ThunderEgg  1.0.0
ThunderEgg::Orthant< D > Class Template Reference

An enum-style class that represents the octants of a cube. More...

#include <Orthant.h>

Classes

class  Range
 Range class for Orthant. More...
 

Public Member Functions

 Orthant (const unsigned char val_in)
 Create new Orthant<D> with given value. More...
 
 Orthant ()
 Default constructor that initializes the value to null().
 
size_t getIndex () const
 Get the integer value of the octant. More...
 
Orthant< D > getNbrOnSide (Side< D > s) const
 Return the octant that neighbors this octant on a particular side. More...
 
std::array< Side< D >, D > getInteriorSides () const
 Get the sides of the octant that are on the interior of the cube. More...
 
std::array< Side< D >, D > getExteriorSides () const
 Get the sides of the octant that are on the exterior of the cube. More...
 
bool isOnSide (Side< D > s) const
 Return whether or not the octant lies on a particular side of a cube. More...
 
bool isHigherOnAxis (size_t axis) const
 
bool isLowerOnAxis (size_t axis) const
 
Orthant< D - 1 > collapseOnAxis (size_t axis) const
 From the point of view of an axis, get orthant that this orthant lies on in the D-1 dimension. More...
 
bool operator== (const Orthant< D > &other) const
 Equals operator. More...
 
bool operator!= (const Orthant< D > &other) const
 Not Equals operator. More...
 
bool operator< (const Orthant< D > &other) const
 Less Tan operator. More...
 

Static Public Member Functions

static Orthant< D > null ()
 null value
 
static Orthant< 1 > lower ()
 Lower half of line.
 
static Orthant< 1 > upper ()
 Upper half of line.
 
static Orthant< 2 > sw ()
 South-West quadrant of square.
 
static Orthant< 2 > se ()
 South-East quadrant of square.
 
static Orthant< 2 > nw ()
 North-West quadrant of square.
 
static Orthant< 2 > ne ()
 North-East quadrant of square.
 
static Orthant< 3 > bsw ()
 Bottom-South-West octant of cube.
 
static Orthant< 3 > bse ()
 Bottom-South-East octant of cube.
 
static Orthant< 3 > bnw ()
 Bottom-North-West octant of cube.
 
static Orthant< 3 > bne ()
 Bottom-North-East octant of cube.
 
static Orthant< 3 > tsw ()
 Top-South-West octant of cube.
 
static Orthant< 3 > tse ()
 Top-South-East octant of cube.
 
static Orthant< 3 > tnw ()
 Top-North-West octant of cube.
 
static Orthant< 3 > tne ()
 Top-North-East octant of cube.
 
static Range getValues ()
 Get a range of values that can be iterated over. More...
 
static std::array< Orthant, num_orthants/2 > getValuesOnSide (Side< D > s)
 Get an array of all Orthant<D> values that lie on a particular side of the cube. More...
 

Static Public Attributes

static constexpr size_t num_orthants = 1 << D
 

Detailed Description

template<int D>
class ThunderEgg::Orthant< D >

An enum-style class that represents the octants of a cube.

The octants are named in the following way:

bse means Bottom-South-West, which is in the corner of where the bottom, south, and west sides meet.

Constructor & Destructor Documentation

◆ Orthant()

template<int D>
ThunderEgg::Orthant< D >::Orthant ( const unsigned char  val_in)
inlineexplicit

Create new Orthant<D> with given value.

Parameters
val_inthe value

Member Function Documentation

◆ collapseOnAxis()

template<int D>
Orthant<D - 1> ThunderEgg::Orthant< D >::collapseOnAxis ( size_t  axis) const
inline

From the point of view of an axis, get orthant that this orthant lies on in the D-1 dimension.

Parameters
axisthe axis
Returns
Orthant<D - 1> the resulting orthant

◆ getExteriorSides()

template<int D>
std::array<Side<D>, D> ThunderEgg::Orthant< D >::getExteriorSides ( ) const
inline

Get the sides of the octant that are on the exterior of the cube.

Returns
The sides of the octant that are on the exterior of the cube.

◆ getIndex()

template<int D>
size_t ThunderEgg::Orthant< D >::getIndex ( ) const
inline

Get the integer value of the octant.

Returns
The integer value.

◆ getInteriorSides()

template<int D>
std::array<Side<D>, D> ThunderEgg::Orthant< D >::getInteriorSides ( ) const
inline

Get the sides of the octant that are on the interior of the cube.

Returns
The sides of the octant that are on the interior of the cube.

◆ getNbrOnSide()

template<int D>
Orthant<D> ThunderEgg::Orthant< D >::getNbrOnSide ( Side< D >  s) const
inline

Return the octant that neighbors this octant on a particular side.

Parameters
sthe side of the octant that you want the neighbor of.
Returns
The octant that neighbors on that side.

◆ getValues()

template<int D>
static Range ThunderEgg::Orthant< D >::getValues ( )
inlinestatic

Get a range of values that can be iterated over.

Returns
Range the range of values

◆ getValuesOnSide()

template<int D>
static std::array<Orthant, num_orthants / 2> ThunderEgg::Orthant< D >::getValuesOnSide ( Side< D >  s)
inlinestatic

Get an array of all Orthant<D> values that lie on a particular side of the cube.

When the two axis that the side lies on are arranged in the following way, the octants are returned in the following order:

^ | | 2 | 3 |--—+--— | 0 | 1 +--------—>

Returns
The array.

◆ isOnSide()

template<int D>
bool ThunderEgg::Orthant< D >::isOnSide ( Side< D >  s) const
inline

Return whether or not the octant lies on a particular side of a cube.

Parameters
sthe side of the cube.j
Returns
Whether or not it lies on that side.

◆ operator!=()

template<int D>
bool ThunderEgg::Orthant< D >::operator!= ( const Orthant< D > &  other) const
inline

Not Equals operator.

Parameters
otherThe other octant.
Returns
Whether or not the value of this octant is not equal the value other octant.

◆ operator<()

template<int D>
bool ThunderEgg::Orthant< D >::operator< ( const Orthant< D > &  other) const
inline

Less Tan operator.

Parameters
otherThe other octant.
Returns
Whether or not the value of this octant is less than the value other octant.

◆ operator==()

template<int D>
bool ThunderEgg::Orthant< D >::operator== ( const Orthant< D > &  other) const
inline

Equals operator.

Parameters
otherThe other octant.
Returns
Whether or not the value of this octant equals the value other octant.

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