18 params.
addCoupledVar(
"coupled_variables",
"Vector of variables used in the parsed function");
21 params.
addParam<std::vector<std::string>>(
23 std::vector<std::string>(),
24 "Vector of constants used in the parsed function (use this for kB etc.)");
25 params.
addParam<std::vector<std::string>>(
26 "constant_expressions",
27 std::vector<std::string>(),
28 "Vector of values for the constants in constant_names (can be an FParser expression)");
31 params.
addParam<std::vector<std::string>>(
"tol_names",
32 std::vector<std::string>(),
33 "Vector of variable names to be protected from "
34 "being 0 or 1 within a tolerance (needed for log(c) "
35 "and log(1-c) terms)");
36 params.
addParam<std::vector<Real>>(
"tol_values",
38 "Vector of tolerance values for the variables in tol_names");
41 params.
addParam<std::vector<MooseFunctorName>>(
42 "functor_names", {},
"Functors to use in the parsed expression");
43 params.
addParam<std::vector<std::string>>(
46 "Symbolic name to use for each functor in 'functor_names' in the parsed expression. If not "
47 "provided, then the actual functor names will be used in the parsed expression.");
50 params.
addParam<std::vector<std::string>>(
51 "material_property_names",
52 std::vector<std::string>(),
53 "Vector of material properties used in the parsed function");
56 params.
addParam<std::vector<PostprocessorName>>(
57 "postprocessor_names",
58 std::vector<PostprocessorName>(),
59 "Vector of postprocessor names used in the parsed function");
65 "Parsed function (see FParser) expression for the parsed material",
66 "'function' is deprecated, use 'expression' instead");
71 "Parsed function (see FParser) expression for the parsed material");
77 : _function_param(parameters.isParamValid(
"function") ?
"function" :
"expression"),
78 _function(parameters.get<
std::string>(_function_param))
85 _tol_names = parameters.
get<std::vector<std::string>>(
"tol_names");
100 auto raiseErr = [
this](std::string param_name, std::string msg)
102 if (
auto derived_object =
dynamic_cast<MooseObject *
>(
this))
103 derived_object->paramError(param_name, msg);
108 auto hasDuplicates = [](
const std::vector<std::string> &
values)
111 return values.size() != s.size();
115 auto isKnownConstantName = [
this](
const std::string & name)
123 auto isReservedName = [reserved_names](
const std::string & name)
124 {
return reserved_names.find(name) != reserved_names.end(); };
128 raiseErr(
"constant_names",
"In the constants duplicate names are not permitted.");
131 if (isReservedName(name))
132 raiseErr(
"constant_names",
"In constants, the name '" + name +
"' is not permitted.");
137 raiseErr(
"tol_names",
"In the tolerances duplicate names are not permitted.");
143 raiseErr(
"functor_names",
"functor_symbols must be the same length as functor_names.");
148 raiseErr(
"functor_names",
"functor_symbols must be the same length as functor_names.");
149 std::vector<std::string> names;
154 if (hasDuplicates(names))
156 "In functors, duplicate names are not permitted.");
157 for (
const auto & name : names)
159 if (isKnownConstantName(name))
161 "In functors, the name '" + name +
"' is already in use as a constant.");
162 if (isReservedName(name))
164 "In functors, the name '" + name +
"' is not permitted.");
std::array< Real, 2 > values
Every object that can be built by the factory should be derived from this class.
std::vector< MooseFunctorName > _functor_names
Functor vectors (names, count, and symbols)
std::vector< std::string > _tol_names
tolerance vectors
std::vector< Real > _tol_values
ParsedMaterialBase(const InputParameters ¶meters)
std::vector< std::string > _constant_names
constant vectors
std::vector< std::string > _functor_symbols
static InputParameters validParams()
std::vector< std::string > _constant_expressions
void validateVectorNames(const std::set< std::string > &reserved_names={})
Function to ensure that the names of constants, tolerances, and functors do not overlap with each oth...