Block-Structured AMR Software Framework
amrex::IndexTypeND< dim > Class Template Reference

Cell-Based or Node-Based Indices. More...

#include <AMReX_IndexType.H>

Inheritance diagram for amrex::IndexTypeND< dim >:
amrex::CellIndexEnum

Public Types

using value_type = CellIndex
 
- Public Types inherited from amrex::CellIndexEnum
enum  CellIndex { CELL = 0 , NODE = 1 }
 The cell index type: one of CELL or NODE. More...
 

Public Member Functions

constexpr AMREX_GPU_HOST_DEVICE IndexTypeND () noexcept=default
 The default constructor. More...
 
AMREX_GPU_HOST_DEVICE IndexTypeND (const IntVectND< dim > &iv) noexcept
 Construct an IndexTypeND identical to an IntVectND. More...
 
template<class... Args, std::enable_if_t<(sizeof...(Args)+1==dim) &&IsConvertible_v< CellIndex, Args... >, int > = 0>
constexpr AMREX_GPU_HOST_DEVICE IndexTypeND (CellIndex i, Args...js) noexcept
 Construct an IndexTypeND given an explicit CellIndex for each direction. The inputs for this constructor are N CellIndex, where N is equal to the number of dimensions of the IndexTypeND. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void set (int dir) noexcept
 Set IndexTypeND to be NODE based in direction dir. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void unset (int dir) noexcept
 Set IndexTypeND to be CELL based in direction dir. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool test (int dir) const noexcept
 True if IndexTypeND is NODE based in direction dir. More...
 
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE void setall () noexcept
 Set NODE based in all directions. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void clear () noexcept
 Set CELL based in all directions. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool any () const noexcept
 True if this IndexTypeND is NODE based in any direction. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool ok () const noexcept
 True if IndexTypeND is valid. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void flip (int i) noexcept
 Change from CELL to NODE or NODE to CELL in direction dir. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool operator== (const IndexTypeND &t) const noexcept
 True if IndexTypeNDs are identical. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool operator!= (const IndexTypeND &t) const noexcept
 True if IndexTypeNDs are not identical. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool operator< (const IndexTypeND &t) const noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool cellCentered () const noexcept
 True if the IndexTypeND is CELL based in all directions. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool cellCentered (int dir) const noexcept
 True if the IndexTypeND is CELL based in dir-direction. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool nodeCentered () const noexcept
 True if the IndexTypeND is NODE based in all directions. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool nodeCentered (int dir) const noexcept
 True if the IndexTypeND is NODE based in dir-direction. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void setType (int dir, CellIndex t) noexcept
 Set IndexTypeND to CellIndex type t in direction dir. More...
 
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE CellIndex ixType (int dir) const noexcept
 Returns the CellIndex in direction dir. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int operator[] (int dir) const noexcept
 Return an integer representing the IndexTypeND in direction dir. More...
 
template<std::size_t i>
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE CellIndex get () const noexcept
 Returns the i'th CellIndex of the IndexTypeND. Used by structured bindings. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > ixType () const noexcept
 Fill an IntVectND of size dim with IndexTypeNDs. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > toIntVect () const noexcept
 Fill an IntVectND of size dim with IndexTypeNDs. More...
 
template<int new_dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IndexTypeND< new_dim > shrink () const noexcept
 Returns a new IndexTypeND of size new_dim and assigns the first new_dim values of this IndexTypeND to it. More...
 
template<int new_dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IndexTypeND< new_dim > expand (CellIndex fill_extra=CellIndex::CELL) const noexcept
 Returns a new IndexTypeND of size new_dim and assigns all values of this IndexTypeND to it and fill_extra to the remaining elements. More...
 
template<int new_dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IndexTypeND< new_dim > resize (CellIndex fill_extra=CellIndex::CELL) const noexcept
 Returns a new IndexTypeND of size new_dim by either shrinking or expanding this IndexTypeND. More...
 
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE unsigned intgetBits () noexcept
 Return the bit field representing the underlying data. More...
 
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE const unsigned intgetBits () const noexcept
 Return the bit field representing the underlying data. More...
 

Static Public Member Functions

AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE IndexTypeND< dim > TheCellType () noexcept
 This static member function returns an IndexTypeND object of value IndexTypeND::CELL. It is provided as a convenience to our users when defining a Box all of whose faces should be of type IndexTypeND::CELL. More...
 
AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE IndexTypeND< dim > TheNodeType () noexcept
 This static member function returns an IndexTypeND object of value IndexTypeND::NODE. It is provided as a convenience to our users when defining a Box all of whose faces should be of type IndexTypeND::NODE. More...
 
AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE std::size_t size () noexcept
 Return the size of this IndexTypeND. More...
 
AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE int isize () noexcept
 Return the size of this IndexTypeND. More...
 

Static Private Member Functions

AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE unsigned int mask (int k) noexcept
 Returns 1<<k. More...
 

Private Attributes

unsigned int itype {0}
 An integer holding the CellIndex in bits 0 - dim-1. More...
 

Detailed Description

template<int dim>
class amrex::IndexTypeND< dim >

Cell-Based or Node-Based Indices.

The class IndexTypeND defines an index as being cell based or node (edge) based in each of the dim directions. This class defines an enumerated type CellIndex to be either CELL or NODE; i.e. each of the dim dimensions must be either CELL or NODE.

Member Typedef Documentation

◆ value_type

template<int dim>
using amrex::IndexTypeND< dim >::value_type = CellIndex

Constructor & Destructor Documentation

◆ IndexTypeND() [1/3]

template<int dim>
constexpr AMREX_GPU_HOST_DEVICE amrex::IndexTypeND< dim >::IndexTypeND ( )
constexprdefaultnoexcept

The default constructor.

◆ IndexTypeND() [2/3]

template<int dim>
AMREX_GPU_HOST_DEVICE amrex::IndexTypeND< dim >::IndexTypeND ( const IntVectND< dim > &  iv)
inlineexplicitnoexcept

Construct an IndexTypeND identical to an IntVectND.

◆ IndexTypeND() [3/3]

template<int dim>
template<class... Args, std::enable_if_t<(sizeof...(Args)+1==dim) &&IsConvertible_v< CellIndex, Args... >, int > = 0>
constexpr AMREX_GPU_HOST_DEVICE amrex::IndexTypeND< dim >::IndexTypeND ( CellIndex  i,
Args...  js 
)
inlineconstexprnoexcept

Construct an IndexTypeND given an explicit CellIndex for each direction. The inputs for this constructor are N CellIndex, where N is equal to the number of dimensions of the IndexTypeND.

Member Function Documentation

◆ any()

template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool amrex::IndexTypeND< dim >::any ( ) const
inlinenoexcept

True if this IndexTypeND is NODE based in any direction.

◆ cellCentered() [1/2]

template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool amrex::IndexTypeND< dim >::cellCentered ( ) const
inlinenoexcept

True if the IndexTypeND is CELL based in all directions.

◆ cellCentered() [2/2]

template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool amrex::IndexTypeND< dim >::cellCentered ( int  dir) const
inlinenoexcept

True if the IndexTypeND is CELL based in dir-direction.

◆ clear()

template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void amrex::IndexTypeND< dim >::clear ( )
inlinenoexcept

Set CELL based in all directions.

◆ expand()

template<int dim>
template<int new_dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IndexTypeND<new_dim> amrex::IndexTypeND< dim >::expand ( CellIndex  fill_extra = CellIndex::CELL) const
inlinenoexcept

Returns a new IndexTypeND of size new_dim and assigns all values of this IndexTypeND to it and fill_extra to the remaining elements.

◆ flip()

template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void amrex::IndexTypeND< dim >::flip ( int  i)
inlinenoexcept

Change from CELL to NODE or NODE to CELL in direction dir.

◆ get()

template<int dim>
template<std::size_t i>
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE CellIndex amrex::IndexTypeND< dim >::get ( ) const
inlineconstexprnoexcept

Returns the i'th CellIndex of the IndexTypeND. Used by structured bindings.

◆ getBits() [1/2]

template<int dim>
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE const unsigned int& amrex::IndexTypeND< dim >::getBits ( ) const
inlineconstexprnoexcept

Return the bit field representing the underlying data.

◆ getBits() [2/2]

template<int dim>
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE unsigned int& amrex::IndexTypeND< dim >::getBits ( )
inlineconstexprnoexcept

Return the bit field representing the underlying data.

◆ isize()

template<int dim>
AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE int amrex::IndexTypeND< dim >::isize ( )
inlinestaticconstexprnoexcept

Return the size of this IndexTypeND.

◆ ixType() [1/2]

template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND<dim> amrex::IndexTypeND< dim >::ixType ( ) const
inlinenoexcept

Fill an IntVectND of size dim with IndexTypeNDs.

