39 const std::string filename_input =
"test_IO_Data_Text.yaml";
40 const std::string filename_output =
"stdout";
42 class Parameters_Test_IO_GaugeConfig :
public Parameters {
44 Parameters_Test_IO_GaugeConfig()
46 Register_string(
"gauge_config_status",
"NULL");
47 Register_string(
"gauge_config_type_input",
"NULL");
48 Register_string(
"config_filename_input",
"NULL");
49 Register_string(
"config_filename_output",
"NULL");
51 Register_int(
"data_size", 1024);
53 Register_string(
"verbose_level",
"NULL");
54 Register_double(
"expected_result", 0.0);
62 #ifdef USE_TESTMANAGER_AUTOREGISTER
64 #if defined(USE_GROUP_SU2)
90 const string str_gconf_status = params_test->
get_string(
"gauge_config_status");
91 const string str_gconf_read = params_test->
get_string(
"gauge_config_type_input");
92 const string readfile = params_test->
get_string(
"config_filename_input");
93 const string testfile = params_test->
get_string(
"config_filename_output");
94 const int data_size = params_test->
get_int(
"data_size");
95 const string str_vlevel = params_test->
get_string(
"verbose_level");
97 const bool do_check = params_test->
is_set(
"expected_result");
98 const double expected_result = do_check ? params_test->
get_double(
"expected_result") : 0.0;
103 vout.
general(vl,
" gconf_status = %s\n", str_gconf_status.c_str());
104 vout.
general(vl,
" gconf_read = %s\n", str_gconf_read.c_str());
105 vout.
general(vl,
" readfile = %s\n", readfile.c_str());
106 vout.
general(vl,
" testfile = %s\n", testfile.c_str());
108 vout.
general(vl,
" vlevel = %s\n", str_vlevel.c_str());
117 vout.
crucial(vl,
"%s: Input parameters have not been set.\n", test_name.c_str());
126 if (str_gconf_status ==
"Continue") {
128 }
else if (str_gconf_status ==
"Cold_start") {
130 }
else if (str_gconf_status ==
"Hot_start") {
131 int i_seed_noise = 1234567;
135 vout.
crucial(vl,
"%s: unsupported gconf status \"%s\".\n", test_name.c_str(), str_gconf_status.c_str());
151 std::vector<double> array(data_size);
152 double *p = U->
ptr(0);
154 for (
size_t i = 0; i < data_size; ++i) {
162 std::vector<dcomplex> arrayc(data_size);
165 for (
size_t i = 0; i < data_size; ++i) {
169 arrayc[i] = cmplx(x, y);
176 std::vector<double> array2(data_size);
182 for (
size_t i = 0; i < data_size; ++i) {
183 if (abs(array[i] - array2[i]) > tiny) ++err;
186 vout.
general(vl,
"%s: \t%s\n", test_name.c_str(), (err == 0) ?
"ok" :
"failed");
197 vout.
detailed(vl,
"check skipped: expected_result not set.\n\n");
Random number generator base on M-series.
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.
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 non_NULL(const std::string v)
void crucial(const char *format,...)
void Register_Parameters(const string &, Parameters *const)
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)
static void read(const std::string ¶ms_file, Parameters *params)
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