SpECTRE  v2025.04.21
Neighbors< VolumeDim, IdType > Class Template Reference

Information about the neighbors of a host Element or Block in a particular direction. More...

#include <Neighbors.hpp>

Public Member Functions

 Neighbors (std::unordered_set< IdType > ids, std::unordered_map< size_t, OrientationMap< VolumeDim > > orientations, bool are_conforming)
 Construct with the ids, the orientation of the neighbors relative to the host, and whether the neighbors are conforming. More...
 
 Neighbors (std::unordered_set< IdType > ids, OrientationMap< VolumeDim > orientation)
 Construct with the ids and orientation of the neighbors relative to the host, assuming the neighbors are conforming. More...
 
 Neighbors (IdType id, OrientationMap< VolumeDim > orientation)
 Construct with the id and orientation of a single neighbor relative to the host, assuming the neighbor is conforming. More...
 
 Neighbors ()=default
 Default constructor for Charm++ serialization.
 
 Neighbors (const Neighbors &neighbor)=default
 
 Neighbors (Neighbors &&)=default
 
Neighborsoperator= (const Neighbors &rhs)=default
 
Neighborsoperator= (Neighbors &&)=default
 
const std::unordered_set< IdType > & ids () const
 
const std::unordered_map< size_t, OrientationMap< VolumeDim > > & orientations () const
 The orientations of the neighbors for each neighboring Block. More...
 
bool are_conforming () const
 Whether or not the block logical coordinates of the neighbors conform to those of the host (see domain::neighbor_is_conforming)
 
const OrientationMap< VolumeDim > & orientation (const IdType &id) const
 The orientation of a particular neighbor.
 
void set_ids_to (std::unordered_set< IdType > new_ids)
 Reset the ids of the neighbors. More...
 
void add_ids (std::unordered_set< IdType > additional_ids)
 Add ids of neighbors. More...
 
void pup (PUP::er &p)
 Serialization for Charm++.
 
size_t size () const
 The number of neighbors.
 
std::unordered_set< IdType >::iterator begin ()
 
std::unordered_set< IdType >::iterator end ()
 
std::unordered_set< IdType >::const_iterator begin () const
 
std::unordered_set< IdType >::const_iterator end () const
 
std::unordered_set< IdType >::const_iterator cbegin () const
 
std::unordered_set< IdType >::const_iterator cend () const
 

Detailed Description

template<size_t VolumeDim, typename IdType = ElementId<VolumeDim>>
class Neighbors< VolumeDim, IdType >

Information about the neighbors of a host Element or Block in a particular direction.

Template Parameters
VolumeDimthe volume dimension.
IdTypethe type of the Id of the neighbor (either ElementId or size_t for a Block)

Constructor & Destructor Documentation

◆ Neighbors() [1/3]

template<size_t VolumeDim, typename IdType = ElementId<VolumeDim>>
Neighbors< VolumeDim, IdType >::Neighbors ( std::unordered_set< IdType >  ids,
std::unordered_map< size_t, OrientationMap< VolumeDim > >  orientations,
bool  are_conforming 
)

Construct with the ids, the orientation of the neighbors relative to the host, and whether the neighbors are conforming.

Parameters
idsthe ids of the neighbors.
orientationsAn OrientationMap (which takes objects in the logical coordinate frame of the host and maps them to the logical coordinate frame of the neighbor) for each neighboring Block (Elements within a Block share the same orientation). The key of the unordered map is the Block ID.
are_conformingwhether or not the block logical coordinates of the neighbors conform to those of the host (see domain::neighbor_is_conforming)

◆ Neighbors() [2/3]

template<size_t VolumeDim, typename IdType = ElementId<VolumeDim>>
Neighbors< VolumeDim, IdType >::Neighbors ( std::unordered_set< IdType >  ids,
OrientationMap< VolumeDim >  orientation 
)

Construct with the ids and orientation of the neighbors relative to the host, assuming the neighbors are conforming.

Parameters
idsthe ids of the neighbors.
orientationThis OrientationMap takes objects in the logical coordinate frame of the host and maps them to the logical coordinate frame of the neighbor.

◆ Neighbors() [3/3]

template<size_t VolumeDim, typename IdType = ElementId<VolumeDim>>
Neighbors< VolumeDim, IdType >::Neighbors ( IdType  id,
OrientationMap< VolumeDim >  orientation 
)

Construct with the id and orientation of a single neighbor relative to the host, assuming the neighbor is conforming.

Parameters
idthe id of the neighbors.
orientationThis OrientationMap takes objects in the logical coordinate frame of the host Element and maps them to the logical coordinate frame of the neighbor Element.

Member Function Documentation

◆ add_ids()

template<size_t VolumeDim, typename IdType = ElementId<VolumeDim>>
void Neighbors< VolumeDim, IdType >::add_ids ( std::unordered_set< IdType >  additional_ids)

Add ids of neighbors.

Note
Adding an existing neighbor is allowed.
The additional ids must be from Blocks with the existing orientations.

◆ orientations()

template<size_t VolumeDim, typename IdType = ElementId<VolumeDim>>
const std::unordered_map< size_t, OrientationMap< VolumeDim > > & Neighbors< VolumeDim, IdType >::orientations ( ) const
inline

The orientations of the neighbors for each neighboring Block.

Note
All Elements within a Block share the same orientation.

◆ set_ids_to()

template<size_t VolumeDim, typename IdType = ElementId<VolumeDim>>
void Neighbors< VolumeDim, IdType >::set_ids_to ( std::unordered_set< IdType >  new_ids)

Reset the ids of the neighbors.

Note
This should only be called to reset Element Neighbors after h-refinement

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