Bridge++  Ver. 1.1.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fopr_Overlap.h
Go to the documentation of this file.
1 
15 #ifndef FOPR_OVERLAP_INCLUDED
16 #define FOPR_OVERLAP_INCLUDED
17 
18 #include "fopr_Wilson.h"
19 #include "fopr_Sign.h"
20 
21 #include "bridgeIO.h"
22 using Bridge::vout;
23 
24 //- parameters class
25 class Parameters_Fopr_Overlap : virtual public Parameters
26 {
27  public:
29 };
30 //- end
31 
33 
49 class Fopr_Overlap : public Fopr
50 {
51  private:
52  //- parameters
53  double m_mq; // quark mass
54  double m_M0; // domain-wall height
55  int m_Np; // number of poles in rational approx.
56  double m_x_min, m_x_max; // valid range of approximate sign function
57  int m_Niter; // max iteration of shiftsolver
58  double m_Stop_cond; // stopping condition of shift solver
59  std::valarray<int> m_boundary;
60 
61  //- pointers to used classes
62  Fopr_Wilson *m_fopr_w; // kernel fermion operator.
63  Fopr_Sign *m_sign; // sign function approximation.
64 
65  //- for low-eigenmode subtraction.
66  int m_Nsbt;
67  std::valarray<double> *m_ev;
68  std::valarray<Field> *m_vk;
69 
70  //- mode control
71  std::string m_mode;
72  void (Fopr_Overlap::*m_mult) (Field&, const Field&);
73  void (Fopr_Overlap::*m_mult_dag) (Field&, const Field&);
74 
75  public:
76 
78  : Fopr()
79  {
80  m_fopr_w = fopr;
81  m_sign = new Fopr_Sign(m_fopr_w);
84  }
85 
87  {
88  delete m_sign;
89  }
90 
91  void set_parameters(const Parameters& params);
92  void set_parameters(const double mq, const double M0, const int Np,
93  const double x_min, const double x_max,
94  const int Niter, const double Stop_cond,
95  const std::valarray<int> bc);
96 
97  void set_config(Field *U)
98  {
99  m_sign->set_config(U);
100  // m_fopr_w->set_config() is called in m_sign.
101  }
102 
103  void set_lowmodes(int Nsbt, std::valarray<double> *,
104  std::valarray<Field> *);
105 
106  const Field mult(const Field& f)
107  {
108  Field v(f.nin(), f.nvol(), f.nex());
109 
110  mult(v, f);
111  return v;
112  }
113 
114  const Field mult_dag(const Field& f)
115  {
116  Field v(f.nin(), f.nvol(), f.nex());
117 
118  mult_dag(v, f);
119  return v;
120  }
121 
122  void mult(Field& v, const Field& f)
123  {
124  (this->*m_mult)(v, f);
125  }
126 
127  void mult_dag(Field& v, const Field& f)
128  {
129  (this->*m_mult_dag)(v, f);
130  }
131 
132  void set_mode(std::string mode)
133  {
134  m_mode = mode;
135  if (m_mode == "D") {
138  } else if (m_mode == "Ddag") {
141  } else if (m_mode == "DdagD") {
144  } else if (m_mode == "H") {
147  } else {
148  vout.crucial(m_vl, "Fopr_Overlap: mode undefined.\n");
149  abort();
150  }
151  }
152 
153  std::string get_mode() const
154  {
155  return m_mode;
156  }
157 
158  void H(Field& v, const Field& f);
159  void D(Field& v, const Field& f);
160  void Ddag(Field& v, const Field& f);
161  void DdagD(Field& v, const Field& f);
162 
163  void mult_undef(Field& v, const Field& f)
164  {
165  vout.crucial(m_vl, "Fopr_Overlap: mode undefined.\n");
166  abort();
167  }
168 
169  int field_nvol() { return m_fopr_w->field_nvol(); }
170  int field_nin() { return m_fopr_w->field_nin(); }
171  int field_nex() { return m_fopr_w->field_nex(); }
172 };
173 #endif