EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Classes | Namespaces | Functions | Variables
EBGeometry_SurfaceRef.hpp File Reference

SurfaceRef: which surface of a shape decides its value at a point, and the container protocol that names one inside a shape holding several. More...

#include <cstdint>
#include <type_traits>
#include <utility>
#include "EBGeometry_GPU.hpp"
#include "EBGeometry_LabelId.hpp"
#include "EBGeometry_Vec.hpp"
Include dependency graph for EBGeometry_SurfaceRef.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  EBGeometry::SurfaceRef< T >
 The surface that decides a shape's value at a point, as closestSurface() reports it. More...
 
struct  EBGeometry::SurfaceDetail::HasSurfaces< S, T, class >
 Container detection: the primary template is a shape with one surface. More...
 
struct  EBGeometry::SurfaceDetail::HasSurfaces< S, T, std::void_t< decltype(std::declval< const S & >().getNumSurfaces()), decltype(std::declval< const S & >().closestSurface(std::declval< const Vec3T< T > & >()))> >
 Container detection: a shape with getNumSurfaces() and closestSurface(const Vec3T<T>&). More...
 
struct  EBGeometry::SurfaceDetail::HasParts< S, T, class >
 Part detection: the primary template is a shape with one part. More...
 
struct  EBGeometry::SurfaceDetail::HasParts< S, T, std::void_t< decltype(std::declval< const S & >().getNumParts()), decltype(std::declval< const S & >().closestPart(std::declval< const Vec3T< T > & >()))> >
 Part detection: a shape with getNumParts() and closestPart(const Vec3T<T>&). More...
 

Namespaces

namespace  EBGeometry
 Namespace containing all of EBGeometry's functionality.
 

Functions

template<class T , class S >
uint32_t EBGeometry::SurfaceDetail::numPartsOf (const S &a_shape)
 How many parts a shape has: its getNumParts(), 1 for a shape without parts.
 
template<class T , class S >
uint32_t EBGeometry::SurfaceDetail::numSurfacesOf (const S &a_shape)
 How many surfaces a shape holds: a container's getNumSurfaces(), 1 for any other shape.
 
template<class T , class S >
SurfaceRef< T > EBGeometry::SurfaceDetail::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(), surface 0 at the point itself for any other shape.
 
template<class T , class S >
SurfaceRef< T > EBGeometry::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, a BVH union, a sphere cloud), and for any other shape surface 0 with its part (see hasParts). For code templated on a shape. Callable on a device.
 

Variables

template<class S , class T >
constexpr bool EBGeometry::hasSurfaces = SurfaceDetail::HasSurfaces<S, T>::value
 Whether a shape holds several surfaces: it has uint32_t getNumSurfaces() const (host) and SurfaceRef<T> closestSurface(const Vec3T<T>&) const (host and device), which name its members.
 
template<class S , class T >
constexpr bool EBGeometry::hasParts = SurfaceDetail::HasParts<S, T>::value
 Whether a shape has several parts: it has uint32_t getNumParts() const (host) and uint32_t closestPart(const Vec3T<T>&) const (host and device), which reads the part from its own formula at a point in its frame: the term that decides the value there (a box's face, a cylinder's side or cap, a mesh's face). A part belongs to the shape, never to a composition of it: a face a difference cuts into two pieces is one part. A shape without them has one part, 0.
 

Detailed Description

SurfaceRef: which surface of a shape decides its value at a point, and the container protocol that names one inside a shape holding several.

Author
Robert Marskar

Function Documentation

◆ closestSurfaceOf()

template<class T , class S >
SurfaceRef< T > EBGeometry::SurfaceDetail::closestSurfaceOf ( const S &  a_shape,
const Vec3T< T > &  a_point 
)
inlinenoexcept

The surface of a shape that decides its value at a point: a container's closestSurface(), surface 0 at the point itself for any other shape.

Internal helper; not part of the public API. Out of line on a device, like the ray helpers: a container's closestSurface() is a traversal, and inlined at each call site it would be copied into every drill of every type.

Template Parameters
TFloating-point precision.
SShape type.
Parameters
[in]a_shapeThe shape.
[in]a_pointThe point, in the shape's frame.
Returns
The surface.

◆ numPartsOf()

template<class T , class S >
uint32_t EBGeometry::SurfaceDetail::numPartsOf ( const S &  a_shape)
inline

How many parts a shape has: its getNumParts(), 1 for a shape without parts.

Internal helper; not part of the public API. Host only.

Template Parameters
TFloating-point precision.
SShape type.
Parameters
[in]a_shapeThe shape.
Returns
The count.

◆ numSurfacesOf()

template<class T , class S >
uint32_t EBGeometry::SurfaceDetail::numSurfacesOf ( const S &  a_shape)
inline

How many surfaces a shape holds: a container's getNumSurfaces(), 1 for any other shape.

Internal helper; not part of the public API. Host only.

Template Parameters
TFloating-point precision.
SShape type.
Parameters
[in]a_shapeThe shape.
Returns
The count.