Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
AMReX_IntVect.H
Go to the documentation of this file.
1#ifndef AMREX_INTVECT_H_
2#define AMREX_INTVECT_H_
3#include <AMReX_Config.H>
4
5#include <AMReX.H>
6#include <AMReX_INT.H>
7#include <AMReX_SPACE.H>
8#include <AMReX_Array.H>
9#include <AMReX_Vector.H>
10#include <AMReX_Dim3.H>
11#include <AMReX_BLassert.H>
12#include <AMReX_Extension.H>
13#include <AMReX_GpuQualifiers.H>
14#include <AMReX_Math.H>
15#include <AMReX_Tuple.H>
16#include <AMReX_TypeTraits.H>
17
18#include <iosfwd>
19#include <cstdlib>
20#include <cmath>
21#include <limits>
22#include <climits>
23#include <algorithm>
24
25namespace amrex {
26
28int coarsen (int i, int ratio) noexcept
29{
30 switch (ratio) {
31 case 1: return i;
32 case 2: return (i<0) ? -std::abs(i+1)/2 -1 : i/2;
33 case 4: return (i<0) ? -std::abs(i+1)/4 -1 : i/4;
34 default: return (i<0) ? -std::abs(i+1)/ratio-1 : i/ratio;
35 }
36}
37
38template <int ratio>
40int coarsen (int i) noexcept
41{
42 return (i<0) ? -std::abs(i+1)/ratio-1 : i/ratio;
43}
44
46namespace detail
47{
48 template <typename T>
49 std::ostream& T_vector_write (std::ostream& os, const T* data, int dim)
50 {
51 os << '(' << data[0];
52 for (int i = 1; i < dim; ++i) {
53 os << ',' << data[i];
54 }
55 os << ')';
56 if (os.fail()) {
57 amrex::Error("operator<<(ostream&,[Int|Real]Vect&) failed");
58 }
59 return os;
60 }
61
62 template <typename T>
63 std::istream& T_vector_read (std::istream& is, T* data, int dim)
64 {
65 is >> std::ws;
66 char c;
67 is >> c;
68
69 for (int i = 0; i < dim; ++i) {
70 data[i] = T(0);
71 }
72
73 if (c == '(')
74 {
75 int component = 0;
76 bool need_comma = false;
77
78 while (true) {
79 is >> std::ws;
80 int ic = is.peek();
81
82 if (ic == std::char_traits<char>::eof()) {
83 if (component == 0) {
84 amrex::Error("operator>>(ostream&,[Int|Real]Vect&): missing first component");
85 } else {
86 amrex::Error("operator>>(ostream&,[Int|Real]Vect&): premature EOF");
87 }
88 }
89
90 if (ic == static_cast<int>(')')) {
91 is.get();
92 if (component == 0) {
93 amrex::Error("operator>>(ostream&,[Int|Real]Vect&): missing first component");
94 }
95 break;
96 }
97
98 if (need_comma) {
99 if (ic != static_cast<int>(',')) {
100 amrex::Error("operator>>(ostream&,[Int|Real]Vect&): expected ',' or ')'");
101 }
102 is.get();
103 is >> std::ws;
104 }
105
106 T value{};
107 if (!(is >> value)) {
108 if (component == 0) {
109 amrex::Error("operator>>(ostream&,[Int|Real]Vect&): missing first component");
110 } else {
111 amrex::Error("operator>>(ostream&,[Int|Real]Vect&): premature EOF");
112 }
113 }
114
115 if (component < dim) {
116 data[component] = value;
117 }
118 ++component;
119 need_comma = true;
120 }
121 }
122 else
123 {
124 amrex::Error("operator>>(ostream&,[Int|Real]Vect&): expected '('");
125 }
126
127 if (is.fail()) {
128 amrex::Error("operator>>(ostream&,[Int|Real]Vect&) failed");
129 }
130
131 return is;
132 }
133}
135
147template<int dim>
149{
150public:
151 static_assert(dim >= 1, "The number of dimensions of IntVectND must be positive");
152
155 std::size_t operator()(const IntVectND<dim>& vec) const noexcept
156 {
157 static constexpr unsigned shift1 = sizeof(size_t)>=8 ? 20 : 10;
158 static constexpr unsigned shift2 = sizeof(size_t)>=8 ? 40 : 20;
159 if constexpr (dim == 1) {
160 amrex::ignore_unused(shift1);
161 amrex::ignore_unused(shift2);
162 return static_cast<std::size_t>(vec[0]);
163 } else if constexpr (dim == 2) {
164 amrex::ignore_unused(shift2);
165 return static_cast<std::size_t>(vec[0]) ^
166 (static_cast<std::size_t>(vec[1]) << shift1);
167 } else if constexpr (dim == 3) {
168 return static_cast<std::size_t>(vec[0]) ^
169 (static_cast<std::size_t>(vec[1]) << shift1) ^
170 (static_cast<std::size_t>(vec[2]) << shift2);
171 } else {
172 std::size_t seed = dim;
173 // hash function from
174 // https://stackoverflow.com/questions/20511347/a-good-hash-function-for-a-vector
175 for (int i=0; i<dim; ++i) {
176 auto x = static_cast<unsigned int>(vec[i]);
177 x = ((x >> 16) ^ x) * 0x45d9f3b;
178 x = ((x >> 16) ^ x) * 0x45d9f3b;
179 x = (x >> 16) ^ x;
180 seed ^= x + 0x9e3779b9 + (seed << 6) + (seed >> 2);
181 }
182 return seed;
183 }
184 }
185 };
186
188
190
193 constexpr IntVectND () noexcept {} // cannot use = default due to Clang bug // NOLINT
194
200 template <class...Args,
201 std::enable_if_t<
202 (sizeof...(Args)+2 == dim) &&
203 IsConvertible_v<int, Args...>,
204 int> = 0>
206 constexpr IntVectND (int i, int j, Args...ks) noexcept : vect{i, j, static_cast<int>(ks)...} {}
207
212 explicit constexpr IntVectND (int s) noexcept {
213 for (int i=0; i<dim; ++i) {
214 vect[i] = s;
215 }
216 }
217
223 explicit IntVectND (const int* a) noexcept {
224 for (int i=0; i<dim; ++i) {
225 vect[i] = a[i];
226 }
227 }
228
234 explicit IntVectND (const Vector<int>& a) noexcept {
235 BL_ASSERT(a.size() == dim);
236 for (int i=0; i<dim; ++i) {
237 vect[i] = a[i];
238 }
239 }
240
244 explicit constexpr IntVectND (const Array<int,dim>& a) noexcept {
245 for (int i=0; i<dim; ++i) {
246 vect[i] = a[i];
247 }
248 }
249
250 template <int N=dim, std::enable_if_t<( 1<=N && N<=3 ), int> = 0>
251 explicit constexpr IntVectND (Dim3 const& a) noexcept {
252 vect[0] = a.x;
253 if constexpr (dim >= 2) {
254 vect[1] = a.y;
255 }
256 if constexpr (dim == 3) {
257 vect[2] = a.z;
258 }
259 }
260
261 // dtor, copy-ctor, copy-op=, move-ctor, and move-op= are compiler generated.
262
263 template <int N=dim, std::enable_if_t<( 1<=N && N<=3 ), int> = 0>
264 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
265 constexpr Dim3 dim3 () const noexcept {
266 if constexpr (dim == 1) {
267 return Dim3{.x = vect[0], .y = 0, .z = 0};
268 } else if constexpr (dim == 2) {
269 return Dim3{.x = vect[0], .y = vect[1], .z = 0};
270 } else {
271 return Dim3{.x = vect[0], .y = vect[1], .z = vect[2]};
272 }
273 }
274
275 template <int N=dim, std::enable_if_t<( 1<=N && N<=3 ), int> = 0>
276 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
277 constexpr Dim3 dim3 ([[maybe_unused]] int fill_extra) const noexcept {
278 if constexpr (dim == 1) {
279 return Dim3{.x = vect[0], .y = fill_extra, .z = fill_extra};
280 } else if constexpr (dim == 2) {
281 return Dim3{.x = vect[0], .y = vect[1], .z = fill_extra};
282 } else {
283 return Dim3{.x = vect[0], .y = vect[1], .z = vect[2]};
284 }
285 }
286
287 template< typename T = int >
289 constexpr Array<T, dim> toArray () const noexcept {
290 Array<T, dim> ret {};
291 for (int i=0; i<dim; ++i) {
292 ret[i] = T(vect[i]);
293 }
294 return ret;
295 }
296
298
302 constexpr int sum () const noexcept
303 {
304 int retval = vect[0];
305 for (int i=1; i<dim; ++i) {
306 retval += vect[i];
307 }
308 return retval;
309 }
310
313 constexpr int max () const noexcept
314 {
315 int retval = vect[0];
316 for (int i=1; i<dim; ++i) {
317 retval = retval > vect[i] ? retval : vect[i];
318 }
319 return retval;
320 }
321
324 constexpr int min () const noexcept
325 {
326 int retval = vect[0];
327 for (int i=1; i<dim; ++i) {
328 retval = retval < vect[i] ? retval : vect[i];
329 }
330 return retval;
331 }
332
333 //return coordinate with largest value
335 int maxDir(bool a_doAbsValue) const noexcept;
336
338 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr
339 int& operator[] (int i) noexcept { BL_ASSERT(i>=0 && i < dim); return vect[i]; }
340
342 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr
343 const int& operator[] (int i) const noexcept { BL_ASSERT(i>=0 && i < dim); return vect[i]; }
344
346 template<std::size_t i>
347 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr
348 int& get () noexcept {static_assert(0<=i && i<dim); return vect[i];}
349
351 template<std::size_t i>
352 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr
353 const int& get () const noexcept {static_assert(0<=i && i<dim); return vect[i];}
354
356 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr
357 int* begin () noexcept { return &vect[0]; }
358
360 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr
361 const int* begin () const noexcept { return &vect[0]; }
362
364 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr
365 int* end () noexcept { return &vect[dim]; }
366
368 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr
369 const int* end () const noexcept { return &vect[dim]; }
370
373 IntVectND& setVal (int i, int val) noexcept
374 {
375 BL_ASSERT(i>=0 && i<dim); vect[i] = val; return *this;
376 }
377
383 const int* getVect () const& noexcept { return vect; }
385 int* getVect () & noexcept { return vect; }
387 int* getVect () && = delete;
388
391 constexpr bool operator== (int val) const noexcept
392 {
393 bool retval = vect[0] == val;
394 for (int i=1; i<dim; ++i) {
395 retval = retval && vect[i] == val;
396 }
397 return retval;
398 }
399
402 constexpr bool operator!= (int val) const noexcept
403 {
404 bool retval = vect[0] != val;
405 for (int i=1; i<dim; ++i) {
406 retval = retval || vect[i] != val;
407 }
408 return retval;
409 }
410
413 constexpr bool operator== (const IntVectND<dim>& rhs) const noexcept
414 {
415 bool retval = vect[0] == rhs[0];
416 for (int i=1; i<dim; ++i) {
417 retval = retval && vect[i] == rhs[i];
418 }
419 return retval;
420 }
423 constexpr bool operator!= (const IntVectND<dim>& rhs) const noexcept
424 {
425 bool retval = vect[0] != rhs[0];
426 for (int i=1; i<dim; ++i) {
427 retval = retval || vect[i] != rhs[i];
428 }
429 return retval;
430 }
433 constexpr bool operator< (const IntVectND<dim>& rhs) const noexcept
434 {
435 for (int i=dim-1; i>=0; --i) {
436 if (vect[i] < rhs[i]) {
437 return true;
438 } else if (vect[i] > rhs[i]) {
439 return false;
440 }
441 }
442 return false;
443 }
446 constexpr bool operator<= (const IntVectND<dim>& rhs) const noexcept
447 {
448 return !(rhs < *this);
449 }
452 constexpr bool operator> (const IntVectND<dim>& rhs) const noexcept
453 {
454 return rhs < *this;
455 }
458 constexpr bool operator>= (const IntVectND<dim>& rhs) const noexcept
459 {
460 return !(*this < rhs);
461 }
467 constexpr bool allLT (const IntVectND<dim>& rhs) const noexcept
468 {
469 bool retval = vect[0] < rhs[0];
470 for (int i=1; i<dim; ++i) {
471 retval = retval && vect[i] < rhs[i];
472 }
473 return retval;
474 }
479 constexpr bool allLT (int rhs) const noexcept
480 {
481 bool retval = vect[0] < rhs;
482 for (int i=1; i<dim; ++i) {
483 retval = retval && vect[i] < rhs;
484 }
485 return retval;
486 }
492 constexpr bool allLE (const IntVectND<dim>& rhs) const noexcept
493 {
494 bool retval = vect[0] <= rhs[0];
495 for (int i=1; i<dim; ++i) {
496 retval = retval && vect[i] <= rhs[i];
497 }
498 return retval;
499 }
504 constexpr bool allLE (int rhs) const noexcept
505 {
506 bool retval = vect[0] <= rhs;
507 for (int i=1; i<dim; ++i) {
508 retval = retval && vect[i] <= rhs;
509 }
510 return retval;
511 }
517 constexpr bool allGT (const IntVectND<dim>& rhs) const noexcept
518 {
519 bool retval = vect[0] > rhs[0];
520 for (int i=1; i<dim; ++i) {
521 retval = retval && vect[i] > rhs[i];
522 }
523 return retval;
524 }
529 constexpr bool allGT (int rhs) const noexcept
530 {
531 bool retval = vect[0] > rhs;
532 for (int i=1; i<dim; ++i) {
533 retval = retval && vect[i] > rhs;
534 }
535 return retval;
536 }
542 constexpr bool allGE (const IntVectND<dim>& rhs) const noexcept
543 {
544 bool retval = vect[0] >= rhs[0];
545 for (int i=1; i<dim; ++i) {
546 retval = retval && vect[i] >= rhs[i];
547 }
548 return retval;
549 }
554 constexpr bool allGE (int rhs) const noexcept
555 {
556 bool retval = vect[0] >= rhs;
557 for (int i=1; i<dim; ++i) {
558 retval = retval && vect[i] >= rhs;
559 }
560 return retval;
561 }
564 constexpr IntVectND<dim> operator+ () const noexcept { return *this; }
567 constexpr IntVectND<dim> operator- () const noexcept {
568 IntVectND<dim> retval(0);
569 for (int i=0; i<dim; ++i) {
570 retval[i] = -vect[i];
571 }
572 return retval;
573 }
576 constexpr IntVectND<dim>& operator+= (int s) noexcept
577 {
578 for (int i=0; i<dim; ++i) {
579 vect[i] += s;
580 }
581 return *this;
582 }
585 constexpr IntVectND<dim>& operator+= (const IntVectND<dim>& p) noexcept
586 {
587 for (int i=0; i<dim; ++i) {
588 vect[i] += p[i];
589 }
590 return *this;
591 }
594 constexpr IntVectND<dim>& operator*= (int s) noexcept
595 {
596 for (int i=0; i<dim; ++i) {
597 vect[i] *= s;
598 }
599 return *this;
600 }
603 constexpr IntVectND<dim>& operator*= (const IntVectND<dim>& p) noexcept
604 {
605 for (int i=0; i<dim; ++i) {
606 vect[i] *= p[i];
607 }
608 return *this;
609 }
612 constexpr IntVectND<dim>& operator/= (int s) noexcept
613 {
614 for (int i=0; i<dim; ++i) {
615 vect[i] /= s;
616 }
617 return *this;
618 }
621 constexpr IntVectND<dim>& operator/= (const IntVectND<dim>& p) noexcept
622 {
623 for (int i=0; i<dim; ++i) {
624 vect[i] /= p[i];
625 }
626 return *this;
627 }
630 constexpr IntVectND<dim>& operator-= (int s) noexcept
631 {
632 for (int i=0; i<dim; ++i) {
633 vect[i] -= s;
634 }
635 return *this;
636 }
639 constexpr IntVectND<dim>& operator-= (const IntVectND<dim>& p) noexcept
640 {
641 for (int i=0; i<dim; ++i) {
642 vect[i] -= p[i];
643 }
644 return *this;
645 }
648 constexpr IntVectND<dim> operator+ (const IntVectND<dim>& p) const noexcept
649 {
650 IntVectND<dim> retval = *this;
651 return retval += p;
652 }
655 constexpr IntVectND<dim> operator+ (int s) const noexcept
656 {
657 IntVectND<dim> retval = *this;
658 return retval += s;
659 }
662 constexpr IntVectND<dim> operator- (const IntVectND<dim>& p) const noexcept
663 {
664 IntVectND<dim> retval = *this;
665 return retval -= p;
666 }
669 constexpr IntVectND<dim> operator- (int s) const noexcept
670 {
671 IntVectND<dim> retval = *this;
672 return retval -= s;
673 }
676 constexpr IntVectND<dim> operator* (const IntVectND<dim>& p) const noexcept
677 {
678 IntVectND<dim> retval = *this;
679 return retval *= p;
680 }
683 constexpr IntVectND<dim> operator* (int s) const noexcept
684 {
685 IntVectND<dim> retval = *this;
686 return retval *= s;
687 }
690 constexpr IntVectND<dim> operator/ (const IntVectND<dim>& p) const noexcept
691 {
692 IntVectND<dim> retval = *this;
693 return retval /= p;
694 }
697 constexpr IntVectND<dim> operator/ (int s) const noexcept
698 {
699 IntVectND<dim> retval = *this;
700 return retval /= s;
701 }
704 constexpr IntVectND<dim>& min (const IntVectND<dim>& p) noexcept
705 {
706 for (int i=0; i<dim; ++i) {
707 vect[i] = (vect[i] < p.vect[i] ? vect[i] : p.vect[i]);
708 }
709 return *this;
710 }
713 constexpr IntVectND<dim>& max (const IntVectND<dim>& p) noexcept
714 {
715 for (int i=0; i<dim; ++i) {
716 vect[i] = (vect[i] > p.vect[i] ? vect[i] : p.vect[i]);
717 }
718 return *this;
719 }
722 constexpr IntVectND<dim>& scale (int s) noexcept {
723 for (int i=0; i<dim; ++i) {
724 vect[i] *= s;
725 }
726 return *this;
727 }
733 constexpr IntVectND<dim>& reflect (int ref_ix, int idir) noexcept
734 {
735 BL_ASSERT(idir >= 0 && idir < dim);
736 vect[idir] = -vect[idir] + 2*ref_ix;
737 return *this;
738 }
741 constexpr IntVectND<dim>& shift (int coord, int s) noexcept
742 {
743 BL_ASSERT(coord >= 0 && coord < dim); vect[coord] += s; return *this;
744 }
747 constexpr IntVectND<dim>& shift (const IntVectND<dim>& iv) noexcept { *this += iv; return *this; }
750 constexpr IntVectND<dim>& diagShift (int s) noexcept
751 {
752 for (int i=0; i<dim; ++i) {
753 vect[i] += s;
754 }
755 return *this;
756 }
762 IntVectND<dim>& coarsen (int p) noexcept;
763
771 static constexpr IntVectND<dim> TheZeroVector () noexcept {
772 return IntVectND<dim>(0);
773 }
781 static constexpr IntVectND<dim> TheUnitVector () noexcept {
782 return IntVectND<dim>(1);
783 }
790 static constexpr IntVectND<dim> TheDimensionVector (int d) noexcept {
791 IntVectND<dim> retval(0);
792 retval[d] = 1;
793 return retval;
794 }
801 static constexpr IntVectND<dim> TheNodeVector () noexcept {
802 return IntVectND<dim>(1);
803 }
810 static constexpr IntVectND<dim> TheCellVector () noexcept {
811 return IntVectND<dim>(0);
812 }
813
815 static constexpr IntVectND<dim> TheMaxVector () noexcept {
816 return IntVectND<dim>(std::numeric_limits<int>::max());
817 }
819 static constexpr IntVectND<dim> TheMinVector () noexcept {
820 return IntVectND<dim>(std::numeric_limits<int>::lowest());
821 }
822
824 static constexpr std::size_t size () noexcept {
825 return static_cast<std::size_t>(dim);
826 }
827
829 static constexpr int isize () noexcept {
830 return dim;
831 }
832
834
839 template<int new_dim>
841 constexpr IntVectND<new_dim> shrink () const noexcept {
842 static_assert(new_dim <= dim);
843 return IntVectND<new_dim>(this->begin());
844 }
845
850 template<int new_dim>
852 constexpr IntVectND<new_dim> expand (int fill_extra=0) const noexcept {
853 static_assert(new_dim >= dim);
854 IntVectND<new_dim> retval(fill_extra);
855 for (int i=0; i<dim; ++i) {
856 retval[i] = vect[i];
857 }
858 return retval;
859 }
860
865 template<int new_dim>
867 constexpr IntVectND<new_dim> resize (int fill_extra=0) const noexcept {
868 if constexpr (new_dim > dim) {
869 return expand<new_dim>(fill_extra);
870 } else {
871 return shrink<new_dim>();
872 }
873 }
874
878 static const IntVectND<dim> Zero;
879
883 static const IntVectND<dim> Unit;
884
885 int vect[dim] = {};
886};
887
888template <int dim>
889inline constexpr const IntVectND<dim> IntVectND<dim>::Zero{0};
890
891template <int dim>
892inline constexpr const IntVectND<dim> IntVectND<dim>::Unit{1};
893
894// Template deduction guide for IntVectND
895template<std::size_t dim>
896AMREX_GPU_HOST_DEVICE // __device__ for HIP
898
899// Template deduction guide for IntVectND
900template <class...Args,
901 std::enable_if_t<
902 IsConvertible_v<int, Args...>,
903 int> = 0>
904AMREX_GPU_HOST_DEVICE // __device__ for HIP
905IntVectND(int, int, Args...) -> IntVectND<sizeof...(Args)+2>;
906
910
911template<int dim>
916{
917 BL_ASSERT(s > 0);
918 switch (s) {
919 case 1:
920 break;
921 case 2:
922 for (int i=0; i<dim; ++i) {
923 vect[i] = (vect[i]<0) ? -std::abs(vect[i]+1)/2-1 : vect[i]/2;
924 }
925 break;
926 case 4:
927 for (int i=0; i<dim; ++i) {
928 vect[i] = (vect[i]<0) ? -std::abs(vect[i]+1)/4-1 : vect[i]/4;
929 }
930 break;
931 default:
932 for (int i=0; i<dim; ++i) {
933 vect[i] = (vect[i]<0) ? -std::abs(vect[i]+1)/s-1 : vect[i]/s;
934 }
935 }
936 return *this;
937}
938
939template<int dim>
944{
945 BL_ASSERT(p.allGT(0));
946 for (int i=0; i<dim; ++i) {
947 vect[i] = amrex::coarsen(vect[i], p.vect[i]);
948 }
949 return *this;
950}
951
952template<int dim>
955int
956IntVectND<dim>::maxDir(bool a_doAbsValue) const noexcept
957{
958 int retval = 0;
959 if(a_doAbsValue)
960 {
961 int maxval = std::abs((*this)[0]);
962 for(int idir = 1; idir < dim; idir++)
963 {
964 int curval = std::abs((*this)[idir]);
965 if(curval > maxval)
966 {
967 maxval = curval;
968 retval = idir;
969 }
970 }
971 }
972 else
973 {
974 int maxval = (*this)[0];
975 for(int idir = 1; idir < dim; idir++)
976 {
977 int curval = (*this)[idir];
978 if(curval > maxval)
979 {
980 maxval = curval;
981 retval = idir;
982 }
983 }
984 }
985 return retval;
986}
987
989template<int dim>
992constexpr IntVectND<dim> operator+ (int s, const IntVectND<dim>& p) noexcept
993{
994 IntVectND<dim> retval = p;
995 for (int i=0; i<dim; ++i) {
996 retval[i] = s + retval[i];
997 }
998 return retval;
999}
1000
1002template<int dim>
1005constexpr IntVectND<dim> operator- (int s, const IntVectND<dim>& p) noexcept
1006{
1007 IntVectND<dim> retval = p;
1008 for (int i=0; i<dim; ++i) {
1009 retval[i] = s - retval[i];
1010 }
1011 return retval;
1012}
1013
1015template<int dim>
1018constexpr IntVectND<dim> operator* (int s, const IntVectND<dim>& p) noexcept
1019{
1020 IntVectND<dim> retval = p;
1021 for (int i=0; i<dim; ++i) {
1022 retval[i] = s * retval[i];
1023 }
1024 return retval;
1025}
1026
1031template<int dim>
1034constexpr IntVectND<dim>
1035min (const IntVectND<dim>& p1, const IntVectND<dim>& p2) noexcept
1036{
1037 IntVectND<dim> p(p1);
1038 p.min(p2);
1039 return p;
1040}
1041
1042template<int dim>
1045constexpr IntVectND<dim>
1046elemwiseMin (const IntVectND<dim>& p1, const IntVectND<dim>& p2) noexcept
1047{
1048 IntVectND<dim> p(p1);
1049 p.min(p2);
1050 return p;
1051}
1052
1057template<int dim>
1060constexpr IntVectND<dim>
1061max (const IntVectND<dim>& p1, const IntVectND<dim>& p2) noexcept
1062{
1063 IntVectND<dim> p(p1);
1064 p.max(p2);
1065 return p;
1066}
1067
1068template<int dim>
1071constexpr IntVectND<dim>
1072elemwiseMax (const IntVectND<dim>& p1, const IntVectND<dim>& p2) noexcept
1073{
1074 IntVectND<dim> p(p1);
1075 p.max(p2);
1076 return p;
1077}
1078
1084template<int dim = AMREX_SPACEDIM>
1087IntVectND<dim>
1088BASISV (int dir) noexcept
1089{
1090 BL_ASSERT(dir >= 0 && dir < dim);
1091 IntVectND<dim> tmp(0);
1092 tmp[dir] = 1;
1093 return tmp;
1094}
1095
1100template<int dim>
1103constexpr IntVectND<dim>
1104scale (const IntVectND<dim>& p, int s) noexcept
1105{
1106 return IntVectND<dim>(p).scale(s);
1107}
1108
1114template<int dim>
1117constexpr IntVectND<dim>
1118reflect (const IntVectND<dim>& a, int ref_ix, int idir) noexcept
1119{
1120 return IntVectND<dim>(a).reflect(ref_ix, idir);
1121}
1122
1127template<int dim>
1130constexpr IntVectND<dim>
1131diagShift (const IntVectND<dim>& p, int s) noexcept
1132{
1133 return p + s;
1134}
1135
1140template<int dim>
1143IntVectND<dim>
1144coarsen (const IntVectND<dim>& p, int s) noexcept
1145{
1146 BL_ASSERT(s > 0);
1147 IntVectND<dim> v = p;
1148 v.coarsen(s);
1149 return v;
1150}
1151
1156template<int dim>
1159IntVectND<dim>
1160coarsen (const IntVectND<dim>& p1, const IntVectND<dim>& p2) noexcept
1161{
1162 IntVectND<dim> v = p1;
1163 v.coarsen(p2);
1164 return v;
1165}
1166
1167template<int dim, std::enable_if_t<( 1<=dim && dim<=3 ), int> = 0>
1168AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
1169constexpr Dim3 refine (Dim3 const& coarse, IntVectND<dim> const& ratio) noexcept
1170{
1171 if constexpr (dim == 1) {
1172 return Dim3{.x = coarse.x*ratio[0], .y = coarse.y, .z = coarse.z};
1173 } else if constexpr (dim == 2) {
1174 return Dim3{.x = coarse.x*ratio[0], .y = coarse.y*ratio[1], .z = coarse.z};
1175 } else {
1176 return Dim3{.x = coarse.x*ratio[0], .y = coarse.y*ratio[1], .z = coarse.z*ratio[2]};
1177 }
1178}
1179
1180template<int dim, std::enable_if_t<( 1<=dim && dim<=3 ), int> = 0>
1181AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
1182Dim3 coarsen (Dim3 const& fine, IntVectND<dim> const& ratio) noexcept
1183{
1184 if constexpr (dim == 1) {
1185 return Dim3{.x = amrex::coarsen(fine.x, ratio[0]),
1186 .y = fine.y,
1187 .z = fine.z};
1188 } else if constexpr (dim == 2) {
1189 return Dim3{.x = amrex::coarsen(fine.x, ratio[0]),
1190 .y = amrex::coarsen(fine.y, ratio[1]),
1191 .z = fine.z};
1192 } else {
1193 return Dim3{.x = amrex::coarsen(fine.x, ratio[0]),
1194 .y = amrex::coarsen(fine.y, ratio[1]),
1195 .z = amrex::coarsen(fine.z, ratio[2])};
1196 }
1197}
1198
1200namespace detail {
1201
1202 template<int dim>
1204 void IntVectCat_imp (int*& dst, const IntVectND<dim>& src) noexcept {
1205 for (int i=0; i<dim; ++i) {
1206 dst[i] = src[i];
1207 }
1208 dst += dim;
1209 }
1210
1211 template<int dim>
1213 void IntVectSplit_imp2 (IntVectND<dim>& dst, const int*& src) noexcept {
1214 for (int i=0; i<dim; ++i) {
1215 dst[i] = src[i];
1216 }
1217 src += dim;
1218 }
1219
1220 template<class T, std::size_t...Ns>
1222 T IntVectSplit_imp (T& retval, std::index_sequence<Ns...>, const int * src) noexcept {
1223 (IntVectSplit_imp2(amrex::get<Ns>(retval), src), ...);
1224 return retval;
1225 }
1226
1227 template<int...dims>
1229 int get_sum () {
1230 return (0 + ... + dims);
1231 }
1232}
1234
1240template<int dim>
1241std::ostream&
1242operator<< (std::ostream& os, const IntVectND<dim>& iv)
1243{
1244 return detail::T_vector_write(os, iv.begin(), dim);
1245}
1246
1257template<int dim>
1258std::istream&
1259operator>> (std::istream& is, IntVectND<dim>& iv)
1260{
1261 return detail::T_vector_read(is, iv.begin(), dim);
1262}
1263
1268template<int d, int...dims>
1271constexpr IntVectND<detail::get_sum<d, dims...>()>
1272IntVectCat (const IntVectND<d>& v, const IntVectND<dims>&...vects) noexcept {
1273 IntVectND<detail::get_sum<d, dims...>()> retval (0);
1274 int* dst = retval.begin();
1275 detail::IntVectCat_imp(dst, v);
1276 (detail::IntVectCat_imp(dst, vects), ...);
1277 return retval;
1278}
1279
1284template<int d, int...dims>
1287constexpr GpuTuple<IntVectND<d>, IntVectND<dims>...>
1288IntVectSplit (const IntVectND<detail::get_sum<d, dims...>()>& v) noexcept {
1290 return detail::IntVectSplit_imp(retval,
1291 std::make_index_sequence<1 + sizeof...(dims)>(),
1292 v.begin());
1293}
1294
1299template<int new_dim, int old_dim>
1302constexpr IntVectND<new_dim>
1303IntVectShrink (const IntVectND<old_dim>& iv) noexcept {
1304 return iv.template shrink<new_dim>();
1305}
1306
1311template<int new_dim, int old_dim>
1314constexpr IntVectND<new_dim>
1315IntVectExpand (const IntVectND<old_dim>& iv, int fill_extra=0) noexcept {
1316 return iv.template expand<new_dim>(fill_extra);
1317}
1318
1323template<int new_dim, int old_dim>
1326constexpr IntVectND<new_dim>
1327IntVectResize (const IntVectND<old_dim>& iv, int fill_extra=0) noexcept {
1328 return iv.template resize<new_dim>(fill_extra);
1329}
1330
1332template <std::size_t I, int dim>
1334constexpr int get (IntVectND<dim> const& iv) noexcept { return iv.vect[I]; }
1335
1336namespace detail {
1337 template <typename F, int dim, std::size_t... N>
1339 constexpr auto apply_impl (F&& f, IntVectND<dim> const& iv,
1340 std::index_sequence<N...> /*is*/)
1341 {
1342 return std::forward<F>(f)(amrex::get<N>(iv)...);
1343 }
1344}
1345
1348template <typename F, int dim>
1350constexpr auto Apply (F&& f, IntVectND<dim> const& iv)
1351{
1352 return detail::apply_impl(std::forward<F>(f), iv, std::make_index_sequence<dim>());
1353}
1354
1355} // namespace amrex
1356
1357// Spcialize std::tuple_size for IntVectND. Used by structured bindings.
1358template<int dim>
1359struct std::tuple_size<amrex::IntVectND<dim>> {
1360 static constexpr std::size_t value = dim;
1361};
1362
1363// Spcialize std::tuple_element for IntVectND. Used by structured bindings.
1364template<std::size_t s, int dim>
1365struct std::tuple_element<s, amrex::IntVectND<dim>> {
1366 using type = int;
1367};
1368
1369#endif /*AMREX_INTVECT_H*/
#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:1143
GPU-compatible tuple.
Definition AMReX_Tuple.H:98
An Integer Vector in dim-Dimensional Space.
Definition AMReX_IntVect.H:149
__host__ __device__ constexpr IntVectND< dim > & operator*=(int s) noexcept
Modifies IntVectND by multiplication of a scalar to each component.
Definition AMReX_IntVect.H:594
__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:223
__host__ __device__ int * getVect() &noexcept
Definition AMReX_IntVect.H:385
__host__ __device__ constexpr IntVectND< dim > operator*(const IntVectND< dim > &p) const noexcept
Returns component-wise product of IntVectND and argument.
Definition AMReX_IntVect.H:676
__host__ __device__ constexpr int & operator[](int i) noexcept
Returns a reference to the i'th coordinate of the IntVectND.
Definition AMReX_IntVect.H:339
__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:517
__host__ __device__ constexpr bool operator>(const IntVectND< dim > &rhs) const noexcept
Return true if this is lexicographically greater than rhs.
Definition AMReX_IntVect.H:452
__host__ __device__ constexpr IntVectND< dim > & shift(int coord, int s) noexcept
Modify IntVectND by adding s to given coordinate.
Definition AMReX_IntVect.H:741
__host__ __device__ constexpr int min() const noexcept
minimum (no absolute values) value
Definition AMReX_IntVect.H:324
__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:852
__host__ __device__ constexpr IntVectND< dim > & operator+=(int s) noexcept
Modifies IntVectND by addition of a scalar to each component.
Definition AMReX_IntVect.H:576
__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:747
int value_type
Definition AMReX_IntVect.H:833
__host__ __device__ constexpr Array< T, dim > toArray() const noexcept
Definition AMReX_IntVect.H:289
__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:348
__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:244
__host__ static __device__ constexpr IntVectND< dim > TheMaxVector() noexcept
Definition AMReX_IntVect.H:815
__host__ static __device__ constexpr std::size_t size() noexcept
Definition AMReX_IntVect.H:824
__host__ __device__ IntVectND & setVal(int i, int val) noexcept
Set i'th coordinate of IntVectND to val.
Definition AMReX_IntVect.H:373
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:234
__host__ __device__ constexpr bool allGT(int rhs) const noexcept
Returns true if this is greater than argument for all components.
Definition AMReX_IntVect.H:529
__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:943
__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:781
__host__ __device__ int maxDir(bool a_doAbsValue) const noexcept
Definition AMReX_IntVect.H:956
__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:383
static const IntVectND< dim > Unit
Definition AMReX_IntVect.H:883
__host__ __device__ constexpr IntVectND< dim > & min(const IntVectND< dim > &p) noexcept
Modifies IntVectND by taking component-wise min with argument.
Definition AMReX_IntVect.H:704
__host__ __device__ constexpr int sum() const noexcept
Definition AMReX_IntVect.H:302
__host__ __device__ constexpr IntVectND< dim > & scale(int s) noexcept
Modify IntVectND by multiplying each coordinate by s.
Definition AMReX_IntVect.H:722
__host__ __device__ constexpr const int * begin() const noexcept
Returns a pointer to the first element of the IntVectND.
Definition AMReX_IntVect.H:361
__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:542
__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:733
__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:810
__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:206
__host__ __device__ constexpr bool operator==(int val) const noexcept
Returns true if all components are equal to the argument val.
Definition AMReX_IntVect.H:391
__host__ __device__ constexpr IntVectND< dim > & diagShift(int s) noexcept
Modify IntVectND by adding s to each coordinate.
Definition AMReX_IntVect.H:750
__host__ __device__ constexpr IntVectND< dim > operator-() const noexcept
Unary Minus – negates all components.
Definition AMReX_IntVect.H:567
__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:867
__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:771
__host__ __device__ constexpr IntVectND< dim > operator+() const noexcept
Unary plus – for completeness.
Definition AMReX_IntVect.H:564
__host__ __device__ IntVectND< dim > & coarsen(int p) noexcept
Modify IntVectND<dim> by component-wise integer projection.
Definition AMReX_IntVect.H:915
__host__ __device__ constexpr int max() const noexcept
maximum (no absolute values) value
Definition AMReX_IntVect.H:313
__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:467
__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:801
static const IntVectND< dim > Zero
Definition AMReX_IntVect.H:878
__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:504
__host__ __device__ constexpr IntVectND< dim > & operator-=(int s) noexcept
Modifies IntVectND by subtraction of a scalar to each component.
Definition AMReX_IntVect.H:630
__host__ __device__ constexpr IntVectND< dim > operator/(const IntVectND< dim > &p) const noexcept
Returns component-wise division of IntVectND by argument.
Definition AMReX_IntVect.H:690
__host__ __device__ constexpr IntVectND< dim > & operator/=(int s) noexcept
Modifies IntVectND by division by a scalar to each component.
Definition AMReX_IntVect.H:612
__host__ __device__ constexpr int * end() noexcept
Returns a pointer to the (last+1) element of the IntVectND.
Definition AMReX_IntVect.H:365
__host__ static __device__ constexpr int isize() noexcept
Definition AMReX_IntVect.H:829
__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:446
__host__ __device__ constexpr IntVectND(int s) noexcept
Construct an IntVectND whose components are all the same.
Definition AMReX_IntVect.H:212
__host__ __device__ constexpr const int * end() const noexcept
Returns a pointer to the (last+1) element of the IntVectND.
Definition AMReX_IntVect.H:369
__host__ __device__ constexpr bool operator<(const IntVectND< dim > &rhs) const noexcept
Return true if this is lexicographically less than rhs.
Definition AMReX_IntVect.H:433
__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:353
__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:402
__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:492
__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:554
__host__ __device__ constexpr IntVectND< dim > & max(const IntVectND< dim > &p) noexcept
Modifies IntVectND by taking component-wise max with argument.
Definition AMReX_IntVect.H:713
__host__ __device__ constexpr bool allLT(int rhs) const noexcept
Returns true if this is less than argument for all components.
Definition AMReX_IntVect.H:479
constexpr IntVectND() noexcept
Construct an IntVectND whose components are all zero.
Definition AMReX_IntVect.H:193
int vect[dim]
Definition AMReX_IntVect.H:885
__host__ static __device__ constexpr IntVectND< dim > TheMinVector() noexcept
Definition AMReX_IntVect.H:819
__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:458
__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:841
__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:790
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:50
__host__ __device__ void ignore_unused(const Ts &...)
This shuts up the compiler about unused variables.
Definition AMReX.H:139
__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:1327
__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 > BASISV(int dir) noexcept
Returns a basis vector in the given coordinate direction; eg. IntVectND<3> BASISV<3>(1) == (0,...
Definition AMReX_IntVect.H:1088
__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:1131
__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:261
__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:1118
__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:1303
__host__ __device__ constexpr auto Apply(F &&f, IntVectND< dim > const &iv)
Definition AMReX_IntVect.H:1350
__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:1104
__host__ __device__ constexpr const T & max(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:44
void Error(const std::string &msg)
Print out message to cerr and exit via amrex::Abort().
Definition AMReX.cpp:235
__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:1315
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:1334
Hash function for IntVectND.
Definition AMReX_IntVect.H:154
std::size_t operator()(const IntVectND< dim > &vec) const noexcept
Definition AMReX_IntVect.H:155
int type
Definition AMReX_IntVect.H:1366