https://mooseframework.inl.gov
KokkosScalar.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 
12 #include "KokkosReferenceWrapper.h"
13 
14 namespace Moose::Kokkos
15 {
16 
20 template <typename T, typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
21 class Scalar : public ReferenceWrapper<T>
22 {
23 public:
28  Scalar(T & value) : ReferenceWrapper<T>(value) {}
29 
34  auto & operator=(T value)
35  {
36  this->_reference = value;
37 
38  return *this;
39  }
40 
41  // TODO: add support for arithmetic operators
42 };
43 
44 template <typename T>
46 {
47  static constexpr bool value = true;
48 };
49 
50 // Mimic MOOSE convention
52 
53 } // namespace Moose::Kokkos
The Kokkos object that can hold the reference of a variable.
The Kokkos wrapper class that can hold the reference of an arithmetic scalar variable.
Definition: KokkosScalar.h:21
T & _reference
Writeable host reference of the variable.
auto & operator=(T value)
Assign a scalar value to the underlying host reference.
Definition: KokkosScalar.h:34
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
The type trait that determines the default behavior of copy constructor and deepCopy() If this type t...
Definition: KokkosArray.h:90
Scalar(T &value)
Constructor.
Definition: KokkosScalar.h:28
static constexpr bool value
Definition: KokkosArray.h:92