Block-Structured AMR Software Framework
 
Loading...
Searching...
No Matches
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

__host__ __device__ constexpr IndexTypeND () noexcept=default
 The default constructor.
 
__host__ __device__ IndexTypeND (const IntVectND< dim > &iv) noexcept
 Construct an IndexTypeND identical to an IntVectND.
 
template<class... Args, std::enable_if_t<(sizeof...(Args)+1==dim) &&IsConvertible_v< CellIndex, Args... >, int > = 0>
__host__ __device__ constexpr 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.
 
__host__ __device__ void set (int dir) noexcept
 Set IndexTypeND to be NODE based in direction dir.
 
__host__ __device__ void unset (int dir) noexcept
 Set IndexTypeND to be CELL based in direction dir.
 
__host__ __device__ bool test (int dir) const noexcept
 True if IndexTypeND is NODE based in direction dir.
 
__host__ __device__ constexpr void setall () noexcept
 Set NODE based in all directions.
 
__host__ __device__ void clear () noexcept
 Set CELL based in all directions.
 
__host__ __device__ bool any () const noexcept
 True if this IndexTypeND is NODE based in any direction.
 
__host__ __device__ bool ok () const noexcept
 True if IndexTypeND is valid.
 
__host__ __device__ void flip (int i) noexcept
 Change from CELL to NODE or NODE to CELL in direction dir.
 
__host__ __device__ bool operator== (const IndexTypeND &t) const noexcept
 True if IndexTypeNDs are identical.
 
__host__ __device__ bool operator!= (const IndexTypeND &t) const noexcept
 True if IndexTypeNDs are not identical.
 
__host__ __device__ bool operator< (const IndexTypeND &t) const noexcept
 
__host__ __device__ bool cellCentered () const noexcept
 True if the IndexTypeND is CELL based in all directions.
 
__host__ __device__ bool cellCentered (int dir) const noexcept
 True if the IndexTypeND is CELL based in dir-direction.
 
__host__ __device__ bool nodeCentered () const noexcept
 True if the IndexTypeND is NODE based in all directions.
 
__host__ __device__ bool nodeCentered (int dir) const noexcept
 True if the IndexTypeND is NODE based in dir-direction.
 
__host__ __device__ void setType (int dir, CellIndex t) noexcept
 Set IndexTypeND to CellIndex type t in direction dir.
 
__host__ __device__ constexpr CellIndex ixType (int dir) const noexcept
 Returns the CellIndex in direction dir.
 
__host__ __device__ int operator[] (int dir) const noexcept
 Return an integer representing the IndexTypeND in direction dir.
 
template<std::size_t i>
__host__ __device__ constexpr CellIndex get () const noexcept
 Returns the i'th CellIndex of the IndexTypeND. Used by structured bindings.
 
__host__ __device__ IntVectND< dim > ixType () const noexcept
 Fill an IntVectND of size dim with IndexTypeNDs.
 
__host__ __device__ IntVectND< dim > toIntVect () const noexcept
 Fill an IntVectND of size dim with IndexTypeNDs.
 
template<int new_dim>
__host__ __device__ 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.
 
template<int new_dim>
__host__ __device__ 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.
 
template<int new_dim>
__host__ __device__ 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.
 
__host__ __device__ constexpr unsigned int & getBits () noexcept
 Return the bit field representing the underlying data.
 
__host__ __device__ constexpr const unsigned int & getBits () const noexcept
 Return the bit field representing the underlying data.
 

Static Public Member Functions

__host__ static __device__ constexpr 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.
 
__host__ static __device__ constexpr 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.
 
__host__ static __device__ constexpr std::size_t size () noexcept
 Return the size of this IndexTypeND.
 
__host__ static __device__ constexpr int isize () noexcept
 Return the size of this IndexTypeND.
 

Static Private Member Functions

__host__ static __device__ constexpr unsigned int mask (int k) noexcept
 Returns 1<<k.
 

Private Attributes

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

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>
__host__ __device__ constexpr amrex::IndexTypeND< dim >::IndexTypeND ( )
constexprdefaultnoexcept

