31 namespace Test_IO_GaugeConfig {
86 #ifdef USE_TESTMANAGER_AUTOREGISTER
88 #if defined(USE_GROUP_SU2)
92 "IO.GaugeConfig.Text",
96 "IO.GaugeConfig.Binary",
101 "IO.GaugeConfig.BinaryParallel",
105 "IO.GaugeConfig.BinaryDistributed",
110 "IO.GaugeConfig.Fortran",
116 "IO.GaugeConfig.ILDG",
121 "IO.GaugeConfig.ILDG_Parallel",
141 const string str_gconf_status = params_test.
get_string(
"gauge_config_status");
142 const string str_gconf_read = params_test.
get_string(
"gauge_config_type_input");
143 const string str_gconf_write = params_test.
get_string(
"gauge_config_type_output");
144 const string readfile = params_test.
get_string(
"config_filename_input");
145 const string testfile = params_test.
get_string(
"config_filename_output");
146 const string str_rand_type = params_test.
get_string(
"random_number_type");
147 const unsigned long seed = params_test.
get_unsigned_long(
"seed_for_random_number");
148 const string str_vlevel = params_test.
get_string(
"verbose_level");
150 const bool do_check = params_test.
is_set(
"expected_result");
151 const double expected_result = do_check ? params_test.
get_double(
"expected_result") : 0.0;
156 vout.
general(vl,
" gconf_status = %s\n", str_gconf_status.c_str());
157 vout.
general(vl,
" gconf_read = %s\n", str_gconf_read.c_str());
158 vout.
general(vl,
" gconf_write = %s\n", str_gconf_write.c_str());
159 vout.
general(vl,
" readfile = %s\n", readfile.c_str());
160 vout.
general(vl,
" testfile = %s\n", testfile.c_str());
161 vout.
general(vl,
" rand_type = %s\n", str_rand_type.c_str());
163 vout.
general(vl,
" vlevel = %s\n", str_vlevel.c_str());
183 if (str_gconf_status ==
"Continue") {
185 }
else if (str_gconf_status ==
"Cold_start") {
187 }
else if (str_gconf_status ==
"Hot_start") {
190 vout.
crucial(vl,
"Error at %s: unsupported gconf status \"%s\"\n",
test_name.c_str(), str_gconf_status.c_str());
217 if (!is_equal) ++err;
222 const int result = err;
232 vout.
detailed(vl,
"check skipped: expected_result not set.\n\n");
239 static inline bool is_equal(
const double x,
const double y)
243 if ((x == 0) && (y == 0))
return true;
245 if (x == 0)
return fabs(y) < eps;
247 if (y == 0)
return fabs(x) < eps;
249 return fabs((x - y) / y) < eps;
264 for (
int idir = 0; idir < Ndim; ++idir) {
265 for (
int isite = 0; isite < Nvol; ++isite) {
266 for (
int i = 0; i < Nc * Nc; ++i) {
267 double v1r = f->
cmp_r(i, isite, idir);
268 double v1i = f->
cmp_i(i, isite, idir);
270 double v2r = g->
cmp_r(i, isite, idir);
271 double v2i = g->
cmp_i(i, isite, idir);
278 vout.
general(vl,
"%6d : %4d: %2d: %19.15f %19.15f\n %19.15f %19.15f : %s\n",
281 is_ok ?
"ok" :
"fail");
283 vout.
paranoiac(vl,
"%6d : %4d: %2d: %19.15f %19.15f\n %19.15f %19.15f : %s\n",
286 is_ok ?
"ok" :
"fail");
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()
Parameters lookup(const string &key) const
static bool RegisterTest(const std::string &key, const Test_function func)
static bool initialize(const std::string &rng_type, unsigned long seed)
void read(Field_G *U, const string &filename=string())
unsigned long get_unsigned_long(const string &key) const
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)
bool is_set(const string &key) const
void crucial(const char *format,...)
static void read(const std::string ¶ms_file, Parameters ¶ms)
void read_file(Field_G *U, const string &filename)
int verify(const double result, const double expected, double eps)
int test_io_gconf_fortran()
void write_file(Field_G *U, const string &filename)
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)