Bridge++  Ver. 2.0.2
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  std::string vlevel;
22  if (!params.fetch_string("verbose_level", vlevel)) {
23  m_vl = vout.set_verbose_level(vlevel);
24  }
25 
26  //- fetch and check input parameters
27  double ct_tilde;
28 
29  int err = 0;
30  err += params.fetch_double("ct_tilde", ct_tilde);
31 
32  if (err) {
33  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
34  exit(EXIT_FAILURE);
35  }
36 
37  set_parameters(ct_tilde);
38 }
39 
40 
41 //====================================================================
43 {
44  params.set_double("ct_tilde", m_ct_tilde);
45 
46  params.set_string("verbose_level", vout.get_verbose_level(m_vl));
47 }
48 
49 
50 //====================================================================
51 void Source_Wall_SF::set_parameters(const double ct_tilde)
52 {
53  //- print input parameters
54  vout.general(m_vl, "%s:\n", class_name.c_str());
55  vout.general(m_vl, " ct_tilde = %10.6f\n", ct_tilde);
56 
57  //- range check
58  // NB. ct_tilde=0 is allowed.
59 
60  //- store values
61  m_ct_tilde = ct_tilde;
62 }
63 
64 
65 //====================================================================
66 void Source_Wall_SF::set_parameters(Field_G *U, const double ct_tilde)
67 {
68  //- print input parameters
69  vout.general(m_vl, "%s:\n", class_name.c_str());
70  vout.general(m_vl, " ct_tilde = %10.6f\n", ct_tilde);
71 
72  //- range check
73  // NB. ct_tilde=0 is allowed.
74 
75  //- store values
76  m_U = U;
77  m_ct_tilde = ct_tilde;
78 }
79 
80 
81 //====================================================================
82 
87  const double ct_tilde)
88 {
89  //- print input parameters
90  vout.general(m_vl, "%s:\n", class_name.c_str());
91  vout.general(m_vl, " ct_tilde = %10.6f\n", ct_tilde);
92 
93  //- range check
94  // NB. ct_tilde=0 is allowed.
95 
96  //- store values
97  dr_smear->set_config(U);
98  const int Nsmear = dr_smear->get_Nsmear();
99  m_U = (Field_G *)dr_smear->getptr_smearedConfig(Nsmear);
100 
101  m_ct_tilde = ct_tilde;
102 }
103 
104 
105 //====================================================================
106 
121 void Source_Wall_SF::set_t0(Field_F& src, const int ic, const int id)
122 {
123  const int Nvol = CommonParameters::Nvol();
124  const int Ndim = CommonParameters::Ndim();
125 
126  std::vector<int> Nsize(Ndim);
127 
128  Nsize[0] = CommonParameters::Nx();
129  Nsize[1] = CommonParameters::Ny();
130  Nsize[2] = CommonParameters::Nz();
131  Nsize[3] = CommonParameters::Nt();
132 
133  const int Nc = CommonParameters::Nc();
134  const int Nd = CommonParameters::Nd();
135 
136  assert(ic < Nc);
137  assert(id < Nd / 2);
138  assert(src.nvol() == Nvol);
139  assert(src.nex() == 1);
140 
141  Mat_SU_N u0dag(Nc);
142  src.set(0.0);
143 
144  if (Communicator::ipe(3) == 0) {
145  const int t = 1;
146 
147  for (int z = 0; z < Nsize[2]; ++z) {
148  for (int y = 0; y < Nsize[1]; ++y) {
149  for (int x = 0; x < Nsize[0]; ++x) {
150  int site = m_index.site(x, y, z, t);
151  int site0 = m_index.site(x, y, z, t - 1);
152 
153  u0dag = m_U->mat_dag(site0, 3);
154 
155  for (int ac = 0; ac < Nc; ++ac) {
156  src.set_ri(ac, id, site, 0, u0dag.r(ac, ic), u0dag.i(ac, ic));
157  }
158  }
159  }
160  }
161  scal(src, m_ct_tilde);
162  }
163 }
164 
165 
166 //====================================================================
167 
181 void Source_Wall_SF::set_tT(Field_F& src, const int ic, const int id)
182 {
183  const int NPEt = CommonParameters::NPEt();
184  const int Nvol = CommonParameters::Nvol();
185  const int Ndim = CommonParameters::Ndim();
186 
187  std::vector<int> Nsize(Ndim);
188 
189  Nsize[0] = CommonParameters::Nx();
190  Nsize[1] = CommonParameters::Ny();
191  Nsize[2] = CommonParameters::Nz();
192  Nsize[3] = CommonParameters::Nt();
193 
194  const int Nc = CommonParameters::Nc();
195  const int Nd = CommonParameters::Nd();
196 
197  assert(ic < Nc);
198  assert(id > Nd / 2 - 1);
199  assert(id < Nd);
200  assert(src.nvol() == Nvol);
201  assert(src.nex() == 1);
202 
203  Mat_SU_N u0(Nc);
204  src.set(0.0);
205 
206  if (Communicator::ipe(3) == (NPEt - 1)) {
207  const int t = Nsize[3] - 1;
208 
209  for (int z = 0; z < Nsize[2]; ++z) {
210  for (int y = 0; y < Nsize[1]; ++y) {
211  for (int x = 0; x < Nsize[0]; ++x) {
212  int site = m_index.site(x, y, z, t);
213  u0 = m_U->mat(site, 3);
214 
215  for (int ac = 0; ac < Nc; ++ac) {
216  src.set_ri(ac, id, site, 0, u0.r(ac, ic), u0.i(ac, ic));
217  }
218  }
219  }
220  }
221  scal(src, m_ct_tilde);
222  }
223 }
224 
225 
226 //====================================================================
227 //============================================================END=====
Source_Wall_SF::class_name
static const std::string class_name
Definition: source_Wall_SF.h:39
CommonParameters::Ny
static int Ny()
Definition: commonParameters.h:106
CommonParameters::Nz
static int Nz()
Definition: commonParameters.h:107
Parameters::set_string
void set_string(const string &key, const string &value)
Definition: parameters.cpp:39
CommonParameters::Ndim
static int Ndim()
Definition: commonParameters.h:117
Field::set
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
Parameters
Class for parameters.
Definition: parameters.h:46
Field_G::mat_dag
Mat_SU_N mat_dag(const int site, const int mn=0) const
Definition: field_G.h:127
Parameters::set_double
void set_double(const string &key, const double value)
Definition: parameters.cpp:33
Field::nex
int nex() const
Definition: field.h:128
CommonParameters::Nvol
static int Nvol()
Definition: commonParameters.h:109
Field_F::set_ri
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
Source_Wall_SF::m_ct_tilde
double m_ct_tilde
Boundary O(a) improvement factor for the Wilson (clover) fermion.
Definition: source_Wall_SF.h:48
Director_Smear::getptr_smearedConfig
Field * getptr_smearedConfig(const int i_smear)
get pointer to i-th smeared config (0th is original thin link)
Definition: director_Smear.cpp:88
CommonParameters::Nx
static int Nx()
Definition: commonParameters.h:105
CommonParameters::Nc
static int Nc()
Definition: commonParameters.h:115
Source_Wall_SF::set_parameters
void set_parameters(const Parameters &params)
Definition: source_Wall_SF.cpp:19
Source_Wall_SF::set_t0
void set_t0(Field_F &src, const int ic, const int id)
Set the 3D wall source at t=1.
Definition: source_Wall_SF.cpp:121
CommonParameters::Nt
static int Nt()
Definition: commonParameters.h:108
SU_N::Mat_SU_N
Definition: mat_SU_N.h:36
SU_N::Mat_SU_N::r
double r(int c) const
Definition: mat_SU_N.h:115
Field::nvol
int nvol() const
Definition: field.h:127
Source_Wall_SF::m_index
Index_lex m_index
Definition: source_Wall_SF.h:50
source_Wall_SF.h
Index_lex::site
int site(const int &x, const int &y, const int &z, const int &t) const
Definition: index_lex.h:55
Director_Smear
Manager of smeared configurations.
Definition: director_Smear.h:39
Source_Wall_SF::set_tT
void set_tT(Field_F &src, const int ic, const int id)
Set the 3D wall source at t=T-1.
Definition: source_Wall_SF.cpp:181
CommonParameters::Nd
static int Nd()
Definition: commonParameters.h:116
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
Source_Wall_SF::m_U
Field_G * m_U
Pointer to gauge field.
Definition: source_Wall_SF.h:46
Director_Smear::get_Nsmear
int get_Nsmear()
get number of applied smearing operation
Definition: director_Smear.h:83
SU_N::Mat_SU_N::i
double i(int c) const
Definition: mat_SU_N.h:116
scal
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:261
Communicator::ipe
static int ipe(const int dir)
logical coordinate of current proc.
Definition: communicator.cpp:105
Parameters::fetch_string
int fetch_string(const string &key, string &value) const
Definition: parameters.cpp:378
Field_F
Wilson-type fermion field.
Definition: field_F.h:37
Parameters::fetch_double
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
CommonParameters::NPEt
static int NPEt()
Definition: commonParameters.h:100
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition: bridgeIO.cpp:180
Field_G::mat
Mat_SU_N mat(const int site, const int mn=0) const
Definition: field_G.h:114
Director_Smear::set_config
void set_config(Field *U)
set pointer to original thin link variable
Definition: director_Smear.cpp:79
Field_G
SU(N) gauge field.
Definition: field_G.h:38
Bridge::BridgeIO::general
void general(const char *format,...)
Definition: bridgeIO.cpp:200
Source_Wall_SF::get_parameters
void get_parameters(Parameters &params) const
Definition: source_Wall_SF.cpp:42
Source_Wall_SF::m_vl
Bridge::VerboseLevel m_vl
Definition: source_Wall_SF.h:42
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
Bridge::BridgeIO::get_verbose_level
static std::string get_verbose_level(const VerboseLevel vl)
Definition: bridgeIO.cpp:154