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> {};
134#if defined(AMREX_USE_GPU) && !defined(AMREX_ARRAY4_64BIT_INDEX)
135 using Array4Int =
int;
137 using Array4Int =
Long;
140 struct Array4Stride { Array4Int a[2] = {};
Long n = 0; };
142 template <
int N,
bool C>
struct StrideType {
using type = Stride<N-1>; };
143 template <>
struct StrideType<4,true> {
using type = Array4Stride; };
150 template <
typename T>
151 struct IsValidIndexType {
152 static constexpr bool value = std::is_integral_v<T> && IsNonNarrowingConversion_v<T, int>;
161 template <
int N,
bool last_dim_component,
typename... idx>
162 struct ArrayNDIndexCheck_impl {
164 static constexpr int num_indices =
sizeof...(idx);
166 template <
typename... Ts>
167 struct AllExceptLastEnum;
169 template <
typename first,
typename... Ts>
170 struct AllExceptLastEnum<first, Ts...> {
171 static constexpr bool value =
172 IsValidIndexType<std::decay_t<first>>::value
173 && AllExceptLastEnum<Ts...>::value;
178 template <
typename last>
179 struct AllExceptLastEnum<last> {
180 static constexpr bool value = IsValidIndexType<std::decay_t<last>>::value
181 || (std::is_enum_v<std::decay_t<last>>);
184 static constexpr bool index_with_maybe_enum = AllExceptLastEnum<idx...>::value;
186 static constexpr bool index_all_values = Conjunction<
187 IsValidIndexType<std::decay_t<idx>>...>::value;
190 static constexpr bool value = ((num_indices == N) && index_all_values)
191 || ((num_indices == N - 1) && index_all_values && last_dim_component)
192 || ((num_indices == N) && index_with_maybe_enum && last_dim_component);
195 template <
int N,
bool last_dim_component,
class... idx>
196 inline constexpr bool ArrayNDIndexCheck_impl_v = ArrayNDIndexCheck_impl<N, last_dim_component, idx...>::value;
198 template<std::size_t... idx>
199 constexpr auto make_oob_message_impl (std::index_sequence<idx...>) {
200 constexpr std::size_t N =
sizeof...(idx);
201 constexpr char prefix[] =
" (";
202 constexpr char middle[] =
") is out of bound (";
203 constexpr char suffix[] =
")\n";
205 constexpr std::size_t size =
212 std::array<char, size> buf{};
217 for (
char c : prefix) {
223 ((buf[pos++] =
'%', buf[pos++] =
'd', idx + 1 < N ? buf[pos++] =
',' : 0), ...);
226 for (
char c : middle) {
233 ((buf[pos++] =
'%', buf[pos++] =
'd', buf[pos++] =
':', buf[pos++] =
'%', buf[pos++] =
'd',
234 idx + 1 < N ? buf[pos++] =
',' : 0), ...);
237 for (
char c : suffix) {
243 template <std::size_t... idx, std::size_t... idx2x, std::size_t... ichar>
245 void device_print_impl2 (std::index_sequence<idx...>,
246 std::index_sequence<idx2x...>,
247 std::index_sequence<ichar...>,
253 static constexpr auto buf = make_oob_message_impl(std::index_sequence<idx...>{});
254 static constexpr char msg[] = {buf[ichar]...};
258 ((idx2x % 2 == 0) ?
begin.vect[idx2x / 2] :
end.vect[idx2x / 2] - 1)...
265 void device_printf_impl (
const IntVectND<N>& iv,
266 const IntVectND<N>&
begin,
267 const IntVectND<N>&
end)
270 std::make_index_sequence<N>{},
271 std::make_index_sequence<N*2>{},
272 std::make_index_sequence<make_oob_message_impl(std::make_index_sequence<N>{}).size()>{},
303 template<
typename T,
int N,
bool last_dim_component = false>
306 static_assert(N >= 1,
"ArrayND must have at least one dimension");
307 static_assert(N > 1 || !last_dim_component,
"ArrayND with N=1 cannot have last_dim_component=true");
312 static constexpr bool IsArray4_v = (N==4 && last_dim_component);
338 requires (std::is_const_v<U>)
340 constexpr ArrayND (
ArrayND<std::remove_const_t<T>, N, last_dim_component>
const& rhs) noexcept
341 :
p(rhs.p), stride(rhs.stride),
begin(rhs.begin),
end(rhs.end) {}
351 requires (!last_dim_component)
352 :
ArrayND(a_p, box.smallEnd(), box.bigEnd() + 1)
362 requires (((M+1==N) || (N == 4 && M == AMREX_SPACEDIM))
363 && last_dim_component)
367 :
ArrayND(a_p, box.smallEnd(), box.bigEnd() + 1, ncomp)
381 requires (!last_dim_component)
398 constexpr ArrayND (T* a_p,
Dim3 const& a_begin,
Dim3 const& a_end,
int a_ncomp)
noexcept
400 :
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)
416 requires (((M+1 == N) || (N == 4 && M == AMREX_SPACEDIM)) && last_dim_component)
429 end.vect[N-1] = ncomp;
443 requires (std::is_same_v<std::remove_const_t<T>, std::remove_const_t<U>>
444 && (N >= 2) && last_dim_component)
453 end.vect[N-1] = rhs.
end.
vect[N-1] - start_comp;
466 requires (std::is_same_v<std::remove_const_t<T>, std::remove_const_t<U>>
467 && (N >= 2) && last_dim_component)
476 end.vect[N-1] = num_comp;
484 constexpr explicit operator bool() const noexcept {
return p !=
nullptr; }
492 constexpr bool ok () const noexcept {
return p !=
nullptr &&
end.allGT(
begin); }
510 template <
typename... idx>
512 && detail::ArrayNDIndexCheck_impl_v<N, last_dim_component, idx...>)
514 T&
operator() (idx... i)
const noexcept {
515 constexpr auto nidx =
sizeof...(i);
516#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
535 requires (!std::is_void_v<T> &&
536 ((M == N) || (!
IsArray4_v && last_dim_component && (M + 1 == N))))
539#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
557 requires (!std::is_void_v<T> && last_dim_component && !
IsArray4_v
561#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
573 template <
typename... idx>
575 && detail::ArrayNDIndexCheck_impl_v<N, last_dim_component, idx...>)
577 T*
ptr (idx... i)
const noexcept {
578 constexpr auto nidx =
sizeof...(i);
579#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
598 requires ((M == N) || (!
IsArray4_v && last_dim_component && (M + 1 == N)))
601#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
619 requires (last_dim_component && !
IsArray4_v && (M + 1 == N))
622#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
642 constexpr int nComp () const noexcept {
643 if constexpr (last_dim_component) {
644 return end.vect[N-1];
659 constexpr std::size_t
size () const noexcept {
682 requires ((d < N) && (d >= 0))
687 }
else if constexpr (N > 1 && d > 0) {
688 return stride.a[d-1];
705 template <
typename... idx>
707 detail::ArrayNDIndexCheck_impl_v<N, last_dim_component, idx...>)
709 constexpr bool contains (idx... i)
const noexcept {
710 constexpr auto nidx =
sizeof...(i);
731 requires ((M == N) || (!
IsArray4_v && last_dim_component && (M + 1 == N)))
736 inside = inside && (iv.
vect[d] >=
begin.vect[d]) && (iv.
vect[d] <
end.vect[d]);
758 requires (last_dim_component && !
IsArray4_v && (M + 1 == N))
763 inside = inside && (iv.
vect[d] >=
begin.vect[d]) && (iv.
vect[d] <
end.vect[d]);
765 inside = inside && (n >= 0) && (n <
end.vect[N-1]);
790 int ncomp =
end.vect[N-1];
802 requires ((M == N) || (last_dim_component && (M + 1 == N || M == AMREX_SPACEDIM)))
809 constexpr int idx = (last_dim_component && M == N) ? N - 1 : M;
810 if constexpr (N > 1) {
818 if constexpr (last_dim_component && M == N) {
834 requires (last_dim_component
835 && ((M + 1 == N) || (N == 4 && M == AMREX_SPACEDIM)))
847#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
848#if defined(AMREX_USE_HIP)
855 bool out_of_bounds =
false;
856 for (
int d = 0; d < N; ++d) {
858 out_of_bounds =
true;
863 detail::device_printf_impl(iv,
begin,
end);
867 std::stringstream ss;
869 for (
int d = 0; d < N; ++d) {
871 if (d + 1 < N) ss <<
",";
873 ss <<
") is out of bound (";
874 for (
int d = 0; d < N; ++d) {
875 ss <<
begin.vect[d] <<
":" <<
end.vect[d]-1;
876 if (d + 1 < N) ss <<
",";
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; ++d) {
897 iv_full.vect[d] =
begin.vect[d];
899 index_assert(iv_full);
905 requires (((M+1 == N) || (M == AMREX_SPACEDIM)) && last_dim_component)
906#
if defined(AMREX_USE_HIP)
913 IntVectND<N> iv_full = iv.template expand<N>(0);
914 for (
int d = M; d < N-1; ++d) {
915 iv_full.vect[d] =
begin.vect[d];
917 iv_full.vect[N-1] = n;
918 index_assert(iv_full);
936 constexpr Long offset4 (
int i,
int j,
int k,
int n)
const noexcept
939#if defined(AMREX_USE_GPU) || defined(AMREX_DEBUG)
940 return (i-
begin.vect[0]) +
941 (j-
begin.vect[1]) * stride.a[0] +
942 (k-
begin.vect[2]) * stride.a[1] +
945 Long idx1 = i + j*stride.a[0] + k*stride.a[1] + n*stride.n;
947 +
begin.vect[1] * stride.a[0]
948 +
begin.vect[2] * stride.a[1];
975#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
976 AMREX_ARRAY4_INDEX_ASSERT(i,j,k,0);
1001#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
1002 AMREX_ARRAY4_INDEX_ASSERT(i,j,k,n);
1017 requires (!std::is_void_v<T> &&
IsArray4_v && (M == 3 || M == AMREX_SPACEDIM))
1020#if (AMREX_SPACEDIM == 1)
1021 if constexpr (M == 1) {
1024#elif (AMREX_SPACEDIM == 2)
1025 if constexpr (M == 2) {
1026 return this->
operator()(iv.vect[0],iv.vect[1],0);
1030 return this->
operator()(iv.vect[0],iv.vect[1],iv.vect[2]);
1045 requires (!std::is_void_v<T> &&
IsArray4_v && (M == 3 || M == AMREX_SPACEDIM))
1048#if (AMREX_SPACEDIM == 1)
1049 if constexpr (M == 1) {
1052#elif (AMREX_SPACEDIM == 2)
1053 if constexpr (M == 2) {
1074 return this->
operator()(cell.x,cell.y,cell.z);
1089 return this->
operator()(cell.x,cell.y,cell.z,n);
1101 T*
ptr (
int i,
int j,
int k)
const noexcept
1105#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
1106 AMREX_ARRAY4_INDEX_ASSERT(i,j,k,0);
1121 T*
ptr (
int i,
int j,
int k,
int n)
const noexcept
1125#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
1126 AMREX_ARRAY4_INDEX_ASSERT(i,j,k,n);
1138 requires (!std::is_void_v<T> &&
IsArray4_v && (M == 3 || M == AMREX_SPACEDIM))
1141#if (AMREX_SPACEDIM == 1)
1142 if constexpr (M == 1) {
1143 return this->
ptr(iv.
vect[0],0,0);
1145#elif (AMREX_SPACEDIM == 2)
1146 if constexpr (M == 2) {
1163 requires (!std::is_void_v<T> &&
IsArray4_v && (M == 3 || M == AMREX_SPACEDIM))
1166#if (AMREX_SPACEDIM == 1)
1167 if constexpr (M == 1) {
1168 return this->
ptr(iv.
vect[0],0,0,n);
1170#elif (AMREX_SPACEDIM == 2)
1171 if constexpr (M == 2) {
1191 return this->
ptr(cell.x,cell.y,cell.z);
1206 return this->
ptr(cell.x,cell.y,cell.z,n);
1222 return (i>=
begin.vect[0] && i<
end.vect[0] &&
1223 j>=
begin.vect[1] && j<
end.vect[1] &&
1224 k>=
begin.vect[2] && k<
end.vect[2]);
1234 requires (
IsArray4_v && (M == 3 || M == AMREX_SPACEDIM))
1237#if (AMREX_SPACEDIM < 3)
1238 if constexpr (M == AMREX_SPACEDIM) {
1262 return (cell.x>=
begin.vect[0] && cell.x<
end.vect[0] &&
1263 cell.y>=
begin.vect[1] && cell.y<
end.vect[1] &&
1264 cell.z>=
begin.vect[2] && cell.z<
end.vect[2]);
1267#if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
1268#if defined(AMREX_USE_HIP)
1273 void index_assert_print_error_message (
int i,
int j,
int k,
int n)
const
1287 std::stringstream ss;
1288 ss <<
" (" << i <<
"," << j <<
"," << k <<
"," << n
1289 <<
") is out of bound ("
1290 <<
begin.vect[0] <<
":" <<
end.vect[0]-1 <<
","
1291 <<
begin.vect[1] <<
":" <<
end.vect[1]-1 <<
","
1292 <<
begin.vect[2] <<
":" <<
end.vect[2]-1 <<
","
1293 <<
"0:" <<
end.vect[3]-1 <<
")";
1301 constexpr void set_stride () noexcept {
1305 stride.a[0] = detail::Array4Int(nx);
1306 stride.a[1] = detail::Array4Int(nxy);
1307 stride.n = nxy * (
end.vect[2] -
begin.vect[2]);
1308 if constexpr (std::is_same_v<detail::Array4Int,int>) {
1311 }
else if constexpr (N > 1) {
1312 Long current_stride = 1;
1315 current_stride *= len;
1316 stride.a[d] = current_stride;
1325 template <
typename T,
int N>
1330 template <
typename T,
int N>
1334 template <
typename T,
int N>
1338 template <
typename T,
int N>
1342 template <
typename T>
1351 template<
typename T>
1365 return Dim3{.x = a.begin.vect[0], .y = a.begin.vect[1], .z = a.begin.vect[2]};
1379 return Dim3{.x = a.end.vect[0]-1, .y = a.end.vect[1]-1, .z = a.end.vect[2]-1};
1393 return Dim3{.x = a.end.vect[0]-a.begin.vect[0],
1394 .y = a.end.vect[1]-a.begin.vect[1],
1395 .z = a.end.vect[2]-a.begin.vect[2]};
1409 template <
typename T,
int N,
bool C>
1411 os <<
"(" << a.
begin <<
',' << a.
end-1 <<
")";
1419 template <
class A>
struct HasMultiComp : std::false_type {};
1422 requires (B().size() >= 1)
1423 struct HasMultiComp<B> : std::true_type {};
1438 template <
typename T>
1447 T& operator() (
int i,
int j,
int k)
const noexcept {
1452 typename T::reference_type
1453 operator() (
int i,
int j,
int k,
int n)
const noexcept
1454 requires (amrex::HasMultiComp<T>::value)
1461 T& operator() (
int i,
int j,
int k,
int n)
const noexcept
1462 requires (!amrex::HasMultiComp<T>::value)
1471 template <
typename T>
1472 [[nodiscard]] PolymorphicArray4<T>
Runtime initialization/finalization helpers and global diagnostics.
#define AMREX_ASSERT(EX)
Definition AMReX_BLassert.H:38
Compile-time unrolled loop utility.
#define AMREX_NO_UNIQUE_ADDRESS
Definition AMReX_Extension.H:306
#define AMREX_NO_INLINE
Definition AMReX_Extension.H:140
#define AMREX_FORCE_INLINE
Definition AMReX_Extension.H:123
#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:156
int vect[dim]
Definition AMReX_IntVect.H:914
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:1377
__host__ __device__ Dim3 length(Array4< T > const &a) noexcept
Return the spatial extents of an Array4 in Dim3 form.
Definition AMReX_Array4.H:1391
PolymorphicArray4< T > makePolymorphic(Array4< T > const &a)
Definition AMReX_Array4.H:1473
ArrayND< T, 4, true > Array4
Convenient alias for a 4D ArrayND with three spatial dimensions plus a component dimension.
Definition AMReX_Array4.H:1352
__host__ __device__ Dim3 lbound(Array4< T > const &a) noexcept
Return the inclusive lower bounds of an Array4 in Dim3 form.
Definition AMReX_Array4.H:1363
__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:239
const int[]
Definition AMReX_BLProfiler.cpp:1665
__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:1379
A multidimensional array accessor.
Definition AMReX_Array4.H:305
__host__ __device__ T * ptr(int i, int j, int k) const noexcept
Return the pointer to an element.
Definition AMReX_Array4.H:1101
static constexpr bool IsArray4_v
Definition AMReX_Array4.H:312
__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:366
__host__ __device__ constexpr bool ok() const noexcept
Check if the ArrayND pointer is valid and bounds are valid.
Definition AMReX_Array4.H:492
__host__ __device__ T & operator()(idx... i) const noexcept
Multi-index operator() for accessing elements.
Definition AMReX_Array4.H:514
__host__ __device__ ArrayND(T *a_p, BoxND< N > const &box) noexcept
Constructor using a BoxND.
Definition AMReX_Array4.H:350
__host__ __device__ constexpr std::size_t size() const noexcept
Total number of elements in the ArrayND's index region.
Definition AMReX_Array4.H:659
T *__restrict__ p
Definition AMReX_Array4.H:314
__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:380
__host__ __device__ constexpr bool contains(idx... i) const noexcept
Definition AMReX_Array4.H:709
__host__ __device__ T * ptr(Dim3 const &cell, int n) const noexcept
Return the pointer to an element.
Definition AMReX_Array4.H:1202
static constexpr bool IsLastDimComponent_v
Definition AMReX_Array4.H:310
__host__ __device__ constexpr int nComp() const noexcept
Get number of components.
Definition AMReX_Array4.H:642
__host__ __device__ constexpr T * dataPtr() const noexcept
Get raw data pointer.
Definition AMReX_Array4.H:633
__host__ __device__ T * ptr(idx... i) const noexcept
Definition AMReX_Array4.H:577
__host__ __device__ T * ptr(int i, int j, int k, int n) const noexcept
Return the pointer to an element.
Definition AMReX_Array4.H:1121
IntVectND< N > end
Definition AMReX_Array4.H:319
IntVectND< N > begin
Definition AMReX_Array4.H:318
__host__ __device__ CellData< T > cellData(int i, int j, int k) const noexcept
Create a single-cell component accessor.
Definition AMReX_Array4.H:786
__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:340
__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:804
__host__ __device__ T * ptr(Dim3 const &cell) const noexcept
Return the pointer to an element.
Definition AMReX_Array4.H:1187
__host__ __device__ constexpr Long get_stride() const noexcept
Definition AMReX_Array4.H:684
__host__ __device__ constexpr Long offset4(int i, int j, int k, int n) const noexcept
Offset of element (i,j,k,n) from p.
Definition AMReX_Array4.H:936
__host__ __device__ constexpr ArrayND() noexcept
Default-construct an empty accessor.
Definition AMReX_Array4.H:327
__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:398
__host__ __device__ bool contains(Dim3 const &cell) const noexcept
Test whether the spatial indices are inside the Array4 bounds.
Definition AMReX_Array4.H:1258
__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:1218
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:1441
__host__ __device__ PolymorphicArray4(Array4< T > const &a)
Definition AMReX_Array4.H:1443