Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
amrex::ArrayND< T, N, last_dim_component > Struct Template Reference

A multidimensional array accessor. More...

#include <AMReX_Array4.H>

Inheritance diagram for amrex::ArrayND< T, N, last_dim_component >:
amrex::PolymorphicArray4< T >

Public Member Functions

__host__ __device__ constexpr ArrayND () noexcept
 
template<class U = T, std::enable_if_t< std::is_const_v< U >, int > = 0>
__host__ __device__ constexpr ArrayND (ArrayND< std::remove_const_t< T >, N, last_dim_component > const &rhs) noexcept
 
template<bool C = last_dim_component, std::enable_if_t<!C, int > = 0>
__host__ __device__ ArrayND (T *a_p, BoxND< N > const &box) noexcept
 Constructor using a BoxND.
 
template<int M, std::enable_if_t<((M+1==N)||(N==4 &&M==3)) &&last_dim_component, int > = 0>
__host__ __device__ ArrayND (T *a_p, BoxND< M > const &box, int ncomp) noexcept
 Constructor using a BoxND.
 
template<bool C = last_dim_component, std::enable_if_t<!C, int > = 0>
__host__ __device__ constexpr ArrayND (T *a_p, IntVectND< N > const &a_begin, IntVectND< N > const &a_end) noexcept
 IntVectND<N> constructor.
 
template<bool B = IsArray4_v, std::enable_if_t< B, int > = 0>
__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.
 
template<int M, std::enable_if_t<((M+1==N)||(N==4 &&M==3)) &&last_dim_component, int > = 0>
__host__ __device__ constexpr ArrayND (T *a_p, IntVectND< M > const &a_begin, IntVectND< M > const &a_end, int ncomp) noexcept
 Reduced dimension constructor with component count.
 
template<class U , std::enable_if_t< std::is_same_v< std::remove_const_t< T >, std::remove_const_t< U > > &&(N >=2) &&last_dim_component, int > = 0>
__host__ __device__ constexpr ArrayND (ArrayND< U, N, last_dim_component > const &rhs, int start_comp) noexcept
 Slicing constructor (Component subset).
 
template<class U , std::enable_if_t< std::is_same_v< std::remove_const_t< T >, std::remove_const_t< U > > &&(N >=2) &&last_dim_component, int > = 0>
__host__ __device__ constexpr ArrayND (ArrayND< U, N, last_dim_component > const &rhs, int start_comp, int num_comp) noexcept
 Slicing constructor (Component subset with count).
 
__host__ __device__ constexpr operator bool () const noexcept
 Check if the ArrayND pointer is valid.
 
__host__ __device__ constexpr bool ok () const noexcept
 Check if the ArrayND pointer is valid and bounds are valid.
 
template<typename... idx, class U = T, std::enable_if_t<!std::is_void_v< U > &&!IsArray4_v &&detail::ArrayNDIndexCheck_impl_v< N, last_dim_component, idx... >, int > = 0>
__host__ __device__ U & operator() (idx... i) const noexcept
 Multi-index operator() for accessing elements.
 
template<int M, class U = T, std::enable_if_t< !std::is_void_v< U > &&((M==N)||(!IsArray4_v &&last_dim_component &&(M+1==N))), int > = 0>
__host__ __device__ U & operator() (IntVectND< M > const &iv) const noexcept
 Access element by IntVectND.
 
template<int M, class U = T, std::enable_if_t< !std::is_void_v< U > &&last_dim_component &&!IsArray4_v &&(M+1==N), int > = 0>
__host__ __device__ U & operator() (IntVectND< M > const &iv, int n) const noexcept
 Access element by spatial IntVectND and component index.
 
template<typename... idx, class U = T, std::enable_if_t<!std::is_void_v< U > &&!IsArray4_v &&detail::ArrayNDIndexCheck_impl_v< N, last_dim_component, idx... >, int > = 0>
__host__ __device__ T * ptr (idx... i) const noexcept
 Multi-index ptr() for accessing pointer to element.
 
template<int M, std::enable_if_t<(M==N)||(!IsArray4_v &&last_dim_component &&(M+1==N)), int > = 0>
__host__ __device__ T * ptr (IntVectND< M > const &iv) const noexcept
 Access pointer by IntVectND.
 
