41#ifndef PECLET_CORE_GEOM_PRIMITIVES_HPP
42#define PECLET_CORE_GEOM_PRIMITIVES_HPP
58template <
class Shape,
class Real>
324 const Real db = bx * bx + by * by;
404template <
class Shape>
412 template <
class Real>
416 template <
class Real>
418 return shape.grad(p);
423template <
class Shape>
429 template <
class Real>
431 return -
shape.eval(p);
433 template <
class Real>
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 hdMax(Real a, Real b)
PECLET_HD Real hdAbs(Real v)
PECLET_HD Real hdSqrt(Real v)
PECLET_HD Vec3< Real > gradient(const Shape &s, Vec3< Real > p, Real h)
Generic outward normal by central differences — the fallback for any leaf until rung 2 supplies close...
Kokkos::View< T *, MemSpace > View
1D device array.
double Real
Default host floating type. Device kernels may use float; conversions happen at the boundary.
Real-templated POD 3-vector — the geometry layer's point type on host and device.
Axis-aligned solid box of half-extents (hx, hy, hz), centred on the origin.
PECLET_HD Real eval(Vec3< Real > p) const
static constexpr bool exact_distance
PECLET_HD Vec3< Real > grad(Vec3< Real > p) const
static constexpr bool analytic_gradient
Solid capsule about the y axis: a segment from (0,-halfLength,0) to (0,+halfLength,...
PECLET_HD Vec3< Real > grad(Vec3< Real > p) const
static constexpr bool analytic_gradient
static constexpr bool exact_distance
PECLET_HD Real eval(Vec3< Real > p) const
Negation: solid and void swap. Composes with any leaf (a container is the complement of a body).
PECLET_HD Vec3< Real > grad(Vec3< Real > p) const
static constexpr bool analytic_gradient
static constexpr bool exact_distance
PECLET_HD Real eval(Vec3< Real > p) const
Solid capped cone (frustum) about the y axis: radius rBottom at y = -halfHeight, radius rTop at y = +...
static constexpr bool exact_distance
PECLET_HD Real eval(Vec3< Real > p) const
static constexpr bool analytic_gradient
PECLET_HD Vec3< Real > grad(Vec3< Real > p) const
Finite differences over this leaf's own eval (the piecewise capped-cone form has no gradient worth ha...
Solid ellipsoid with semi-axes (rx, ry, rz), centred on the origin.
PECLET_HD Vec3< Real > grad(Vec3< Real > p) const
Finite differences over this leaf's own eval (the normalised implicit has no gradient worth hand-deri...
static constexpr bool analytic_gradient
static constexpr bool exact_distance
PECLET_HD Real eval(Vec3< Real > p) const
Solid tube wall about the z axis as a CSG intersection of half-spaces: max(r - rOuter,...
static constexpr bool exact_distance
PECLET_HD Real eval(Vec3< Real > p) const
PECLET_HD Real evalRZ(Real r, Real z) const
Cross-section form: r is the in-plane radius, z the axial coordinate.
PECLET_HD Vec3< Real > grad(Vec3< Real > p) const
static constexpr bool analytic_gradient
Solid tube wall about the y axis: outer radius rOuter, full height height, wall thickness thickness (...
static constexpr bool exact_distance
static constexpr bool analytic_gradient
PECLET_HD Vec3< Real > grad(Vec3< Real > p) const
PECLET_HD Real eval(Vec3< Real > p) const
Offset (rounded) shape: the inner solid grown outward by radius.
static constexpr bool exact_distance
typename Shape::value_type value_type
PECLET_HD Real eval(Vec3< Real > p) const
PECLET_HD Vec3< Real > grad(Vec3< Real > p) const
static constexpr bool analytic_gradient
Solid ball of radius radius, centred on the origin.
PECLET_HD Vec3< Real > grad(Vec3< Real > p) const
PECLET_HD Real eval(Vec3< Real > p) const
static constexpr bool exact_distance
static constexpr bool analytic_gradient
Solid superquadric with semi-axes (rx, ry, rz) and exponent e: the implicit |x/rx|^e + |y/ry|^e + |z/...
static constexpr bool exact_distance
PECLET_HD Real eval(Vec3< Real > p) const
static constexpr bool analytic_gradient
PECLET_HD Vec3< Real > grad(Vec3< Real > p) const
Finite differences over this leaf's own eval (the Taubin estimate has no gradient worth hand-deriving...
Solid torus with its axis along y: tube of minor radius minorRadius swept around a circle of radius m...
PECLET_HD Real eval(Vec3< Real > p) const
PECLET_HD Vec3< Real > grad(Vec3< Real > p) const
static constexpr bool exact_distance
static constexpr bool analytic_gradient