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

Interface for custom Belos solver factories. More...

#include <BelosCustomSolverFactory.hpp>

Public Member Functions

virtual Teuchos::RCP
< SolverManager< Scalar, MV,
OP > > 
getSolver (const std::string &solverName, const Teuchos::RCP< Teuchos::ParameterList > &solverParams)=0
 Return an instance of the specified solver, or Teuchos::null if this factory does not provide the requested solver. More...
 
virtual int numSupportedSolvers () const =0
 Number of supported solvers. More...
 
virtual std::vector< std::string > supportedSolverNames () const =0
 List of supported solver names. More...
 
virtual bool isSupported (const std::string &solverName) const =0
 Whether the given solver name names a supported solver. More...
 
virtual ~CustomSolverFactory ()
 Destructor (virtual, for safety of derived classes). More...
 

Detailed Description

template<class Scalar, class MV, class OP>
class Belos::CustomSolverFactory< Scalar, MV, OP >

Interface for custom Belos solver factories.

If you want to extend Belos::SolverFactory (which see) to support new solvers, you may do the following:

  1. Create a subclass of CustomSolverFactory, whose getSolver() method returns instances of the new solvers
  2. Tell Belos about your subclass, by giving an instance of it to Belos::SolverFactory::addFactory
  3. Now, you may use Belos::SolverFactory to create instances of the new solvers

For a test and example of how to do this (with a trivial solver), see Trilinos/packages/belos/tpetra/test/CustomSolverFactory.cpp.

Definition at line 49 of file BelosCustomSolverFactory.hpp.

Constructor & Destructor Documentation

template<class Scalar , class MV , class OP >
virtual Belos::CustomSolverFactory< Scalar, MV, OP >::~CustomSolverFactory ( )
inlinevirtual

Destructor (virtual, for safety of derived classes).

Definition at line 103 of file BelosCustomSolverFactory.hpp.

Member Function Documentation

template<class Scalar , class MV , class OP >
virtual Teuchos::RCP<SolverManager<Scalar, MV, OP> > Belos::CustomSolverFactory< Scalar, MV, OP >::getSolver ( const std::string &  solverName,
const Teuchos::RCP< Teuchos::ParameterList > &  solverParams 
)
pure virtual

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

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 requested solver.
solverParams[in/out] List of parameters with which to configure the solver. If Teuchos::null, subclasses must still return a valid solver. They may configure the solver with default parameters in that case. If nonnull, the factory or solver may modify the list by filling in missing parameters, or overriding existing parameters. You may then inspect the resulting list to learn what parameters the solver accepts.
Returns
If the given solverName is valid, the solver, else Teuchos::null. (Returning null makes "chaining" factories work; see e.g., Belos::SolverFactory::addFactory.)

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.

template<class Scalar , class MV , class OP >
virtual int Belos::CustomSolverFactory< Scalar, MV, OP >::numSupportedSolvers ( ) const
pure 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.

template<class Scalar , class MV , class OP >
virtual std::vector<std::string> Belos::CustomSolverFactory< Scalar, MV, OP >::supportedSolverNames ( ) const
pure 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.

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

Whether the given solver name names a supported solver.


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

Generated on Mon Jul 15 2024 09:24:24 for Belos by doxygen 1.8.5