WARPXM v1.10.0
Loading...
Searching...
No Matches
WmTypedArray< MAJOR_ORDER_TYPE, T > Class Template Reference

Defines common interface for arrays of type T elements. More...

#include <wmsimplearrays.h>

Inheritance diagram for WmTypedArray< MAJOR_ORDER_TYPE, T >:
WmTypeOpaqueArray< MAJOR_ORDER_TYPE > WmArrayBase< MAJOR_ORDER_TYPE >

Detailed Description

template<int MAJOR_ORDER_TYPE, typename T>
class WmTypedArray< MAJOR_ORDER_TYPE, T >

Defines common interface for arrays of type T elements.

Support for arbitrary dimensions, major ordering, and start indices.

Public Member Functions

 WmTypedArray (const WxRange &range, T *data)
 Array spanning given range object.
 
 WmTypedArray (const WxRange &range)
 Array spanning given range object.
 
 WmTypedArray (const WmTypedArray< MAJOR_ORDER_TYPE, T > &that)
 Copy constructor does not allocate new memory.
 
 WmTypedArray (const WmTypeOpaqueArray< MAJOR_ORDER_TYPE > &that)
 Special copy constructor does not allocate new memory.
 
WmTypedArray< MAJOR_ORDER_TYPE, T > & operator= (const WmTypedArray< MAJOR_ORDER_TYPE, T > &that)
 
 ~WmTypedArray ()
 Delete instance which may or may not involve freeing array element allocation.
 
operator() (int k0) const
 Rank-1 indexer.
 
T & operator() (int k0)
 
operator() (int k0, int k1) const
 Rank-2 indexer.
 
T & operator() (int k0, int k1)
 
operator() (int k0, int k1, int k2) const
 Rank-3 indexer.
 
T & operator() (int k0, int k1, int k2)
 
operator() (int k0, int k1, int k2, int k3) const
 Rank-4 indexer.
 
T & operator() (int k0, int k1, int k2, int k3)
 
T * data ()
 Access raw array data.
 
const T * data () const
 Access raw array data.
 
T * dataSlab (const int *indices, int indicesRank)
 Access higher dimension slab of raw array element.
 
const T * dataSlab (const int *indices, int indicesRank) const
 Access higher dimension slab of raw array element.
 
- Public Member Functions inherited from WmTypeOpaqueArray< MAJOR_ORDER_TYPE >
 WmTypeOpaqueArray (const WxRange &range, void *data, int numBytesPerElement)
 Array spanning given range object.
 
 WmTypeOpaqueArray (const WmTypeOpaqueArray< MAJOR_ORDER_TYPE > &that)
 Copy constructor does not allocate new memory.
 
WmTypeOpaqueArray< MAJOR_ORDER_TYPE > & operator= (const WmTypeOpaqueArray< MAJOR_ORDER_TYPE > &that)
 
void * data ()
 Access start of raw array data.
 
const void * data () const
 Access start of raw array data.
 
void * data (const int *indices)
 Access raw array element.
 
const void * data (const int *indices) const
 Access raw array element.
 
void * dataSlab (const int *indices, int indicesRank)
 Access higher dimension slab of raw array element.
 
const void * dataSlab (const int *indices, int indicesRank) const
 Access higher dimension slab of raw array element.
 
int numBytesPerElement () const
 
void put (const WxRange &selection, const WxRange &inputShape, const void *bufin)
 Copy data elements from bufin to the region described by the range selection.
 
void get (const WxRange &selection, const WxRange &outputShape, void *bufout) const
 Copy data elements from the region described range selection to the bufout provided.
 
virtual ~WmTypeOpaqueArray ()
 Delete object which only describes the array geometry, no array allocation is deleted.
 
- Public Member Functions inherited from WmArrayBase< MAJOR_ORDER_TYPE >
const WxRangerange () const
 

Protected Member Functions

void resetArrayProperties (const WxRange &range, T *newdata)
 Copy data elements from bufin to the region described by the range selection.
 
 WmTypedArray ()
 Default ctor does not set up array geometry initially, this must be done later, so it is only exposed to derived classes.
 
- Protected Member Functions inherited from WmTypeOpaqueArray< MAJOR_ORDER_TYPE >
 WmTypeOpaqueArray ()
 Default ctor does not set up array geometry initially, this must be done later, so it is only exposed to derived classes.
 
