Stratimikos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Private Types | Private Member Functions | Private Attributes | List of all members
Stratimikos::LinearSolverBuilder< Scalar > Class Template Reference

Concrete subclass of Thyra::LinearSolverBuilderBase for creating Thyra::LinearOpWithSolveFactoryBase objects and Thyra::PreconditionerFactoryBase objects on demand for various Trilinos linear solver and preconditioner packages. More...

#include <Stratimikos_LinearSolverBuilder_decl.hpp>

Inherits LinearSolverBuilderBase< Scalar >.

Private Types

typedef RCP< const
AbstractFactory
< Thyra::LinearOpWithSolveFactoryBase
< Scalar > > > 
lowsf_fcty_t
 
typedef RCP< const
AbstractFactory
< Thyra::PreconditionerFactoryBase
< Scalar > > > 
pf_fcty_t
 

Private Member Functions

void initializeDefaults ()
 
void justInTimeInitialize () const
 
int getAndAssertExistingFactoryNameIdx (const std::string &setFunctionName, const Teuchos::ArrayView< std::string > namesArray, const std::string &name) const
 
template<>
void initializeDefaults ()
 

Private Attributes

RCP< ParameterListparamList_
 
Array< std::string > validLowsfNames_
 
Array< lowsf_fcty_tlowsfArray_
 
std::string defaultLOWSF_
 
Array< std::string > validPfNames_
 
Array< pf_fcty_tpfArray_
 
std::string defaultPF_
 
bool enableDelayedSolverConstruction_
 
RCP< const ParameterListvalidParamList_
 
RCP< const
Teuchos::StringToIntegralParameterEntryValidator
< int > > 
lowsfValidator_
 
RCP< const
Teuchos::StringToIntegralParameterEntryValidator
< int > > 
pfValidator_
 

Constructors/Initializers/Accessors

 LinearSolverBuilder (const std::string &paramsXmlFileName="", const std::string &extraParamsXmlString="", const std::string &paramsUsedXmlOutFileName="", const std::string &paramsXmlFileNameOption="linear-solver-params-file", const std::string &extraParamsXmlStringOption="extra-linear-solver-params", const std::string &paramsUsedXmlOutFileNameOption="linear-solver-params-used-file", const bool &replaceDuplicateFactories=true)
 Construct with default parameters. More...
 
 ~LinearSolverBuilder ()
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, paramsXmlFileName)
 The name an XML file that will be read to get XML parameters (if not ""). More...
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, extraParamsXmlString)
 An XML string that will be used to update the parameters (if not ""). More...
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, paramsUsedXmlOutFileName)
 The name of an XML file that will be written (if not "") for the parameters actually used. More...
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, paramsXmlFileNameOption)
 The name of the option that will be added the the commandline processor that will set paramsXmlFileName() . More...
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, extraParamsXmlStringOption)
 The name of the option that will be added the the commandline processor that will set extraParamsXmlString() . More...
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, paramsUsedXmlOutFileNameOption)
 The name of the option that will be added the the commandline processor that will set paramsUsedXmlOutFileName() . More...
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (bool, replaceDuplicateFactories)
 Determines if duplicate registered factories are replaced or if an exception is thrown. More...
 
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. More...
 
void setDefaultLinearSolveStrategyFactoryName (const std::string &solveStrategyName)
 Set the default linear solver factory name. More...
 
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. More...
 
void setDefaultPreconditioningStrategyFactoryName (const std::string &precStrategyName)
 Set the default linear solver factory name. More...
 
void setupCLP (Teuchos::CommandLineProcessor *clp)
 Setup the command-line processor to read in the needed data to extra the parameters from. More...
 
void readParameters (std::ostream *out)
 Force the parameters to be read from a file and/or an extra XML string. More...
 
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 are read in order to show defaults and create a new list for input the next time. More...
 
std::string getLinearSolveStrategyName () const
 Get the name of the linear solver strategy that will be created on the next call to this->createLinearSolverStrategy(). More...
 
std::string getPreconditionerStrategyName () const
 Get the name of the preconditioner strategy that will be created on the next call to this->createPreconditioningStrategy(). More...
 

Overridden from ParameterListAcceptor

void setParameterList (RCP< ParameterList > const &paramList)
 
RCP< ParameterListgetNonconstParameterList ()
 
RCP< ParameterListunsetParameterList ()
 
RCP< const ParameterListgetParameterList () const
 
RCP< const ParameterListgetValidParameters () const
 

Overridden from LinearSolverBuilderBase.

