Teuchos Package Browser (Single Doxygen Collection)
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
remainder
example
SolverFactory
Common.hpp
Go to the documentation of this file.
1
#ifndef COMMON_HPP
2
#define COMMON_HPP
3
4
//
5
// Header file for classes common to all "packages" in this example.
6
//
7
8
#include "
Trilinos_Details_LinearSolver.hpp
"
9
#include "
Trilinos_Details_LinearSolverFactory.hpp
"
10
#include <iostream>
11
#include <sstream>
12
13
// Namespace for classes common to all "packages" in this example.
14
namespace
Common
{
15
16
// Stub of a MultiVector (MV) class, templated on Scalar type (the
17
// type of its entries).
18
template
<
class
Scalar>
19
class
MultiVector
{};
20
21
// Stub of an Operator (OP) class, templated on Scalar type (the
22
// template parameter of the MultiVector specialization that it
23
// uses).
24
template
<
class
Scalar>
25
class
Operator
{
26
public
:
27
typedef
MultiVector<Scalar>
MV
;
28
29
void
apply
(
MV
&
/* Y */
,
const
MV
&
/* X */
) {
30
std::cout <<
"Operator<"
<<
typeid
(Scalar).name () <<
">::apply"
<< std::endl;
31
}
32
};
33
34
// Base classes of Trilinos::Details::LinearSolver must implement
35
// all the pure virtual methods of that interface. This base class
36
// only exists to make the example more concise. Its subclasses
37
// must implement solve(), name(), and the virtual destructor.
38
template
<
class
MV,
class
OP,
class
NormType>
39
class
LinearSolverTestBase
:
public
Trilinos::Details::LinearSolver
<MV, OP, NormType> {
40
protected
:
41
virtual
std::string
name
()
const
= 0;
42
43
public
:
44
virtual
~LinearSolverTestBase
() {}
45
46
void
setMatrix
(
const
Teuchos::RCP<const OP>
&
A
) {
47
std::cout << this->
name
() <<
"::setMatrix"
<< std::endl;
48
A_
=
A
;
49
}
50
51
Teuchos::RCP<const OP>
getMatrix
()
const
{
52
std::cout << this->
name
() <<
"::getMatrix"
<< std::endl;
53
return
A_
;
// this could be null if setMatrix wasn't called
54
}
55
56
void
setParameters
(
const
Teuchos::RCP<Teuchos::ParameterList>
&
/* params */
) {
57
std::cout << this->
name
() <<
"::setParameters"
<< std::endl;
58
}
59
60
void
symbolic
() {
61
std::cout << this->
name
() <<
"::symbolic"
<< std::endl;
62
}
63
64
void
numeric
() {
65
std::cout << this->
name
() <<
"::numeric"
<< std::endl;
66
}
67
68
private
:
69
Teuchos::RCP<const OP>
A_
;
// the matrix given to setMatrix
70
};
71
72
}
// namespace Common
73
74
#endif
// COMMON_HPP
Trilinos_Details_LinearSolverFactory.hpp
Declaration and definition of linear solver factory, and "factory of factories".
Trilinos_Details_LinearSolver.hpp
Declaration of linear solver interface.
Common::LinearSolverTestBase
Definition
Common.hpp:39
Common::LinearSolverTestBase::numeric
void numeric()
Set up any part of the solve that depends on both the structure and the numerical values of the input...
Definition
Common.hpp:64
Common::LinearSolverTestBase::A_
Teuchos::RCP< const OP > A_
Definition
Common.hpp:69
Common::LinearSolverTestBase::~LinearSolverTestBase
virtual ~LinearSolverTestBase()
Definition
Common.hpp:44
Common::LinearSolverTestBase::setParameters
void setParameters(const Teuchos::RCP< Teuchos::ParameterList > &)
Set this solver's parameters.
Definition
Common.hpp:56
Common::LinearSolverTestBase::symbolic
void symbolic()
Set up any part of the solve that depends on the structure of the input matrix, but not its numerical...
Definition
Common.hpp:60
Common::LinearSolverTestBase::name
virtual std::string name() const =0
Common::LinearSolverTestBase::setMatrix
void setMatrix(const Teuchos::RCP< const OP > &A)
Set the solver's matrix.
Definition
Common.hpp:46
Common::LinearSolverTestBase::getMatrix
Teuchos::RCP< const OP > getMatrix() const
Get a pointer to this solver's matrix.
Definition
Common.hpp:51
Common::MultiVector
Definition
Common.hpp:19
Common::Operator
Definition
Common.hpp:25
Common::Operator::MV
MultiVector< Scalar > MV
Definition
Common.hpp:27
Common::Operator::apply
void apply(MV &, const MV &)
Definition
Common.hpp:29
Teuchos::RCP
Smart reference counting pointer class for automatic garbage collection.
Definition
Teuchos_RCPDecl.hpp:429
Trilinos::Details::LinearSolver
Interface for a method for solving linear system(s) AX=B.
Definition
Trilinos_Details_LinearSolver.hpp:146
A
Definition
PackageA.cpp:3
Common
Definition
Common.hpp:14
Generated by
1.17.0