Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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:
40  : m_vl(CommonParameters::Vlevel()) {}
41 
42  virtual ~Solver() {}
43 
44  private:
45  Solver(const Solver&);
46  Solver& operator=(const Solver&);
47 
48  public:
49  virtual void set_parameters(const Parameters& params) = 0;
50  virtual void set_parameters(const int Niter, const int Nrestart, const double Stop_cond) = 0;
51  virtual void set_parameters(const int Niter, const int Nrestart, const double Stop_cond, const bool use_init_guess) = 0;
52 
54 
55  virtual void solve(Field& solution, const Field& source,
56  int& Nconv, double& diff) = 0;
57 
58  virtual Fopr *get_fopr() = 0;
59 
60  virtual double flop_count() = 0;
61 
62  protected:
64 
65 #ifdef USE_FACTORY
66  public:
67  typedef Solver *(*ProductCreator)(Fopr *);
69 
70  static Solver *New(const IdentifierType& subtype, Fopr *fopr)
71  {
72  ProductCreator p = Factory::Find(subtype);
73 
74  return p ? (*p)(fopr) : 0;
75  }
76 
77  static Solver *New(const IdentifierType& subtype, unique_ptr<Fopr>& fopr)
78  {
79  ProductCreator p = Factory::Find(subtype);
80 
81  return p ? (*p)(fopr.get()) : 0;
82  }
83 
84 #ifdef USE_FACTORY_AUTOREGISTER
85 #else
86  static bool init_factory();
87 #endif
88 #endif
89 };
90 #endif
Container of Field-type object.
Definition: field.h:45
virtual Fopr * get_fopr()=0
virtual ~Solver()
Definition: solver.h:42
Class for parameters.
Definition: parameters.h:46
virtual void set_parameters(const Parameters &params)=0
Solver()
Definition: solver.h:39
Solver & operator=(const Solver &)
pointer get() const
Common parameter class: provides parameters as singleton.
Base class for linear solver class family.
Definition: solver.h:36
Bridge::VerboseLevel vl
VerboseLevel
Definition: bridgeIO.h:42
std::string IdentifierType
Factory template class.
Definition: factory.h:39
Base class of fermion operator family.
Definition: fopr.h:46
void set_parameter_verboselevel(const Bridge::VerboseLevel vl)
Definition: solver.h:53
virtual void solve(Field &solution, const Field &source, int &Nconv, double &diff)=0
virtual double flop_count()=0
Bridge::VerboseLevel m_vl
Definition: solver.h:63