Bridge++  Ver. 2.0.2
afield_Gauge-inc.h
Go to the documentation of this file.
1 
10 #ifndef QXS_AFIELD_GAUGE_INC_INCLUDED
11 #define QXS_AFIELD_GAUGE_INC_INCLUDED
12 
13 #include <cstdlib>
14 
16 
19 #include "lib_alt_QXS/inline/afield_th-inc.h"
20 
21 namespace QXS_Gauge {
22 //====================================================================
23  template<typename REALTYPE>
25  const std::vector<int>& boundary)
26  {
27  typedef REALTYPE real_t;
28 
29 #pragma omp barrier
30 
31  int Nx = CommonParameters::Nx();
32  int Ny = CommonParameters::Ny();
33  int Nz = CommonParameters::Nz();
34  int Nt = CommonParameters::Nt();
35  int Ndim = CommonParameters::Ndim();
36  int Nvol = Nx * Ny * Nz * Nt;
37 
38  int Nin = ulex.nin();
39 
40  if (!ulex.check_size(Nin, Nvol, Ndim)) {
41  vout.crucial("set_boundary: wrong size of input field\n");
42  exit(EXIT_FAILURE);
43  }
44 
46 
47  int mu = 0;
48  int ipex = Communicator::ipe(mu);
49  int npex = Communicator::npe(mu);
50 
51  if ((boundary[mu] != 1) && (ipex == npex - 1)) {
52  real_t bc = real_t(boundary[mu]);
53  int Nyzt = Ny * Nz * Nt;
54 
55  int ith, nth, is, ns;
56  set_threadtask(ith, nth, is, ns, Nyzt);
57 
58  for (int iyzt = is; iyzt < ns; ++iyzt) {
59  int site = Nx - 1 + Nx * iyzt;
60  for (int in = 0; in < Nin; ++in) {
61  int idx = index.idx_G(in, site, mu);
62  real_t uv = ulex.cmp(idx);
63  uv = uv * bc;
64  ulex.set(idx, uv);
65  }
66  }
67  }
68 
69  mu = 1;
70  int ipey = Communicator::ipe(mu);
71  int npey = Communicator::npe(mu);
72 
73  if ((boundary[mu] != 1) && (ipey == npey - 1)) {
74  real_t bc = real_t(boundary[mu]);
75  int Nxzt = Nx * Nz * Nt;
76 
77  int ith, nth, is, ns;
78  set_threadtask(ith, nth, is, ns, Nxzt);
79 
80  for (int ixzt = is; ixzt < ns; ++ixzt) {
81  int ix = ixzt % Nx;
82  int izt = ixzt / Nx;
83  int site = ix + Nx * (Ny - 1 + Ny * izt);
84  for (int in = 0; in < Nin; ++in) {
85  int idx = index.idx_G(in, site, mu);
86  real_t uv = ulex.cmp(idx);
87  uv = uv * bc;
88  ulex.set(idx, uv);
89  }
90  }
91  }
92 
93  mu = 2;
94  int ipez = Communicator::ipe(mu);
95  int npez = Communicator::npe(mu);
96 
97  if ((boundary[mu] != 1) && (ipez == npez - 1)) {
98  real_t bc = real_t(boundary[mu]);
99  int Nxy = Nx * Ny;
100  int Nxyt = Nxy * Nt;
101 
102  int ith, nth, is, ns;
103  set_threadtask(ith, nth, is, ns, Nxyt);
104 
105  for (int ixyt = is; ixyt < ns; ++ixyt) {
106  int ixy = ixyt % Nxy;
107  int it = ixyt / Nxy;
108  int site = ixy + Nxy * (Nz - 1 + Nz * it);
109  for (int in = 0; in < Nin; ++in) {
110  int idx = index.idx_G(in, site, mu);
111  real_t uv = ulex.cmp(idx);
112  uv = uv * bc;
113  ulex.set(idx, uv);
114  }
115  }
116  }
117 
118  mu = 3;
119  int ipet = Communicator::ipe(mu);
120  int npet = Communicator::npe(mu);
121 
122  if ((boundary[mu] != 1) && (ipet == npet - 1)) {
123  real_t bc = real_t(boundary[mu]);
124  int Nxyz = Nx * Ny * Nz;
125 
126  int ith, nth, is, ns;
127  set_threadtask(ith, nth, is, ns, Nxyz);
128 
129  for (int ixyz = is; ixyz < ns; ++ixyz) {
130  int site = ixyz + Nxyz * (Nt - 1);
131  for (int in = 0; in < Nin; ++in) {
132  int idx = index.idx_G(in, site, mu);
133  real_t uv = ulex.cmp(idx);
134  uv = uv * bc;
135  ulex.set(idx, uv);
136  }
137  }
138  }
139 
140 #pragma omp barrier
141  }
142 } // namespace QXS_Gauge
143 
144 //============================================================END=====
145 #endif
CommonParameters::Ny
static int Ny()
Definition: commonParameters.h:106
CommonParameters::Nz
static int Nz()
Definition: commonParameters.h:107
afield.h
CommonParameters::Ndim
static int Ndim()
Definition: commonParameters.h:117
AIndex_lex
Definition: aindex_lex_base.h:17
AField< REALTYPE, QXS >
Definition: afield.h:35
real_t
double real_t
Definition: bridgeQXS_Clover_coarse_double.cpp:16
CommonParameters::Nx
static int Nx()
Definition: commonParameters.h:105
QXS_Gauge
Definition: afield_Gauge-inc.h:21
aindex_lex.h
QXS_Gauge::set_boundary
void set_boundary(AField< REALTYPE, QXS > &ulex, const std::vector< int > &boundary)
Definition: afield_Gauge-inc.h:24
CommonParameters::Nt
static int Nt()
Definition: commonParameters.h:108
Communicator::npe
static int npe(const int dir)
logical grid extent
Definition: communicator.cpp:112
AIndex_eo_qxs::idx
int idx(const int in, const int Nin, const int ist, const int Nx2, const int Ny, const int leo, const int Nvol2, const int ex)
Definition: aindex_eo.h:27
threadManager.h
AField< REALTYPE, QXS >::check_size
bool check_size(const int nin, const int nvol, const int nex) const
checking size parameters.
Definition: afield.h:121
AField< REALTYPE, QXS >::set
void set(const int index, const real_t a)
Definition: afield.h:160
Communicator::ipe
static int ipe(const int dir)
logical coordinate of current proc.
Definition: communicator.cpp:105
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition: bridgeIO.cpp:180
AField< REALTYPE, QXS >::nin
int nin() const
returning size of inner (on site) d.o.f.
Definition: afield.h:109
AField< REALTYPE, QXS >::cmp
real_t cmp(const int index) const
reference of data element
Definition: afield.h:157
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512