Line data Source code
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 :
12 : #include "KokkosMaterialPropertyValueDecl.h"
13 : #include "KokkosMaterialPropertyDecl.h"
14 : #include "KokkosDatum.h"
15 :
16 : namespace Moose
17 : {
18 : namespace Kokkos
19 : {
20 :
21 : template <typename T, unsigned int dimension>
22 : KOKKOS_FUNCTION
23 25810976 : MaterialPropertyValueBase<T, dimension>::MaterialPropertyValueBase(
24 0 : const MaterialProperty<T, dimension> & property, const Datum & datum, const unsigned int qp)
25 25810976 : : _qp(datum.qpOffset() + qp),
26 25810976 : _data(property._default ? nullptr : &property._data[datum.subdomain()]),
27 25810976 : _value(property._value)
28 : {
29 25810976 : }
30 :
31 : template <typename T>
32 25810976 : MaterialPropertyValue<T, 0>::MaterialPropertyValue(const MaterialProperty<T, 0> & property,
33 : const Datum & datum,
34 0 : unsigned int qp)
35 25810976 : : MaterialPropertyValueBase<T, 0>(property, datum, qp)
36 : {
37 25810976 : }
38 :
39 : template <typename T>
40 : MaterialPropertyValue<T, 1>::MaterialPropertyValue(const MaterialProperty<T, 1> & property,
41 : const Datum & datum,
42 : unsigned int qp)
43 : : MaterialPropertyValueBase<T, 1>(property, datum, qp)
44 : {
45 : }
46 :
47 : template <typename T>
48 : MaterialPropertyValue<T, 2>::MaterialPropertyValue(const MaterialProperty<T, 2> & property,
49 : const Datum & datum,
50 : unsigned int qp)
51 : : MaterialPropertyValueBase<T, 2>(property, datum, qp)
52 : {
53 : }
54 :
55 : template <typename T>
56 : MaterialPropertyValue<T, 3>::MaterialPropertyValue(const MaterialProperty<T, 3> & property,
57 : const Datum & datum,
58 : unsigned int qp)
59 : : MaterialPropertyValueBase<T, 3>(property, datum, qp)
60 : {
61 : }
62 :
63 : template <typename T>
64 : MaterialPropertyValue<T, 4>::MaterialPropertyValue(const MaterialProperty<T, 4> & property,
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 &
73 2988304 : MaterialPropertyValue<T, 0>::operator=(const T & value)
74 : {
75 2988304 : (*_data)(_qp) = value;
76 :
77 2988304 : return *this;
78 : }
79 :
80 : template <typename T>
81 : KOKKOS_FUNCTION auto &
82 84000 : MaterialPropertyValue<T, 0>::operator=(const MaterialPropertyValue<T, 0> & value)
83 : {
84 84000 : (*_data)(_qp) = static_cast<T>(value);
85 :
86 84000 : return *this;
87 : }
88 :
89 : } // namespace Kokkos
90 : } // namespace Moose
|