24#ifndef PECLET_CORE_COMMON_PORTABLE_HPP
25#define PECLET_CORE_COMMON_PORTABLE_HPP
27#if !defined(PECLET_HD)
28#if defined(KOKKOS_VERSION)
31#define PECLET_HD KOKKOS_INLINE_FUNCTION
32#elif defined(__CUDACC__) || defined(__HIPCC__)
33#define PECLET_HD __host__ __device__ inline
35#define PECLET_HD inline
71 return a.
x * b.
x + a.
y * b.
y + a.
z * b.
z;
98 a.
w * b.
x + a.
x * b.
w + a.
y * b.
z - a.
z * b.
y, a.
w * b.
y - a.
x * b.
z + a.
y * b.
w + a.
z * b.
x,
99 a.
w * b.
z + a.
x * b.
y - a.
y * b.
x + a.
z * b.
w, a.
w * b.
w - a.
x * b.
x - a.
y * b.
y - a.
z * b.
z};
108#if defined(KOKKOS_VERSION)
111 return Kokkos::sqrt(v);
115 return Kokkos::fabs(v);
119 return Kokkos::fmax(a, b);
123 return Kokkos::fmin(a, b);
127 return Kokkos::pow(a, b);
131 return Kokkos::nearbyint(v);
135 return Kokkos::floor(v);
139 return Kokkos::fma(a, b, c);
152 return std::fmax(a, b);
156 return std::fmin(a, b);
160 return std::pow(a, b);
164 return std::nearbyint(v);
168 return std::floor(v);
172 return std::fma(a, b, c);
181 return (a < b) ? b : a;
PECLET_HD Real hdMin(Real a, Real b)
PECLET_HD Real hdPow(Real a, Real b)
PECLET_HD Real cmpMax(Real a, Real b)
Comparison-based max, <-ordered (ties keep the earlier operand) — std::max semantics,...
PECLET_HD Real hdFma(Real a, Real b, Real c)
PECLET_HD Real hdMax(Real a, Real b)
PECLET_HD Real hdFloor(Real v)
PECLET_HD Real hdNearbyint(Real v)
PECLET_HD Real hdAbs(Real v)
PECLET_HD Real hdSqrt(Real v)
PECLET_HD Quat< Real > mulQuat(Quat< Real > a, Quat< Real > b)
Hamilton product a ⊗ b in the (x, y, z, w) storage convention rotate uses, so rotate(mulQuat(a,...
PECLET_HD Vec3< Real > rotate(Quat< Real > q, Vec3< Real > v)
Rotate v by q.
PECLET_HD Vec3< Real > add(Vec3< Real > a, Vec3< Real > b)
PECLET_HD Real dot(Vec3< Real > a, Vec3< Real > b)
PECLET_HD Vec3< Real > invRotate(Quat< Real > q, Vec3< Real > v)
Rotate v by the conjugate of q — dem invRotateVector.
PECLET_HD Vec3< Real > sub(Vec3< Real > a, Vec3< Real > b)
PECLET_HD Vec3< Real > scale(Vec3< Real > a, Real s)
PECLET_HD Vec3< Real > cross(Vec3< Real > a, Vec3< Real > b)
double Real
Default host floating type. Device kernels may use float; conversions happen at the boundary.
Quaternion, {x, y, z, w} — dem's F4 ordering (dem_portable.hpp), NOT {w, x, y, z}.
Real-templated POD 3-vector — the geometry layer's point type on host and device.