12#ifndef EBGEOMETRY_SURFACEREF_HPP
13#define EBGEOMETRY_SURFACEREF_HPP
43 static constexpr uint32_t
None = 0xFFFFFFFFU;
99namespace SurfaceDetail {
107template <
class S,
class T,
class =
void>
118template <
class S,
class T>
121 std::void_t<decltype(std::declval<const S&>().getNumSurfaces()),
122 decltype(std::declval<const S&>().closestSurface(std::declval<const Vec3T<T>&>()))>>
123 : std::is_same<std::decay_t<decltype(std::declval<const S&>().closestSurface(std::declval<const Vec3T<T>&>()))>,
139template <
class S,
class T>
142namespace SurfaceDetail {
150template <
class S,
class T,
class =
void>
161template <
class S,
class T>
164 std::void_t<decltype(std::declval<const S&>().getNumParts()),
165 decltype(std::declval<const S&>().closestPart(std::declval<const Vec3T<T>&>()))>>
181template <
class S,
class T>
184namespace SurfaceDetail {
194template <
class T,
class S>
199 if constexpr (hasParts<S, T>) {
200 return a_shape.getNumParts();
215template <
class T,
class S>
220 if constexpr (hasSurfaces<S, T>) {
221 return a_shape.getNumSurfaces();
240template <
class T,
class S>
246 if constexpr (hasSurfaces<S, T>) {
247 return a_shape.closestSurface(a_point);
255 if constexpr (hasParts<S, T>) {
256 surface.
m_part = a_shape.closestPart(a_point);
275template <
class T,
class S>
280 return SurfaceDetail::closestSurfaceOf<T>(a_shape, a_point);
GPU portability layer: host/device decoration macros and backend detection.
#define EBGEOMETRY_DEVICE_NOINLINE
Keep a function out of line in the device pass (CUDA/HIP); nothing on the host.
Definition EBGeometry_GPU.hpp:110
#define EBGEOMETRY_HOST_DEVICE
Mark a function as callable from both host and device code (no-op on host compilers).
Definition EBGeometry_GPU.hpp:80
#define EBGEOMETRY_HOST
Mark a function as callable from host code only (no-op on host compilers).
Definition EBGeometry_GPU.hpp:83
LabelId: the number of a label, typed by what it labels (SurfaceLabelId, MaterialLabelId).
uint32_t numPartsOf(const S &a_shape)
How many parts a shape has: its getNumParts(), 1 for a shape without parts.
Definition EBGeometry_SurfaceRef.hpp:197
SurfaceRef< T > closestSurfaceOf(const S &a_shape, const Vec3T< T > &a_point) noexcept
The surface of a shape that decides its value at a point: a container's closestSurface(),...
Definition EBGeometry_SurfaceRef.hpp:244
uint32_t numSurfacesOf(const S &a_shape)
How many surfaces a shape holds: a container's getNumSurfaces(), 1 for any other shape.
Definition EBGeometry_SurfaceRef.hpp:218
Declaration of 2D and 3D point/vector classes with templated precision, and free functions on them.
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:258
static constexpr Vec3T< T > zeros() noexcept
Return a vector with x = y = z = 0.
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_Affine.hpp:26
constexpr bool hasSurfaces
Whether a shape holds several surfaces: it has uint32_t getNumSurfaces() const (host) and SurfaceRef<...
Definition EBGeometry_SurfaceRef.hpp:140
constexpr bool hasParts
Whether a shape has several parts: it has uint32_t getNumParts() const (host) and uint32_t closestPar...
Definition EBGeometry_SurfaceRef.hpp:182
SurfaceRef< T > closestSurface(const S &a_shape, const Vec3T< T > &a_point) noexcept
The surface of any shape that decides its value at a point: a container's closestSurface() (a tape,...
Definition EBGeometry_SurfaceRef.hpp:278
Part detection: the primary template is a shape with one part.
Definition EBGeometry_SurfaceRef.hpp:152
Container detection: the primary template is a shape with one surface.
Definition EBGeometry_SurfaceRef.hpp:109
The surface that decides a shape's value at a point, as closestSurface() reports it.
Definition EBGeometry_SurfaceRef.hpp:39
Vec3T< T > m_localPoint
The point in the frame of the deepest shape reached: the primitive, or the container member,...
Definition EBGeometry_SurfaceRef.hpp:96
uint32_t m_ownerRegion
Set by a tape's region queries: the owner, the region the surface is reported from at the queried poi...
Definition EBGeometry_SurfaceRef.hpp:74
SurfaceLabelId m_surfaceLabel
Set by a tape: the surface's label, or none. A part labeled through face groups (SurfaceLabel(shape,...
Definition EBGeometry_SurfaceRef.hpp:59
uint32_t m_part
The part of the deepest shape reached, read from its own formula at the local point (see hasParts): a...
Definition EBGeometry_SurfaceRef.hpp:65
uint32_t m_leaf
Set by a tape: the leaf the surface belongs to, as Tape::closestLeaf() numbers it.
Definition EBGeometry_SurfaceRef.hpp:53
uint32_t m_neighborRegion
Set by a tape's region queries: the neighbor, the region across the surface from the owner at the que...
Definition EBGeometry_SurfaceRef.hpp:80
MaterialLabelId m_ownerMaterial
Set with the sides: the owner's material (m_ownerRegion's MaterialLabel()), or none.
Definition EBGeometry_SurfaceRef.hpp:85
uint32_t m_surface
The surface, numbered within the shape that was asked (across the scene when that is a tape).
Definition EBGeometry_SurfaceRef.hpp:48
MaterialLabelId m_neighborMaterial
Set with the sides: the neighbor's material (m_neighborRegion's), or none.
Definition EBGeometry_SurfaceRef.hpp:90
static constexpr uint32_t None
No surface (an empty shape), no leaf or no label.
Definition EBGeometry_SurfaceRef.hpp:43