void resetArrayProperties (const WxRange &range, void *data, int numBytesPerElement)
 Reset the properties of this array.
 
- Protected Member Functions inherited from WmArrayBase< MAJOR_ORDER_TYPE >
 WmArrayBase ()
 Default ctor does not set up array geometry initially, this must be done later.
 
 WmArrayBase (const WxRange &range)
 Array spanning given range object.
 
 WmArrayBase (const WmArrayBase< MAJOR_ORDER_TYPE > &that)
 Copy constructor duplicates the array geometry properties of original one.
 
WmArrayBase< MAJOR_ORDER_TYPE > & operator= (const WmArrayBase< MAJOR_ORDER_TYPE > &that)
 Assignment operator duplicates the array geometry properties of right hand side one.
 
 ~WmArrayBase ()
 Delete object which only describes the array geometry, no array allocation is deleted.
 
void setRange (const WxRange &range)
 Array spanning given range object.
 
unsigned rank () const
 Rank of array.
 

Additional Inherited Members

- Protected Attributes inherited from WmArrayBase< MAJOR_ORDER_TYPE >
WmIndexer< MAJOR_ORDER_TYPE > _indexer
 Indexer assists finding linear position of array elements.
 
WxRange _range
 Range covered by this array.
 
- Static Protected Attributes inherited from WmArrayBase< MAJOR_ORDER_TYPE >
static const int max_dims = 8
 

Constructor & Destructor Documentation

◆ WmTypedArray() [1/5]

template<int MAJOR_ORDER_TYPE, typename T >
WmTypedArray< MAJOR_ORDER_TYPE, T >::WmTypedArray ( const WxRange range,
T *  data 
)
inline

Array spanning given range object.

Freeing of array memory is not the responsibility of this instance.

Parameters
rangerange spanned by array
datapointer to already allocated array storage

◆ WmTypedArray() [2/5]

template<int MAJOR_ORDER_TYPE, typename T >
WmTypedArray< MAJOR_ORDER_TYPE, T >::WmTypedArray ( const WxRange range)
inline

Array spanning given range object.

This instance will allocate array elements and subsequently free them upon destruction.

Parameters
rangerange spanned by array

◆ WmTypedArray() [3/5]

template<int MAJOR_ORDER_TYPE, typename T >
WmTypedArray< MAJOR_ORDER_TYPE, T >::WmTypedArray ( const WmTypedArray< MAJOR_ORDER_TYPE, T > &  that)
inline

Copy constructor does not allocate new memory.

The created array represents the same data and geometry as the original one.

Freeing of array memory is not the responsibility of this instance

Parameters
farray to copy

◆ WmTypedArray() [4/5]

template<int MAJOR_ORDER_TYPE, typename T >
WmTypedArray< MAJOR_ORDER_TYPE, T >::WmTypedArray ( const WmTypeOpaqueArray< MAJOR_ORDER_TYPE > &  that)
inline

Special copy constructor does not allocate new memory.

The created array represents the same data and geometry as the original one.

Freeing of array memory is not the responsibility of this instance

Parameters
farray to copy (promotes TypeOpaque to Typed Array)

◆ ~WmTypedArray()

template<int MAJOR_ORDER_TYPE, typename T >
WmTypedArray< MAJOR_ORDER_TYPE, T >::~WmTypedArray ( )
inline

Delete instance which may or may not involve freeing array element allocation.

It depends on which constructor was called.

◆ WmTypedArray() [5/5]

template<int MAJOR_ORDER_TYPE, typename T >
WmTypedArray< MAJOR_ORDER_TYPE, T >::WmTypedArray ( )
inlineprotected

Default ctor does not set up array geometry initially, this must be done later, so it is only exposed to derived classes.

Before this instance would be useful, derived must call resetArrayProperties().

Member Function Documentation

◆ data() [1/2]

template<int MAJOR_ORDER_TYPE, typename T >
T * WmTypedArray< MAJOR_ORDER_TYPE, T >::data ( )
inline

Access raw array data.

Returns
Pointer to start of raw array data.

◆ data() [2/2]

template<int MAJOR_ORDER_TYPE, typename T >
const T * WmTypedArray< MAJOR_ORDER_TYPE, T >::data ( ) const
inline

Access raw array data.

Returns
Const Pointer to raw array data.

◆ dataSlab() [1/2]

