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;
std::unordered_map< SubdomainID, Real > _sub_id_to_prop
static InputParameters validParams()
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
virtual void computeQpProperties() override
Users must override this method.
registerMooseObject("MooseApp", PiecewiseConstantByBlockMaterial)
Materials compute MaterialProperties.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
PiecewiseConstantByBlockMaterialTempl(const InputParameters ¶meters)
static InputParameters validParams()
SubdomainID getSubdomainID(const SubdomainName &subdomain_name) const
Get the associated subdomain ID for the subdomain name.