template<int M, std::enable_if_t< last_dim_component &&!IsArray4_v &&(M+1==N), int > = 0>
__host__ __device__ T * ptr (IntVectND< M > const &iv, int n) const noexcept
 Access pointer by spatial IntVectND and component index.
 
__host__ __device__ constexpr T * dataPtr () const noexcept
 Get raw data pointer.
 
__host__ __device__ constexpr int nComp () const noexcept
 Get number of components.
 
__host__ __device__ constexpr std::size_t size () const noexcept
 
template<int d, std::enable_if_t<(d< N) &&(d >=0), int > = 0>
__host__ __device__ constexpr Long get_stride () const noexcept
 
template<typename... idx, std::enable_if_t<!IsArray4_v &&detail::ArrayNDIndexCheck_impl_v< N, last_dim_component, idx... >, int > = 0>
__host__ __device__ constexpr bool contains (idx... i) const noexcept
 
template<int M, std::enable_if_t<(M==N)||(!IsArray4_v &&last_dim_component &&(M+1==N)), int > = 0>
__host__ __device__ constexpr bool contains (IntVectND< M > const &iv) const noexcept
 
template<int M, std::enable_if_t< last_dim_component &&!IsArray4_v &&(M+1==N), int > = 0>
__host__ __device__ constexpr bool contains (IntVectND< M > const &iv, int n) const noexcept
 
template<int M = N, bool B = IsArray4_v, std::enable_if_t< B, int > = 0>
__host__ __device__ CellData< T > cellData (int i, int j, int k) const noexcept
 
template<int M, std::enable_if_t<(M==N)||(last_dim_component &&(M+1==N||M==3)), int > = 0>
__host__ __device__ constexpr Long get_offset (IntVectND< M > const &iv) const noexcept
 
template<int M, std::enable_if_t< last_dim_component &&((M+1==N)||(N==4 &&M==3)), int > = 0>
__host__ __device__ constexpr Long get_offset (IntVectND< M > const &iv, int n) const noexcept
 
template<class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v, int > = 0>
__host__ __device__ U & operator() (int i, int j, int k) const noexcept
 
template<class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v, int > = 0>
__host__ __device__ U & operator() (int i, int j, int k, int n) const noexcept
 
template<int M, class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v &&(M==3||M==3), int > = 0>
__host__ __device__ U & operator() (IntVectND< M > const &iv) const noexcept
 
template<int M, class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v &&(M==3||M==3), int > = 0>
__host__ __device__ U & operator() (IntVectND< M > const &iv, int n) const noexcept
 
template<class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v, int > = 0>
__host__ __device__ U & operator() (Dim3 const &cell) const noexcept
 
template<class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v, int > = 0>
__host__ __device__ U & operator() (Dim3 const &cell, int n) const noexcept
 
template<class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v, int > = 0>
__host__ __device__ U * ptr (int i, int j, int k) const noexcept
 
template<class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v, int > = 0>
__host__ __device__ U * ptr (int i, int j, int k, int n) const noexcept
 
template<int M, class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v &&(M==3||M==3), int > = 0>
__host__ __device__ U * ptr (IntVectND< M > const &iv) const noexcept
 
template<int M, class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v &&(M==3||M==3), int > = 0>
__host__ __device__ U * ptr (IntVectND< M > const &iv, int n) const noexcept
 
template<class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v, int > = 0>
__host__ __device__ U * ptr (Dim3 const &cell) const noexcept
 
template<class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v, int > = 0>
__host__ __device__ U * ptr (Dim3 const &cell, int n) const noexcept
 
template<bool B = IsArray4_v, std::enable_if_t< B, int > = 0>
__host__ __device__ bool contains (int i, int j, int k) const noexcept
 
template<int M, std::enable_if_t< IsArray4_v &&(M==3||M==3), int > = 0>
__host__ __device__ bool contains (IntVectND< M > const &iv) const noexcept
 
template<bool B = IsArray4_v, std::enable_if_t< B, int > = 0>
__host__ __device__ bool contains (Dim3 const &cell) const noexcept
 

