7#include <Kokkos_Core.hpp>
29 KOKKOS_INLINE_FUNCTION
32 for (
int k = 0; k < 9; ++k)
39 KOKKOS_INLINE_FUNCTION
42 for (
int k = 0; k < 9; ++k)
51 KOKKOS_INLINE_FUNCTION
76 KOKKOS_INLINE_FUNCTION
const scalar*
data()
const {
return data_; }
78 constexpr size_t size()
const {
return 9; }
80 KOKKOS_INLINE_FUNCTION
83 KOKKOS_INLINE_FUNCTION
86 KOKKOS_INLINE_FUNCTION
89 for (
int k = 0; k < 9; ++k)
91 if (data_[k] != rhs.data_[k])
return false;
96 KOKKOS_INLINE_FUNCTION
100 for (
int k = 0; k < 9; ++k)
102 res.data_[k] = data_[k] + rhs.data_[k];
107 KOKKOS_INLINE_FUNCTION
110 for (
int k = 0; k < 9; ++k)
112 data_[k] += rhs.data_[k];
117 KOKKOS_INLINE_FUNCTION
121 for (
int k = 0; k < 9; ++k)
123 res.data_[k] = data_[k] - rhs.data_[k];
128 KOKKOS_INLINE_FUNCTION
131 for (
int k = 0; k < 9; ++k)
133 data_[k] -= rhs.data_[k];
138 KOKKOS_INLINE_FUNCTION
142 for (
int k = 0; k < 9; ++k)
144 res.data_[k] = data_[k] * s;
149 KOKKOS_INLINE_FUNCTION
152 for (
int k = 0; k < 9; ++k)
160 KOKKOS_INLINE_FUNCTION
164 KOKKOS_INLINE_FUNCTION
168 data_[0], data_[3], data_[6], data_[1], data_[4], data_[7], data_[2], data_[5], data_[8]
178KOKKOS_INLINE_FUNCTION
182KOKKOS_INLINE_FUNCTION
186 t(0, 0) * v[0] + t(0, 1) * v[1] + t(0, 2) * v[2],
187 t(1, 0) * v[0] + t(1, 1) * v[1] + t(1, 2) * v[2],
188 t(2, 0) * v[0] + t(2, 1) * v[1] + t(2, 2) * v[2]
193KOKKOS_INLINE_FUNCTION
197 v[0] * t(0, 0) + v[1] * t(1, 0) + v[2] * t(2, 0),
198 v[0] * t(0, 1) + v[1] * t(1, 1) + v[2] * t(2, 1),
199 v[0] * t(0, 2) + v[1] * t(1, 2) + v[2] * t(2, 2)
204KOKKOS_INLINE_FUNCTION
208 for (
int k = 0; k < 9; ++k)
216KOKKOS_INLINE_FUNCTION
221 for (
int k = 0; k < 9; ++k)
234 return Tensor(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
A class for the representation of a 3x3 tensor.
KOKKOS_INLINE_FUNCTION const scalar * data() const
KOKKOS_INLINE_FUNCTION Tensor operator+(const Tensor &rhs) const
KOKKOS_INLINE_FUNCTION bool operator==(const Tensor &rhs) const
KOKKOS_INLINE_FUNCTION scalar * data()
KOKKOS_INLINE_FUNCTION Tensor(scalar t00, scalar t01, scalar t02, scalar t10, scalar t11, scalar t12, scalar t20, scalar t21, scalar t22)
KOKKOS_INLINE_FUNCTION Tensor operator-(const Tensor &rhs) const
KOKKOS_INLINE_FUNCTION Tensor()
KOKKOS_INLINE_FUNCTION Tensor & operator-=(const Tensor &rhs)
KOKKOS_INLINE_FUNCTION Tensor & operator*=(const scalar s)
KOKKOS_INLINE_FUNCTION Tensor(const scalar diag)
Construct scalar-times-identity tensor.
constexpr size_t size() const
KOKKOS_INLINE_FUNCTION scalar trace() const
Trace: sum of diagonal components.
KOKKOS_INLINE_FUNCTION scalar operator()(const size_t i, const size_t j) const
KOKKOS_INLINE_FUNCTION scalar & operator()(const size_t i, const size_t j)
KOKKOS_INLINE_FUNCTION Tensor T() const
Transpose.
KOKKOS_INLINE_FUNCTION Tensor & operator+=(const Tensor &rhs)
KOKKOS_INLINE_FUNCTION Tensor operator*(const scalar s) const
A class for the representation of a 3D Vec3.
Integer types used throughout NeoN.
KOKKOS_INLINE_FUNCTION Tensor one< Tensor >()
std::ostream & operator<<(std::ostream &os, const Dictionary &in)
KOKKOS_INLINE_FUNCTION Tensor inv< Tensor >(Tensor)
KOKKOS_INLINE_FUNCTION Tensor zero< Tensor >()
KOKKOS_INLINE_FUNCTION scalar mag(const scalar &s)
KOKKOS_INLINE_FUNCTION Vec3 operator&(const SymmTensor &s, const Vec3 &v)
Symmetric matrix-vector product S·v.
KOKKOS_INLINE_FUNCTION SymmTensor operator*(const scalar s, const SymmTensor &st)
KOKKOS_INLINE_FUNCTION scalar magSqr(const SymmTensor &s)
Frobenius norm squared.