Bridge++  Ver. 2.0.2
solver.h
Go to the documentation of this file.
1 
14 #ifndef SOLVER_INCLUDED
15 #define SOLVER_INCLUDED
16 
17 #include "Fopr/fopr.h"
18 
20 
21 #ifdef USE_FACTORY
22 #include "Tools/factory.h"
23 #endif
24 
26 
36 class Solver
37 {
38  public:
39  Solver() {}
40 
41  virtual ~Solver() {}
42 
43  private:
44  Solver(const Solver&);
45  Solver& operator=(const Solver&);
46 
47  public:
48  virtual void set_parameters(const Parameters& params) = 0;
49 
50  virtual void set_parameters(const int Niter, const int Nrestart, const double Stop_cond) = 0;
51 
52  // virtual void set_parameters(const int Niter, const int Nrestart, const double Stop_cond, const bool use_init_guess) = 0;
53 
54  virtual void get_parameters(Parameters& params) const = 0;
55 
56  virtual void solve(Field& solution, const Field& source, int& Nconv, double& diff) = 0;
57 
58  virtual Fopr *get_fopr() = 0;
59 
60  virtual double flop_count() = 0;
61 
62 
63 #ifdef USE_FACTORY
64  public:
65  typedef Solver *(*ProductCreator)(Fopr *);
66  typedef Solver *(*ProductCreator_params)(Fopr *, const Parameters&);
67 
70 
71  static Solver *New(const IdentifierType& subtype, Fopr *fopr)
72  {
73  ProductCreator p = Factory::Find(subtype);
74 
75  return p ? (*p)(fopr) : 0;
76  }
77 
78  static Solver *New(const IdentifierType& subtype, Fopr *fopr, const Parameters& params)
79  {
80  ProductCreator_params p = Factory_params::Find(subtype);
81 
82  return p ? (*p)(fopr, params) : 0;
83  }
84 
85 #ifdef USE_FACTORY_AUTOREGISTER
86 #else
87  static bool init_factory();
88 #endif
89 #endif
90 };
91 #endif
AFopr< Field >
factory.h
Parameters
Class for parameters.
Definition: parameters.h:46
Solver::flop_count
virtual double flop_count()=0
Solver::set_parameters
virtual void set_parameters(const Parameters &params)=0
Solver::solve
virtual void solve(Field &solution, const Field &source, int &Nconv, double &diff)=0
Solver::~Solver
virtual ~Solver()
Definition: solver.h:41
Solver
Base class for linear solver class family.
Definition: solver.h:36
Solver::Solver
Solver()
Definition: solver.h:39
threadManager.h
FactoryTemplate
Definition: factory.h:42
Solver::get_parameters
virtual void get_parameters(Parameters &params) const =0
Solver::get_fopr
virtual Fopr * get_fopr()=0
fopr.h
Field
Container of Field-type object.
Definition: field.h:46
Solver::operator=
Solver & operator=(const Solver &)
IdentifierType
std::string IdentifierType
Definition: factory.h:39