2#ifndef AMREX_RealBox_H_
3#define AMREX_RealBox_H_
4#include <AMReX_Config.H>
38 RealBox (
const std::array<Real,AMREX_SPACEDIM>& a_lo,
39 const std::array<Real,AMREX_SPACEDIM>& a_hi)
noexcept;
53 const Real*
lo () const& noexcept {
return xlo; }
58 const Real*
hi () const& noexcept {
return xhi; }
63 Real lo (
int dir)
const noexcept {
return xlo[dir]; }
66 Real hi (
int dir)
const noexcept {
return xhi[dir]; }
69 Real length (
int dir)
const noexcept {
return xhi[dir]-xlo[dir]; }
77 void setLo (
int dir,
Real a_lo)
noexcept {
BL_ASSERT(dir >= 0 && dir < AMREX_SPACEDIM); xlo[dir] = a_lo; }
85 void setHi (
int dir,
Real a_hi)
noexcept {
BL_ASSERT(dir >= 0 && dir < AMREX_SPACEDIM); xhi[dir] = a_hi; }
88 bool ok () const noexcept {
90#if (AMREX_SPACEDIM > 1)
93#
if (AMREX_SPACEDIM > 2)
110 Real eps = 0.0) const noexcept {
111 return AMREX_D_TERM((xlo[0]-eps < point[0]) && (point[0] < xhi[0]+eps),
112 && (xlo[1]-eps < point[1]) && (point[1] < xhi[1]+eps),
113 && (xlo[2]-eps < point[2]) && (point[2] < xhi[2]+eps));
119 return AMREX_D_TERM((xlo[0]-eps < point.
x) && (point.
x < xhi[0]+eps),
120 && (xlo[1]-eps < point.
y) && (point.
y < xhi[1]+eps),
121 && (xlo[2]-eps < point.
z) && (point.
z < xhi[2]+eps));
132 Real eps = 0.0) const noexcept {
139 return ! (
AMREX_D_TERM((xlo[0] > bx.xhi[0]) || (xhi[0] < bx.xlo[0]),
140 || (xlo[1] > bx.xhi[1]) || (xhi[1] < bx.xlo[1]),
141 || (xlo[2] > bx.xhi[2]) || (xhi[2] < bx.xlo[2])));
154std::ostream&
operator<< (std::ostream&,
const RealBox&);
157std::istream&
operator>> (std::istream&, RealBox&);
162 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:28
__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:109
void setLo(int dir, Real a_lo) noexcept
Sets lo side in specified direction.
Definition AMReX_RealBox.H:77
constexpr RealBox() noexcept=default
The default constructor. Builds invalid RealBox.
void setLo(const Real *a_lo) noexcept
Sets lo side.
Definition AMReX_RealBox.H:71
__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:131
__host__ __device__ Real lo(int dir) const noexcept
Returns length in specified direction.
Definition AMReX_RealBox.H:63
void setHi(const Vector< Real > &a_hi) noexcept
Sets hi side.
Definition AMReX_RealBox.H:81
void setHi(int dir, Real a_hi) noexcept
Sets hi side in specified direction.
Definition AMReX_RealBox.H:85
__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:138
__host__ __device__ Real volume() const noexcept
Definition AMReX_RealBox.H:102
void setHi(const RealVect &a_hi) noexcept
Sets hi side.
Definition AMReX_RealBox.H:83
__host__ __device__ const Real * hi() &&=delete
__host__ __device__ const Real * lo() const &noexcept
Returns lo side.
Definition AMReX_RealBox.H:53
__host__ __device__ bool contains(XDim3 point, Real eps=0.0) const noexcept
Is the specified point contained in the RealBox?
Definition AMReX_RealBox.H:118
__host__ __device__ const Real * hi() const &noexcept
Returns hide side.
Definition AMReX_RealBox.H:58
__host__ __device__ Real length(int dir) const noexcept
Returns length in specified direction.
Definition AMReX_RealBox.H:69
__host__ __device__ Real hi(int dir) const noexcept
Returns hi side in specified direction.
Definition AMReX_RealBox.H:66
__host__ __device__ RealBox(Real x0, Real y0, Real z0, Real x1, Real y1, Real z1) noexcept
Explicit dimension specific constructors.
Definition AMReX_RealBox.H:48
void setLo(const RealVect &a_lo) noexcept
Sets lo side.
Definition AMReX_RealBox.H:75
void setLo(const Vector< Real > &a_lo) noexcept
Sets lo side.
Definition AMReX_RealBox.H:73
void setHi(const Real *a_hi) noexcept
Sets hi side.
Definition AMReX_RealBox.H:79
__host__ __device__ bool ok() const noexcept
Is the RealBox OK; i.e. does it have non-negative volume?
Definition AMReX_RealBox.H:88
__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:126
__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