40#define usingMaterialBaseMembers \
41 usingMooseObjectMembers; \
42 usingTransientInterfaceMembers; \
43 using MaterialBase::_subproblem; \
44 using MaterialBase::_fe_problem; \
45 using MaterialBase::_tid; \
46 using MaterialBase::_assembly; \
47 using MaterialBase::_qp; \
48 using MaterialBase::_coord; \
49 using MaterialBase::_normals; \
50 using MaterialBase::_mesh
88#ifdef MOOSE_KOKKOS_ENABLED
131 template <
typename T>
134 return declareGenericPropertyByName<T, false>(prop_name);
136 template <
typename T>
138 template <
typename T>
141 return declareGenericPropertyByName<T, true>(prop_name);
143 template <
typename T>
146 template <
typename T,
bool is_ad>
150 return declareADProperty<T>(prop_name);
152 return declareProperty<T>(prop_name);
154 template <
typename T,
bool is_ad>
162 template <
typename T,
bool is_ad>
165 template <
typename T,
bool is_ad>
172 template <
typename T,
bool is_ad>
176 template <
typename T,
typename... Ts>
179 return getGenericZeroMaterialProperty<T, false>(args...);
183 template <
typename T,
typename... Ts>
186 return getGenericZeroMaterialPropertyByName<T, false>(args...);
256 template <
typename Consumers>
257 static std::deque<MaterialBase *>
259 const std::vector<std::shared_ptr<MaterialBase>> & mats,
260 const bool allow_stateful);
320 virtual const QBase &
qRule()
const = 0;
380 void registerPropName(
const std::string & prop_name,
bool is_get,
const unsigned int state);
439 std::string prop_name =
name;
443 return declarePropertyByName<T>(prop_name);
446template <
typename T,
bool is_ad>
450 const auto prop_name_modified =
453 : MooseUtils::join(std::vector<std::string>({prop_name,
_declare_suffix}),
"_");
462template <
typename T,
bool is_ad>
467 std::string prop_name =
name;
471 return getGenericZeroMaterialPropertyByName<T, is_ad>(prop_name);
474template <
typename T,
bool is_ad>
487 for (std::set<SubdomainID>::const_iterator it =
blockIDs().begin(); it !=
blockIDs().end(); ++it)
496 if (nqp > preload_with_zero.size())
497 preload_with_zero.resize(nqp);
498 for (
unsigned int qp = 0; qp < nqp; ++qp)
501 return preload_with_zero;
504template <
typename T,
bool is_ad>
514 if (nqp > zero.size())
518 for (
unsigned int qp = 0; qp < nqp; ++qp)
529 std::string prop_name =
name;
533 return declareADPropertyByName<T>(prop_name);
536template <
typename Consumers>
537std::deque<MaterialBase *>
539 const std::vector<std::shared_ptr<MaterialBase>> & mats,
540 const bool allow_stateful)
542 std::deque<MaterialBase *> required_mats;
544 std::unordered_set<unsigned int> needed_mat_props;
545 for (
const auto & consumer : mat_consumers)
547 const auto & mp_deps = consumer->getMatPropDependencies();
548 needed_mat_props.insert(mp_deps.begin(), mp_deps.end());
556 for (
auto it = mats.rbegin(); it != mats.rend(); ++it)
558 auto *
const mat = it->get();
559 bool supplies_needed =
false;
561 const auto & supplied_props = mat->getSuppliedPropIDs();
564 for (
const auto supplied_prop : supplied_props)
566 if (needed_mat_props.count(supplied_prop))
568 supplies_needed =
true;
573 if (!supplies_needed)
576 if (!allow_stateful && mat->hasStatefulProperties())
578 "Someone called buildRequiredMaterials with allow_stateful = false but a material "
581 " computes stateful properties.");
583 const auto & mp_deps = mat->getMatPropDependencies();
584 needed_mat_props.insert(mp_deps.begin(), mp_deps.end());
585 required_mats.push_front(mat);
588 return required_mats;
boundary_id_type BoundaryID
typename GenericMaterialPropertyStruct< T, is_ad >::type GenericMaterialProperty
An interface for accessing Moose::Functors for systems that care about automatic differentiation,...
Keeps track of stuff related to assembling.
An interface that restricts an object to subdomains via the 'blocks' input parameter.
virtual const std::set< SubdomainID > & blockIDs() const
Return the block subdomain ids for this object Note, if this is not block restricted,...
/class BoundaryRestrictable /brief Provides functionality for limiting the object to certain boundary...
virtual const std::set< BoundaryID > & boundaryIDs() const
Return the boundary IDs for this object.
Interface for sorting dependent vectors of objects.
Interface for objects that need to use distributions.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
This data structure is used to store geometric and variable related metadata about each cell face in ...
Interface for objects that need to use functions.
FunctorMaterials compute functor material properties.
MaterialBases compute MaterialProperties.
const Moose::CoordinateSystemType & _coord_sys
Coordinate system.
const MooseArray< Point > & _normals
normals at quadrature points (valid only in boundary materials)
const MooseArray< Real > & _coord
bool forceStatefulInit() const
virtual MaterialData & materialData()=0
virtual void computeProperties()=0
Performs the quadrature point loop, calling computeQpProperties.
unsigned int getMaxQps() const
virtual void computeQpProperties()
Users must override this method.
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.
const MaterialProperty< T > & getZeroMaterialProperty(Ts... args)
for backwards compatibility
virtual void initStatefulProperties(const unsigned int n_points)
Initialize stateful properties (if material has some)
bool isPropertyActive(const unsigned int prop_id) const
Check whether a material property is active.
GenericMaterialProperty< T, is_ad > & declareGenericPropertyByName(const std::string &prop_name)
virtual bool isInterfaceMaterial()
bool hasActiveProperties()
Whether this material has active properties.
ADMaterialProperty< T > & declareADPropertyByName(const std::string &prop_name)
const MaterialProperty< T > & getZeroMaterialPropertyByName(Ts... args)
for backwards compatibility
virtual const std::set< std::string > & getSuppliedItems() override
Return a set of properties accessed with declareProperty.
void markMatPropRequested(const std::string &name)
Helper method for adding a material property name to the material property requested set.
void checkStatefulSanity() const
std::set< unsigned int > _supplied_prop_ids
The ids of the supplied properties, i.e.
virtual const FEProblemBase & miProblem() const
virtual Moose::MaterialDataType materialDataType()=0
void checkExecutionStage()
Check and throw an error if the execution has progressed past the construction stage.
virtual FEProblemBase & miProblem()
virtual void initQpStatefulProperties()
Initialize stateful properties at quadrature points.
auto & declareGenericProperty(const std::string &prop_name)
const MaterialPropertyName _declare_suffix
Suffix to append to the name of the material property/ies when declaring it/them.
void storeSubdomainZeroMatProp(SubdomainID block_id, const MaterialPropertyName &name)
Adds to a map based on block ids of material properties for which a zero value can be returned.
FEProblemBase & _fe_problem
virtual const MaterialData & materialData() const =0
virtual void resetProperties()
Resets the properties at each quadrature point (see resetQpProperties), only called if 'compute = fal...
void setActiveProperties(const std::unordered_set< unsigned int > &needed_props)
Set active properties of this material Note: This function is called by FEProblemBase::setActiveMater...
const std::set< unsigned int > & getSuppliedPropIDs() const
Get the prop ids corresponding to declareProperty.
bool hasRestoredProperties() const
virtual const std::set< std::string > & getRequestedItems() override
Return a set of properties accessed with getMaterialProperty.
const GenericMaterialProperty< T, is_ad > & getGenericZeroMaterialProperty()
Return a constant zero anonymous material property.
std::set< OutputName > getOutputs()
Get the list of output objects that this class is restricted.
virtual const std::unordered_set< unsigned int > & getMatPropDependencies() const =0
Retrieve the set of material properties that this object depends on.
std::set< std::string > _requested_props
Set of properties accessed via get method.
MaterialProperty< T > & declarePropertyByName(const std::string &prop_name)
Declare the property named "name".
void setFaceInfo(const FaceInfo &fi)
virtual const QBase & qRule() const =0
const FaceInfo * _face_info
virtual void computePropertiesAtQp(unsigned int qp)
A method for (re)computing the properties of a MaterialBase.
const bool _compute
If False MOOSE does not compute this property.
virtual bool ghostable() const
Whether this material supports ghosted computations.
const bool _force_stateful_init
Whether or not to force stateful init; see forceStatefulInit()
MaterialProperty< T > & declareProperty(const std::string &name)
void registerPropName(const std::string &prop_name, bool is_get, const unsigned int state)
Small helper function to call store{Subdomain,Boundary}MatPropName.
static InputParameters validParams()
virtual void resetQpProperties()
Resets the properties prior to calculation of traditional materials (only if 'compute = false').
bool _overrides_init_stateful_props
ADMaterialProperty< T > & declareADProperty(const std::string &name)
bool _has_stateful_property
std::unordered_set< unsigned int > _active_prop_ids
The ids of the current active supplied properties.
std::unordered_map< unsigned int, unsigned int > _props_to_min_states
The minimum states requested (0 = current, 1 = old, 2 = older) This is sparse and is used to keep tra...
virtual bool isBoundaryMaterial() const =0
Returns true of the MaterialData type is not associated with volume data.
void storeBoundaryZeroMatProp(BoundaryID boundary_id, const MaterialPropertyName &name)
Adds to a map based on boundary ids of material properties for which a zero value can be returned.
std::vector< unsigned int > _displacements
std::set< std::string > _supplied_props
Set of properties declared.
const GenericMaterialProperty< T, is_ad > & getGenericZeroMaterialPropertyByName(const std::string &prop_name)
virtual void subdomainSetup() override
Subdomain setup evaluating material properties when required.
bool hasStatefulProperties() const
Proxy for accessing MaterialPropertyStorage.
GenericMaterialProperty< T, is_ad > & declareProperty(const std::string &prop_name, const MooseObject &requestor)
Declares a material property.
GenericMaterialProperty< T, is_ad > & getProperty(const std::string &prop_name, const unsigned int state, const MooseObject &requestor)
Retrieves a material property.
static constexpr PropertyValue::id_type zero_property_id
The material property ID for a zero property.
Interface for notifications that the mesh has changed.
const InputParameters & parameters() const
Get the parameters of the object.
const std::string & name() const
Get the name of the class.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
const InputParameters & _pars
The object's parameters.
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Every object that can be built by the factory should be derived from this class.
A class to provide an common interface to objects requiring "outputs" option.
Interface class for classes which interact with Postprocessors.
Interface for objects that need parallel consistent random numbers without patterns over the course o...
A class for creating restricted objects.
Interface for objects that needs scalar coupling capabilities.
Generic class for solving transient nonlinear problems.
Interface for objects that needs transient capabilities.
Interface for objects that need to use UserObjects.
void mooseSetToZero(T &v)
Helper function templates to set a variable to zero.
MaterialDataType
MaterialData types.