10#ifndef STRATIMIKOS_LINEAR_SOLVER_BUILDING_BASE
11#define STRATIMIKOS_LINEAR_SOLVER_BUILDING_BASE
13#include "Stratimikos_ConfigDefs.hpp"
14#include "Thyra_LinearSolverBuilderBase.hpp"
15#include "Teuchos_AbstractFactory.hpp"
16#include "Teuchos_StandardMemberCompositionMacros.hpp"
17#include "Teuchos_StandardParameterEntryValidators.hpp"
20#include "Thyra_LinearOpWithSolveFactoryHelpers.hpp"
21#include "Thyra_LinearOpWithSolveBase.hpp"
22#include "Thyra_PreconditionerFactoryHelpers.hpp"
23#include "Thyra_DefaultScaledAdjointLinearOp.hpp"
24#include "Thyra_DefaultPreconditioner.hpp"
25#include "Thyra_MultiVectorStdOps.hpp"
26#include "Thyra_VectorStdOps.hpp"
27#include "Thyra_VectorBase.hpp"
30namespace Teuchos {
class CommandLineProcessor; }
33namespace Stratimikos {
41using Teuchos::AbstractFactory;
43using Teuchos::ParameterList;
82template <
class Scalar =
double>
84 :
public Thyra::LinearSolverBuilderBase<Scalar>
99 const std::string ¶msXmlFileName =
"",
100 const std::string &extraParamsXmlString =
"",
101 const std::string ¶msUsedXmlOutFileName =
"",
102 const std::string ¶msXmlFileNameOption =
"linear-solver-params-file",
103 const std::string &extraParamsXmlStringOption =
"extra-linear-solver-params",
104 const std::string ¶msUsedXmlOutFileNameOption =
"linear-solver-params-used-file",
105 const bool &replaceDuplicateFactories =
true
148 const RCP<
const AbstractFactory<Thyra::LinearOpWithSolveFactoryBase<Scalar> > >
149 &solveStrategyFactory,
150 const std::string &solveStrategyName,
151 const bool makeDefault =
false
156 const std::string &solveStrategyName);
160 const RCP<
const AbstractFactory<Thyra::PreconditionerFactoryBase<Scalar> > >
161 &precStrategyFactory,
162 const std::string &precStrategyName,
163 const bool makeDefault =
false
168 const std::string &precStrategyName);
186 void setupCLP( Teuchos::CommandLineProcessor *clp );
224 const Thyra::LinearOpWithSolveFactoryBase<Scalar> &lowsFactory,
225 const std::string &outputXmlFileName =
""
260 RCP<Thyra::LinearOpWithSolveFactoryBase<Scalar> >
262 const std::string &linearSolveStrategyName
265 RCP<Thyra::PreconditionerFactoryBase<Scalar> >
267 const std::string &preconditioningStrategyName
277 typedef RCP<const AbstractFactory<Thyra::LinearOpWithSolveFactoryBase<Scalar> > >
279 typedef RCP<const AbstractFactory<Thyra::PreconditionerFactoryBase<Scalar> > >
285 RCP<ParameterList> paramList_;
286 Array<std::string> validLowsfNames_;
287 Array<lowsf_fcty_t> lowsfArray_;
288 std::string defaultLOWSF_;
289 Array<std::string> validPfNames_;
290 Array<pf_fcty_t> pfArray_;
291 std::string defaultPF_;
292 bool enableDelayedSolverConstruction_;
293 mutable RCP<const ParameterList> validParamList_;
294 mutable RCP<const Teuchos::StringToIntegralParameterEntryValidator<int> > lowsfValidator_;
295 mutable RCP<const Teuchos::StringToIntegralParameterEntryValidator<int> > pfValidator_;
300 void initializeDefaults();
301 void justInTimeInitialize()
const;
303 int getAndAssertExistingFactoryNameIdx(
const std::string &setFunctionName,
304 const Teuchos::ArrayView<std::string> namesArray,
const std::string &name)
const;
309namespace LinearSolverBuilderHelpers {
319int existingNameIndex(
320 const Teuchos::ArrayView<std::string> namesArray,
const std::string &name);
Concrete subclass of Thyra::LinearSolverBuilderBase for creating Thyra::LinearOpWithSolveFactoryBase ...
void setLinearSolveStrategyFactory(const RCP< const AbstractFactory< Thyra::LinearOpWithSolveFactoryBase< Scalar > > > &solveStrategyFactory, const std::string &solveStrategyName, const bool makeDefault=false)
Set a new linear solver strategy factory object.
RCP< Thyra::PreconditionerFactoryBase< Scalar > > createPreconditioningStrategy(const std::string &preconditioningStrategyName) const
STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string, extraParamsXmlString)
An XML string that will be used to update the parameters (if not "").
RCP< const ParameterList > getParameterList() const
std::string getLinearSolveStrategyName() const
Get the name of the linear solver strategy that will be created on the next call to this->createLinea...
void setDefaultPreconditioningStrategyFactoryName(const std::string &precStrategyName)
Set the default linear solver factory name.
STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string, extraParamsXmlStringOption)
The name of the option that will be added the the commandline processor that will set extraParamsXmlS...
STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string, paramsXmlFileNameOption)
The name of the option that will be added the the commandline processor that will set paramsXmlFileNa...
RCP< const ParameterList > getValidParameters() const
STANDARD_MEMBER_COMPOSITION_MEMBERS(bool, replaceDuplicateFactories)
Determines if duplicate registered factories are replaced or if an exception is thrown.
STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string, paramsUsedXmlOutFileName)
The name of an XML file that will be written (if not "") for the parameters actually used.
RCP< Thyra::LinearOpWithSolveFactoryBase< Scalar > > createLinearSolveStrategy(const std::string &linearSolveStrategyName) const
std::string getPreconditionerStrategyName() const
Get the name of the preconditioner strategy that will be created on the next call to this->createPrec...
void setParameterList(RCP< ParameterList > const ¶mList)
void setDefaultLinearSolveStrategyFactoryName(const std::string &solveStrategyName)
Set the default linear solver factory name.
void setupCLP(Teuchos::CommandLineProcessor *clp)
Setup the command-line processor to read in the needed data to extra the parameters from.
RCP< ParameterList > getNonconstParameterList()
void readParameters(std::ostream *out)
Force the parameters to be read from a file and/or an extra XML string.
STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string, paramsUsedXmlOutFileNameOption)
The name of the option that will be added the the commandline processor that will set paramsUsedXmlOu...
void setPreconditioningStrategyFactory(const RCP< const AbstractFactory< Thyra::PreconditionerFactoryBase< Scalar > > > &precStrategyFactory, const std::string &precStrategyName, const bool makeDefault=false)
Set a new preconditioner strategy factory object.
RCP< ParameterList > unsetParameterList()
void writeParamsFile(const Thyra::LinearOpWithSolveFactoryBase< Scalar > &lowsFactory, const std::string &outputXmlFileName="") const
Write the parameters list for a LinearOpWithSolveFactoryBase object to a file after the parameters ar...
STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string, paramsXmlFileName)
The name an XML file that will be read to get XML parameters (if not "").