29 value = field.boolVal();
34 const auto strval = field.param<std::string>();
37 else if (strval ==
"0")
39 else if (!hit::toBool(strval, &
value))
40 throw std::invalid_argument(
"invalid boolean syntax for parameter: " + field.path() +
"='" +
107 #ifdef MOOSE_MFEM_ENABLED 146 if (names.size() != 2)
147 throw std::invalid_argument(
"invalid syntax in ReporterName parameter " + field.fullpath() +
148 ": supplied name '" + val +
"' must contain the '/' delimiter");
149 return {names[0], names[1]};
159 const auto vec = field.param<std::vector<double>>();
160 if (vec.size() != LIBMESH_DIM)
162 " parameter '" + field.fullpath() +
"': was given " +
163 std::to_string(vec.size()) +
" component(s) but should have " +
164 std::to_string(LIBMESH_DIM));
189 const auto vec = field.param<std::vector<double>>();
190 value.resize(vec.size());
199 std::vector<std::string> tokens;
205 std::vector<Real> values;
206 if (!MooseUtils::tokenizeAndConvert<Real>(
token, values))
207 throw std::invalid_argument(
"invalid syntax for parameter: " + field.fullpath() +
"[" +
208 std::to_string(i) +
"]='" +
token +
"'");
210 value.resize(tokens.size(), values.size());
211 else if (libMesh::cast_int<std::size_t>(
value.cols()) != values.size())
212 throw std::invalid_argument(
"matrix is not square for parameter " + field.fullpath());
214 value(i, j) = values[j];
219 {
value = field.param<std::string>(); });
232 const auto vec = field.param<std::vector<double>>();
233 if (vec.size() != LIBMESH_DIM * LIBMESH_DIM)
234 throw std::invalid_argument(
"invalid RealTensorValue parameter '" + field.fullpath() +
235 "': size is " + std::to_string(vec.size()) +
" but should be " +
236 std::to_string(LIBMESH_DIM * LIBMESH_DIM));
240 value(i, j) =
Real(vec[i * LIBMESH_DIM + j]);
255 const auto vec = field.param<std::vector<double>>();
257 if (vec.size() % LIBMESH_DIM)
258 throw std::invalid_argument(
"wrong number of values in vector parameter '" + field.fullpath() +
259 "': size " + std::to_string(vec.size()) +
" is not a multiple of " +
260 std::to_string(LIBMESH_DIM));
262 const std::size_t size = vec.size() / LIBMESH_DIM;
266 value[i](d) = vec[i * LIBMESH_DIM + d];
271 registry.
add<std::vector<Point>>([](std::vector<Point> &
value,
const hit::Field & field)
275 [](std::vector<RealVectorValue> &
value,
const hit::Field & field)
284 [](std::vector<MooseEnum> &
value,
const hit::Field & field)
286 mooseAssert(!
value.empty(),
"Missing a value to initialize on");
291 const auto vec = field.param<std::vector<std::string>>();
298 [](std::vector<MultiMooseEnum> &
value,
const hit::Field & field)
300 mooseAssert(!
value.empty(),
"Missing a value to initialize on");
305 const auto & entry = tokens[i];
307 throw std::invalid_argument(
"entry " + std::to_string(i) +
" in '" + field.fullpath() +
313 std::vector<std::string> strvals;
314 MooseUtils::tokenize<std::string>(tokens[i], strvals, 1,
" ");
320 [](std::vector<ReporterName> &
value,
const hit::Field & field)
323 const auto names = field.param<std::vector<std::string>>();
324 value.resize(names.size());
330 [](std::vector<CLIArgString> &
value,
const hit::Field & field)
333 const auto strvals = field.param<std::vector<std::string>>();
338 value.resize(strvals.size());
341 unsigned int i_param = 0;
342 bool vector_param_detected =
false;
346 const auto double_split =
348 const auto single_split =
350 if (double_split.size() + single_split.size() >= 3)
353 if ((double_split.size() + single_split.size()) % 2 == 1)
354 vector_param_detected = !vector_param_detected;
357 if (vector_param_detected)
358 value[i_param] += strvals[i] +
' ';
361 value[i_param] += strvals[i];
366 value.resize(i_param);
376 const auto strval = field.param<std::string>();
379 std::vector<std::string> tokens;
381 value.resize(tokens.size());
384 std::vector<std::vector<double>> vecvec(tokens.size());
386 if (!MooseUtils::tokenizeAndConvert<double>(tokens[i], vecvec[i]))
387 throw std::invalid_argument(
"invalid format for parameter '" + field.fullpath() +
388 "' at index " + std::to_string(i));
392 const auto & vec = vecvec[i];
393 if (vec.size() % LIBMESH_DIM)
394 throw std::invalid_argument(
395 "wrong number of values in double-indexed vector component parameter '" +
396 field.fullpath() +
"' at index " + std::to_string(i) +
": subcomponent size " +
397 std::to_string(vec.size()) +
" is not a multiple of " + std::to_string(LIBMESH_DIM));
401 value.resize(vecvec.size());
404 const auto & vec_entry = vecvec[i];
405 auto & value_entry =
value[i];
406 const std::size_t size = vec_entry.size() / LIBMESH_DIM;
407 value_entry.resize(size);
410 value_entry[j](d) = vec_entry[j * LIBMESH_DIM + d];
416 [](std::vector<std::vector<Point>> &
value,
const hit::Field & field)
420 [](std::vector<std::vector<RealVectorValue>> &
value,
const hit::Field & field)
A MultiMooseEnum object to hold "execute_on" flags.
void tokenize(const std::string &str, std::vector< T > &elements, unsigned int min_len=1, const std::string &delims="/")
This function will split the passed in string on a set of delimiters appending the substrings to the ...
void setScalarValue(T &value, const hit::Field &field)
Converts the given field node into a scalar of the given type.
registerVectorParameter(bool)
static auto multimooseenum
static Moose::ParameterRegistry & registry
static auto vector_cliargstring
static auto realeigenvector
Registry that allows for the typeless setting of a parameter value from a hit field.
const auto set_double_vector_component_value
Helper for setting a double vector component value (one with 3 real values)
static auto vector_realvectorvalue
auto max(const L &left, const R &right)
std::vector< std::string > split(const std::string &str, const std::string &delimiter, std::size_t max_count=std::numeric_limits< std::size_t >::max())
Python like split functions for strings.
std::vector< std::string > rsplit(const std::string &str, const std::string &delimiter, std::size_t max_count=std::numeric_limits< std::size_t >::max())
TensorValue< Real > RealTensorValue
static auto doublevector_realvectorvalue
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
static auto realvectorvalue
std::string trim(const std::string &str, const std::string &white_space=" \\\)
Standard scripting language trim function.
static auto doublevector_point
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
registerMapParameter(std::string, unsigned int)
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic > RealEigenMatrix
const auto set_scalar_component_value
Helper for setting a scalar component value (one with 3 real values)
static auto vector_multimooseenum
static auto realeigenmatrix
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const auto convert_reporter_name
Helper for converting a string to a ReporterName, which requires splitting the string at the '/' deli...
char add(F &&f)
Add a parameter.
static auto vector_reportername
IntRange< T > make_range(T beg, T end)
const auto set_vector_component_value
Helper for setting a vector component value (one with 3 real values)
static auto vector_mooseenum
Eigen::Matrix< Real, Eigen::Dynamic, 1 > RealEigenVector
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type...
registerParameter(FileName)
static auto realtensorvalue
std::string stringJoin(const std::vector< std::string > &values, const std::string &separator=" ")
Concatenates value into a single string separated by separator.
auto index_range(const T &sizable)
The Reporter system is comprised of objects that can contain any number of data values.
static ParameterRegistry & get()
Get the singleton registry.
registerScalarParameter(bool)
std::string prettyCppType(const std::string &cpp_type)