Bridge++  Ver. 1.1.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
solver.h
Go to the documentation of this file.
1 
15 #ifndef SOLVER_INCLUDED
16 #define SOLVER_INCLUDED
17 
18 #include "defs.h"
19 #include "parameters.h"
20 #include "commonParameters.h"
21 #include "bridgeIO.h"
22 
23 #include "fopr.h"
24 #include "field.h"
25 
26 #ifdef USE_FACTORY
27 #include "factory.h"
28 #endif
29 
30 
32 
37 class Solver
38 {
39  public:
40 
42  : m_vl(CommonParameters::Vlevel()) {}
43 
44  virtual ~Solver() {}
45 
46  virtual void set_parameters(const Parameters& params) = 0;
47 
49 
50  virtual void set_parameters(const int Niter, const double Stop_cond) = 0;
51 
52  virtual void solve(Field& solution, const Field& source,
53  int& Nconv, double& diff) = 0;
54 
55  virtual Fopr *get_fopr() = 0;
56 
57  protected:
58 
60 
61 #ifdef USE_FACTORY
62  public:
63  typedef Solver *(*ProductCreator)(Fopr *);
65 
66  static Solver *New(const IdentifierType& subtype, Fopr *fopr)
67  {
68  ProductCreator p = Factory::Find(subtype);
69 
70  return p ? (*p)(fopr) : 0;
71  }
72 #endif
73 };
74 #endif