template<int MAJOR_ORDER_TYPE, typename T >
T * WmTypedArray< MAJOR_ORDER_TYPE, T >::dataSlab ( const int *  indices,
int  indicesRank 
)
inline

Access higher dimension slab of raw array element.

Parameters
indicesspecify slab location, starting from array dim 0
indicesRanknumber of indices provided
Returns
Pointer to array slab starting at specified slab location

◆ dataSlab() [2/2]

template<int MAJOR_ORDER_TYPE, typename T >
const T * WmTypedArray< MAJOR_ORDER_TYPE, T >::dataSlab ( const int *  indices,
int  indicesRank 
) const
inline

Access higher dimension slab of raw array element.

Parameters
indicesspecify slab location, starting from array dim 0
indicesRanknumber of indices provided
Returns
Pointer to array slab starting at specified slab location

◆ operator()() [1/8]

template<int MAJOR_ORDER_TYPE, typename T >
T & WmTypedArray< MAJOR_ORDER_TYPE, T >::operator() ( int  k0)

◆ operator()() [2/8]

template<int MAJOR_ORDER_TYPE, typename T >
T WmTypedArray< MAJOR_ORDER_TYPE, T >::operator() ( int  k0) const

Rank-1 indexer.

Parameters
k0index into dimension 0

◆ operator()() [3/8]

template<int MAJOR_ORDER_TYPE, typename T >
T & WmTypedArray< MAJOR_ORDER_TYPE, T >::operator() ( int  k0,
int  k1 
)

◆ operator()() [4/8]

template<int MAJOR_ORDER_TYPE, typename T >
T WmTypedArray< MAJOR_ORDER_TYPE, T >::operator() ( int  k0,
int  k1 
) const

Rank-2 indexer.

Parameters
k0index into dimension 0
k1index into dimension 1

◆ operator()() [5/8]

template<int MAJOR_ORDER_TYPE, typename T >
T & WmTypedArray< MAJOR_ORDER_TYPE, T >::operator() ( int  k0,
int  k1,
int  k2 
)

◆ operator()() [6/8]

template<int MAJOR_ORDER_TYPE, typename T >
T WmTypedArray< MAJOR_ORDER_TYPE, T >::operator() ( int  k0,
int  k1,
int  k2 
) const

Rank-3 indexer.

Parameters
k0index into dimension 0
k1index into dimension 1
k2index into dimension 2

◆ operator()() [7/8]

template<int MAJOR_ORDER_TYPE, typename T >
T & WmTypedArray< MAJOR_ORDER_TYPE, T >::operator() ( int  k0,
int  k1,
int  k2,
int  k3 
)

◆ operator()() [8/8]

template<int MAJOR_ORDER_TYPE, typename T >
T WmTypedArray< MAJOR_ORDER_TYPE, T >::operator() ( int  k0,
int  k1,
int  k2,
int  k3 
) const

Rank-4 indexer.

Parameters
k0index into dimension 0
k1index into dimension 1
k2index into dimension 2
k3index into dimension 3

◆ operator=()

template<int MAJOR_ORDER_TYPE, typename T >
WmTypedArray< MAJOR_ORDER_TYPE, T > & WmTypedArray< MAJOR_ORDER_TYPE, T >::operator= ( const WmTypedArray< MAJOR_ORDER_TYPE, T > &  that)
inline

◆ resetArrayProperties()

template<int MAJOR_ORDER_TYPE, typename T >
void WmTypedArray< MAJOR_ORDER_TYPE, T >::resetArrayProperties ( const WxRange range,
T *  newdata 
)
inlineprotected

Copy data elements from bufin to the region described by the range selection.

Assumes that the bufin elements are arranged exactly matching the dimensions of the destination range. (i.e. same major ordering, no ghost/exterior cells skipping.

Parameters
hyper-rectangularrange in this array to copy into.
sourcedata elements with contiguous arrangement. Copy data elements from the region described range selection to the bufout provided.

The bufout elements are arranged exactly matching the dimensions of the source range. (i.e. same major ordering, no ghost/exterior cell skipping.

Parameters
hyper-rectangularrange in this array to copy from.
desitinationdata elements with contiguous arrangement. Reset the properties of this array.

protected so only responsible derived class can change geometry. Intended for modification to instances that are not responsible for allocation. But, if called on such an instance, the allocation will be freed.


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