47 #include "Teko_LU2x2DiagonalStrategy.hpp"
49 #include "Teuchos_TimeMonitor.hpp"
53 using Teuchos::TimeMonitor;
55 Teuchos::RCP<Teuchos::Time> LU2x2DiagonalStrategy::initTimer_;
56 Teuchos::RCP<Teuchos::Time> LU2x2DiagonalStrategy::invSTimer_;
57 Teuchos::RCP<Teuchos::Time> LU2x2DiagonalStrategy::invA00Timer_;
58 Teuchos::RCP<Teuchos::Time> LU2x2DiagonalStrategy::opsTimer_;
62 if(initTimer_==Teuchos::null)
63 initTimer_ = TimeMonitor::getNewTimer(
"LU2x2DiagonalStrategy::initializePrec");
65 if(invSTimer_==Teuchos::null)
66 invSTimer_ = TimeMonitor::getNewTimer(
"LU2x2DiagonalStrategy::initializePrec invS");
68 if(invA00Timer_==Teuchos::null)
69 invA00Timer_ = TimeMonitor::getNewTimer(
"LU2x2DiagonalStrategy::initializePrec invA00");
71 if(opsTimer_==Teuchos::null)
72 opsTimer_ = TimeMonitor::getNewTimer(
"LU2x2DiagonalStrategy::initializePrec buildOps");
76 : a00InverseType_(Diagonal)
83 const Teuchos::RCP<InverseFactory> & invS)
84 : invFactoryA00_(invFA), invFactoryS_(invS), a00InverseType_(Diagonal)
118 Teko_DEBUG_SCOPE(
"LU2x2DiagonalStrategy::initializeState",10);
124 Teuchos::TimeMonitor timer(*initTimer_,
true);
127 LinearOp A00 = Teko::getBlock(0,0,A);
128 LinearOp A01 = Teko::getBlock(0,1,A);
129 LinearOp A10 = Teko::getBlock(1,0,A);
130 LinearOp A11 = Teko::getBlock(1,1,A);
136 Teko_DEBUG_SCOPE(
"Building S",5);
137 Teuchos::TimeMonitor timer(*opsTimer_,
true);
139 LinearOp diagA00 = getInvDiagonalOp(A00,a00InverseType_);
143 triple = explicitMultiply(A10,diagA00,A01,triple);
144 S = explicitAdd(scale(-1.0,A11),triple,S);
150 Teko_DEBUG_SCOPE(
"Building inverse(S)",5);
151 Teuchos::TimeMonitor timer(*invSTimer_,
true);
154 if(invS==Teuchos::null)
163 Teko_DEBUG_SCOPE(
"Building inverse(A00)",5);
164 Teuchos::TimeMonitor timer(*invA00Timer_,
true);
167 *getOutputStream() <<
"(LU2x2) invA00 pointer = " << invA00 << std::endl;
168 if(invA00==Teuchos::null)
190 const InverseLibrary & invLib)
192 Teko_DEBUG_SCOPE(
"LU2x2DiagonalStrategy::initializeFromParameterList",10);
194 std::string invStr=
"Amesos", invA00Str=
"", invSStr=
"";
197 if(pl.isParameter(
"Inverse Type"))
198 invStr = pl.get<std::string>(
"Inverse Type");
199 if(pl.isParameter(
"Inverse A00 Type"))
200 invA00Str = pl.get<std::string>(
"Inverse A00 Type");
201 if(pl.isParameter(
"Inverse Schur Type"))
202 invSStr = pl.get<std::string>(
"Inverse Schur Type");
203 if(pl.isParameter(
"Diagonal Type")) {
204 std::string massInverseStr = pl.get<std::string>(
"Diagonal Type");
207 a00InverseType_ = getDiagonalType(massInverseStr);
211 if(invA00Str==
"") invA00Str = invStr;
212 if(invSStr==
"") invSStr = invStr;
214 Teko_DEBUG_MSG_BEGIN(5)
215 DEBUG_STREAM <<
"LU2x2 Diagonal Strategy Parameters: " << std::endl;
216 DEBUG_STREAM <<
" inv type = \"" << invStr <<
"\"" << std::endl;
217 DEBUG_STREAM <<
" inv A00 type = \"" << invA00Str <<
"\"" << std::endl;
218 DEBUG_STREAM <<
" inv S type = \"" << invSStr <<
"\"" << std::endl;
219 DEBUG_STREAM <<
"LU2x2 Diagonal Strategy Parameter list: " << std::endl;
220 pl.print(DEBUG_STREAM);
224 invFactoryA00_ = invLib.getInverseFactory(invA00Str);
226 if(invA00Str==invSStr)
227 invFactoryS_ = invFactoryA00_;
229 invFactoryS_ = invLib.getInverseFactory(invSStr);
void rebuildInverse(const InverseFactory &factory, const LinearOp &A, InverseLinearOp &invA)
virtual const Teko::LinearOp getTildeInvA00(const Teko::BlockedLinearOp &A, BlockPreconditionerState &state) const
LU2x2DiagonalStrategy()
default Constructor
An implementation of a state object for block preconditioners.
void initializeState(const Teko::BlockedLinearOp &A, BlockPreconditionerState &state) const
virtual bool isInitialized() const
static void buildTimers()
virtual const Teko::LinearOp getHatInvA00(const Teko::BlockedLinearOp &A, BlockPreconditionerState &state) const
virtual const Teko::LinearOp getInvS(const Teko::BlockedLinearOp &A, BlockPreconditionerState &state) const
InverseLinearOp buildInverse(const InverseFactory &factory, const LinearOp &A)
Build an inverse operator using a factory and a linear operator.
virtual void initializeFromParameterList(const Teuchos::ParameterList &settings, const InverseLibrary &invLib)
This function builds the internals of the state from a parameter list.
virtual void setInitialized(bool init=true)
virtual Teko::ModifiableLinearOp & getModifiableOp(const std::string &name)
Add a named operator to the state object.