7#include <Kokkos_Core.hpp>
27 KOKKOS_INLINE_FUNCTION
35 KOKKOS_INLINE_FUNCTION
43 KOKKOS_INLINE_FUNCTION
46 cmpts_[0] = constValue;
47 cmpts_[1] = constValue;
48 cmpts_[2] = constValue;
70 constexpr size_t size()
const {
return 3; }
72 KOKKOS_INLINE_FUNCTION
75 KOKKOS_INLINE_FUNCTION
78 KOKKOS_INLINE_FUNCTION
81 KOKKOS_INLINE_FUNCTION
84 KOKKOS_INLINE_FUNCTION
87 return cmpts_[0] == rhs(0) && cmpts_[1] == rhs(1) && cmpts_[2] == rhs(2);
90 KOKKOS_INLINE_FUNCTION
93 return Vec3(cmpts_[0] + rhs(0), cmpts_[1] + rhs(1), cmpts_[2] + rhs(2));
96 KOKKOS_INLINE_FUNCTION
105 KOKKOS_INLINE_FUNCTION
108 return Vec3(cmpts_[0] - rhs(0), cmpts_[1] - rhs(1), cmpts_[2] - rhs(2));
111 KOKKOS_INLINE_FUNCTION
120 KOKKOS_INLINE_FUNCTION
123 return Vec3(cmpts_[0] * rhs, cmpts_[1] * rhs, cmpts_[2] * rhs);
127 KOKKOS_INLINE_FUNCTION
130 return Vec3(cmpts_[0] * rhs, cmpts_[1] * rhs, cmpts_[2] * rhs);
134 KOKKOS_INLINE_FUNCTION
149KOKKOS_INLINE_FUNCTION
158KOKKOS_INLINE_FUNCTION
161 return {lhs[0] * rhs[0], lhs[1] * rhs[1], lhs[2] * rhs[2]};
165KOKKOS_INLINE_FUNCTION
168 return lhs[0] * rhs[0] + lhs[1] * rhs[1] + lhs[2] * rhs[2];
172KOKKOS_INLINE_FUNCTION
176 lhs[1] * rhs[2] - lhs[2] * rhs[1],
177 lhs[2] * rhs[0] - lhs[0] * rhs[2],
178 lhs[0] * rhs[1] - lhs[1] * rhs[0]
184KOKKOS_INLINE_FUNCTION
188KOKKOS_INLINE_FUNCTION
192KOKKOS_INLINE_FUNCTION
193scalar mag(
const Vec3& vec) {
return sqrt(vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2]); }
201 return Vec3(1.0, 1.0, 1.0);
207 return Vec3(0.0, 0.0, 0.0);
213 return Vec3(1.0 / in[0], 1.0 / in[1], 1.0 / in[2]);
A class for the representation of a 3D Vec3.
scalar * data()
Returns pointer to the data of the vector.
KOKKOS_INLINE_FUNCTION Vec3 operator-(const Vec3 &rhs) const
KOKKOS_INLINE_FUNCTION Vec3 operator+(const Vec3 &rhs) const
KOKKOS_INLINE_FUNCTION scalar & operator()(const size_t i)
KOKKOS_INLINE_FUNCTION Vec3 & operator-=(const Vec3 &rhs)
KOKKOS_INLINE_FUNCTION Vec3 & operator+=(const Vec3 &rhs)
constexpr size_t size() const
Returns the size of the vector.
KOKKOS_INLINE_FUNCTION Vec3(const scalar constValue)
KOKKOS_INLINE_FUNCTION Vec3 & operator*=(const scalar &rhs)
KOKKOS_INLINE_FUNCTION Vec3()
KOKKOS_INLINE_FUNCTION Vec3 operator*(const scalar &rhs) const
const scalar * data() const
Returns pointer to the data of the vector.
KOKKOS_INLINE_FUNCTION bool operator==(const Vec3 &rhs) const
KOKKOS_INLINE_FUNCTION Vec3(scalar x, scalar y, scalar z)
KOKKOS_INLINE_FUNCTION scalar & operator[](const size_t i)
KOKKOS_INLINE_FUNCTION scalar operator[](const size_t i) const
KOKKOS_INLINE_FUNCTION scalar operator()(const size_t i) const
KOKKOS_INLINE_FUNCTION Vec3 operator*(const label &rhs) const
Integer types used throughout NeoN.
std::ostream & operator<<(std::ostream &os, const Dictionary &in)
KOKKOS_INLINE_FUNCTION Vec3 zero< Vec3 >()
KOKKOS_INLINE_FUNCTION Vec3 one< Vec3 >()
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 Vec3 inv< Vec3 >(Vec3 in)
KOKKOS_INLINE_FUNCTION SymmTensor operator*(const scalar s, const SymmTensor &st)
KOKKOS_INLINE_FUNCTION Vec3 operator^(const Vec3 &lhs, Vec3 rhs)
cross (vector) product, right-handed: lhs ^ rhs
KOKKOS_INLINE_FUNCTION Vec3 cross(const Vec3 &lhs, const Vec3 &rhs)
cross (vector) product, spelled out for call sites that read better as a named function than as ^
KOKKOS_INLINE_FUNCTION Vec3 operator/(const Vec3 &lhs, scalar rhs)