QMCPACK
test_InputSection.cpp
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2023 QMCPACK developers.
6 //
7 // File developed by: Jaron T. Krogel, krogeljt@ornl.gov, Oak Ridge National Lab
8 // Peter W. Doak, doakpw@ornl.gov, Oak Ridge National Lab
9 //
10 // File created by: Jaron T. Krogel, krogeljt@ornl.gov, Oak Ridge National Lab
11 //////////////////////////////////////////////////////////////////////////////////////
12 
13 
14 #include "catch.hpp"
15 
16 #include "InputSection.h"
17 #include "OhmmsData/Libxml2Doc.h"
18 #include "Utilities/string_utils.h"
20 #include "EstimatorInput.h"
21 
22 #include <stdio.h>
23 #include <sstream>
24 #include <map>
25 
26 namespace qmcplusplus
27 {
28 // Take note that all input is done at full precision.
30 
31 enum class TestEnum1
32 {
33  VALUE1,
34  VALUE2
35 };
36 
37 enum class TestEnum2
38 {
39  VALUE1,
40  VALUE2
41 };
42 
43 std::unordered_map<std::string, std::any> lookup_input_enum_value{{"testenum1-value1", TestEnum1::VALUE1},
44  {"testenum1-value2", TestEnum1::VALUE2},
45  {"testenum2-value1", TestEnum2::VALUE1},
46  {"testenum2-value2", TestEnum2::VALUE2}};
47 
48 // clang-format: off
50 {
51 public:
53  {
54  section_name = "Test";
55  attributes = {"name", "samples", "kmax", "full", "width::type"};
56  parameters = {"label", "count", "width", "rational", "testenum1",
57  "testenum2", "sposets", "center", "density", "target"};
58  required = {"count", "full"};
59  strings = {"name", "label", "width::type"};
60  multi_strings = {"sposets"};
61  multi_reals = {"density"};
62  multiple = {"target"};
63  integers = {"samples", "count"};
64  reals = {"kmax", "width"};
65  positions = {"center", "target"};
66  bools = {"full", "rational"};
67  enums = {"testenum1", "testenum2"};
68  default_values = {{"name", std::string("demo")},
69  {"samples", int(20)},
70  {"width", Real(1.0)},
71  {"rational", bool(false)}};
72  };
73  // clang-format: on
74 
75  std::any assignAnyEnum(const std::string& name) const override
76  {
77  return lookupAnyEnum(name, get<std::string>(name), lookup_input_enum_value);
78  }
79 
80  void report(std::ostream& ostr)
81  { //InputSection::report(ostr);
82  }
83 };
84 
86 {
87 public:
89  {
90  section_name = "unknown";
91  enums = {"testenum"};
92  }
93 };
94 
95 
96 TEST_CASE("InputSection::InputSection", "[estimators]")
97 {
98  // empty input section
100  // no values assigned yet
101  CHECK(!ti.has("name"));
102  CHECK(!ti.has("samples"));
103  CHECK(!ti.has("kmax"));
104  CHECK(!ti.has("full"));
105  CHECK(!ti.has("label"));
106  CHECK(!ti.has("count"));
107  CHECK(!ti.has("width"));
108  CHECK(!ti.has("rational"));
109  CHECK(!ti.has("sposets"));
110 }
111 
112 TEST_CASE("InputSection::assignAnyEnum", "[estimators]")
113 {
114  enum class SomeEnum
115  {
116  VALUE1,
117  VALUE2
118  };
119 
120  TestAssignAnyEnum taae;
121  CHECK_THROWS_AS(taae.get<SomeEnum>("testenum"), UniformCommunicateError);
122 }
123 
124 TEST_CASE("InputSection::readXML", "[estimators]")
125 {
126  SECTION("minimum required attributes and parameters")
127  {
128  // clang-format: off
129  const char* xml = R"(
130 <test full="no">
131  <parameter name="count"> 15 </parameter>
132 </test>
133 )";
134  // clang-format: on
135 
136  // parse xml doc
138  bool okay = doc.parseFromString(xml);
139  REQUIRE(okay);
140  xmlNodePtr cur = doc.getRoot();
141 
142  // read xml
143  TestInputSection ti;
144  ti.readXML(cur);
145 
146  ti.report(std::cout);
147 
148  // assigned from xml
149  CHECK(ti.has("full"));
150  CHECK(ti.has("count"));
151  // assigned from defaults
152  CHECK(ti.has("name"));
153  CHECK(ti.has("samples"));
154  CHECK(ti.has("width"));
155  CHECK(ti.has("rational"));
156  // unassigned
157  CHECK(!ti.has("kmax"));
158  CHECK(!ti.has("label"));
159  CHECK(!ti.has("sposets"));
160  CHECK(!ti.has("center"));
161  // check value correctness
162  CHECK(ti.get<bool>("full") == false);
163  CHECK(ti.get<int>("count") == 15);
164  CHECK(ti.get<std::string>("name") == "demo");
165  CHECK(ti.get<int>("samples") == 20);
166  CHECK(ti.get<Real>("width") == Approx(1.0));
167  CHECK(ti.get<bool>("rational") == false);
168  }
169 
170  SECTION("complete attributes and parameters")
171  {
172  // clang-format: off
173  const char* xml = R"(
174 <test name="alice" samples="10" kmax="3.0" full="no">
175  <parameter name="label" > relative </parameter>
176  <parameter name="count" > 15 </parameter>
177  <parameter name="width" type="super"> 2.5 </parameter>
178  <parameter name="rational"> yes </parameter>
179  <parameter name="testenum1"> Value1 </parameter>
180  <parameter name="testenum2"> Value2 </parameter>
181  <parameter name="sposets"> spo1 spo2 </parameter>
182  <density> 10.0 20.0 30.0 </density>
183  <target> 0.0 0.2 0.3 </target>
184  <target> 0.1 0.3 0.5 </target>
185  <parameter name="center"> 0.0 0.0 0.1 </parameter>
186 </test>
187 )";
188  // clang-format: on
189 
190  // parse xml doc
192  bool okay = doc.parseFromString(xml);
193  REQUIRE(okay);
194  xmlNodePtr cur = doc.getRoot();
195 
196  // read xml
197  TestInputSection ti;
198  ti.readXML(cur);
199 
200  ti.report(std::cout);
201  // assigned from xml
202  CHECK(ti.has("name"));
203  CHECK(ti.has("samples"));
204  CHECK(ti.has("kmax"));
205  CHECK(ti.has("full"));
206  CHECK(ti.has("label"));
207  CHECK(ti.has("count"));
208  CHECK(ti.has("width"));
209  CHECK(ti.has("width::type"));
210  CHECK(ti.has("rational"));
211  CHECK(ti.has("sposets"));
212  // check value correctness
213  CHECK(ti.get<std::string>("name") == "alice");
214  CHECK(ti.get<int>("samples") == 10);
215  CHECK(ti.get<Real>("kmax") == Approx(3.0));
216  CHECK(ti.get<bool>("full") == false);
217  CHECK(ti.get<std::string>("label") == "relative");
218  CHECK(ti.get<int>("count") == 15);
219  CHECK(ti.get<Real>("width") == Approx(2.5));
220  CHECK(ti.get<std::string>("width::type") == "super");
221  CHECK(ti.get<bool>("rational") == true);
222  CHECK(ti.get<std::vector<Real>>("density") == std::vector<Real>{10.0, 20.0, 30.0});
223  CHECK(ti.get<TestEnum1>("testenum1") == TestEnum1::VALUE1);
224  CHECK(ti.get<TestEnum2>("testenum2") == TestEnum2::VALUE2);
225  CHECK(ti.get<std::vector<std::string>>("sposets") == std::vector<std::string>{"spo1", "spo2"});
226  }
227 
228 
229  SECTION("invalid inputs")
230  {
231  // cases that should result in thrown exception:
232  // required attribute/parameter is missing
233  // unrecognized attribute/parameter encountered
234 
235  std::map<std::string, std::string_view> invalid_inputs =
236  {{"missing_attribute", R"(
237 <test>
238  <parameter name="count"> 15 </parameter>
239 </test>
240 )"},
241  {"missing_parameter", R"(
242 <test full="no"/>
243 )"},
244  {"foreign_attribute", R"(
245 <test full="no" area="51">
246  <parameter name="count"> 15 </parameter>
247 </test>
248 )"},
249  {"foreign_parameter", R"(
250 <test full="no">
251  <parameter name="count"> 15 </parameter>
252  <parameter name="area" > 51 </parameter>
253 </test>
254 )"},
255  {"invalid_section_name", R"(<not_test><parameter name="nothing"></parameter></not_test>)"}};
256 
257  std::cout << "really going to try bad sections\n" << std::endl;
258  for (auto& [label, xml] : invalid_inputs)
259  {
260  // parse xml doc
262  bool okay = doc.parseFromString(xml);
263  REQUIRE(okay);
264  xmlNodePtr cur = doc.getRoot();
265 
266  // read xml
267  TestInputSection ti;
268  CHECK_THROWS_AS(ti.readXML(cur), UniformCommunicateError);
269  }
270  }
271 }
272 
273 TEST_CASE("InputSection::InvalidElement", "[estimators]")
274 {
275  std::string invalid_element{R"(<test> &lt; </test>)"};
277  bool okay = doc.parseFromString(invalid_element);
278  REQUIRE(okay);
279  xmlNodePtr cur = doc.getRoot();
280  TestInputSection ti;
281  CHECK_THROWS_AS(ti.readXML(cur), UniformCommunicateError);
282 }
283 
284 TEST_CASE("InputSection::init", "[estimators]")
285 {
286  SECTION("bad type handling")
287  {
288  TestInputSection ti;
289  CHECK_THROWS_AS(ti.init({{"full", bool(false)}, {"count", int(15)}, {"width", int(10)}}), UniformCommunicateError);
290  }
291  SECTION("minimum required attributes and parameters")
292  {
293  // initialize
294  TestInputSection ti;
295  ti.init({{"full", bool(false)}, {"count", int(15)}});
296 
297  ti.report(std::cout);
298 
299  // assigned from initializer-list
300  CHECK(ti.has("full"));
301  CHECK(ti.has("count"));
302  // assigned from defaults
303  CHECK(ti.has("name"));
304  CHECK(ti.has("samples"));
305  CHECK(ti.has("width"));
306  CHECK(ti.has("rational"));
307  // unassigned
308  CHECK(!ti.has("kmax"));
309  CHECK(!ti.has("label"));
310  // check value correctness
311  CHECK(ti.get<bool>("full") == false);
312  CHECK(ti.get<int>("count") == 15);
313  CHECK(ti.get<std::string>("name") == "demo");
314  CHECK(ti.get<int>("samples") == 20);
315  CHECK(ti.get<Real>("width") == Approx(1.0));
316  CHECK(ti.get<bool>("rational") == false);
317  }
318 
319 
320  SECTION("complete attributes and parameters")
321  {
322  // initialize
323  TestInputSection ti;
324  ti.init({{"name", std::string("alice")},
325  {"samples", int(10)},
326  {"kmax", Real(3.0)},
327  {"full", bool(false)},
328  {"label", std::string("relative")},
329  {"count", int(15)},
330  {"width", Real(2.5)},
331  {"rational", bool(true)},
332  {"sposets", std::vector<std::string>{"spo1", "spo2"}},
333  {"center", InputSection::Position(0.0, 0.0, 0.1)}});
334 
335  ti.report(std::cout);
336  // assigned from initializer-list
337  CHECK(ti.has("name"));
338  CHECK(ti.has("samples"));
339  CHECK(ti.has("kmax"));
340  CHECK(ti.has("full"));
341  CHECK(ti.has("label"));
342  CHECK(ti.has("count"));
343  CHECK(ti.has("width"));
344  CHECK(ti.has("rational"));
345  // check value correctness
346  CHECK(ti.get<std::string>("name") == "alice");
347  CHECK(ti.get<int>("samples") == 10);
348  CHECK(ti.get<Real>("kmax") == Approx(3.0));
349  CHECK(ti.get<bool>("full") == false);
350  CHECK(ti.get<std::string>("label") == "relative");
351  CHECK(ti.get<int>("count") == 15);
352  CHECK(ti.get<Real>("width") == Approx(2.5));
353  CHECK(ti.get<bool>("rational") == true);
354  CHECK(ti.get<std::vector<std::string>>("sposets") == std::vector<std::string>{"spo1", "spo2"});
355  CHECK(ti.get<InputSection::Position>("center") == InputSection::Position(0.0, 0.0, 0.1));
356  }
357 
358 
359  SECTION("invalid type assignment")
360  {
361  TestInputSection ti;
362  CHECK_THROWS_AS(ti.init({{"full", bool(false)}, {"count", Real(15.)}}), UniformCommunicateError);
363  }
364 }
365 
366 TEST_CASE("InputSection::get", "[estimators]")
367 {
368  TestInputSection ti;
369  ti.init({{"name", std::string("alice")},
370  {"samples", int(10)},
371  {"kmax", Real(3.0)},
372  {"full", bool(false)},
373  {"label", std::string("relative")},
374  {"count", int(15)},
375  {"width", Real(2.5)},
376  {"rational", bool(true)},
377  {"sposets", std::vector<std::string>{"spo1", "spo2"}},
378  {"center", InputSection::Position(0.0, 0.0, 0.1)}});
379 
380  // invalid type access results in thrown exception
381  CHECK_THROWS_AS(ti.get<int>("name"), UniformCommunicateError);
382  CHECK_THROWS_AS(ti.get<Real>("samples"), UniformCommunicateError);
383  CHECK_THROWS_AS(ti.get<bool>("kmax"), UniformCommunicateError);
384  CHECK_THROWS_AS(ti.get<std::string>("full"), UniformCommunicateError);
385  CHECK_THROWS_AS(ti.get<Real>("label"), UniformCommunicateError);
386  CHECK_THROWS_AS(ti.get<bool>("count"), UniformCommunicateError);
387  CHECK_THROWS_AS(ti.get<std::string>("width"), UniformCommunicateError);
388  CHECK_THROWS_AS(ti.get<int>("rational"), UniformCommunicateError);
389  CHECK_THROWS_AS(ti.get<std::string>("sposets"), UniformCommunicateError);
390  CHECK_THROWS_AS(ti.get<Real>("center"), UniformCommunicateError);
391 }
392 
394 {
395 public:
396  struct WeirdStuff
397  {
398  std::string letters;
399  std::array<int, 3> numbers;
400  };
401  using Repeater = std::vector<std::pair<std::string, std::string>>;
403  {
404  section_name = "Test";
405  attributes = {"name", "samples", "kmax", "full", "custom_attribute", "with_custom::custom_attribute"};
406  parameters = {"label", "count", "width", "with_custom"};
407  strings = {"name", "label", "with_custom"};
408  reals = {"kmax"};
409  integers = {"samples", "count"};
410  bools = {"full"};
411  custom = {"weird_stuff", "repeater", "custom_attribute"};
412  }
413  void setFromStreamCustom(const std::string& ename, const std::string& name, std::istringstream& svalue) override
414  {
415  if (ename == "weird_stuff")
416  {
417  WeirdStuff ws;
418  svalue >> ws.letters;
419  svalue >> ws.numbers[0];
420  svalue >> ws.numbers[1];
421  svalue >> ws.numbers[2];
422  values_[name] = ws;
423  }
424  else if (ename == "repeater")
425  {
426  std::string compound;
427  svalue >> compound;
428  auto split_vstrv = split(compound, ":");
429  if (has(name))
430  std::any_cast<Repeater>(&(values_[name]))->emplace_back(split_vstrv[0], split_vstrv[1]);
431  else
432  values_[name] = Repeater{{split_vstrv[0], split_vstrv[1]}};
433  }
434  else if (name == "custom_attribute" || name == "with_custom::custom_attribute")
435  {
436  std::string cus_at;
437  std::getline(svalue, cus_at);
438  values_[name] = cus_at;
439  }
440  else
441  throw std::runtime_error("bad name passed: " + name +
442  " or custom setFromStream not implemented in derived class.");
443  }
444 
445  void report(std::ostream& ostr) { InputSection::report(ostr); }
446 };
447 
449 {
450 public:
451  struct WeirdStuff
452  {
453  std::string letters;
454  std::array<int, 3> numbers;
455  };
456  using Repeater = std::vector<std::pair<std::string, std::string>>;
458  {
459  section_name = "Test";
460  attributes = {"name", "samples", "kmax", "full", "custom_attribute", "with_custom::custom_attribute"};
461  parameters = {"label", "count", "width", "with_custom"};
462  strings = {"name", "label"};
463  reals = {"kmax"};
464  integers = {"samples", "count"};
465  bools = {"full"};
466  custom = {"weird_stuff", "repeater", "custom_attribute"};
467  }
468 };
469 
470 TEST_CASE("InputSection::custom", "[estimators]")
471 {
472  std::string_view xml = R"XML(
473 <test name="alice" samples="10" kmax="3.0" full="no" custom_attribute="for the section">
474  <parameter name="label" > relative </parameter>
475  <parameter name="count" > 15 </parameter>
476  <weird_stuff name="weird"> XQ 10 20 10 </weird_stuff>
477  <Repeater> first:something </Repeater>
478  <Repeater> second:else </Repeater>
479  <parameter name="with_custom" custom_attribute="This is a custom attribute."/>
480 </test>
481 )XML";
482 
484  bool okay = doc.parseFromString(xml);
485  xmlNodePtr cur = doc.getRoot();
486  CustomTestInput cti;
487  cti.readXML(cur);
488 
489  auto ws = cti.get<decltype(cti)::WeirdStuff>("weird");
490  CHECK(ws.letters == "XQ");
491  std::array<int, 3> exp_numbers{10, 20, 10};
492  CHECK(ws.numbers == exp_numbers);
493 
494  cti.report(std::cout);
495  std::string custom_attribute = cti.get<std::string>("with_custom::custom_attribute");
496  CHECK(custom_attribute == "This is a custom attribute.");
497  custom_attribute = cti.get<std::string>("custom_attribute");
498  CHECK(custom_attribute == "for the section");
499 
500  auto repeater = cti.get<decltype(cti)::Repeater>("repeater");
501  decltype(cti)::Repeater exp_repeater{{"first", "something"}, {"second", "else"}};
502  CHECK(repeater == exp_repeater);
503 
504  FailCustomTestInput fcti;
505  CHECK_THROWS_AS(fcti.readXML(cur), std::runtime_error);
506 }
507 
508 /** Generic delgate input class.
509  * This feature is targeted at supporting things like ReferencePointsInput, SpaceGridInput etc.
510  *
511  * The delegate input requires:
512  * A constructor that takes an xmlNodePtr
513  * A factoryFunction that matches the signature discussed in InputSection::DelegateHandler
514  */
515 
517 {
518 public:
520  {
521  public:
523  {
524  section_name = "AnotherInput";
525  section_name_alternates = {"ainput"};
526  attributes = {"name", "optional"};
527  strings = {"name", "optional"};
528  }
529  };
530 
531  AnotherInput(xmlNodePtr cur)
532  {
533  input_section_.readXML(cur);
534  auto setIfInInput = LAMBDA_setIfInInput;
535  setIfInInput(name_, "name");
536  setIfInInput(optional_, "optional");
537  input_str_ = XMLNodeString{cur};
538  }
539 
540  std::vector<std::string_view> getTokens() const { return modernstrutil::split(input_str_, " "); }
541  const std::string& get_name() const { return name_; };
542 
543 private:
544  std::string name_ = "AnotherInputSection";
546  std::string input_str_;
547  std::string optional_;
548  std::vector<std::string_view> tokens_;
549 };
550 
551 std::any makeAnotherInput(xmlNodePtr cur, std::string& value_label)
552 {
553  AnotherInput another_input{cur};
554  value_label = another_input.get_name();
555  return another_input;
556 }
557 
558 /** Generic input section delegating some inputs to other input classes.
559  * an example would be EnergyDensityInput
560  */
562 {
564  {
565  public:
567  {
568  section_name = "DelegateTest";
569  attributes = {"name", "full"};
570  parameters = {"label", "count", "width"};
571  strings = {"name", "label"};
572  integers = {"count"};
573  bools = {"full"};
574  delegates = {"anotherinput"};
575  InputSection::registerDelegate("anotherinput", makeAnotherInput);
576  }
577  };
578 
579 public:
580  DelegatingInput(xmlNodePtr cur) { dins_.readXML(cur); }
581 
582  // rather than write a real input class we just pass through InputSection for this test.
583  bool has(const std::string& name) const { return dins_.has(name); }
584  template<typename T>
585  T get(const std::string& name) const
586  {
587  return dins_.get<T>(name);
588  }
589 
590 private:
591  std::string name_ = "DelegatingInput";
593 };
594 
595 TEST_CASE("InputSection::Delegate", "[estimators]")
596 {
597  std::string_view xml = R"XML(
598 <delegatetest name="alice" full="no">
599  <parameter name="label" > relative </parameter>
600  <parameter name="count" > 15 </parameter>
601  <AnotherInput name="ainput"> XQ 10 20 10 </AnotherInput>
602 </delegatetest>
603 )XML";
604 
606  bool okay = doc.parseFromString(xml);
607  REQUIRE(okay);
608  xmlNodePtr cur = doc.getRoot();
609 
610  DelegatingInput dti(cur);
611 
612  CHECK(dti.has("ainput"));
613  AnotherInput ai(dti.get<AnotherInput>("ainput"));
614  std::vector<std::string_view> ref_tokens{"XQ", "10", "20", "10"};
615  CHECK(ai.getTokens() == ref_tokens);
616 
617 
618  std::string_view xml_duplicate_delegate_name = R"XML(
619 <test name="alice" full="no">
620  <parameter name="label" > relative </parameter>
621  <parameter name="count" > 15 </parameter>
622  <AnotherInput name="ainput"> XQ 10 20 10 </AnotherInput>
623  <AnotherInput name="ainput"> XQ 10 20 10 </AnotherInput>
624 </test>
625 )XML";
626 
627  okay = doc.parseFromString(xml_duplicate_delegate_name);
628  REQUIRE(okay);
629  cur = doc.getRoot();
630 
631  CHECK_THROWS_AS(dti = DelegatingInput(cur), UniformCommunicateError);
632 }
633 
634 } // namespace qmcplusplus
std::vector< std::string_view > tokens_
std::any makeAnotherInput(xmlNodePtr cur, std::string &value_label)
std::unordered_set< std::string > strings
Definition: InputSection.h:67
std::unordered_set< std::string > reals
Definition: InputSection.h:72
class that handles xmlDoc
Definition: Libxml2Doc.h:76
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
std::unordered_set< std::string > parameters
Definition: InputSection.h:63
Generic delgate input class.
std::vector< std::string_view > getTokens() const
TEST_CASE("complex_helper", "[type_traits]")
const std::string & get_name() const
std::unordered_map< std::string, std::any > lookup_input_enum_value
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
std::any assignAnyEnum(const std::string &name) const override
Derived class overrides this to get proper assignment of scoped enum values.
std::unordered_set< std::string > positions
Definition: InputSection.h:73
std::unordered_map< std::string, std::any > default_values
Definition: InputSection.h:79
QMCTraits::FullPrecRealType Real
Definition: InputSection.h:40
void setFromStreamCustom(const std::string &ename, const std::string &name, std::istringstream &svalue) override
Derived class can overrides this to do custom parsing of the element values for Custom elements These...
ForceBase::Real Real
Definition: ForceBase.cpp:26
Generic input section delegating some inputs to other input classes.
void init(const std::unordered_map< std::string, std::any > &init_values)
bool has(const std::string &name) const
REQUIRE(std::filesystem::exists(filename))
void report(std::ostream &ostr)
T get(const std::string &name) const
#define LAMBDA_setIfInInput
If tag is present in input_secution set its variable.
typename QMCTypes< Real, OHMMS_DIM >::PosType Position
Definition: InputSection.h:41
std::unordered_set< std::string > integers
Definition: InputSection.h:71
This a subclass for runtime errors that will occur on all ranks.
void readXML(xmlNodePtr cur)
Read variable values (initialize) from XML input, call checkValid.
void report(std::ostream &ostr)
constexpr bool has(const R &this_one)
std::unordered_set< std::string > attributes
Definition: InputSection.h:62
TEST_CASE("InputSection::Delegate", "[estimators]")
static std::any lookupAnyEnum(const std::string &enum_name, const std::string &enum_value, const std::unordered_map< std::string, std::any > &enum_map)
Assign any enum helper for InputSection derived class assumes enum lookup table of this form: inline ...
DelegatingInputSection dins_
std::vector< std::pair< std::string, std::string > > Repeater
convert xmlNode contents into a std::string
std::unordered_set< std::string > required
Definition: InputSection.h:65
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
std::vector< std::string_view > split(const string_view s, const string_view delimiters)
AnotherInputSection input_section_
std::unordered_set< std::string > multi_strings
Definition: InputSection.h:68
std::unordered_set< std::string > bools
Definition: InputSection.h:70
std::unordered_set< std::string > multi_reals
Definition: InputSection.h:69
QTFull::RealType FullPrecRealType
Definition: Configuration.h:66
std::vector< std::pair< std::string, std::string > > Repeater
std::unordered_set< std::string > multiple
Definition: InputSection.h:66
Input section provides basic parsing and a uniform method of access to the raw parsed input...
Definition: InputSection.h:37
T get(const std::string &name) const
Definition: InputSection.h:92
bool has(const std::string &name) const
Definition: InputSection.h:87
std::string section_name
"Name" of the input section, you must define this in the subtype and the ename, name, type, or method must match.
Definition: InputSection.h:57
std::unordered_set< std::string > enums
list of enum inputs which allow a finite set of strings to map to enum values The enum class types an...
Definition: InputSection.h:78