14 #ifdef MOOSE_KOKKOS_SCOPE 34 template <
typename T,
unsigned int dimension>
41 template <
typename T,
unsigned int dimension>
46 const auto & prop =
property._reference ? *
property._reference : property;
50 _reference =
property._reference;
53 template <
typename T,
unsigned int dimension>
57 shallowCopy(property);
62 template <
typename T,
unsigned int dimension>
71 #ifdef MOOSE_KOKKOS_SCOPE 72 template <
typename T,
unsigned int dimension>
78 mooseAssert(prop_cast,
"The property to copy should be of the same type and dimension.");
81 if (prop_cast->_data[i].isAlloc())
82 _data[i].deepCopy(prop_cast->_data[i]);
87 template <
typename T,
unsigned int dimension>
93 mooseAssert(prop_cast,
"The property to swap should be of the same type and dimension.");
95 _data.swap(prop_cast->_data);
98 template <
typename T,
unsigned int dimension>
102 _record =
property._record;
104 _default =
property._default;
106 _reference =
property._reference;
107 _data =
property._data;
108 _value =
property._value;
111 template <
typename T,
unsigned int dimension>
115 const std::set<SubdomainID> & subdomains,
119 if (!_data.isAlloc())
120 _data.create(
mesh.meshSubdomains().size());
122 for (
const auto subdomain : subdomains)
124 auto sid =
mesh.getKokkosMesh()->getContiguousSubdomainID(subdomain);
126 std::vector<dof_id_type> n;
128 for (
unsigned int i = 0; i < dimension; ++i)
129 n.push_back(_record->dims[i]);
133 if (!_data[sid].isAlloc())
134 _data[sid].createDevice(n);
137 _data.copyToDevice();
140 template <
typename T,
unsigned int dimension>
148 template <
typename T,
unsigned int dimension>
154 dataStore(stream, property->_data,
nullptr);
156 template <
typename T,
unsigned int dimension>
162 dataLoad(stream, property->_data,
nullptr);
virtual void init(const PropRecord &record, const StorageKey &)
Initialize this property.
The Kokkos assembly class.
A structure storing the metadata of Kokkos material properties.
The base class for Kokkos material properties.
KOKKOS_FUNCTION MaterialPropertyValue< T, dimension > operator()(const Datum &datum, const unsigned int qp) const
Get the property values of a quadrature point.
The Kokkos object that holds thread-private data in the parallel operations of any Kokkos object...
const PropRecord * _record
Pointer to the record of this property.
void propertyLoad(std::istream &stream, void *prop)
virtual void init(const PropRecord &record, const StorageKey &key) override
Initialize this property.
virtual void swap(MaterialPropertyBase &prop, StorageKey) override
Swap with another property.
virtual void allocate(const MooseMesh &mesh, const Assembly &assembly, const std::set< SubdomainID > &subdomains, const bool bnd, StorageKey) override
Allocate the data storage.
auto & operator=(const MaterialProperty< T, dimension > &property)
Shallow copy another property.
unsigned int _id
Property ID.
unsigned int id
Property ID.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
MaterialProperty()=default
Default constructor.
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
virtual void copy(const MaterialPropertyBase &prop, StorageKey) override
Deep copy another property.
KOKKOS_FUNCTION dof_id_type getNumFaceQps(ContiguousSubdomainID subdomain) const
Get the total number of facial quadrature points in a subdomain Note: this number does not represent ...
void shallowCopy(const MaterialProperty< T, dimension > &property)
Shallow copy another property.
void dataStore(std::ostream &stream, Array< T, dimension > &array, void *context)
void dataLoad(std::istream &stream, Array< T, dimension > &array, void *context)
KOKKOS_FUNCTION dof_id_type getNumQps(ContiguousSubdomainID subdomain) const
Get the total number of elemental quadrature points in a subdomain.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
The Kokkos material property class.
auto index_range(const T &sizable)
void propertyStore(std::ostream &stream, void *prop)