42#ifndef STRATIMIKOS_LINEAR_SOLVER_BUILDING_BASE
43#define STRATIMIKOS_LINEAR_SOLVER_BUILDING_BASE
45#include "Stratimikos_ConfigDefs.hpp"
46#include "Thyra_LinearSolverBuilderBase.hpp"
47#include "Teuchos_AbstractFactory.hpp"
48#include "Teuchos_StandardMemberCompositionMacros.hpp"
49#include "Teuchos_StandardParameterEntryValidators.hpp"
52#ifdef HAVE_STRATIMIKOS_THYRAEPETRAADAPTERS
53#include "Thyra_EpetraThyraWrappers.hpp"
54#include "Thyra_EpetraLinearOp.hpp"
56#include "Thyra_LinearOpWithSolveFactoryHelpers.hpp"
57#include "Thyra_LinearOpWithSolveBase.hpp"
58#include "Thyra_PreconditionerFactoryHelpers.hpp"
59#include "Thyra_DefaultScaledAdjointLinearOp.hpp"
60#include "Thyra_DefaultPreconditioner.hpp"
61#include "Thyra_MultiVectorStdOps.hpp"
62#include "Thyra_VectorStdOps.hpp"
63#include "Thyra_VectorBase.hpp"
66namespace Teuchos {
class CommandLineProcessor; }
69namespace Stratimikos {
77using Teuchos::AbstractFactory;
79using Teuchos::ParameterList;
118template <
class Scalar =
double>
120 :
public Thyra::LinearSolverBuilderBase<Scalar>
135 const std::string ¶msXmlFileName =
""
136 ,
const std::string &extraParamsXmlString =
""
137 ,
const std::string ¶msUsedXmlOutFileName =
""
138 ,
const std::string ¶msXmlFileNameOption =
"linear-solver-params-file"
139 ,
const std::string &extraParamsXmlStringOption =
"extra-linear-solver-params"
140 ,
const std::string ¶msUsedXmlOutFileNameOption =
"linear-solver-params-used-file"
178 const RCP<
const AbstractFactory<Thyra::LinearOpWithSolveFactoryBase<Scalar> > >
179 &solveStrategyFactory,
180 const std::string &solveStrategyName,
181 const bool makeDefault =
false
186 const std::string &solveStrategyName);
190 const RCP<
const AbstractFactory<Thyra::PreconditionerFactoryBase<Scalar> > >
191 &precStrategyFactory,
192 const std::string &precStrategyName,
193 const bool makeDefault =
false
198 const std::string &precStrategyName);
216 void setupCLP( Teuchos::CommandLineProcessor *clp );
254 const Thyra::LinearOpWithSolveFactoryBase<Scalar> &lowsFactory,
255 const std::string &outputXmlFileName =
""
290 RCP<Thyra::LinearOpWithSolveFactoryBase<Scalar> >
292 const std::string &linearSolveStrategyName
295 RCP<Thyra::PreconditionerFactoryBase<Scalar> >
297 const std::string &preconditioningStrategyName
307 typedef RCP<const AbstractFactory<Thyra::LinearOpWithSolveFactoryBase<Scalar> > >
309 typedef RCP<const AbstractFactory<Thyra::PreconditionerFactoryBase<Scalar> > >
315 RCP<ParameterList> paramList_;
316 Array<std::string> validLowsfNames_;
317 Array<lowsf_fcty_t> lowsfArray_;
318 std::string defaultLOWSF_;
319 Array<std::string> validPfNames_;
320 Array<pf_fcty_t> pfArray_;
321 std::string defaultPF_;
322 bool enableDelayedSolverConstruction_;
323 mutable RCP<const ParameterList> validParamList_;
324 mutable RCP<const Teuchos::StringToIntegralParameterEntryValidator<int> > lowsfValidator_;
325 mutable RCP<const Teuchos::StringToIntegralParameterEntryValidator<int> > pfValidator_;
330 void initializeDefaults();
331 void justInTimeInitialize()
const;
Concrete subclass of Thyra::LinearSolverBuilderBase for creating LinearOpWithSolveFactoryBase objects...
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(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 "").