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 125 template <
typename T>
128 return declareGenericPropertyByName<T, false>(prop_name);
130 template <
typename T>
132 template <
typename T>
135 return declareGenericPropertyByName<T, true>(prop_name);
137 template <
typename T>
140 template <
typename T,
bool is_ad>
144 return declareADProperty<T>(prop_name);
146 return declareProperty<T>(prop_name);
148 template <
typename T,
bool is_ad>
156 template <
typename T,
bool is_ad>
159 template <
typename T,
bool is_ad>
166 template <
typename T,
bool is_ad>
170 template <
typename T,
typename... Ts>
173 return getGenericZeroMaterialProperty<T, false>(args...);
177 template <
typename T,
typename... Ts>
180 return getGenericZeroMaterialPropertyByName<T, false>(args...);
245 template <
typename Consumers>
246 static std::deque<MaterialBase *>
248 const std::vector<std::shared_ptr<MaterialBase>> & mats,
249 const bool allow_stateful);
304 virtual const QBase &
qRule()
const = 0;
364 void registerPropName(
const std::string & prop_name,
bool is_get,
const unsigned int state);
418 template <
typename T>
423 std::string prop_name =
name;
427 return declarePropertyByName<T>(prop_name);
430 template <
typename T,
bool is_ad>
434 const auto prop_name_modified =
446 template <
typename T,
bool is_ad>
451 std::string prop_name =
name;
455 return getGenericZeroMaterialPropertyByName<T, is_ad>(prop_name);
458 template <
typename T,
bool is_ad>
471 for (std::set<SubdomainID>::const_iterator it =
blockIDs().begin(); it !=
blockIDs().end(); ++it)
480 if (nqp > preload_with_zero.size())
481 preload_with_zero.resize(nqp);
482 for (
unsigned int qp = 0; qp < nqp; ++qp)
485 return preload_with_zero;
488 template <
typename T,
bool is_ad>
498 if (nqp >
zero.size())
502 for (
unsigned int qp = 0; qp < nqp; ++qp)
508 template <
typename T>
513 std::string prop_name =
name;
517 return declareADPropertyByName<T>(prop_name);
520 template <
typename Consumers>
521 std::deque<MaterialBase *>
523 const std::vector<std::shared_ptr<MaterialBase>> & mats,
524 const bool allow_stateful)
526 std::deque<MaterialBase *> required_mats;
528 std::unordered_set<unsigned int> needed_mat_props;
529 for (
const auto & consumer : mat_consumers)
531 const auto & mp_deps = consumer->getMatPropDependencies();
532 needed_mat_props.insert(mp_deps.begin(), mp_deps.end());
540 for (
auto it = mats.rbegin(); it != mats.rend(); ++it)
542 auto *
const mat = it->get();
543 bool supplies_needed =
false;
545 const auto & supplied_props = mat->getSuppliedPropIDs();
548 for (
const auto supplied_prop : supplied_props)
550 if (needed_mat_props.count(supplied_prop))
552 supplies_needed =
true;
557 if (!supplies_needed)
560 if (!allow_stateful && mat->hasStatefulProperties())
562 "Someone called buildRequiredMaterials with allow_stateful = false but a material " 565 " computes stateful properties.");
567 const auto & mp_deps = mat->getMatPropDependencies();
568 needed_mat_props.insert(mp_deps.begin(), mp_deps.end());
569 required_mats.push_front(mat);
572 return required_mats;
Interface for objects that need parallel consistent random numbers without patterns over the course o...
const MaterialPropertyName _declare_suffix
Suffix to append to the name of the material property/ies when declaring it/them. ...
virtual bool ghostable() const
Whether this material supports ghosted computations.
std::string join(Iterator begin, Iterator end, const std::string &delimiter)
Python-like join function for strings over an iterator range.
void mooseSetToZero(T &v)
Helper function templates to set a variable to zero.
FEProblemBase & _fe_problem
A class for creating restricted objects.
virtual void computeQpProperties()
Users must override this method.
MaterialProperty< T > & declareProperty(const std::string &name)
MaterialBase(const InputParameters ¶meters)
virtual FEProblemBase & miProblem()
Keeps track of stuff related to assembling.
static InputParameters validParams()
void setFaceInfo(const FaceInfo &fi)
bool _has_stateful_property
bool hasStatefulProperties() const
MaterialProperty< T > & declarePropertyByName(const std::string &prop_name)
Declare the property named "name".
virtual void resetProperties()
Resets the properties at each quadrature point (see resetQpProperties), only called if 'compute = fal...
const Moose::CoordinateSystemType & _coord_sys
Coordinate system.
A class to provide an common interface to objects requiring "outputs" option.
auto & declareGenericProperty(const std::string &prop_name)
/class BoundaryRestrictable /brief Provides functionality for limiting the object to certain boundary...
std::set< OutputName > getOutputs()
Get the list of output objects that this class is restricted.
const MaterialProperty< T > & getZeroMaterialPropertyByName(Ts... args)
for backwards compatibility
virtual const std::set< std::string > & getRequestedItems() override
Return a set of properties accessed with getMaterialProperty.
virtual void initQpStatefulProperties()
Initialize stateful properties at quadrature points.
virtual void subdomainSetup() override
Subdomain setup evaluating material properties when required.
virtual const std::unordered_set< unsigned int > & getMatPropDependencies() const =0
Retrieve the set of material properties that this object depends on.
virtual const std::set< SubdomainID > & blockIDs() const
Return the block subdomain ids for this object Note, if this is not block restricted, this function returns all mesh subdomain ids.
virtual const QBase & qRule() const =0
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual const std::string & name() const
Get the name of the class.
virtual void computeProperties()=0
Performs the quadrature point loop, calling computeQpProperties.
void checkStatefulSanity() const
An interface for accessing Moose::Functors for systems that care about automatic differentiation, e.g.
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 void resetQpProperties()
Resets the properties prior to calculation of traditional materials (only if 'compute = false')...
ADMaterialProperty< T > & declareADPropertyByName(const std::string &prop_name)
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...
An interface that allows the marking of invalid solutions during a solve.
Interface for objects that needs transient capabilities.
const FaceInfo * _face_info
This data structure is used to store geometric and variable related metadata about each cell face in ...
virtual const std::set< std::string > & getSuppliedItems() override
Return a set of properties accessed with declareProperty.
virtual const FEProblemBase & miProblem() const
FunctorMaterials compute functor material properties.
std::set< std::string > _requested_props
Set of properties accessed via get method.
unsigned int getMaxQps() const
Interface for notifications that the mesh has changed.
const bool _compute
If False MOOSE does not compute this property.
Every object that can be built by the factory should be derived from this class.
void checkExecutionStage()
Check and throw an error if the execution has progressed past the construction stage.
boundary_id_type BoundaryID
Interface for objects that need to use distributions.
typename GenericMaterialPropertyStruct< T, is_ad >::type GenericMaterialProperty
std::unordered_set< unsigned int > _active_prop_ids
The ids of the current active supplied properties.
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
std::set< unsigned int > _supplied_prop_ids
The ids of the supplied properties, i.e.
bool forceStatefulInit() const
Interface for objects that need to use UserObjects.
virtual void initStatefulProperties(unsigned int n_points)
Initialize stateful properties (if material has some)
bool _overrides_init_stateful_props
const bool _force_stateful_init
Whether or not to force stateful init; see forceStatefulInit()
void setActiveProperties(const std::unordered_set< unsigned int > &needed_props)
Set active properties of this material Note: This function is called by FEProblemBase::setActiveMater...
static constexpr PropertyValue::id_type zero_property_id
The material property ID for a zero property.
std::vector< unsigned int > _displacements
Generic class for solving transient nonlinear problems.
void markMatPropRequested(const std::string &name)
Helper method for adding a material property name to the material property requested set...
const MooseArray< Point > & _normals
normals at quadrature points (valid only in boundary materials)
ADMaterialProperty< T > & declareADProperty(const std::string &name)
const GenericMaterialProperty< T, is_ad > & getGenericZeroMaterialPropertyByName(const std::string &prop_name)
GenericMaterialProperty< T, is_ad > & getProperty(const std::string &prop_name, const unsigned int state, const MooseObject &requestor)
Retrieves a material property.
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 GenericMaterialProperty< T, is_ad > & getGenericZeroMaterialProperty()
Return a constant zero anonymous material property.
An interface that restricts an object to subdomains via the 'blocks' input parameter.
bool isPropertyActive(const unsigned int prop_id) const
Check whether a material property is active.
Interface for sorting dependent vectors of objects.
Interface for objects that needs scalar coupling capabilities.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
const InputParameters & _pars
Parameters of this object, references the InputParameters stored in the InputParametersWarehouse.
const InputParameters & parameters() const
Get the parameters of the object.
Proxy for accessing MaterialPropertyStorage.
void registerPropName(const std::string &prop_name, bool is_get, const unsigned int state)
Small helper function to call store{Subdomain,Boundary}MatPropName.
virtual void computePropertiesAtQp(unsigned int qp)
A method for (re)computing the properties of a MaterialBase.
std::set< std::string > _supplied_props
Set of properties declared.
GenericMaterialProperty< T, is_ad > & declareGenericPropertyByName(const std::string &prop_name)
const MaterialProperty< T > & getZeroMaterialProperty(Ts... args)
for backwards compatibility
const MooseArray< Real > & _coord
virtual const std::set< BoundaryID > & boundaryIDs() const
Return the boundary IDs for this object.
virtual const MaterialData & materialData() const =0
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...
MaterialBases compute MaterialProperties.
Interface for objects that need to use functions.
virtual bool isBoundaryMaterial() const =0
Returns true of the MaterialData type is not associated with volume data.
const std::set< unsigned int > & getSuppliedPropIDs()
Get the prop ids corresponding to declareProperty.
GenericMaterialProperty< T, is_ad > & declareProperty(const std::string &prop_name, const MooseObject &requestor)
Declares a material property.
Interface class for classes which interact with Postprocessors.
virtual bool isInterfaceMaterial()