|
| __host__ __device__ const T * | begin () const noexcept |
| |
| __host__ __device__ const T * | end () const noexcept |
| |
| __host__ __device__ T * | begin () noexcept |
| |
| __host__ __device__ T * | end () noexcept |
| |
| template<Order Ord = ORDER, std::enable_if_t< Ord==Order::F, int > = 0> |
| __host__ __device__ const T & | operator() (int i, int j, int k) const noexcept |
| |
| template<Order Ord = ORDER, std::enable_if_t< Ord==Order::F, int > = 0> |
| __host__ __device__ T & | operator() (int i, int j, int k) noexcept |
| |
| template<Order Ord = ORDER, std::enable_if_t< Ord==Order::C, int > = 0> |
| __host__ __device__ const T & | operator() (int i, int j, int k) const noexcept |
| |
| template<Order Ord = ORDER, std::enable_if_t< Ord==Order::C, int > = 0> |
| __host__ __device__ T & | operator() (int i, int j, int k) noexcept |
| |
| __host__ __device__ constexpr T | sum () const noexcept |
| |
| __host__ __device__ constexpr T | sum (int axis, int loc0, int loc1) const noexcept |
| |
| __host__ __device__ constexpr T | product () const noexcept |
| |
| __host__ __device__ constexpr T | product (const int axis, const int loc0, const int loc1) const noexcept |
| |
|
| __host__ static __device__ constexpr unsigned int | size () noexcept |
| |
| __host__ static __device__ constexpr int | xlo () noexcept |
| |
| __host__ static __device__ constexpr int | xhi () noexcept |
| |
| __host__ static __device__ constexpr unsigned int | xlen () noexcept |
| |
| __host__ static __device__ constexpr int | ylo () noexcept |
| |
| __host__ static __device__ constexpr int | yhi () noexcept |
| |
| __host__ static __device__ constexpr unsigned int | ylen () noexcept |
| |
| __host__ static __device__ constexpr int | zlo () noexcept |
| |
| __host__ static __device__ constexpr int | zhi () noexcept |
| |
| __host__ static __device__ constexpr unsigned int | zlen () noexcept |
| |
template<class T, int XLO, int XHI, int YLO, int YHI, int ZLO, int ZHI,
Order ORDER = Order::F>
struct amrex::Array3D< T, XLO, XHI, YLO, YHI, ZLO, ZHI, ORDER >
A GPU-compatible three-dimensional array.
- Template Parameters
-
| XLO | Index for lower bound in x dimension. Can be other than 0. |
| XHI | Index for upper bound in x dimension. |
| YLO | Index for lower bound in y dimension. Can be other than 0. |
| YHI | Index for upper bound in y dimension. |
| ZLO | Index for lower bound in z dimension. Can be other than 0. |
| ZHI | Index for upper bound in z dimension. |
| ORDER | Either Order::C (C/C++ row-major order) or Order::F (Fortran column-major order, which is the default if not given) |
template<class T , int XLO, int XHI, int YLO, int YHI, int ZLO, int ZHI,
Order ORDER = Order::F>
| __host__ __device__ constexpr T amrex::Array3D< T, XLO, XHI, YLO, YHI, ZLO, ZHI, ORDER >::product |
( |
const int |
axis, |
|
|
const int |
loc0, |
|
|
const int |
loc1 |
|
) |
| const |
|
inlineconstexprnoexcept |
When called with three arguments, performs a product reduction over the specified axis, for a particular set of location indices loc0 and loc1.
- Parameters
-
| axis | The dimension to reduce (0 for x dimension, 1 for y dimension, 2 for z dimension) |
| loc0 | The appropriate location index (either i or j) |
| loc1 | The appropriate location index (either j or k) |
This can be used, for instance, to calculate the sum over the z dimension of an Array3D object that was instantiated as
Definition AMReX_Array.H:648
One could instantiate an Array2D object to hold the results,
Definition AMReX_Array.H:341
and then perform the summation for each element of the resulting matrix.
for (int j = 1; j <= N; ++j) {
for (int i = 1; i <= M; ++i) {
mat(i,j) = array.
sum(2,i,j)
}
}
__host__ __device__ constexpr T sum() const noexcept
Definition AMReX_Array.H:820
In this example, the axis is 2 and the location indices are loc0 = i and loc1 = j. For axis = 0, the location indices are treated as loc0 = j and loc1 = k; for axis = 1, loc0 = i and loc1 = k.
template<class T , int XLO, int XHI, int YLO, int YHI, int ZLO, int ZHI,
Order ORDER = Order::F>
| __host__ __device__ constexpr T amrex::Array3D< T, XLO, XHI, YLO, YHI, ZLO, ZHI, ORDER >::sum |
( |
int |
axis, |
|
|
int |
loc0, |
|
|
int |
loc1 |
|
) |
| const |
|
inlineconstexprnoexcept |
When called with three arguments, performs a sum reduction over the specified axis, for a particular set of location indices loc0 and loc1.
- Parameters
-
| axis | The dimension to reduce (0 for x dimension, 1 for y dimension, 2 for z dimension) |
| loc0 | The appropriate location index (either i or j) |
| loc1 | The appropriate location index (either j or k) |
This can be used, for instance, to calculate the sum over the x dimension of an Array3D object that was instantiated as
One could instantiate an Array2D object to hold the results,
and then perform the summation for each element of the resulting matrix.
for (int j = 1; j <= N; ++j) {
for (int k = 1; k <= K; ++k) {
mat(j,k) = array.
sum(0,j,k)
}
}
In this example, the axis is 0 and the location indices are loc0 = j and loc1 = k. For axis = 1, the location indices are treated as loc0 = i and loc1 = k; for axis = 2, loc0 = j and loc1 = k.