Teuchos Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
PackageC.hpp
Go to the documentation of this file.
1#ifndef PACKAGE_C_HPP
2#define PACKAGE_C_HPP
3
4//
5// Header file for Package C.
6//
7
8#include "Common.hpp"
9
10namespace C {
11
12 //
13 // This solver is independent of other solvers.
14 //
15 template<class MV, class OP, class NormType>
16 class Solver5 : public Common::LinearSolverTestBase<MV, OP, NormType> {
17 protected:
18 std::string name () const {
19 return "Solver5";
20 }
21
22 public:
23 virtual ~Solver5 () {}
24
25 void solve (MV& /* X */, const MV& /* B */ ) {
26 std::cout << this->name () << "::solve START" << std::endl;
27 std::cout << this->name () << "::solve END" << std::endl;
28 }
29 };
30
31 //
32 // This solver is independent of other solvers.
33 //
34 template<class MV, class OP, class NormType>
35 class Solver6 : public Common::LinearSolverTestBase<MV, OP, NormType> {
36 protected:
37 std::string name () const {
38 return "Solver6";
39 }
40
41 public:
42 virtual ~Solver6 () {}
43
44 void solve (MV& /* X */, const MV& /* B */ ) {
45 std::cout << this->name () << "::solve START" << std::endl;
46 std::cout << this->name () << "::solve END" << std::endl;
47 }
48 };
49
50 //
51 // Package C's solver factory.
52 //
53 template<class MV, class OP, class NormType>
54 class FactoryC : public Trilinos::Details::LinearSolverFactory<MV, OP, NormType> {
55 public:
57 getLinearSolver (const std::string& solverName)
58 {
60
61 if (solverName == "5") {
63 }
64 else if (solverName == "6") {
66 }
67 else {
68 std::ostringstream err;
69 err << "C::FactoryC::getLinearSolver: Invalid solver name \""
70 << solverName << "\"";
71 throw std::invalid_argument (err.str ());
72 }
73 }
74 };
75
76} // namespace C
77
78#endif // PACKAGE_C_HPP
Teuchos::RCP< Trilinos::Details::LinearSolver< MV, OP, NormType > > getLinearSolver(const std::string &solverName)
Get an instance of a solver from a particular package.
Definition PackageC.hpp:57
void solve(MV &, const MV &)
Solve the linear system(s) AX=B.
Definition PackageC.hpp:25
std::string name() const
Definition PackageC.hpp:18
virtual ~Solver5()
Definition PackageC.hpp:23
std::string name() const
Definition PackageC.hpp:37
virtual ~Solver6()
Definition PackageC.hpp:42
void solve(MV &, const MV &)
Solve the linear system(s) AX=B.
Definition PackageC.hpp:44
Concrete serial communicator subclass.
Interface for a "factory" that creates solvers.
Interface for a method for solving linear system(s) AX=B.
Definition PackageC.cpp:3