Stratimikos Package Browser (Single Doxygen Collection)  Version of the Day
Private Types | Private Member Functions | Private Attributes | List of all members
Stratimikos::DefaultLinearSolverBuilder Class Reference

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

#include <Stratimikos_DefaultLinearSolverBuilder.hpp>

Inherits LinearSolverBuilderBase< double >.

Private Types

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

Private Member Functions

void initializeDefaults ()
 
void justInTimeInitialize () const
 

Private Attributes

RCP< ParameterList > paramList_
 
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 ParameterList > validParamList_
 
RCP< const Teuchos::StringToIntegralParameterEntryValidator< int > > lowsfValidator_
 
RCP< const Teuchos::StringToIntegralParameterEntryValidator< int > > pfValidator_
 

Constructors/Initializers/Accessors

 DefaultLinearSolverBuilder (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")
 Construct with default parameters. More...
 
 ~DefaultLinearSolverBuilder ()
 
 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...
 
void setLinearSolveStrategyFactory (const RCP< const AbstractFactory< Thyra::LinearOpWithSolveFactoryBase< double > > > &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< double > > > &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< double > &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< ParameterList > getNonconstParameterList ()
 
RCP< ParameterList > unsetParameterList ()
 
RCP< const ParameterList > getParameterList () const
 
RCP< const ParameterList > getValidParameters () const
 

Overridden from LinearSolverBuilderBase.

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

Detailed Description

Concrete subclass of Thyra::LinearSolverBuilderBase for creating LinearOpWithSolveFactoryBase objects and PreconditionerFactoryBase object on demand for various Trilinos linear solver 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, simple_stratimikos_example.cpp, and test_single_stratimikos_solver.cpp.

Definition at line 116 of file Stratimikos_DefaultLinearSolverBuilder.hpp.

Member Typedef Documentation

◆ lowsf_fcty_t

typedef RCP<const AbstractFactory<Thyra::LinearOpWithSolveFactoryBase<double> > > Stratimikos::DefaultLinearSolverBuilder::lowsf_fcty_t
private

Definition at line 305 of file Stratimikos_DefaultLinearSolverBuilder.hpp.

◆ pf_fcty_t

typedef RCP<const AbstractFactory<Thyra::PreconditionerFactoryBase<double> > > Stratimikos::DefaultLinearSolverBuilder::pf_fcty_t
private

Definition at line 307 of file Stratimikos_DefaultLinearSolverBuilder.hpp.

Constructor & Destructor Documentation

◆ DefaultLinearSolverBuilder()

Stratimikos::DefaultLinearSolverBuilder::DefaultLinearSolverBuilder ( 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" 
)

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 90 of file Stratimikos_DefaultLinearSolverBuilder.cpp.

◆ ~DefaultLinearSolverBuilder()

Stratimikos::DefaultLinearSolverBuilder::~DefaultLinearSolverBuilder ( )

Definition at line 110 of file Stratimikos_DefaultLinearSolverBuilder.cpp.

Member Function Documentation

◆ STANDARD_MEMBER_COMPOSITION_MEMBERS() [1/6]

Stratimikos::DefaultLinearSolverBuilder::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
paramsXmlFileName   
)

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

◆ STANDARD_MEMBER_COMPOSITION_MEMBERS() [2/6]

Stratimikos::DefaultLinearSolverBuilder::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
extraParamsXmlString   
)

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

◆ STANDARD_MEMBER_COMPOSITION_MEMBERS() [3/6]

Stratimikos::DefaultLinearSolverBuilder::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
paramsUsedXmlOutFileName   
)

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

◆ STANDARD_MEMBER_COMPOSITION_MEMBERS() [4/6]

Stratimikos::DefaultLinearSolverBuilder::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
paramsXmlFileNameOption   
)

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

◆ STANDARD_MEMBER_COMPOSITION_MEMBERS() [5/6]

Stratimikos::DefaultLinearSolverBuilder::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
extraParamsXmlStringOption   
)

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

◆ STANDARD_MEMBER_COMPOSITION_MEMBERS() [6/6]

Stratimikos::DefaultLinearSolverBuilder::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
paramsUsedXmlOutFileNameOption   
)

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

◆ setLinearSolveStrategyFactory()

void Stratimikos::DefaultLinearSolverBuilder::setLinearSolveStrategyFactory ( const RCP< const AbstractFactory< Thyra::LinearOpWithSolveFactoryBase< double > > > &  solveStrategyFactory,
const std::string &  solveStrategyName,
const bool  makeDefault = false 
)

Set a new linear solver strategy factory object.

Definition at line 121 of file Stratimikos_DefaultLinearSolverBuilder.cpp.

◆ setDefaultLinearSolveStrategyFactoryName()

void Stratimikos::DefaultLinearSolverBuilder::setDefaultLinearSolveStrategyFactoryName ( const std::string &  solveStrategyName)

Set the default linear solver factory name.

Definition at line 137 of file Stratimikos_DefaultLinearSolverBuilder.cpp.

◆ setPreconditioningStrategyFactory()

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

Set a new preconditioner strategy factory object.

Definition at line 144 of file Stratimikos_DefaultLinearSolverBuilder.cpp.

◆ setDefaultPreconditioningStrategyFactoryName()

void Stratimikos::DefaultLinearSolverBuilder::setDefaultPreconditioningStrategyFactoryName ( const std::string &  precStrategyName)

Set the default linear solver factory name.

Definition at line 160 of file Stratimikos_DefaultLinearSolverBuilder.cpp.

◆ setupCLP()

