Teuchos - Trilinos Tools Package  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Static Public Member Functions | List of all members
Trilinos::Details::Impl::LinearSolverFactoryRepository< MV, OP, NormType > Class Template Reference

Repository of solver factories. More...

#include <Trilinos_Details_LinearSolverFactory.hpp>

Public Types

typedef Teuchos::RCP
< LinearSolverFactory< MV, OP,
NormType > > 
factory_pointer_type
 Type of a reference-counted pointer to LinearSolverFactory. More...
 
typedef std::map< std::string,
factory_pointer_type
map_type
 Type of a data structure that looks up a LinearSolverFactory corresponding to a given package name. More...
 

Static Public Member Functions

static factory_pointer_type getFactory (const std::string &packageName)
 Get a LinearSolverFactory from the given package. More...
 
static void registerLinearSolverFactory (const std::string &packageName, const factory_pointer_type &factory)
 Register the given factory from a package. More...
 

Detailed Description

template<class MV, class OP, class NormType>
class Trilinos::Details::Impl::LinearSolverFactoryRepository< MV, OP, NormType >

Repository of solver factories.

Template Parameters
MVType of a (multi)vector, representing either the solution(s) X or the right-hand side(s) B of a linear system AX=B. For example, with Tpetra, use a Tpetra::MultiVector specialization. A multivector is a single data structure containing zero or more vectors with the same dimensions and layout.
OPType of a matrix or linear operator that LinearSolver understands. For example, for Tpetra, use a Tpetra::Operator specialization.
NormTypeType of the norm of a residual.

A LinearSolver knows how to solve linear systems AX=B. A LinearSolverFactory knows how to create LinearSolver instances. Each independent unit of code ("package") that wants to participate in the linear solver system, registers its own LinearSolverFactory using the nonmember functions Trilinos::Details::registerLinearSolverFactory(). Solvers may then get (inner) solver instances with Trilinos::Details::getLinearSolver() (see above in this file). Those two nonmember functions dispatch to this class' class (static) methods with the same names.

Definition at line 400 of file Trilinos_Details_LinearSolverFactory.hpp.

Member Typedef Documentation

template<class MV , class OP , class NormType >
Trilinos::Details::Impl::LinearSolverFactoryRepository< MV, OP, NormType >::factory_pointer_type

Type of a reference-counted pointer to LinearSolverFactory.

If C++11 is enabled, we use std::shared_ptr here, for improved thread safety. Teuchos does not require C++11.

Definition at line 410 of file Trilinos_Details_LinearSolverFactory.hpp.

template<class MV , class OP , class NormType >
Trilinos::Details::Impl::LinearSolverFactoryRepository< MV, OP, NormType >::map_type

Type of a data structure that looks up a LinearSolverFactory corresponding to a given package name.

The compiler insists that this be public. This doesn't hurt encapsulation, because this class lives in an "Impl"(ementation) namespace anyway.

Definition at line 420 of file Trilinos_Details_LinearSolverFactory.hpp.

Member Function Documentation

template<class MV , class OP , class NormType >
static factory_pointer_type Trilinos::Details::Impl::LinearSolverFactoryRepository< MV, OP, NormType >::getFactory ( const std::string &  packageName)
inlinestatic

Get a LinearSolverFactory from the given package.

This is an implementation detail of the nonmember function with the same name (see above).

Parameters
packageName[in] Name of the package. This must be the same name as that used to register the package via registerLinearSolverFactory(). Package names are case sensitive.
Returns
If packageName has been registered with a valid LinearSolverFactory, the pointer to the factory, else null.

Definition at line 436 of file Trilinos_Details_LinearSolverFactory.hpp.

template<class MV , class OP , class NormType >
static void Trilinos::Details::Impl::LinearSolverFactoryRepository< MV, OP, NormType >::registerLinearSolverFactory ( const std::string &  packageName,
const factory_pointer_type factory 
)
inlinestatic

Register the given factory from a package.

This is an implementation detail of the nonmember function with the same name (see above).

Parameters
packageName[in] Name of the package registering the factory. Package names are case sensitive.
factory[in] That package's factory (must be nonnull).
Warning
This method is not reentrant. In particular, if multiple threads call this method at the same time, they might manage to double-register the atexit() handler for factories_. This could only happen if this method is called twice by different threads.

Definition at line 463 of file Trilinos_Details_LinearSolverFactory.hpp.


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