Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
amrex::PolymorphicArray4< T > Class Template Reference

Array4 subclass that provides uniform (i,j,k,n) access for both AoS and SoA data. More...

#include <AMReX_Array4.H>

Inheritance diagram for amrex::PolymorphicArray4< T >:
amrex::ArrayND< T, 4, true >

Public Member Functions

__host__ __device__ PolymorphicArray4 (Array4< T > const &a)
__host__ __device__ T & operator() (int i, int j, int k) const noexcept
__host__ __device__ T::reference_type operator() (int i, int j, int k, int n) const noexcept
__host__ __device__ T & operator() (int i, int j, int k, int n) const noexcept
Public Member Functions inherited from amrex::ArrayND< T, 4, true >
__host__ __device__ constexpr ArrayND () noexcept
 Default-construct an empty accessor.
__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.
__host__ __device__ ArrayND (T *a_p, BoxND< N > const &box) noexcept
 Constructor using a BoxND.
__host__ __device__ ArrayND (T *a_p, BoxND< M > const &box, int ncomp) noexcept
 Constructor using a BoxND and the number of components.
__host__ __device__ constexpr ArrayND (T *a_p, IntVectND< N > const &a_begin, IntVectND< N > const &a_end) noexcept
 IntVectND<N> constructor.
__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.
__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.
__host__ __device__ constexpr ArrayND (ArrayND< U, N, last_dim_component > const &rhs, int start_comp) noexcept
 Slicing constructor (Component subset).
__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.
__host__ __device__ T & operator() (idx... i) const noexcept
 Multi-index operator() for accessing elements.
__host__ __device__ T & operator() (IntVectND< M > const &iv) const noexcept
 Access element by IntVectND.
__host__ __device__ T & operator() (IntVectND< M > const &iv, int n) const noexcept
 Access element by spatial IntVectND and component index.
__host__ __device__ T * ptr (idx... i) const noexcept
 Multi-index ptr() for accessing pointer to element.
__host__ __device__ T * ptr (IntVectND< M > const &iv) const noexcept
 Access pointer by IntVectND.
__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
 Total number of elements in the ArrayND's index region.
__host__ __device__ constexpr Long get_stride () const noexcept
 Return the stride (in elements) for dimension d.
__host__ __device__ constexpr bool contains (idx... i) const noexcept
 Test whether an index tuple lies inside the ArrayND bounds.
__host__ __device__ constexpr bool contains (IntVectND< M > const &iv) const noexcept
 Test whether an IntVectND lies inside the ArrayND bounds.
__host__ __device__ constexpr bool contains (IntVectND< M > const &iv, int n) const noexcept
 Test whether a spatial index and component lie inside the bounds.
__host__ __device__ CellData< T > cellData (int i, int j, int k) const noexcept
 Create a single-cell component accessor.
__host__ __device__ constexpr Long get_offset (IntVectND< M > const &iv) const noexcept
 Compute the linear offset (in elements) for an IntVectND.
__host__ __device__ constexpr Long get_offset (IntVectND< M > const &iv, int n) const noexcept
 Compute the linear offset (in elements) for an IntVectND and component index.
__host__ __device__ T & operator() (int i, int j, int k) const noexcept
 Access Array4 element using three integer spatial indices.
__host__ __device__ T & operator() (int i, int j, int k, int n) const noexcept
 Access Array4 element using three integer spatial indices and component index.
__host__ __device__ T & operator() (IntVectND< M > const &iv) const noexcept
 Access Array4 element by spatial indices in IntVectND.
__host__ __device__ T & operator() (IntVectND< M > const &iv, int n) const noexcept
 Access Array4 element by spatial indices in IntVectND and component index.
__host__ __device__ T & operator() (Dim3 const &cell) const noexcept
 Access Array4 element by spatial indices in Dim3.
__host__ __device__ T & operator() (Dim3 const &cell, int n) const noexcept
 Access Array4 element by spatial indices in Dim3 and component index.
__host__ __device__ T * ptr (int i, int j, int k) const noexcept
 Return the pointer to an element.
__host__ __device__ T * ptr (int i, int j, int k, int n) const noexcept
 Return the pointer to an element.
__host__ __device__ T * ptr (IntVectND< M > const &iv) const noexcept
 Return the pointer to an element.
__host__ __device__ T * ptr (IntVectND< M > const &iv, int n) const noexcept
 Return the pointer to an element.
__host__ __device__ T * ptr (Dim3 const &cell) const noexcept
 Return the pointer to an element.
__host__ __device__ T * ptr (Dim3 const &cell, int n) const noexcept
 Return the pointer to an element.
__host__ __device__ bool contains (int i, int j, int k) const noexcept
 Test whether the spatial indices are inside the Array4 bounds.
__host__ __device__ bool contains (IntVectND< M > const &iv) const noexcept
 Test whether the spatial indices are inside the Array4 bounds.
__host__ __device__ bool contains (Dim3 const &cell) const noexcept
 Test whether the spatial indices are inside the Array4 bounds.

Additional Inherited Members

Public Attributes inherited from amrex::ArrayND< T, 4, true >
T *__restrict__ p
IntVectND< N > begin
 Inclusive lower bounds.
IntVectND< N > end
 Exclusive upper bounds.
Static Public Attributes inherited from amrex::ArrayND< T, 4, true >
static constexpr bool IsLastDimComponent_v
 True if the last dimension is treated as components.
static constexpr bool IsArray4_v
 True if this is an Array4 (N==4 and last dim is component).

Detailed Description

template<typename T>
class amrex::PolymorphicArray4< T >

Array4 subclass that provides uniform (i,j,k,n) access for both AoS and SoA data.

Dispatches operator()(i,j,k,n) to the appropriate access pattern depending on whether T is a multi-component value type (AoS) or a scalar type (SoA). SoA refers to a multi-component BaseFab; AoS refers to a single-component BaseFab whose element type is a multi-component GpuArray.

Template Parameters
TElement type.

Constructor & Destructor Documentation

◆ PolymorphicArray4()

template<typename T>
__host__ __device__ amrex::PolymorphicArray4< T >::PolymorphicArray4 ( Array4< T > const & a)
inline

Member Function Documentation

◆ operator()() [1/3]

template<typename T>
__host__ __device__ T & amrex::PolymorphicArray4< T >::operator() ( int i,
int j,
int k ) const
inlinenodiscardnoexcept

◆ operator()() [2/3]

template<typename T>
__host__ __device__ T & amrex::PolymorphicArray4< T >::operator() ( int i,
int j,
int k,
int n ) const
inlinenodiscardnoexcept

◆ operator()() [3/3]

template<typename T>
__host__ __device__ T::reference_type amrex::PolymorphicArray4< T >::operator() ( int i,
int j,
int k,
int n ) const
inlinenodiscardnoexcept

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