4#include <AMReX_Config.H>
20#define AMREX_ARRAY4_INDEX_ASSERT(i,j,k,n) \
21 if ((i)<begin.vect[0] || (i)>=end.vect[0] || \
22 (j)<begin.vect[1] || (j)>=end.vect[1] || \
23 (k)<begin.vect[2] || (k)>=end.vect[2] || \
24 (n)<0 || (n)>=end.vect[3]) \
26 index_assert_print_error_message(i,j,k,n); \
65 :
p(a_p), stride(a_stride), ncomp(a_ncomp)
77 requires (std::is_const_v<U>)
80 :
p(rhs.p), stride(rhs.stride), ncomp(rhs.ncomp)
89 explicit operator bool() const noexcept {
return p !=
nullptr; }
93 int nComp() const noexcept {
return ncomp; }
107 requires (!std::is_void_v<T>)
110#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
111 if (n < 0 || n >= ncomp) {
117 std::stringstream ss;
118 ss <<
" " << n <<
" is out of bound: (0:" << ncomp-1 <<
")";
130 template <
int N>
struct Stride { Long a[N] = {}; };
131 template <>
struct Stride<0> {};
138 template <
typename T>
139 struct IsValidIndexType {
140 static constexpr bool value = std::is_integral_v<T> && IsNonNarrowingConversion_v<T, int>;
149 template <
int N,
bool last_dim_component,
typename... idx>
150 struct ArrayNDIndexCheck_impl {
152 static constexpr int num_indices =
sizeof...(idx);
154 template <
typename... Ts>
155 struct AllExceptLastEnum;
157 template <
typename first,
typename... Ts>
158 struct AllExceptLastEnum<first, Ts...> {
159 static constexpr bool value =
160 IsValidIndexType<std::decay_t<first>>::value
161 && AllExceptLastEnum<Ts...>::value;
166 template <
typename last>
167 struct AllExceptLastEnum<last> {
168 static constexpr bool value = IsValidIndexType<std::decay_t<last>>::value
169 || (std::is_enum_v<std::decay_t<last>>);
172 static constexpr bool index_with_maybe_enum = AllExceptLastEnum<idx...>::value;
174 static constexpr bool index_all_values = Conjunction<
175 IsValidIndexType<std::decay_t<idx>>...>::value;
178 static constexpr bool value = ((num_indices == N) && index_all_values)
179 || ((num_indices == N - 1) && index_all_values && last_dim_component)
180 || ((num_indices == N) && index_with_maybe_enum && last_dim_component);
183 template <
int N,
bool last_dim_component,
class... idx>
184 inline constexpr bool ArrayNDIndexCheck_impl_v = ArrayNDIndexCheck_impl<N, last_dim_component, idx...>::value;
186 template<std::size_t... idx>
187 constexpr auto make_oob_message_impl (std::index_sequence<idx...>) {
188 constexpr std::size_t N =
sizeof...(idx);
189 constexpr char prefix[] =
" (";
190 constexpr char middle[] =
") is out of bound (";
191 constexpr char suffix[] =
")\n";
193 constexpr std::size_t size =
200 std::array<char, size> buf{};
205 for (
char c : prefix) {
211 ((buf[pos++] =
'%', buf[pos++] =
'd', idx + 1 < N ? buf[pos++] =
',' : 0), ...);
214 for (
char c : middle) {
221 ((buf[pos++] =
'%', buf[pos++] =
'd', buf[pos++] =
':', buf[pos++] =
'%', buf[pos++] =
'd',
222 idx + 1 < N ? buf[pos++] =
',' : 0), ...);
225 for (
char c : suffix) {
231 template <std::size_t... idx, std::size_t... idx2x>
233 void device_print_impl2 (std::index_sequence<idx...>,
234 std::index_sequence<idx2x...>,
239 constexpr auto msg = make_oob_message_impl(std::index_sequence<idx...>{});
243 ((idx2x % 2 == 0) ?
begin.vect[idx2x / 2] :
end.vect[idx2x / 2] - 1)...
250 void device_printf_impl (
const IntVectND<N>& iv,
251 const IntVectND<N>&
begin,
252 const IntVectND<N>&
end)
255 std::make_index_sequence<N>{},
256 std::make_index_sequence<N*2>{},
287 template<
typename T,
int N,
bool last_dim_component = false>
290 static_assert(N >= 1,
"ArrayND must have at least one dimension");
291 static_assert(N > 1 || !last_dim_component,
"ArrayND with N=1 cannot have last_dim_component=true");
296 static constexpr bool IsArray4_v = (N==4 && last_dim_component);
322 requires (std::is_const_v<U>)
324 constexpr ArrayND (
ArrayND<std::remove_const_t<T>, N, last_dim_component>
const& rhs) noexcept
325 :
p(rhs.p), stride(rhs.stride),
begin(rhs.begin),
end(rhs.end) {}
335 requires (!last_dim_component)
336 :
ArrayND(a_p, box.smallEnd(), box.bigEnd() + 1)
346 requires (((M+1==N) || (N == 4 && M == AMREX_SPACEDIM))
347 && last_dim_component)
351 :
ArrayND(a_p, box.smallEnd(), box.bigEnd() + 1, ncomp)
365 requires (!last_dim_component)
382 constexpr ArrayND (T* a_p,
Dim3 const& a_begin,
Dim3 const& a_end,
int a_ncomp)
noexcept
384 :
p(a_p),
begin(a_begin.
x, a_begin.
y, a_begin.
z, 0),
end(a_end.
x, a_end.
y, a_end.
z, a_ncomp)
400 requires (((M+1 == N) || (N == 4 && M == AMREX_SPACEDIM)) && last_dim_component)
413 end.vect[N-1] = ncomp;
427 requires (std::is_same_v<std::remove_const_t<T>, std::remove_const_t<U>>
428 && (N >= 2) && last_dim_component)
431 :
p((T*)(rhs.
p + start_comp*rhs.stride.a[N-2])),
437 end.vect[N-1] = rhs.
end.
vect[N-1] - start_comp;
450 requires (std::is_same_v<std::remove_const_t<T>, std::remove_const_t<U>>
451 && (N >= 2) && last_dim_component)
454 :
p((T*)(rhs.
p + start_comp*rhs.stride.a[N-2])),
460 end.vect[N-1] = num_comp;
468 constexpr explicit operator bool() const noexcept {
return p !=
nullptr; }
476 constexpr bool ok () const noexcept {
return p !=
nullptr &&
end.allGT(
begin); }
494 template <
typename... idx>
496 && detail::ArrayNDIndexCheck_impl_v<N, last_dim_component, idx...>)
498 T&
operator() (idx... i)
const noexcept {
499 constexpr auto nidx =
sizeof...(i);
500#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
519 requires (!std::is_void_v<T> &&
520 ((M == N) || (!
IsArray4_v && last_dim_component && (M + 1 == N))))
523#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
541 requires (!std::is_void_v<T> && last_dim_component && !
IsArray4_v
545#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
557 template <
typename... idx>
559 && detail::ArrayNDIndexCheck_impl_v<N, last_dim_component, idx...>)
561 T*
ptr (idx... i)
const noexcept {
562 constexpr auto nidx =
sizeof...(i);
563#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
582 requires ((M == N) || (!
IsArray4_v && last_dim_component && (M + 1 == N)))
585#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
603 requires (last_dim_component && !
IsArray4_v && (M + 1 == N))
606#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
626 constexpr int nComp () const noexcept {
627 if constexpr (last_dim_component) {
628 return end.vect[N-1];
643 constexpr std::size_t
size () const noexcept {
666 requires ((d < N) && (d >= 0))
669 if constexpr (N > 1 && d > 0) {
670 return stride.a[d-1];
687 template <
typename... idx>
689 detail::ArrayNDIndexCheck_impl_v<N, last_dim_component, idx...>)
691 constexpr bool contains (idx... i)
const noexcept {
692 constexpr auto nidx =
sizeof...(i);
713 requires ((M == N) || (!
IsArray4_v && last_dim_component && (M + 1 == N)))
718 inside = inside && (iv.
vect[d] >=
begin.vect[d]) && (iv.
vect[d] <
end.vect[d]);
740 requires (last_dim_component && !
IsArray4_v && (M + 1 == N))
745 inside = inside && (iv.
vect[d] >=
begin.vect[d]) && (iv.
vect[d] <
end.vect[d]);
747 inside = inside && (n >= 0) && (n <
end.vect[N-1]);
772 int ncomp =
end.vect[N-1];
784 requires ((M == N) || (last_dim_component && (M + 1 == N || M == AMREX_SPACEDIM)))
791 constexpr int idx = (last_dim_component && M == N) ? N - 1 : M;
792 if constexpr (N > 1) {
794 offset += (iv.
vect[d] -
begin.vect[d]) * stride.a[d-1];
800 if constexpr (last_dim_component && M == N) {
801 offset += iv.
vect[N-1] * stride.a[N-2];
816 requires (last_dim_component
817 && ((M + 1 == N) || (N == 4 && M == AMREX_SPACEDIM)))
823 offset += (iv.
vect[d] -
begin.vect[d]) * stride.a[d-1];
825 offset += n * stride.a[N-2];
829#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
830#if defined(AMREX_USE_HIP)
837 bool out_of_bounds =
false;
838 for (
int d = 0; d < N; ++d) {
840 out_of_bounds =
true;
845 detail::device_printf_impl(iv,
begin,
end);
849 std::stringstream ss;
851 for (
int d = 0; d < N; ++d) {
853 if (d + 1 < N) ss <<
",";
855 ss <<
") is out of bound (";
856 for (
int d = 0; d < N; ++d) {
857 ss <<
begin.vect[d] <<
":" <<
end.vect[d]-1;
858 if (d + 1 < N) ss <<
",";
869 requires (((M+1 == N) || (M == AMREX_SPACEDIM)) && last_dim_component)
870#
if defined(AMREX_USE_HIP)
877 IntVectND<N> iv_full = iv.template expand<N>(0);
878 for (
int d = M; d < N; ++d) {
879 iv_full.vect[d] =
begin.vect[d];
881 index_assert(iv_full);
887 requires (((M+1 == N) || (M == AMREX_SPACEDIM)) && last_dim_component)
888#
if defined(AMREX_USE_HIP)
895 IntVectND<N> iv_full = iv.template expand<N>(0);
896 for (
int d = M; d < N-1; ++d) {
897 iv_full.vect[d] =
begin.vect[d];
899 iv_full.vect[N-1] = n;
900 index_assert(iv_full);
930#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
931 AMREX_ARRAY4_INDEX_ASSERT(i,j,k,0);
933#if defined(AMREX_USE_GPU) || defined(AMREX_DEBUG)
934 return p[(i-
begin.vect[0]) +
935 (j-
begin.vect[1]) * stride.a[0] +
936 (k-
begin.vect[2]) * stride.a[1]];
938 Long idx1 = i + j*stride.a[0] + k*stride.a[1];
940 +
begin.vect[1] * stride.a[0]
941 +
begin.vect[2] * stride.a[1];
966#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
967 AMREX_ARRAY4_INDEX_ASSERT(i,j,k,n);
969#if defined(AMREX_USE_GPU) || defined(AMREX_DEBUG)
970 return p[(i-
begin.vect[0]) +
971 (j-
begin.vect[1]) * stride.a[0] +
972 (k-
begin.vect[2]) * stride.a[1] +
975 Long idx1 = i + j*stride.a[0] + k*stride.a[1] + n*stride.a[2];
977 +
begin.vect[1] * stride.a[0]
978 +
begin.vect[2] * stride.a[1];
993 requires (!std::is_void_v<T> &&
IsArray4_v && (M == 3 || M == AMREX_SPACEDIM))
996#if (AMREX_SPACEDIM == 1)
997 if constexpr (M == 1) {
1000#elif (AMREX_SPACEDIM == 2)
1001 if constexpr (M == 2) {
1002 return this->
operator()(iv.vect[0],iv.vect[1],0);
1006 return this->
operator()(iv.vect[0],iv.vect[1],iv.vect[2]);
1021 requires (!std::is_void_v<T> &&
IsArray4_v && (M == 3 || M == AMREX_SPACEDIM))
1024#if (AMREX_SPACEDIM == 1)
1025 if constexpr (M == 1) {
1028#elif (AMREX_SPACEDIM == 2)
1029 if constexpr (M == 2) {
1050 return this->
operator()(cell.x,cell.y,cell.z);
1065 return this->
operator()(cell.x,cell.y,cell.z,n);
1077 T*
ptr (
int i,
int j,
int k)
const noexcept
1081#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
1082 AMREX_ARRAY4_INDEX_ASSERT(i,j,k,0);
1084#if defined(AMREX_USE_GPU) || defined(AMREX_DEBUG)
1085 return p + ((i-
begin.vect[0]) +
1086 (j-
begin.vect[1]) * stride.a[0] +
1087 (k-
begin.vect[2]) * stride.a[1]);
1089 Long idx1 = i + j*stride.a[0] + k*stride.a[1];
1091 +
begin.vect[1] * stride.a[0]
1092 +
begin.vect[2] * stride.a[1];
1093 return p + (idx1-idx0);
1107 T*
ptr (
int i,
int j,
int k,
int n)
const noexcept
1111#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
1112 AMREX_ARRAY4_INDEX_ASSERT(i,j,k,n);
1114#if defined(AMREX_USE_GPU) || defined(AMREX_DEBUG)
1115 return p + ((i-
begin.vect[0]) +
1116 (j-
begin.vect[1]) * stride.a[0] +
1117 (k-
begin.vect[2]) * stride.a[1] +
1120 Long idx1 = i + j*stride.a[0] + k*stride.a[1] + n*stride.a[2];
1122 +
begin.vect[1] * stride.a[0]
1123 +
begin.vect[2] * stride.a[1];
1124 return p + (idx1-idx0);
1135 requires (!std::is_void_v<T> &&
IsArray4_v && (M == 3 || M == AMREX_SPACEDIM))
1138#if (AMREX_SPACEDIM == 1)
1139 if constexpr (M == 1) {
1140 return this->
ptr(iv.
vect[0],0,0);
1142#elif (AMREX_SPACEDIM == 2)
1143 if constexpr (M == 2) {
1160 requires (!std::is_void_v<T> &&
IsArray4_v && (M == 3 || M == AMREX_SPACEDIM))
1163#if (AMREX_SPACEDIM == 1)
1164 if constexpr (M == 1) {
1165 return this->
ptr(iv.
vect[0],0,0,n);
1167#elif (AMREX_SPACEDIM == 2)
1168 if constexpr (M == 2) {
1188 return this->
ptr(cell.x,cell.y,cell.z);
1203 return this->
ptr(cell.x,cell.y,cell.z,n);
1219 return (i>=
begin.vect[0] && i<
end.vect[0] &&
1220 j>=
begin.vect[1] && j<
end.vect[1] &&
1221 k>=
begin.vect[2] && k<
end.vect[2]);
1231 requires (
IsArray4_v && (M == 3 || M == AMREX_SPACEDIM))
1234#if (AMREX_SPACEDIM < 3)
1235 if constexpr (M == AMREX_SPACEDIM) {
1259 return (cell.x>=
begin.vect[0] && cell.x<
end.vect[0] &&
1260 cell.y>=
begin.vect[1] && cell.y<
end.vect[1] &&
1261 cell.z>=
begin.vect[2] && cell.z<
end.vect[2]);
1264#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
1265#if defined(AMREX_USE_HIP)
1270 void index_assert_print_error_message (
int i,
int j,
int k,
int n)
const
1284 std::stringstream ss;
1285 ss <<
" (" << i <<
"," << j <<
"," << k <<
"," << n
1286 <<
") is out of bound ("
1287 <<
begin.vect[0] <<
":" <<
end.vect[0]-1 <<
","
1288 <<
begin.vect[1] <<
":" <<
end.vect[1]-1 <<
","
1289 <<
begin.vect[2] <<
":" <<
end.vect[2]-1 <<
","
1290 <<
"0:" <<
end.vect[3]-1 <<
")";
1298 constexpr void set_stride () noexcept {
1299 if constexpr (N > 1) {
1300 Long current_stride = 1;
1303 current_stride *= len;
1304 stride.a[d] = current_stride;
1313 template <
typename T,
int N>
1318 template <
typename T,
int N>
1322 template <
typename T,
int N>
1326 template <
typename T,
int N>
1330 template <
typename T>
1339 template<
typename T>
1353 return Dim3{.x = a.begin.vect[0], .y = a.begin.vect[1], .z = a.begin.vect[2]};
1367 return Dim3{.x = a.end.vect[0]-1, .y = a.end.vect[1]-1, .z = a.end.vect[2]-1};
1381 return Dim3{.x = a.end.vect[0]-a.begin.vect[0],
1382 .y = a.end.vect[1]-a.begin.vect[1],
1383 .z = a.end.vect[2]-a.begin.vect[2]};
1397 template <
typename T,
int N,
bool C>
1399 os <<
"(" << a.
begin <<
',' << a.
end-1 <<
")";
1407 template <
class A>
struct HasMultiComp : std::false_type {};
1410 requires (B().size() >= 1)
1411 struct HasMultiComp<B> : std::true_type {};
1426 template <
typename T>
1435 T& operator() (
int i,
int j,
int k)
const noexcept {
1440 typename T::reference_type
1441 operator() (
int i,
int j,
int k,
int n)
const noexcept
1442 requires (amrex::HasMultiComp<T>::value)
1449 T& operator() (
int i,
int j,
int k,
int n)
const noexcept
1450 requires (!amrex::HasMultiComp<T>::value)
1459 template <
typename T>
1460 [[nodiscard]] PolymorphicArray4<T>
Runtime initialization/finalization helpers and global diagnostics.
Compile-time unrolled loop utility.
#define AMREX_NO_UNIQUE_ADDRESS
Definition AMReX_Extension.H:307
#define AMREX_NO_INLINE
Definition AMReX_Extension.H:141
#define AMREX_FORCE_INLINE
Definition AMReX_Extension.H:124
#define AMREX_RESTRICT
Definition AMReX_Extension.H:37
#define AMREX_DEVICE_PRINTF(...)
Definition AMReX_GpuPrint.H:15
#define AMREX_IF_ON_DEVICE(CODE)
Definition AMReX_GpuQualifiers.H:56
#define AMREX_IF_ON_HOST(CODE)
Definition AMReX_GpuQualifiers.H:58
#define AMREX_GPU_HOST_DEVICE
Definition AMReX_GpuQualifiers.H:20
while parser_exe_t p
Definition AMReX_Parser_Exe_Body.H:33
#define AMREX_D_TERM(a, b, c)
Definition AMReX_SPACE.H:172
A Rectangular Domain on an Integer Lattice.
Definition AMReX_Box.H:54
An Integer Vector in dim-Dimensional Space.
Definition AMReX_IntVect.H:149
int vect[dim]
Definition AMReX_IntVect.H:907
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:1365
__host__ __device__ Dim3 length(Array4< T > const &a) noexcept
Return the spatial extents of an Array4 in Dim3 form.
Definition AMReX_Array4.H:1379
PolymorphicArray4< T > makePolymorphic(Array4< T > const &a)
Definition AMReX_Array4.H:1461
ArrayND< T, 4, true > Array4
Convenient alias for a 4D ArrayND with three spatial dimensions plus a component dimension.
Definition AMReX_Array4.H:1340
__host__ __device__ Dim3 lbound(Array4< T > const &a) noexcept
Return the inclusive lower bounds of an Array4 in Dim3 form.
Definition AMReX_Array4.H:1351
__host__ __device__ constexpr void constexpr_for(F const &f)
Compile-time unrolled loop from Idx (inclusive) to N (exclusive).
Definition AMReX_ConstexprFor.H:38
Definition AMReX_Amr.cpp:50
__host__ __device__ Dim3 begin(BoxND< dim > const &box) noexcept
Return the iterator begin coordinate of box as Dim3.
Definition AMReX_Box.H:2241
IntVectND(const Array< int, dim > &) -> IntVectND< dim >
@ y
Definition AMReX_Orientation.H:14
@ x
Definition AMReX_Orientation.H:14
@ z
Definition AMReX_Orientation.H:14
void Abort(const std::string &msg)
Print a fatal-error message to stderr and abort execution.
Definition AMReX.cpp:244
__host__ __device__ Dim3 end(BoxND< dim > const &box) noexcept
Return the iterator end coordinate of box as Dim3.
Definition AMReX_Box.H:2259
std::ostream & operator<<(std::ostream &os, AmrMesh const &amr_mesh)
Stream helper; forwards to the friend declared inside AmrMesh.
Definition AMReX_AmrMesh.cpp:1372
A multidimensional array accessor.
Definition AMReX_Array4.H:289
__host__ __device__ T * ptr(int i, int j, int k) const noexcept
Return the pointer to an element.
Definition AMReX_Array4.H:1077
static constexpr bool IsArray4_v
Definition AMReX_Array4.H:296
__host__ __device__ ArrayND(T *a_p, BoxND< M > const &box, int ncomp) noexcept
Constructor using a BoxND and the number of components.
Definition AMReX_Array4.H:350
__host__ __device__ constexpr bool ok() const noexcept
Check if the ArrayND pointer is valid and bounds are valid.
Definition AMReX_Array4.H:476
__host__ __device__ T & operator()(idx... i) const noexcept
Multi-index operator() for accessing elements.
Definition AMReX_Array4.H:498
__host__ __device__ ArrayND(T *a_p, BoxND< N > const &box) noexcept
Constructor using a BoxND.
Definition AMReX_Array4.H:334
__host__ __device__ constexpr std::size_t size() const noexcept
Total number of elements in the ArrayND's index region.
Definition AMReX_Array4.H:643
T *__restrict__ p
Definition AMReX_Array4.H:298
__host__ __device__ constexpr ArrayND(T *a_p, IntVectND< N > const &a_begin, IntVectND< N > const &a_end) noexcept
IntVectND<N> constructor.
Definition AMReX_Array4.H:364
__host__ __device__ constexpr bool contains(idx... i) const noexcept
Definition AMReX_Array4.H:691
__host__ __device__ T * ptr(Dim3 const &cell, int n) const noexcept
Return the pointer to an element.
Definition AMReX_Array4.H:1199
static constexpr bool IsLastDimComponent_v
Definition AMReX_Array4.H:294
__host__ __device__ constexpr int nComp() const noexcept
Get number of components.
Definition AMReX_Array4.H:626
__host__ __device__ constexpr T * dataPtr() const noexcept
Get raw data pointer.
Definition AMReX_Array4.H:617
__host__ __device__ T * ptr(idx... i) const noexcept
Definition AMReX_Array4.H:561
__host__ __device__ T * ptr(int i, int j, int k, int n) const noexcept
Return the pointer to an element.
Definition AMReX_Array4.H:1107
IntVectND< N > end
Definition AMReX_Array4.H:303
IntVectND< N > begin
Definition AMReX_Array4.H:302
__host__ __device__ CellData< T > cellData(int i, int j, int k) const noexcept
Create a single-cell component accessor.
Definition AMReX_Array4.H:768
__host__ __device__ constexpr ArrayND(ArrayND< std::remove_const_t< T >, N, last_dim_component > const &rhs) noexcept
Construct a const accessor from a non-const accessor.
Definition AMReX_Array4.H:324
__host__ __device__ constexpr Long get_offset(IntVectND< M > const &iv) const noexcept
Compute the linear offset (in elements) for an IntVectND.
Definition AMReX_Array4.H:786
__host__ __device__ T * ptr(Dim3 const &cell) const noexcept
Return the pointer to an element.
Definition AMReX_Array4.H:1184
__host__ __device__ constexpr Long get_stride() const noexcept
Definition AMReX_Array4.H:668
__host__ __device__ constexpr ArrayND() noexcept
Default-construct an empty accessor.
Definition AMReX_Array4.H:311
__host__ __device__ constexpr ArrayND(T *a_p, Dim3 const &a_begin, Dim3 const &a_end, int a_ncomp) noexcept
Constructor for N=4 using Dim3.
Definition AMReX_Array4.H:382
__host__ __device__ bool contains(Dim3 const &cell) const noexcept
Test whether the spatial indices are inside the Array4 bounds.
Definition AMReX_Array4.H:1255
__host__ __device__ bool contains(int i, int j, int k) const noexcept
Test whether the spatial indices are inside the Array4 bounds.
Definition AMReX_Array4.H:1215
Lightweight accessor for data associated with a single cell.
Definition AMReX_Array4.H:47
__host__ __device__ constexpr CellData(T *a_p, Long a_stride, int a_ncomp)
Construct a CellData.
Definition AMReX_Array4.H:64
__host__ __device__ constexpr CellData(CellData< std::remove_const_t< T > > const &rhs) noexcept
Construct a const CellData from a non-const CellData.
Definition AMReX_Array4.H:79
__host__ __device__ T & operator[](int n) const
Access the n-th component of the cell.
Definition AMReX_Array4.H:106
__host__ __device__ int nComp() const noexcept
Return the number of components referenced by this accessor.
Definition AMReX_Array4.H:93
A simple struct holding 3 int values for a 3D index.
Definition AMReX_Dim3.H:24
Array4 subclass that provides uniform (i,j,k,n) access for both AoS and SoA data.
Definition AMReX_Array4.H:1429
__host__ __device__ PolymorphicArray4(Array4< T > const &a)
Definition AMReX_Array4.H:1431