Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
source_Wall_SF.cpp
Go to the documentation of this file.
1 
14 #include "source_Wall_SF.h"
15 
16 const std::string Source_Wall_SF::class_name = "Source_Wall_SF";
17 
18 //====================================================================
20 {
21  const string str_vlevel = params.get_string("verbose_level");
22 
23  m_vl = vout.set_verbose_level(str_vlevel);
24 
25  //- fetch and check input parameters
26  double ct_tilde;
27 
28  int err = 0;
29  err += params.fetch_double("ct_tilde", ct_tilde);
30 
31  if (err) {
32  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
33  exit(EXIT_FAILURE);
34  }
35 
36  set_parameters(ct_tilde);
37 }
38 
39 
40 //====================================================================
41 void Source_Wall_SF::set_parameters(const double ct_tilde)
42 {
43  //- print input parameters
44  vout.general(m_vl, "%s:\n", class_name.c_str());
45  vout.general(m_vl, " ct_tilde = %10.6f\n", ct_tilde);
46 
47  //- range check
48  // NB. ct_tilde=0 is allowed.
49 
50  //- store values
51  m_ct_tilde = ct_tilde;
52 }
53 
54 
55 //====================================================================
56 void Source_Wall_SF::set_parameters(Field_G *U, const double ct_tilde)
57 {
58  //- print input parameters
59  vout.general(m_vl, "%s:\n", class_name.c_str());
60  vout.general(m_vl, " ct_tilde = %10.6f\n", ct_tilde);
61 
62  //- range check
63  // NB. ct_tilde=0 is allowed.
64 
65  //- store values
66  m_U = U;
67  m_ct_tilde = ct_tilde;
68 }
69 
70 
71 //====================================================================
72 
77  const double ct_tilde)
78 {
79  //- print input parameters
80  vout.general(m_vl, "%s:\n", class_name.c_str());
81  vout.general(m_vl, " ct_tilde = %10.6f\n", ct_tilde);
82 
83  //- range check
84  // NB. ct_tilde=0 is allowed.
85 
86  //- store values
87  dr_smear->set_config(U);
88  const int Nsmear = dr_smear->get_Nsmear();
89  m_U = (Field_G *)dr_smear->getptr_smearedConfig(Nsmear);
90 
91  m_ct_tilde = ct_tilde;
92 }
93 
94 
95 //====================================================================
96 
111 void Source_Wall_SF::set_t0(Field_F& src, const int ic, const int id)
112 {
113  const int Nvol = CommonParameters::Nvol();
114  const int Ndim = CommonParameters::Ndim();
115 
116  std::vector<int> Nsize(Ndim);
117 
118  Nsize[0] = CommonParameters::Nx();
119  Nsize[1] = CommonParameters::Ny();
120  Nsize[2] = CommonParameters::Nz();
121  Nsize[3] = CommonParameters::Nt();
122 
123  const int Nc = CommonParameters::Nc();
124  const int Nd = CommonParameters::Nd();
125 
126  assert(ic < Nc);
127  assert(id < Nd / 2);
128  assert(src.nvol() == Nvol);
129  assert(src.nex() == 1);
130 
131  Mat_SU_N u0dag(Nc);
132  src.set(0.0);
133 
134  if (Communicator::ipe(3) == 0) {
135  const int t = 1;
136 
137  for (int z = 0; z < Nsize[2]; ++z) {
138  for (int y = 0; y < Nsize[1]; ++y) {
139  for (int x = 0; x < Nsize[0]; ++x) {
140  int site = m_index.site(x, y, z, t);
141  int site0 = m_index.site(x, y, z, t - 1);
142 
143  u0dag = m_U->mat_dag(site0, 3);
144 
145  for (int ac = 0; ac < Nc; ++ac) {
146  src.set_ri(ac, id, site, 0, u0dag.r(ac, ic), u0dag.i(ac, ic));
147  }
148  }
149  }
150  }
151  scal(src, m_ct_tilde);
152  }
153 }
154 
155 
156 //====================================================================
157 
171 void Source_Wall_SF::set_tT(Field_F& src, const int ic, const int id)
172 {
173  const int NPEt = CommonParameters::NPEt();
174  const int Nvol = CommonParameters::Nvol();
175  const int Ndim = CommonParameters::Ndim();
176 
177  std::vector<int> Nsize(Ndim);
178 
179  Nsize[0] = CommonParameters::Nx();
180  Nsize[1] = CommonParameters::Ny();
181  Nsize[2] = CommonParameters::Nz();
182  Nsize[3] = CommonParameters::Nt();
183 
184  const int Nc = CommonParameters::Nc();
185  const int Nd = CommonParameters::Nd();
186 
187  assert(ic < Nc);
188  assert(id > Nd / 2 - 1);
189  assert(id < Nd);
190  assert(src.nvol() == Nvol);
191  assert(src.nex() == 1);
192 
193  Mat_SU_N u0(Nc);
194  src.set(0.0);
195 
196  if (Communicator::ipe(3) == (NPEt - 1)) {
197  const int t = Nsize[3] - 1;
198 
199  for (int z = 0; z < Nsize[2]; ++z) {
200  for (int y = 0; y < Nsize[1]; ++y) {
201  for (int x = 0; x < Nsize[0]; ++x) {
202  int site = m_index.site(x, y, z, t);
203  u0 = m_U->mat(site, 3);
204 
205  for (int ac = 0; ac < Nc; ++ac) {
206  src.set_ri(ac, id, site, 0, u0.r(ac, ic), u0.i(ac, ic));
207  }
208  }
209  }
210  }
211  scal(src, m_ct_tilde);
212  }
213 }
214 
215 
216 //====================================================================
217 //============================================================END=====
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:433
Bridge::VerboseLevel m_vl
static const std::string class_name
BridgeIO vout
Definition: bridgeIO.cpp:503
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
int site(const int &x, const int &y, const int &z, const int &t) const
Definition: index_lex.h:53
void general(const char *format,...)
Definition: bridgeIO.cpp:197
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
int nvol() const
Definition: field.h:127
Class for parameters.
Definition: parameters.h:46
static int ipe(const int dir)
logical coordinate of current proc.
Wilson-type fermion field.
Definition: field_F.h:37
SU(N) gauge field.
Definition: field_G.h:38
void set_ri(const int cc, const int s, const int site, const int e, const double re, const double im)
Definition: field_F.h:116
void set_parameters(const Parameters &params)
Index_lex m_index
int nex() const
Definition: field.h:128
void set_t0(Field_F &src, const int ic, const int id)
Set the 3D wall source at t=1.
void set_config(Field *U)
set pointer to original thin link variable
int get_Nsmear()
get number of applied smearing operation
Field_G * m_U
Pointer to gauge field.
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
void set_tT(Field_F &src, const int ic, const int id)
Set the 3D wall source at t=T-1.
Manager of smeared configurations.
Field * getptr_smearedConfig(const int i_smear)
get pointer to i-th smeared config (0th is original thin link)
Mat_SU_N mat_dag(const int site, const int mn=0) const
Definition: field_G.h:127
string get_string(const string &key) const
Definition: parameters.cpp:221
Mat_SU_N mat(const int site, const int mn=0) const
Definition: field_G.h:114
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131
double m_ct_tilde
Boundary O(a) improvement factor for the Wilson (clover) fermion.