47 #include "Teko_LU2x2PreconditionerFactory.hpp"
51 #include "Teko_BlockUpperTriInverseOp.hpp"
54 #include "Teko_LU2x2DiagonalStrategy.hpp"
55 #include "NS/Teko_PCDStrategy.hpp"
69 : invOpsStrategy_(rcp(new
StaticLU2x2Strategy(hatInvA00,tildeInvA00,invS))), useFullLDU_(true)
73 : invOpsStrategy_(strategy), useFullLDU_(true)
77 : invOpsStrategy_(Teuchos::null), useFullLDU_(true)
86 Teko_DEBUG_SCOPE(
"LU2x2PreconditionerFactory::buildPreconditionerOperator",10);
93 return createLU2x2InverseOp(A,hatInvA00,tildeInvA00,invS,
"LU2x2-Full");
95 std::vector<LinearOp> invDiag(2);
96 invDiag[0] = hatInvA00;
97 invDiag[1] = scale(-1.0,invS);
98 return createBlockUpperTriInverseOp(A,invDiag,
"LU2x2-Upper");
116 Teko_DEBUG_SCOPE(
"LU2x2PreconditionerFactory::initializeFromParameterList",10);
120 if(settings.isParameter(
"Use LDU"))
121 useLDU = settings.get<
bool>(
"Use LDU");
125 std::string stratName = settings.get<std::string>(
"Strategy Name");
126 const Teuchos::ParameterList & pl = settings.sublist(
"Strategy Settings");
146 Teko_DEBUG_SCOPE(
"LU2x2PreconditionerFactory::getRequestedParameters",0);
165 Teko_DEBUG_SCOPE(
"LU2x2PreconditionerFactory::updateRequestedParameters",0);
189 const Teuchos::ParameterList & settings,
190 const RCP<const InverseLibrary> & invLib,
191 const RCP<RequestHandler> & rh)
193 Teko_DEBUG_SCOPE(
"LU2x2PreconditionerFactory::buildStrategy",0);
196 if(strategyBuilder_.cloneCount()==0) initializeStrategyBuilder();
198 Teko_DEBUG_MSG_BEGIN(1)
199 std::vector<std::string> names;
200 strategyBuilder_.getCloneNames(names);
201 DEBUG_STREAM <<
"Strategy names = ";
202 for(std::size_t i=0;i<names.size();i++)
203 DEBUG_STREAM << names[i] <<
", ";
204 DEBUG_STREAM << std::endl;
208 RCP<LU2x2Strategy> strategy = strategyBuilder_.build(name);
210 if(strategy==Teuchos::null) {
211 Teko_DEBUG_MSG(
"Warning: Could not build LU2x2Strategy named \""
212 << name <<
"\"...pressing on, failure expected",0)
213 return Teuchos::null;
218 strategy->setRequestHandler(rh);
219 strategy->initializeFromParameterList(settings,*invLib);
239 Teko_DEBUG_SCOPE(
"LU2x2PreconditionerFactory::addStrategy",10);
242 if(strategyBuilder_.cloneCount()==0) initializeStrategyBuilder();
245 strategyBuilder_.addClone(name,clone);
249 void LU2x2PreconditionerFactory::initializeStrategyBuilder()
251 Teko_DEBUG_SCOPE(
"LU2x2PreconditionerFactory::initializeStrategyBuilder",10);
253 RCP<Cloneable> clone;
257 strategyBuilder_.addClone(
"Diagonal Strategy",clone);
261 strategyBuilder_.addClone(
"NS PCD Strategy",clone);
LinearOp buildPreconditionerOperator(BlockedLinearOp &blo, BlockPreconditionerState &state) const
Create the LU 2x2 preconditioner operator.
virtual bool updateRequestedParameters(const Teuchos::ParameterList &pl)
Update this object with the fields from a parameter list.
static RCP< LU2x2Strategy > buildStrategy(const std::string &name, const Teuchos::ParameterList &settings, const RCP< const InverseLibrary > &invLib, const RCP< RequestHandler > &rh)
Builder function for creating strategies.
Teuchos::RCP< LU2x2Strategy > invOpsStrategy_
some members
An implementation of a state object for block preconditioners.
virtual void setFullLDU(bool value)
Set the type of inverse operation to use.
static void addStrategy(const std::string &name, const RCP< Cloneable > &clone)
Add a strategy to the builder. This is done using the clone pattern.
LU2x2PreconditionerFactory()
Default constructor for use with AutoClone.
Teuchos::RCP< const InverseLibrary > getInverseLibrary() const
Get the inverse library used by this preconditioner factory.
virtual bool useFullLDU() const
Determine the type of inverse operator to build.
A simple strategy for use with LU2x2PreconditionerFactory, that offers static objects for inv(F) and ...
Teuchos::RCP< RequestHandler > getRequestHandler() const
Get the request handler with pointers to the appropriate callbacks.
virtual Teuchos::RCP< Teuchos::ParameterList > getRequestedParameters() const
Request the additional parameters this preconditioner factory needs.
virtual void initializeFromParameterList(const Teuchos::ParameterList &settings)
This function builds the internals of the preconditioner factory from a parameter list...