RCP
< Thyra::LinearOpWithSolveFactoryBase
< Scalar > > 
createLinearSolveStrategy (const std::string &linearSolveStrategyName) const
 
RCP
< Thyra::PreconditionerFactoryBase
< Scalar > > 
createPreconditioningStrategy (const std::string &preconditioningStrategyName) const
 

Detailed Description

template<class Scalar = double>
class Stratimikos::LinearSolverBuilder< Scalar >

Concrete subclass of Thyra::LinearSolverBuilderBase for creating Thyra::LinearOpWithSolveFactoryBase objects and Thyra::PreconditionerFactoryBase objects on demand for various Trilinos linear solver and preconditioner packages.

For an example of how to use this class see simple_stratimikos_example.cpp.

A hierarchical list of all valid parameters is given below:


Examples:
MixedOrderPhysicsBasedPreconditioner.cpp, and simple_stratimikos_example.cpp.

Definition at line 87 of file Stratimikos_LinearSolverBuilder_decl.hpp.

Member Typedef Documentation

template<class Scalar = double>
typedef RCP<const AbstractFactory<Thyra::LinearOpWithSolveFactoryBase<Scalar> > > Stratimikos::LinearSolverBuilder< Scalar >::lowsf_fcty_t
private

Definition at line 282 of file Stratimikos_LinearSolverBuilder_decl.hpp.

template<class Scalar = double>
typedef RCP<const AbstractFactory<Thyra::PreconditionerFactoryBase<Scalar> > > Stratimikos::LinearSolverBuilder< Scalar >::pf_fcty_t
private

Definition at line 284 of file Stratimikos_LinearSolverBuilder_decl.hpp.

Constructor & Destructor Documentation

template<class Scalar >
Stratimikos::LinearSolverBuilder< Scalar >::LinearSolverBuilder ( const std::string &  paramsXmlFileName = "",
const std::string &  extraParamsXmlString = "",
const std::string &  paramsUsedXmlOutFileName = "",
const std::string &  paramsXmlFileNameOption = "linear-solver-params-file",
const std::string &  extraParamsXmlStringOption = "extra-linear-solver-params",
const std::string &  paramsUsedXmlOutFileNameOption = "linear-solver-params-used-file",
const bool &  replaceDuplicateFactories = true 
)

Construct with default parameters.

Warning! Do not change the defaults by passing then into this constructor. Instead, use the member functions to set them after *this is constructed. This will help to avoid problems with updates to the ordering of the arguments.

Definition at line 68 of file Stratimikos_LinearSolverBuilder_def.hpp.

template<class Scalar >
Stratimikos::LinearSolverBuilder< Scalar >::~LinearSolverBuilder ( )

Definition at line 91 of file Stratimikos_LinearSolverBuilder_def.hpp.

Member Function Documentation

template<class Scalar = double>
Stratimikos::LinearSolverBuilder< Scalar >::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
paramsXmlFileName   
)

The name an XML file that will be read to get XML parameters (if not "").

template<class Scalar = double>
Stratimikos::LinearSolverBuilder< Scalar >::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
extraParamsXmlString   
)

An XML string that will be used to update the parameters (if not "").

template<class Scalar = double>
Stratimikos::LinearSolverBuilder< Scalar >::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
paramsUsedXmlOutFileName   
)

The name of an XML file that will be written (if not "") for the parameters actually used.

template<class Scalar = double>
Stratimikos::LinearSolverBuilder< Scalar >::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
paramsXmlFileNameOption   
)

The name of the option that will be added the the commandline processor that will set paramsXmlFileName() .

template<class Scalar = double>
Stratimikos::LinearSolverBuilder< Scalar >::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
extraParamsXmlStringOption   
)

The name of the option that will be added the the commandline processor that will set extraParamsXmlString() .

template<class Scalar = double>
Stratimikos::LinearSolverBuilder< Scalar >::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
paramsUsedXmlOutFileNameOption   
)

The name of the option that will be added the the commandline processor that will set paramsUsedXmlOutFileName() .

template<class Scalar = double>
Stratimikos::LinearSolverBuilder< Scalar >::STANDARD_MEMBER_COMPOSITION_MEMBERS ( bool  ,
replaceDuplicateFactories   
)

Determines if duplicate registered factories are replaced or if an exception is thrown.

template<class Scalar >
void Stratimikos::LinearSolverBuilder< Scalar >::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.

Definition at line 103 of file Stratimikos_LinearSolverBuilder_def.hpp.

