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

A domain's surface groups, read on the host or a device: each group a set of surfaces, given by its selectors (SurfaceSelector), that the caller gives one meaning (a boundary condition, an exchange with another code), and the group of a surface, so that a surface found at a point (Domain::closestSurface()) gives its group, and the group its meaning. More...

#include <EBGeometry_SurfaceGroups.hpp>

Inheritance diagram for EBGeometry::SurfaceGroups:
Inheritance graph
[legend]
Collaboration diagram for EBGeometry::SurfaceGroups:
Collaboration graph
[legend]

Classes

struct  Layout
 The arrays, as offsets: what a Domain stores. More...
 

Public Member Functions

 SurfaceGroups () noexcept=default
 No surface groups.
 
 SurfaceGroups (Pool &a_pool, const std::vector< SurfaceSelector > &a_selectors, const std::vector< uint32_t > &a_surfaceGroups, const uint32_t a_numSurfaceGroups)
 Build the selectors in a pool.
 
 SurfaceGroups (const Layout &a_layout, const PoolLocation &a_location) noexcept
 Rebuild a view from a stored layout and the location of the pool that holds it (as a Domain does).
 
const Layout & layout () const noexcept
 The arrays, as offsets.
 
uint32_t getNumSurfaceGroups () const noexcept
 How many surface groups there are.
 
uint32_t getNumSelectors () const noexcept
 How many selectors there are, over all surface groups.
 
const SurfaceSelector & getSelector (const uint32_t a_selector) const noexcept
 A selector.
 
uint32_t getSurfaceGroupOfSelector (const uint32_t a_selector) const noexcept
 The surface group of a selector.
 
template<class T >
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 remaining surfaces (SurfaceSelector::rest()) tried last.
 
SurfaceGroups rebasedView (const Pool &a_pool) const noexcept
 A view resolving against another pool of the selectors' mirror chain (see PoolHandle).
 
- Public Member Functions inherited from EBGeometry::PoolHandle
PoolLocation location () const noexcept
 Where this handle's arrays live.
 
bool isAttachedTo (const Pool &a_pool) const noexcept
 Check whether this handle's arrays were reserved from a_pool.
 

Static Public Attributes

static constexpr uint32_t None = 0xFFFFFFFFU
 No surface group: a surface no selector matches.
 

Additional Inherited Members

- Protected Member Functions inherited from EBGeometry::PoolHandle
 PoolHandle () noexcept=default
 An unset location; the first reservation attaches it.
 
 PoolHandle (const PoolLocation &a_location) noexcept
 Adopt a location, as a handle rebuilt from a stored layout does.
 
 PoolHandle (const PoolHandle &) noexcept=default
 Copy a handle, as a derived handle's copy does.
 
 PoolHandle (PoolHandle &&) noexcept=default
 Move a handle; the same as a copy.
 
PoolHandle & operator= (const PoolHandle &) noexcept=default
 Copy-assign a handle, as a derived handle's assignment does.
 
PoolHandle & operator= (PoolHandle &&) noexcept=default
 Move-assign a handle; the same as a copy.
 
 ~PoolHandle () noexcept=default
 Destructor; protected, since a PoolHandle exists only as the base of a handle.
 
void * base () noexcept
 The base address this handle's offsets resolve against; see PoolLocation::base().
 
const void * base () const noexcept
 The base address this handle's offsets resolve against, for read-only access.
 
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().
 
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::rebasedOnto().
 
void setLocation (const PoolLocation &a_location) noexcept
 Replace the location, for a view or a copy made by a derived handle.
 

Detailed Description

A domain's surface groups, read on the host or a device: each group a set of surfaces, given by its selectors (SurfaceSelector), that the caller gives one meaning (a boundary condition, an exchange with another code), and the group of a surface, so that a surface found at a point (Domain::closestSurface()) gives its group, and the group its meaning.

A view of the selectors in a pool: trivially copyable, a pool handle (see PoolHandle). A Domain builds it from a DomainSetup and returns it (Domain::surfaceGroups()); a renderer showing surface groups takes one built on its own (DomainSetup::buildSurfaceGroups()). The pool must outlive it. A default-constructed one has no surface groups. A surface is in the group of the first selector it matches, in the order they were added, the remaining surfaces' (SurfaceSelector::rest()) tried last. The groups' names and meanings are the caller's: the class holds numbers only.

Constructor & Destructor Documentation

◆ SurfaceGroups() [1/2]

EBGeometry::SurfaceGroups::SurfaceGroups ( Pool &  a_pool,
const std::vector< SurfaceSelector > &  a_selectors,
const std::vector< uint32_t > &  a_surfaceGroups,
const uint32_t  a_numSurfaceGroups 
)
inline

Build the selectors in a pool.

Aborts with a message, in every build, when the two lists differ in length or a selector's surface group is not below a_numSurfaceGroups.

Parameters
[in,out]a_poolPool to reserve the arrays from (not frozen).
[in]a_selectorsThe selectors, in order.
[in]a_surfaceGroupsEach selector's surface group.
[in]a_numSurfaceGroupsHow many surface groups there are.

◆ SurfaceGroups() [2/2]

EBGeometry::SurfaceGroups::SurfaceGroups ( const Layout &  a_layout,
const PoolLocation &  a_location 
)
inlinenoexcept

Rebuild a view from a stored layout and the location of the pool that holds it (as a Domain does).

Parameters
[in]a_layoutThe arrays.
[in]a_locationWhere they live.

Member Function Documentation

◆ getNumSelectors()

uint32_t EBGeometry::SurfaceGroups::getNumSelectors ( ) const
inlinenoexcept

How many selectors there are, over all surface groups.

Returns
The count.

◆ getNumSurfaceGroups()

uint32_t EBGeometry::SurfaceGroups::getNumSurfaceGroups ( ) const
inlinenoexcept

How many surface groups there are.

Returns
The count.

◆ getSelector()

const SurfaceSelector & EBGeometry::SurfaceGroups::getSelector ( const uint32_t  a_selector) const
inlinenoexcept

A selector.

Parameters
[in]a_selectorIts number (below getNumSelectors()).
Returns
The selector.

◆ getSurfaceGroupOfSelector()

uint32_t EBGeometry::SurfaceGroups::getSurfaceGroupOfSelector ( const uint32_t  a_selector) const
inlinenoexcept

The surface group of a selector.

Parameters
[in]a_selectorIts number (below getNumSelectors()).
Returns
The surface group.

◆ layout()

const Layout & EBGeometry::SurfaceGroups::layout ( ) const
inlinenoexcept

The arrays, as offsets.

Returns
The layout.

◆ rebasedView()

SurfaceGroups EBGeometry::SurfaceGroups::rebasedView ( const Pool &  a_pool) const
inlinenoexcept

A view resolving against another pool of the selectors' mirror chain (see PoolHandle).

Parameters
[in]a_poolThe pool, or a mirror of it.
Returns
The view.

◆ surfaceGroupOf()

template<class T >
uint32_t EBGeometry::SurfaceGroups::surfaceGroupOf ( const SurfaceRef< T > &  a_surface) const
inlinenoexcept

The surface group a surface point is in: that of the first selector it matches, those of the remaining surfaces (SurfaceSelector::rest()) tried last.

Template Parameters
TFloating-point precision.
Parameters
[in]a_surfaceThe surface, with its sides and their materials (Tape::closestSurface(p, subdomains, subdomain), firstRegionChange()).
Returns
The surface group, or None.

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