20 params.addClassDescription(
"Computes a property value on a per-subdomain basis");
22 params.template addRequiredParam<MaterialPropertyName>(
"prop_name",
23 "The name of the property to declare");
24 params.template addRequiredParam<std::map<std::string, Real>>(
25 "subdomain_to_prop_value",
"Map from subdomain to property value");
32 :
Material(params), _prop(declareGenericProperty<Real, is_ad>(
"prop_name"))
34 for (
const auto & map_pr : getParam<std::map<std::string, Real>>(
"subdomain_to_prop_value"))
42 mooseAssert(_current_elem,
43 "We should be on a block which means we should definitely have a current element");
44 auto it = _sub_id_to_prop.find(_current_elem->subdomain_id());
45 mooseAssert(it != _sub_id_to_prop.end(),
46 "Block restriction must match the subdomain names passed in the "
47 "subdomain_to_prop_value parameter");
48 _prop[_qp] = it->second;
registerMooseObject("MooseApp", PiecewiseConstantByBlockMaterial)
Materials compute MaterialProperties.
static InputParameters validParams()
SubdomainID getSubdomainID(const SubdomainName &subdomain_name) const
Get the associated subdomain ID for the subdomain name.
std::unordered_map< SubdomainID, Real > _sub_id_to_prop
PiecewiseConstantByBlockMaterialTempl(const InputParameters ¶meters)
virtual void computeQpProperties() override
Users must override this method.
static InputParameters validParams()