MaMiCo 1.2
Loading...
Searching...
No Matches
coupling::indexing::CellIndex< dim, traits > Class Template Reference
Collaboration diagram for coupling::indexing::CellIndex< dim, traits >:

Classes

class  IndexIterator
 

Public Types

using value_T
 

Public Member Functions

 CellIndex ()=default
 
 CellIndex (const CellIndex &ci)=default
 
 CellIndex (const value_T &i)
 
template<coupling::indexing::IndexTrait... converted_traits>
 operator CellIndex< dim, converted_traits... > () const
 
value_T get () const
 
CellIndexoperator++ ()
 
CellIndexoperator-- ()
 
bool operator== (const CellIndex &i) const
 
bool operator!= (const CellIndex &i) const
 
bool operator< (const CellIndex &i) const
 
bool operator<= (const CellIndex &i) const
 
bool operator> (const CellIndex &i) const
 
bool operator>= (const CellIndex &i) const
 
tarch::la::Vector< dim, double > getCellMidPoint () const
 

Static Public Member Functions

static constexpr bool checkIndexTraitOrder ()
 
static void setDomainParameters ()
 
static bool contains (const coupling::indexing::BaseIndex< dim > &index)
 
static IndexIterator begin ()
 
static IndexIterator end ()
 

Static Public Attributes

static BaseIndex< dim > lowerBoundary
 
static BaseIndex< dim > upperBoundary
 
static tarch::la::Vector< dim, unsigned int > numberCellsInDomain
 
static unsigned int linearNumberCellsInDomain
 
static tarch::la::Vector< dim, unsigned int > divisionFactor
 
static const char TNAME []
 

Private Member Functions

template<coupling::indexing::IndexTrait T1, coupling::indexing::IndexTrait... other_traits>
CellIndex< dim, other_traits... > getScalarCellIndex (int value)
 

Private Attributes

value_T _index
 

Detailed Description

template<unsigned int dim, coupling::indexing::IndexTrait... traits>
class coupling::indexing::CellIndex< dim, traits >

Index used to describe spatial location of a CouplingCell. Since various different ways of expressing this location are useful for different applications, IndexTraits are used to describe the context of this index.
All commonly used (arithmetic) operations on CouplingCell indices are provided as well as seamless conversion between any two ways of expressing these indices. (cf. user-defined conversion function below)

Template Parameters
dimnumber of dimensions of the coupled simulation
traits...index type parametrisation (expressed via IndexTraits) used by this specific index
Author
Felix Maurer

Member Typedef Documentation

◆ value_T

template<unsigned int dim, coupling::indexing::IndexTrait... traits>
using coupling::indexing::CellIndex< dim, traits >::value_T
Initial value:
std::conditional_t<(coupling::indexing::TraitOperations::is_same<coupling::indexing::IndexTrait::vector>(traits) or ...),
Definition Vector.h:24

The type of this CellIndex's underlying index representation.

Constructor & Destructor Documentation

◆ CellIndex()

template<unsigned int dim, coupling::indexing::IndexTrait... traits>
coupling::indexing::CellIndex< dim, traits >::CellIndex ( )
default

Constructors

Member Function Documentation

◆ checkIndexTraitOrder()

template<unsigned int dim, coupling::indexing::IndexTrait... traits>
static constexpr bool coupling::indexing::CellIndex< dim, traits >::checkIndexTraitOrder ( )
inlinestaticconstexpr

Check at compile time wether traits... is in proper order, i.e.

\forall i<j: traits[i] < traits[j]

where '<' is the standard operator< on enum classes. This means: vector < local < md2macro < noGhost

Note that this causes duplicate IndexTraits in 'traits' to be not accepted.

◆ contains()

template<unsigned int dim, coupling::indexing::IndexTrait... traits>
static bool coupling::indexing::CellIndex< dim, traits >::contains ( const coupling::indexing::BaseIndex< dim > & index)
inlinestatic

Checks if a given index is within the domain between this the lower and upper bound of this kind of indexing.

Parameters
CellIndexindex index to be checked
Returns
true iff i is within the domain of this CellIndex template specialisation.

◆ get()

template<unsigned int dim, coupling::indexing::IndexTrait... traits>
value_T coupling::indexing::CellIndex< dim, traits >::get ( ) const
inline

Access to primive value_T of this index. Should be used as sparingly as possible since it can lead to bugs preventable by using CellIndex instances instead of primitives.

Returns
unsigned integer/vector representation of this index.

◆ operator CellIndex< dim, converted_traits... >()

template<unsigned int dim, coupling::indexing::IndexTrait... traits>
template<coupling::indexing::IndexTrait... converted_traits>
coupling::indexing::CellIndex< dim, traits >::operator CellIndex< dim, converted_traits... > ( ) const

Conversion function: Convert to CellIndex of same dim but different IndexType.

Template Parameters
convert_to_TIndexType parameter of the CellIndex specialisation to convert to
Returns
CellIndex of different template parametrisation.

◆ operator++()

template<unsigned int dim, coupling::indexing::IndexTrait... traits>
CellIndex & coupling::indexing::CellIndex< dim, traits >::operator++ ( )
inline

Increments the index by one. Note that this does NOT increment indices in vector representation in all directions.

◆ operator--()

template<unsigned int dim, coupling::indexing::IndexTrait... traits>
CellIndex & coupling::indexing::CellIndex< dim, traits >::operator-- ( )
inline

Decrements the index by one. Note that this does NOT decrement indices in vector representation in all directions.

◆ setDomainParameters()

template<unsigned int dim, coupling::indexing::IndexTrait... traits>
static void coupling::indexing::CellIndex< dim, traits >::setDomainParameters ( )
inlinestatic

Initialises all static members dependant only on upperBoundary and lowerBoundary

Member Data Documentation

◆ divisionFactor

template<unsigned int dim, coupling::indexing::IndexTrait... traits>
tarch::la::Vector<dim, unsigned int> coupling::indexing::CellIndex< dim, traits >::divisionFactor
static

Used in scalar -> vector indexing conversion functions Initialised in setDomainParameters().

◆ linearNumberCellsInDomain

template<unsigned int dim, coupling::indexing::IndexTrait... traits>
unsigned int coupling::indexing::CellIndex< dim, traits >::linearNumberCellsInDomain
static

Number of cells in this indexing's domain. Same as numberCellsInDomain, but expressed as a scalar.

◆ lowerBoundary

template<unsigned int dim, coupling::indexing::IndexTrait... traits>
BaseIndex<dim> coupling::indexing::CellIndex< dim, traits >::lowerBoundary
static

Defines where this type of cell index starts counting. Read inclusively, e.g.: lowerBoundary = {1,2,3} means {1,2,3} is the first index contained in this type of cell index' domain.

◆ numberCellsInDomain

template<unsigned int dim, coupling::indexing::IndexTrait... traits>
tarch::la::Vector<dim, unsigned int> coupling::indexing::CellIndex< dim, traits >::numberCellsInDomain
static

Number of cells in this indexing's domain. The above declared boundaries are inclusive. Initialised in setDomainParameters().

◆ upperBoundary

template<unsigned int dim, coupling::indexing::IndexTrait... traits>
BaseIndex<dim> coupling::indexing::CellIndex< dim, traits >::upperBoundary
static

Defines where this type of cell index stops counting. Read inclusively, e.g.: upperBoundary = {4,5,6} means {4,5,6} is the last index contained in this type of cell index' domain.


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