The default constructor.

◆ IndexTypeND() [2/3]

template<int dim>
__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>
__host__ __device__ constexpr 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>
__host__ __device__ bool amrex::IndexTypeND< dim >::any ( ) const
inlinenoexcept

True if this IndexTypeND is NODE based in any direction.

◆ cellCentered() [1/2]

template<int dim>
__host__ __device__ bool amrex::IndexTypeND< dim >::cellCentered ( ) const
inlinenoexcept

True if the IndexTypeND is CELL based in all directions.

◆ cellCentered() [2/2]

template<int dim>
__host__ __device__ bool amrex::IndexTypeND< dim >::cellCentered ( int  dir) const
inlinenoexcept

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

◆ clear()

template<int dim>
__host__ __device__ void amrex::IndexTypeND< dim >::clear ( )
inlinenoexcept

Set CELL based in all directions.

◆ expand()

template<int dim>
template<int new_dim>
__host__ __device__ 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>
__host__ __device__ 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>
__host__ __device__ constexpr 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>
__host__ __device__ constexpr const unsigned int & amrex::IndexTypeND< dim >::getBits ( ) const
inlineconstexprnoexcept

Return the bit field representing the underlying data.

◆ getBits() [2/2]

template<int dim>
__host__ __device__ constexpr unsigned int & amrex::IndexTypeND< dim >::getBits ( )
inlineconstexprnoexcept

Return the bit field representing the underlying data.

◆ isize()

template<int dim>
__host__ static __device__ constexpr int amrex::IndexTypeND< dim >::isize ( )
inlinestaticconstexprnoexcept

Return the size of this IndexTypeND.

◆ ixType() [1/2]

template<int dim>
__host__ __device__ IntVectND< dim > amrex::IndexTypeND< dim >::ixType ( ) const
inlinenoexcept

Fill an IntVectND of size dim with IndexTypeNDs.

◆ ixType() [2/2]

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

Returns the CellIndex in direction dir.

◆ mask()

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

Returns 1<<k.

◆ nodeCentered() [1/2]

template<int dim>
__host__ __device__ bool amrex::IndexTypeND< dim >::nodeCentered ( ) const
inlinenoexcept

True if the IndexTypeND is NODE based in all directions.

◆ nodeCentered() [2/2]

template<int dim>
__host__ __device__ bool amrex::IndexTypeND< dim >::nodeCentered ( int  dir) const
inlinenoexcept

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

◆ ok()

template<int dim>
__host__ __device__ bool amrex::IndexTypeND< dim >::ok ( ) const
inlinenoexcept

True if IndexTypeND is valid.

◆ operator!=()

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

True if IndexTypeNDs are not identical.

◆ operator<()

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

◆ operator==()

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

True if IndexTypeNDs are identical.

◆ operator[]()

template<int dim>
__host__ __device__ 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>
__host__ __device__ 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>
__host__ __device__ void amrex::IndexTypeND< dim >::set ( int  dir)
inlinenoexcept

Set IndexTypeND to be NODE based in direction dir.

◆ setall()

template<int dim>
__host__ __device__ constexpr void amrex::IndexTypeND< dim >::setall ( )
inlineconstexprnoexcept

Set NODE based in all directions.

◆ setType()

template<int dim>
__host__ __device__ 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>
__host__ __device__ 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>
__host__ static __device__ constexpr std::size_t amrex::IndexTypeND< dim >::size ( )
inlinestaticconstexprnoexcept

Return the size of this IndexTypeND.

◆ test()

template<int dim>
__host__ __device__ bool amrex::IndexTypeND< dim >::test ( int  dir) const
inlinenoexcept

True if IndexTypeND is NODE based in direction dir.

◆ TheCellType()

template<int dim>
__host__ static __device__ constexpr 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>
__host__ static __device__ constexpr 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>
__host__ __device__ IntVectND< dim > amrex::IndexTypeND< dim >::toIntVect ( ) const
inlinenoexcept

Fill an IntVectND of size dim with IndexTypeNDs.

◆ unset()

template<int dim>
__host__ __device__ 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: