22 "prescribed by input parameters.");
24 "prop_names",
"The names of the properties this material will have");
26 "prop_values",
"The values associated with the named properties. ");
36 _prop_names(getParam<
std::vector<
std::string>>(
"prop_names")),
37 _prop_values(getParam<
std::vector<
std::vector<Real>>>(
"prop_values"))
41 if (num_names != num_values)
43 "Number of vector property names (" + std::to_string(num_names) +
44 ") does not match the number of vectors of property values (" +
45 std::to_string(num_values) +
")");
58 computeQpProperties();
65 for (
unsigned int i = 0; i < _num_props; i++)
67 auto & prop_out = (*_properties[i])[_qp];
68 const auto & prop_in = _prop_values[i];
69 prop_out.resize(prop_in.size());
70 for (
const auto j : index_range(prop_in))
71 prop_out[j] = prop_in[j];
78 const MaterialPropertyName & prop_name)
const
80 for (
const auto i : index_range(_prop_names))
81 if (_prop_names[i] == prop_name)
82 return _prop_values[i].size();
83 paramError(
"prop_names",
"Property '" + prop_name +
"' was not defined");
registerMooseObject("MooseApp", GenericConstantStdVectorMaterial)
Material to create constant properties with the variable-size std::vector<Real> type.
const std::vector< std::string > & _prop_names
The names of the constant vector material properties.
const std::vector< std::vector< Real > > & _prop_values
The vector values of each vector material property.
virtual void computeQpProperties() override
Users must override this method.
std::size_t _num_props
The number of constant vector material properties defined.
virtual void initQpStatefulProperties() override
Initialize stateful properties at quadrature points.
static InputParameters validParams()
std::vector< GenericMaterialProperty< std::vector< Real >, is_ad > * > _properties
A vector of pointers to the material properties.
virtual std::size_t getVectorPropertySize(const MaterialPropertyName &prop_name) const override
Return the size of the variable size vector material property that the material defines.
GenericConstantStdVectorMaterialTempl(const InputParameters ¶meters)
auto & declareGenericProperty(const std::string &prop_name)
Materials compute MaterialProperties.
static InputParameters validParams()
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 ...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Interface class to return the size of material properties that do not have a fixed size.