39 class Parameters_Test_IO_GaugeConfig :
public Parameters {
41 Parameters_Test_IO_GaugeConfig()
43 Register_string(
"gauge_config_status",
"NULL");
44 Register_string(
"gauge_config_type_input",
"NULL");
45 Register_string(
"gauge_config_type_output",
"NULL");
46 Register_string(
"config_filename_input",
"NULL");
47 Register_string(
"config_filename_output",
"NULL");
49 Register_string(
"verbose_level",
"NULL");
51 Register_double(
"expected_result", 0.0);
103 #ifdef USE_TESTMANAGER_AUTOREGISTER
105 #if defined(USE_GROUP_SU2)
109 "IO.GaugeConfig.Text",
113 "IO.GaugeConfig.Binary",
118 "IO.GaugeConfig.BinaryParallel",
122 "IO.GaugeConfig.BinaryDistributed",
127 "IO.GaugeConfig.Fortran",
132 "IO.GaugeConfig.ILDG",
138 "IO.GaugeConfig.ILDG_Parallel",
160 const string str_gconf_status = params_test->
get_string(
"gauge_config_status");
161 const string str_gconf_read = params_test->
get_string(
"gauge_config_type_input");
162 const string str_gconf_write = params_test->
get_string(
"gauge_config_type_output");
163 const string readfile = params_test->
get_string(
"config_filename_input");
164 const string testfile = params_test->
get_string(
"config_filename_output");
165 const string str_vlevel = params_test->
get_string(
"verbose_level");
167 const bool do_check = params_test->
is_set(
"expected_result");
168 const double expected_result = do_check ? params_test->
get_double(
"expected_result") : 0.0;
173 vout.
general(vl,
" gconf_status = %s\n", str_gconf_status.c_str());
174 vout.
general(vl,
" gconf_read = %s\n", str_gconf_read.c_str());
175 vout.
general(vl,
" gconf_write = %s\n", str_gconf_write.c_str());
176 vout.
general(vl,
" readfile = %s\n", readfile.c_str());
177 vout.
general(vl,
" testfile = %s\n", testfile.c_str());
178 vout.
general(vl,
" vlevel = %s\n", str_vlevel.c_str());
187 vout.
crucial(vl,
"%s: Input parameters have not been set.\n", test_name.c_str());
196 if (str_gconf_status ==
"Continue") {
198 }
else if (str_gconf_status ==
"Cold_start") {
200 }
else if (str_gconf_status ==
"Hot_start") {
201 int i_seed_noise = 1234567;
205 vout.
crucial(vl,
"%s: unsupported gconf status \"%s\".\n", test_name.c_str(), str_gconf_status.c_str());
231 if (!is_equal) ++err;
233 vout.
general(vl,
"%s: \t%s\n", test_name.c_str(), is_equal ?
"ok" :
"failed");
244 vout.
detailed(vl,
"check skipped: expected_result not set.\n\n");
251 static inline bool is_equal(
const double x,
const double y)
255 if ((x == 0) && (y == 0))
return true;
257 if (x == 0)
return fabs(y) < eps;
259 if (y == 0)
return fabs(x) < eps;
261 return fabs((x - y) / y) < eps;
276 for (
int idir = 0; idir < Ndim; ++idir) {
277 for (
int isite = 0; isite < Nvol; ++isite) {
278 for (
int i = 0; i < Nc * Nc; ++i) {
279 double v1r = f->
cmp_r(i, isite, idir);
280 double v1i = f->
cmp_i(i, isite, idir);
282 double v2r = g->
cmp_r(i, isite, idir);
283 double v2i = g->
cmp_i(i, isite, idir);
290 vout.
general(vl,
"%6d : %4d: %2d: %19.15f %19.15f\n %19.15f %19.15f : %s\n",
293 is_ok ?
"ok" :
"fail");
295 vout.
paranoiac(vl,
"%6d : %4d: %2d: %19.15f %19.15f\n %19.15f %19.15f : %s\n",
298 is_ok ?
"ok" :
"fail");
Random number generator base on M-series.
static bool is_equal(const double x, const double y)
const std::string test_name
int test_io_gconf_ILDG_parallel()
int test_io_gconf_binary()
int test_io_gconf_binary_distributed()
void detailed(const char *format,...)
static double epsilon_criterion()
void general(const char *format,...)
static Bridge::VerboseLevel Vlevel()
double cmp_i(const int cc, const int site, const int mn=0) const
int check_conf(const unique_ptr< Field_G > &f, const unique_ptr< Field_G > &g)
int test_io_gconf_binary_parallel()
void read_file(Field *U, const string &filename)
void set_random(RandomNumbers *rand)
static bool RegisterTest(const std::string &key, const Test_function func)
bool is_set(const string &) const
double get_double(const string &key) const
int test_io_gconf_main(const std::string &)
void write_file(Field *U, const string &filename)
void paranoiac(const char *format,...)
int non_NULL(const std::string v)
void crucial(const char *format,...)
void Register_Parameters(const string &, Parameters *const)
int verify(const double result, const double expected, double eps)
int test_io_gconf_fortran()
static void read(const std::string ¶ms_file, Parameters *params)
double cmp_r(const int cc, const int site, const int mn=0) const
GaugeConfig class for file I/O of gauge configuration.
string get_string(const string &key) const
void report(const Bridge::VerboseLevel vl=Bridge::GENERAL)
static VerboseLevel set_verbose_level(const std::string &str)