10 #include "Teko_LU2x2PreconditionerFactory.hpp"
14 #include "Teko_BlockUpperTriInverseOp.hpp"
17 #include "Teko_LU2x2DiagonalStrategy.hpp"
18 #include "NS/Teko_PCDStrategy.hpp"
36 : invOpsStrategy_(strategy), useFullLDU_(true) {}
39 : invOpsStrategy_(Teuchos::null), useFullLDU_(true) {}
47 Teko_DEBUG_SCOPE(
"LU2x2PreconditionerFactory::buildPreconditionerOperator", 10);
54 return createLU2x2InverseOp(A, hatInvA00, tildeInvA00, invS,
"LU2x2-Full");
56 std::vector<LinearOp> invDiag(2);
57 invDiag[0] = hatInvA00;
58 invDiag[1] = scale(-1.0, invS);
59 return createBlockUpperTriInverseOp(A, invDiag,
"LU2x2-Upper");
76 const Teuchos::ParameterList& settings) {
77 Teko_DEBUG_SCOPE(
"LU2x2PreconditionerFactory::initializeFromParameterList", 10);
81 if (settings.isParameter(
"Use LDU")) useLDU = settings.get<
bool>(
"Use LDU");
85 std::string stratName = settings.get<std::string>(
"Strategy Name");
86 const Teuchos::ParameterList& pl = settings.sublist(
"Strategy Settings");
105 Teko_DEBUG_SCOPE(
"LU2x2PreconditionerFactory::getRequestedParameters", 0);
123 Teko_DEBUG_SCOPE(
"LU2x2PreconditionerFactory::updateRequestedParameters", 0);
147 const std::string& name,
const Teuchos::ParameterList& settings,
148 const RCP<const InverseLibrary>& invLib,
const RCP<RequestHandler>& rh) {
149 Teko_DEBUG_SCOPE(
"LU2x2PreconditionerFactory::buildStrategy", 0);
152 if (strategyBuilder_.cloneCount() == 0) initializeStrategyBuilder();
154 Teko_DEBUG_MSG_BEGIN(1) std::vector<std::string> names;
155 strategyBuilder_.getCloneNames(names);
156 DEBUG_STREAM <<
"Strategy names = ";
157 for (std::size_t i = 0; i < names.size(); i++) DEBUG_STREAM << names[i] <<
", ";
158 DEBUG_STREAM << std::endl;
163 strategy = strategyBuilder_.build(name);
165 if (strategy == Teuchos::null) {
166 Teko_DEBUG_MSG(
"Warning: Could not build LU2x2Strategy named \""
167 << name <<
"\"...pressing on, failure expected",
168 0)
return Teuchos::null;
173 strategy->setRequestHandler(rh);
174 strategy->initializeFromParameterList(settings, *invLib);
193 Teko_DEBUG_SCOPE(
"LU2x2PreconditionerFactory::addStrategy", 10);
196 if (strategyBuilder_.cloneCount() == 0) initializeStrategyBuilder();
199 strategyBuilder_.addClone(name, clone);
203 void LU2x2PreconditionerFactory::initializeStrategyBuilder() {
204 Teko_DEBUG_SCOPE(
"LU2x2PreconditionerFactory::initializeStrategyBuilder", 10);
206 RCP<Cloneable> clone;
210 strategyBuilder_.addClone(
"Diagonal Strategy", clone);
214 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...