EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
EBGeometry::PoolLocation Struct Reference

Where a pool-resident descriptor resolves its offsets, and the rules for moving it. More...

#include <EBGeometry_Pool.hpp>

Collaboration diagram for EBGeometry::PoolLocation:
Collaboration graph
[legend]

Public Member Functions

void * base () const noexcept
 The base address the descriptor's offsets resolve against.
 
bool isAttachedTo (const Pool &a_pool) const noexcept
 Whether this location follows the given pool.
 
void attach (const Pool &a_pool, const char *a_who) noexcept
 Start following a pool, as the descriptor's first reservation from it does.
 
PoolLocation rebasedOnto (const Pool &a_pool, uint64_t a_endByte, const char *a_who) const noexcept
 The location of the same arrays in another pool of the same mirror chain.
 

Public Attributes

const PoolControl * m_control = nullptr
 Control block of the pool the descriptor follows; null for a snapshot or when unset.
 
void * m_base = nullptr
 Base address captured by a snapshot; null otherwise.
 
bool m_hostAccessible = false
 Whether host code may dereference a snapshot's base (managed or mapped memory).
 

Detailed Description

Where a pool-resident descriptor resolves its offsets, and the rules for moving it.

Every pool-resident handle (EBGeometry::DCEL::MeshT, EBGeometry::BVH::PackedBVH, and the classes built on them) holds one PoolLocation through its PoolHandle base, and delegates attaching, resolving and rebasing to it. It is in one of three states, decided by its value:

A descriptor changes location only through rebasedView(), which calls rebasedOnto(). Only handles hold a location (see PoolHandle): a descriptor stored inside another object's pool – a TriMeshSDF held in the primitive array of a EBGeometry::BVHUnion, for instance – is stored as its layout, and the outer handle pairs it with its own location.

Member Function Documentation

◆ attach()

void EBGeometry::PoolLocation::attach ( const Pool &  a_pool,
const char *  a_who 
)
inlinenoexcept

Start following a pool, as the descriptor's first reservation from it does.

Aborts, in every build, if the location already follows a different pool: all of a descriptor's arrays resolve against one base, so they must come from one pool.

Parameters
[in]a_poolPool to follow.
[in]a_whoName of the descriptor class, for the message.

◆ base()

void * EBGeometry::PoolLocation::base ( ) const
inlinenoexcept

The base address the descriptor's offsets resolve against.

On the host, the followed pool's current base, or a snapshot's base if host code may use it. On a device, the snapshot's base: a location that still follows a host pool means a host descriptor was copied into a kernel without rebasedView(), which EBGEOMETRY_EXPECT catches.

Returns
The base address.

◆ isAttachedTo()

bool EBGeometry::PoolLocation::isAttachedTo ( const Pool &  a_pool) const
inlinenoexcept

Whether this location follows the given pool.

Parameters
[in]a_poolPool to compare with.
Returns
True if the descriptor follows a_pool's control block.

◆ rebasedOnto()

PoolLocation EBGeometry::PoolLocation::rebasedOnto ( const Pool &  a_pool,
uint64_t  a_endByte,
const char *  a_who 
) const
inlinenoexcept

The location of the same arrays in another pool of the same mirror chain.

The descriptor must follow a pool (not be a snapshot or unset), a_pool must belong to the same mirror chain – the pool itself, one of its mirrors, or a mirror of a mirror – and the descriptor's arrays must fit inside it. Each is checked in every build. A device-accessible a_pool, which must be frozen so its base cannot move, gives a snapshot; a host pool gives a location that follows it.

Parameters
[in]a_poolPool to resolve against.
[in]a_endByteFirst byte past the descriptor's last array.
[in]a_whoName of the descriptor class, for the messages.
Returns
The new location.

The documentation for this struct was generated from the following file: