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#ifdef HAVE_STRATIMIKOS_THYRAEPETRAADAPTERS
21#include "Thyra_EpetraThyraWrappers.hpp"
22#include "Thyra_EpetraLinearOp.hpp"
24#include "Thyra_LinearOpWithSolveFactoryHelpers.hpp"
25#include "Thyra_LinearOpWithSolveBase.hpp"
26#include "Thyra_PreconditionerFactoryHelpers.hpp"
27#include "Thyra_DefaultScaledAdjointLinearOp.hpp"
28#include "Thyra_DefaultPreconditioner.hpp"
29#include "Thyra_MultiVectorStdOps.hpp"
30#include "Thyra_VectorStdOps.hpp"
31#include "Thyra_VectorBase.hpp"
34namespace Teuchos {
class CommandLineProcessor; }
37namespace Stratimikos {
45using Teuchos::AbstractFactory;
47using Teuchos::ParameterList;
86template <
class Scalar =
double>
88 :
public Thyra::LinearSolverBuilderBase<Scalar>
103 const std::string ¶msXmlFileName =
"",
104 const std::string &extraParamsXmlString =
"",
105 const std::string ¶msUsedXmlOutFileName =
"",
106 const std::string ¶msXmlFileNameOption =
"linear-solver-params-file",
107 const std::string &extraParamsXmlStringOption =
"extra-linear-solver-params",
108 const std::string ¶msUsedXmlOutFileNameOption =
"linear-solver-params-used-file",
109 const bool &replaceDuplicateFactories =
true
152 const RCP<
const AbstractFactory<Thyra::LinearOpWithSolveFactoryBase<Scalar> > >
153 &solveStrategyFactory,
154 const std::string &solveStrategyName,
155 const bool makeDefault =
false
160 const std::string &solveStrategyName);
164 const RCP<
const AbstractFactory<Thyra::PreconditionerFactoryBase<Scalar> > >
165 &precStrategyFactory,
166 const std::string &precStrategyName,
167 const bool makeDefault =
false
172 const std::string &precStrategyName);
190 void setupCLP( Teuchos::CommandLineProcessor *clp );
228 const Thyra::LinearOpWithSolveFactoryBase<Scalar> &lowsFactory,
229 const std::string &outputXmlFileName =
""
264 RCP<Thyra::LinearOpWithSolveFactoryBase<Scalar> >
266 const std::string &linearSolveStrategyName
269 RCP<Thyra::PreconditionerFactoryBase<Scalar> >
271 const std::string &preconditioningStrategyName
281 typedef RCP<const AbstractFactory<Thyra::LinearOpWithSolveFactoryBase<Scalar> > >
283 typedef RCP<const AbstractFactory<Thyra::PreconditionerFactoryBase<Scalar> > >
289 RCP<ParameterList> paramList_;
290 Array<std::string> validLowsfNames_;
291 Array<lowsf_fcty_t> lowsfArray_;
292 std::string defaultLOWSF_;
293 Array<std::string> validPfNames_;
294 Array<pf_fcty_t> pfArray_;
295 std::string defaultPF_;
296 bool enableDelayedSolverConstruction_;
297 mutable RCP<const ParameterList> validParamList_;
298 mutable RCP<const Teuchos::StringToIntegralParameterEntryValidator<int> > lowsfValidator_;
299 mutable RCP<const Teuchos::StringToIntegralParameterEntryValidator<int> > pfValidator_;
304 void initializeDefaults();
305 void justInTimeInitialize()
const;
307 int getAndAssertExistingFactoryNameIdx(
const std::string &setFunctionName,
308 const Teuchos::ArrayView<std::string> namesArray,
const std::string &name)
const;
313namespace LinearSolverBuilderHelpers {
323int existingNameIndex(
324 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 "").