Stratimikos Version of the Day
Loading...
Searching...
No Matches
List of all members
Stratimikos::LinearSolverBuilder< Scalar > Class Template Reference

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

#include <Stratimikos_LinearSolverBuilder_decl.hpp>

Inherits Thyra::LinearSolverBuilderBase< double >.

Overridden from LinearSolverBuilderBase.

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

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")
 Construct with default parameters.
 
 ~LinearSolverBuilder ()
 
 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 (std::string, extraParamsXmlString)
 An XML string that will be used to update the parameters (if not "").
 
 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 (std::string, paramsXmlFileNameOption)
 The name of the option that will be added the the commandline processor that will set paramsXmlFileName() .
 
 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 (std::string, paramsUsedXmlOutFileNameOption)
 The name of the option that will be added the the commandline processor that will set paramsUsedXmlOutFileName() .
 
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.
 
void setDefaultLinearSolveStrategyFactoryName (const std::string &solveStrategyName)
 Set the default linear solver factory name.
 
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.
 
void setDefaultPreconditioningStrategyFactoryName (const std::string &precStrategyName)
 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.
 
void readParameters (std::ostream *out)
 Force the parameters to be read from a file and/or an extra XML string.
 
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.
 
std::string getLinearSolveStrategyName () const
 Get the name of the linear solver strategy that will be created on the next call to this->createLinearSolverStrategy().
 
std::string getPreconditionerStrategyName () const
 Get the name of the preconditioner strategy that will be created on the next call to this->createPreconditioningStrategy().
 

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
 

Detailed Description

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

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:


Definition at line 119 of file Stratimikos_LinearSolverBuilder_decl.hpp.

Constructor & Destructor Documentation

◆ LinearSolverBuilder()

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" )

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 96 of file Stratimikos_LinearSolverBuilder_def.hpp.

◆ ~LinearSolverBuilder()

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

Definition at line 96 of file Stratimikos_LinearSolverBuilder_def.hpp.

Member Function Documentation

◆ STANDARD_MEMBER_COMPOSITION_MEMBERS() [1/6]

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 "").

◆ STANDARD_MEMBER_COMPOSITION_MEMBERS() [2/6]

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 "").

◆ STANDARD_MEMBER_COMPOSITION_MEMBERS() [3/6]

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.

◆ STANDARD_MEMBER_COMPOSITION_MEMBERS() [4/6]

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() .

◆ STANDARD_MEMBER_COMPOSITION_MEMBERS() [5/6]

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() .

◆ STANDARD_MEMBER_COMPOSITION_MEMBERS() [6/6]

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() .

◆ setLinearSolveStrategyFactory()

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 129 of file Stratimikos_LinearSolverBuilder_def.hpp.

◆ setDefaultLinearSolveStrategyFactoryName()

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

Set the default linear solver factory name.

Definition at line 146 of file Stratimikos_LinearSolverBuilder_def.hpp.

◆ setPreconditioningStrategyFactory()

template<class Scalar >
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 154 of file Stratimikos_LinearSolverBuilder_def.hpp.

◆ setDefaultPreconditioningStrategyFactoryName()

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

Set the default linear solver factory name.

Definition at line 171 of file Stratimikos_LinearSolverBuilder_def.hpp.

◆ setupCLP()

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.

Definition at line 179 of file Stratimikos_LinearSolverBuilder_def.hpp.

◆ readParameters()

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:

Definition at line 200 of file Stratimikos_LinearSolverBuilder_def.hpp.

◆ writeParamsFile()

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.

Definition at line 230 of file Stratimikos_LinearSolverBuilder_def.hpp.

◆ getLinearSolveStrategyName()

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 246 of file Stratimikos_LinearSolverBuilder_def.hpp.

◆ getPreconditionerStrategyName()

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 256 of file Stratimikos_LinearSolverBuilder_def.hpp.

◆ setParameterList()

template<class Scalar = double>
void Stratimikos::LinearSolverBuilder< Scalar >::setParameterList ( RCP< ParameterList > const & paramList)

Definition at line 268 of file Stratimikos_LinearSolverBuilder_def.hpp.

◆ getNonconstParameterList()

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

Definition at line 282 of file Stratimikos_LinearSolverBuilder_def.hpp.

◆ unsetParameterList()

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

Definition at line 290 of file Stratimikos_LinearSolverBuilder_def.hpp.

◆ getParameterList()

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

Definition at line 300 of file Stratimikos_LinearSolverBuilder_def.hpp.

◆ getValidParameters()

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

Definition at line 308 of file Stratimikos_LinearSolverBuilder_def.hpp.

◆ createLinearSolveStrategy()

template<class Scalar >
RCP< Thyra::LinearOpWithSolveFactoryBase< Scalar > > Stratimikos::LinearSolverBuilder< Scalar >::createLinearSolveStrategy ( const std::string & linearSolveStrategyName) const

Definition at line 396 of file Stratimikos_LinearSolverBuilder_def.hpp.

◆ createPreconditioningStrategy()

template<class Scalar >
RCP< Thyra::PreconditionerFactoryBase< Scalar > > Stratimikos::LinearSolverBuilder< Scalar >::createPreconditioningStrategy ( const std::string & preconditioningStrategyName) const

Definition at line 457 of file Stratimikos_LinearSolverBuilder_def.hpp.


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

Generated for Stratimikos by doxygen 1.10.0