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() +
"='" +
108 #ifdef MOOSE_MFEM_ENABLED 149 if (names.size() != 2)
150 throw std::invalid_argument(
"invalid syntax in ReporterName parameter " + field.fullpath() +
151 ": supplied name '" + val +
"' must contain the '/' delimiter");
152 return {names[0], names[1]};
162 const auto vec = field.param<std::vector<double>>();
163 if (vec.size() != LIBMESH_DIM)
165 " parameter '" + field.fullpath() +
"': was given " +
166 std::to_string(vec.size()) +
" component(s) but should have " +
167 std::to_string(LIBMESH_DIM));
192 const auto vec = field.param<std::vector<double>>();
193 value.resize(vec.size());
202 std::vector<std::string> tokens;
208 std::vector<Real> values;
209 if (!MooseUtils::tokenizeAndConvert<Real>(
token, values))
210 throw std::invalid_argument(
"invalid syntax for parameter: " + field.fullpath() +
"[" +
211 std::to_string(i) +
"]='" +
token +
"'");
213 value.resize(tokens.size(), values.size());
214 else if (libMesh::cast_int<std::size_t>(
value.cols()) != values.size())
215 throw std::invalid_argument(
"matrix is not square for parameter " + field.fullpath());
217 value(i, j) = values[j];
222 {
value = field.param<std::string>(); });
235 const auto vec = field.param<std::vector<double>>();
236 if (vec.size() != LIBMESH_DIM * LIBMESH_DIM)
237 throw std::invalid_argument(
"invalid RealTensorValue parameter '" + field.fullpath() +
238 "': size is " + std::to_string(vec.size()) +
" but should be " +
239 std::to_string(LIBMESH_DIM * LIBMESH_DIM));
243 value(i, j) =
Real(vec[i * LIBMESH_DIM + j]);
258 const auto vec = field.param<std::vector<double>>();
260 if (vec.size() % LIBMESH_DIM)
261 throw std::invalid_argument(
"wrong number of values in vector parameter '" + field.fullpath() +
262 "': size " + std::to_string(vec.size()) +
" is not a multiple of " +
263 std::to_string(LIBMESH_DIM));
265 const std::size_t size = vec.size() / LIBMESH_DIM;
269 value[i](d) = vec[i * LIBMESH_DIM + d];
274 registry.
add<std::vector<Point>>([](std::vector<Point> &
value,
const hit::Field & field)
278 [](std::vector<RealVectorValue> &
value,
const hit::Field & field)
287 [](std::vector<MooseEnum> &
value,
const hit::Field & field)
289 mooseAssert(!
value.empty(),
"Missing a value to initialize on");
294 const auto vec = field.param<std::vector<std::string>>();
301 [](std::vector<MultiMooseEnum> &
value,
const hit::Field & field)
303 mooseAssert(!
value.empty(),
"Missing a value to initialize on");
308 const auto & entry = tokens[i];
310 throw std::invalid_argument(
"entry " + std::to_string(i) +
" in '" + field.fullpath() +
316 std::vector<std::string> strvals;
317 MooseUtils::tokenize<std::string>(tokens[i], strvals, 1,
" ");
323 [](std::vector<ReporterName> &
value,
const hit::Field & field)
326 const auto names = field.param<std::vector<std::string>>();
327 value.resize(names.size());
333 [](std::vector<CLIArgString> &
value,
const hit::Field & field)
336 const auto strvals = field.param<std::vector<std::string>>();
341 value.resize(strvals.size());
344 unsigned int i_param = 0;
345 bool vector_param_detected =
false;
349 const auto double_split =
351 const auto single_split =
353 if (double_split.size() + single_split.size() >= 3)
356 if ((double_split.size() + single_split.size()) % 2 == 1)
357 vector_param_detected = !vector_param_detected;
360 if (vector_param_detected)
361 value[i_param] += strvals[i] +
' ';
364 value[i_param] += strvals[i];
369 value.resize(i_param);
379 const auto strval = field.param<std::string>();
382 std::vector<std::string> tokens;
384 value.resize(tokens.size());
387 std::vector<std::vector<double>> vecvec(tokens.size());
389 if (!MooseUtils::tokenizeAndConvert<double>(tokens[i], vecvec[i]))
390 throw std::invalid_argument(
"invalid format for parameter '" + field.fullpath() +
391 "' at index " + std::to_string(i));
395 const auto & vec = vecvec[i];
396 if (vec.size() % LIBMESH_DIM)
397 throw std::invalid_argument(
398 "wrong number of values in double-indexed vector component parameter '" +
399 field.fullpath() +
"' at index " + std::to_string(i) +
": subcomponent size " +
400 std::to_string(vec.size()) +
" is not a multiple of " + std::to_string(LIBMESH_DIM));
404 value.resize(vecvec.size());
407 const auto & vec_entry = vecvec[i];
408 auto & value_entry =
value[i];
409 const std::size_t size = vec_entry.size() / LIBMESH_DIM;
410 value_entry.resize(size);
413 value_entry[j](d) = vec_entry[j * LIBMESH_DIM + d];
419 [](std::vector<std::vector<Point>> &
value,
const hit::Field & field)
423 [](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)
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
std::vector< std::string > rsplit(const std::string &str, const std::string &delimiter, std::size_t max_count)
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)
std::vector< std::string > split(const std::string &str, const std::string &delimiter, std::size_t max_count)
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)