3 #include <Kokkos_Core.hpp>
11 #define FORCE_SIMD _Pragma("omp simd")
23 KOKKOS_INLINE_FUNCTION
Simd<T>(T initval){
24 for (
int i_simd = 0; i_simd<SIMD_SIZE; i_simd++)
x[i_simd] = initval;
33 template<
typename Trhs>
34 KOKKOS_INLINE_FUNCTION
void operator = (
const Trhs rhs) {
35 for (
int i_simd = 0; i_simd<SIMD_SIZE; i_simd++)
x[i_simd] = rhs;
41 for (
int i_simd = 0; i_simd<SIMD_SIZE; i_simd++) out.
x[i_simd] = -
x[i_simd];
45 template<
typename Trhs>
48 for (
int i_simd = 0; i_simd<SIMD_SIZE; i_simd++) out.
x[i_simd] =
x[i_simd] - rhs[i_simd];
52 template<
typename Trhs>
55 for (
int i_simd = 0; i_simd<SIMD_SIZE; i_simd++) out.
x[i_simd] =
x[i_simd] + rhs[i_simd];
59 template<
typename Trhs>
62 for (
int i_simd = 0; i_simd<SIMD_SIZE; i_simd++) out.
x[i_simd] =
x[i_simd] * rhs[i_simd];
66 template<
typename Trhs>
69 for (
int i_simd = 0; i_simd<SIMD_SIZE; i_simd++) out.
x[i_simd] =
x[i_simd] / rhs[i_simd];
76 KOKKOS_INLINE_FUNCTION
void zero(){
77 for (
int i_simd = 0; i_simd<SIMD_SIZE; i_simd++)
x[i_simd] = 0.0;
85 for (
int i_simd = 0; i_simd<SIMD_SIZE; i_simd++) out.
x[i_simd] = lhs.
x[i_simd] - rhs;
92 for (
int i_simd = 0; i_simd<SIMD_SIZE; i_simd++) out.
x[i_simd] = lhs - rhs.
x[i_simd];
99 for (
int i_simd = 0; i_simd<SIMD_SIZE; i_simd++) out.
x[i_simd] = lhs.
x[i_simd] + rhs;
106 for (
int i_simd = 0; i_simd<SIMD_SIZE; i_simd++) out.
x[i_simd] = lhs + rhs.
x[i_simd];
113 for (
int i_simd = 0; i_simd<SIMD_SIZE; i_simd++) out.
x[i_simd] = lhs.
x[i_simd] * rhs;
120 for (
int i_simd = 0; i_simd<SIMD_SIZE; i_simd++) out.
x[i_simd] = lhs * rhs.
x[i_simd];
127 for (
int i_simd = 0; i_simd<SIMD_SIZE; i_simd++) out.
x[i_simd] = lhs.
x[i_simd] / rhs;
134 for (
int i_simd = 0; i_simd<SIMD_SIZE; i_simd++) out.
x[i_simd] = lhs / rhs.
x[i_simd];
144 KOKKOS_INLINE_FUNCTION
double magnitude(
const int i_simd)
const{
145 return sqrt(
r[i_simd]*
r[i_simd] +
z[i_simd]*
z[i_simd]);
167 KOKKOS_INLINE_FUNCTION
void zero(){
168 for (
int i_simd = 0; i_simd<SIMD_SIZE; i_simd++){
176 KOKKOS_INLINE_FUNCTION
double magnitude(
const int i_simd)
const{
177 return sqrt(
r[i_simd]*
r[i_simd] +
z[i_simd]*
z[i_simd] +
phi[i_simd]*
phi[i_simd]);
Simd< double > r
Definition: simd.hpp:150
KOKKOS_INLINE_FUNCTION void operator=(const Trhs rhs)
Definition: simd.hpp:34
KOKKOS_INLINE_FUNCTION T operator[](int i) const
Definition: simd.hpp:28
KOKKOS_INLINE_FUNCTION Simd< T > operator/(const Simd< T > &lhs, const T rhs)
Definition: simd.hpp:125
KOKKOS_INLINE_FUNCTION Simd< T > operator/(const Simd< Trhs > &rhs) const
Definition: simd.hpp:67
KOKKOS_INLINE_FUNCTION SimdVector2D & x()
Definition: simd.hpp:156
KOKKOS_INLINE_FUNCTION double poloidal_magnitude(const int i_simd) const
Definition: simd.hpp:181
KOKKOS_INLINE_FUNCTION Simd< T > operator*(const Simd< T > &lhs, const T rhs)
Definition: simd.hpp:111
Simd< double > z
Definition: simd.hpp:141
T x[SIMD_SIZE]
Definition: simd.hpp:19
KOKKOS_INLINE_FUNCTION Simd< T > operator-() const
Definition: simd.hpp:39
Simd< double > phi
Definition: simd.hpp:152
KOKKOS_INLINE_FUNCTION const SimdVector2D & x() const
Definition: simd.hpp:162
Simd< double > z
Definition: simd.hpp:151
KOKKOS_INLINE_FUNCTION void zero()
Definition: simd.hpp:76
Simd< double > r
Definition: simd.hpp:140
KOKKOS_INLINE_FUNCTION Simd< T > operator-(const Simd< T > &lhs, const T rhs)
Definition: simd.hpp:83
KOKKOS_INLINE_FUNCTION void zero()
Definition: simd.hpp:167
KOKKOS_INLINE_FUNCTION Simd< T > operator+(const Simd< Trhs > &rhs) const
Definition: simd.hpp:53
KOKKOS_INLINE_FUNCTION double magnitude(const int i_simd) const
Definition: simd.hpp:176
KOKKOS_INLINE_FUNCTION double magnitude(const int i_simd) const
Definition: simd.hpp:144
KOKKOS_INLINE_FUNCTION Simd< T > operator*(const Simd< Trhs > &rhs) const
Definition: simd.hpp:60
KOKKOS_INLINE_FUNCTION Simd< T > operator+(const Simd< T > &lhs, const T rhs)
Definition: simd.hpp:97