Bridge++  Ver. 1.2.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
field_G_SF.cpp
Go to the documentation of this file.
1 
14 #include "field_G_SF.h"
15 
16 #ifdef USE_PARAMETERS_FACTORY
17 #include "parameters_factory.h"
18 #endif
19 
20 //- parameter entries
21 namespace {
22  void append_entry(Parameters& param)
23  {
24  param.Register_double("phi", 0.0);
25  param.Register_double("phipr", 0.0);
26  }
27 
28 
29 #ifdef USE_PARAMETERS_FACTORY
30  bool init_param = ParametersFactory::Register("Field_G_SF", append_entry);
31 #endif
32 }
33 //- end
34 
35 //- parameters class
37 //- end
38 
39 //====================================================================
40 
51 {
52  int mn = 0;
53 
54  if (Communicator::ipe(3) == 0) {
55  for (int site = 0; site < Svol; ++site) {
56  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
57  field[myindex(2 * cc, site, mn)] = U.r(cc);
58  field[myindex(2 * cc + 1, site, mn)] = U.i(cc);
59  }
60  }
61  }
62 }
63 
64 
65 //====================================================================
66 
77 {
78  int mn = 0;
79 
80  if (Communicator::ipe(3) == NPEt - 1) {
81  for (int site = m_Nvol - Svol; site < m_Nvol; ++site) {
82  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
83  field[myindex(2 * cc, site, mn)] = U.r(cc);
84  field[myindex(2 * cc + 1, site, mn)] = U.i(cc);
85  }
86  }
87  }
88 }
89 
90 
91 //====================================================================
92 
102 {
103  int mn = 0;
104 
105  if (Communicator::ipe(3) == 0) {
106  for (int site = 0; site < Svol; ++site) {
107  for (int cc = 0; cc < 2 * m_Nc * m_Nc; ++cc) {
108  field[myindex(cc, site, mn)] = 0.0;
109  }
110  }
111  }
112 }
113 
114 
115 //====================================================================
116 
126 {
127  if (Communicator::ipe(3) == 0) {
128  for (int mn = 0; mn < 3; ++mn) {
129  for (int site = 0; site < Svol; ++site) {
130  for (int cc = 0; cc < 2 * m_Nc * m_Nc; ++cc) {
131  field[myindex(cc, site, mn)] = 0.0;
132  }
133  }
134  }
135  }
136 }
137 
138 
139 //====================================================================
140 
151 void Field_G_SF::mult_ct_boundary(int t, double ct)
152 {
153  int mn = 0;
154  int ini = Nx * Ny * Nz * t;
155  int fin = Nx * Ny * Nz * (t + 1);
156 
157  if (((Communicator::ipe(3) == 0) && ((t == 0) || (t == 1))) || ((Communicator::ipe(3) == NPEt - 1) && (t == Nt - 1))) {
158  for (int site = ini; site < fin; ++site) {
159  for (int cc = 0; cc < 2 * m_Nc * m_Nc; ++cc) {
160  field[myindex(cc, site, mn)] *= ct;
161  }
162  }
163  }
164 }
165 
166 
167 //====================================================================
168 
179 {
180  int mn = 0;
181 
182  assert(f.nex() == 1);
183  if (Communicator::ipe(3) == 0) {
184  for (int site = 0; site < Svol; ++site) {
185  f.set_mat(site, mn, wk);
186  }
187  }
188 }
189 
190 
191 //====================================================================
192 
203 {
204  int mn = 0;
205 
206  assert(f.nex() == 1);
207  if (Communicator::ipe(3) == NPEt - 1) {
208  for (int site = m_Nvol - Svol; site < m_Nvol; ++site) {
209  f.set_mat(site, mn, wkpr);
210  }
211  }
212 }
213 
214 
215 //====================================================================
216 
227 {
228  int mn = 0;
229 
230  assert(f.nex() == 1);
231  if (Communicator::ipe(3) == 0) {
232  for (int site = 0; site < Svol; ++site) {
233  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
234  f.set_ri(cc, site, mn, 0.0, 0.0);
235  }
236  }
237  }
238 }
239 
240 
241 //====================================================================
242 
253 {
254  assert(f.nex() >= 3);
255  if (Communicator::ipe(3) == 0) {
256  for (int mn = 0; mn < 3; ++mn) {
257  for (int site = 0; site < Svol; ++site) {
258  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
259  f.set_ri(cc, site, mn, 0.0, 0.0);
260  }
261  }
262  }
263  }
264 }
265 
266 
267 //====================================================================
269 {
270  std::valarray<double> phi = params.get_double_vector("phi");
271  std::valarray<double> phipr = params.get_double_vector("phipr");
272 
273  set_parameters(&phi[0], &phipr[0]);
274 }
275 
276 
277 //====================================================================
278 void Field_G_SF::set_parameters(const std::valarray<double>& phi,
279  const std::valarray<double>& phipr)
280 {
281  double aphi[3];
282  double aphipr[3];
283 
284  for (int i = 0; i < 3; ++i) {
285  aphi[i] = phi[i];
286  aphipr[i] = phipr[i];
287  }
288 
289  set_parameters(aphi, aphipr);
290 }
291 
292 
293 //====================================================================
294 void Field_G_SF::set_parameters(double *phi, double *phipr)
295 {
296  int Lx = CommonParameters::Lx();
297  double c0r, c0i, c1r, c1i, c2r, c2i;
298 
299  c0r = cos(phi[0] / Lx);
300  c0i = sin(phi[0] / Lx);
301  c1r = cos(phi[1] / Lx);
302  c1i = sin(phi[1] / Lx);
303  c2r = cos(phi[2] / Lx);
304  c2i = sin(phi[2] / Lx);
305 
306  wk.zero();
307  wk.set(0, 0, c0r, c0i);
308  wk.set(1, 1, c1r, c1i);
309  wk.set(2, 2, c2r, c2i);
310 
311  c0r = cos(phipr[0] / Lx);
312  c0i = sin(phipr[0] / Lx);
313  c1r = cos(phipr[1] / Lx);
314  c1i = sin(phipr[1] / Lx);
315  c2r = cos(phipr[2] / Lx);
316  c2i = sin(phipr[2] / Lx);
317 
318  wkpr.zero();
319  wkpr.set(0, 0, c0r, c0i);
320  wkpr.set(1, 1, c1r, c1i);
321  wkpr.set(2, 2, c2r, c2i);
322 }
323 
324 
325 //====================================================================
void set_boundary_zero()
Set the boundary matrix to 0 for SF bc.
Definition: field_G_SF.cpp:101
double i(int c) const
Definition: mat_SU_N.h:115
void set_boundary_wkpr(const Mat_SU_N &U)
Set the boundary spatial link at t=Nt-1 for SF bc.
Definition: field_G_SF.cpp:76
Mat_SU_N & zero()
Definition: mat_SU_N.h:383
SU(N) gauge field class in which a few functions are added for the SF.
Definition: field_G_SF.h:34
Class for parameters.
Definition: parameters.h:40
static int ipe(const int dir)
logical coordinate of current proc.
void mult_ct_boundary(int t, double ct)
Multiply the boundary improvement factor ct or ctr to an SU(N) matrix object which belongs to a site ...
Definition: field_G_SF.cpp:151
void set_boundary_spatial_link_zero()
Set the boundary spatial link to 0 for SF bc.
Definition: field_G_SF.cpp:125
SU(N) gauge field.
Definition: field_G.h:36
void set_boundary_wk(const Mat_SU_N &U)
Set the boundary spatial link at t=0 for SF bc.
Definition: field_G_SF.cpp:50
std::valarray< double > get_double_vector(const string &key) const
Definition: parameters.cpp:55
int nex() const
Definition: field.h:102
Mat_SU_N wk
SF boundary condition at t=0.
Definition: field_G_SF.h:57
std::valarray< double > field
Definition: field.h:49
int m_Nc
number of color elements
Definition: field_G_SF.h:45
void set_parameters(const Parameters_Field_G_SF &params)
Set the parameter with Parameters_Field_G_SF class.
Definition: field_G_SF.cpp:268
static bool Register(const std::string &realm, const creator_callback &cb)
int m_Nvol
number of sites
Definition: field_G_SF.h:49
void Register_double(const string &, const double)
Definition: parameters.cpp:324
double r(int c) const
Definition: mat_SU_N.h:114
void set(int c, double re, const double &im)
Definition: mat_SU_N.h:133
void set_mat(const int site, const int mn, const Mat_SU_N &U)
Definition: field_G.h:156
int myindex(const int jin, const int site, const int jex) const
Definition: field.h:52
Mat_SU_N wkpr
SF boundary condition at t=Nt.
Definition: field_G_SF.h:59
void set_ri(const int cc, const int site, const int mn, const double re, const double im)
Definition: field_G.h:103