6#include <Kokkos_Core.hpp>
24 KOKKOS_INLINE_FUNCTION
32 KOKKOS_INLINE_FUNCTION
59 constexpr size_t size()
const {
return 3; }
61 KOKKOS_INLINE_FUNCTION
64 KOKKOS_INLINE_FUNCTION
67 KOKKOS_INLINE_FUNCTION
70 KOKKOS_INLINE_FUNCTION
73 KOKKOS_INLINE_FUNCTION
76 return cmpts_[0] == rhs(0) && cmpts_[1] == rhs(1) && cmpts_[2] == rhs(2);
79 KOKKOS_INLINE_FUNCTION
82 return Vector(cmpts_[0] + rhs(0), cmpts_[1] + rhs(1), cmpts_[2] + rhs(2));
85 KOKKOS_INLINE_FUNCTION
94 KOKKOS_INLINE_FUNCTION
97 return Vector(cmpts_[0] - rhs(0), cmpts_[1] - rhs(1), cmpts_[2] - rhs(2));
100 KOKKOS_INLINE_FUNCTION
109 KOKKOS_INLINE_FUNCTION
112 return Vector(cmpts_[0] * rhs, cmpts_[1] * rhs, cmpts_[2] * rhs);
116 KOKKOS_INLINE_FUNCTION
119 return Vector(cmpts_[0] * rhs, cmpts_[1] * rhs, cmpts_[2] * rhs);
123 KOKKOS_INLINE_FUNCTION
138KOKKOS_INLINE_FUNCTION
145KOKKOS_INLINE_FUNCTION
148 return Vector(rhs[0] * lhs[0], rhs[1] * lhs[1], rhs[2] * lhs[2]);
151KOKKOS_INLINE_FUNCTION
152scalar mag(
const Vector& vec) {
return sqrt(vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2]); }
A class for the representation of a 3D Vector.
KOKKOS_INLINE_FUNCTION Vector & operator+=(const Vector &rhs)
KOKKOS_INLINE_FUNCTION Vector(scalar x, scalar y, scalar z)
KOKKOS_INLINE_FUNCTION scalar operator[](const size_t i) const
KOKKOS_INLINE_FUNCTION scalar & operator()(const size_t i)
KOKKOS_INLINE_FUNCTION bool operator==(const Vector &rhs) const
scalar * data()
Returns pointer to the data of the vector.
KOKKOS_INLINE_FUNCTION Vector & operator*=(const scalar &rhs)
constexpr size_t size() const
Returns the size of the vector.
KOKKOS_INLINE_FUNCTION Vector()
KOKKOS_INLINE_FUNCTION scalar operator()(const size_t i) const
KOKKOS_INLINE_FUNCTION Vector operator*(const scalar &rhs) const
KOKKOS_INLINE_FUNCTION Vector operator*(const label &rhs) const
KOKKOS_INLINE_FUNCTION scalar & operator[](const size_t i)
KOKKOS_INLINE_FUNCTION Vector & operator-=(const Vector &rhs)
const scalar * data() const
Returns pointer to the data of the vector.
KOKKOS_INLINE_FUNCTION Vector operator+(const Vector &rhs) const
KOKKOS_INLINE_FUNCTION Vector operator-(const Vector &rhs) const
KOKKOS_INLINE_FUNCTION scalar mag(const Vector &vec)
std::ostream & operator<<(std::ostream &out, const Vector &vec)
KOKKOS_INLINE_FUNCTION Vector operator*(const scalar &sclr, Vector rhs)
KOKKOS_INLINE_FUNCTION Vector operator&(const Vector &lhs, Vector rhs)