32 namespace Test_IO_Data {
37 const std::string filename_input =
"test_IO_Data_Text.yaml";
43 #ifdef USE_TESTMANAGER_AUTOREGISTER
45 #if defined(USE_GROUP_SU2)
68 const string str_gconf_status = params_test.
get_string(
"gauge_config_status");
69 const string str_gconf_read = params_test.
get_string(
"gauge_config_type_input");
70 const string readfile = params_test.
get_string(
"config_filename_input");
71 const string testfile = params_test.
get_string(
"config_filename_output");
72 const string str_rand_type = params_test.
get_string(
"random_number_type");
73 const unsigned long seed = params_test.
get_unsigned_long(
"seed_for_random_number");
74 const int data_size = params_test.
get_int(
"data_size");
75 const string str_vlevel = params_test.
get_string(
"verbose_level");
77 const bool do_check = params_test.
is_set(
"expected_result");
78 const double expected_result = do_check ? params_test.
get_double(
"expected_result") : 0.0;
83 vout.
general(vl,
" gconf_status = %s\n", str_gconf_status.c_str());
84 vout.
general(vl,
" gconf_read = %s\n", str_gconf_read.c_str());
85 vout.
general(vl,
" readfile = %s\n", readfile.c_str());
86 vout.
general(vl,
" testfile = %s\n", testfile.c_str());
87 vout.
general(vl,
" rand_type = %s\n", str_rand_type.c_str());
90 vout.
general(vl,
" vlevel = %s\n", str_vlevel.c_str());
110 if (str_gconf_status ==
"Continue") {
112 }
else if (str_gconf_status ==
"Cold_start") {
114 }
else if (str_gconf_status ==
"Hot_start") {
117 vout.
crucial(vl,
"Error at %s: unsupported gconf status \"%s\"\n",
test_name.c_str(), str_gconf_status.c_str());
133 std::vector<double> array(data_size);
134 double *p = U->
ptr(0);
136 for (
size_t i = 0; i < data_size; ++i) {
144 std::vector<dcomplex> arrayc(data_size);
147 for (
size_t i = 0; i < data_size; ++i) {
151 arrayc[i] = cmplx(x, y);
158 std::vector<double> array2(data_size);
164 for (
size_t i = 0; i < data_size; ++i) {
165 if (abs(array[i] - array2[i]) > tiny) ++err;
181 vout.
detailed(vl,
"check skipped: expected_result not set.\n\n");
void detailed(const char *format,...)
const double * ptr(const int jin, const int site, const int jex) const
static double epsilon_criterion()
void general(const char *format,...)
int get_int(const string &key) const
DataIO_Text class for general file I/O in plain Text format.
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 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)
virtual void write_file(const double *v, const size_t n, const string &, const bool append=true)=0
int verify(const double result, const double expected, double eps)
int test_io_data_text(void)
GaugeConfig class for file I/O of gauge configuration.
const std::string test_name
string get_string(const string &key) const
void report(const Bridge::VerboseLevel vl=Bridge::GENERAL)
static VerboseLevel set_verbose_level(const std::string &str)
virtual void read_file(double *v, const size_t n, const string &)=0