https://mooseframework.inl.gov
Loading...
Searching...
No Matches
KokkosMaterialPropertyValue.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://www.mooseframework.org
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
14#include "KokkosDatum.h"
15
16namespace Moose::Kokkos
17{
18
19template <typename T, unsigned int dimension>
20KOKKOS_FUNCTION
22 const MaterialProperty<T, dimension> & property, const Datum & datum, const unsigned int qp)
23 : _idx(property._default ? libMesh::invalid_uint
24 : datum.propertyIdx(property._constant_option[datum.subdomain()], qp)),
25 _data(property._default ? nullptr : &property._data[datum.subdomain()]),
26 _value(property._value)
27{
28}
29
30template <typename T, unsigned int dimension>
31KOKKOS_FUNCTION
33 const MaterialProperty<T, dimension> & property, const Datum & datum, const unsigned int qp)
34 : MaterialPropertyValueBase<T, dimension>(property, datum, qp)
35{
36}
37
38template <typename T>
39KOKKOS_FUNCTION
41 const Datum & datum,
42 const unsigned int qp)
43 : MaterialPropertyValueBase<T, 0>(property, datum, qp)
44{
45}
46
47template <typename T>
48KOKKOS_FUNCTION auto &
50{
51 (*_data)(_idx) = value;
52
53 return *this;
54}
55
56template <typename T>
57KOKKOS_FUNCTION auto &
59{
60 (*_data)(_idx) = static_cast<T>(value);
61
62 return *this;
63}
64
65} // namespace Moose::Kokkos
The Kokkos object that holds thread-private data in the parallel operations of any Kokkos object.
The Kokkos wrapper class for accessing the material property values of a single quadrature point.
KOKKOS_FUNCTION MaterialPropertyValueBase(const MaterialProperty< T, dimension > &property, const Datum &datum, const unsigned int qp)
Constructor.
The Kokkos material property class.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...