Bridge++  Ver. 1.1.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
40 class Solver_CG : public Solver
41 {
42  private:
44  int m_Niter;
45  double m_Stop_cond;
46 
47  Field s, r, x, p, v;
48 
49  public:
50  Solver_CG(Fopr *fopr)
51  : Solver(), m_fopr(fopr) {}
52 
54 
55  void set_parameters(const Parameters& params);
56  void set_parameters(const int Niter, const double Stop_cond);
57 
58  void solve(Field& solution, const Field& source,
59  int& Nconv, double& diff);
60 
61  Fopr *get_fopr() { return m_fopr; }
62 
63  private:
64  void reset_field(const Field&);
65 
66  void solve_init(const Field&, double&);
67  void solve_step(double&);
68 };
69 #endif