23 const int nin_field = v->
nin();
24 const int nex_field = v->
nex();
28 const int NinG = 2 * Nc * Nc;
37 const int LvolF = NxF * NyF * NzF * NtF;
38 const Field v_in(NinG, LvolF, Ndim);
40 const int nin_file = NinG;
41 const int nex_file = Ndim;
43 assert(nin_file == nin_field);
44 assert(nex_file == nex_field);
47 vout.
detailed(
m_vl,
"%s: file format: nin=%d, nex=%d, Lvol=%ld\n", __func__, nin_file, nex_file, Lvol);
48 vout.
detailed(
m_vl,
"%s: field format: nin=%d, nex=%d, Lvol=%ld\n", __func__, nin_field, nex_field, v->
nvol());
52 Field vtmp(nin_field, LvolF, nex_field);
59 std::fstream config(filename.c_str(), std::ios::in);
60 if (!config.is_open()) {
61 vout.
crucial(
m_vl,
"Error at %s: file open error: %s may not exist.\n", __func__, filename.c_str());
67 for (
int isite = 0; isite < LvolF; ++isite) {
68 for (
int j = 0; j < nex_file; ++j) {
69 for (
int i = 0; i < nin_file; ++i) {
89 vtmp.
set(i, isite, j, val);
99 vout.
crucial(
m_vl,
"Warning at %s: file size larger than expected.\n", __func__);
110 const int count = NinG * LvolF * Ndim;
126 for (
int j = 0; j < Ndim; ++j) {
127 for (
int t = 0; t < Nt; ++t) {
128 int t_global = (t + ipe_t * Nt) % NtF;
130 for (
int z = 0; z < Nz; ++z) {
131 int z_global = (z + ipe_z * Nz) % NzF;
133 for (
int y = 0; y < Ny; ++y) {
134 int y_global = (y + ipe_y * Ny) % NyF;
136 for (
int x = 0; x < Nx; ++x) {
137 int x_global = (x + ipe_x * Nx) % NxF;
139 int local_site = idx.site(x, y, z, t);
140 int global_site = indexF.
site(x_global, y_global, z_global, t_global);
142 for (
int i = 0; i < NinG; ++i) {
143 v->
set(i, local_site, j, vtmp.
cmp(i, global_site, j));
void detailed(const char *format,...)
const double * ptr(const int jin, const int site, const int jex) const
void set(const int jin, const int site, const int jex, double v)
int site(const int &x, const int &y, const int &z, const int &t) const
Container of Field-type object.
double cmp(const int jin, const int site, const int jex) const
static int ipe(const int dir)
logical coordinate of current proc.
long long_t
definition of long for Bridge++
void crucial(const char *format,...)
static const std::string class_name
void read_file(Field *v, const std::string filename)
read data from file.
void write_file(Field *v, const std::string filename)
write data to file.
static int sync()
synchronize within small world.
static int broadcast(int count, double *data, int sender)
broadcast array of double from sender.
static bool is_primary()
check if the present node is primary in small communicator.
Bridge::VerboseLevel m_vl