Public Attributes

T *__restrict__ p = nullptr
 
detail::Stride< N-1 > stride {}
 
IntVectND< N > begin {1}
 
IntVectND< N > end {0}
 

Static Public Attributes

static constexpr bool IsLastDimComponent_v = last_dim_component
 
static constexpr bool IsArray4_v = (N==4 && last_dim_component)
 

Detailed Description

template<typename T, int N, bool last_dim_component = false>
struct amrex::ArrayND< T, N, last_dim_component >

A multidimensional array accessor.

Template Parameters
TThe type of data (e.g., Real, int).
NThe dimension of the array (rank).
last_dim_componentIf true, the last dimension is treated as components.

ArrayND is a lightweight, non-owning wrapper around a pointer that provides multidimensional indexing into a contiguous memory block. It is trivially copyable and designed to be passed by value into GPU kernels. Note, ArrayND follows fortran-style column-major ordering.

It stores the pointer, stride information, and the bounds (begin and end) of the array.

Constructor & Destructor Documentation

◆ ArrayND() [1/9]

template<typename T , int N, bool last_dim_component = false>
__host__ __device__ constexpr amrex::ArrayND< T, N, last_dim_component >::ArrayND ( )
inlineconstexprnoexcept

◆ ArrayND() [2/9]

template<typename T , int N, bool last_dim_component = false>
template<class U = T, std::enable_if_t< std::is_const_v< U >, int > = 0>
__host__ __device__ constexpr amrex::ArrayND< T, N, last_dim_component >::ArrayND ( ArrayND< std::remove_const_t< T >, N, last_dim_component > const &  rhs)
inlineconstexprnoexcept

◆ ArrayND() [3/9]

template<typename T , int N, bool last_dim_component = false>
template<bool C = last_dim_component, std::enable_if_t<!C, int > = 0>
__host__ __device__ amrex::ArrayND< T, N, last_dim_component >::ArrayND ( T *  a_p,
BoxND< N > const &  box 
)
inlinenoexcept

Constructor using a BoxND.

Parameters
a_pPointer to data.
boxThe domain covered by this array.

TODO: Make BoxND functions constexpr to allow this constructor to be constexpr.

◆ ArrayND() [4/9]

template<typename T , int N, bool last_dim_component = false>
template<int M, std::enable_if_t<((M+1==N)||(N==4 &&M==3)) &&last_dim_component, int > = 0>
__host__ __device__ amrex::ArrayND< T, N, last_dim_component >::ArrayND ( T *  a_p,
BoxND< M > const &  box,
int  ncomp 
)
inlinenoexcept

Constructor using a BoxND.

Parameters
a_pPointer to data.
boxBoxND<M> with M <= N-1 defining the spatial dimensions.
ncompNumber of components (size of last dimension).

TODO: Make BoxND functions constexpr to allow this constructor to be constexpr.

◆ ArrayND() [5/9]

template<typename T , int N, bool last_dim_component = false>
template<bool C = last_dim_component, std::enable_if_t<!C, int > = 0>
__host__ __device__ constexpr amrex::ArrayND< T, N, last_dim_component >::ArrayND ( T *  a_p,
IntVectND< N > const &  a_begin,
IntVectND< N > const &  a_end 
)
inlineconstexprnoexcept

IntVectND<N> constructor.

Parameters
a_pPointer to data.
a_beginStart index (inclusive).
a_endEnd index (exclusive).

This constructor specifies begin and end indices using IntVectND<N> for all N dimensions.

◆ ArrayND() [6/9]

template<typename T , int N, bool last_dim_component = false>
template<bool B = IsArray4_v, std::enable_if_t< B, int > = 0>
__host__ __device__ constexpr amrex::ArrayND< T, N, last_dim_component >::ArrayND ( T *  a_p,
Dim3 const &  a_begin,
Dim3 const &  a_end,
int  a_ncomp 
)
inlineconstexprnoexcept

Constructor for N=4 using Dim3.

Parameters
a_pPointer to data.
a_beginStart index.
a_endEnd index exclusive.
a_ncompNumber of components (4th dimension).