void Stratimikos::DefaultLinearSolverBuilder::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 167 of file Stratimikos_DefaultLinearSolverBuilder.cpp.

◆ readParameters()

void Stratimikos::DefaultLinearSolverBuilder::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 187 of file Stratimikos_DefaultLinearSolverBuilder.cpp.

◆ writeParamsFile()

void Stratimikos::DefaultLinearSolverBuilder::writeParamsFile ( const Thyra::LinearOpWithSolveFactoryBase< double > &  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 216 of file Stratimikos_DefaultLinearSolverBuilder.cpp.

◆ getLinearSolveStrategyName()

std::string Stratimikos::DefaultLinearSolverBuilder::getLinearSolveStrategyName ( ) const

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

Definition at line 231 of file Stratimikos_DefaultLinearSolverBuilder.cpp.

◆ getPreconditionerStrategyName()

std::string Stratimikos::DefaultLinearSolverBuilder::getPreconditionerStrategyName ( ) const

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

Definition at line 240 of file Stratimikos_DefaultLinearSolverBuilder.cpp.

◆ setParameterList()

void Stratimikos::DefaultLinearSolverBuilder::setParameterList ( RCP< ParameterList > const &  paramList)

◆ getNonconstParameterList()

RCP< Teuchos::ParameterList > Stratimikos::DefaultLinearSolverBuilder::getNonconstParameterList ( )

◆ unsetParameterList()

RCP< Teuchos::ParameterList > Stratimikos::DefaultLinearSolverBuilder::unsetParameterList ( )

Definition at line 271 of file Stratimikos_DefaultLinearSolverBuilder.cpp.

◆ getParameterList()

RCP< const Teuchos::ParameterList > Stratimikos::DefaultLinearSolverBuilder::getParameterList ( ) const

Definition at line 280 of file Stratimikos_DefaultLinearSolverBuilder.cpp.

◆ getValidParameters()

RCP< const Teuchos::ParameterList > Stratimikos::DefaultLinearSolverBuilder::getValidParameters ( ) const

◆ createLinearSolveStrategy()

RCP< Thyra::LinearOpWithSolveFactoryBase< double > > Stratimikos::DefaultLinearSolverBuilder::createLinearSolveStrategy ( const std::string &  linearSolveStrategyName) const

◆ createPreconditioningStrategy()

RCP< Thyra::PreconditionerFactoryBase< double > > Stratimikos::DefaultLinearSolverBuilder::createPreconditioningStrategy ( const std::string &  preconditioningStrategyName) const

Definition at line 434 of file Stratimikos_DefaultLinearSolverBuilder.cpp.

◆ initializeDefaults()

void Stratimikos::DefaultLinearSolverBuilder::initializeDefaults ( )
private

Definition at line 465 of file Stratimikos_DefaultLinearSolverBuilder.cpp.

◆ justInTimeInitialize()

void Stratimikos::DefaultLinearSolverBuilder::justInTimeInitialize ( ) const
private

Definition at line 539 of file Stratimikos_DefaultLinearSolverBuilder.cpp.

Member Data Documentation

◆ paramList_

RCP<ParameterList> Stratimikos::DefaultLinearSolverBuilder::paramList_
private

Definition at line 312 of file Stratimikos_DefaultLinearSolverBuilder.hpp.

◆ validLowsfNames_

Array<std::string> Stratimikos::DefaultLinearSolverBuilder::validLowsfNames_
private

Definition at line 313 of file Stratimikos_DefaultLinearSolverBuilder.hpp.

◆ lowsfArray_

Array<lowsf_fcty_t> Stratimikos::DefaultLinearSolverBuilder::lowsfArray_
private

Definition at line 314 of file Stratimikos_DefaultLinearSolverBuilder.hpp.

◆ defaultLOWSF_

std::string Stratimikos::DefaultLinearSolverBuilder::defaultLOWSF_
private

Definition at line 315 of file Stratimikos_DefaultLinearSolverBuilder.hpp.

◆ validPfNames_

Array<std::string> Stratimikos::DefaultLinearSolverBuilder::validPfNames_
private

Definition at line 316 of file Stratimikos_DefaultLinearSolverBuilder.hpp.

◆ pfArray_

Array<pf_fcty_t> Stratimikos::DefaultLinearSolverBuilder::pfArray_
private

Definition at line 317 of file Stratimikos_DefaultLinearSolverBuilder.hpp.

◆ defaultPF_

std::string Stratimikos::DefaultLinearSolverBuilder::defaultPF_
private

Definition at line 318 of file Stratimikos_DefaultLinearSolverBuilder.hpp.

◆ enableDelayedSolverConstruction_

bool Stratimikos::DefaultLinearSolverBuilder::enableDelayedSolverConstruction_
private

Definition at line 319 of file Stratimikos_DefaultLinearSolverBuilder.hpp.

◆ validParamList_

RCP<const ParameterList> Stratimikos::DefaultLinearSolverBuilder::validParamList_
mutableprivate

Definition at line 320 of file Stratimikos_DefaultLinearSolverBuilder.hpp.

◆ lowsfValidator_

RCP<const Teuchos::StringToIntegralParameterEntryValidator<int> > Stratimikos::DefaultLinearSolverBuilder::lowsfValidator_
mutableprivate

Definition at line 321 of file Stratimikos_DefaultLinearSolverBuilder.hpp.

◆ pfValidator_

RCP<const Teuchos::StringToIntegralParameterEntryValidator<int> > Stratimikos::DefaultLinearSolverBuilder::pfValidator_
mutableprivate

Definition at line 322 of file Stratimikos_DefaultLinearSolverBuilder.hpp.


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