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 , unsigned int dimension> | |
bool | haveKokkosProperty (const std::string &prop_name) const |
Get whether a Kokkos material property exists. 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... | |
template<typename T , unsigned int dimension, unsigned int state> | |
Moose::Kokkos::MaterialProperty< T, dimension > | getKokkosProperty (const std::string &prop_name) |
Get a Kokkos material property. More... | |
template<typename T , unsigned int dimension> | |
Moose::Kokkos::MaterialProperty< T, dimension > | declareKokkosProperty (const std::string &prop_name, const std::vector< unsigned int > &dims, const MaterialBase *declarer, const bool bnd) |
Declare a Kokkos 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) |
Moose::Kokkos::MaterialPropertyBase & | addKokkosPropertyHelper (const std::string &prop_name, const std::type_info &type, const unsigned int state, std::shared_ptr< Moose::Kokkos::MaterialPropertyBase > shell) |
Helper function for adding a Kokkos material property. More... | |
Moose::Kokkos::MaterialPropertyBase & | declareKokkosPropertyHelper (const std::string &prop_name, const std::type_info &type, const MaterialBase *declarer, const std::vector< unsigned int > &dims, const bool bnd, std::shared_ptr< Moose::Kokkos::MaterialPropertyBase > shell) |
Helper function for declaring a Kokkos material property. More... | |
Moose::Kokkos::MaterialPropertyBase & | getKokkosPropertyHelper (const std::string &prop_name, const unsigned int state=0, std::shared_ptr< Moose::Kokkos::MaterialPropertyBase > shell=nullptr) const |
Helper function for getting a Kokkos material property. More... | |
bool | haveKokkosPropertyHelper (const std::string &prop_name) const |
Helper function for checking whether a Kokkos material property exists. More... | |
void | kokkosRegisterLoadStoreHelper (std::type_index type, Moose::Kokkos::PropertyStore store, Moose::Kokkos::PropertyLoad load) |
Helper function to register load/store functions of a Kokkos material property to the Kokkos material property storage. More... | |
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 37 of file MaterialData.h.
MaterialData::MaterialData | ( | MaterialPropertyStorage & | storage, |
const THREAD_ID | tid | ||
) |
Definition at line 15 of file MaterialData.C.
|
private |
Helper function for adding a Kokkos material property.
prop_name | The property name |
type | The property data type |
state | The property state |
shell | The managed pointer containing the instance of the property |
Referenced by getKokkosProperty().
|
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.
Moose::Kokkos::MaterialProperty< T, dimension > MaterialData::declareKokkosProperty | ( | const std::string & | prop_name, |
const std::vector< unsigned int > & | dims, | ||
const MaterialBase * | declarer, | ||
const bool | bnd | ||
) |
Declare a Kokkos material property.
T | The property data type |
dimension | The property dimension |
prop_name | The property name |
dims | The vector containing the size of each dimension |
declarer | The Kokkos material declaring the property |
bnd | Whether the property is a face property |
Definition at line 495 of file MaterialData.h.
Referenced by Moose::Kokkos::MaterialBase::declareKokkosPropertyByName().
|
private |
Helper function for declaring a Kokkos material property.
prop_name | The property name |
type | The property data type |
declarer | The Kokkos material declaring the property |
dims | The vector containing the size of each dimension |
bnd | Whether the property is a face property |
shell | The managed pointer containing the instance of the property |
Referenced by declareKokkosProperty().
|
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 142 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.
Moose::Kokkos::MaterialProperty< T, dimension > MaterialData::getKokkosProperty | ( | const std::string & | prop_name | ) |
Get a Kokkos material property.
T | The property data type |
dimension | The property dimension |
state | The property state |
prop_name | The property name |
Definition at line 455 of file MaterialData.h.
Referenced by MaterialPropertyInterface::getKokkosMaterialPropertyByName().
|
private |
Helper function for getting a Kokkos material property.
prop_name | The property name |
state | The property state |
shell | The managed pointer containing the instance of the property |
Referenced by getKokkosProperty(), and haveKokkosProperty().
|
inline |
Provide read-only access to the underlying MaterialPropertyStorage object.
Definition at line 186 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 207 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 127 of file MaterialData.h.
Referenced by MaterialPropertyInterface::getBlockMaterialProperty(), MaterialPropertyInterface::getGenericMaterialPropertyByName(), and MaterialBase::getGenericZeroMaterialPropertyByName().
|
private |
Definition at line 378 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(), MaterialPropertyInterface::getKokkosMaterialPropertyByName(), 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 100 of file MaterialData.h.
Referenced by MaterialPropertyInterface::hasADMaterialPropertyByName(), and MaterialOutputAction::hasADProperty().
|
inline |
Definition at line 362 of file MaterialData.h.
Referenced by BlockRestrictable::hasBlockMaterialProperty(), and BoundaryRestrictable::hasBoundaryMaterialProperty().
bool MaterialData::haveKokkosProperty | ( | const std::string & | prop_name | ) | const |
Get whether a Kokkos material property exists.
T | The property data type |
dimension | The property dimension |
prop_name | The property name |
Definition at line 444 of file MaterialData.h.
Referenced by MaterialPropertyInterface::hasKokkosMaterialPropertyByName().
|
private |
Helper function for checking whether a Kokkos material property exists.
prop_name | The property name |
Referenced by haveKokkosProperty().
|
inline |
Returns true if the regular material property exists - defined by any material.
Definition at line 93 of file MaterialData.h.
Referenced by MaterialPropertyInterface::hasMaterialPropertyByName(), and MaterialOutputAction::hasProperty().
|
inline |
Check value of _resize_only_if_smaller.
Definition at line 233 of file MaterialData.h.
|
inline |
Returns true if the stateful material is in a swapped state.
Definition at line 181 of file MaterialData.h.
Referenced by swap(), and swapBack().
|
private |
Helper function to register load/store functions of a Kokkos material property to the Kokkos material property storage.
type | The property type index |
store | The store function pointer |
load | The load function pointer |
Referenced by getKokkosProperty().
|
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 54 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 228 of file MaterialData.h.
|
inline |
state
(defaults to zero).This should NEVER be used to modify the size of these objects.{
Definition at line 347 of file MaterialData.h.
Referenced by Material::computeProperties(), getPropertyHelper(), haveGenericProperty(), resize(), and Material::subdomainSetup().
|
inline |
Definition at line 354 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 435 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(), FEProblemBase::reinitMaterials(), FEProblemBase::reinitMaterialsBoundary(), FEProblemBase::reinitMaterialsFace(), FEProblemBase::reinitMaterialsFaceOnBoundary(), FEProblemBase::reinitMaterialsInterface(), FEProblemBase::reinitMaterialsNeighbor(), and FEProblemBase::resizeMaterialData().
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 250 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 340 of file MaterialData.h.
Referenced by isOnlyResizeIfSmaller(), onlyResizeIfSmaller(), and resize().
|
private |
Reference to the MaterialStorage class.
Definition at line 244 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 336 of file MaterialData.h.
Referenced by isSwapped(), swap(), and swapBack().
|
private |
The thread id.
Definition at line 247 of file MaterialData.h.
Referenced by copy(), swap(), and swapBack().
|
static |
The max time state supported (2 = older)
Definition at line 43 of file MaterialData.h.
Referenced by MaterialPropertyStorage::addProperty().