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;
41 return (i<0) ? -std::abs(i+1)/ratio-1 : i/ratio;
59 static_assert(dim >= 1,
"The number of dimensions of IntVectND must be positive");
65 static constexpr unsigned shift1 =
sizeof(size_t)>=8 ? 20 : 10;
66 static constexpr unsigned shift2 =
sizeof(size_t)>=8 ? 40 : 20;
67 if constexpr (dim == 1) {
70 return static_cast<std::size_t
>(vec[0]);
71 }
else if constexpr (dim == 2) {
73 return static_cast<std::size_t
>(vec[0]) ^
74 (
static_cast<std::size_t
>(vec[1]) << shift1);
75 }
else if constexpr (dim == 3) {
76 return static_cast<std::size_t
>(vec[0]) ^
77 (
static_cast<std::size_t
>(vec[1]) << shift1) ^
78 (
static_cast<std::size_t
>(vec[2]) << shift2);
80 std::size_t seed = dim;
83 for (
int i=0; i<dim; ++i) {
84 auto x =
static_cast<unsigned int>(vec[i]);
85 x = ((
x >> 16) ^
x) * 0x45d9f3b;
86 x = ((
x >> 16) ^
x) * 0x45d9f3b;
88 seed ^=
x + 0x9e3779b9 + (seed << 6) + (seed >> 2);
108 template <
class...Args,
110 (
sizeof...(Args)+2 == dim) &&
114 constexpr IntVectND (
int i,
int j, Args...ks) noexcept :
vect{i, j,
static_cast<int>(ks)...} {}
121 for (
int i=0; i<dim; ++i) {
132 for (
int i=0; i<dim; ++i) {
144 for (
int i=0; i<dim; ++i) {
153 for (
int i=0; i<dim; ++i) {
158 template <
int N=dim, std::enable_if_t<( 1<=N && N<=3 ),
int> = 0>
159 explicit constexpr IntVectND (Dim3 const& a) noexcept {
161 if constexpr (dim >= 2) {
164 if constexpr (dim == 3) {
171 template <
int N=dim, std::enable_if_t<( 1<=N && N<=3 ),
int> = 0>
172 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
173 constexpr Dim3 dim3 () const noexcept {
174 if constexpr (dim == 1) {
175 return Dim3{vect[0],0,0};
176 } else if constexpr (dim == 2) {
177 return Dim3{vect[0],vect[1],0};
179 return Dim3{vect[0],vect[1],vect[2]};
183 template <
int N=dim, std::enable_if_t<( 1<=N && N<=3 ),
int> = 0>
184 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
185 constexpr Dim3 dim3 ([[maybe_unused]]
int fill_extra) const noexcept {
186 if constexpr (dim == 1) {
187 return Dim3{vect[0],fill_extra,fill_extra};
188 } else if constexpr (dim == 2) {
189 return Dim3{vect[0],vect[1],fill_extra};
191 return Dim3{vect[0],vect[1],vect[2]};
195 template<
typename T =
int >
199 for (
int i=0; i<dim; ++i) {
210 constexpr int sum () const noexcept
212 int retval =
vect[0];
213 for (
int i=1; i<dim; ++i) {
221 constexpr int max () const noexcept
223 int retval =
vect[0];
224 for (
int i=1; i<dim; ++i) {
225 retval = retval >
vect[i] ? retval :
vect[i];
232 constexpr int min () const noexcept
234 int retval =
vect[0];
235 for (
int i=1; i<dim; ++i) {
236 retval = retval <
vect[i] ? retval :
vect[i];
243 int maxDir(
bool a_doAbsValue)
const noexcept;
254 template<std::
size_t i>
256 int&
get () noexcept {
static_assert(0<=i && i<dim);
return vect[i];}
259 template<std::
size_t i>
261 const int&
get () const noexcept {
static_assert(0<=i && i<dim);
return vect[i];}
277 const int*
end () const noexcept {
return &
vect[dim]; }
301 bool retval =
vect[0] == val;
302 for (
int i=1; i<dim; ++i) {
303 retval = retval &&
vect[i] == val;
312 bool retval =
vect[0] != val;
313 for (
int i=1; i<dim; ++i) {
314 retval = retval ||
vect[i] != val;
323 bool retval =
vect[0] == rhs[0];
324 for (
int i=1; i<dim; ++i) {
325 retval = retval &&
vect[i] == rhs[i];
333 bool retval =
vect[0] != rhs[0];
334 for (
int i=1; i<dim; ++i) {
335 retval = retval ||
vect[i] != rhs[i];
343 for (
int i=dim-1; i>=0; --i) {
344 if (
vect[i] < rhs[i]) {
346 }
else if (
vect[i] > rhs[i]) {
356 return !(rhs < *
this);
368 return !(*
this < rhs);
377 bool retval =
vect[0] < rhs[0];
378 for (
int i=1; i<dim; ++i) {
379 retval = retval &&
vect[i] < rhs[i];
387 constexpr bool allLT (
int rhs)
const noexcept
389 bool retval =
vect[0] < rhs;
390 for (
int i=1; i<dim; ++i) {
391 retval = retval &&
vect[i] < rhs;
402 bool retval =
vect[0] <= rhs[0];
403 for (
int i=1; i<dim; ++i) {
404 retval = retval &&
vect[i] <= rhs[i];
412 constexpr bool allLE (
int rhs)
const noexcept
414 bool retval =
vect[0] <= rhs;
415 for (
int i=1; i<dim; ++i) {
416 retval = retval &&
vect[i] <= rhs;
427 bool retval =
vect[0] > rhs[0];
428 for (
int i=1; i<dim; ++i) {
429 retval = retval &&
vect[i] > rhs[i];
437 constexpr bool allGT (
int rhs)
const noexcept
439 bool retval =
vect[0] > rhs;
440 for (
int i=1; i<dim; ++i) {
441 retval = retval &&
vect[i] > rhs;
452 bool retval =
vect[0] >= rhs[0];
453 for (
int i=1; i<dim; ++i) {
454 retval = retval &&
vect[i] >= rhs[i];
462 constexpr bool allGE (
int rhs)
const noexcept
464 bool retval =
vect[0] >= rhs;
465 for (
int i=1; i<dim; ++i) {
466 retval = retval &&
vect[i] >= rhs;
477 for (
int i=0; i<dim; ++i) {
478 retval[i] = -
vect[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) {
549 for (
int i=0; i<dim; ++i) {
614 for (
int i=0; i<dim; ++i) {
623 for (
int i=0; i<dim; ++i) {
631 for (
int i=0; i<dim; ++i) {
651 BL_ASSERT(coord >= 0 && coord < dim);
vect[coord] += s;
return *
this;
660 for (
int i=0; i<dim; ++i) {
732 static constexpr std::size_t
size () noexcept {
733 return static_cast<std::size_t
>(dim);
737 static constexpr int isize () noexcept {
747 template<
int new_dim>
750 static_assert(new_dim <= dim);
758 template<
int new_dim>
761 static_assert(new_dim >= dim);
763 for (
int i=0; i<dim; ++i) {
773 template<
int new_dim>
776 if constexpr (new_dim > dim) {
777 return expand<new_dim>(fill_extra);
779 return shrink<new_dim>();
803template<std::
size_t dim>
808template <
class...Args,
830 for (
int i=0; i<dim; ++i) {
831 vect[i] = (vect[i]<0) ? -std::abs(vect[i]+1)/2-1 : vect[i]/2;
835 for (
int i=0; i<dim; ++i) {
836 vect[i] = (vect[i]<0) ? -std::abs(vect[i]+1)/4-1 : vect[i]/4;
840 for (
int i=0; i<dim; ++i) {
841 vect[i] = (vect[i]<0) ? -std::abs(vect[i]+1)/s-1 : vect[i]/s;
854 for (
int i=0; i<dim; ++i) {
869 int maxval = std::abs((*
this)[0]);
872 int curval = std::abs((*
this)[
idir]);
882 int maxval = (*this)[0];
885 int curval = (*this)[
idir];
903 for (
int i=0; i<dim; ++i) {
904 retval[i] = s + retval[i];
917 for (
int i=0; i<dim; ++i) {
918 retval[i] = s - retval[i];
930 for (
int i=0; i<dim; ++i) {
931 retval[i] = s * retval[i];
943constexpr IntVectND<dim>
954constexpr IntVectND<dim>
969constexpr IntVectND<dim>
980constexpr IntVectND<dim>
993template<
int dim = AMREX_SPACEDIM>
1012constexpr IntVectND<dim>
1026constexpr IntVectND<dim>
1039constexpr IntVectND<dim>
1076template<
int dim, std::enable_if_t<( 1<=dim && dim<=3 ),
int> = 0>
1077AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
1078constexpr Dim3 refine (Dim3 const& coarse, IntVectND<dim> const& ratio) noexcept
1080 if constexpr (dim == 1) {
1081 return Dim3{coarse.x*ratio[0], coarse.y, coarse.z};
1082 } else if constexpr (dim == 2) {
1083 return Dim3{coarse.x*ratio[0], coarse.y*ratio[1], coarse.z};
1085 return Dim3{coarse.x*ratio[0], coarse.y*ratio[1], coarse.z*ratio[2]};
1089template<
int dim, std::enable_if_t<( 1<=dim && dim<=3 ),
int> = 0>
1090AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
1091Dim3 coarsen (Dim3 const& fine, IntVectND<dim> const& ratio) noexcept
1093 if constexpr (dim == 1) {
1094 return Dim3{amrex::coarsen(fine.x, ratio[0]),
1097 } else if constexpr (dim == 2) {
1098 return Dim3{amrex::coarsen(fine.x, ratio[0]),
1099 amrex::coarsen(fine.y, ratio[1]),
1102 return Dim3{amrex::coarsen(fine.x, ratio[0]),
1103 amrex::coarsen(fine.y, ratio[1]),
1104 amrex::coarsen(fine.z, ratio[2])};
1110 std::ostream&
int_vector_write (std::ostream& os, const
int* iv,
int dim);
1111 std::istream&
int_vector_read (std::istream& is,
int* iv,
int dim);
1115 void IntVectCat_imp (
int*& dst,
const IntVectND<dim>& src)
noexcept {
1116 for (
int i=0; i<dim; ++i) {
1124 void IntVectSplit_imp2 (IntVectND<dim>& dst,
const int*& src)
noexcept {
1125 for (
int i=0; i<dim; ++i) {
1131 template<
class T, std::size_t...Ns>
1133 T IntVectSplit_imp (T& retval, std::index_sequence<Ns...>,
const int * src)
noexcept {
1134 (IntVectSplit_imp2(amrex::get<Ns>(retval), src), ...);
1138 template<
int...dims>
1141 return (0 + ... + dims);
1150 return detail::int_vector_write(os, iv.
begin(), dim);
1157 return detail::int_vector_read(is, iv.
begin(), dim);
1164template<
int d,
int...dims>
1167constexpr IntVectND<detail::get_sum<d, dims...>()>
1169 IntVectND<detail::get_sum<d, dims...>()> retval (0);
1170 int* dst = retval.
begin();
1171 detail::IntVectCat_imp(dst, v);
1172 (detail::IntVectCat_imp(dst, vects), ...);
1180template<
int d,
int...dims>
1183constexpr GpuTuple<IntVectND<d>, IntVectND<dims>...>
1186 return detail::IntVectSplit_imp(retval,
1187 std::make_index_sequence<1 +
sizeof...(dims)>(),
1195template<
int new_dim,
int old_dim>
1198constexpr IntVectND<new_dim>
1200 return iv.template shrink<new_dim>();
1207template<
int new_dim,
int old_dim>
1210constexpr IntVectND<new_dim>
1212 return iv.template expand<new_dim>(fill_extra);
1219template<
int new_dim,
int old_dim>
1222constexpr IntVectND<new_dim>
1224 return iv.template resize<new_dim>(fill_extra);
1228template <std::
size_t I,
int dim>
1233 template <
typename F,
int dim, std::size_t... N>
1235 constexpr auto apply_impl (F&& f, IntVectND<dim>
const& iv,
1236 std::index_sequence<N...> )
1238 return std::forward<F>(f)(amrex::get<N>(iv)...);
1244template <
typename F,
int dim>
1248 return detail::apply_impl(std::forward<F>(f), iv, std::make_index_sequence<dim>());
1255struct std::tuple_size<
amrex::IntVectND<dim>> {
1256 static constexpr std::size_t value = dim;
1260template<std::
size_t s,
int dim>
1261struct std::tuple_element<s,
amrex::IntVectND<dim>> {
#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
GPU-compatible tuple.
Definition AMReX_Tuple.H:98
An Integer Vector in dim-Dimensional Space.
Definition AMReX_IntVect.H:57
__host__ __device__ constexpr IntVectND< dim > & operator*=(int s) noexcept
Modifies IntVectND by multiplication of a scalar to each component.
Definition AMReX_IntVect.H:502
__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:131
__host__ __device__ int * getVect() &noexcept
Definition AMReX_IntVect.H:293
__host__ __device__ constexpr IntVectND< dim > operator*(const IntVectND< dim > &p) const noexcept
Returns component-wise product of IntVectND and argument.
Definition AMReX_IntVect.H:584
__host__ __device__ constexpr int & operator[](int i) noexcept
Returns a reference to the i'th coordinate of the IntVectND.
Definition AMReX_IntVect.H:247
__host__ __device__ constexpr 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:425
__host__ __device__ constexpr bool operator>(const IntVectND< dim > &rhs) const noexcept
Return true if this is lexicographically greater than rhs.
Definition AMReX_IntVect.H:360
__host__ __device__ constexpr IntVectND< dim > & shift(int coord, int s) noexcept
Modify IntVectND by adding s to given coordinate.
Definition AMReX_IntVect.H:649
__host__ __device__ constexpr int min() const noexcept
minimum (no absolute values) value
Definition AMReX_IntVect.H:232
__host__ __device__ constexpr 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:760
__host__ __device__ constexpr IntVectND< dim > & operator+=(int s) noexcept
Modifies IntVectND by addition of a scalar to each component.
Definition AMReX_IntVect.H:484
__host__ __device__ constexpr IntVectND< dim > & shift(const IntVectND< dim > &iv) noexcept
Equivalent to shift(0,iv[0]).shift(1,iv[1]) ...
Definition AMReX_IntVect.H:655
int value_type
Definition AMReX_IntVect.H:741
__host__ __device__ constexpr Array< T, dim > toArray() const noexcept
Definition AMReX_IntVect.H:197
__host__ __device__ constexpr int & get() noexcept
Returns a reference to the i'th coordinate of the IntVectND. Used by structured bindings.
Definition AMReX_IntVect.H:256
__host__ __device__ int * getVect() &&=delete
constexpr IntVectND(const Array< int, dim > &a) noexcept
Construct an IntVectND from an Array<int,dim>.
Definition AMReX_IntVect.H:152
__host__ static __device__ constexpr IntVectND< dim > TheMaxVector() noexcept
Definition AMReX_IntVect.H:723
__host__ static __device__ constexpr std::size_t size() noexcept
Definition AMReX_IntVect.H:732
__host__ __device__ IntVectND & setVal(int i, int val) noexcept
Set i'th coordinate of IntVectND to val.
Definition AMReX_IntVect.H:281
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:142
__host__ __device__ constexpr bool allGT(int rhs) const noexcept
Returns true if this is greater than argument for all components.
Definition AMReX_IntVect.H:437
__host__ __device__ constexpr int * begin() noexcept
Returns a pointer to the first element of the IntVectND.
Definition AMReX_IntVect.H:265
__host__ __device__ IntVectND< dim > & coarsen(const IntVectND< dim > &p) noexcept
Modify IntVectND<dim> by component-wise integer projection.
Definition AMReX_IntVect.H:851
__host__ static __device__ 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:689
__host__ __device__ int maxDir(bool a_doAbsValue) const noexcept
Definition AMReX_IntVect.H:864
__host__ __device__ 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:291
static const IntVectND< dim > Unit
Definition AMReX_IntVect.H:791
__host__ __device__ constexpr IntVectND< dim > & min(const IntVectND< dim > &p) noexcept
Modifies IntVectND by taking component-wise min with argument.
Definition AMReX_IntVect.H:612
__host__ __device__ constexpr int sum() const noexcept
Definition AMReX_IntVect.H:210
__host__ __device__ constexpr IntVectND< dim > & scale(int s) noexcept
Modify IntVectND by multiplying each coordinate by s.
Definition AMReX_IntVect.H:630
__host__ __device__ constexpr const int * begin() const noexcept
Returns a pointer to the first element of the IntVectND.
Definition AMReX_IntVect.H:269
__host__ __device__ constexpr 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:450
__host__ __device__ constexpr 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:641
__host__ static __device__ 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:718
__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:114
__host__ __device__ constexpr bool operator==(int val) const noexcept
Returns true if all components are equal to the argument val.
Definition AMReX_IntVect.H:299
__host__ __device__ constexpr IntVectND< dim > & diagShift(int s) noexcept
Modify IntVectND by adding s to each coordinate.
Definition AMReX_IntVect.H:658
__host__ __device__ constexpr IntVectND< dim > operator-() const noexcept
Unary Minus – negates all components.
Definition AMReX_IntVect.H:475
__host__ __device__ constexpr 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:775
__host__ static __device__ 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:679
__host__ __device__ constexpr IntVectND< dim > operator+() const noexcept
Unary plus – for completeness.
Definition AMReX_IntVect.H:472
__host__ __device__ IntVectND< dim > & coarsen(int p) noexcept
Modify IntVectND<dim> by component-wise integer projection.
Definition AMReX_IntVect.H:823
__host__ __device__ constexpr int max() const noexcept
maximum (no absolute values) value
Definition AMReX_IntVect.H:221
__host__ __device__ constexpr 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:375
__host__ static __device__ 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:709
static const IntVectND< dim > Zero
Definition AMReX_IntVect.H:786
__host__ __device__ constexpr bool allLE(int rhs) const noexcept
Returns true if this is less than or equal to argument for all components.
Definition AMReX_IntVect.H:412
__host__ __device__ constexpr IntVectND< dim > & operator-=(int s) noexcept
Modifies IntVectND by subtraction of a scalar to each component.
Definition AMReX_IntVect.H:538
__host__ __device__ constexpr IntVectND< dim > operator/(const IntVectND< dim > &p) const noexcept
Returns component-wise division of IntVectND by argument.
Definition AMReX_IntVect.H:598
__host__ __device__ constexpr IntVectND< dim > & operator/=(int s) noexcept
Modifies IntVectND by division by a scalar to each component.
Definition AMReX_IntVect.H:520
__host__ __device__ constexpr int * end() noexcept
Returns a pointer to the (last+1) element of the IntVectND.
Definition AMReX_IntVect.H:273
__host__ static __device__ constexpr int isize() noexcept
Definition AMReX_IntVect.H:737
__host__ __device__ constexpr bool operator<=(const IntVectND< dim > &rhs) const noexcept
Return true if this is lexicographically less than or equal to rhs.
Definition AMReX_IntVect.H:354
__host__ __device__ constexpr IntVectND(int s) noexcept
Construct an IntVectND whose components are all the same.
Definition AMReX_IntVect.H:120
__host__ __device__ constexpr const int * end() const noexcept
Returns a pointer to the (last+1) element of the IntVectND.
Definition AMReX_IntVect.H:277
__host__ __device__ constexpr bool operator<(const IntVectND< dim > &rhs) const noexcept
Return true if this is lexicographically less than rhs.
Definition AMReX_IntVect.H:341
__host__ __device__ 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:261
__host__ __device__ constexpr bool operator!=(int val) const noexcept
Returns true if any component is not equal to the argument val.
Definition AMReX_IntVect.H:310
__host__ __device__ constexpr 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:400
__host__ __device__ constexpr bool allGE(int rhs) const noexcept
Returns true if this is greater than or equal to argument for all components.
Definition AMReX_IntVect.H:462
__host__ __device__ constexpr IntVectND< dim > & max(const IntVectND< dim > &p) noexcept
Modifies IntVectND by taking component-wise max with argument.
Definition AMReX_IntVect.H:621
__host__ __device__ constexpr bool allLT(int rhs) const noexcept
Returns true if this is less than argument for all components.
Definition AMReX_IntVect.H:387
constexpr IntVectND() noexcept
Construct an IntVectND whose components are all zero.
Definition AMReX_IntVect.H:101
int vect[dim]
Definition AMReX_IntVect.H:793
__host__ static __device__ constexpr IntVectND< dim > TheMinVector() noexcept
Definition AMReX_IntVect.H:727
__host__ __device__ constexpr bool operator>=(const IntVectND< dim > &rhs) const noexcept
Return true if this is lexicographically greater than or equal to rhs.
Definition AMReX_IntVect.H:366
__host__ __device__ constexpr 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:749
__host__ static __device__ 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:698
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition AMReX_Vector.H:28
__host__ __device__ BoxND< dim > coarsen(const BoxND< dim > &b, int ref_ratio) noexcept
Coarsen BoxND by given (positive) coarsening ratio.
Definition AMReX_Box.H:1409
std::array< T, N > Array
Definition AMReX_Array.H:26
Definition AMReX_Amr.cpp:49
__host__ __device__ void ignore_unused(const Ts &...)
This shuts up the compiler about unused variables.
Definition AMReX.H:138
__host__ __device__ 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:1223
__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:1184
__host__ __device__ 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:997
__host__ __device__ constexpr T elemwiseMax(T const &a, T const &b) noexcept
Return the element-wise maximum of the given values for types like XDim3.
Definition AMReX_Algorithm.H:77
__host__ __device__ GpuComplex< T > operator*(const GpuComplex< T > &a_x, const GpuComplex< U > &a_y) noexcept
Multiply two complex numbers.
Definition AMReX_GpuComplex.H:257
__host__ __device__ constexpr 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:1040
__host__ __device__ constexpr const T & min(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:24
constexpr bool IsConvertible_v
Definition AMReX_TypeTraits.H:276
__host__ __device__ constexpr 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:1027
__host__ __device__ 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:1199
__host__ __device__ constexpr auto Apply(F &&f, IntVectND< dim > const &iv)
Definition AMReX_IntVect.H:1246
__host__ __device__ constexpr 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:1013
__host__ __device__ constexpr const T & max(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:44
__host__ __device__ 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:1211
const int[]
Definition AMReX_BLProfiler.cpp:1664
__host__ __device__ XDim3 operator-(XDim3 const &a, XDim3 const &b)
Definition AMReX_Dim3.H:34
__host__ __device__ XDim3 operator+(XDim3 const &a, XDim3 const &b)
Definition AMReX_Dim3.H:28
__host__ __device__ constexpr T elemwiseMin(T const &a, T const &b) noexcept
Return the element-wise minimum of the given values for types like XDim3.
Definition AMReX_Algorithm.H:62
__host__ __device__ constexpr int get(IntVectND< dim > const &iv) noexcept
Get I'th element of IntVectND<dim>
Definition AMReX_IntVect.H:1230
Hash function for IntVectND.
Definition AMReX_IntVect.H:62
std::size_t operator()(const IntVectND< dim > &vec) const noexcept
Definition AMReX_IntVect.H:63
int type
Definition AMReX_IntVect.H:1262