29 setIfInInput(
label_,
"label");
30 setIfInInput(
grid_,
"grid");
31 setIfInInput(
p1_,
"p1");
32 setIfInInput(
p2_,
"p2");
33 setIfInInput(
scale_,
"scale");
37 const std::string& name,
38 std::istringstream& svalue)
45 values_[name] = parseGridInput<Real>(svalue);
49 std::ostringstream msg;
50 msg <<
"SpaceGridAxisInputSection failed in custom stream handler with: " << uce.what()
51 <<
" a report of the current parse progress should be found above\n";
57 throw std::runtime_error(
"bad name passed or custom setFromStream not implemented in derived class.");
64 setIfInInput(p1_,
"p1");
65 setIfInInput(p2_,
"p2");
66 setIfInInput(fraction_,
"fraction");
100 for (
auto& axis : axes)
103 std::string axis_label = axis_input->
get_input().template get<std::string>(
"label");
104 auto result = std::find(std::begin(ax_labels), std::end(ax_labels), axis_label);
105 if (result == std::end(ax_labels))
120 std::ostringstream
error;
121 error <<
" grid values for " <<
axis_labels_[d] <<
" must fall in [0,1]" << std::endl;
129 std::ostringstream
error;
130 error <<
" grid values for " <<
axis_labels_[d] <<
" must fall in [-1,1]" << std::endl;
146 value_label =
"spacegrid";
152 auto axes = std::any_cast<std::vector<std::any>>(values_[
"axis"]);
153 static_assert(
std::is_same<decltype(axes), std::vector<std::any>>::value);
154 auto axis_count = axes.size();
157 std::ostringstream
error;
158 error <<
"SpaceGrid input must contain " <<
OHMMS_DIM <<
" axes, " << axis_count <<
" found!";
std::array< std::string, OHMMS_DIM > axis_labels_
void checkAxes(std::vector< std::any > &axes)
helper functions for EinsplineSetBuilder
SpaceGridInputSection input_section_
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...
static const std::unordered_map< std::string, std::any > lookup_input_enum_value
std::array< std::string, OHMMS_DIM > axis_p1s_
std::any makeSpaceGridInput(xmlNodePtr cur, std::string &value_label)
factory function for a SpaceGridInput
bool is_same(const xmlChar *a, const char *b)
SpaceGridAxisInput(xmlNodePtr cur)
const SpaceGridAxisInputSection & get_input()
void error(char const *m)
std::array< AxisGrid< Real >, OHMMS_DIM > axis_grids_
SpaceGridAxisInputSection input_section_
#define LAMBDA_setIfInInput
If tag is present in input_secution set its variable.
std::any assignAnyEnum(const std::string &name) const override
Derived class overrides this to get proper assignment of scoped enum values.
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.
std::array< std::string, OHMMS_DIM > axis_p2s_
SpaceGridInput(xmlNodePtr cur)
static const std::unordered_map< CoordForm, LabelSet > axes_label_sets
void checkParticularValidity() override
Do validation for a particular subtype of InputSection Called by check_valid.
std::array< Real, OHMMS_DIM > axis_scales_
SpaceGridOriginInput(xmlNodePtr cur)
T get(const std::string &name) const
bool has(const std::string &name) const