template<class Scalar >
void Stratimikos::LinearSolverBuilder< Scalar >::setDefaultLinearSolveStrategyFactoryName ( const std::string &  solveStrategyName)

Set the default linear solver factory name.

Definition at line 129 of file Stratimikos_LinearSolverBuilder_def.hpp.

template<class Scalar = double>
void Stratimikos::LinearSolverBuilder< Scalar >::setPreconditioningStrategyFactory ( const RCP< const AbstractFactory< Thyra::PreconditionerFactoryBase< Scalar > > > &  precStrategyFactory,
const std::string &  precStrategyName,
const bool  makeDefault = false 
)

Set a new preconditioner strategy factory object.

Definition at line 137 of file Stratimikos_LinearSolverBuilder_def.hpp.

template<class Scalar >
void Stratimikos::LinearSolverBuilder< Scalar >::setDefaultPreconditioningStrategyFactoryName ( const std::string &  precStrategyName)

Set the default linear solver factory name.

Definition at line 163 of file Stratimikos_LinearSolverBuilder_def.hpp.

template<class Scalar >
void Stratimikos::LinearSolverBuilder< Scalar >::setupCLP ( Teuchos::CommandLineProcessor clp)

Setup the command-line processor to read in the needed data to extra the parameters from.

Command-line options with names this->paramsXmlFileNameOption(), this->extraParamsXmlStringOption(), and this->paramsUsedXmlOutFileNameOption() will be set if they are not empty.

Then, when cpl->parse(...) is called, then the options set will be read into this->paramsXmlFileName(), this->extraParamsXmlString(), and this->paramsUsedXmlOutFileName().

After this function is called, this->readParameters() can be called to actually read in the parameters and fill the parameter list.

Examples:
simple_stratimikos_example.cpp.

Definition at line 171 of file Stratimikos_LinearSolverBuilder_def.hpp.

template<class Scalar >
void Stratimikos::LinearSolverBuilder< Scalar >::readParameters ( std::ostream *  out)

Force the parameters to be read from a file and/or an extra XML string.

First, if this->getParameterList().get()==NULL and new parameter list will be created.

Second, if this->paramsXmlFileName()!="" then the file this->paramsXmlFileName() will be read to get XML parameters append/update those already in the parameter list.

Third, if this->extraParamsXmlString()!="" then the XML string this->extraParamsXmlString() will be read and used to append/update the parameters already in the parameter list..

Postconditions:

Examples:
simple_stratimikos_example.cpp.

Definition at line 192 of file Stratimikos_LinearSolverBuilder_def.hpp.

template<class Scalar >
void Stratimikos::LinearSolverBuilder< Scalar >::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 are read in order to show defaults and create a new list for input the next time.

If outputXmlFileName!="" then the parameter list with be written to the file outputXmlFileName in XML format. If outputXmlFileName=="", but this->paramsUsedXmlOutFileNameOption()!="" then the parameter list will be written to the file this->paramsUsedXmlOutFileNameOption(). If both outputXmlFileName=="" and this->paramsUsedXmlOutFileNameOption()=="" then no file is written.

Examples:
simple_stratimikos_example.cpp.

Definition at line 222 of file Stratimikos_LinearSolverBuilder_def.hpp.

template<class Scalar >
std::string Stratimikos::LinearSolverBuilder< Scalar >::getLinearSolveStrategyName ( ) const

Get the name of the linear solver strategy that will be created on the next call to this->createLinearSolverStrategy().

Definition at line 238 of file Stratimikos_LinearSolverBuilder_def.hpp.

template<class Scalar >
std::string Stratimikos::LinearSolverBuilder< Scalar >::getPreconditionerStrategyName ( ) const

Get the name of the preconditioner strategy that will be created on the next call to this->createPreconditioningStrategy().

Definition at line 248 of file Stratimikos_LinearSolverBuilder_def.hpp.

template<class Scalar >
void Stratimikos::LinearSolverBuilder< Scalar >::setParameterList ( RCP< ParameterList > const &  paramList)
template<class Scalar >
RCP< Teuchos::ParameterList > Stratimikos::LinearSolverBuilder< Scalar >::getNonconstParameterList ( )
template<class Scalar >
RCP< Teuchos::ParameterList > Stratimikos::LinearSolverBuilder< Scalar >::unsetParameterList ( )

Definition at line 282 of file Stratimikos_LinearSolverBuilder_def.hpp.

template<class Scalar >
RCP< const Teuchos::ParameterList > Stratimikos::LinearSolverBuilder< Scalar >::getParameterList ( ) const

