6#include <Kokkos_Core.hpp>
26 KOKKOS_INLINE_FUNCTION
34 KOKKOS_INLINE_FUNCTION
42 KOKKOS_INLINE_FUNCTION
45 cmpts_[0] = constValue;
46 cmpts_[1] = constValue;
47 cmpts_[2] = constValue;
69 constexpr size_t size()
const {
return 3; }
71 KOKKOS_INLINE_FUNCTION
74 KOKKOS_INLINE_FUNCTION
77 KOKKOS_INLINE_FUNCTION
80 KOKKOS_INLINE_FUNCTION
83 KOKKOS_INLINE_FUNCTION
86 return cmpts_[0] == rhs(0) && cmpts_[1] == rhs(1) && cmpts_[2] == rhs(2);
89 KOKKOS_INLINE_FUNCTION
92 return Vec3(cmpts_[0] + rhs(0), cmpts_[1] + rhs(1), cmpts_[2] + rhs(2));
95 KOKKOS_INLINE_FUNCTION
104 KOKKOS_INLINE_FUNCTION
107 return Vec3(cmpts_[0] - rhs(0), cmpts_[1] - rhs(1), cmpts_[2] - rhs(2));
110 KOKKOS_INLINE_FUNCTION
119 KOKKOS_INLINE_FUNCTION
122 return Vec3(cmpts_[0] * rhs, cmpts_[1] * rhs, cmpts_[2] * rhs);
126 KOKKOS_INLINE_FUNCTION
129 return Vec3(cmpts_[0] * rhs, cmpts_[1] * rhs, cmpts_[2] * rhs);
133 KOKKOS_INLINE_FUNCTION
148KOKKOS_INLINE_FUNCTION
155KOKKOS_INLINE_FUNCTION
158 return lhs[0] * rhs[0] + lhs[1] * rhs[1] + lhs[2] * rhs[2];
161KOKKOS_INLINE_FUNCTION
162scalar mag(
const Vec3& vec) {
return sqrt(vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2]); }
170 return Vec3(1.0, 1.0, 1.0);
176 return Vec3(0.0, 0.0, 0.0);
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
KOKKOS_INLINE_FUNCTION scalar operator&(const Vec3 &lhs, Vec3 rhs)
KOKKOS_INLINE_FUNCTION Vec3 zero< Vec3 >()
KOKKOS_INLINE_FUNCTION Vec3 one< Vec3 >()
KOKKOS_INLINE_FUNCTION scalar mag(const scalar &s)
std::ostream & operator<<(std::ostream &out, const Vec3 &vec)
KOKKOS_INLINE_FUNCTION Vec3 operator*(const scalar &sclr, Vec3 rhs)