2#ifndef BL_ORIENTATION_H
3#define BL_ORIENTATION_H
4#include <AMReX_Config.H>
41 val(AMREX_SPACEDIM*side + dir)
43 BL_ASSERT(0 <= dir && dir < AMREX_SPACEDIM);
47 :
val(AMREX_SPACEDIM*side +
static_cast<int>(dir))
74 constexpr operator int () const noexcept {
return val; }
89 bool isLow () const noexcept {
return val < AMREX_SPACEDIM; }
92 bool isHigh () const noexcept {
return val >= AMREX_SPACEDIM; }
98 static constexpr int xlo () noexcept {
return 0; }
102 static constexpr int xhi () noexcept {
return AMREX_SPACEDIM; }
106 static constexpr int ylo () noexcept {
return 1; }
110 static constexpr int yhi () noexcept {
return 1+AMREX_SPACEDIM; }
114 static constexpr int zlo () noexcept {
return 2; }
118 static constexpr int zhi () noexcept {
return 2+AMREX_SPACEDIM; }
153 operator void* ()
noexcept {
return 0 <=
face &&
face < 2*AMREX_SPACEDIM ? this :
nullptr; }
#define BL_ASSERT(EX)
Definition AMReX_BLassert.H:39
#define AMREX_FORCE_INLINE
Definition AMReX_Extension.H:119
#define AMREX_GPU_HOST_DEVICE
Definition AMReX_GpuQualifiers.H:20
An Iterator over the Orientation of Faces of a Box.
Definition AMReX_Orientation.H:135
AMREX_GPU_HOST_DEVICE bool operator!=(const OrientationIter &oi) const noexcept
The inequality operator.
Definition AMReX_Orientation.H:183
AMREX_GPU_HOST_DEVICE OrientationIter(int _face) noexcept
Construct an iterator on the face.
Definition AMReX_Orientation.H:193
AMREX_GPU_HOST_DEVICE bool operator==(const OrientationIter &oi) const noexcept
The equality operator.
Definition AMReX_Orientation.H:177
int face
Definition AMReX_Orientation.H:190
AMREX_GPU_HOST_DEVICE OrientationIter & operator--() noexcept
Pre-decrement.
Definition AMReX_Orientation.H:159
AMREX_GPU_HOST_DEVICE void rewind() noexcept
Reset (rewind) the iterator.
Definition AMReX_Orientation.H:147
AMREX_GPU_HOST_DEVICE OrientationIter & operator++() noexcept
Pre-increment.
Definition AMReX_Orientation.H:162
AMREX_GPU_HOST_DEVICE bool isValid() const noexcept
Is the iterator valid?
Definition AMReX_Orientation.H:156
AMREX_GPU_HOST_DEVICE Orientation operator()() const noexcept
Return the orientation of the face.
Definition AMReX_Orientation.H:150
constexpr OrientationIter() noexcept=default
The default constructor.
Encapsulation of the Orientation of the Faces of a Box.
Definition AMReX_Orientation.H:29
AMREX_GPU_HOST_DEVICE bool operator==(const Orientation &o) const noexcept
Logical equality.
Definition AMReX_Orientation.H:52
AMREX_GPU_HOST_DEVICE bool operator!=(const Orientation &o) const noexcept
Logical inequality.
Definition AMReX_Orientation.H:55
AMREX_GPU_HOST_DEVICE Orientation flip() const noexcept
Return opposite orientation.
Definition AMReX_Orientation.H:77
AMREX_GPU_HOST_DEVICE constexpr Orientation(Direction dir, Side side) noexcept
Definition AMReX_Orientation.H:46
int val
The data.
Definition AMReX_Orientation.H:126
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE constexpr int yhi() noexcept
Int value of the y-hi-face.
Definition AMReX_Orientation.H:110
AMREX_GPU_HOST_DEVICE bool operator<(const Orientation &o) const noexcept
Less-than.
Definition AMReX_Orientation.H:58
constexpr Orientation() noexcept=default
The default constructor.
AMREX_GPU_HOST_DEVICE bool operator>(const Orientation &o) const noexcept
Greater-than.
Definition AMReX_Orientation.H:64
AMREX_GPU_HOST_DEVICE int coordDir() const noexcept
Returns the coordinate direction.
Definition AMReX_Orientation.H:83
AMREX_GPU_HOST_DEVICE Orientation(int v) noexcept
Used internally.
Definition AMReX_Orientation.H:123
AMREX_GPU_HOST_DEVICE bool isLow() const noexcept
Returns true if Orientation is low.
Definition AMReX_Orientation.H:89
Side
In each dimension a face is either low or high.
Definition AMReX_Orientation.H:34
@ low
Definition AMReX_Orientation.H:34
@ high
Definition AMReX_Orientation.H:34
friend std::istream & operator>>(std::istream &is, Orientation &o)
Read from an istream.
Definition AMReX_Orientation.cpp:26
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE constexpr int zlo() noexcept
Int value of the z-lo-face.
Definition AMReX_Orientation.H:114
AMREX_GPU_HOST_DEVICE Side faceDir() const noexcept
Returns the orientation of the face – low or high.
Definition AMReX_Orientation.H:86
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE constexpr int xhi() noexcept
Int value of the x-hi-face.
Definition AMReX_Orientation.H:102
AMREX_GPU_HOST_DEVICE bool isHigh() const noexcept
Returns true if Orientation is high.
Definition AMReX_Orientation.H:92
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE constexpr int xlo() noexcept
Int value of the x-lo-face.
Definition AMReX_Orientation.H:98
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE constexpr int zhi() noexcept
Int value of the z-hi-face.
Definition AMReX_Orientation.H:118
AMREX_GPU_HOST_DEVICE bool operator>=(const Orientation &o) const noexcept
Greater-than or equal.
Definition AMReX_Orientation.H:67
AMREX_GPU_HOST_DEVICE bool operator<=(const Orientation &o) const noexcept
Less-than or equal.
Definition AMReX_Orientation.H:61
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE constexpr int ylo() noexcept
Int value of the y-lo-face.
Definition AMReX_Orientation.H:106
Definition AMReX_Amr.cpp:49
Direction
Definition AMReX_Orientation.H:14
const int[]
Definition AMReX_BLProfiler.cpp:1664
std::ostream & operator<<(std::ostream &os, AmrMesh const &amr_mesh)
Definition AMReX_AmrMesh.cpp:1236