Bridge++  Ver. 2.0.2
asolver_BiCGStab_Precond.h
Go to the documentation of this file.
1 
9 #ifndef ASOLVER_BICGSTAB_PRECOND_H
10 #define ASOLVER_BICGSTAB_PRECOND_H
11 
12 #include <cstdio>
13 #include <cstdlib>
14 #include <vector>
15 using std::vector;
16 #include <string>
17 using std::string;
18 
19 #include "lib_alt/Solver/asolver.h"
20 #include "lib/Fopr/afopr.h"
22 
23 template<typename AFIELD>
24 class ASolver_BiCGStab_Precond : public ASolver<AFIELD>
25 {
26  public:
27  typedef typename AFIELD::real_t real_t;
29  static const std::string class_name;
30 
31  private:
32 
35 
36  int m_Niter;
39 
43 
44  protected:
45 
47  int m_nconv;
48 
51 
52  public:
56  : m_Niter(0), m_Stop_cond(0.0L)
57  {
58  m_fopr = fopr;
59  m_prec = prec;
60  init();
61  }
62 
65 
67  void set_parameters(const Parameters& params);
68 
70  void set_parameters(const int Niter, const real_t Stop_cond);
71 
73  void solve(AFIELD& xq, const AFIELD& b, int& nconv, real_t& diff);
74 
77 
79  double flop_count();
80 
81  protected:
82 
84  void init(void);
85 
87  void tidyup(void);
88 
89  void solve_init(const AFIELD& b, real_t& rr);
90 
91  void solve_step(real_t& rr);
92 
93  void prec(AFIELD&, AFIELD&);
94 };
95 
96 #endif // ASOLVER_BICGSTAB_PRECOND_H
ASolver_BiCGStab_Precond::ASolver_BiCGStab_Precond
ASolver_BiCGStab_Precond(AFopr< AFIELD > *fopr, APrecond< AFIELD > *prec)
constructor.
Definition: asolver_BiCGStab_Precond.h:54
ASolver_BiCGStab_Precond::m_nconv
int m_nconv
to remember convergence iteration to provide flop count.
Definition: asolver_BiCGStab_Precond.h:47
ASolver_BiCGStab_Precond::m_rh
AFIELD m_rh
Definition: asolver_BiCGStab_Precond.h:41
ASolver_BiCGStab_Precond::solve
void solve(AFIELD &xq, const AFIELD &b, int &nconv, real_t &diff)
solver main.
Definition: asolver_BiCGStab_Precond-tmpl.h:97
AFopr
Definition: afopr.h:48
ASolver
Definition: asolver.h:23
ASolver_BiCGStab_Precond::m_p
AFIELD m_p
Definition: asolver_BiCGStab_Precond.h:41
ASolver_BiCGStab_Precond::solve_step
void solve_step(real_t &rr)
Definition: asolver_BiCGStab_Precond-tmpl.h:182
ASolver_BiCGStab_Precond::m_Stop_cond2
real_t m_Stop_cond2
stopping criterion for inner solver.
Definition: asolver_BiCGStab_Precond.h:38
ASolver_BiCGStab_Precond::prec
void prec(AFIELD &, AFIELD &)
Definition: asolver_BiCGStab_Precond-tmpl.h:224
Parameters
Class for parameters.
Definition: parameters.h:46
APrecond
Definition: aprecond.h:28
ASolver_BiCGStab_Precond::m_alpha_prev
real_t m_alpha_prev
Definition: asolver_BiCGStab_Precond.h:42
ASolver_BiCGStab_Precond::m_u
AFIELD m_u
Definition: asolver_BiCGStab_Precond.h:41
ASolver_BiCGStab_Precond::m_x
AFIELD m_x
Matsufuru added: new AField_dev implementation.
Definition: asolver_BiCGStab_Precond.h:41
ASolver_BiCGStab_Precond::m_v
AFIELD m_v
Definition: asolver_BiCGStab_Precond.h:41
real_t
double real_t
Definition: bridgeQXS_Clover_coarse_double.cpp:16
ASolver_BiCGStab_Precond::m_t
AFIELD m_t
Definition: asolver_BiCGStab_Precond.h:41
ASolver_BiCGStab_Precond::get_afopr
AFopr< AFIELD > * get_afopr()
returns the pointer to the fermion operator.
Definition: asolver_BiCGStab_Precond.h:76
Field::real_t
double real_t
Definition: field.h:51
ASolver_BiCGStab_Precond::~ASolver_BiCGStab_Precond
~ASolver_BiCGStab_Precond()
destructor.
Definition: asolver_BiCGStab_Precond.h:64
ASolver_BiCGStab_Precond::m_rho_prev
real_t m_rho_prev
Definition: asolver_BiCGStab_Precond.h:42
ASolver_BiCGStab_Precond::m_r
AFIELD m_r
Definition: asolver_BiCGStab_Precond.h:41
ASolver_BiCGStab_Precond::init
void init(void)
initial setup.
Definition: asolver_BiCGStab_Precond-tmpl.h:17
ASolver_BiCGStab_Precond::solve_init
void solve_init(const AFIELD &b, real_t &rr)
Definition: asolver_BiCGStab_Precond-tmpl.h:159
ASolver_BiCGStab_Precond::m_Stop_cond
real_t m_Stop_cond
stopping criterion (squared).
Definition: asolver_BiCGStab_Precond.h:37
ASolver_BiCGStab_Precond::m_omega_prev
real_t m_omega_prev
Definition: asolver_BiCGStab_Precond.h:42
ASolver_BiCGStab_Precond::m_Niter
int m_Niter
maximum iteration number.
Definition: asolver_BiCGStab_Precond.h:36
ASolver_BiCGStab_Precond::m_prec
APrecond< AFIELD > * m_prec
preconditioner.
Definition: asolver_BiCGStab_Precond.h:34
ASolver_BiCGStab_Precond::tidyup
void tidyup(void)
final tidy-up.
Definition: asolver_BiCGStab_Precond-tmpl.h:40
ASolver_BiCGStab_Precond::m_s
AFIELD m_s
Definition: asolver_BiCGStab_Precond.h:41
ASolver_BiCGStab_Precond::m_fopr
AFopr< AFIELD > * m_fopr
fermion operator.
Definition: asolver_BiCGStab_Precond.h:33
ASolver_BiCGStab_Precond::set_parameters
void set_parameters(const Parameters &params)
setting parameters by a Parameter object.
Definition: asolver_BiCGStab_Precond-tmpl.h:49
ASolver_BiCGStab_Precond
Definition: asolver_BiCGStab_Precond.h:24
aprecond.h
ASolver_BiCGStab_Precond::flop_count
double flop_count()
returns the floating point operation count.
Definition: asolver_BiCGStab_Precond-tmpl.h:232
Field
Container of Field-type object.
Definition: field.h:46
afopr.h
ASolver_BiCGStab_Precond::ASolver_BiCGStab_Precond
ASolver_BiCGStab_Precond()
calling constructor without fermion operator is forbidden.
Definition: asolver_BiCGStab_Precond.h:50
asolver.h
ASolver_BiCGStab_Precond::class_name
static const std::string class_name
Definition: asolver_BiCGStab_Precond.h:29
ASolver_BiCGStab_Precond::real_t
AFIELD::real_t real_t
Definition: asolver_BiCGStab_Precond.h:27
ASolver::real_t
AFIELD::real_t real_t
Definition: asolver.h:29