18 params.addParam<std::vector<std::string>>(
21 "List of material properties that should be defined on this ActionComponent");
22 params.addParam<std::vector<MooseFunctorName>>(
25 "Functors that provide the values of the material property on this ActionComponent");
28 params.addParam<
bool>(
"use_ad_for_properties",
30 "Whether to use automatic differentiation for the properties defined");
31 params.addParam<
bool>(
"define_material_properties",
33 "If true, define material properties from the values provided");
34 params.addParam<
bool>(
"define_functor_properties",
36 "If true, define functor properties from the values provided");
38 params.addParamNamesToGroup(
"property_names property_values use_ad_for_properties " 39 "define_material_properties define_functor_properties",
40 "Material and Functor Property");
47 _property_names(getParam<
std::vector<
std::string>>(
"property_names")),
48 _property_functors(getParam<
std::vector<MooseFunctorName>>(
"property_values")),
49 _use_ad_for_props(getParam<bool>(
"use_ad_for_properties"))
53 paramError(
"property_names",
"Should be the same size as property functors");
59 if (getParam<bool>(
"define_material_properties") &&
_property_names.size())
65 params.
set<std::vector<SubdomainName>>(
"block") =
_blocks;
68 std::vector<MaterialPropertyName> property_names(
_property_names.size());
71 property_names.begin(),
72 [](
const std::string & val) {
return MaterialPropertyName(val); });
74 params.
set<std::vector<MaterialPropertyName>>(
"ad_props_out") = property_names;
76 params.
set<std::vector<MaterialPropertyName>>(
"reg_props_out") = property_names;
79 "MaterialFunctorConverter",
name() +
"_local_material_properties", params);
84 if (getParam<bool>(
"define_functor_properties") &&
_property_names.size())
89 const auto mat_type =
_use_ad_for_props ?
"ADGenericFunctorMaterial" :
"GenericFunctorMaterial";
91 params.
set<std::vector<SubdomainName>>(
"block") =
_blocks;
106 const MooseFunctorName &
108 const std::string & requestor_name)
const 115 "' was requested on Component '",
bool hasProperty(const std::string &property_name) const
Whether the component has a property with that name.
virtual void addMaterial(const std::string &material_name, const std::string &name, InputParameters ¶meters)
InputParameters getValidParams(const std::string &name) const
Get valid parameters for the object.
const std::vector< std::string > _property_names
Names of the material properties.
Base class for components that are defined using an action.
virtual const std::string & name() const
Get the name of the class.
static InputParameters validParams()
FEProblemBase & getProblem()
Get problem from action warehouse.
std::vector< SubdomainName > _blocks
Names of the blocks the component is comprised of.
const MooseFunctorName & getPropertyValue(const std::string &property_name, const std::string &requestor_name) const
Return the name of the functor for that property.
ComponentMaterialPropertyInterface(const InputParameters ¶ms)
const std::vector< MooseFunctorName > _property_functors
Functor values of the material properties.
Factory & getFactory() const
Get the factory to build (often physics-related but not always) objects (for example a Positions) ...
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 ...
void addRequiredTask(const std::string &task)
Add a new required task for all physics deriving from this class NOTE: This does not register the tas...
virtual void addMaterials() override
Used to add materials or functor materials on a component.
const bool _use_ad_for_props
Whether to use automatic differentiation when defining properties.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
static InputParameters validParams()
auto index_range(const T &sizable)