29 namespace Test_IO_GaugeConfig {
37 class Parameters_Test_IO_GaugeConfig :
public Parameters {
39 Parameters_Test_IO_GaugeConfig()
41 Register_string(
"gauge_config_status",
"NULL");
42 Register_string(
"gauge_config_type_input",
"NULL");
43 Register_string(
"gauge_config_type_output",
"NULL");
44 Register_string(
"config_filename_input",
"NULL");
45 Register_string(
"config_filename_output",
"NULL");
47 Register_string(
"verbose_level",
"NULL");
49 Register_double(
"expected_result", 0.0);
95 #ifdef USE_TESTMANAGER_AUTOREGISTER
97 #if defined(USE_GROUP_SU2)
101 "IO.GaugeConfig.Text",
105 "IO.GaugeConfig.Binary",
110 "IO.GaugeConfig.BinaryParallel",
115 "IO.GaugeConfig.Fortran",
120 "IO.GaugeConfig.ILDG",
126 "IO.GaugeConfig.ILDG_Parallel",
141 Parameters *params_test =
new Parameters_Test_IO_GaugeConfig;
147 params_manager.
read_params(filename_input, params_all);
149 const string str_gconf_status = params_test->
get_string(
"gauge_config_status");
150 const string str_gconf_read = params_test->
get_string(
"gauge_config_type_input");
151 const string str_gconf_write = params_test->
get_string(
"gauge_config_type_output");
152 const string readfile = params_test->
get_string(
"config_filename_input");
153 const string testfile = params_test->
get_string(
"config_filename_output");
154 const string str_vlevel = params_test->
get_string(
"verbose_level");
156 const bool do_check = params_test->
is_set(
"expected_result");
157 const double expected_result = do_check ? params_test->
get_double(
"expected_result") : 0.0;
162 vout.
general(vl,
" gconf_status = %s\n", str_gconf_status.c_str());
163 vout.
general(vl,
" gconf_read = %s\n", str_gconf_read.c_str());
164 vout.
general(vl,
" gconf_write = %s\n", str_gconf_write.c_str());
165 vout.
general(vl,
" readfile = %s\n", readfile.c_str());
166 vout.
general(vl,
" testfile = %s\n", testfile.c_str());
167 vout.
general(vl,
" vlevel = %s\n", str_vlevel.c_str());
185 if (str_gconf_status ==
"Continue") {
187 }
else if (str_gconf_status ==
"Cold_start") {
189 }
else if (str_gconf_status ==
"Hot_start") {
193 vout.
crucial(vl,
"%s: unsupported gconf status \"%s\".\n",
test_name.c_str(), str_gconf_status.c_str());
219 if (!is_equal) ++err;
221 vout.
general(vl,
"Test_IO_GaugeConfig:\t%s\n", is_equal ?
"ok" :
"failed");
245 vout.
detailed(vl,
"check skipped: expected_result not set.\n\n");
252 static inline bool is_equal(
const double x,
const double y)
256 if ((x == 0) && (y == 0))
return true;
258 if (x == 0)
return fabs(y) < eps;
260 if (y == 0)
return fabs(x) < eps;
262 return fabs((x - y) / y) < eps;
277 for (
int idir = 0; idir < Ndim; ++idir) {
278 for (
int isite = 0; isite < Nvol; ++isite) {
279 for (
int i = 0; i < Nc * Nc; ++i) {
280 double v1r = f->
cmp_r(i, isite, idir);
281 double v1i = f->
cmp_i(i, isite, idir);
283 double v2r = g->
cmp_r(i, isite, idir);
284 double v2i = g->
cmp_i(i, isite, idir);
291 vout.
general(vl,
"%6d : %4d: %2d: %19.15f %19.15f\n %19.15f %19.15f : %s\n",
294 is_ok ?
"ok" :
"fail");
296 vout.
paranoiac(vl,
"%6d : %4d: %2d: %19.15f %19.15f\n %19.15f %19.15f : %s\n",
299 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()
void read_params(const std::string ¶ms_file, Parameters *params)
read parameters from file.
void detailed(const char *format,...)
static double epsilon_criterion()
void general(const char *format,...)
static Bridge::VerboseLevel Vlevel()
Container of Field-type object.
double cmp_i(const int cc, const int site, const int mn=0) const
int test_io_gconf_binary_parallel()
void set_random(RandomNumbers *rand)
static bool RegisterTest(const std::string &key, const Test_function func)
bool is_set(const string &) const
int check_conf(const Field_G *f, const Field_G *g)
double get_double(const string &key) const
int test_io_gconf_main(const std::string &)
void paranoiac(const char *format,...)
int non_NULL(const std::string v)
void crucial(const char *format,...)
void Register_Parameters(const string &, Parameters *const)
void write_file(Field *u, const string &filename)
int test_io_gconf_fortran()
double cmp_r(const int cc, const int site, const int mn=0) const
Parameter manager with YAML parser.
GaugeConfig class for file I/O of gauge configuration.
int verify(const double expected, const double result)
void read_file(Field *u, const string &filename)
string get_string(const string &key) const
void report(const Bridge::VerboseLevel vl=Bridge::GENERAL)
static VerboseLevel set_verbose_level(const std::string &str)