Definition at line 292 of file Stratimikos_LinearSolverBuilder_def.hpp.

template<class Scalar >
RCP< const Teuchos::ParameterList > Stratimikos::LinearSolverBuilder< Scalar >::getValidParameters ( ) const
template<class Scalar >
RCP< Thyra::LinearOpWithSolveFactoryBase< Scalar > > Stratimikos::LinearSolverBuilder< Scalar >::createLinearSolveStrategy ( const std::string &  linearSolveStrategyName) const
template<class Scalar >
RCP< Thyra::PreconditionerFactoryBase< Scalar > > Stratimikos::LinearSolverBuilder< Scalar >::createPreconditioningStrategy ( const std::string &  preconditioningStrategyName) const

Definition at line 449 of file Stratimikos_LinearSolverBuilder_def.hpp.

template<class Scalar >
void Stratimikos::LinearSolverBuilder< Scalar >::initializeDefaults ( )
private

Definition at line 480 of file Stratimikos_LinearSolverBuilder_def.hpp.

template<class Scalar >
void Stratimikos::LinearSolverBuilder< Scalar >::justInTimeInitialize ( ) const
private

Definition at line 617 of file Stratimikos_LinearSolverBuilder_def.hpp.

template<class Scalar >
int Stratimikos::LinearSolverBuilder< Scalar >::getAndAssertExistingFactoryNameIdx ( const std::string &  setFunctionName,
const Teuchos::ArrayView< std::string >  namesArray,
const std::string &  name 
) const
private

Definition at line 628 of file Stratimikos_LinearSolverBuilder_def.hpp.

template<>
void Stratimikos::LinearSolverBuilder< double >::initializeDefaults ( )
private

Definition at line 526 of file Stratimikos_LinearSolverBuilder_def.hpp.

Member Data Documentation

template<class Scalar = double>
RCP<ParameterList> Stratimikos::LinearSolverBuilder< Scalar >::paramList_
private

Definition at line 289 of file Stratimikos_LinearSolverBuilder_decl.hpp.

template<class Scalar = double>
Array<std::string> Stratimikos::LinearSolverBuilder< Scalar >::validLowsfNames_
private

Definition at line 290 of file Stratimikos_LinearSolverBuilder_decl.hpp.

template<class Scalar = double>
Array<lowsf_fcty_t> Stratimikos::LinearSolverBuilder< Scalar >::lowsfArray_
private

Definition at line 291 of file Stratimikos_LinearSolverBuilder_decl.hpp.

template<class Scalar = double>
std::string Stratimikos::LinearSolverBuilder< Scalar >::defaultLOWSF_
private

Definition at line 292 of file Stratimikos_LinearSolverBuilder_decl.hpp.

template<class Scalar = double>
Array<std::string> Stratimikos::LinearSolverBuilder< Scalar >::validPfNames_
private

Definition at line 293 of file Stratimikos_LinearSolverBuilder_decl.hpp.

template<class Scalar = double>
Array<pf_fcty_t> Stratimikos::LinearSolverBuilder< Scalar >::pfArray_
private

Definition at line 294 of file Stratimikos_LinearSolverBuilder_decl.hpp.

template<class Scalar = double>
std::string Stratimikos::LinearSolverBuilder< Scalar >::defaultPF_
private

Definition at line 295 of file Stratimikos_LinearSolverBuilder_decl.hpp.

template<class Scalar = double>
bool Stratimikos::LinearSolverBuilder< Scalar >::enableDelayedSolverConstruction_
private

Definition at line 296 of file Stratimikos_LinearSolverBuilder_decl.hpp.

template<class Scalar = double>
RCP<const ParameterList> Stratimikos::LinearSolverBuilder< Scalar >::validParamList_
mutableprivate

Definition at line 297 of file Stratimikos_LinearSolverBuilder_decl.hpp.

template<class Scalar = double>
RCP<const Teuchos::StringToIntegralParameterEntryValidator<int> > Stratimikos::LinearSolverBuilder< Scalar >::lowsfValidator_
mutableprivate

Definition at line 298 of file Stratimikos_LinearSolverBuilder_decl.hpp.

template<class Scalar = double>
RCP<const Teuchos::StringToIntegralParameterEntryValidator<int> > Stratimikos::LinearSolverBuilder< Scalar >::pfValidator_
mutableprivate

Definition at line 299 of file Stratimikos_LinearSolverBuilder_decl.hpp.


The documentation for this class was generated from the following files: