Belos  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Belos::Impl::SolverFactoryParent< Scalar, MV, OP > Class Template Reference

Specializations of Belos::SolverFactory may inherit from this class to get basic SolverFactory functionality. More...

#include <BelosSolverFactory.hpp>

Inheritance diagram for Belos::Impl::SolverFactoryParent< Scalar, MV, OP >:
Inheritance graph
[legend]

Public Types

typedef ::Belos::SolverManager
< Scalar, MV, OP > 
solver_base_type
 The type of the solver returned by create(). More...
 
typedef CustomSolverFactory
< Scalar, MV, OP > 
custom_solver_factory_type
 The type of a solver factory that users may give to addFactory() (which see below) More...
 

Public Member Functions

virtual Teuchos::RCP
< solver_base_type
create (const std::string &solverName, const Teuchos::RCP< Teuchos::ParameterList > &solverParams)
 Create, configure, and return the specified solver. More...
 
virtual int numSupportedSolvers () const
 Number of supported solvers. More...
 
virtual Teuchos::Array
< std::string > 
supportedSolverNames () const
 List of supported solver names. More...
 
virtual bool isSupported (const std::string &solverName) const
 Whether the given solver name names a supported solver. More...
 
void addFactory (const Teuchos::RCP< custom_solver_factory_type > &factory)
 Add a custom solver factory. More...
 
Implementation of Teuchos::Describable interface
virtual std::string description () const
 A string description of this object. More...
 
virtual void describe (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
 Describe this object. More...
 
- Public Member Functions inherited from Teuchos::Describable
void describe (std::ostream &out, const EVerbosityLevel verbLevel=verbLevel_default) const
 
virtual ~Describable ()
 
 LabeledObject ()
 
virtual ~LabeledObject ()
 
virtual void setObjectLabel (const std::string &objectLabel)
 
virtual std::string getObjectLabel () const
 
DescribableStreamManipulatorState describe (const Describable &describable, const EVerbosityLevel verbLevel=Describable::verbLevel_default)
 
std::ostream & operator<< (std::ostream &os, const DescribableStreamManipulatorState &d)
 

Static Public Member Functions

static void registerSolver (const std::string &solverName, Teuchos::RCP< SolverFactoryParent< Scalar, MV, OP >::solver_base_type > instance)
 register a solver for Inverted Injection (DII). More...
 
static bool isSolverRegistered (const std::string &solverName)
 is solver registered for Inverted Injection (DII). More...
 

Protected Member Functions

 SolverFactoryParent ()
 
virtual Teuchos::RCP
< solver_base_type
getSolver (const std::string &solverName, const Teuchos::RCP< Teuchos::ParameterList > &solverParams)
 Return an instance of the specified solver, or Teuchos::null if this factory does not provide the requested solver. More...
 

Additional Inherited Members

- Static Public Attributes inherited from Teuchos::Describable
static const EVerbosityLevel verbLevel_default
 

Detailed Description

template<class Scalar, class MV, class OP>
class Belos::Impl::SolverFactoryParent< Scalar, MV, OP >

Specializations of Belos::SolverFactory may inherit from this class to get basic SolverFactory functionality.

This class is not for Belos users. It's really just for Belos developers who want to write a specialization of Belos::SolverFactory. Those developers may make their specialization inherit from this class, in order to get basic Belos::SolverFactory functionality without reimplementing everything.

Template Parameters
ScalarSame as template parameter 1 of Belos::SolverFactory (which see below).
MVSame as template parameter 2 of Belos::SolverFactory (which see below).
OPSame as template parameter 2 of Belos::SolverFactory (which see below).

Definition at line 95 of file BelosSolverFactory.hpp.

Member Typedef Documentation

template<class Scalar, class MV, class OP>
typedef ::Belos::SolverManager<Scalar, MV, OP> Belos::Impl::SolverFactoryParent< Scalar, MV, OP >::solver_base_type

The type of the solver returned by create().

This is a specialization of SolverManager for the same scalar, multivector, and operator types as the template parameters of this factory.

Definition at line 117 of file BelosSolverFactory.hpp.

template<class Scalar, class MV, class OP>
typedef CustomSolverFactory<Scalar, MV, OP> Belos::Impl::SolverFactoryParent< Scalar, MV, OP >::custom_solver_factory_type

The type of a solver factory that users may give to addFactory() (which see below)

Definition at line 121 of file BelosSolverFactory.hpp.

Constructor & Destructor Documentation

template<class Scalar, class MV, class OP>
Belos::Impl::SolverFactoryParent< Scalar, MV, OP >::SolverFactoryParent ( )
inlineprotected

Definition at line 109 of file BelosSolverFactory.hpp.

Member Function Documentation

template<class Scalar , class MV , class OP >
Teuchos::RCP< typename SolverFactoryParent< Scalar, MV, OP >::solver_base_type > Belos::Impl::SolverFactoryParent< Scalar, MV, OP >::getSolver ( const std::string &  solverName,
const Teuchos::RCP< Teuchos::ParameterList > &  solverParams 
)
protectedvirtual

Return an instance of the specified solver, or Teuchos::null if this factory does not provide the requested solver.

The preferred way to customize this method is not to inherit from it, but rather to add a custom SolverFactory via addFactory() (which see below). Nevertheless, we leave open the possibility of overriding this method, for example in order to change the order in which users' solver factories are queried.

Note
To implementers: DO NOT THROW if this factory does not recognize and support the input solverName. Instead, just return Teuchos::null. This will make Belos::SolverFactory's implementation cleaner (and is also the reason why we gave this function a different name).
Parameters
solverName[in] Name of the solver.
solverParams[in/out] List of parameters with which to configure the solver. If null, we configure the solver with default parameters. If nonnull, the solver may modify the list by filling in missing parameters with default values. You can then inspect the resulting list to learn what parameters the solver accepts.

Some solvers may be accessed by multiple names ("aliases"). Each solver has a canonical name, and zero or more aliases. Using some aliases (such as those that access Flexible GMRES capability in GMRES-type solvers) may make this method set certain parameters in your parameter list.

The input parameter list is passed in as a Teuchos::RCP because the factory passes it to the solver, and Belos solvers want their input parameter list as a Teuchos::RCP<Teuchos::ParameterList>. We allow a null parameter list only for convenience, and will use default parameter values in that case.

Definition at line 324 of file BelosSolverFactory.hpp.

template<class Scalar , class MV , class OP >
Teuchos::RCP< typename SolverFactoryParent< Scalar, MV, OP >::solver_base_type > Belos::Impl::SolverFactoryParent< Scalar, MV, OP >::create ( const std::string &  solverName,
const Teuchos::RCP< Teuchos::ParameterList > &  solverParams 
)
virtual

Create, configure, and return the specified solver.

Parameters
solverName[in] Name of the solver.
solverParams[in/out] List of parameters with which to configure the solver.

This method differs from getSolver() (see above) only in that it throws an exception if solverName is invalid.

Definition at line 310 of file BelosSolverFactory.hpp.

template<class Scalar , class MV , class OP >
int Belos::Impl::SolverFactoryParent< Scalar, MV, OP >::numSupportedSolvers ( ) const
virtual

Number of supported solvers.

This may differ from the number of supported solver names, since we may accept multiple names ("aliases") for some solvers.

Definition at line 492 of file BelosSolverFactory.hpp.

template<class Scalar , class MV , class OP >
Teuchos::Array< std::string > Belos::Impl::SolverFactoryParent< Scalar, MV, OP >::supportedSolverNames ( ) const
virtual

List of supported solver names.

The length of this list may differ from the number of supported solvers, since we may accept multiple names ("aliases") for some solvers.

Definition at line 512 of file BelosSolverFactory.hpp.

template<class Scalar , class MV , class OP >
bool Belos::Impl::SolverFactoryParent< Scalar, MV, OP >::isSupported ( const std::string &  solverName) const
virtual

Whether the given solver name names a supported solver.

Definition at line 550 of file BelosSolverFactory.hpp.

template<class Scalar , class MV , class OP >
void Belos::Impl::SolverFactoryParent< Scalar, MV, OP >::addFactory ( const Teuchos::RCP< custom_solver_factory_type > &  factory)

Add a custom solver factory.

Any custom solver factories that you may define will override this factory. "Override" means that if the solverName argument to create() or getSolver() matches any solvers that the custom factories support, then one of the custom factories will create it.

Note
To developers: This is an instance method, but it adds the factory for all current and future instances.
Warning
This method makes no promise of reentrancy or thread safety, with respect to other calls to this or other factories' methods.

Definition at line 414 of file BelosSolverFactory.hpp.

template<class Scalar, class MV, class OP>
static void Belos::Impl::SolverFactoryParent< Scalar, MV, OP >::registerSolver ( const std::string &  solverName,
Teuchos::RCP< SolverFactoryParent< Scalar, MV, OP >::solver_base_type instance 
)
inlinestatic

register a solver for Inverted Injection (DII).

Definition at line 215 of file BelosSolverFactory.hpp.

template<class Scalar, class MV, class OP>
static bool Belos::Impl::SolverFactoryParent< Scalar, MV, OP >::isSolverRegistered ( const std::string &  solverName)
inlinestatic

is solver registered for Inverted Injection (DII).

Definition at line 228 of file BelosSolverFactory.hpp.

template<class Scalar , class MV , class OP >
std::string Belos::Impl::SolverFactoryParent< Scalar, MV, OP >::description ( ) const
virtual

A string description of this object.

Reimplemented from Teuchos::Describable.

Definition at line 423 of file BelosSolverFactory.hpp.

template<class Scalar , class MV , class OP >
void Belos::Impl::SolverFactoryParent< Scalar, MV, OP >::describe ( Teuchos::FancyOStream out,
const Teuchos::EVerbosityLevel  verbLevel = Teuchos::Describable::verbLevel_default 
) const
virtual

Describe this object.

At higher verbosity levels, this method will print out the list of names of supported solvers. You can also get this list directly by using the supportedSolverNames() method.

Reimplemented from Teuchos::Describable.

Definition at line 443 of file BelosSolverFactory.hpp.


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

Generated on Fri Jun 5 2020 10:21:07 for Belos by doxygen 1.8.5