Block-Structured AMR Software Framework
amrex::IndexType Class Reference

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

#include <AMReX_IndexType.H>

Public Types

enum  CellIndex { CELL = 0 , NODE = 1 }
 The cell index type: one of CELL or NODE. More...
 

Public Member Functions

constexpr AMREX_GPU_HOST_DEVICE IndexType () noexcept=default
 The default constructor. More...
 
AMREX_GPU_HOST_DEVICE IndexType (const IntVect &iv) noexcept
 Construct an IndexType identical to an IntVect. More...
 
constexpr AMREX_GPU_HOST_DEVICE IndexType (AMREX_D_DECL(CellIndex i, CellIndex j, CellIndex k)) noexcept
 Construct an IndexType given an explicit CellIndex for each direction. AMREX_D_DECL is a macro that sets the constructor to take AMREX_SPACEDIM arguments. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void set (int dir) noexcept
 Set IndexType to be NODE based in direction dir. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void unset (int dir) noexcept
 Set IndexType to be CELL based in direction dir. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool test (int dir) const noexcept
 True if IndexType is NODE based in direction dir. More...
 
AMREX_GPU_HOST_DEVICE 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 IndexType is NODE based in any direction. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool ok () const noexcept
 True if IndexType 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 IndexType &t) const noexcept
 True if IndexTypes are identical. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool operator!= (const IndexType &t) const noexcept
 True if IndexTypes are not identical. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool operator< (const IndexType &t) const noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool cellCentered () const noexcept
 True if the IndexType is CELL based in all directions. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool cellCentered (int dir) const noexcept
 True if the IndexType is CELL based in dir-direction. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool nodeCentered () const noexcept
 True if the IndexType is NODE based in all directions. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool nodeCentered (int dir) const noexcept
 True if the IndexType is NODE based in dir-direction. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void setType (int dir, CellIndex t) noexcept
 Set IndexType to CellIndex type t in direction dir. More...
 
AMREX_GPU_HOST_DEVICE 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 IndexType in direction dir. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVect ixType () const noexcept
 Fill an IntVect of size AMREX_SPACEDIM with IndexTypes. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVect toIntVect () const noexcept
 Fill an IntVect of size AMREX_SPACEDIM with IndexTypes. More...
 

Static Public Member Functions

AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE IndexType TheCellType () noexcept
 This static member function returns an IndexType object of value IndexType::CELL. It is provided as a convenience to our users when defining a Box all of whose faces should be of type IndexType::CELL. More...
 
AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE IndexType TheNodeType () noexcept
 This static member function returns an IndexType object of value IndexType::NODE. It is provided as a convenience to our users when defining a Box all of whose faces should be of type IndexType::NODE. More...
 

Static Private Member Functions

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

Private Attributes

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

Friends

MPI_Datatype ParallelDescriptor::Mpi_typemap ()
 

Detailed Description

Cell-Based or Node-Based Indices.

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

Member Enumeration Documentation

◆ CellIndex

The cell index type: one of CELL or NODE.

Enumerator
CELL 
NODE 

Constructor & Destructor Documentation

◆ IndexType() [1/3]

constexpr AMREX_GPU_HOST_DEVICE amrex::IndexType::IndexType ( )
constexprdefaultnoexcept

The default constructor.

◆ IndexType() [2/3]

AMREX_GPU_HOST_DEVICE amrex::IndexType::IndexType ( const IntVect iv)
inlineexplicitnoexcept

Construct an IndexType identical to an IntVect.

◆ IndexType() [3/3]

constexpr AMREX_GPU_HOST_DEVICE amrex::IndexType::IndexType ( AMREX_D_DECL(CellIndex i, CellIndex j, CellIndex k)  )
inlineconstexprnoexcept

Construct an IndexType given an explicit CellIndex for each direction. AMREX_D_DECL is a macro that sets the constructor to take AMREX_SPACEDIM arguments.

Member Function Documentation

◆ any()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool amrex::IndexType::any ( ) const
inlinenoexcept

True if this IndexType is NODE based in any direction.

◆ cellCentered() [1/2]

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool amrex::IndexType::cellCentered ( ) const
inlinenoexcept

True if the IndexType is CELL based in all directions.

◆ cellCentered() [2/2]

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool amrex::IndexType::cellCentered ( int  dir) const
inlinenoexcept

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

◆ clear()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void amrex::IndexType::clear ( )
inlinenoexcept

Set CELL based in all directions.

◆ flip()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void amrex::IndexType::flip ( int  i)
inlinenoexcept

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

◆ ixType() [1/2]

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVect amrex::IndexType::ixType ( ) const
inlinenoexcept

Fill an IntVect of size AMREX_SPACEDIM with IndexTypes.

◆ ixType() [2/2]

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE CellIndex amrex::IndexType::ixType ( int  dir) const
inlinenoexcept

Returns the CellIndex in direction dir.

◆ mask()

AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE int amrex::IndexType::mask ( int  k)
inlinestaticprivatenoexcept

Returns 1<<k.

◆ nodeCentered() [1/2]

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool amrex::IndexType::nodeCentered ( ) const
inlinenoexcept

True if the IndexType is NODE based in all directions.

◆ nodeCentered() [2/2]

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool amrex::IndexType::nodeCentered ( int  dir) const
inlinenoexcept

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

◆ ok()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool amrex::IndexType::ok ( ) const
inlinenoexcept

True if IndexType is valid.

◆ operator!=()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool amrex::IndexType::operator!= ( const IndexType t) const
inlinenoexcept

True if IndexTypes are not identical.

◆ operator<()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool amrex::IndexType::operator< ( const IndexType t) const
inlinenoexcept

◆ operator==()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool amrex::IndexType::operator== ( const IndexType t) const
inlinenoexcept

True if IndexTypes are identical.

◆ operator[]()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int amrex::IndexType::operator[] ( int  dir) const
inlinenoexcept

Return an integer representing the IndexType in direction dir.

◆ set()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void amrex::IndexType::set ( int  dir)
inlinenoexcept

Set IndexType to be NODE based in direction dir.

◆ setall()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void amrex::IndexType::setall ( )
inlinenoexcept

Set NODE based in all directions.

◆ setType()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void amrex::IndexType::setType ( int  dir,
CellIndex  t 
)
inlinenoexcept

Set IndexType to CellIndex type t in direction dir.

◆ test()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool amrex::IndexType::test ( int  dir) const
inlinenoexcept

True if IndexType is NODE based in direction dir.

◆ TheCellType()

AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE IndexType amrex::IndexType::TheCellType ( )
inlinestaticconstexprnoexcept

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

◆ TheNodeType()

AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE IndexType amrex::IndexType::TheNodeType ( )
inlinestaticconstexprnoexcept

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

◆ toIntVect()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVect amrex::IndexType::toIntVect ( ) const
inlinenoexcept

Fill an IntVect of size AMREX_SPACEDIM with IndexTypes.

◆ unset()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void amrex::IndexType::unset ( int  dir)
inlinenoexcept

Set IndexType to be CELL based in direction dir.

Friends And Related Function Documentation

◆ ParallelDescriptor::Mpi_typemap

Member Data Documentation

◆ itype

unsigned int amrex::IndexType::itype {0}
private

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


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