1#ifndef AMREX_INTVECT_H_
2#define AMREX_INTVECT_H_
3#include <AMReX_Config.H>
31 case 2:
return (i<0) ? -std::abs(i+1)/2 -1 : i/2;
32 case 4:
return (i<0) ? -std::abs(i+1)/4 -1 : i/4;
33 default:
return (i<0) ? -std::abs(i+1)/ratio-1 : i/ratio;
50 static_assert(dim >= 1,
"The number of dimensions of IntVectND must be positive");
55 static constexpr unsigned shift1 =
sizeof(size_t)>=8 ? 20 : 10;
56 static constexpr unsigned shift2 =
sizeof(size_t)>=8 ? 40 : 20;
57 if constexpr (dim == 1) {
60 return static_cast<std::size_t
>(vec[0]);
61 }
else if constexpr (dim == 2) {
63 return static_cast<std::size_t
>(vec[0]) ^
64 (
static_cast<std::size_t
>(vec[1]) << shift1);
65 }
else if constexpr (dim == 3) {
66 return static_cast<std::size_t
>(vec[0]) ^
67 (
static_cast<std::size_t
>(vec[1]) << shift1) ^
68 (
static_cast<std::size_t
>(vec[2]) << shift2);
70 std::size_t seed = dim;
73 for (
int i=0; i<dim; ++i) {
74 auto x =
static_cast<unsigned int>(vec[i]);
75 x = ((
x >> 16) ^
x) * 0x45d9f3b;
76 x = ((
x >> 16) ^
x) * 0x45d9f3b;
78 seed ^=
x + 0x9e3779b9 + (seed << 6) + (seed >> 2);
98 template <
class...Args,
100 (
sizeof...(Args)+2 == dim) &&
104 constexpr IntVectND (
int i,
int j, Args...ks) noexcept :
vect{i, j,
static_cast<int>(ks)...} {}
111 for (
int i=0; i<dim; ++i) {
122 for (
int i=0; i<dim; ++i) {
134 for (
int i=0; i<dim; ++i) {
143 for (
int i=0; i<dim; ++i) {
148 template <
int N=dim, std::enable_if_t<( 1<=N && N<=3 ),
int> = 0>
149 explicit constexpr IntVectND (Dim3 const& a) noexcept {
151 if constexpr (dim >= 2) {
154 if constexpr (dim == 3) {
161 template <
int N=dim, std::enable_if_t<( 1<=N && N<=3 ),
int> = 0>
162 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
163 Dim3 dim3 () const noexcept {
164 if constexpr (dim == 1) {
165 return Dim3{vect[0],0,0};
166 } else if constexpr (dim == 2) {
167 return Dim3{vect[0],vect[1],0};
169 return Dim3{vect[0],vect[1],vect[2]};
173 template <
int N=dim, std::enable_if_t<( 1<=N && N<=3 ),
int> = 0>
174 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
175 Dim3 dim3 ([[maybe_unused]]
int fill_extra) const noexcept {
176 if constexpr (dim == 1) {
177 return Dim3{vect[0],fill_extra,fill_extra};
178 } else if constexpr (dim == 2) {
179 return Dim3{vect[0],vect[1],fill_extra};
181 return Dim3{vect[0],vect[1],vect[2]};
185 template<
typename T =
int >
190 for (
int i=0; i<dim; ++i) {
203 int retval =
vect[0];
204 for (
int i=1; i<dim; ++i) {
214 int retval =
vect[0];
215 for (
int i=1; i<dim; ++i) {
216 retval = retval >
vect[i] ? retval :
vect[i];
225 int retval =
vect[0];
226 for (
int i=1; i<dim; ++i) {
227 retval = retval <
vect[i] ? retval :
vect[i];
234 int maxDir(
bool a_doAbsValue)
const noexcept;
245 template<std::
size_t i>
247 int&
get () noexcept {
static_assert(0<=i && i<dim);
return vect[i];}
250 template<std::
size_t i>
252 const int&
get () const noexcept {
static_assert(0<=i && i<dim);
return vect[i];}
268 const int*
end () const noexcept {
return &
vect[dim]; }
292 bool retval =
vect[0] == val;
293 for (
int i=1; i<dim; ++i) {
294 retval = retval &&
vect[i] == val;
303 bool retval =
vect[0] != val;
304 for (
int i=1; i<dim; ++i) {
305 retval = retval ||
vect[i] != val;
314 bool retval =
vect[0] == rhs[0];
315 for (
int i=1; i<dim; ++i) {
316 retval = retval &&
vect[i] == rhs[i];
324 bool retval =
vect[0] != rhs[0];
325 for (
int i=1; i<dim; ++i) {
326 retval = retval ||
vect[i] != rhs[i];
334 for (
int i=dim-1; i>=0; --i) {
335 if (
vect[i] < rhs[i]) {
337 }
else if (
vect[i] > rhs[i]) {
347 return !(rhs < *
this);
359 return !(*
this < rhs);
368 bool retval =
vect[0] < rhs[0];
369 for (
int i=1; i<dim; ++i) {
370 retval = retval &&
vect[i] < rhs[i];
380 bool retval =
vect[0] < rhs;
381 for (
int i=1; i<dim; ++i) {
382 retval = retval &&
vect[i] < rhs;
393 bool retval =
vect[0] <= rhs[0];
394 for (
int i=1; i<dim; ++i) {
395 retval = retval &&
vect[i] <= rhs[i];
405 bool retval =
vect[0] <= rhs;
406 for (
int i=1; i<dim; ++i) {
407 retval = retval &&
vect[i] <= rhs;
418 bool retval =
vect[0] > rhs[0];
419 for (
int i=1; i<dim; ++i) {
420 retval = retval &&
vect[i] > rhs[i];
430 bool retval =
vect[0] > rhs;
431 for (
int i=1; i<dim; ++i) {
432 retval = retval &&
vect[i] > rhs;
443 bool retval =
vect[0] >= rhs[0];
444 for (
int i=1; i<dim; ++i) {
445 retval = retval &&
vect[i] >= rhs[i];
455 bool retval =
vect[0] >= rhs;
456 for (
int i=1; i<dim; ++i) {
457 retval = retval &&
vect[i] >= rhs;
468 for (
int i=0; i<dim; ++i) {
469 retval[i] = -
vect[i];
477 for (
int i=0; i<dim; ++i) {
486 for (
int i=0; i<dim; ++i) {
495 for (
int i=0; i<dim; ++i) {
504 for (
int i=0; i<dim; ++i) {
513 for (
int i=0; i<dim; ++i) {
522 for (
int i=0; i<dim; ++i) {
531 for (
int i=0; i<dim; ++i) {
540 for (
int i=0; i<dim; ++i) {
605 for (
int i=0; i<dim; ++i) {
614 for (
int i=0; i<dim; ++i) {
622 for (
int i=0; i<dim; ++i) {
642 BL_ASSERT(coord >= 0 && coord < dim);
vect[coord] += s;
return *
this;
651 for (
int i=0; i<dim; ++i) {
723 static constexpr std::size_t
size () noexcept {
724 return static_cast<std::size_t
>(dim);
728 static constexpr int isize () noexcept {
738 template<
int new_dim>
741 static_assert(new_dim <= dim);
749 template<
int new_dim>
752 static_assert(new_dim >= dim);
754 for (
int i=0; i<dim; ++i) {
764 template<
int new_dim>
767 if constexpr (new_dim > dim) {
768 return expand<new_dim>(fill_extra);
770 return shrink<new_dim>();
796template<std::
size_t dim>
801template <
class...Args,
821 for (
int i=0; i<dim; ++i) {
822 vect[i] = (vect[i]<0) ? -std::abs(vect[i]+1)/2-1 : vect[i]/2;
826 for (
int i=0; i<dim; ++i) {
827 vect[i] = (vect[i]<0) ? -std::abs(vect[i]+1)/4-1 : vect[i]/4;
831 for (
int i=0; i<dim; ++i) {
832 vect[i] = (vect[i]<0) ? -std::abs(vect[i]+1)/s-1 : vect[i]/s;
845 for (
int i=0; i<dim; ++i) {
860 int maxval = std::abs((*
this)[0]);
863 int curval = std::abs((*
this)[
idir]);
873 int maxval = (*this)[0];
876 int curval = (*this)[
idir];
894 for (
int i=0; i<dim; ++i) {
895 retval[i] = s + retval[i];
908 for (
int i=0; i<dim; ++i) {
909 retval[i] = s - retval[i];
921 for (
int i=0; i<dim; ++i) {
922 retval[i] = s * retval[i];
984template<
int dim = AMREX_SPACEDIM>
1067template<
int dim, std::enable_if_t<( 1<=dim && dim<=3 ),
int> = 0>
1068AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
1069Dim3 refine (Dim3 const& coarse, IntVectND<dim> const& ratio) noexcept
1071 if constexpr (dim == 1) {
1072 return Dim3{coarse.x*ratio[0], coarse.y, coarse.z};
1073 } else if constexpr (dim == 2) {
1074 return Dim3{coarse.x*ratio[0], coarse.y*ratio[1], coarse.z};
1076 return Dim3{coarse.x*ratio[0], coarse.y*ratio[1], coarse.z*ratio[2]};
1080template<
int dim, std::enable_if_t<( 1<=dim && dim<=3 ),
int> = 0>
1081AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
1082Dim3 coarsen (Dim3 const& fine, IntVectND<dim> const& ratio) noexcept
1084 if constexpr (dim == 1) {
1085 return Dim3{amrex::coarsen(fine.x, ratio[0]),
1088 } else if constexpr (dim == 2) {
1089 return Dim3{amrex::coarsen(fine.x, ratio[0]),
1090 amrex::coarsen(fine.y, ratio[1]),
1093 return Dim3{amrex::coarsen(fine.x, ratio[0]),
1094 amrex::coarsen(fine.y, ratio[1]),
1095 amrex::coarsen(fine.z, ratio[2])};
1100 std::ostream&
int_vector_write (std::ostream& os, const
int* iv,
int dim);
1101 std::istream&
int_vector_read (std::istream& is,
int* iv,
int dim);
1106 for (
int i=0; i<dim; ++i) {
1115 for (
int i=0; i<dim; ++i) {
1121 template<
class T, std::size_t...Ns>
1128 template<
int...dims>
1131 return (0 + ... + dims);
1139 return detail::int_vector_write(os, iv.
begin(), dim);
1146 return detail::int_vector_read(is, iv.
begin(), dim);
1153template<
int d,
int...dims>
1156constexpr IntVectND<detail::get_sum<d, dims...>()>
1158 IntVectND<detail::get_sum<d, dims...>()> retval (0);
1159 int* dst = retval.
begin();
1160 detail::IntVectCat_imp(dst, v);
1161 (detail::IntVectCat_imp(dst, vects), ...);
1169template<
int d,
int...dims>
1172constexpr GpuTuple<IntVectND<d>, IntVectND<dims>...>
1175 return detail::IntVectSplit_imp(retval,
1176 std::make_index_sequence<1 +
sizeof...(dims)>(),
1184template<
int new_dim,
int old_dim>
1187constexpr IntVectND<new_dim>
1189 return iv.template shrink<new_dim>();
1196template<
int new_dim,
int old_dim>
1199constexpr IntVectND<new_dim>
1201 return iv.template expand<new_dim>(fill_extra);
1208template<
int new_dim,
int old_dim>
1211constexpr IntVectND<new_dim>
1213 return iv.template resize<new_dim>(fill_extra);
1220struct std::tuple_size<
amrex::IntVectND<dim>> {
1221 static constexpr std::size_t value = dim;
1225template<std::
size_t s,
int dim>
1226struct std::tuple_element<s,
amrex::IntVectND<dim>> {
std::ostream & operator<<(std::ostream &os, const BLProfStats::TimeRange &tr)
Definition AMReX_BLProfStats.cpp:344
#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
int idir
Definition AMReX_HypreMLABecLap.cpp:1093
Definition AMReX_Tuple.H:93
Definition AMReX_IntVect.H:48
IntVectND(const Array< int, dim > &a) noexcept
Construct an IntVectND from an Array<int,dim>.
Definition AMReX_IntVect.H:142
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr const int & get() const noexcept
Returns a reference to the i'th coordinate of the IntVectND. Used by structured bindings.
Definition AMReX_IntVect.H:252
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr const int * begin() const noexcept
Returns a pointer to the first element of the IntVectND.
Definition AMReX_IntVect.H:260
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE constexpr IntVectND< dim > TheMinVector() noexcept
Definition AMReX_IntVect.H:718
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > & operator/=(int s) noexcept
Modifies IntVectND by division by a scalar to each component.
Definition AMReX_IntVect.H:511
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool allGE(const IntVectND< dim > &rhs) const noexcept
Returns true if this is greater than or equal to argument for all components. NOTE: This is NOT a str...
Definition AMReX_IntVect.H:441
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool operator<(const IntVectND< dim > &rhs) const noexcept
Return true if this is lexicographically less than rhs.
Definition AMReX_IntVect.H:332
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool allLE(const IntVectND< dim > &rhs) const noexcept
Returns true if this is less than or equal to argument for all components. NOTE: This is NOT a strict...
Definition AMReX_IntVect.H:391
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool allLE(int rhs) const noexcept
Returns true if this is less than or equal to argument for all components.
Definition AMReX_IntVect.H:403
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool allLT(int rhs) const noexcept
Returns true if this is less than argument for all components.
Definition AMReX_IntVect.H:378
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > operator/(const IntVectND< dim > &p) const noexcept
Returns component-wise division of IntVectND by argument.
Definition AMReX_IntVect.H:589
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > & max(const IntVectND< dim > &p) noexcept
Modifies IntVectND by taking component-wise max with argument.
Definition AMReX_IntVect.H:612
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE constexpr IntVectND< dim > TheNodeVector() noexcept
This static member function returns a reference to a constant IntVectND object, all of whose dim argu...
Definition AMReX_IntVect.H:700
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE constexpr int isize() noexcept
Definition AMReX_IntVect.H:728
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr int * begin() noexcept
Returns a pointer to the first element of the IntVectND.
Definition AMReX_IntVect.H:256
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int sum() const noexcept
Definition AMReX_IntVect.H:201
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr int & get() noexcept
Returns a reference to the i'th coordinate of the IntVectND. Used by structured bindings.
Definition AMReX_IntVect.H:247
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > & coarsen(int p) noexcept
Modify IntVectND<dim> by component-wise integer projection.
Definition AMReX_IntVect.H:814
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > & coarsen(const IntVectND< dim > &p) noexcept
Modify IntVectND<dim> by component-wise integer projection.
Definition AMReX_IntVect.H:842
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > operator-() const noexcept
Unary Minus – negates all components.
Definition AMReX_IntVect.H:466
int value_type
Definition AMReX_IntVect.H:732
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Array< T, dim > toArray() const noexcept
Definition AMReX_IntVect.H:188
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int maxDir(bool a_doAbsValue) const noexcept
Definition AMReX_IntVect.H:855
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > & shift(const IntVectND< dim > &iv) noexcept
Equivalent to shift(0,iv[0]).shift(1,iv[1]) ...
Definition AMReX_IntVect.H:646
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool allGT(const IntVectND< dim > &rhs) const noexcept
Returns true if this is greater than argument for all components. NOTE: This is NOT a strict weak ord...
Definition AMReX_IntVect.H:416
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > & operator+=(int s) noexcept
Modifies IntVectND by addition of a scalar to each component.
Definition AMReX_IntVect.H:475
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool operator!=(int val) const noexcept
Returns true if any component is not equal to the argument val.
Definition AMReX_IntVect.H:301
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int * getVect() &noexcept
Definition AMReX_IntVect.H:284
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool allGE(int rhs) const noexcept
Returns true if this is greater than or equal to argument for all components.
Definition AMReX_IntVect.H:453
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > & min(const IntVectND< dim > &p) noexcept
Modifies IntVectND by taking component-wise min with argument.
Definition AMReX_IntVect.H:603
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool operator==(int val) const noexcept
Returns true if all components are equal to the argument val.
Definition AMReX_IntVect.H:290
IntVectND(const Vector< int > &a) noexcept
Construct an IntVectND from an Vector<int>. It is an error if the Vector<int> doesn't have the same d...
Definition AMReX_IntVect.H:132
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > operator*(const IntVectND< dim > &p) const noexcept
Returns component-wise product of IntVectND and argument.
Definition AMReX_IntVect.H:575
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE constexpr IntVectND< dim > TheUnitVector() noexcept
This static member function returns a reference to a constant IntVectND object, all of whose dim argu...
Definition AMReX_IntVect.H:680
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr int & operator[](int i) noexcept
Returns a reference to the i'th coordinate of the IntVectND.
Definition AMReX_IntVect.H:238
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > & shift(int coord, int s) noexcept
Modify IntVectND by adding s to given coordinate.
Definition AMReX_IntVect.H:640
static const IntVectND< dim > Unit
Definition AMReX_IntVect.H:782
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > & diagShift(int s) noexcept
Modify IntVectND by adding s to each coordinate.
Definition AMReX_IntVect.H:649
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool allGT(int rhs) const noexcept
Returns true if this is greater than argument for all components.
Definition AMReX_IntVect.H:428
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE constexpr std::size_t size() noexcept
Definition AMReX_IntVect.H:723
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE constexpr IntVectND< dim > TheDimensionVector(int d) noexcept
This static member function returns a reference to a constant IntVectND object, all of whose dim argu...
Definition AMReX_IntVect.H:689
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool operator<=(const IntVectND< dim > &rhs) const noexcept
Return true if this is lexicographically less than or equal to rhs.
Definition AMReX_IntVect.H:345
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE const int * getVect() const &noexcept
Returns a const pointer to an array of coordinates of the IntVectND. Useful for arguments to FORTRAN ...
Definition AMReX_IntVect.H:282
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< new_dim > resize(int fill_extra=0) const noexcept
Returns a new IntVectND of size new_dim by either shrinking or expanding this IntVectND.
Definition AMReX_IntVect.H:766
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int min() const noexcept
minimum (no absolute values) value
Definition AMReX_IntVect.H:223
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< new_dim > expand(int fill_extra=0) const noexcept
Returns a new IntVectND of size new_dim and assigns all values of this IntVectND to it and fill_extra...
Definition AMReX_IntVect.H:751
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE constexpr IntVectND< dim > TheZeroVector() noexcept
This static member function returns a reference to a constant IntVectND object, all of whose dim argu...
Definition AMReX_IntVect.H:670
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > & scale(int s) noexcept
Modify IntVectND by multiplying each coordinate by s.
Definition AMReX_IntVect.H:621
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool operator>(const IntVectND< dim > &rhs) const noexcept
Return true if this is lexicographically greater than rhs.
Definition AMReX_IntVect.H:351
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int max() const noexcept
maximum (no absolute values) value
Definition AMReX_IntVect.H:212
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr const int * end() const noexcept
Returns a pointer to the (last+1) element of the IntVectND.
Definition AMReX_IntVect.H:268
AMREX_GPU_HOST_DEVICE IntVectND(const int *a) noexcept
Construct an IntVectND setting the coordinates to the corresponding values in the integer array a.
Definition AMReX_IntVect.H:121
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > operator+() const noexcept
Unary plus – for completeness.
Definition AMReX_IntVect.H:463
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND & setVal(int i, int val) noexcept
Set i'th coordinate of IntVectND to val.
Definition AMReX_IntVect.H:272
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< new_dim > shrink() const noexcept
Returns a new IntVectND of size new_dim and assigns the first new_dim values of this IntVectND to it.
Definition AMReX_IntVect.H:740
AMREX_GPU_HOST_DEVICE constexpr IntVectND(int i, int j, Args...ks) noexcept
Construct an IntVectND given the specific values for its coordinates. The inputs for this constructor...
Definition AMReX_IntVect.H:104
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > & reflect(int ref_ix, int idir) noexcept
Modify IntVectND by reflecting it in the plane defined by the index ref_ix and with normal in the dir...
Definition AMReX_IntVect.H:632
static const IntVectND< dim > Zero
Definition AMReX_IntVect.H:777
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > & operator*=(int s) noexcept
Modifies IntVectND by multiplication of a scalar to each component.
Definition AMReX_IntVect.H:493
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > & operator-=(int s) noexcept
Modifies IntVectND by subtraction of a scalar to each component.
Definition AMReX_IntVect.H:529
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE constexpr IntVectND< dim > TheMaxVector() noexcept
Definition AMReX_IntVect.H:714
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr int * end() noexcept
Returns a pointer to the (last+1) element of the IntVectND.
Definition AMReX_IntVect.H:264
constexpr IntVectND() noexcept
Construct an IntVectND whose components are all zero.
Definition AMReX_IntVect.H:91
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool operator>=(const IntVectND< dim > &rhs) const noexcept
Return true if this is lexicographically greater than or equal to rhs.
Definition AMReX_IntVect.H:357
int vect[dim]
Definition AMReX_IntVect.H:786
AMREX_GPU_HOST_DEVICE constexpr IntVectND(int s) noexcept
Construct an IntVectND whose components are all the same.
Definition AMReX_IntVect.H:110
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool allLT(const IntVectND< dim > &rhs) const noexcept
Returns true if this is less than argument for all components. NOTE: This is NOT a strict weak orderi...
Definition AMReX_IntVect.H:366
AMREX_GPU_HOST_DEVICE int * getVect() &&=delete
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE constexpr IntVectND< dim > TheCellVector() noexcept
This static member function returns a reference to a constant IntVectND object, all of whose dim argu...
Definition AMReX_IntVect.H:709
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition AMReX_Vector.H:27
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr T IntVectSplit_imp(T &retval, std::index_sequence< Ns... >, const int *src) noexcept
Definition AMReX_IntVect.H:1123
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr int get_sum()
Definition AMReX_IntVect.H:1130
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr void IntVectCat_imp(int *&dst, const IntVectND< dim > &src) noexcept
Definition AMReX_IntVect.H:1105
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr void IntVectSplit_imp2(IntVectND< dim > &dst, const int *&src) noexcept
Definition AMReX_IntVect.H:1114
Definition AMReX_Amr.cpp:49
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > BASISV(int dir) noexcept
Returns a basis vector in the given coordinate direction; eg. IntVectND<3> BASISV<3>(1) == (0,...
Definition AMReX_IntVect.H:988
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > diagShift(const IntVectND< dim > &p, int s) noexcept
Returns IntVectND obtained by adding s to each of the components of this IntVectND.
Definition AMReX_IntVect.H:1031
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > reflect(const IntVectND< dim > &a, int ref_ix, int idir) noexcept
Returns an IntVectND that is the reflection of input in the plane which passes through ref_ix and nor...
Definition AMReX_IntVect.H:1018
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE GpuComplex< T > operator+(const GpuComplex< T > &a_x)
Identity operation on a complex number.
Definition AMReX_GpuComplex.H:166
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr const T & min(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:21
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr T elemwiseMin(T const &a, T const &b) noexcept
Definition AMReX_Algorithm.H:49
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > scale(const IntVectND< dim > &p, int s) noexcept
Returns a IntVectND obtained by multiplying each of the components of this IntVectND by s.
Definition AMReX_IntVect.H:1004
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE 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:1173
constexpr bool IsConvertible_v
Definition AMReX_TypeTraits.H:262
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr IntVectND< new_dim > IntVectResize(const IntVectND< old_dim > &iv, int fill_extra=0) noexcept
Returns a new IntVectND of size new_dim by either shrinking or expanding iv.
Definition AMReX_IntVect.H:1212
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > coarsen(const BoxND< dim > &b, int ref_ratio) noexcept
Coarsen BoxND by given (positive) refinement ratio. NOTE: if type(dir) = CELL centered: lo <- lo/rati...
Definition AMReX_Box.H:1304
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE GpuComplex< T > operator*(const GpuComplex< T > &a_x, const GpuComplex< T > &a_y) noexcept
Multiply two complex numbers.
Definition AMReX_GpuComplex.H:252
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr IntVectND< new_dim > IntVectShrink(const IntVectND< old_dim > &iv) noexcept
Returns a new IntVectND of size new_dim and assigns the first new_dim values of iv to it.
Definition AMReX_IntVect.H:1188
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void ignore_unused(const Ts &...)
This shuts up the compiler about unused variables.
Definition AMReX.H:127
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr IntVectND< new_dim > IntVectExpand(const IntVectND< old_dim > &iv, int fill_extra=0) noexcept
Returns a new IntVectND of size new_dim and assigns all values of iv to it and fill_extra to the rema...
Definition AMReX_IntVect.H:1200
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr const T & max(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:35
const int[]
Definition AMReX_BLProfiler.cpp:1664
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE GpuComplex< T > operator-(const GpuComplex< T > &a_x)
Negate a complex number.
Definition AMReX_GpuComplex.H:173
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr T elemwiseMax(T const &a, T const &b) noexcept
Definition AMReX_Algorithm.H:62
std::array< T, N > Array
Definition AMReX_Array.H:24
Definition AMReX_IntVect.H:52
std::size_t operator()(const IntVectND< dim > &vec) const noexcept
Definition AMReX_IntVect.H:53
int type
Definition AMReX_IntVect.H:1227