Typically used for standard (i, j, k, n) access in 3D simulations.

◆ ArrayND() [7/9]

template<typename T , int N, bool last_dim_component = false>
template<int M, std::enable_if_t<((M+1==N)||(N==4 &&M==3)) &&last_dim_component, int > = 0>
__host__ __device__ constexpr amrex::ArrayND< T, N, last_dim_component >::ArrayND ( T *  a_p,
IntVectND< M > const &  a_begin,
IntVectND< M > const &  a_end,
int  ncomp 
)
inlineconstexprnoexcept

Reduced dimension constructor with component count.

Parameters
a_pPointer to data.
a_beginStart index (inclusive).
a_endEnd index (exclusive).
ncompNumber of components (size of last dimension).

Pads intermediate dimensions with [0,1) and sets the last dimension to [0, ncomp).

◆ ArrayND() [8/9]

template<typename T , int N, bool last_dim_component = false>
template<class U , std::enable_if_t< std::is_same_v< std::remove_const_t< T >, std::remove_const_t< U > > &&(N >=2) &&last_dim_component, int > = 0>
__host__ __device__ constexpr amrex::ArrayND< T, N, last_dim_component >::ArrayND ( ArrayND< U, N, last_dim_component > const &  rhs,
int  start_comp 
)
inlineconstexprnoexcept

Slicing constructor (Component subset).

Parameters
rhsThe source ArrayND to slice from.
start_compThe starting component index for the slice.

Creates a new ArrayND that is a slice of the input ArrayND along the last dimension (components).

◆ ArrayND() [9/9]

template<typename T , int N, bool last_dim_component = false>
template<class U , std::enable_if_t< std::is_same_v< std::remove_const_t< T >, std::remove_const_t< U > > &&(N >=2) &&last_dim_component, int > = 0>
__host__ __device__ constexpr amrex::ArrayND< T, N, last_dim_component >::ArrayND ( ArrayND< U, N, last_dim_component > const &  rhs,
int  start_comp,
int  num_comp 
)
inlineconstexprnoexcept

Slicing constructor (Component subset with count).

Parameters
rhsThe source ArrayND to slice from.
start_compThe starting component index for the slice.
num_compThe number of components to include in the slice.

Creates a new ArrayND that is a slice of the input ArrayND along the last dimension (components).

Member Function Documentation

◆ cellData()

template<typename T , int N, bool last_dim_component = false>
template<int M = N, bool B = IsArray4_v, std::enable_if_t< B, int > = 0>
__host__ __device__ CellData< T > amrex::ArrayND< T, N, last_dim_component >::cellData ( int  i,
int  j,
int  k 
) const
inlinenoexcept

◆ contains() [1/6]

template<typename T , int N, bool last_dim_component = false>
template<bool B = IsArray4_v, std::enable_if_t< B, int > = 0>
__host__ __device__ bool amrex::ArrayND< T, N, last_dim_component >::contains ( Dim3 const &  cell) const
inlinenoexcept

◆ contains() [2/6]

template<typename T , int N, bool last_dim_component = false>
template<typename... idx, std::enable_if_t<!IsArray4_v &&detail::ArrayNDIndexCheck_impl_v< N, last_dim_component, idx... >, int > = 0>
__host__ __device__ constexpr bool amrex::ArrayND< T, N, last_dim_component >::contains ( idx...  i) const
inlineconstexprnoexcept

◆ contains() [3/6]

template<typename T , int N, bool last_dim_component = false>
template<bool B = IsArray4_v, std::enable_if_t< B, int > = 0>
__host__ __device__ bool amrex::ArrayND< T, N, last_dim_component >::contains ( int  i,
int  j,
int  k 
) const
inlinenoexcept

◆ contains() [4/6]

template<typename T , int N, bool last_dim_component = false>
template<int M, std::enable_if_t<(M==N)||(!IsArray4_v &&last_dim_component &&(M+1==N)), int > = 0>
__host__ __device__ constexpr bool amrex::ArrayND< T, N, last_dim_component >::contains ( IntVectND< M > const &  iv) const
inlineconstexprnoexcept

◆ contains() [5/6]

