SpECTRE  v2024.08.03
OrientationMap< VolumeDim > Class Template Reference

A mapping of the logical coordinate axes of a host to the logical coordinate axes of a neighbor of the host. More...

#include <OrientationMap.hpp>

Public Member Functions

 OrientationMap ()
 Creates an OrientationMap in an uninitialized state. More...
 
 OrientationMap (std::array< Direction< VolumeDim >, VolumeDim > mapped_directions)
 Mapped directions relative to the positive (Side::Upper) direction in each logical direction.
 
 OrientationMap (const std::array< Direction< VolumeDim >, VolumeDim > &directions_in_host, const std::array< Direction< VolumeDim >, VolumeDim > &directions_in_neighbor)
 
 OrientationMap (const OrientationMap &)=default
 
OrientationMapoperator= (const OrientationMap &)=default
 
 OrientationMap (OrientationMap &&)=default
 
OrientationMapoperator= (OrientationMap &&)=default
 
bool is_aligned () const
 True when mapped(Direction) == Direction.
 
size_t operator() (const size_t dim) const
 The corresponding dimension in the neighbor.
 
Direction< VolumeDim > operator() (const Direction< VolumeDim > &direction) const
 The corresponding direction in the neighbor.
 
std::array< SegmentId, VolumeDim > operator() (const std::array< SegmentId, VolumeDim > &segmentIds) const
 The corresponding SegmentIds in the neighbor.
 
Mesh< VolumeDim > operator() (const Mesh< VolumeDim > &mesh) const
 The corresponding Mesh in the neighbor.
 
template<typename T >
std::array< T, VolumeDim > permute_to_neighbor (const std::array< T, VolumeDim > &array_to_permute) const
 An array whose elements are permuted such that result[this->operator()(d)] = array_to_permute[d]. More...
 
template<typename T >
std::array< T, VolumeDim > permute_from_neighbor (const std::array< T, VolumeDim > &array_in_neighbor) const
 An array whose elements are permuted such that result[d] = array_in_neighbor[this->operator()(d)] More...
 
OrientationMap< VolumeDim > inverse_map () const
 The corresponding Orientation of the host in the frame of the neighbor.
 
void pup (PUP::er &p)
 Serialization for Charm++.
 

Static Public Member Functions

static OrientationMap< VolumeDim > create_aligned ()
 Creates an OrientationMap that is the identity map on directions. is_aligned() is true in this case.
 

Static Public Attributes

static constexpr uint16_t aligned_mask = 0b1000000000000000
 
static constexpr uint16_t version_mask = 0b0111000000000000
 

Friends

bool operator== (const OrientationMap &lhs, const OrientationMap &rhs)
 

Detailed Description

template<size_t VolumeDim>
class OrientationMap< VolumeDim >

A mapping of the logical coordinate axes of a host to the logical coordinate axes of a neighbor of the host.

Given a size_t dimension, a Direction, a SegmentId, or a Mesh of the host, an OrientationMap will give the corresponding value in the neighbor.

Template Parameters
VolumeDimthe dimension of the blocks.

See the tutorial for information on how OrientationMaps are used and constructed.

Constructor & Destructor Documentation

◆ OrientationMap()

template<size_t VolumeDim>
OrientationMap< VolumeDim >::OrientationMap ( )

Creates an OrientationMap in an uninitialized state.

This can be helpful for debugging code. If you would like the identity map, please use create_aligned().

Member Function Documentation

◆ permute_from_neighbor()

template<size_t VolumeDim>
template<typename T >
std::array< T, VolumeDim > OrientationMap< VolumeDim >::permute_from_neighbor ( const std::array< T, VolumeDim > &  array_in_neighbor) const

An array whose elements are permuted such that result[d] = array_in_neighbor[this->operator()(d)]

Note
the permutation depends only on how the dimension is mapped and ignores the side of the mapped direction.

◆ permute_to_neighbor()

template<size_t VolumeDim>
template<typename T >
std::array< T, VolumeDim > OrientationMap< VolumeDim >::permute_to_neighbor ( const std::array< T, VolumeDim > &  array_to_permute) const

An array whose elements are permuted such that result[this->operator()(d)] = array_to_permute[d].

Note
the permutation depends only on how the dimension is mapped and ignores the side of the mapped direction.

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