Teuchos Package Browser (Single Doxygen Collection)
Version of the Day
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
remainder
example
SolverFactory
PackageA.cpp
Go to the documentation of this file.
1
#include "
PackageA.hpp
"
2
3
namespace
A
{
4
5
// Creating an instance of this "object" registers A::FactoryA<MV,
6
// OP> with the central registry of packages' factories. That lets
7
// getLinearSolver create solvers from package A.
8
template
<
class
MV,
class
OP,
class
NormType>
9
class
RegisterFactoryA
{
10
public
:
11
RegisterFactoryA
() {
12
#ifdef HAVE_TEUCHOSCORE_CXX11
13
typedef
std::shared_ptr<Trilinos::Details::LinearSolverFactory<MV, OP, NormType> > ptr_type;
14
#else
15
typedef
Teuchos::RCP<Trilinos::Details::LinearSolverFactory<MV, OP, NormType>
> ptr_type;
16
#endif // HAVE_TEUCHOSCORE_CXX11
17
18
ptr_type factory (
new
FactoryA<MV, OP, NormType>
());
19
Trilinos::Details::registerLinearSolverFactory<MV, OP, NormType> (
"A"
, factory);
20
}
21
};
22
23
}
// namespace A
24
25
namespace
{
// (anonymous)
26
27
// For each triple of types (MV, OP, NormType) of interest, register
28
// A::FactoryA<MV, OP, NormType>. We use MV =
29
// Common::MultiVector<Scalar> and OP = Common::Operator<Scalar>
30
// here, for various Scalar types. NormType = Scalar simulates the
31
// case where Scalar is real (not complex).
32
//
33
// This is a stub of what you likely will want to do with Tpetra and
34
// its downstream solver packages. See the public documentation of
35
// Trilinos::Details::LinearSolverFactory for details.
36
//
37
// The ## operator in a macro appends two things. For example, with
38
// INSTMACRO( float ), registerer_##SCALAR becomes registerer_float.
39
// This ensures that the different instances of RegisterFactoryA
40
// have different names.
41
42
#define INSTMACRO( SCALAR ) \
43
A::RegisterFactoryA< Common::MultiVector< SCALAR >, Common::Operator< SCALAR >, SCALAR > registerer_##SCALAR;
44
45
//A::RegisterFactoryA< Common::MultiVector<double>, Common::Operator<double>, double > registerer_double;
46
INSTMACRO
(
double
)
47
48
//A::RegisterFactoryA< Common::MultiVector<float>, Common::Operator<float>, float > registerer_float;
49
INSTMACRO
(
float
)
50
51
}
// namespace (anonymous)
A::RegisterFactoryA
Definition:
PackageA.cpp:9
A
Definition:
core/example/RefCountPtr/cxx_main.cpp:47
INSTMACRO
#define INSTMACRO(SCALAR)
Definition:
PackageA.cpp:42
A::RegisterFactoryA::RegisterFactoryA
RegisterFactoryA()
Definition:
PackageA.cpp:11
A::FactoryA
Definition:
PackageA.hpp:63
PackageA.hpp
Teuchos::RCP
Smart reference counting pointer class for automatic garbage collection.
Definition:
Teuchos_RCPDecl.hpp:429
Generated by
1.8.5