47 #include "Teko_LU2x2PreconditionerFactory.hpp"
51 #include "Teko_BlockUpperTriInverseOp.hpp"
54 #include "Teko_LU2x2DiagonalStrategy.hpp"
55 #include "NS/Teko_PCDStrategy.hpp"
73 : invOpsStrategy_(strategy), useFullLDU_(true) {}
76 : invOpsStrategy_(Teuchos::null), useFullLDU_(true) {}
84 Teko_DEBUG_SCOPE(
"LU2x2PreconditionerFactory::buildPreconditionerOperator", 10);
91 return createLU2x2InverseOp(A, hatInvA00, tildeInvA00, invS,
"LU2x2-Full");
93 std::vector<LinearOp> invDiag(2);
94 invDiag[0] = hatInvA00;
95 invDiag[1] = scale(-1.0, invS);
96 return createBlockUpperTriInverseOp(A, invDiag,
"LU2x2-Upper");
113 const Teuchos::ParameterList& settings) {
114 Teko_DEBUG_SCOPE(
"LU2x2PreconditionerFactory::initializeFromParameterList", 10);
118 if (settings.isParameter(
"Use LDU")) useLDU = settings.get<
bool>(
"Use LDU");
122 std::string stratName = settings.get<std::string>(
"Strategy Name");
123 const Teuchos::ParameterList& pl = settings.sublist(
"Strategy Settings");
142 Teko_DEBUG_SCOPE(
"LU2x2PreconditionerFactory::getRequestedParameters", 0);
160 Teko_DEBUG_SCOPE(
"LU2x2PreconditionerFactory::updateRequestedParameters", 0);
184 const std::string& name,
const Teuchos::ParameterList& settings,
185 const RCP<const InverseLibrary>& invLib,
const RCP<RequestHandler>& rh) {
186 Teko_DEBUG_SCOPE(
"LU2x2PreconditionerFactory::buildStrategy", 0);
189 if (strategyBuilder_.cloneCount() == 0) initializeStrategyBuilder();
191 Teko_DEBUG_MSG_BEGIN(1) std::vector<std::string> names;
192 strategyBuilder_.getCloneNames(names);
193 DEBUG_STREAM <<
"Strategy names = ";
194 for (std::size_t i = 0; i < names.size(); i++) DEBUG_STREAM << names[i] <<
", ";
195 DEBUG_STREAM << std::endl;
200 strategy = strategyBuilder_.build(name);
202 if (strategy == Teuchos::null) {
203 Teko_DEBUG_MSG(
"Warning: Could not build LU2x2Strategy named \""
204 << name <<
"\"...pressing on, failure expected",
205 0)
return Teuchos::null;
210 strategy->setRequestHandler(rh);
211 strategy->initializeFromParameterList(settings, *invLib);
230 Teko_DEBUG_SCOPE(
"LU2x2PreconditionerFactory::addStrategy", 10);
233 if (strategyBuilder_.cloneCount() == 0) initializeStrategyBuilder();
236 strategyBuilder_.addClone(name, clone);
240 void LU2x2PreconditionerFactory::initializeStrategyBuilder() {
241 Teko_DEBUG_SCOPE(
"LU2x2PreconditionerFactory::initializeStrategyBuilder", 10);
243 RCP<Cloneable> clone;
247 strategyBuilder_.addClone(
"Diagonal Strategy", clone);
251 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...