Bridge++  Ver. 2.0.2
field_SF.cpp
Go to the documentation of this file.
1 
14 #include "field_SF.h"
16 
17 
18 //free function version
19 
20 namespace Field_SF {
21 //====================================================================
22 
32  void set_boundary_wk(Field_G& u, const Mat_SU_N& wk)
33  {
34  assert(u.nex() == 1);
35 
36  const int mn = 0;
37  int Nt = CommonParameters::Nt();
38  int Nvol = u.nvol();
39  int Svol = Nvol / Nt;
40 
41  int ith, nth, is, ns;
42  set_threadtask(ith, nth, is, ns, Svol);
43 
44  if (Communicator::ipe(3) == 0) {
45  for (int site = is; site < ns; ++site) {
46  u.set_mat(site, mn, wk);
47  }
48  }
49  }
50 
51 
52 //====================================================================
53 
63  void set_boundary_wkpr(Field_G& u, const Mat_SU_N& wkpr)
64  {
65  assert(u.nex() == 1);
66 
67  const int mn = 0;
68  int Nt = CommonParameters::Nt();
69  int NPEt = CommonParameters::NPEt();
70  int Nvol = u.nvol();
71  int Svol = Nvol / Nt;
72 
73  int ith, nth, is, ns;
74  set_threadtask(ith, nth, is, ns, Svol);
75 
76  if (Communicator::ipe(3) == NPEt - 1) {
77  int site0 = Nvol - Svol;
78  for (int site2 = is; site2 < ns; ++site2) {
79  int site = site2 + site0;
80  u.set_mat(site, mn, wkpr);
81  }
82  }
83  }
84 
85 
86 //====================================================================
87 
97  {
98  const int mn = 0;
99  int Nc = CommonParameters::Nc();
100  int Nt = CommonParameters::Nt();
101  int Nvol = u.nvol();
102  int Svol = Nvol / Nt;
103 
104  int ith, nth, is, ns;
105  set_threadtask(ith, nth, is, ns, Svol);
106 
107  if (Communicator::ipe(3) == 0) {
108  for (int site = is; site < ns; ++site) {
109  for (int cc = 0; cc < 2 * Nc * Nc; ++cc) {
110  u.set(cc, site, mn, 0.0);
111  }
112  }
113  }
114  }
115 
116 
117 //====================================================================
119  {
120 #pragma omp barrier
121 
122  int Nt = CommonParameters::Nt();
123  int Nvol = f.nvol();
124  int Svol = Nvol / Nt;
125  int Nin = f.nin();
126 
127  int ith, nth, is, ns;
128  set_threadtask(ith, nth, is, ns, Svol);
129 
130  if (Communicator::ipe(3) == 0) {
131  for (int site = is; site < ns; ++site) {
132  for (int in = 0; in < Nin; ++in) {
133  f.set(in, site, 0, 0.0);
134  }
135  }
136  }
137 #pragma omp barrier
138  }
139 
140 
141 //====================================================================
142 
152  {
153  int Nc = CommonParameters::Nc();
154  int Nt = CommonParameters::Nt();
155  int Nvol = u.nvol();
156  int Svol = Nvol / Nt;
157 
158  int ith, nth, is, ns;
159  set_threadtask(ith, nth, is, ns, Svol);
160 
161  if (Communicator::ipe(3) == 0) {
162  for (int mn = 0; mn < 3; ++mn) {
163  for (int site = is; site < ns; ++site) {
164  for (int cc = 0; cc < 2 * Nc * Nc; ++cc) {
165  u.set(cc, site, mn, 0.0);
166  }
167  }
168  }
169  }
170  }
171 
172 
173 //====================================================================
174 
185  void mult_ct_boundary(Field_G& u, const int t, const double ct)
186  {
187  int Nc = CommonParameters::Nc();
188  int Nx = CommonParameters::Nx();
189  int Ny = CommonParameters::Ny();
190  int Nz = CommonParameters::Nz();
191  int Nt = CommonParameters::Nt();
192  int NPEt = CommonParameters::NPEt();
193  int Svol = Nx * Ny * Nz;
194 
195  const int mn = 0;
196  const int ini = Nx * Ny * Nz * t;
197  // const int fin = Nx * Ny * Nz * (t + 1);
198 
199  int ith, nth, is, ns;
200  set_threadtask(ith, nth, is, ns, Svol);
201 
202  if (((Communicator::ipe(3) == 0) && ((t == 0) || (t == 1))) ||
203  ((Communicator::ipe(3) == NPEt - 1) && (t == Nt - 1))) {
204  for (int site2 = is; site2 < ns; ++site2) {
205  int site = site2 + ini;
206  for (int cc = 0; cc < 2 * Nc * Nc; ++cc) {
207  double ut = u.cmp(cc, site, mn);
208  u.set(cc, site, mn, ut * ct);
209  }
210  }
211  }
212  }
213 
214 
215 //====================================================================
216  void set_boundary_matrix(Mat_SU_N& wk, const std::vector<double>& phi)
217  {
218  const int Lx = CommonParameters::Lx();
219  const double Lx_inv = 1.0 / double(Lx);
220 
221  double c0r = cos(phi[0] * Lx_inv);
222  double c0i = sin(phi[0] * Lx_inv);
223  double c1r = cos(phi[1] * Lx_inv);
224  double c1i = sin(phi[1] * Lx_inv);
225  double c2r = cos(phi[2] * Lx_inv);
226  double c2i = sin(phi[2] * Lx_inv);
227 
228  wk.zero();
229  wk.set(0, 0, c0r, c0i);
230  wk.set(1, 1, c1r, c1i);
231  wk.set(2, 2, c2r, c2i);
232  }
233 } // namespace
234 //============================================================END=====
CommonParameters::Ny
static int Ny()
Definition: commonParameters.h:106
Field_SF::set_boundary_wkpr
void set_boundary_wkpr(Field_G &u, const Mat_SU_N &wkpr)
Definition: field_SF.cpp:63
CommonParameters::Nz
static int Nz()
Definition: commonParameters.h:107
Field::set
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
Field::nex
int nex() const
Definition: field.h:128
Field_G::set_mat
void set_mat(const int site, const int mn, const Mat_SU_N &U)
Definition: field_G.h:160
Field_SF::set_boundary_wk
void set_boundary_wk(Field_G &u, const Mat_SU_N &wk)
Definition: field_SF.cpp:32
Field::nin
int nin() const
Definition: field.h:126
SU_N::Mat_SU_N::set
void set(int c, const double &re, const double &im)
Definition: mat_SU_N.h:137
Field_SF::mult_ct_boundary
void mult_ct_boundary(Field_G &u, const int t, const double ct)
Definition: field_SF.cpp:185
CommonParameters::Nx
static int Nx()
Definition: commonParameters.h:105
Field_SF::set_boundary_zero
void set_boundary_zero(Field_G &u)
Definition: field_SF.cpp:96
CommonParameters::Lx
static int Lx()
Definition: commonParameters.h:91
CommonParameters::Nc
static int Nc()
Definition: commonParameters.h:115
SU_N::Mat_SU_N::zero
Mat_SU_N & zero()
Definition: mat_SU_N.h:429
CommonParameters::Nt
static int Nt()
Definition: commonParameters.h:108
SU_N::Mat_SU_N
Definition: mat_SU_N.h:36
field_SF.h
Field::nvol
int nvol() const
Definition: field.h:127
Field_SF::set_boundary_matrix
void set_boundary_matrix(Mat_SU_N &wk, const std::vector< double > &phi)
Definition: field_SF.cpp:216
Field_SF::set_boundary_spatial_link_zero
void set_boundary_spatial_link_zero(Field_G &u)
Definition: field_SF.cpp:151
Field::cmp
double cmp(const int jin, const int site, const int jex) const
Definition: field.h:143
Communicator::ipe
static int ipe(const int dir)
logical coordinate of current proc.
Definition: communicator.cpp:105
field_thread-inc.h
CommonParameters::NPEt
static int NPEt()
Definition: commonParameters.h:100
Field
Container of Field-type object.
Definition: field.h:46
Field_G
SU(N) gauge field.
Definition: field_G.h:38
Field_SF
SU(N) gauge field class in which a few functions are added for the SF.
Definition: field_SF.cpp:20