18 params.
addCoupledVar(
"args",
"Vector of variables used in the parsed function");
22 params.
addParam<std::vector<std::string>>(
24 std::vector<std::string>(),
25 "Vector of constants used in the parsed function (use this for kB etc.)");
26 params.
addParam<std::vector<std::string>>(
27 "constant_expressions",
28 std::vector<std::string>(),
29 "Vector of values for the constants in constant_names (can be an FParser expression)");
32 params.
addParam<std::vector<std::string>>(
"tol_names",
33 std::vector<std::string>(),
34 "Vector of variable names to be protected from " 35 "being 0 or 1 within a tolerance (needed for log(c) " 36 "and log(1-c) terms)");
37 params.
addParam<std::vector<Real>>(
"tol_values",
39 "Vector of tolerance values for the variables in tol_names");
42 params.
addParam<std::vector<MooseFunctorName>>(
43 "functor_names", {},
"Functors to use in the parsed expression");
44 params.
addParam<std::vector<std::string>>(
47 "Symbolic name to use for each functor in 'functor_names' in the parsed expression. If not " 48 "provided, then the actual functor names will be used in the parsed expression.");
51 params.
addParam<std::vector<std::string>>(
52 "material_property_names",
53 std::vector<std::string>(),
54 "Vector of material properties used in the parsed function");
57 params.
addParam<std::vector<PostprocessorName>>(
58 "postprocessor_names",
59 std::vector<PostprocessorName>(),
60 "Vector of postprocessor names used in the parsed function");
66 "Parsed function (see FParser) expression for the parsed material",
67 "'function' is deprecated, use 'expression' instead");
72 "Parsed function (see FParser) expression for the parsed material");
78 : _derived_object(obj),
79 _function_param(parameters.isParamValid(
"function") ?
"function" :
"expression"),
80 _function(parameters.
get<
std::string>(_function_param))
87 _tol_names = parameters.
get<std::vector<std::string>>(
"tol_names");
102 auto raiseErr = [
this](std::string param_name, std::string msg)
110 auto hasDuplicates = [](
const std::vector<std::string> & values)
112 std::set<std::string> s(values.begin(), values.end());
113 return values.size() != s.size();
117 auto isKnownConstantName = [
this](
const std::string &
name)
125 auto isReservedName = [reserved_names](
const std::string &
name)
126 {
return reserved_names.find(
name) != reserved_names.end(); };
130 raiseErr(
"constant_names",
"In the constants duplicate names are not permitted.");
133 if (isReservedName(
name))
134 raiseErr(
"constant_names",
"In constants, the name '" +
name +
"' is not permitted.");
139 raiseErr(
"tol_names",
"In the tolerances duplicate names are not permitted.");
145 raiseErr(
"functor_names",
"functor_symbols must be the same length as functor_names.");
150 raiseErr(
"functor_names",
"functor_symbols must be the same length as functor_names.");
151 std::vector<std::string> names;
156 if (hasDuplicates(names))
158 "In functors, duplicate names are not permitted.");
159 for (
const auto &
name : names)
161 if (isKnownConstantName(
name))
163 "In functors, the name '" +
name +
"' is already in use as a constant.");
164 if (isReservedName(
name))
166 "In functors, the name '" +
name +
"' is not permitted.");
std::vector< std::string > _constant_expressions
std::string name(const ElemQuality q)
std::vector< std::string > _constant_names
constant vectors
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
static InputParameters validParams()
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
ParsedMaterialBase(const InputParameters ¶meters, const MooseObject *obj)
std::vector< std::string > _tol_names
tolerance vectors
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...
Every object that can be built by the factory should be derived from this class.
std::vector< std::string > _functor_symbols
const MooseObject *const _derived_object
Pointer to the MooseObject (to call paramError)
std::vector< MooseFunctorName > _functor_names
Functor vectors (names, count, and symbols)
std::vector< Real > _tol_values