8#ifndef DEM_PORTABLE_HPP
9#define DEM_PORTABLE_HPP
11#include <Kokkos_Core.hpp>
12#include <Kokkos_MathematicalFunctions.hpp>
16#include "peclet/core/geom/primitives.hpp"
30 return F3{a.
x + b.
x, a.
y + b.
y, a.
z + b.
z};
33 return F3{a.
x - b.
x, a.
y - b.
y, a.
z - b.
z};
36 return F3{a.
x * s, a.
y * s, a.
z * s};
39 return a.
x * b.
x + a.
y * b.
y + a.
z * b.
z;
41KOKKOS_INLINE_FUNCTION
float len3(
F3 v) {
42 return Kokkos::sqrt(
dot3(v, v));
45 return F3{a.
y * b.
z - a.
z * b.
y, a.
z * b.
x - a.
x * b.
z, a.
x * b.
y - a.
y * b.
x};
48 return F4{a.
y * b.
z - a.
z * b.
y, a.
z * b.
x - a.
x * b.
z, a.
x * b.
y - a.
y * b.
x, 0.0f};
53KOKKOS_INLINE_FUNCTION
F3 ldF3(
const V& v,
int i) {
54 return F3{v(i, 0), v(i, 1), v(i, 2)};
57KOKKOS_INLINE_FUNCTION
F4 ldF4(
const V& v,
int i) {
58 return F4{v(i, 0), v(i, 1), v(i, 2), v(i, 3)};
64 const F3 qv{q.
x, q.
y, q.
z};
72 return F4{-q.
x, -q.
y, -q.
z, q.
w};
76 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,
77 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};
104 return peclet::core::Vec3<float>{p.
x, p.
y, p.
z};
108 return peclet::core::geom::prim::Sphere<float>{params.
x}.eval(
toCoreVec(p));
115 return peclet::core::geom::prim::HollowCylinder<float>{params.
x, params.
y, params.
z}.eval(
120 return peclet::core::geom::prim::Box<float>{params.
x, params.
y, params.
z}.eval(
toCoreVec(p));
float sdfEval(F3 p, int type, F4 params)
float sdfHollowCylinder(F3 p, F4 params)
float sdfBox(F3 p, F4 params)
F3 invRotateVector(F4 q, F3 v)
F3 ldF3(const V &v, int i)
F3 rotateVector(F4 q, F3 v)
peclet::core::Vec3< float > toCoreVec(F3 p)
F3 -> core's Real-templated point type. Layout-identical; this is a type change, not a copy.
F4 ldF4(const V &v, int i)
float sdfSphere(F3 p, F4 params)