24 "_material_data_type");
25 params.
addParam<MaterialPropertyName>(
"prop_getter_suffix",
27 "An optional suffix parameter that can be appended to any " 28 "attempt to retrieve/get material properties. The suffix " 29 "will be prepended with a '_' character.");
31 "use_interpolated_state",
33 "For the old and older state use projected material properties interpolated at the " 34 "quadrature points. To set up projection use the ProjectedStatefulMaterialStorageAction.");
36 "Material property retrieval");
54 const std::set<SubdomainID> & block_ids,
55 const std::set<BoundaryID> & boundary_ids)
56 : _mi_moose_object(*moose_object),
57 _mi_params(_mi_moose_object.parameters()),
58 _mi_name(_mi_params.
get<
std::string>(
"_object_name")),
59 _mi_moose_object_name(_mi_params.
get<
std::string>(
"_moose_base"), _mi_name,
"::"),
60 _mi_feproblem(*_mi_params.getCheckedPointerParam<
FEProblemBase *>(
"_fe_problem_base")),
61 _mi_subproblem(*_mi_params.getCheckedPointerParam<
SubProblem *>(
"_subproblem")),
63 _material_data_type(getMaterialDataType(boundary_ids)),
64 _material_data(_mi_feproblem.getMaterialData(_material_data_type, _mi_tid)),
65 _stateful_allowed(true),
66 _get_material_property_called(false),
67 _get_suffix(_mi_params.
get<MaterialPropertyName>(
"prop_getter_suffix")),
68 _use_interpolated_state(_mi_params.
get<bool>(
"use_interpolated_state")),
70 _mi_block_ids(block_ids),
71 _mi_boundary_ids(boundary_ids)
90 std::vector<SubdomainName>
102 std::vector<BoundaryName>
116 const std::string & prop_name)
152 std::shared_ptr<MaterialBase> discrete)
157 std::ostringstream oss;
158 oss <<
"Incompatible material and object blocks:";
161 <<
" material defined on blocks ";
162 for (
const auto & sbd_id : discrete->blockIDs())
163 oss << sbd_id <<
", ";
167 oss << block_id <<
", ";
175 std::ostringstream oss;
176 oss <<
"Incompatible material and object boundaries:";
179 <<
" material defined on boundaries ";
180 for (
const auto & bnd_id : discrete->boundaryIDs())
181 oss << bnd_id <<
", ";
184 <<
" object needs material on boundaries ";
186 oss << bnd_id <<
", ";
201 std::shared_ptr<MaterialBase> discrete =
208 std::unordered_map<SubdomainID, std::vector<MaterialBase *>>
211 std::unordered_map<SubdomainID, std::vector<MaterialBase *>> required_mats;
216 std::array<const MaterialPropertyInterface *, 1> consumers = {{
this}};
217 const auto block_required =
219 required_mats[id].insert(
220 required_mats[
id].begin(), block_required.begin(), block_required.end());
222 return required_mats;
229 mooseError(
"Material properties must be retrieved during object construction. This is a code " 237 proxy->resolve(*
this);
std::string name(const ElemQuality q)
FEProblemBase & _mi_feproblem
Reference to the FEProblemBase class.
const THREAD_ID _mi_tid
Current threaded it.
virtual void resolveOptionalProperties()
resolve all optional properties
static const std::string _interpolated_old
name suffixes for interpolated old and older properties
virtual void checkMaterialProperty(const std::string &name, const unsigned int state)
A helper method for checking material properties This method was required to avoid a compiler problem...
unsigned int getMaxQps() const
virtual std::set< BoundaryID > getMaterialPropertyBoundaryIDs(const std::string &prop_name)
Get a vector containing the block ids the material property is defined on.
const std::set< SubdomainID > & _mi_block_ids
Storage for the block ids created by BlockRestrictable.
std::vector< BoundaryName > getMaterialPropertyBoundaryNames(const std::string &name)
Retrieve the boundary namess that the material property is defined.
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
MaterialPropertyInterface(const MooseObject *moose_object, const std::set< SubdomainID > &block_ids, const std::set< BoundaryID > &boundary_ids)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
void addConsumedPropertyName(const MooseObjectName &obj_name, const std::string &prop_name)
Helper for tracking the object that is consuming a property for MaterialPropertyDebugOutput.
virtual void storeSubdomainDelayedCheckMatProp(const std::string &requestor, SubdomainID block_id, const std::string &name)
Adds to a map based on block ids of material properties to validate.
static const std::string _interpolated_older
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
MaterialDataType
MaterialData types.
std::vector< SubdomainName > getMaterialPropertyBlockNames(const std::string &name)
Retrieve the block names that the material property is defined.
const bool _mi_boundary_restricted
BoundaryRestricted flag.
std::set< BoundaryID > getMaterialPropertyBoundaryIDs(const std::string &name)
Retrieve the boundary ids that the material property is defined.
virtual void storeBoundaryDelayedCheckMatProp(const std::string &requestor, BoundaryID boundary_id, const std::string &name)
Adds to a map based on boundary ids of material properties to validate.
static InputParameters validParams()
const std::set< BoundaryID > & _mi_boundary_ids
Storage for the boundary ids created by BoundaryRestrictable.
const std::string _mi_name
The name of the object that this interface belongs to.
const MaterialWarehouse & getMaterialWarehouse() const
MaterialPropertyName getMaterialPropertyName(const std::string &name) const
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual void markMatPropRequested(const std::string &)
Helper method for adding a material property name to the _material_property_requested set...
void markMatPropRequested(const std::string &)
A proxy method for _mi_feproblem.markMatPropRequested(name)
MooseApp & getMooseApp() const
Get the MooseApp this class is associated with.
std::set< SubdomainID > getMaterialPropertyBlocks(const std::string &name)
Retrieve the block ids that the material property is defined.
static bool restricted(const std::set< BoundaryID > &ids)
Helper for determining if the object is boundary restricted.
Every object that can be built by the factory should be derived from this class.
Moose::MaterialDataType getMaterialDataType(const std::set< BoundaryID > &boundary_ids) const
virtual std::vector< SubdomainName > getMaterialPropertyBlockNames(const std::string &prop_name)
Get a vector of block id equivalences that the material property is defined on.
const InputParameters & _mi_params
Parameters of the object with this interface.
virtual std::set< SubdomainID > getMaterialPropertyBlocks(const std::string &prop_name)
Get a vector containing the block ids the material property is defined on.
MaterialBase & getMaterialByName(const std::string &name, bool no_warn=false)
void statefulPropertiesAllowed(bool)
Derived classes can declare whether or not they work with stateful material properties.
Generic class for solving transient nonlinear problems.
virtual std::vector< BoundaryName > getMaterialPropertyBoundaryNames(const std::string &prop_name)
Get a vector of block id equivalences that the material property is defined on.
std::shared_ptr< MaterialBase > getMaterial(std::string name, Moose::MaterialDataType type, const THREAD_ID tid=0, bool no_warn=false)
Return a pointer to a MaterialBase object.
static std::deque< MaterialBase * > buildRequiredMaterials(const Consumers &mat_consumers, const std::vector< std::shared_ptr< MaterialBase >> &mats, const bool allow_stateful)
Build the materials required by a set of consumer objects.
void addConsumedPropertyName(const MooseObjectName &obj_name, const std::string &prop_name)
std::vector< std::unique_ptr< OptionalMaterialPropertyProxyBase< MaterialPropertyInterface > > > _optional_property_proxies
optional material properties
void checkBlockAndBoundaryCompatibility(std::shared_ptr< MaterialBase > discrete)
Check if block and boundary restrictions of a given material are compatible with the current material...
void checkExecutionStage()
Check and throw an error if the execution has progressed past the construction stage.
const Moose::MaterialDataType _material_data_type
The type of data.
bool _stateful_allowed
True by default.
A class for storing the names of MooseObject by tag and object name.
MaterialBase & getMaterial(const std::string &name)
Return a MaterialBase reference - usable for computing directly.
bool boundaryRestricted(const std::set< BoundaryID > &boundary_ids)
MaterialBases compute MaterialProperties.
std::string paramErrorPrefix(const InputParameters ¶ms, const std::string ¶m)
Get canonical paramError prefix for param-related error/warning/info messages.
void registerInterfaceObject(T &interface)
Registers an interface object for accessing with getInterfaceObjects.
virtual bool startedInitialSetup()
Returns true if we are in or beyond the initialSetup stage.
std::unordered_map< SubdomainID, std::vector< MaterialBase * > > buildRequiredMaterials(bool allow_stateful=true)
get a map of MaterialBase pointers for all material objects that this object depends on for each bloc...
unsigned int getMaxQps() const