Cell-Based or Node-Based Indices. More...
#include <AMReX_IndexType.H>
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 int & | getBits () noexcept |
Return the bit field representing the underlying data. More... | |
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE const unsigned int & | getBits () 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... | |
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.
using amrex::IndexTypeND< dim >::value_type = CellIndex |
|
constexprdefaultnoexcept |
The default constructor.
|
inlineexplicitnoexcept |
Construct an IndexTypeND identical to an IntVectND.
|
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.
|
inlinenoexcept |
True if this IndexTypeND is NODE based in any direction.
|
inlinenoexcept |
True if the IndexTypeND is CELL based in all directions.
|
inlinenoexcept |
True if the IndexTypeND is CELL based in dir-direction.
|
inlinenoexcept |
Set CELL based in all directions.
|
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.
|
inlinenoexcept |
Change from CELL to NODE or NODE to CELL in direction dir.
|
inlineconstexprnoexcept |
Returns the i'th CellIndex of the IndexTypeND. Used by structured bindings.
|
inlineconstexprnoexcept |
Return the bit field representing the underlying data.
|
inlineconstexprnoexcept |
Return the bit field representing the underlying data.
|
inlinestaticconstexprnoexcept |
Return the size of this IndexTypeND.
|
inlinenoexcept |
Fill an IntVectND of size dim with IndexTypeNDs.
|
inlineconstexprnoexcept |
Returns the CellIndex in direction dir.
|
inlinestaticconstexprprivatenoexcept |
Returns 1<<k.
|
inlinenoexcept |
True if the IndexTypeND is NODE based in all directions.
|
inlinenoexcept |
True if the IndexTypeND is NODE based in dir-direction.
|
inlinenoexcept |
True if IndexTypeND is valid.
|
inlinenoexcept |
True if IndexTypeNDs are not identical.
|
inlinenoexcept |
|
inlinenoexcept |
True if IndexTypeNDs are identical.
|
inlinenoexcept |
Return an integer representing the IndexTypeND in direction dir.
|
inlinenoexcept |
Returns a new IndexTypeND of size new_dim by either shrinking or expanding this IndexTypeND.
|
inlinenoexcept |
Set IndexTypeND to be NODE based in direction dir.
|
inlineconstexprnoexcept |
Set NODE based in all directions.
|
inlinenoexcept |
Set IndexTypeND to CellIndex type t in direction dir.
|
inlinenoexcept |
Returns a new IndexTypeND of size new_dim and assigns the first new_dim values of this IndexTypeND to it.
|
inlinestaticconstexprnoexcept |
Return the size of this IndexTypeND.
|
inlinenoexcept |
True if IndexTypeND is NODE based in direction dir.
|
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.
|
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.
|
inlinenoexcept |
Fill an IntVectND of size dim with IndexTypeNDs.
|
inlinenoexcept |
Set IndexTypeND to be CELL based in direction dir.
|
private |
An integer holding the CellIndex in bits 0 - dim-1.