#include <AMReX_Array.H>
Public Member Functions | |
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE const T * | begin () const noexcept |
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE const T * | end () const noexcept |
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T * | begin () noexcept |
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T * | end () noexcept |
template<Order Ord = ORDER, std::enable_if_t< Ord==Order::F, int > = 0> | |
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE const T & | operator() (int i, int j, int k) const noexcept |
template<Order Ord = ORDER, std::enable_if_t< Ord==Order::F, int > = 0> | |
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T & | operator() (int i, int j, int k) noexcept |
template<Order Ord = ORDER, std::enable_if_t< Ord==Order::C, int > = 0> | |
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE const T & | operator() (int i, int j, int k) const noexcept |
template<Order Ord = ORDER, std::enable_if_t< Ord==Order::C, int > = 0> | |
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T & | operator() (int i, int j, int k) noexcept |
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE T | sum () const noexcept |
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE T | sum (int axis, int loc0, int loc1) const noexcept |
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE T | product () const noexcept |
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE T | product (const int axis, const int loc0, const int loc1) const noexcept |
Static Public Member Functions | |
AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE unsigned int | size () noexcept |
AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE int | xlo () noexcept |
AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE int | xhi () noexcept |
AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE unsigned int | xlen () noexcept |
AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE int | ylo () noexcept |
AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE int | yhi () noexcept |
AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE unsigned int | ylen () noexcept |
AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE int | zlo () noexcept |
AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE int | zhi () noexcept |
AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE unsigned int | zlen () noexcept |
Public Attributes | |
T | arr [(XHI-XLO+1) *(YHI-YLO+1) *(ZHI-ZLO+1)] |
A GPU-compatible three-dimensional array.
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) |
|
inlinenoexcept |
Returns a const
pointer address to the first element of the Array3D object, as if the object is treated as one-dimensional.
|
inlinenoexcept |
Returns a pointer address to the first element of the Array3D object, as if the object is treated as one-dimensional.
|
inlinenoexcept |
Returns a const
pointer address right after the last element of the Array3D object, as if the object is treated as one-dimensional.
|
inlinenoexcept |
Returns a pointer address right after the last element of the Array3D object, as if the object is treated as one-dimensional.
|
inlinenoexcept |
The elements of an Array3D object are accessed using parentheses, e.g. array(i,j,k)
, instead of using square brackets. If the order is not specified, Fortran column-major order is assumed (the index i
moves the fastest)
|
inlinenoexcept |
|
inlinenoexcept |
The elements of an Array3D object are accessed using parentheses, e.g. array(i,j,k)
, instead of using square brackets. If the order is not specified, Fortran column-major order is assumed (the index i
moves the fastest)
|
inlinenoexcept |
|
inlineconstexprnoexcept |
When called without any arguments, returns the product of all elements in the Array3D object.
|
inlineconstexprnoexcept |
When called with three arguments, performs a product reduction over the specified axis
, for a particular set of location indices loc0
and loc1
.
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
Array3D<amrex::Real, 1, M, 1, N, 1, K> array;
One could instantiate an Array2D object to hold the results,
Array2D<amrex::Real, 1, M, 1, N> mat;
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) } }
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
.
|
inlinestaticconstexprnoexcept |
Returns the total number of elements in the Array3D object as an unsigned integer.
|
inlineconstexprnoexcept |
When called without any arguments, returns the sum of all elements in the Array3D object.
|
inlineconstexprnoexcept |
When called with three arguments, performs a sum reduction over the specified axis
, for a particular set of location indices loc0
and loc1
.
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
Array3D<amrex::Real, 1, M, 1, N, 1, K> array;
One could instantiate an Array2D object to hold the results,
Array2D<amrex::Real, 1, N, 1, K> mat;
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
.
|
inlinestaticconstexprnoexcept |
Returns the index of the upper bound of the Array3D object in the x direction.
|
inlinestaticconstexprnoexcept |
Returns the number of elements of the Array3D object in the x direction as an unsigned integer.
|
inlinestaticconstexprnoexcept |
Returns the index of the lower bound of the Array3D object in the x direction. Can be other than 0.
|
inlinestaticconstexprnoexcept |
Returns the index of the upper bound of the Array3D object in the y direction.
|
inlinestaticconstexprnoexcept |
Returns the number of elements of the Array3D object in the y direction as an unsigned integer.
|
inlinestaticconstexprnoexcept |
Returns the index of the lower bound of the Array3D object in the y direction. Can be other than 0.
|
inlinestaticconstexprnoexcept |
Returns the index of the upper bound of the Array3D object in the z direction.
|
inlinestaticconstexprnoexcept |
Returns the number of elements of the Array3D object in the z direction as an unsigned integer.
|
inlinestaticconstexprnoexcept |
Returns the index of the lower bound of the Array3D object in the z direction. Can be other than 0.
T amrex::Array3D< T, XLO, XHI, YLO, YHI, ZLO, ZHI, ORDER >::arr[(XHI-XLO+1) *(YHI-YLO+1) *(ZHI-ZLO+1)] |