template<typename T , int N, bool last_dim_component = false>
template<int M, std::enable_if_t< IsArray4_v &&(M==3||M==3), int > = 0>
__host__ __device__ bool amrex::ArrayND< T, N, last_dim_component >::contains ( IntVectND< M > const &  iv) const
inlinenoexcept

◆ contains() [6/6]

template<typename T , int N, bool last_dim_component = false>
template<int M, std::enable_if_t< last_dim_component &&!IsArray4_v &&(M+1==N), int > = 0>
__host__ __device__ constexpr bool amrex::ArrayND< T, N, last_dim_component >::contains ( IntVectND< M > const &  iv,
int  n 
) const
inlineconstexprnoexcept

◆ dataPtr()

template<typename T , int N, bool last_dim_component = false>
__host__ __device__ constexpr T * amrex::ArrayND< T, N, last_dim_component >::dataPtr ( ) const
inlineconstexprnoexcept

Get raw data pointer.

Returns
Raw data pointer.

◆ get_offset() [1/2]

template<typename T , int N, bool last_dim_component = false>
template<int M, std::enable_if_t<(M==N)||(last_dim_component &&(M+1==N||M==3)), int > = 0>
__host__ __device__ constexpr Long amrex::ArrayND< T, N, last_dim_component >::get_offset ( IntVectND< M > const &  iv) const
inlineconstexprnoexcept

◆ get_offset() [2/2]

template<typename T , int N, bool last_dim_component = false>
template<int M, std::enable_if_t< last_dim_component &&((M+1==N)||(N==4 &&M==3)), int > = 0>
__host__ __device__ constexpr Long amrex::ArrayND< T, N, last_dim_component >::get_offset ( IntVectND< M > const &  iv,
int  n 
) const
inlineconstexprnoexcept

◆ get_stride()

template<typename T , int N, bool last_dim_component = false>
template<int d, std::enable_if_t<(d< N) &&(d >=0), int > = 0>
__host__ __device__ constexpr Long amrex::ArrayND< T, N, last_dim_component >::get_stride ( ) const
inlineconstexprnoexcept

◆ nComp()

template<typename T , int N, bool last_dim_component = false>
__host__ __device__ constexpr int amrex::ArrayND< T, N, last_dim_component >::nComp ( ) const
inlineconstexprnoexcept

Get number of components.

Returns
Number of components.

◆ ok()

template<typename T , int N, bool last_dim_component = false>
__host__ __device__ constexpr bool amrex::ArrayND< T, N, last_dim_component >::ok ( ) const
inlineconstexprnoexcept

Check if the ArrayND pointer is valid and bounds are valid.

Returns
true if pointer and bounds are valid, false otherwise.

◆ operator bool()

template<typename T , int N, bool last_dim_component = false>
__host__ __device__ constexpr amrex::ArrayND< T, N, last_dim_component >::operator bool ( ) const
inlineexplicitconstexprnoexcept

Check if the ArrayND pointer is valid.

Returns
true if pointer is valid, false otherwise.

◆ operator()() [1/9]

template<typename T , int N, bool last_dim_component = false>
template<class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v, int > = 0>
__host__ __device__ U & amrex::ArrayND< T, N, last_dim_component >::operator() ( Dim3 const &  cell) const
inlinenoexcept

◆ operator()() [2/9]

template<typename T , int N, bool last_dim_component = false>
template<class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v, int > = 0>
__host__ __device__ U & amrex::ArrayND< T, N, last_dim_component >::operator() ( Dim3 const &  cell,
int  n 
) const
inlinenoexcept

◆ operator()() [3/9]

template<typename T , int N, bool last_dim_component = false>
template<typename... idx, class U = T, std::enable_if_t<!std::is_void_v< U > &&!IsArray4_v &&detail::ArrayNDIndexCheck_impl_v< N, last_dim_component, idx... >, int > = 0>
__host__ __device__ U & amrex::ArrayND< T, N, last_dim_component >::operator() ( idx...  i) const
inlinenoexcept

Multi-index operator() for accessing elements.

Template Parameters
idxVariadic template for indices.
Parameters
iVariadic list of indices.
Returns
Reference to the element.

