Public Member Functions | List of all members
SegmentId Class Reference

A SegmentId labels a segment of the interval [-1,1] and is used to identify the bounds of an Element in a Block in each dimension. More...

#include <SegmentId.hpp>

Public Member Functions

constexpr SegmentId () noexcept=default
 Default constructor needed for Charm++ serialization.
 
constexpr SegmentId (const SegmentId &segment_id) noexcept=default
 
constexpr SegmentId (SegmentId &&segment_id) noexcept=default
 
SegmentIdoperator= (const SegmentId &segment_id) noexcept=default
 
SegmentIdoperator= (SegmentId &&segment_id) noexcept=default
 
 SegmentId (size_t refinement_level, size_t index) noexcept
 
constexpr size_t refinement_level () const noexcept
 
constexpr size_t index () const noexcept
 
SegmentId id_of_parent () const noexcept
 
SegmentId id_of_child (Side side) const noexcept
 
SegmentId id_of_sibling () const noexcept
 The other child of the parent of this segment.
 
SegmentId id_of_abutting_nibling () const noexcept
 The child of the sibling of this segment that shares an endpoint with it.
 
Side side_of_sibling () const noexcept
 The side on which this segment shares an endpoint with its sibling.
 
SegmentId id_if_flipped () const noexcept
 The id this segment would have if the coordinate axis were flipped.
 
double endpoint (Side side) const noexcept
 The logical coordinate of the endpoint of the segment on the given Side.
 
double midpoint () const noexcept
 The logical coordinate of the midpoint of the segment.
 
bool overlaps (const SegmentId &other) const noexcept
 Does the segment overlap with another?
 
void pup (PUP::er &p) noexcept
 Serialization for Charm++.
 

Detailed Description

A SegmentId labels a segment of the interval [-1,1] and is used to identify the bounds of an Element in a Block in each dimension.

In \(d\) dimensions, \(d\) SegmentIds are used to identify an Element. In each dimension, a segment spans the subinterval \([-1 + 2 \frac{i}{N}, -1 + 2 \frac{i+1}{N}]\) of the logical coordinates of a Block, where \(i \)= index and \(N = 2^L\) where \(L\) = refinement_level.

SegmentId.svg
SegmentIds

In the figure, The index of segments increase from the lower side to the upper side in each dimension of a Block, while the refinement level increases as the segments are subdivided. For example, let the segment labeled self be on refinement level \(L\), with index \(i\). Its parent segment is on refinement level \(L-1\) with index \(\frac{i-1}{2}\). The children of self are on refinement level \(L+1\), and have index \(2i\) and \(2i+1\) for the lower and upper child respectively. Also labeled on the figure are the sibling and abutting nibling (child of sibling) of self. These relationships between segments are important for h-refinement, since in each dimension an Element can be flagged to split into its two children segments, or join with its sibling segment to form its parent segment. As refinement levels of neighboring elements are kept within one, in the direction of its sibling, a segment can only abut its sibling or abutting nibling, while on the opposite side, it can abut a segment on its level, the next-lower, or the next-higher level.


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