Bridge++  Version 1.5.4
 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 //====================================================================
17 
28 {
29  const int mn = 0;
30 
31  if (Communicator::ipe(3) == 0) {
32  for (int site = 0; site < m_Svol; ++site) {
33  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
34  field[myindex(2 * cc, site, mn)] = U.r(cc);
35  field[myindex(2 * cc + 1, site, mn)] = U.i(cc);
36  }
37  }
38  }
39 }
40 
41 
42 //====================================================================
43 
54 {
55  const int mn = 0;
56 
57  if (Communicator::ipe(3) == m_NPEt - 1) {
58  for (int site = m_Nvol - m_Svol; site < m_Nvol; ++site) {
59  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
60  field[myindex(2 * cc, site, mn)] = U.r(cc);
61  field[myindex(2 * cc + 1, site, mn)] = U.i(cc);
62  }
63  }
64  }
65 }
66 
67 
68 //====================================================================
69 
79 {
80  const int mn = 0;
81 
82  if (Communicator::ipe(3) == 0) {
83  for (int site = 0; site < m_Svol; ++site) {
84  for (int cc = 0; cc < 2 * m_Nc * m_Nc; ++cc) {
85  field[myindex(cc, site, mn)] = 0.0;
86  }
87  }
88  }
89 }
90 
91 
92 //====================================================================
93 
103 {
104  if (Communicator::ipe(3) == 0) {
105  for (int mn = 0; mn < 3; ++mn) {
106  for (int site = 0; site < m_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 //====================================================================
117 
128 void Field_G_SF::mult_ct_boundary(const int t, const double ct)
129 {
130  const int mn = 0;
131  const int ini = m_Nx * m_Ny * m_Nz * t;
132  const int fin = m_Nx * m_Ny * m_Nz * (t + 1);
133 
134  if (((Communicator::ipe(3) == 0) && ((t == 0) || (t == 1))) || ((Communicator::ipe(3) == m_NPEt - 1) && (t == m_Nt - 1))) {
135  for (int site = ini; site < fin; ++site) {
136  for (int cc = 0; cc < 2 * m_Nc * m_Nc; ++cc) {
137  field[myindex(cc, site, mn)] *= ct;
138  }
139  }
140  }
141 }
142 
143 
144 //====================================================================
145 
156 {
157  const int mn = 0;
158 
159  assert(f.nex() == 1);
160  if (Communicator::ipe(3) == 0) {
161  for (int site = 0; site < m_Svol; ++site) {
162  f.set_mat(site, mn, m_wk);
163  }
164  }
165 }
166 
167 
168 //====================================================================
169 
180 {
181  const int mn = 0;
182 
183  assert(f.nex() == 1);
184  if (Communicator::ipe(3) == m_NPEt - 1) {
185  for (int site = m_Nvol - m_Svol; site < m_Nvol; ++site) {
186  f.set_mat(site, mn, m_wkpr);
187  }
188  }
189 }
190 
191 
192 //====================================================================
193 
204 {
205  const int mn = 0;
206 
207  assert(f.nex() == 1);
208  if (Communicator::ipe(3) == 0) {
209  for (int site = 0; site < m_Svol; ++site) {
210  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
211  f.set_ri(cc, site, mn, 0.0, 0.0);
212  }
213  }
214  }
215 }
216 
217 
218 //====================================================================
219 
230 {
231  assert(f.nex() >= 3);
232  if (Communicator::ipe(3) == 0) {
233  for (int mn = 0; mn < 3; ++mn) {
234  for (int site = 0; site < m_Svol; ++site) {
235  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
236  f.set_ri(cc, site, mn, 0.0, 0.0);
237  }
238  }
239  }
240  }
241 }
242 
243 
244 //====================================================================
245 void Field_G_SF::set_parameters(const std::vector<double>& phi,
246  const std::vector<double>& phipr)
247 {
248  double aphi[3];
249  double aphipr[3];
250 
251  for (int i = 0; i < 3; ++i) {
252  aphi[i] = phi[i];
253  aphipr[i] = phipr[i];
254  }
255 
256  set_parameters(aphi, aphipr);
257 }
258 
259 
260 //====================================================================
261 void Field_G_SF::set_parameters(double *phi, double *phipr)
262 {
263  const int Lx = CommonParameters::Lx();
264 
265  double c0r = cos(phi[0] / Lx);
266  double c0i = sin(phi[0] / Lx);
267  double c1r = cos(phi[1] / Lx);
268  double c1i = sin(phi[1] / Lx);
269  double c2r = cos(phi[2] / Lx);
270  double c2i = sin(phi[2] / Lx);
271 
272  m_wk.zero();
273  m_wk.set(0, 0, c0r, c0i);
274  m_wk.set(1, 1, c1r, c1i);
275  m_wk.set(2, 2, c2r, c2i);
276 
277  c0r = cos(phipr[0] / Lx);
278  c0i = sin(phipr[0] / Lx);
279  c1r = cos(phipr[1] / Lx);
280  c1i = sin(phipr[1] / Lx);
281  c2r = cos(phipr[2] / Lx);
282  c2i = sin(phipr[2] / Lx);
283 
284  m_wkpr.zero();
285  m_wkpr.set(0, 0, c0r, c0i);
286  m_wkpr.set(1, 1, c1r, c1i);
287  m_wkpr.set(2, 2, c2r, c2i);
288 }
289 
290 
291 //====================================================================
void set_boundary_zero()
Set the boundary matrix to 0 for SF bc.
Definition: field_G_SF.cpp:78
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:53
size_t myindex(const int jin, const int site, const int jex) const
Definition: field.h:64
int m_NPEt
Definition: field_G_SF.h:46
Mat_SU_N & zero()
Definition: mat_SU_N.h:383
static int ipe(const int dir)
logical coordinate of current proc.
void set_boundary_spatial_link_zero()
Set the boundary spatial link to 0 for SF bc.
Definition: field_G_SF.cpp:102
SU(N) gauge field.
Definition: field_G.h:38
Mat_SU_N m_wk
SF boundary condition at t=0.
Definition: field_G_SF.h:49
void set_parameters(const std::vector< double > &phi, const std::vector< double > &phipr)
Set the parameter by giving vector objects.
Definition: field_G_SF.cpp:245
int m_Svol
Definition: field_G_SF.h:45
void mult_ct_boundary(const int t, const 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:128
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:27
int nex() const
Definition: field.h:128
std::valarray< double > field
Definition: field.h:60
Mat_SU_N m_wkpr
SF boundary condition at t=Nt.
Definition: field_G_SF.h:51
int m_Nc
number of color elements
Definition: field_G_SF.h:37
int m_Nvol
number of sites
Definition: field_G_SF.h:41
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:160
void set_ri(const int cc, const int site, const int mn, const double re, const double im)
Definition: field_G.h:107