This operator is only enabled when the number of indices provided matches the dimension N or N-1 if last_dim_component is true, where in the latter case the last dimension is assumed to be 0. The passed indices must be of integral types that can be converted to int without narrowing. The last index can also be an enum type.

TODO: Use concepts when we move to C++20.

◆ operator()() [4/9]

template<typename T , int N, bool last_dim_component = false>
template<class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v, int > = 0>
__host__ __device__ U & amrex::ArrayND< T, N, last_dim_component >::operator() ( int  i,
int  j,
int  k 
) const
inlinenoexcept

◆ operator()() [5/9]

template<typename T , int N, bool last_dim_component = false>
template<class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v, int > = 0>
__host__ __device__ U & amrex::ArrayND< T, N, last_dim_component >::operator() ( int  i,
int  j,
int  k,
int  n 
) const
inlinenoexcept

◆ operator()() [6/9]

template<typename T , int N, bool last_dim_component = false>
template<int M, class U = T, std::enable_if_t< !std::is_void_v< U > &&((M==N)||(!IsArray4_v &&last_dim_component &&(M+1==N))), int > = 0>
__host__ __device__ U & amrex::ArrayND< T, N, last_dim_component >::operator() ( IntVectND< M > const &  iv) const
inlinenoexcept

Access element by IntVectND.

Template Parameters
MThe dimension of the index vector.
Parameters
ivThe index vector.
Returns
Reference to the element.

This function handles access via:

  1. Full dimension vector (M == N).
  2. Spatial dimension vector (M == N-1) && !IsArray4_v (only enabled if last_dim_component is true).

◆ operator()() [7/9]

template<typename T , int N, bool last_dim_component = false>
template<int M, class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v &&(M==3||M==3), int > = 0>
__host__ __device__ U & amrex::ArrayND< T, N, last_dim_component >::operator() ( IntVectND< M > const &  iv) const
inlinenoexcept

◆ operator()() [8/9]

template<typename T , int N, bool last_dim_component = false>
template<int M, class U = T, std::enable_if_t< !std::is_void_v< U > &&last_dim_component &&!IsArray4_v &&(M+1==N), int > = 0>
__host__ __device__ U & amrex::ArrayND< T, N, last_dim_component >::operator() ( IntVectND< M > const &  iv,
int  n 
) const
inlinenoexcept

Access element by spatial IntVectND and component index.

Template Parameters
MThe dimension of the spatial index vector (typically N-1 or AMREX_SPACEDIM).
Parameters
ivThe spatial index vector.
nComponent index (last dimension).
Returns
Reference to the element.

This overload is enabled only when last_dim_component is true and M represents the spatial dimensions (either N-1 or AMREX_SPACEDIM).

◆ operator()() [9/9]

template<typename T , int N, bool last_dim_component = false>
template<int M, class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v &&(M==3||M==3), int > = 0>
__host__ __device__ U & amrex::ArrayND< T, N, last_dim_component >::operator() ( IntVectND< M > const &  iv,
int  n 
) const
inlinenoexcept

◆ ptr() [1/9]

template<typename T , int N, bool last_dim_component = false>
template<class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v, int > = 0>
__host__ __device__ U * amrex::ArrayND< T, N, last_dim_component >::ptr ( Dim3 const &  cell) const
inlinenoexcept

◆ ptr() [2/9]

template<typename T , int N, bool last_dim_component = false>
template<class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v, int > = 0>
__host__ __device__ U * amrex::ArrayND< T, N, last_dim_component >::ptr ( Dim3 const &  cell,
int  n 
) const
inlinenoexcept

◆ ptr() [3/9]

template<typename T , int N, bool last_dim_component = false>
template<typename... idx, class U = T, std::enable_if_t<!std::is_void_v< U > &&!IsArray4_v &&detail::ArrayNDIndexCheck_impl_v< N, last_dim_component, idx... >, int > = 0>
__host__ __device__ T * amrex::ArrayND< T, N, last_dim_component >::ptr ( idx...  i) const
inlinenoexcept

Multi-index ptr() for accessing pointer to element.

Template Parameters
idxVariadic template for indices.
Parameters
iVariadic list of indices.
Returns
Pointer to the element.

