atlas
|
Multi-dimensional access to a Array object or Field object. More...
#include <NativeArrayView.h>
Public Member Functions | |
ATLAS_HOST_DEVICE | ArrayView (const ArrayView &other) |
ArrayView (const Array &array, bool device_view) | |
ArrayView (const ArrayView< value_type, Rank > &other) | |
operator const ArrayView< value_type, Rank > & () const | |
value_type * | data () |
value_type const * | data () const |
template<typename... Coords, typename = typename std::enable_if<( sizeof...( Coords ) == Rank ), int>::type> | |
ATLAS_HOST_DEVICE value_type & | operator() (Coords... c) |
template<typename... Coords, typename = typename std::enable_if<( sizeof...( Coords ) == Rank ), int>::type> | |
ATLAS_HOST_DEVICE value_type const & | operator() (Coords... c) const |
template<typename Int , bool EnableBool = true> | |
ATLAS_HOST_DEVICE std::enable_if<(Rank==1 &&EnableBool), const value_type & >::type | operator[] (Int idx) const |
template<typename Int , bool EnableBool = true> | |
ATLAS_HOST_DEVICE std::enable_if<(Rank==1 &&EnableBool), value_type & >::type | operator[] (Int idx) |
template<unsigned int Dim> | |
ATLAS_HOST_DEVICE idx_t | shape () const |
ATLAS_HOST_DEVICE data_view_t & | data_view () |
ATLAS_HOST_DEVICE data_view_t const & | data_view () const |
template<unsigned int Dim> | |
ATLAS_HOST_DEVICE idx_t | stride () const |
size_t | size () const |
bool | valid () const |
bool | contiguous () const |
void | dump (std::ostream &os) const |
ENABLE_IF_NON_CONST void | assign (const value_type &value) |
ENABLE_IF_NON_CONST void | assign (const std::initializer_list< value_type > &list) |
const idx_t * | strides () const |
const idx_t * | shape () const |
template<typename Int > | |
idx_t | shape (Int idx) const |
template<typename Int > | |
idx_t | stride (Int idx) const |
template<typename... Args> | |
slice_t< Args... >::type | slice (Args... args) |
template<typename... Args> | |
const_slice_t< Args... >::type | slice (Args... args) const |
bool | isDeviceView () const |
ArrayView (const ArrayView &other) | |
ArrayView (const ArrayView< value_type, Rank > &other) | |
ArrayView (value_type *data, const ArrayShape &shape, const ArrayStrides &strides) | |
operator const ArrayView< value_type, Rank > & () const | |
template<typename... Idx> | |
value_type & | operator() (Idx... idx) |
Multidimensional index operator: view(i,j,k,...) | |
template<typename... Ints> | |
const value_type & | operator() (Ints... idx) const |
Multidimensional index operator: view(i,j,k,...) | |
template<typename Int , bool EnableBool = true> | |
std::enable_if<(Rank==1 &&EnableBool), const value_type & >::type | operator[] (Int idx) const |
Access to data using square bracket [idx] operator {m-label m-warning} Rank==1. More... | |
template<typename Int , bool EnableBool = true> | |
std::enable_if<(Rank==1 &&EnableBool), value_type & >::type | operator[] (Int idx) |
Access to data using square bracket [idx] operator {m-label m-warning} Rank==1 More... | |
template<unsigned int Dim> | |
idx_t | shape () const |
Return number of values in dimension Dim (template argument) More... | |
template<unsigned int Dim> | |
idx_t | stride () const |
Return stride for values in dimension Dim (template argument) | |
size_t | size () const |
Return total number of values (accumulated over all dimensions) | |
const idx_t * | strides () const |
const idx_t * | shape () const |
template<typename Int > | |
idx_t | shape (Int idx) const |
Return number of values in dimension idx. | |
template<typename Int > | |
idx_t | stride (Int idx) const |
Return stride for values in dimension idx. | |
value_type const * | data () const |
Access to internal data. {m-label m-danger} dangerous | |
value_type * | data () |
Access to internal data. {m-label m-danger} dangerous | |
bool | valid () const |
bool | contiguous () const |
Return true when all values are contiguous in memory. More... | |
ENABLE_IF_NON_CONST void | assign (const value_type &value) |
ENABLE_IF_NON_CONST void | assign (const std::initializer_list< value_type > &list) |
void | dump (std::ostream &os) const |
template<typename... Args> | |
slice_t< Args... >::type | slice (Args... args) |
Obtain a slice from this view: view.slice( Range, Range, ... More... | |
template<typename... Args> | |
const_slice_t< Args... >::type | slice (Args... args) const |
Obtain a slice from this view: view.slice( Range, Range, ... ) | |
Static Public Member Functions | |
static constexpr idx_t | rank () |
static constexpr idx_t | rank () |
Return the number of dimensions. | |
Static Public Attributes | |
static constexpr bool | is_const = std::is_const<Value>::value |
static constexpr bool | is_non_const = !std::is_const<Value>::value |
static constexpr int | RANK {Rank} |
Friends | |
template<typename friendValue , int friendRank> | |
class | ArrayView |
Multi-dimensional access to a Array object or Field object.
An ArrayView enables access to the inner data-memory-storage of the Array. It is required to create the view using the make_view helper functions.
Depending on whether atlas was compiled with the Feature GRIDTOOLS_STORAGE
, the internal data allocation of the Array object is managed by GridTools (ATLAS_HAVE_GRIDTOOLS==1) or by Atlas itself (ATLAS_HAVE_GRIDTOOLS==0).
The ArrayView class is therefore also compiled differently dependening on this feature.
|
inline |
Return true when all values are contiguous in memory.
This means that if there is e.g. padding in the fastest dimension, or if the ArrayView represents a slice, the returned value will be false.
|
inline |
Access to data using square bracket [idx] operator {m-label m-warning} Rank==1.
Note that this function is only present when Rank == 1
|
inline |
Access to data using square bracket [idx] operator {m-label m-warning} Rank==1
Note that this function is only present when Rank == 1
|
inline |
|
inline |
Obtain a slice from this view: view.slice( Range, Range, ...
)
The return type of this function is intentionally auto
and is guaranteed to have the same API as ArrayView, but is not necessarily this type.
If the current view has Rank == 2, a Rank == 1 slice can be created in several ways:
Sometimes it may be required to extend the rank of the current view to cater for certain algorithms requiring an extra rank.