34 namespace Test_TopologicalCharge {
39 const std::string filename_input =
"test_TopologicalCharge.yaml";
40 const std::string filename_output =
"stdout";
42 class Parameters_Test_TopologicalCharge :
public Parameters {
44 Parameters_Test_TopologicalCharge()
46 Register_string(
"gauge_config_status",
"NULL");
47 Register_string(
"gauge_config_type_input",
"NULL");
48 Register_string(
"config_filename_input",
"NULL");
50 Register_int(
"number_of_max_smearing", 0);
51 Register_int(
"number_of_smearing_step", 0);
53 Register_string(
"verbose_level",
"NULL");
55 Register_double(
"expected_result", 0.0);
63 #ifdef USE_TESTMANAGER_AUTOREGISTER
65 #if defined(USE_GROUP_SU2)
83 Parameters *params_test =
new Parameters_Test_TopologicalCharge;
95 params_manager.
read_params(filename_input, params_all);
97 const string str_gconf_status = params_test->
get_string(
"gauge_config_status");
98 const string str_gconf_read = params_test->
get_string(
"gauge_config_type_input");
99 const string readfile = params_test->
get_string(
"config_filename_input");
100 const int Nsmear = params_test->
get_int(
"number_of_max_smearing");
101 const int Nmeas = params_test->
get_int(
"number_of_smearing_step");
102 const string str_vlevel = params_test->
get_string(
"verbose_level");
104 const bool do_check = params_test->
is_set(
"expected_result");
105 const double expected_result = do_check ? params_test->
get_double(
"expected_result") : 0.0;
107 const string str_proj_type = params_proj->
get_string(
"projection_type");
108 const string str_smear_type = params_smear->
get_string(
"smear_type");
113 vout.
general(vl,
" gconf_status = %s\n", str_gconf_status.c_str());
114 vout.
general(vl,
" gconf_read = %s\n", str_gconf_read.c_str());
115 vout.
general(vl,
" readfile = %s\n", readfile.c_str());
118 vout.
general(vl,
" vlevel = %s\n", str_vlevel.c_str());
119 vout.
general(vl,
" proj_type = %s\n", str_proj_type.c_str());
120 vout.
general(vl,
" smear_type = %s\n", str_smear_type.c_str());
137 if (str_gconf_status ==
"Continue") {
139 }
else if (str_gconf_status ==
"Cold_start") {
141 }
else if (str_gconf_status ==
"Hot_start") {
145 vout.
crucial(vl,
"%s: unsupported gconf status \"%s\".\n",
test_name.c_str(), str_gconf_status.c_str());
154 Projection *proj = Projection::New(str_proj_type);
155 Smear *smear = Smear::New(str_smear_type, proj);
164 Field_G Uorg(Nvol, Ndim), Usmear(Nvol, Ndim);
169 for (
int i_smear = 0; i_smear <= Nsmear; ++i_smear) {
170 if (i_smear > 0) smear->
smear(Usmear, Uorg);
172 if ((i_smear % Nmeas) == 0) {
173 result = topological_charge->
measure(Usmear);
175 vout.
general(vl,
"i_smear,Q = %d %20.16e\n", i_smear, result);
205 vout.
detailed(vl,
"check skipped: expected_result not set.\n\n");
Random number generator base on M-series.
void read_params(const std::string ¶ms_file, Parameters *params)
read parameters from file.
void detailed(const char *format,...)
void general(const char *format,...)
double measure(Field_G &U)
main function to measure Topological Charge.
Container of Field-type object.
virtual void set_parameters(const Parameters &)=0
int get_int(const string &key) const
static Parameters * New(const std::string &realm)
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
virtual void smear(Field_G &, const Field_G &)=0
int non_NULL(const std::string v)
void crucial(const char *format,...)
void Register_Parameters(const string &, Parameters *const)
base class for projection operator into gauge group.
virtual void set_parameters(const Parameters ¶ms)
setting parameters.
int topological_charge(void)
base class for smearing of link variables.
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
const std::string test_name
void report(const Bridge::VerboseLevel vl=Bridge::GENERAL)
static VerboseLevel set_verbose_level(const std::string &str)