15 #if defined(__clang__) 16 #pragma clang diagnostic push 17 #pragma clang diagnostic ignored "-Woverloaded-virtual" 18 #elif defined(__GNUC__) || defined(__GNUG__) 19 #pragma GCC diagnostic push 20 #pragma GCC diagnostic ignored "-Woverloaded-virtual" 62 template <
typename Derived>
124 template <
typename T,
unsigned int dimension = 0,
unsigned int state = 0>
133 template <
typename T,
unsigned int dimension = 0>
136 return getKokkosMaterialPropertyByName<T, dimension, 1>(prop_name);
145 template <
typename T,
unsigned int dimension = 0>
148 return getKokkosMaterialPropertyByName<T, dimension, 2>(prop_name);
158 template <
typename T,
unsigned int dimension = 0,
unsigned int state = 0>
170 template <
typename T,
unsigned int dimension = 0>
182 template <
typename T,
unsigned int dimension = 0>
224 const QBase *
const &
_qrule;
230 template <
typename Derived>
240 template <
typename Derived>
247 _default_init(&Derived::initQpStatefulProperties == &
Material::initQpStatefulProperties),
248 _qrule(_bnd ? (_neighbor ? _subproblem.assembly(_tid, 0).qRuleNeighbor()
249 : _subproblem.assembly(_tid, 0).qRuleFace())
250 : _subproblem.assembly(_tid, 0).qRule())
256 template <
typename Derived>
262 _neighbor(
object._neighbor),
263 _default_init(
object._default_init),
264 _qrule(
object._qrule)
268 template <
typename Derived>
275 if (!_bnd && !_neighbor)
276 ::Kokkos::parallel_for(
277 ::Kokkos::RangePolicy<
ElementInit, ExecSpace, ::Kokkos::IndexType<ThreadID>>(
278 0, numKokkosElements()),
279 *static_cast<Derived *>(
this));
280 else if (_bnd && !_neighbor)
281 ::Kokkos::parallel_for(
282 ::Kokkos::RangePolicy<
SideInit, ExecSpace, ::Kokkos::IndexType<ThreadID>>(
283 0, numKokkosElementSides()),
284 *static_cast<Derived *>(
this));
286 ::Kokkos::parallel_for(
287 ::Kokkos::RangePolicy<
NeighborInit, ExecSpace, ::Kokkos::IndexType<ThreadID>>(
288 0, numKokkosElementSides()),
289 *static_cast<Derived *>(
this));
294 template <
typename Derived>
298 if (!_bnd && !_neighbor)
299 ::Kokkos::parallel_for(
300 ::Kokkos::RangePolicy<
ElementCompute, ExecSpace, ::Kokkos::IndexType<ThreadID>>(
301 0, numKokkosElements()),
302 *static_cast<Derived *>(
this));
303 else if (_bnd && !_neighbor)
304 ::Kokkos::parallel_for(
305 ::Kokkos::RangePolicy<
SideCompute, ExecSpace, ::Kokkos::IndexType<ThreadID>>(
306 0, numKokkosElementSides()),
307 *static_cast<Derived *>(
this));
309 ::Kokkos::parallel_for(
310 ::Kokkos::RangePolicy<
NeighborCompute, ExecSpace, ::Kokkos::IndexType<ThreadID>>(
311 0, numKokkosElementSides()),
312 *static_cast<Derived *>(
this));
317 template <
typename Derived>
321 auto material =
static_cast<const Derived *
>(
this);
322 auto elem = kokkosElementID(tid);
324 Datum datum(elem, kokkosAssembly(), kokkosSystems());
326 for (
unsigned int qp = 0; qp < datum.
n_qps(); qp++)
329 material->initQpStatefulProperties(qp, datum);
333 template <
typename Derived>
337 auto material =
static_cast<const Derived *
>(
this);
338 auto [elem, side] = kokkosElementSideID(tid);
340 Datum datum(elem, side, kokkosAssembly(), kokkosSystems());
342 for (
unsigned int qp = 0; qp < datum.
n_qps(); qp++)
345 material->initQpStatefulProperties(qp, datum);
349 template <
typename Derived>
353 auto material =
static_cast<const Derived *
>(
this);
354 auto [elem, side] = kokkosElementSideID(tid);
356 Datum datum(elem, side, kokkosAssembly(), kokkosSystems());
358 for (
unsigned int qp = 0; qp < datum.
n_qps(); qp++)
361 material->initQpStatefulProperties(qp, datum);
365 template <
typename Derived>
369 auto material =
static_cast<const Derived *
>(
this);
370 auto elem = kokkosElementID(tid);
372 Datum datum(elem, kokkosAssembly(), kokkosSystems());
374 for (
unsigned int qp = 0; qp < datum.
n_qps(); qp++)
377 material->computeQpProperties(qp, datum);
381 template <
typename Derived>
385 auto material =
static_cast<const Derived *
>(
this);
386 auto [elem, side] = kokkosElementSideID(tid);
388 Datum datum(elem, side, kokkosAssembly(), kokkosSystems());
390 for (
unsigned int qp = 0; qp < datum.
n_qps(); qp++)
393 material->computeQpProperties(qp, datum);
397 template <
typename Derived>
401 auto material =
static_cast<const Derived *
>(
this);
402 auto [elem, side] = kokkosElementSideID(tid);
404 Datum datum(elem, side, kokkosAssembly(), kokkosSystems());
406 for (
unsigned int qp = 0; qp < datum.
n_qps(); qp++)
409 material->computeQpProperties(qp, datum);
413 template <
typename Derived>
414 template <
typename T,
unsigned int dimension,
unsigned int state>
420 const auto prop_name =
423 :
MooseUtils::join(std::vector<std::string>({prop_name_in, _get_suffix}),
"_");
425 if constexpr (state == 0)
426 _requested_props.insert(prop_name);
429 MaterialPropertyInterface::getKokkosMaterialPropertyByName<T, dimension, state>(prop_name);
431 registerPropName(prop_name,
true, state);
virtual const std::unordered_set< unsigned int > & getMatPropDependencies() const
Retrieve the set of material properties that this object depends on.
std::string join(Iterator begin, Iterator end, const std::string &delimiter)
Python-like join function for strings over an iterator range.
virtual void checkMaterialProperty(const std::string &name, const unsigned int state)
A helper method for checking material properties This method was required to avoid a compiler problem...
virtual const std::unordered_set< unsigned int > & getMatPropDependencies() const override
Retrieve the set of material properties that this object depends on.
The Kokkos object that holds thread-private data in the parallel operations of any Kokkos object...
virtual bool boundaryRestricted() const
Returns true if this object has been restricted to a boundary.
KOKKOS_FUNCTION void initQpStatefulProperties(const unsigned int, Datum &) const
Default methods to prevent compile errors even when these methods were not defined in the derived cla...
virtual bool isBoundaryMaterial() const override
Returns true of the MaterialData type is not associated with volume data.
const bool _bnd
Flag whether the material is on faces.
const InputParameters & parameters() const
Get the parameters of the object.
MaterialDataType
MaterialData types.
virtual void computeProperties() override
Performs the quadrature point loop, calling computeQpProperties.
static InputParameters validParams()
MaterialPropertyName getMaterialPropertyName(const std::string &name) const
virtual void initStatefulProperties(unsigned int) override
Dispatch stateful material property initialization.
virtual void checkMaterialProperty(const std::string &name, const unsigned int state) override
A helper method for checking material properties This method was required to avoid a compiler problem...
MaterialData & _material_data
The material data class that stores properties.
MaterialProperty< T, dimension > getKokkosMaterialPropertyOlder(const std::string &name)
Get an older material property.
MaterialProperty< T, dimension > getKokkosMaterialPropertyOldByName(const std::string &prop_name)
Get an old material property by property name.
const std::string & name() const
Get the name of the class.
const QBase *const & _qrule
Dummy members unused for Kokkos materials.
void checkExecutionStage()
Check and throw an error if the execution has progressed past the construction stage.
static InputParameters validParams()
KOKKOS_FUNCTION unsigned int n_qps() const
Get the number of local quadrature points.
virtual MaterialDataType materialDataType() override
virtual void initStatefulProperties(unsigned int n_points)
Initialize stateful properties (if material has some)
const std::vector< MooseVariableFieldBase * > & getCoupledMooseVars() const
Get the list of all coupled variables.
virtual void computeProperties() override
Dispatch material property evaluation.
MaterialProperty< T, dimension > getKokkosMaterialPropertyOld(const std::string &name)
Get an old material property.
Interface for objects that needs coupling capabilities.
static InputParameters validParams()
void addMooseVariableDependency(MooseVariableFieldBase *var)
Call this function to add the passed in MooseVariableFieldBase as a variable that this object depends...
The base class for a user to derive their own Kokkos materials.
MaterialProperty< T, dimension > getKokkosMaterialPropertyOlderByName(const std::string &prop_name)
Get an older material property by property name.
An interface for accessing Materials.
virtual MaterialData & materialData() override
KOKKOS_FUNCTION void operator()(ElementInit, const ThreadID tid) const
The parallel computation entry functions called by Kokkos.
Moose::Kokkos::MaterialProperty< T, dimension > getKokkosMaterialPropertyByName(const std::string &prop_name)
Get a Kokkos material property by property name for any state.
const bool _default_init
Flag whether initQpStatefulProperties() was not defined in the derived class.
Proxy for accessing MaterialPropertyStorage.
virtual const MaterialData & materialData() const override
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
virtual const QBase & qRule() const override
const Moose::MaterialDataType _material_data_type
The type of data.
The Kokkos material property class.
MaterialProperty< T, dimension > getKokkosMaterialPropertyByName(const std::string &prop_name_in)
Get a material property by property name for any state.
The base class for Kokkos materials.
Material(const InputParameters ¶meters)
Constructor.
const bool _neighbor
Flag whether the material is on neighbor faces.
MaterialProperty< T, dimension > getKokkosMaterialProperty(const std::string &name)
Get a material property for any state.
KOKKOS_FUNCTION void reinit()
Reset the reinit flag.
Material(const InputParameters ¶meters)