◆ ixType() [2/2]

template<int dim>
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE CellIndex amrex::IndexTypeND< dim >::ixType ( int  dir) const
inlineconstexprnoexcept

Returns the CellIndex in direction dir.

◆ mask()

template<int dim>
AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE unsigned int amrex::IndexTypeND< dim >::mask ( int  k)
inlinestaticconstexprprivatenoexcept

Returns 1<<k.

◆ nodeCentered() [1/2]

template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool amrex::IndexTypeND< dim >::nodeCentered ( ) const
inlinenoexcept

True if the IndexTypeND is NODE based in all directions.

◆ nodeCentered() [2/2]

template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool amrex::IndexTypeND< dim >::nodeCentered ( int  dir) const
inlinenoexcept

True if the IndexTypeND is NODE based in dir-direction.

◆ ok()

template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool amrex::IndexTypeND< dim >::ok ( ) const
inlinenoexcept

True if IndexTypeND is valid.

◆ operator!=()

template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool amrex::IndexTypeND< dim >::operator!= ( const IndexTypeND< dim > &  t) const
inlinenoexcept

True if IndexTypeNDs are not identical.

◆ operator<()

template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool amrex::IndexTypeND< dim >::operator< ( const IndexTypeND< dim > &  t) const
inlinenoexcept

◆ operator==()

template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool amrex::IndexTypeND< dim >::operator== ( const IndexTypeND< dim > &  t) const
inlinenoexcept

True if IndexTypeNDs are identical.

◆ operator[]()

template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int amrex::IndexTypeND< dim >::operator[] ( int  dir) const
inlinenoexcept

Return an integer representing the IndexTypeND in direction dir.

◆ resize()

template<int dim>
template<int new_dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IndexTypeND<new_dim> amrex::IndexTypeND< dim >::resize ( CellIndex  fill_extra = CellIndex::CELL) const
inlinenoexcept

Returns a new IndexTypeND of size new_dim by either shrinking or expanding this IndexTypeND.

◆ set()

template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void amrex::IndexTypeND< dim >::set ( int  dir)
inlinenoexcept

Set IndexTypeND to be NODE based in direction dir.

◆ setall()

template<int dim>
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE void amrex::IndexTypeND< dim >::setall ( )
inlineconstexprnoexcept

Set NODE based in all directions.

◆ setType()

template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void amrex::IndexTypeND< dim >::setType ( int  dir,
CellIndex  t 
)
inlinenoexcept

Set IndexTypeND to CellIndex type t in direction dir.

◆ shrink()

template<int dim>
template<int new_dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IndexTypeND<new_dim> amrex::IndexTypeND< dim >::shrink ( ) const
inlinenoexcept

Returns a new IndexTypeND of size new_dim and assigns the first new_dim values of this IndexTypeND to it.

◆ size()

template<int dim>
AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE std::size_t amrex::IndexTypeND< dim >::size ( )
inlinestaticconstexprnoexcept

Return the size of this IndexTypeND.

◆ test()

template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool amrex::IndexTypeND< dim >::test ( int  dir) const
inlinenoexcept

True if IndexTypeND is NODE based in direction dir.

◆ TheCellType()

template<int dim>
AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE IndexTypeND<dim> amrex::IndexTypeND< dim >::TheCellType ( )
inlinestaticconstexprnoexcept

This static member function returns an IndexTypeND object of value IndexTypeND::CELL. It is provided as a convenience to our users when defining a Box all of whose faces should be of type IndexTypeND::CELL.

◆ TheNodeType()

template<int dim>
AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE IndexTypeND<dim> amrex::IndexTypeND< dim >::TheNodeType ( )
inlinestaticconstexprnoexcept

This static member function returns an IndexTypeND object of value IndexTypeND::NODE. It is provided as a convenience to our users when defining a Box all of whose faces should be of type IndexTypeND::NODE.

◆ toIntVect()

template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND<dim> amrex::IndexTypeND< dim >::toIntVect ( ) const
inlinenoexcept

Fill an IntVectND of size dim with IndexTypeNDs.

◆ unset()

template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void amrex::IndexTypeND< dim >::unset ( int  dir)
inlinenoexcept

Set IndexTypeND to be CELL based in direction dir.

Member Data Documentation

◆ itype

template<int dim>
unsigned int amrex::IndexTypeND< dim >::itype {0}
private

An integer holding the CellIndex in bits 0 - dim-1.


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