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::Kokkos
17 {
18 
19 template <typename T, unsigned int dimension>
20 KOKKOS_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 
30 template <typename T, unsigned int dimension>
31 KOKKOS_FUNCTION
33  const MaterialProperty<T, dimension> & property, const Datum & datum, const unsigned int qp)
34  : MaterialPropertyValueBase<T, dimension>(property, datum, qp)
35 {
36 }
37 
38 template <typename T>
39 KOKKOS_FUNCTION
41  const Datum & datum,
42  const unsigned int qp)
43  : MaterialPropertyValueBase<T, 0>(property, datum, qp)
44 {
45 }
46 
47 template <typename T>
48 KOKKOS_FUNCTION auto &
50 {
51  (*_data)(_idx) = value;
52 
53  return *this;
54 }
55 
56 template <typename T>
57 KOKKOS_FUNCTION auto &
59 {
60  (*_data)(_idx) = static_cast<T>(value);
61 
62  return *this;
63 }
64 
65 } // namespace Moose::Kokkos
KOKKOS_FUNCTION MaterialPropertyValue(const MaterialProperty< T, dimension > &property, const Datum &datum, const unsigned int qp)
Constructor.
The Kokkos object that holds thread-private data in the parallel operations of any Kokkos object...
Definition: KokkosDatum.h:23
const unsigned int invalid_uint
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
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:47
const dof_id_type _idx
Index into the property data storage.
MaterialPropertyValueTempl< false > MaterialPropertyValue
The Kokkos material property class.