SpECTRE  v2024.09.29
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

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

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.

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 file: