2#ifndef AMREX_RealBox_H_
3#define AMREX_RealBox_H_
4#include <AMReX_Config.H>
36 RealBox (
const std::array<Real,AMREX_SPACEDIM>& a_lo,
37 const std::array<Real,AMREX_SPACEDIM>& a_hi)
noexcept;
51 const Real*
lo () const& noexcept {
return xlo; }
56 const Real*
hi () const& noexcept {
return xhi; }
61 Real lo (
int dir)
const noexcept {
return xlo[dir]; }
64 Real hi (
int dir)
const noexcept {
return xhi[dir]; }
67 Real length (
int dir)
const noexcept {
return xhi[dir]-xlo[dir]; }
75 void setLo (
int dir,
Real a_lo)
noexcept {
BL_ASSERT(dir >= 0 && dir < AMREX_SPACEDIM); xlo[dir] = a_lo; }
83 void setHi (
int dir,
Real a_hi)
noexcept {
BL_ASSERT(dir >= 0 && dir < AMREX_SPACEDIM); xhi[dir] = a_hi; }
86 bool ok () const noexcept {
88#if (AMREX_SPACEDIM > 1)
91#
if (AMREX_SPACEDIM > 2)
108 Real eps = 0.0) const noexcept {
109 return AMREX_D_TERM((xlo[0]-eps < point[0]) && (point[0] < xhi[0]+eps),
110 && (xlo[1]-eps < point[1]) && (point[1] < xhi[1]+eps),
111 && (xlo[2]-eps < point[2]) && (point[2] < xhi[2]+eps));
117 return AMREX_D_TERM((xlo[0]-eps < point.
x) && (point.
x < xhi[0]+eps),
118 && (xlo[1]-eps < point.
y) && (point.
y < xhi[1]+eps),
119 && (xlo[2]-eps < point.
z) && (point.
z < xhi[2]+eps));
130 Real eps = 0.0) const noexcept {
137 return ! (
AMREX_D_TERM((xlo[0] > bx.xhi[0]) || (xhi[0] < bx.xlo[0]),
138 || (xlo[1] > bx.xhi[1]) || (xhi[1] < bx.xlo[1]),
139 || (xlo[2] > bx.xhi[2]) || (xhi[2] < bx.xlo[2])));
152std::ostream&
operator<< (std::ostream&,
const RealBox&);
155std::istream&
operator>> (std::istream&, RealBox&);
160 Real eps = 0.0) noexcept;
#define BL_ASSERT(EX)
Definition AMReX_BLassert.H:39
#define AMREX_GPU_HOST_DEVICE
Definition AMReX_GpuQualifiers.H:20
#define AMREX_D_EXPR(a, b, c)
Definition AMReX_SPACE.H:170
#define AMREX_D_TERM(a, b, c)
Definition AMReX_SPACE.H:172
#define AMREX_D_DECL(a, b, c)
Definition AMReX_SPACE.H:171
A Box with real dimensions.
Definition AMReX_RealBox.H:26
__host__ __device__ bool contains(const Real *point, Real eps=0.0) const noexcept
Is the specified point contained in the RealBox?
Definition AMReX_RealBox.H:107
void setLo(int dir, Real a_lo) noexcept
Sets lo side in specified direction.
Definition AMReX_RealBox.H:75
constexpr RealBox() noexcept=default
The default constructor. Builds invalid RealBox.
void setLo(const Real *a_lo) noexcept
Sets lo side.
Definition AMReX_RealBox.H:69
__host__ __device__ bool contains(const RealBox &rb, Real eps=0.0) const noexcept
Is the specified RealBox contained in this RealBox?
Definition AMReX_RealBox.H:129
__host__ __device__ Real lo(int dir) const noexcept
Returns length in specified direction.
Definition AMReX_RealBox.H:61
void setHi(const Vector< Real > &a_hi) noexcept
Sets hi side.
Definition AMReX_RealBox.H:79
void setHi(int dir, Real a_hi) noexcept
Sets hi side in specified direction.
Definition AMReX_RealBox.H:83
__host__ __device__ const Real * lo() &&=delete
__host__ __device__ bool intersects(const RealBox &bx) const noexcept
Does the specified RealBox intersect with this RealBox?
Definition AMReX_RealBox.H:136
__host__ __device__ Real volume() const noexcept
Definition AMReX_RealBox.H:100
void setHi(const RealVect &a_hi) noexcept
Sets hi side.
Definition AMReX_RealBox.H:81
__host__ __device__ const Real * hi() &&=delete
__host__ __device__ const Real * lo() const &noexcept
Returns lo side.
Definition AMReX_RealBox.H:51
__host__ __device__ bool contains(XDim3 point, Real eps=0.0) const noexcept
Is the specified point contained in the RealBox?
Definition AMReX_RealBox.H:116
__host__ __device__ const Real * hi() const &noexcept
Returns hide side.
Definition AMReX_RealBox.H:56
__host__ __device__ Real length(int dir) const noexcept
Returns length in specified direction.
Definition AMReX_RealBox.H:67
__host__ __device__ Real hi(int dir) const noexcept
Returns hi side in specified direction.
Definition AMReX_RealBox.H:64
__host__ __device__ RealBox(Real x0, Real y0, Real z0, Real x1, Real y1, Real z1) noexcept
Explicit dimension specific constructors.
Definition AMReX_RealBox.H:46
void setLo(const RealVect &a_lo) noexcept
Sets lo side.
Definition AMReX_RealBox.H:73
void setLo(const Vector< Real > &a_lo) noexcept
Sets lo side.
Definition AMReX_RealBox.H:71
void setHi(const Real *a_hi) noexcept
Sets hi side.
Definition AMReX_RealBox.H:77
__host__ __device__ bool ok() const noexcept
Is the RealBox OK; i.e. does it have non-negative volume?
Definition AMReX_RealBox.H:86
__host__ __device__ bool contains(const RealVect &rv, Real eps=0.0) const noexcept
Is the specified RealVect contained in this RealBox?
Definition AMReX_RealBox.H:124
__host__ __device__ const Real * dataPtr() const noexcept
Definition AMReX_RealVect.H:485
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition AMReX_Vector.H:28
amrex_real Real
Floating Point Type for Fields.
Definition AMReX_REAL.H:79
Definition AMReX_Amr.cpp:49
BoxND< 3 > Box
Box is an alias for amrex::BoxND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:30
bool AlmostEqual(const RealBox &box1, const RealBox &box2, Real eps) noexcept
Check for equality of real boxes within a certain tolerance.
Definition AMReX_RealBox.cpp:84
std::istream & operator>>(std::istream &is, BoxND< dim > &bx)
Read from istream.
Definition AMReX_Box.H:1825
std::ostream & operator<<(std::ostream &os, AmrMesh const &amr_mesh)
Definition AMReX_AmrMesh.cpp:1237
Definition AMReX_Dim3.H:13
Real x
Definition AMReX_Dim3.H:13
Real z
Definition AMReX_Dim3.H:13
Real y
Definition AMReX_Dim3.H:13