11#ifndef EBGEOMETRY_DOMAIN_HPP
12#define EBGEOMETRY_DOMAIN_HPP
61template <
class T,
class... UserPrimitives>
86 this->
attach(a_tables,
"Domain");
156 touches(
const uint32_t a_first,
const uint32_t a_second)
const noexcept
202#if defined(EBGEOMETRY_DEVICE_COMPILE)
206 "Domain::signedDistances: room for %u values, the domain has %u functions",
207 unsigned(a_capacity),
208 unsigned(excluded + 1U));
214 for (uint32_t l = 0; l <= excluded; l++) {
218 m_tape.
regionDistances(a_point, [&](
const uint32_t a_region,
const T a_value) {
220 const uint32_t slot = (subdomain ==
Subdomains::None) ? excluded : subdomain;
222 a_values[slot] =
Math::min(a_values[slot], a_value);
229 uint32_t smallest = 0U;
231 for (uint32_t l = 0; l <= excluded; l++) {
232 if (a_values[l] < first) {
242 for (uint32_t l = 0; l <= excluded; l++) {
243 a_values[l] = T(0.5) * (a_values[l] - ((l == smallest) ? second : first));
254 template <std::
size_t N>
328 view.setLocation(this->
rebasedLocation(a_tablesPool, endByte,
"Domain"));
353template <
class T,
class... UserPrimitives>
DomainSetup: how a domain is made, as an editable value on the host (see Domain).
GPU portability layer: host/device decoration macros and backend detection.
#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
Utility macros for EBGeometry.
#define EBGEOMETRY_REQUIRE(cond,...)
Always-on check of user input and one-time host setup.
Definition EBGeometry_Macros.hpp:200
#define EBGEOMETRY_EXPECT(cond)
Runtime precondition assertion for EBGeometry.
Definition EBGeometry_Macros.hpp:269
Scalar helpers and numeric limits that compile for both host and device.
Growable bump arena for the GPU memory foundation.
Subdomains: the subdomain of each region of a tape, read on the host or a device.
SurfaceSelector and SurfaceGroups: which surfaces a downstream code groups under one meaning.
SurfaceRef: which surface of a shape decides its value at a point, and the container protocol that na...
Declaration of Tape, a composed object (an Expr) compiled into a pool, and its evaluator.
How a domain is made: its subdomains (the regions each computes in) and its surface groups (the selec...
Definition EBGeometry_DomainSetup.hpp:39
SurfaceGroups buildSurfaceGroups(Pool &a_pool) const
Build the surface groups.
Definition EBGeometry_DomainSetup.hpp:371
Subdomains buildSubdomains(Pool &a_pool, const uint32_t a_numRegions) const
Build the subdomains for a tape of a number of regions.
Definition EBGeometry_DomainSetup.hpp:350
A computational domain over a tape, for a downstream code (a solver EBGeometry does not provide): the...
Definition EBGeometry_Domain.hpp:63
uint32_t subdomainAt(const Vec3T< T > &a_point) const noexcept
The subdomain a point is in: that of the region it is in, or Excluded.
Definition EBGeometry_Domain.hpp:168
T signedDistance(const Vec3T< T > &a_point, const uint32_t a_subdomain) const noexcept
A subdomain's function (Tape::signedDistance(p, subdomains, subdomain)), or Excluded's,...
Definition EBGeometry_Domain.hpp:182
Domain rebasedView(const Pool &a_tapePool, const Pool &a_tablesPool) const
A view resolving against mirrors, the tape and the tables in two pools.
Definition EBGeometry_Domain.hpp:320
Tape< T, UserPrimitives... > TapeType
The tape it is built for.
Definition EBGeometry_Domain.hpp:68
Subdomains subdomains() const noexcept
The subdomains, for the tape's own queries that take them (Tape::firstSurface(ray,...
Definition EBGeometry_Domain.hpp:109
bool computesIn(const uint32_t a_region) const noexcept
Whether it computes in a region.
Definition EBGeometry_Domain.hpp:143
Domain rebasedView(const Pool &a_pool) const
A view resolving against mirrors, the tape and the tables in one pool.
Definition EBGeometry_Domain.hpp:307
uint32_t surfaceGroupOf(const SurfaceRef< T > &a_surface) const noexcept
A surface's group (SurfaceGroups::surfaceGroupOf()).
Definition EBGeometry_Domain.hpp:295
void signedDistances(const Vec3T< T > &a_point, T *a_values, const uint32_t a_capacity) const noexcept
Every subdomain's function at a point, and Excluded's, each region's function evaluated once: what a ...
Definition EBGeometry_Domain.hpp:198
uint32_t getNumSubdomainFunctions() const noexcept
How many functions signedDistances() gives: one per subdomain, then Excluded's.
Definition EBGeometry_Domain.hpp:131
SurfaceRef< T > closestSurface(const Vec3T< T > &a_point, const uint32_t a_subdomain) const noexcept
The surface of a subdomain closest to a point, with what is on its other side (Tape::closestSurface(p...
Definition EBGeometry_Domain.hpp:271
static constexpr uint32_t Excluded
What subdomainAt() gives for a point in the regions of no subdomain.
Definition EBGeometry_Domain.hpp:73
Domain(Pool &a_tables, const TapeType &a_tape, const DomainSetup &a_setup)
Build a domain over a tape.
Definition EBGeometry_Domain.hpp:84
bool touches(const uint32_t a_first, const uint32_t a_second) const noexcept
Whether a surface between two regions is one it must give a condition: one side or both in its region...
Definition EBGeometry_Domain.hpp:156
SurfaceGroups surfaceGroups() const noexcept
The surface groups.
Definition EBGeometry_Domain.hpp:120
const TapeType & tape() const noexcept
The tape the domain was built for.
Definition EBGeometry_Domain.hpp:98
SurfaceRole role(const SurfaceRef< T > &a_surface) const noexcept
What a surface is to the domain (Subdomains::role()).
Definition EBGeometry_Domain.hpp:283
void signedDistances(const Vec3T< T > &a_point, T(&a_values)[N]) const noexcept
Every subdomain's function at a point, and Excluded's, into an array whose size is the capacity (see ...
Definition EBGeometry_Domain.hpp:257
Base of every pool-resident handle: the one PoolLocation its arrays resolve against.
Definition EBGeometry_Pool.hpp:563
PoolLocation location() const noexcept
Where this handle's arrays live.
Definition EBGeometry_Pool.hpp:571
PoolLocation rebasedLocation(const Pool &a_pool, uint64_t a_endByte, const char *a_who) const noexcept
The location of this handle's arrays in another pool of its mirror chain; see PoolLocation::rebasedOn...
Definition EBGeometry_Pool.hpp:680
void attach(const Pool &a_pool, const char *a_who, const bool a_deviceWritten=false) noexcept
Follow a_pool, as the first reservation does; see PoolLocation::attach().
Definition EBGeometry_Pool.hpp:665
Growable bump arena over a MemoryResource.
Definition EBGeometry_Pool.hpp:205
The subdomains of a domain (see Domain), read on the host or a device: the subdomain of each region o...
Definition EBGeometry_Subdomains.hpp:51
static constexpr uint32_t None
No subdomain, or a region in no subdomain.
Definition EBGeometry_Subdomains.hpp:56
const Layout & layout() const noexcept
The arrays, as offsets.
Definition EBGeometry_Subdomains.hpp:121
uint32_t subdomainOf(const uint32_t a_region) const noexcept
The subdomain a region is in.
Definition EBGeometry_Subdomains.hpp:155
SurfaceRole role(const SurfaceRef< T > &a_surface) const noexcept
What a surface is to the subdomains at a point: from the regions on its two sides there,...
Definition EBGeometry_Subdomains.hpp:170
A domain's surface groups, read on the host or a device: each group a set of surfaces,...
Definition EBGeometry_SurfaceGroups.hpp:296
const Layout & layout() const noexcept
The arrays, as offsets.
Definition EBGeometry_SurfaceGroups.hpp:385
uint32_t surfaceGroupOf(const SurfaceRef< T > &a_surface) const noexcept
The surface group a surface point is in: that of the first selector it matches, those of the remainin...
Definition EBGeometry_SurfaceGroups.hpp:447
SurfaceRef< T > closestSurface(const Vec3T< T > &a_point, uint32_t a_region) const noexcept
The surface of a region that decides its function at a point: the region's own boundary,...
uint32_t region(const Vec3T< T > &a_point) const noexcept
The region a point is in: the last operand of the Overlays whose solid holds it (later operands are o...
void regionDistances(const Vec3T< T > &a_point, Visit &&a_visit) const noexcept
Every region's function at a point (signedDistance(point, region), the same values),...
T signedDistance(const Vec3T< T > &a_point) const noexcept
The object's value at a point: negative inside, positive outside, zero on the surface.
uint32_t getNumRegions() const noexcept
How many regions the object has: the background (region 0) and one per operand of its Overlays,...
Tape rebasedView(const Pool &a_pool) const noexcept
A view of this tape resolving against another pool of its mirror chain.
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:258
constexpr T max(const T &a_a, const T &a_b) noexcept
The larger of two values.
Definition EBGeometry_Math.hpp:61
constexpr T min(const T &a_a, const T &a_b) noexcept
The smaller of two values.
Definition EBGeometry_Math.hpp:44
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_Affine.hpp:26
SurfaceRole
What a surface is to a domain, at a point, from the regions on its two sides (see Subdomains::role())...
Definition EBGeometry_Subdomains.hpp:32
Numeric limits, with the meanings of the std::numeric_limits members of the same names.
Definition EBGeometry_Math.hpp:91
uint64_t endByte() const noexcept
One past the last byte this array occupies, measured from the pool base.
Definition EBGeometry_PODVector.hpp:264
The arrays, as offsets: what a Domain stores.
Definition EBGeometry_Subdomains.hpp:62
PODVector< uint32_t > m_table
The subdomain of each region, or None.
Definition EBGeometry_Subdomains.hpp:66
uint32_t m_numSubdomains
How many subdomains there are.
Definition EBGeometry_Subdomains.hpp:71
The arrays, as offsets: what a Domain stores.
Definition EBGeometry_SurfaceGroups.hpp:307
PODVector< uint32_t > m_groupOf
Each selector's surface group.
Definition EBGeometry_SurfaceGroups.hpp:316
The surface that decides a shape's value at a point, as closestSurface() reports it.
Definition EBGeometry_SurfaceRef.hpp:39