14#ifdef MOOSE_KOKKOS_SCOPE
31template <
typename T,
unsigned int dimension>
38template <
typename T,
unsigned int dimension>
43 const auto & prop =
property._reference ? *
property._reference : property;
47 _reference =
property._reference;
50template <
typename T,
unsigned int dimension>
54 shallowCopy(property);
59template <
typename T,
unsigned int dimension>
68#ifdef MOOSE_KOKKOS_SCOPE
69template <
typename T,
unsigned int dimension>
75 mooseAssert(prop_cast,
"The property to copy should be of the same type and dimension.");
77 for (
const auto i : index_range(prop_cast->_data))
78 if (prop_cast->_data[i].isAlloc())
79 _data[i].deepCopy(prop_cast->_data[i]);
84template <
typename T,
unsigned int dimension>
90 mooseAssert(prop_cast,
"The property to swap should be of the same type and dimension.");
92 _data.swap(prop_cast->_data);
95template <
typename T,
unsigned int dimension>
99 _record =
property._record;
101 _default =
property._default;
102 _constant_option =
property._constant_option;
104 _reference =
property._reference;
105 _data =
property._data;
106 _value =
property._value;
109template <
typename T,
unsigned int dimension>
113 const std::set<SubdomainID> & subdomains,
117 if (!_data.isAlloc())
118 _data.create(
mesh.getNumSubdomains());
120 if (!_constant_option.isAlloc())
122 _constant_option.create(
mesh.getNumSubdomains());
126 for (
const auto subdomain : subdomains)
128 auto sid =
mesh.getContiguousSubdomainID(subdomain);
129 auto constant_option = libmesh_map_find(_record->constant_option, subdomain);
131 using index_type =
typename std::remove_reference_t<
decltype(_data[sid])>::unsigned_index_type;
133 std::vector<index_type> n;
135 for (
unsigned int i = 0; i < dimension; ++i)
136 n.push_back(libmesh_map_find(_record->dims, subdomain)[i]);
142 :
mesh.getNumSubdomainLocalElements(subdomain));
146 if (!_data[sid].isAlloc())
147 _data[sid].createDevice(n);
149 _constant_option[sid] = constant_option;
152 _data.copyToDevice();
153 _constant_option.copyToDevice();
156template <
typename T,
unsigned int dimension>
164template <
typename T,
unsigned int dimension>
170 dataStore(stream, property->_data,
nullptr);
172template <
typename T,
unsigned int dimension>
178 dataLoad(stream, property->_data,
nullptr);
The Kokkos assembly class.
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 ...
KOKKOS_FUNCTION dof_id_type getElemFacePropertySize(ContiguousSubdomainID subdomain) const
Get the size of element-constant face material property data storage of a subdomain.
KOKKOS_FUNCTION dof_id_type getNumQps(ContiguousSubdomainID subdomain) const
Get the total number of elemental quadrature points in a subdomain.
The Kokkos object that holds thread-private data in the parallel operations of any Kokkos object.
The base class for Kokkos material properties.
const PropRecord * _record
Pointer to the record of this property.
unsigned int _id
Property ID.
virtual void init(const PropRecord &record, const StorageKey &)
Initialize this property.
The Kokkos material property class.
virtual void swap(MaterialPropertyBase &prop, StorageKey) override
Swap with another property.
auto & operator=(const MaterialProperty< T, dimension > &property)
Shallow copy another property.
MaterialProperty()=default
Default constructor.
void shallowCopy(const MaterialProperty< T, dimension > &property)
Shallow copy another property.
virtual void allocate(const Mesh &mesh, const Assembly &assembly, const std::set< SubdomainID > &subdomains, const bool bnd, StorageKey) override
Allocate the data storage.
virtual void copy(const MaterialPropertyBase &prop, StorageKey) override
Deep copy another property.
KOKKOS_FUNCTION MaterialPropertyValue< T, dimension > operator()(const Datum &datum, const unsigned int qp) const
Get the property values of a quadrature point.
virtual void init(const PropRecord &record, const StorageKey &key) override
Initialize this property.
void dataLoad(std::istream &stream, Array< T, dimension, index_type, layout > &array, void *context)
void propertyLoad(std::istream &stream, void *prop)
void propertyStore(std::ostream &stream, void *prop)
void dataStore(std::ostream &stream, Array< T, dimension, index_type, layout > &array, void *context)
A structure storing the metadata of Kokkos material properties.
unsigned int id
Property ID.