Bridge++  Ver. 1.3.x
solver_CG.h
Go to the documentation of this file.
1 
14 #ifndef SOLVER_CG_INCLUDED
15 #define SOLVER_CG_INCLUDED
16 
17 #include "solver.h"
18 
19 #include "bridgeIO.h"
20 using Bridge::vout;
21 
22 //- parameters class
23 class Parameters_Solver_CG : virtual public Parameters
24 {
25  public:
27 };
28 //- end
29 
31 
43 class Solver_CG : public Solver
44 {
45  public:
46  static const std::string class_name;
47 
48  private:
50  int m_Niter;
51  double m_Stop_cond;
52 
53  Field s, r, x, p;
54  // double rr_prev;
55 
56  public:
57  Solver_CG(Fopr *fopr)
58  : Solver(), m_fopr(fopr) {}
59 
61  : Solver(), m_fopr(fopr.get()) {}
62 
64 
65  void set_parameters(const Parameters& params);
66  void set_parameters(const int Niter, const double Stop_cond);
67 
68  void solve(Field& solution, const Field& source,
69  int& Nconv, double& diff);
70 
71  Fopr *get_fopr() { return m_fopr; }
72 
73  private:
74  void reset_field(const Field&);
75 
76  void solve_init(const Field&, double&);
77  void solve_step(double&);
78 };
79 #endif
BridgeIO vout
Definition: bridgeIO.cpp:278
Fopr * get_fopr()
Definition: solver_CG.h:71
void solve_init(const Field &, double &)
Definition: solver_CG.cpp:200
~Solver_CG()
Definition: solver_CG.h:63
double m_Stop_cond
Definition: solver_CG.h:51
void reset_field(const Field &)
Definition: solver_CG.cpp:177
Solver_CG(Fopr *fopr)
Definition: solver_CG.h:57
void solve(Field &solution, const Field &source, int &Nconv, double &diff)
Definition: solver_CG.cpp:104
Container of Field-type object.
Definition: field.h:39
static const std::string class_name
Definition: solver_CG.h:46
void solve_step(double &)
Definition: solver_CG.cpp:215
Class for parameters.
Definition: parameters.h:38
Solver_CG(unique_ptr< Fopr > &fopr)
Definition: solver_CG.h:60
Standard Conjugate Gradient solver algorithm.
Definition: solver_CG.h:43
Field x
Definition: solver_CG.h:53
void set_parameters(const Parameters &params)
Definition: solver_CG.cpp:53
Field r
Definition: solver_CG.h:53
Field p
Definition: solver_CG.h:53
Fopr * m_fopr
Definition: solver_CG.h:49
Base class for linear solver class family.
Definition: solver.h:38
Field s
Definition: solver_CG.h:53
Base class of fermion operator family.
Definition: fopr.h:49
int m_Niter
Definition: solver_CG.h:50