WARPXM v1.10.0
Loading...
Searching...
No Matches
WmTypeOpaqueArray< MAJOR_ORDER_TYPE > Class Template Reference

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

#include <wmsimplearrays.h>

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

Detailed Description

template<int MAJOR_ORDER_TYPE>
class WmTypeOpaqueArray< MAJOR_ORDER_TYPE >

Defines common interface for arrays of elements.

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

Public Member Functions

 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

 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

◆ WmTypeOpaqueArray() [1/3]

template<int MAJOR_ORDER_TYPE>
WmTypeOpaqueArray< MAJOR_ORDER_TYPE >::WmTypeOpaqueArray ( const WxRange range,
void *  data,
int  numBytesPerElement 
)
inline

Array spanning given range object.

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

Parameters
rangerange spanned by array
pointerto already allocated array storage
numberof bytes per array element

◆ WmTypeOpaqueArray() [2/3]

template<int MAJOR_ORDER_TYPE>
WmTypeOpaqueArray< MAJOR_ORDER_TYPE >::WmTypeOpaqueArray ( const WmTypeOpaqueArray< MAJOR_ORDER_TYPE > &  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 class.

Parameters
farray to copy

◆ ~WmTypeOpaqueArray()

template<int MAJOR_ORDER_TYPE>
virtual WmTypeOpaqueArray< MAJOR_ORDER_TYPE >::~WmTypeOpaqueArray ( )
inlinevirtual

Delete object which only describes the array geometry, no array allocation is deleted.

Protected because I anticipate programmer error if ever trying to call delete on a pointer to a WmTypedArrray and for potential performance reasons, I did not want to just make the destructor virtual and forget about it.

For unstructured meshes these arrays are important for defining patch data within a global array Making this public means I can pass around typed arrays without worrying about data type

◆ WmTypeOpaqueArray() [3/3]

template<int MAJOR_ORDER_TYPE>
WmTypeOpaqueArray< MAJOR_ORDER_TYPE >::WmTypeOpaqueArray ( )
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/4]

template<int MAJOR_ORDER_TYPE>
void * WmTypeOpaqueArray< MAJOR_ORDER_TYPE >::data ( )
inline

Access start of raw array data.

Returns
Pointer to start of raw array data.

◆ data() [2/4]

template<int MAJOR_ORDER_TYPE>
const void * WmTypeOpaqueArray< MAJOR_ORDER_TYPE >::data ( ) const
inline

Access start of raw array data.

Returns
Const Pointer to raw array data.

◆ data() [3/4]

template<int MAJOR_ORDER_TYPE>
void * WmTypeOpaqueArray< MAJOR_ORDER_TYPE >::data ( const int *  indices)
inline

Access raw array element.

Parameters
indicesspecify array location
Returns
Pointer to array element with correct offset.

◆ data() [4/4]

template<int MAJOR_ORDER_TYPE>
const void * WmTypeOpaqueArray< MAJOR_ORDER_TYPE >::data ( const int *  indices) const
inline

Access raw array element.

Parameters
indicesspecify array location
Returns
Const Pointer to raw array data with correct offset.

◆ dataSlab() [1/2]

template<int MAJOR_ORDER_TYPE>
void * WmTypeOpaqueArray< MAJOR_ORDER_TYPE >::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>
const void * WmTypeOpaqueArray< MAJOR_ORDER_TYPE >::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

◆ get()

template<int MAJOR_ORDER_TYPE>
void WmTypeOpaqueArray< MAJOR_ORDER_TYPE >::get ( const WxRange selection,
const WxRange outputShape,
void *  bufout 
) const

Copy data elements from the region described range selection to the bufout provided.

Destination buffer elements are assumed to be arranged according to outputShape such that the first element in bufout corresponds to the upper-left corner of outputShape. In other words, the absolute values of outputShape are ignored, only the side length matters.

NOTE: if selection has lower rank than this range, the selection range is extruded to match this range's higher-dimensional shape.

Behavior is undefined if inputShape is smaller than selection.

Parameters
selectionhyper-rectangular range in this array to copy from.
outputShapeshape range representing the in array extents. Must be equal or larger than selection
bufoutdesitination data elements with contiguous arrangement.

◆ numBytesPerElement()

template<int MAJOR_ORDER_TYPE>
int WmTypeOpaqueArray< MAJOR_ORDER_TYPE >::numBytesPerElement ( ) const
inline

◆ operator=()

template<int MAJOR_ORDER_TYPE>
WmTypeOpaqueArray< MAJOR_ORDER_TYPE > & WmTypeOpaqueArray< MAJOR_ORDER_TYPE >::operator= ( const WmTypeOpaqueArray< MAJOR_ORDER_TYPE > &  that)
inline

◆ put()

template<int MAJOR_ORDER_TYPE>
void WmTypeOpaqueArray< MAJOR_ORDER_TYPE >::put ( const WxRange selection,
const WxRange inputShape,
const void *  bufin 
)

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.

NOTE: if selection has lower rank than this range, the selection range is extruded to match this range's higher-dimensional shape.

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.

NOTE: if selection has lower rank than this range, the selection range is extruded to match this range's higher-dimensional shape.

Parameters
hyper-rectangularrange in this array to copy from.
desitinationdata elements with contiguous arrangement. Copy data elements from bufin to the region described by the range selection.

Source buffer elements are assumed to be arranged according to inputShape such that the first element in bufin corresponds to the upper-left corner of inputShape. In other words, the absolute values of inputShape are ignored, only the side length matters. Behavior is undefined if inputShape is smaller than selection.

NOTE: if selection has lower rank than this range, the selection range is extruded to match this range's higher-dimensional shape.

Parameters
selectionhyper-rectangular range in this array to copy into.
inputShapeshape range representing the desired output array extent. Must be equal or larger than selection
bufinsource data elements with contiguous arrangement.

◆ resetArrayProperties()

template<int MAJOR_ORDER_TYPE>
void WmTypeOpaqueArray< MAJOR_ORDER_TYPE >::resetArrayProperties ( const WxRange range,
void *  data,
int  numBytesPerElement 
)
inlineprotected

Reset the properties of this array.

protected so only responsible derived class can change geometry


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