Proxy for accessing MaterialPropertyStorage. More...
#include <MaterialData.h>
Classes | |
class | XFEMKey |
Key that provides access to only the XFEM class. More... | |
Public Member Functions | |
MaterialData (MaterialPropertyStorage &storage, const THREAD_ID tid) | |
void | resize (unsigned int n_qpoints) |
Resize the data to hold properties for n_qpoints quadrature points. More... | |
unsigned int | nQPoints () const |
Returns the number of quadrature points the material properties support/hold. More... | |
void | copy (const Elem &elem_to, const Elem &elem_from, unsigned int side) |
copy material properties from one element to another More... | |
void | swap (const Elem &elem, unsigned int side=0) |
material properties for given element (and possible side) More... | |
template<typename MatContainer > | |
void | reinit (const MatContainer &mats) |
Reinit material properties for given element (and possible side) More... | |
void | reset (const std::vector< std::shared_ptr< MaterialBase >> &mats) |
Calls the reset method of Materials to ensure that they are in a proper state. More... | |
void | swapBack (const Elem &elem, unsigned int side=0) |
material properties for given element (and possible side) More... | |
const MaterialProperties & | props (const unsigned int state=0) const |
MaterialProperties & | props (const unsigned int state=0) |
template<typename T , bool is_ad> | |
bool | haveGenericProperty (const std::string &prop_name) const |
template<typename T > | |
bool | haveProperty (const std::string &prop_name) const |
Returns true if the regular material property exists - defined by any material. More... | |
template<typename T > | |
bool | haveADProperty (const std::string &prop_name) const |
Returns true if the AD material property exists - defined by any material. More... | |
template<typename T , bool is_ad = false> | |
GenericMaterialProperty< T, is_ad > & | getProperty (const std::string &prop_name, const unsigned int state, const MooseObject &requestor) |
Retrieves a material property. More... | |
template<typename T , bool is_ad> | |
GenericMaterialProperty< T, is_ad > & | declareProperty (const std::string &prop_name, const MooseObject &requestor) |
Declares a material property. More... | |
bool | isSwapped () const |
Returns true if the stateful material is in a swapped state. More... | |
const MaterialPropertyStorage & | getMaterialPropertyStorage () const |
Provide read-only access to the underlying MaterialPropertyStorage object. More... | |
MaterialPropertyStorage & | getMaterialPropertyStorageForXFEM (const XFEMKey) |
Provide write-only access to the underlying MaterialPropertyStorage object JUST FOR XFEM. More... | |
bool | hasProperty (const std::string &prop_name) const |
unsigned int | getPropertyId (const std::string &prop_name) const |
Wrapper for MaterialStorage::getPropertyId. More... | |
void | onlyResizeIfSmaller (bool flag) |
Set _resize_only_if_smaller to perform a non-destructive resize. More... | |
bool | isOnlyResizeIfSmaller () const |
Check value of _resize_only_if_smaller. More... | |
void | eraseProperty (const Elem *elem) |
Remove the property storage and element pointer from MaterialPropertyStorage data structures Use this when elements are deleted so we don't end up with invalid elem pointers (for e.g. More... | |
Static Public Attributes | |
static constexpr unsigned int | max_state = 2 |
The max time state supported (2 = older) More... | |
Private Member Functions | |
unsigned int | addPropertyHelper (const std::string &prop_name, const std::type_info &type, const unsigned int state, const MaterialBase *const declarer) |
template<typename T , bool is_ad, bool declare> | |
GenericMaterialProperty< T, is_ad > & | getPropertyHelper (const std::string &prop_name, const unsigned int state, const MooseObject &requestor) |
const MaterialBase & | castRequestorToDeclarer (const MooseObject &requestor) const |
Helper for casting requestor to a MaterialBase in addPropertyHelper() (templated) More... | |
unsigned int | getMaxStateRequested (const unsigned int prop_id) const |
maximum state id requested for a property More... | |
Static Private Member Functions | |
static void | mooseErrorHelper (const MooseObject &object, const std::string_view &error) |
Private Attributes | |
MaterialPropertyStorage & | _storage |
Reference to the MaterialStorage class. More... | |
const THREAD_ID | _tid |
The thread id. More... | |
unsigned int | _n_qpoints |
Number of quadrature points. More... | |
std::array< MaterialProperties, max_state+1 > | _props |
The underlying property data. More... | |
bool | _swapped |
Status of storage swapping (calling swap sets this to true; swapBack sets it to false) More... | |
bool | _resize_only_if_smaller |
Use non-destructive resize of material data (calling resize() will not reduce size). More... | |
Proxy for accessing MaterialPropertyStorage.
MaterialData stores the values associated with a particular material object
Definition at line 33 of file MaterialData.h.
MaterialData::MaterialData | ( | MaterialPropertyStorage & | storage, |
const THREAD_ID | tid | ||
) |
Definition at line 15 of file MaterialData.C.
|
private |
Definition at line 92 of file MaterialData.C.
Referenced by getPropertyHelper().
|
private |
Helper for casting requestor
to a MaterialBase in addPropertyHelper() (templated)
Definition at line 101 of file MaterialData.C.
Referenced by getPropertyHelper().
copy material properties from one element to another
Definition at line 35 of file MaterialData.C.
|
inline |
Declares a material property.
T | The type of the property |
is_ad | Whether or not the property is AD |
prop_name | The name of the property |
requestor | The MooseObject declaring the property |
Definition at line 126 of file MaterialData.h.
Referenced by MaterialBase::declareGenericPropertyByName().
void MaterialData::eraseProperty | ( | const Elem * | elem | ) |
Remove the property storage and element pointer from MaterialPropertyStorage data structures Use this when elements are deleted so we don't end up with invalid elem pointers (for e.g.
stateful properties) hanging around in our data structures
Definition at line 86 of file MaterialData.C.
|
inline |
Provide read-only access to the underlying MaterialPropertyStorage object.
Definition at line 140 of file MaterialData.h.
|
inline |
Provide write-only access to the underlying MaterialPropertyStorage object JUST FOR XFEM.
This should be removed. To be clear - you should not ever expect to have write access to this data. It just turned out that XFEM got away with it when we were storing things as pointers instead of smart pointers...
These dirty reasons are why this method is named so egregiously.
Definition at line 161 of file MaterialData.h.
maximum state id requested for a property
Definition at line 109 of file MaterialData.C.
Referenced by getPropertyHelper().
|
inline |
Retrieves a material property.
T | The type of the property |
is_ad | Whether or not the property is AD |
prop_name | The name of the property |
state | The time state (0 = current, 1 = old, etc; defaults to 0) |
requestor | The MooseObject requesting the property |
Definition at line 111 of file MaterialData.h.
Referenced by MaterialPropertyInterface::getBlockMaterialProperty(), MaterialPropertyInterface::getGenericMaterialPropertyByName(), and MaterialBase::getGenericZeroMaterialPropertyByName().
|
private |
Definition at line 269 of file MaterialData.h.
unsigned int MaterialData::getPropertyId | ( | const std::string & | prop_name | ) | const |
Wrapper for MaterialStorage::getPropertyId.
Allows classes with a MaterialData object (i.e. MaterialPropertyInterface) to access material property IDs.
prop_name | The name of the material property |
Definition at line 80 of file MaterialData.C.
Referenced by MaterialPropertyInterface::getBlockMaterialProperty(), MaterialPropertyInterface::getGenericMaterialPropertyByName(), haveGenericProperty(), and MaterialBase::registerPropName().
bool MaterialData::hasProperty | ( | const std::string & | prop_name | ) | const |
name
Definition at line 74 of file MaterialData.C.
Referenced by haveGenericProperty().
|
inline |
Returns true if the AD material property exists - defined by any material.
Definition at line 96 of file MaterialData.h.
Referenced by MaterialPropertyInterface::hasADMaterialPropertyByName(), and MaterialOutputAction::hasADProperty().
|
inline |
Definition at line 253 of file MaterialData.h.
Referenced by BlockRestrictable::hasBlockMaterialProperty(), and BoundaryRestrictable::hasBoundaryMaterialProperty().
|
inline |
Returns true if the regular material property exists - defined by any material.
Definition at line 89 of file MaterialData.h.
Referenced by MaterialPropertyInterface::hasMaterialPropertyByName(), and MaterialOutputAction::hasProperty().
|
inline |
Check value of _resize_only_if_smaller.
Definition at line 187 of file MaterialData.h.
|
inline |
Returns true if the stateful material is in a swapped state.
Definition at line 135 of file MaterialData.h.
Referenced by swap(), and swapBack().
|
staticprivate |
Definition at line 68 of file MaterialData.C.
Referenced by getPropertyHelper().
|
inline |
Returns the number of quadrature points the material properties support/hold.
Definition at line 50 of file MaterialData.h.
Referenced by copy(), and resize().
|
inline |
Set _resize_only_if_smaller to perform a non-destructive resize.
Setting this flag to true means that resize(n) will not decrease the size of _props if n is smaller than the size of the material data object.
Definition at line 182 of file MaterialData.h.
|
inline |
state
(defaults to zero).This should NEVER be used to modify the size of these objects.{
Definition at line 238 of file MaterialData.h.
Referenced by Material::computeProperties(), getPropertyHelper(), haveGenericProperty(), resize(), and Material::subdomainSetup().
|
inline |
Definition at line 245 of file MaterialData.h.
void MaterialData::reinit | ( | const MatContainer & | mats | ) |
Reinit material properties for given element (and possible side)
mats | The material objects for which to compute properties |
execute_stateful | Whether to execute material objects that have stateful properties. This should be false when for example executing material objects for mortar contexts in which stateful properties don't make sense |
Definition at line 326 of file MaterialData.h.
void MaterialData::reset | ( | const std::vector< std::shared_ptr< MaterialBase >> & | mats | ) |
Calls the reset method of Materials to ensure that they are in a proper state.
Definition at line 51 of file MaterialData.C.
Resize the data to hold properties for n_qpoints quadrature points.
Definition at line 21 of file MaterialData.C.
Referenced by ComputeMaterialsObjectThread::onBoundary(), ComputeMaterialsObjectThread::onInterface(), ComputeMaterialsObjectThread::onInternalSide(), MaterialPropertyStorage::prolongStatefulProps(), FEProblemBase::reinitMaterials(), FEProblemBase::reinitMaterialsBoundary(), FEProblemBase::reinitMaterialsFace(), FEProblemBase::reinitMaterialsInterface(), FEProblemBase::reinitMaterialsNeighbor(), FEProblemBase::resizeMaterialData(), and MaterialPropertyStorage::updateStatefulPropsForPRefinement().
material properties for given element (and possible side)
Definition at line 41 of file MaterialData.C.
material properties for given element (and possible side)
Definition at line 58 of file MaterialData.C.
Referenced by FEProblemBase::swapBackMaterials(), FEProblemBase::swapBackMaterialsFace(), and FEProblemBase::swapBackMaterialsNeighbor().
|
private |
Number of quadrature points.
Definition at line 204 of file MaterialData.h.
Referenced by nQPoints(), and resize().
|
private |
|
private |
Use non-destructive resize of material data (calling resize() will not reduce size).
Default is false (normal resize behaviour)
Definition at line 231 of file MaterialData.h.
Referenced by isOnlyResizeIfSmaller(), onlyResizeIfSmaller(), and resize().
|
private |
Reference to the MaterialStorage class.
Definition at line 198 of file MaterialData.h.
Referenced by addPropertyHelper(), copy(), eraseProperty(), getMaterialPropertyStorage(), getMaterialPropertyStorageForXFEM(), getMaxStateRequested(), getPropertyId(), hasProperty(), resize(), swap(), and swapBack().
|
private |
Status of storage swapping (calling swap sets this to true; swapBack sets it to false)
Definition at line 227 of file MaterialData.h.
Referenced by isSwapped(), swap(), and swapBack().
|
private |
The thread id.
Definition at line 201 of file MaterialData.h.
Referenced by copy(), swap(), and swapBack().
|
static |
The max time state supported (2 = older)
Definition at line 39 of file MaterialData.h.
Referenced by MaterialPropertyStorage::addProperty().