|
| CSArray ()=default |
|
YAKL_INLINE | CSArray (T init_fill) |
| No constructor arguments allowed. More...
|
|
| ~CSArray ()=default |
|
YAKL_INLINE T * | begin () const |
| Returns pointer to beginning of the data. More...
|
|
YAKL_INLINE T * | data () const |
| Get the underlying raw data pointer. More...
|
|
YAKL_INLINE T * | end () const |
| Returns pointer to end of the data. More...
|
|
YAKL_INLINE T * | get_data () const |
| Get the underlying raw data pointer. More...
|
|
YAKL_INLINE CSArray< uint, 1, rank > | get_dimensions () const |
| Returns the dimensions of this array as a yakl::SArray object. More...
|
|
YAKL_INLINE CSArray< uint, 1, rank > | get_lbounds () const |
| Returns the lower bound of each dimension of this array as a yakl::SArray object. More...
|
|
YAKL_INLINE CSArray< uint, 1, rank > | get_ubounds () const |
| Returns the upper bound of each dimension of this array as a yakl::SArray object. More...
|
|
YAKL_INLINE T & | operator() (uint const i0) const |
| Returns a reference to the indexed element (1-D). More...
|
|
YAKL_INLINE T & | operator() (uint const i0, uint const i1) const |
| Returns a reference to the indexed element (2-D). More...
|
|
YAKL_INLINE T & | operator() (uint const i0, uint const i1, uint const i2) const |
| Returns a reference to the indexed element (3-D). More...
|
|
YAKL_INLINE T & | operator() (uint const i0, uint const i1, uint const i2, uint const i3) const |
| Returns a reference to the indexed element (4-D). More...
|
|
template<class TLOC , typename std::enable_if< std::is_arithmetic< TLOC >::value, int >::type = 0> |
YAKL_INLINE void | operator= (TLOC val) |
| Assign a single arithmetic value to the entire array. More...
|
|
template<class T, int rank, unsigned D0, unsigned D1 = 1, unsigned D2 = 1, unsigned D3 = 1>
class yakl::CSArray< T, rank, D0, D1, D2, D3 >
C-style array on the stack similar in nature to, e.g., float arr[ny][nx];
This creates a C-style "Stack Array" (CSArray) class, which is typedefined to yakl::SArray. It should be thought of as very similar to a C-style multi-dimensional array, float arr[n1][n2][n3];
. That array as an SArray
object would be created as yakl::SArray<float,3,n1,n2,n3> arr;
, and it would be indexed as arr(i1,i2,i3);
. For bounds checking, define the CPP macro YAKL_DEBUG
. Dimensions sizes must be known at compile time, and data is placed on the stack of whatever context it is declared. When declared in a device parallel_for
kernel, it is a thread-private array, meaning every thread has a separate copy of the array.
- Parameters
-
T | Type of the yakl::SArray object |
rank | Number of dimensions |
D[0-3] | Dimensions sizes. D1, D2, and D3 are optional template parameters |
Creating these arrays is very cheap, but copying them does a deep copy every time and can be expensive. yakl::SArray objects should be indexed with zero-based indices in row-major order (right-most index varies the fastest)
template<class T , int rank, unsigned D0, unsigned D1 = 1, unsigned D2 = 1, unsigned D3 = 1>
Returns a reference to the indexed element (1-D).
Number of indices must match the rank of the array object. For bounds checking, define the CPP macro YAKL_DEBUG
. Always use zero-based indexing with row-major ordering (right-most index varying the fastest).
template<class T , int rank, unsigned D0, unsigned D1 = 1, unsigned D2 = 1, unsigned D3 = 1>
Returns a reference to the indexed element (2-D).
Number of indices must match the rank of the array object. For bounds checking, define the CPP macro YAKL_DEBUG
. Always use zero-based indexing with row-major ordering (right-most index varying the fastest).
template<class T , int rank, unsigned D0, unsigned D1 = 1, unsigned D2 = 1, unsigned D3 = 1>
Returns a reference to the indexed element (3-D).
Number of indices must match the rank of the array object. For bounds checking, define the CPP macro YAKL_DEBUG
. Always use zero-based indexing with row-major ordering (right-most index varying the fastest).
template<class T , int rank, unsigned D0, unsigned D1 = 1, unsigned D2 = 1, unsigned D3 = 1>
Returns a reference to the indexed element (4-D).
Number of indices must match the rank of the array object. For bounds checking, define the CPP macro YAKL_DEBUG
. Always use zero-based indexing with row-major ordering (right-most index varying the fastest).
template<class T , int rank, unsigned D0, unsigned D1 = 1, unsigned D2 = 1, unsigned D3 = 1>
template<class TLOC , typename std::enable_if< std::is_arithmetic< TLOC >::value, int >::type = 0>
Assign a single arithmetic value to the entire array.