4#include <AMReX_Config.H>
28using Box = BoxND<AMREX_SPACEDIM>;
100 template <
typename T>
101 requires ( 1<=dim && dim<=3 )
104 : smallend(IntVectShrink<dim>(a.
begin)),
105 bigend(IntVectShrink<dim>(a.
end) - 1)
120 int smallEnd (
int dir)
const&
noexcept {
return smallend[dir]; }
132 int bigEnd (
int dir)
const noexcept {
return bigend[dir]; }
150 return bigend - smallend + 1;
157 return bigend - smallend + 1;
162 int length (
int dir)
const noexcept {
return bigend[dir] - smallend[dir] + 1; }
166 requires (1 <= dim && dim <= 3)
169 return {{len3d.
x, len3d.
y, len3d.
z}};
174 requires (1 <= dim && dim <= 3)
176 Dim3 lo3d = smallend.dim3(0);
177 return {{lo3d.
x, lo3d.
y, lo3d.
z}};
182 requires (1 <= dim && dim <= 3)
184 Dim3 hi3d = bigend.dim3(0);
185 return {{hi3d.
x, hi3d.
y, hi3d.
z}};
190 const int*
loVect () const& noexcept {
return smallend.getVect(); }
195 const int*
hiVect () const& noexcept {
return bigend.getVect(); }
202 const int dir = face.coordDir();
203 return face.isLow() ? smallend[dir] : bigend[dir];
212 bool ok () const noexcept {
return bigend.allGE(smallend) && btype.ok(); }
217 return p.allGE(smallend) && p.allLE(bigend);
223 requires (1 <= dim && dim <= 3)
232 requires (1 <= dim && dim <= 3)
234 Dim3 p3d{.
x = i, .y = j, .z = k};
245 return b.smallend.allGE(smallend) && b.bigend.allLE(bigend);
251 return p.allGT(smallend) && p.allLT(bigend);
262 return b.smallend.allGT(smallend) && b.bigend.allLT(bigend);
268 requires (1 <= dim && dim <= 3)
277 requires (1 <= dim && dim <= 3)
279 Dim3 p3d{.
x = i, .y = j, .z = k};
297 return length() == b.length();
306 bool operator== (
const BoxND& b)
const noexcept {
return smallend == b.smallend && bigend == b.bigend && b.btype == btype; }
315 return btype < rhs.btype ||
316 ((btype == rhs.btype) &&
317 ( (smallend < rhs.smallend) ||
318 ((smallend == rhs.smallend) && (bigend < rhs.bigend)) ));
322 return !(rhs < *
this);
330 return !(*
this < rhs);
339 void checkOverflow ()
const {
341 for (
int i = 0; i < dim; ++i) {
342 auto lo =
static_cast<Long>(smallend[i]);
343 auto hi =
static_cast<Long>(bigend[i]);
344 Long len = hi - lo + 1;
346 "Overflow when computing length of box");
349 for (
int i = 1; i < dim; ++i) {
352 num_pts <= std::numeric_limits<Long>::max() / len,
353 "Overflow when computing numPts of box");
365#if defined(AMREX_DEBUG) || defined(AMREX_USE_ASSERTION)
370 for (
int i = 1; i < dim; ++i) {
386 auto num_pts =
static_cast<double>(
length(0));
387 for (
int i = 1; i < dim; ++i) {
388 num_pts *=
static_cast<double>(
length(i));
404 auto num_pts =
static_cast<Long>(
length(0)-btype[0]);
405 for (
int i = 1; i < dim; ++i) {
406 num_pts *=
static_cast<Long>(
length(i)-btype[i]);
422 for (
int i = 1; i < dim; i++)
448 for (
int i = 1; i < dim; i++)
482 requires (1 <= N && N <= 3)
491 BoxND&
setSmall (
int dir,
int sm_index)
noexcept { smallend.setVal(dir,sm_index);
return *
this; }
499 BoxND&
setBig (
int dir,
int bg_index)
noexcept { bigend.setVal(dir,bg_index);
return *
this; }
509 int n_cells = 1) noexcept;
517 BoxND&
shift (
int dir,
int nzones)
noexcept { smallend.shift(dir,nzones); bigend.shift(dir,nzones);
return *
this; }
594 smallend.max(rhs.smallend);
595 bigend.min(rhs.bigend);
608 smallend.min(b.smallend);
609 bigend.max(b.bigend);
649 BoxND&
grow (
int i)
noexcept { smallend.diagShift(-i); bigend.diagShift(i);
return *
this; }
660 BoxND&
grow (
int idir,
int n_cell)
noexcept { smallend.shift(
idir, -n_cell); bigend.shift(
idir, n_cell);
return *
this; }
691 smallend.shift(
idir, -n_cell);
693 bigend.shift(
idir,n_cell);
780 if (!
size().allGE(refrat*min_width)) {
783 BoxND testBox = *
this;
786 return (*
this == testBox);
826 for (
int idim=0; idim < dim; ++idim) {
827 if (this->
length(idim) == 0) {
836 smallend[direction] = slab_index;
837 bigend[direction] = slab_index;
857 static constexpr std::size_t
ndims () noexcept {
858 return static_cast<std::size_t
>(dim);
862 static constexpr int indims () noexcept {
870 template<
int new_dim>
873 static_assert(new_dim <= dim);
874 auto lo = smallend.template shrink<new_dim>();
875 auto hi = bigend.template shrink<new_dim>();
876 auto typ = btype.template shrink<new_dim>();
885 template<
int new_dim>
888 static_assert(new_dim >= dim);
889 auto lo = smallend.template expand<new_dim>(0);
890 auto hi = bigend.template expand<new_dim>(0);
899 template<
int new_dim>
902 if constexpr (new_dim > dim) {
903 return expand<new_dim>();
905 return shrink<new_dim>();
921 if (ref_ratio != 1) {
923 shft -= btype.ixType();
924 smallend *= ref_ratio;
945 for (
int dir = 0; dir < dim; dir++)
948 if (bigend[dir]%ref_ratio[dir]) {
984 for (
int dir = 0; dir < dim; dir++)
986 const auto typ = t[dir];
987 const auto bitval = btype[dir];
988 const int off = typ - bitval;
989 bigend.
shift(dir,off);
1003 bigend.
shift(dir,1);
1018 for (
int i = 0; i < dim; ++i) {
1019 if ((btype[i] == 0)) {
1035 bigend.
shift(dir,-1);
1050 for (
int i = 0 ; i < dim; ++i) {
1066 Long result = vz[0];
1068 for (
int i = 1 ; i < dim; ++i) {
1069 result += mult * vz[i];
1083 if constexpr (dim > 1) {
1086 for (
int i = 1 ; i < dim-1; ++i) {
1087 mult[i] = mult[i-1] *
length(i);
1089 for (
int i = dim-1 ; i > 0; --i) {
1091 offset -= idx * mult[i-1];
1092 result[i] +=
static_cast<int>(idx);
1096 result[0] +=
static_cast<int>(
offset);
1103requires (1 <= N && N <= 3)
1110 return {{iv3d.
x, iv3d.
y, iv3d.
z}};
1119 int n_cells)
noexcept
1121 smallend.setVal(dir,sm_index);
1122 bigend.setVal(dir,sm_index+n_cells-1);
1136 for (
int i = 0 ; i < dim-1; ++i) {
1137 if (p[i] > bigend[i]) {
1152 if constexpr (dim == 1) {
1155 bool is_square =
true;
1157 for (
int i = 0 ; i < dim-1; ++i) {
1158 is_square = is_square && (sz[i] == sz[i+1]);
1187 BL_ASSERT(chop_pnt > smallend[dir] && chop_pnt < bigend[dir]);
1191 bigend.setVal(dir,chop_pnt);
1198 BL_ASSERT(chop_pnt > smallend[dir] && chop_pnt <= bigend[dir]);
1202 bigend.setVal(dir,chop_pnt-1);
1213 const int nbit = (num_halfs<0 ? -num_halfs : num_halfs)%2;
1214 int nshift = num_halfs/2;
1218 const unsigned int bit_dir = btype[dir];
1222 if (num_halfs < 0) {
1223 nshift -= (bit_dir ? nbit : 0);
1225 nshift += (bit_dir ? 0 : nbit);
1227 smallend.
shift(dir,nshift);
1228 bigend.
shift(dir,nshift);
1238 for (
int i = 0; i < dim; i++) {
1249 explicit BoxCommHelper (
const Box& bx,
int* p_ =
nullptr);
1251 [[nodiscard]]
int* data () const& noexcept {
return p; }
1252 int* data () && =
delete;
1254 [[nodiscard]] Box make_box () const noexcept {
1255 return Box(IntVect(p), IntVect(p+AMREX_SPACEDIM), IntVect(p+2*AMREX_SPACEDIM));
1258 [[nodiscard]]
static int size () noexcept {
return 3*AMREX_SPACEDIM; }
1356 return grow(b,
static_cast<int>(d), n_cell);
1376 return growLo(b,
static_cast<int>(d), n_cell);
1396 return growHi(b,
static_cast<int>(d), n_cell);
1495 result.
refine(ref_ratio);
1507 result.
shift(dir, nzones);
1518 result.
shift(nzones);
1639 low.
setVal(dir,sm-len+1);
1661 auto const bitval = b.
type()[dir];
1662 int bg = hi[dir] + 1 - bitval%2;
1689 low.
setVal(dir,sm-len+1);
1694 int bitval = b.
type()[dir];
1695 int bg = hi[dir] + 1 - bitval%2;
1729 low.
setVal(dir,sm - len);
1749 int bitval = b.
type()[dir];
1750 int bg = hi[dir] + 1 - bitval%2;
1752 hi.
setVal(dir,bg + len - 1);
1775 low.
setVal(dir,sm - len);
1780 int bitval = b.
type()[dir];
1781 int bg = hi[dir] + 1 - bitval%2;
1783 hi.
setVal(dir,bg + len - 1);
1811 std::ostream& box_write (std::ostream& os,
const int * smallend,
const int * bigend,
1812 const int * type,
int dim);
1813 std::istream& box_read (std::istream& is,
int * smallend,
int * bigend,
int * type,
int dim);
1815 template<std::size_t...Ns,
class T,
class U>
1817 auto BoxSplit_imp (std::index_sequence<Ns...>,
1818 const T& lo,
const T& hi,
const U& typ)
noexcept {
1819 return makeTuple(BoxND(get<Ns>(lo), get<Ns>(hi), get<Ns>(typ))...);
1829 return detail::box_write(os, bx.
smallEnd().begin(), bx.
bigEnd().begin(), type.
begin(), dim);
1847template<
int d,
int...dims>
1850constexpr BoxND<detail::get_sum<d, dims...>()>
1855 return BoxND<detail::get_sum<d, dims...>()>{lo, hi, typ};
1862template<
int d,
int...dims>
1865constexpr GpuTuple<BoxND<d>, BoxND<dims>...>
1870 return detail::BoxSplit_imp(std::make_index_sequence<1 +
sizeof...(dims)>(), lo, hi, typ);
1877template<
int new_dim,
int old_dim>
1880constexpr BoxND<new_dim>
1882 return bx.template shrink<new_dim>();
1890template<
int new_dim,
int old_dim>
1893constexpr BoxND<new_dim>
1895 return bx.template expand<new_dim>();
1902template<
int new_dim,
int old_dim>
1905constexpr BoxND<new_dim>
1907 return bx.template resize<new_dim>();
1916 return box.smallEnd();
1925 return box.bigEnd();
1934 return box.smallEnd();
1943 return box.bigEnd() + 1;
1952 return box.bigEnd() - box.smallEnd() + 1;
1962 return max(b1.smallEnd(), b2.smallEnd());
1971 return max(b1.smallEnd(), lo);
1981 return min(b1.bigEnd(), b2.bigEnd());
1990 return min(b1.bigEnd(), hi);
1994requires ( 1<=dim && dim<=3 )
2004requires ( 1<=dim && dim<=3 )
2010 return box.
bigEnd().dim3();
2014requires ( 1<=dim && dim<=3 )
2024requires ( 1<=dim && dim<=3 )
2030 return (box.
bigEnd() + 1).dim3(1);
2034requires ( 1<=dim && dim<=3 )
2045requires ( 1<=dim && dim<=3 )
2055requires ( 1<=dim && dim<=3 )
2066requires ( 1<=dim && dim<=3 )
2076requires ( 1<=dim && dim<=3 )
2108template <
class T,
class ... Ts>
2123 Long ncells_subtotal = 0;
2125 for (ibox = 0; ibox < nboxes; ++ibox) {
2127 ncells_subtotal += n;
2128 if (icell < ncells_subtotal) {
2129 offset = icell - (ncells_subtotal - n);
2147template<
int dim=AMREX_SPACEDIM>
2148requires ( 1<=dim && dim<=3 )
2154 Dim3 p3d{.
x = i, .y = j, .z = k};
2179 std::uint64_t mult = 1;
2180 for (
int i=0; i<dim-1; ++i) {
2191 for (
int i=dim-1; i>0; --i) {
2192 std::uint64_t quotient, remainder;
2193 fdm[i-1](quotient, remainder, icell);
2194 retval[i] += quotient;
2205 requires (1 <= dim && dim <= 3)
2235 return Dim3{.
x =
int(icell)+
lo, .y = 0, .z = 0};
#define AMREX_ALWAYS_ASSERT_WITH_MESSAGE(EX, MSG)
Definition AMReX_BLassert.H:49
#define BL_ASSERT(EX)
Definition AMReX_BLassert.H:39
#define AMREX_FORCE_INLINE
Definition AMReX_Extension.H:119
#define AMREX_IF_ON_HOST(CODE)
Definition AMReX_GpuQualifiers.H:58
#define AMREX_GPU_HOST_DEVICE
Definition AMReX_GpuQualifiers.H:20
int idir
Definition AMReX_HypreMLABecLap.cpp:1143
Array4< int const > offset
Definition AMReX_HypreMLABecLap.cpp:1139
Array4< Real > fine
Definition AMReX_InterpFaceRegister.cpp:90
Definition AMReX_Box.H:1266
virtual Box doit(const Box &fine) const =0
virtual ~BoxConverter()=default
virtual BoxConverter * clone() const =0
iterates through the IntVects of a Box
Definition AMReX_BoxIterator.H:51
A Rectangular Domain on an Integer Lattice.
Definition AMReX_Box.H:49
__host__ __device__ const int * hiVect() &&=delete
__host__ __device__ BoxND & grow(const IntVectND< dim > &v) noexcept
Grow BoxND in each direction by specified amount.
Definition AMReX_Box.H:653
__host__ __device__ GpuArray< int, 3 > loVect3d() const noexcept
Definition AMReX_Box.H:173
__host__ __device__ constexpr BoxND(const IntVectND< dim > &small, const IntVectND< dim > &big) noexcept
Construct cell-centered type BoxND.
Definition AMReX_Box.H:67
__host__ __device__ bool operator<=(const BoxND &rhs) const noexcept
Definition AMReX_Box.H:321
__host__ __device__ BoxND & grow(int i) noexcept
Definition AMReX_Box.H:649
__host__ __device__ GpuArray< int, 3 > length3d() const noexcept
Definition AMReX_Box.H:165
__host__ __device__ const IntVectND< dim > & bigEnd() const &noexcept
Return the inclusive upper bound of the box.
Definition AMReX_Box.H:124
__host__ __device__ const int * hiVect() const &noexcept
Return a constant pointer the array of high end coordinates. Useful for calls to FORTRAN.
Definition AMReX_Box.H:195
__host__ __device__ BoxND & operator&=(const BoxND &rhs) noexcept
Intersect this BoxND with its argument. The Boxes MUST be of the same type.
Definition AMReX_Box.H:591
__host__ __device__ bool isEmpty() const noexcept
Checks if it is an empty BoxND.
Definition AMReX_Box.H:208
__host__ __device__ BoxND(const IntVectND< dim > &small, const IntVectND< dim > &big, IndexTypeND< dim > t) noexcept
Construct dimension specific Boxes.
Definition AMReX_Box.H:94
__host__ static __device__ constexpr int indims() noexcept
Definition AMReX_Box.H:862
__host__ __device__ int bigEnd(int dir) const noexcept
Return the inclusive upper bound in the given direction.
Definition AMReX_Box.H:132
__host__ __device__ BoxND< new_dim > resize() const noexcept
Return a new BoxND of size new_dim by either shrinking or expanding this BoxND.
Definition AMReX_Box.H:901
__host__ __device__ BoxND & operator-=(const IntVectND< dim > &v) noexcept
Shift BoxND (relative) by given IntVectND<dim>.
Definition AMReX_Box.H:623
__host__ __device__ BoxND & surroundingNodes(Direction d) noexcept
Definition AMReX_Box.H:568
__host__ __device__ BoxND & makeSlab(int direction, int slab_index) noexcept
Definition AMReX_Box.H:834
__host__ __device__ BoxND & setBig(const IntVectND< dim > &bg) noexcept
Redefine the big end of the BoxND.
Definition AMReX_Box.H:495
__host__ __device__ int shortside() const noexcept
Return length of shortest side. Ignores type.
Definition AMReX_Box.H:461
__host__ __device__ BoxND & minBox(const BoxND &b) noexcept
Modify BoxND to that of the minimum BoxND containing both the original BoxND and the argument....
Definition AMReX_Box.H:605
__host__ __device__ Long volume() const noexcept
Return the volume, in indexing space, of region enclosed by this BoxND. This is identical to numPts()...
Definition AMReX_Box.H:402
__host__ __device__ BoxND & shift(const IntVectND< dim > &iv) noexcept
Equivalent to b.shift(0,iv[0]).shift(1,iv[1]) ....
Definition AMReX_Box.H:521
__host__ __device__ BoxND< new_dim > expand() const noexcept
Return a new BoxND of size new_dim and assigns all values of this BoxND to it and (small=0,...
Definition AMReX_Box.H:887
__host__ __device__ bool isSquare() const noexcept
Definition AMReX_Box.H:1150
__host__ __device__ bool contains(const Dim3 &p) const noexcept
Return true if argument is contained within BoxND.
Definition AMReX_Box.H:222
__host__ __device__ bool cellCentered() const noexcept
Return true if BoxND is cell-centered in all indexing directions.
Definition AMReX_Box.H:335
__host__ __device__ BoxND(const IntVectND< dim > &small, const int *vec_len) noexcept
Construct BoxND with specified lengths.
Definition AMReX_Box.H:74
__host__ __device__ bool coarsenable(int refrat, int min_width=1) const noexcept
Return whether this Box is coarsenable.
Definition AMReX_Box.H:802
__host__ __device__ BoxND & operator+=(const IntVectND< dim > &v) noexcept
Shift BoxND (relative) by given IntVectND<dim>.
Definition AMReX_Box.H:615
__host__ __device__ const int * loVect() &&=delete
__host__ __device__ Long numPts() const noexcept
Return the number of points contained in the BoxND.
Definition AMReX_Box.H:364
__host__ __device__ bool operator>=(const BoxND &rhs) const noexcept
Definition AMReX_Box.H:329
__host__ __device__ bool sameType(const BoxND &b) const noexcept
Return true if Boxes have same type.
Definition AMReX_Box.H:302
__host__ __device__ bool operator!=(const BoxND &b) const noexcept
Return true if Boxes differ (including type).
Definition AMReX_Box.H:310
__host__ __device__ BoxND & setBig(int dir, int bg_index) noexcept
Redefine the big end of the BoxND.
Definition AMReX_Box.H:499
__host__ __device__ BoxND operator-(const IntVectND< dim > &v) const noexcept
Shift BoxND (relative) by given IntVectND<dim>.
Definition AMReX_Box.H:627
__host__ __device__ BoxND & refine(const IntVectND< dim > &ref_ratio) noexcept
Definition AMReX_Box.H:919
__host__ __device__ bool sameSize(const BoxND &b) const noexcept
Return true is Boxes same size, ie translates of each other,. It is an error if they have different t...
Definition AMReX_Box.H:295
__host__ __device__ IntVectND< dim > length() const noexcept
Return the length of the BoxND.
Definition AMReX_Box.H:155
__host__ __device__ GpuArray< int, 3 > hiVect3d() const noexcept
Definition AMReX_Box.H:181
__host__ __device__ BoxND & convert(IndexTypeND< dim > typ) noexcept
Convert the BoxND from the current type into the argument type. This may change the BoxND coordinates...
Definition AMReX_Box.H:982
__host__ __device__ bool contains(const IntVectND< dim > &p) const noexcept
Return true if argument is contained within BoxND.
Definition AMReX_Box.H:216
__host__ __device__ int shortside(int &dir) const noexcept
Return length of shortest side. dir is modified to give direction with shortest side: 0....
Definition AMReX_Box.H:445
__host__ __device__ IntVectND< dim > size() const noexcept
Return the length of the BoxND.
Definition AMReX_Box.H:148
__host__ __device__ int operator[](Orientation face) const noexcept
Return the coordinate normal to given face.
Definition AMReX_Box.H:201
__host__ __device__ bool strictly_contains(const Dim3 &p) const noexcept
Return true if argument is strictly contained within BoxND.
Definition AMReX_Box.H:267
__host__ __device__ BoxND & shift(int dir, int nzones) noexcept
Shift this BoxND nzones indexing positions in coordinate direction dir.
Definition AMReX_Box.H:517
BoxIteratorND< dim > iterator() const noexcept
Return a BoxIteratorND that can be used to loop over the IntVects contained by the BoxND.
Definition AMReX_Box.H:852
__host__ static __device__ constexpr std::size_t ndims() noexcept
Definition AMReX_Box.H:857
__host__ __device__ bool coarsenable(const IntVectND< dim > &refrat, const IntVectND< dim > &min_width) const noexcept
Return whether this Box is coarsenable.
Definition AMReX_Box.H:778
__host__ __device__ BoxND & setSmall(int dir, int sm_index) noexcept
Redefine the small end of the BoxND.
Definition AMReX_Box.H:491
__host__ __device__ double d_numPts() const noexcept
Return the number of points contained in the BoxND. This is intended for use only in diagnostic messa...
Definition AMReX_Box.H:384
__host__ __device__ IntVectND< dim > atOffset(Long offset) const noexcept
Given the offset, compute IntVectND<dim>
Definition AMReX_Box.H:1079
__host__ __device__ BoxND operator+(const IntVectND< dim > &v) const noexcept
Shift BoxND (relative) by given IntVectND<dim>.
Definition AMReX_Box.H:619
__host__ __device__ BoxND & grow(int idir, int n_cell) noexcept
Grow the BoxND on the low and high end by n_cell cells in direction idir.
Definition AMReX_Box.H:660
__host__ __device__ const int * loVect() const &noexcept
Return a constant pointer the array of low end coordinates. Useful for calls to FORTRAN.
Definition AMReX_Box.H:190
__host__ __device__ BoxND & growLo(int idir, int n_cell=1) noexcept
Grow the BoxND on the low end by n_cell cells in direction idir. NOTE: n_cell negative shrinks the Bo...
Definition AMReX_Box.H:670
__host__ __device__ bool contains(const BoxND &b) const noexcept
Return true if argument is contained within BoxND. It is an error if the Boxes have different types.
Definition AMReX_Box.H:242
__host__ __device__ int longside(int &dir) const noexcept
Return length of longest side. dir is modified to give direction with longest side: 0....
Definition AMReX_Box.H:419
__host__ __device__ IndexTypeND< dim > ixType() const noexcept
Return the indexing type.
Definition AMReX_Box.H:136
__host__ __device__ BoxND & growHi(int idir, int n_cell=1) noexcept
Grow the BoxND on the high end by n_cell cells in direction idir. NOTE: n_cell negative shrinks the B...
Definition AMReX_Box.H:681
__host__ __device__ bool strictly_contains(const IntVectND< dim > &p) const noexcept
Return true if argument is strictly contained within BoxND.
Definition AMReX_Box.H:250
__host__ __device__ IntVectND< dim > type() const noexcept
Return the indexing type.
Definition AMReX_Box.H:140
__host__ __device__ BoxND & growHi(Direction d, int n_cell=1) noexcept
Definition AMReX_Box.H:684
__host__ __device__ BoxND & growLo(Direction d, int n_cell=1) noexcept
Definition AMReX_Box.H:673
__host__ __device__ BoxND & coarsen(int ref_ratio) noexcept
Coarsen BoxND by given (positive) refinement ratio. NOTE: if type(dir) = CELL centered: lo <- lo/rati...
Definition AMReX_Box.H:730
__host__ __device__ BoxND & refine(int ref_ratio) noexcept
Refine BoxND by given (positive) refinement ratio. NOTE: if type(dir) = CELL centered: lo <- lo*ratio...
Definition AMReX_Box.H:706
__host__ __device__ BoxND & setRange(int dir, int sm_index, int n_cells=1) noexcept
Set the entire range in a given direction, starting at sm_index with length n_cells....
Definition AMReX_Box.H:1117
__host__ __device__ bool strictly_contains(int i, int j, int k) const noexcept
Return true if argument is strictly contained within BoxND.
Definition AMReX_Box.H:276
__host__ __device__ Long index(const IntVectND< dim > &v) const noexcept
Return offset of point from smallend; i.e. index(smallend) -> 0, bigend would return numPts()-1....
Definition AMReX_Box.H:1063
__host__ __device__ bool contains(int i, int j, int k) const noexcept
Return true if argument is contained within BoxND.
Definition AMReX_Box.H:231
__host__ __device__ BoxND & setType(const IndexTypeND< dim > &t) noexcept
Set indexing type.
Definition AMReX_Box.H:513
__host__ __device__ BoxND & grow(Direction d, int n_cell) noexcept
Definition AMReX_Box.H:663
__host__ __device__ int longside() const noexcept
Return length of longest side. Ignores type.
Definition AMReX_Box.H:435
__host__ __device__ constexpr BoxND() noexcept
Definition AMReX_Box.H:60
__host__ __device__ BoxND & enclosedCells() noexcept
Convert to CELL type in all directions.
Definition AMReX_Box.H:1048
__host__ __device__ GpuArray< int, 3 > atOffset3d(Long offset) const noexcept
Definition AMReX_Box.H:1107
__host__ __device__ void next(IntVectND< dim > &) const noexcept
Step through the rectangle. It is a runtime error to give a point not inside rectangle....
Definition AMReX_Box.H:1130
__host__ __device__ void normalize() noexcept
Definition AMReX_Box.H:824
__host__ __device__ BoxND< new_dim > shrink() const noexcept
Return a new BoxND of dimension new_dim and assigns the first new_dim dimension of this BoxND to it.
Definition AMReX_Box.H:872
__host__ __device__ BoxND & coarsen(const IntVectND< dim > &ref_ratio) noexcept
Coarsen BoxND by given (positive) refinement ratio. NOTE: if type(dir) = CELL centered: lo <- lo/rati...
Definition AMReX_Box.H:936
__host__ __device__ BoxND & shiftHalf(int dir, int num_halfs) noexcept
This member shifts the BoxND by "half" indices, thereby converting the BoxND from type CELL to NODE a...
Definition AMReX_Box.H:1211
__host__ __device__ bool operator==(const BoxND &b) const noexcept
Return true if Boxes are identical (including type).
Definition AMReX_Box.H:306
__host__ static __device__ BoxND TheUnitBox() noexcept
This static member function returns a constant reference to an object of type BoxND representing the ...
Definition AMReX_Box.H:759
__host__ __device__ int smallEnd(int dir) const &noexcept
Return the inclusive lower bound in the given direction.
Definition AMReX_Box.H:120
__host__ __device__ BoxND & convert(const IntVectND< dim > &typ) noexcept
Convert the BoxND from the current type into the argument type. This may change the BoxND coordinates...
Definition AMReX_Box.H:969
__host__ __device__ BoxND & shiftHalf(const IntVectND< dim > &iv) noexcept
Equivalent to b.shiftHalf(0,iv[0]).shiftHalf(1,iv[1]) ...
Definition AMReX_Box.H:1236
__host__ __device__ bool coarsenable(const IntVectND< dim > &refrat, int min_width=1) const noexcept
Return whether this Box is coarsenable.
Definition AMReX_Box.H:818
__host__ __device__ BoxND & enclosedCells(Direction d) noexcept
Convert to CELL type in given Direction d.
Definition AMReX_Box.H:580
__host__ __device__ bool operator<(const BoxND &rhs) const noexcept
Definition AMReX_Box.H:313
__host__ __device__ bool intersects(const BoxND &b) const noexcept
Return true if Boxes have non-null intersections. It is an error if the Boxes have different types.
Definition AMReX_Box.H:288
__host__ __device__ IndexType::CellIndex type(int dir) const noexcept
Return the indexing type in the specified direction.
Definition AMReX_Box.H:144
__host__ __device__ BoxND chop(int dir, int chop_pnt) noexcept
Chop the BoxND at chop_pnt in the dir direction return one BoxND and modify the object BoxND....
Definition AMReX_Box.H:1174
__host__ __device__ bool ok() const noexcept
Checks if it is a proper BoxND (including a valid type).
Definition AMReX_Box.H:212
__host__ __device__ int length(int dir) const noexcept
Return the length of the BoxND in given direction.
Definition AMReX_Box.H:162
friend class BoxCommHelper
Definition AMReX_Box.H:51
__host__ __device__ BoxND & surroundingNodes() noexcept
Convert to NODE type in all directions.
Definition AMReX_Box.H:1016
__host__ __device__ BoxND & grow(Orientation face, int n_cell=1) noexcept
Grow in the direction of the given face.
Definition AMReX_Box.H:688
__host__ __device__ BoxND operator&(const BoxND &rhs) const noexcept
Return BoxND that is intersection of this BoxND and argument. The Boxes MUST be of same type.
Definition AMReX_Box.H:587
__host__ __device__ BoxND(const IntVectND< dim > &small, const IntVectND< dim > &big, const IntVectND< dim > &typ) noexcept
Construct BoxND with given type. small and big are expected to be consistent with given type.
Definition AMReX_Box.H:84
__host__ __device__ const IntVectND< dim > & smallEnd() const &noexcept
Return the inclusive lower bound of the box.
Definition AMReX_Box.H:112
__host__ __device__ bool operator>(const BoxND &rhs) const noexcept
Definition AMReX_Box.H:325
__host__ __device__ BoxND & setSmall(const IntVectND< dim > &sm) noexcept
Definition AMReX_Box.H:487
__host__ __device__ bool strictly_contains(const BoxND &b) const noexcept
Return true if argument is strictly contained within BoxND. It is an error if the Boxes have differen...
Definition AMReX_Box.H:259
Cell-Based or Node-Based Indices.
Definition AMReX_IndexType.H:36
__host__ __device__ void set(int dir) noexcept
Set IndexTypeND to be NODE based in direction dir.
Definition AMReX_IndexType.H:70
__host__ __device__ void unset(int dir) noexcept
Set IndexTypeND to be CELL based in direction dir.
Definition AMReX_IndexType.H:73
An Integer Vector in dim-Dimensional Space.
Definition AMReX_IntVect.H:149
__host__ __device__ IntVectND & setVal(int i, int val) noexcept
Set i'th coordinate of IntVectND to val.
Definition AMReX_IntVect.H:373
__host__ __device__ constexpr int * begin() noexcept
Returns a pointer to the first element of the IntVectND.
Definition AMReX_IntVect.H:357
__host__ __device__ IntVectND< dim > & coarsen(const IntVectND< dim > &p) noexcept
Modify IntVectND<dim> by component-wise integer projection.
Definition AMReX_IntVect.H:941
Encapsulation of the Orientation of the Faces of a Box.
Definition AMReX_Orientation.H:29
__host__ __device__ bool isLow() const noexcept
Returns true if Orientation is low.
Definition AMReX_Orientation.H:89
__host__ __device__ int coordDir() const noexcept
Returns the coordinate direction.
Definition AMReX_Orientation.H:83
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition AMReX_Vector.H:29
amrex_long Long
Definition AMReX_INT.H:30
__host__ __device__ Dim3 ubound(Array4< T > const &a) noexcept
Return the inclusive upper bounds of an Array4 in Dim3 form.
Definition AMReX_Array4.H:1359
__host__ __device__ Dim3 length(Array4< T > const &a) noexcept
Return the spatial extents of an Array4 in Dim3 form.
Definition AMReX_Array4.H:1373
__host__ __device__ Dim3 lbound(Array4< T > const &a) noexcept
Return the inclusive lower bounds of an Array4 in Dim3 form.
Definition AMReX_Array4.H:1345
__host__ __device__ BoxND< dim > coarsen(const BoxND< dim > &b, int ref_ratio) noexcept
Coarsen BoxND by given (positive) coarsening ratio.
Definition AMReX_Box.H:1418
__host__ __device__ BoxND< dim > grow(const BoxND< dim > &b, int i) noexcept
Grow BoxND in all directions by given amount.
Definition AMReX_Box.H:1289
__host__ __device__ BoxND< dim > refine(const BoxND< dim > &b, int ref_ratio) noexcept
Definition AMReX_Box.H:1468
int MPI_Datatype
Definition AMReX_ccse-mpi.H:53
Definition AMReX_Amr.cpp:50
std::ostream & operator<<(std::ostream &os, AmrMesh const &amr_mesh)
Stream helper; forwards to the friend declared inside AmrMesh.
Definition AMReX_AmrMesh.cpp:1306
__host__ __device__ BoxND< dim > adjCellHi(const BoxND< dim > &b, int dir, int len=1) noexcept
Similar to adjCellLo but builds an adjacent BoxND on the high end.
Definition AMReX_Box.H:1744
__host__ __device__ BoxND< dim > makeSingleCellBox(int i, int j, int k, IndexTypeND< dim > typ=IndexTypeND< dim >::TheCellType())
Definition AMReX_Box.H:2152
__host__ __device__ BoxND< dim > convert(const BoxND< dim > &b, const IntVectND< dim > &typ) noexcept
Return a BoxND with different type.
Definition AMReX_Box.H:1567
__host__ __device__ BoxND< dim > makeSlab(BoxND< dim > const &b, int direction, int slab_index) noexcept
Definition AMReX_Box.H:2140
__host__ __device__ constexpr GpuTuple< detail::tuple_decay_t< Ts >... > makeTuple(Ts &&... args)
Definition AMReX_Tuple.H:269
__host__ __device__ BoxND< dim > adjCellLo(const BoxND< dim > &b, int dir, int len=1) noexcept
Return the cell centered BoxND of length len adjacent to b on the low end along the coordinate direct...
Definition AMReX_Box.H:1723
__host__ __device__ BoxND< dim > surroundingNodes(const BoxND< dim > &b, int dir) noexcept
Return a BoxND with NODE based coordinates in direction dir that encloses BoxND b....
Definition AMReX_Box.H:1531
__host__ __device__ IntVectND< dim > end_iv(BoxND< dim > const &box) noexcept
Definition AMReX_Box.H:1941
__host__ __device__ Dim3 begin(BoxND< dim > const &box) noexcept
Definition AMReX_Box.H:2018
__host__ __device__ IntVectND< dim > lbound_iv(BoxND< dim > const &box) noexcept
Definition AMReX_Box.H:1914
__host__ __device__ Dim3 min_ubound(BoxND< dim > const &b1, BoxND< dim > const &b2) noexcept
Definition AMReX_Box.H:2070
__host__ __device__ BoxND< dim > bdryLo(const BoxND< dim > &b, int dir, int len=1) noexcept
Return the edge-centered BoxND (in direction dir) defining the low side of BoxND b.
Definition AMReX_Box.H:1634
__host__ __device__ constexpr GpuTuple< IntVectND< d >, IntVectND< dims >... > IntVectSplit(const IntVectND< detail::get_sum< d, dims... >()> &v) noexcept
Returns a tuple of IntVectND obtained by splitting the input IntVectND according to the dimensions sp...
Definition AMReX_IntVect.H:1288
__host__ __device__ IntVectND< dim > min_ubound_iv(BoxND< dim > const &b1, BoxND< dim > const &b2) noexcept
Definition AMReX_Box.H:1979
__host__ __device__ BoxND< dim > minBox(const BoxND< dim > &b1, const BoxND< dim > &b2) noexcept
Modify BoxND to that of the minimum BoxND containing both the original BoxND and the argument....
Definition AMReX_Box.H:1802
BoxND< 3 > Box
Box is an alias for amrex::BoxND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:30
__host__ __device__ constexpr BoxND< new_dim > BoxResize(const BoxND< old_dim > &bx) noexcept
Return a new BoxND of size new_dim by either shrinking or expanding this BoxND.
Definition AMReX_Box.H:1906
__host__ __device__ Dim3 max_lbound(BoxND< dim > const &b1, BoxND< dim > const &b2) noexcept
Definition AMReX_Box.H:2049
__host__ __device__ constexpr const T & min(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:25
__host__ __device__ BoxND< dim > adjCell(const BoxND< dim > &b, Orientation face, int len=1) noexcept
Similar to adjCellLo and adjCellHi; operates on given face.
Definition AMReX_Box.H:1766
__host__ __device__ IntVectND< dim > begin_iv(BoxND< dim > const &box) noexcept
Definition AMReX_Box.H:1932
__host__ __device__ BoxND< dim > shift(const BoxND< dim > &b, int dir, int nzones) noexcept
Return a BoxND with indices shifted by nzones in dir direction.
Definition AMReX_Box.H:1504
__host__ __device__ constexpr BoxND< new_dim > BoxShrink(const BoxND< old_dim > &bx) noexcept
Return a new BoxND of dimension new_dim and assigns the first new_dim dimension of this BoxND to it.
Definition AMReX_Box.H:1881
__host__ __device__ BoxND< dim > enclosedCells(const BoxND< dim > &b, int dir) noexcept
Return a BoxND with CELL based coordinates in direction dir that is enclosed by b....
Definition AMReX_Box.H:1595
__host__ __device__ constexpr IndexTypeND< detail::get_sum< d, dims... >()> IndexTypeCat(const IndexTypeND< d > &v, const IndexTypeND< dims > &...vects) noexcept
Returns a IndexTypeND obtained by concatenating the input IndexTypeNDs. The dimension of the return v...
Definition AMReX_IndexType.H:293
__host__ __device__ IntVectND< dim > length_iv(BoxND< dim > const &box) noexcept
Definition AMReX_Box.H:1950
Direction
Definition AMReX_Orientation.H:14
__host__ __device__ constexpr BoxND< detail::get_sum< d, dims... >()> BoxCat(const BoxND< d > &bx, const BoxND< dims > &...boxes) noexcept
Return a BoxND obtained by concatenating the input BoxNDs. The dimension of the return value equals t...
Definition AMReX_Box.H:1851
__host__ __device__ BoxND< dim > bdryNode(const BoxND< dim > &b, Orientation face, int len=1) noexcept
Similar to bdryLo and bdryHi except that it operates on the given face of box b.
Definition AMReX_Box.H:1681
__host__ __device__ constexpr const T & max(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:45
__host__ __device__ BoxND< dim > growLo(const BoxND< dim > &b, int idir, int n_cell) noexcept
Definition AMReX_Box.H:1363
__host__ __device__ IntVectND< dim > ubound_iv(BoxND< dim > const &box) noexcept
Definition AMReX_Box.H:1923
__host__ __device__ constexpr BoxND< new_dim > BoxExpand(const BoxND< old_dim > &bx) noexcept
Return a new BoxND of size new_dim and assigns all values of this BoxND to it and (small=0,...
Definition AMReX_Box.H:1894
__host__ __device__ IntVectND< dim > getCell(BoxND< dim > const *boxes, int nboxes, Long icell) noexcept
Definition AMReX_Box.H:2120
const int[]
Definition AMReX_BLProfiler.cpp:1664
void AllGatherBoxes(Vector< Box > &bxs, int n_extra_reserve)
Definition AMReX_Box.cpp:124
std::istream & operator>>(std::istream &is, BoxND< dim > &bx)
Read from istream.
Definition AMReX_Box.H:1834
__host__ __device__ constexpr IntVectND< detail::get_sum< d, dims... >()> IntVectCat(const IntVectND< d > &v, const IntVectND< dims > &...vects) noexcept
Returns a IntVectND obtained by concatenating the input IntVectNDs. The dimension of the return value...
Definition AMReX_IntVect.H:1272
__host__ __device__ Dim3 end(BoxND< dim > const &box) noexcept
Definition AMReX_Box.H:2028
__host__ __device__ BoxND< dim > bdryHi(const BoxND< dim > &b, int dir, int len=1) noexcept
Return the edge-centered BoxND (in direction dir) defining the high side of BoxND b.
Definition AMReX_Box.H:1657
__host__ __device__ BoxND< dim > growHi(const BoxND< dim > &b, int idir, int n_cell) noexcept
Definition AMReX_Box.H:1383
BoxND< dim > getIndexBounds(BoxND< dim > const &b1) noexcept
Definition AMReX_Box.H:2092
__host__ __device__ constexpr GpuTuple< BoxND< d >, BoxND< dims >... > BoxSplit(const BoxND< detail::get_sum< d, dims... >()> &bx) noexcept
Return a tuple of BoxNDs obtained by splitting the input BoxND according to the dimensions specified ...
Definition AMReX_Box.H:1866
__host__ __device__ constexpr GpuTuple< IndexTypeND< d >, IndexTypeND< dims >... > IndexTypeSplit(const IndexTypeND< detail::get_sum< d, dims... >()> &v) noexcept
Returns a tuple of IndexTypeND obtained by splitting the input IndexTypeND according to the dimension...
Definition AMReX_IndexType.H:313
__host__ __device__ IntVectND< dim > max_lbound_iv(BoxND< dim > const &b1, BoxND< dim > const &b2) noexcept
Definition AMReX_Box.H:1960
A multidimensional array accessor.
Definition AMReX_Array4.H:285
IntVectND< N > end
Exclusive upper bounds.
Definition AMReX_Array4.H:299
IntVectND< N > begin
Inclusive lower bounds.
Definition AMReX_Array4.H:298
BoxIndexerND(BoxND< 1 > const &box)
Definition AMReX_Box.H:2221
std::uint64_t npts
Definition AMReX_Box.H:2217
__host__ __device__ std::uint64_t numPts() const
Definition AMReX_Box.H:2239
__host__ __device__ IntVectND< 1 > intVect(std::uint64_t icell) const
Definition AMReX_Box.H:2227
int lo
Definition AMReX_Box.H:2219
Definition AMReX_Box.H:2170
__host__ __device__ IntVectND< dim > intVect(std::uint64_t icell) const
Definition AMReX_Box.H:2187
BoxIndexerND(BoxND< dim > const &box)
Definition AMReX_Box.H:2175
IntVectND< dim > lo
Definition AMReX_Box.H:2173
__host__ __device__ std::uint64_t numPts() const
Definition AMReX_Box.H:2211
Math::FastDivmodU64 fdm[dim-1]
Definition AMReX_Box.H:2172
__host__ __device__ Dim3 operator()(std::uint64_t icell) const
Definition AMReX_Box.H:2204
std::uint64_t npts
Definition AMReX_Box.H:2171
CellIndex
The cell index type: one of CELL or NODE.
Definition AMReX_IndexType.H:21
@ CELL
Definition AMReX_IndexType.H:21
Definition AMReX_Dim3.H:13
int x
Definition AMReX_Dim3.H:13
int z
Definition AMReX_Dim3.H:13
int y
Definition AMReX_Dim3.H:13
Fixed-size array that can be used on GPU.
Definition AMReX_Array.H:43
Definition AMReX_Math.H:493
static MPI_Datatype type()