14 #ifdef MOOSE_KOKKOS_SCOPE 31 template <
typename T,
unsigned int dimension>
38 template <
typename T,
unsigned int dimension>
43 const auto & prop =
property._reference ? *
property._reference : property;
47 _reference =
property._reference;
50 template <
typename T,
unsigned int dimension>
54 shallowCopy(property);
59 template <
typename T,
unsigned int dimension>
68 #ifdef MOOSE_KOKKOS_SCOPE 69 template <
typename T,
unsigned int dimension>
75 mooseAssert(prop_cast,
"The property to copy should be of the same type and dimension.");
78 if (prop_cast->_data[i].isAlloc())
79 _data[i].deepCopy(prop_cast->_data[i]);
84 template <
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);
95 template <
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;
109 template <
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();
156 template <
typename T,
unsigned int dimension>
164 template <
typename T,
unsigned int dimension>
170 dataStore(stream, property->_data,
nullptr);
172 template <
typename T,
unsigned int dimension>
178 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 dataLoad(std::istream &stream, Array< T, dimension, index_type, layout > &array, void *context)
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.
auto & operator=(const MaterialProperty< T, dimension > &property)
Shallow copy another property.
unsigned int _id
Property ID.
unsigned int id
Property ID.
virtual void allocate(const Mesh &mesh, const Assembly &assembly, const std::set< SubdomainID > &subdomains, const bool bnd, StorageKey) override
Allocate the data storage.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
MaterialProperty()=default
Default constructor.
void dataStore(std::ostream &stream, Array< T, dimension, index_type, layout > &array, void *context)
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 ...
KOKKOS_FUNCTION dof_id_type getElemFacePropertySize(ContiguousSubdomainID subdomain) const
Get the size of element-constant face material property data storage of a subdomain.
void shallowCopy(const MaterialProperty< T, dimension > &property)
Shallow copy another property.
KOKKOS_FUNCTION dof_id_type getNumQps(ContiguousSubdomainID subdomain) const
Get the total number of elemental quadrature points in a subdomain.
The Kokkos material property class.
auto index_range(const T &sizable)
void propertyStore(std::ostream &stream, void *prop)