◆ ptr() [4/9]

template<typename T , int N, bool last_dim_component = false>
template<class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v, int > = 0>
__host__ __device__ U * amrex::ArrayND< T, N, last_dim_component >::ptr ( int  i,
int  j,
int  k 
) const
inlinenoexcept

◆ ptr() [5/9]

template<typename T , int N, bool last_dim_component = false>
template<class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v, int > = 0>
__host__ __device__ U * amrex::ArrayND< T, N, last_dim_component >::ptr ( int  i,
int  j,
int  k,
int  n 
) const
inlinenoexcept

◆ ptr() [6/9]

template<typename T , int N, bool last_dim_component = false>
template<int M, std::enable_if_t<(M==N)||(!IsArray4_v &&last_dim_component &&(M+1==N)), int > = 0>
__host__ __device__ T * amrex::ArrayND< T, N, last_dim_component >::ptr ( IntVectND< M > const &  iv) const
inlinenoexcept

Access pointer by IntVectND.

Template Parameters
MThe dimension of the index vector.
Parameters
ivThe index vector.
Returns
Pointer to the element.

This function handles access via:

  1. Full dimension vector (M == N).
  2. Spatial dimension vector (M == N-1) && !IsArray4_v (only enabled if last_dim_component is true).

◆ ptr() [7/9]

template<typename T , int N, bool last_dim_component = false>
template<int M, class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v &&(M==3||M==3), int > = 0>
__host__ __device__ U * amrex::ArrayND< T, N, last_dim_component >::ptr ( IntVectND< M > const &  iv) const
inlinenoexcept

◆ ptr() [8/9]

template<typename T , int N, bool last_dim_component = false>
template<int M, std::enable_if_t< last_dim_component &&!IsArray4_v &&(M+1==N), int > = 0>
__host__ __device__ T * amrex::ArrayND< T, N, last_dim_component >::ptr ( IntVectND< M > const &  iv,
int  n 
) const
inlinenoexcept

Access pointer by spatial IntVectND and component index.

Template Parameters
MThe dimension of the spatial index vector (typically N-1 or AMREX_SPACEDIM).
Parameters
ivThe spatial index vector.
nComponent index (last dimension).
Returns
Pointer to the element.

This overload is enabled only when last_dim_component is true and M represents the spatial dimensions (either N-1 or AMREX_SPACEDIM).

◆ ptr() [9/9]

template<typename T , int N, bool last_dim_component = false>
template<int M, class U = T, std::enable_if_t<!std::is_void_v< U > &&IsArray4_v &&(M==3||M==3), int > = 0>
__host__ __device__ U * amrex::ArrayND< T, N, last_dim_component >::ptr ( IntVectND< M > const &  iv,
int  n 
) const
inlinenoexcept

◆ size()

template<typename T , int N, bool last_dim_component = false>
__host__ __device__ constexpr std::size_t amrex::ArrayND< T, N, last_dim_component >::size ( ) const
inlineconstexprnoexcept

Member Data Documentation

◆ begin

template<typename T , int N, bool last_dim_component = false>
IntVectND<N> amrex::ArrayND< T, N, last_dim_component >::begin {1}

◆ end

template<typename T , int N, bool last_dim_component = false>
IntVectND<N> amrex::ArrayND< T, N, last_dim_component >::end {0}

◆ IsArray4_v

template<typename T , int N, bool last_dim_component = false>
constexpr bool amrex::ArrayND< T, N, last_dim_component >::IsArray4_v = (N==4 && last_dim_component)
staticconstexpr

◆ IsLastDimComponent_v

template<typename T , int N, bool last_dim_component = false>
constexpr bool amrex::ArrayND< T, N, last_dim_component >::IsLastDimComponent_v = last_dim_component
staticconstexpr

◆ p

template<typename T , int N, bool last_dim_component = false>
T* __restrict__ amrex::ArrayND< T, N, last_dim_component >::p = nullptr

◆ stride

template<typename T , int N, bool last_dim_component = false>
detail::Stride<N-1> amrex::ArrayND< T, N, last_dim_component >::stride {}

The documentation for this struct was generated from the following file: