https://mooseframework.inl.gov
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 
16 namespace Moose
17 {
18 namespace Kokkos
19 {
20 
21 template <typename T, unsigned int dimension>
22 KOKKOS_FUNCTION
24  const MaterialProperty<T, dimension> & property, const Datum & datum, const unsigned int qp)
25  : _qp(datum.qpOffset() + qp),
26  _data(property._default ? nullptr : &property._data[datum.subdomain()]),
27  _value(property._value)
28 {
29 }
30 
31 template <typename T>
33  const Datum & datum,
34  unsigned int qp)
35  : MaterialPropertyValueBase<T, 0>(property, datum, qp)
36 {
37 }
38 
39 template <typename T>
41  const Datum & datum,
42  unsigned int qp)
43  : MaterialPropertyValueBase<T, 1>(property, datum, qp)
44 {
45 }
46 
47 template <typename T>
49  const Datum & datum,
50  unsigned int qp)
51  : MaterialPropertyValueBase<T, 2>(property, datum, qp)
52 {
53 }
54 
55 template <typename T>
57  const Datum & datum,
58  unsigned int qp)
59  : MaterialPropertyValueBase<T, 3>(property, datum, qp)
60 {
61 }
62 
63 template <typename T>
65  const Datum & datum,
66  unsigned int qp)
67  : MaterialPropertyValueBase<T, 4>(property, datum, qp)
68 {
69 }
70 
71 template <typename T>
72 KOKKOS_FUNCTION auto &
74 {
75  (*_data)(_qp) = value;
76 
77  return *this;
78 }
79 
80 template <typename T>
81 KOKKOS_FUNCTION auto &
83 {
84  (*_data)(_qp) = static_cast<T>(value);
85 
86  return *this;
87 }
88 
89 } // namespace Kokkos
90 } // namespace Moose
The Kokkos object that holds thread-private data in the parallel operations of any Kokkos object...
Definition: KokkosDatum.h:25
KOKKOS_FUNCTION MaterialPropertyValueBase(const MaterialProperty< T, dimension > &property, const Datum &datum, const unsigned int qp)
Constructor.
The Kokkos wrapper class for accessing the material property values of a single quadrature point...
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
infix_ostream_iterator< T, charT, traits > & operator=(T const &item)
Definition: InfixIterator.h:46
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
MaterialPropertyValueTempl< false > MaterialPropertyValue
The Kokkos material property class.