Overture  Version 25
Classes | Macros
TrivialArray.h File Reference
#include <assert.h>
Include dependency graph for TrivialArray.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  TrivialArray< Type, Dim >
 

Macros

#define DIM_ARGUMENTS
 
#define DIM_ARGS   dim0, dim1, dim2, dim3, dim4, dim5, dim6, dim7, dim8, dim9
 
#define X_DIM_ARGS
 
#define DIM_DECLARATIONS
 
#define TrivialArray_constructor
 
#define TrivialArray_reshape
 
#define TrivialArray_redim
 
#define TrivialArray_resize
 

Macro Definition Documentation

#define DIM_ARGS   dim0, dim1, dim2, dim3, dim4, dim5, dim6, dim7, dim8, dim9
#define DIM_ARGUMENTS
Value:
const Dim& dim0 = 0, const Dim& dim1 = 0, \
const Dim& dim2 = 0, const Dim& dim3 = 0, \
const Dim& dim4 = 0, const Dim& dim5 = 0, \
const Dim& dim6 = 0, const Dim& dim7 = 0, \
const Dim& dim8 = 0, const Dim& dim9 = 0
#define DIM_DECLARATIONS
Value:
Dim dim[MAXDIM]; \
dim[0] = dim0; dim[1] = dim1; dim[2] = dim2; \
dim[3] = dim3; dim[4] = dim4; dim[5] = dim5; \
dim[6] = dim6; dim[7] = dim7; dim[8] = dim8; \
dim[9] = dim9
#define TrivialArray_constructor
Value:
numberOfElements = numberOfDimensions = 0; \
dataPointer = basePointer = 0; \
for (int i=0; i<MAXDIM; i++) \
{ dimension[i] = Dim(0); stride[i] = 1; }

Referenced by TrivialArray< BoundaryAdjustmentArray, Range >::TrivialArray().

#define TrivialArray_redim
Value:
int numberOfElements_, numberOfDimensions_, dimsChanged, i; \
for (numberOfElements_ = numberOfDimensions_ = dimsChanged = 0; \
numberOfDimensions_ < MAXDIM && !(dim[numberOfDimensions_] == Dim(0)); \
numberOfDimensions_++) { \
if (numberOfDimensions_) \
numberOfElements_ *= dim[numberOfDimensions_].getCount(); \
else numberOfElements_ = dim[numberOfDimensions_].getCount(); \
dimsChanged = dimsChanged || \
numberOfDimensions_ >= numberOfDimensions || \
!(dim[numberOfDimensions_] == dimension[numberOfDimensions_]); \
} \
dimsChanged = dimsChanged || numberOfDimensions_ != numberOfDimensions; \
if (numberOfElements != numberOfElements_) { \
assert(dimsChanged); \
if (dataPointer) delete [] dataPointer; \
dataPointer = (numberOfElements = numberOfElements_) ? \
new Type[numberOfElements] : 0; \
} \
if (dimsChanged) { \
numberOfDimensions = numberOfDimensions_; \
basePointer = dataPointer; \
for (i=0; i<numberOfDimensions; i++) { \
dimension[i] = dim[i]; \
stride[i] = i ? stride[i-1] * dimension[i-1].getCount() : 1; \
basePointer -= stride[i] * dimension[i].getBase(); \
} \
for (i=numberOfDimensions; i<MAXDIM; i++) \
{ dimension[i] = Dim(0); stride[i] = i ? stride[i-1] : 1; } \
} \
return dimsChanged

Referenced by TrivialArray< BoundaryAdjustmentArray, Range >::redim().

#define TrivialArray_reshape
Value:
int numberOfElements_, numberOfDimensions_, dimsChanged, i; \
for (numberOfElements_ = numberOfDimensions_ = dimsChanged = 0; \
numberOfDimensions_ < MAXDIM && !(dim[numberOfDimensions_] == Dim(0)); \
numberOfDimensions_++) \
if (numberOfDimensions_) \
numberOfElements_ *= dim[numberOfDimensions_].getCount(); \
else numberOfElements_ = dim[numberOfDimensions_].getCount(); \
assert(numberOfElements_ == numberOfElements); \
dimsChanged = numberOfDimensions_ != numberOfDimensions; \
numberOfDimensions = numberOfDimensions_; \
basePointer = dataPointer; \
for (i=0; i<numberOfDimensions; i++) { \
dimsChanged = dimsChanged || !(dim[i] == dimension[i]); \
dimension[i] = dim[i]; \
stride[i] = i ? stride[i-1] * dimension[i-1].getCount() : 1; \
basePointer -= stride[i] * dimension[i].getBase(); \
} \
for (i=numberOfDimensions; i<MAXDIM; i++) { \
dimension[i] = Dim(0); \
stride[i] = i ? stride[i-1] : 1; \
} \
return dimsChanged

Referenced by TrivialArray< BoundaryAdjustmentArray, Range >::reshape().

#define TrivialArray_resize
#define X_DIM_ARGS
Value:
x.dimension[0], x.dimension[1], x.dimension[2], \
x.dimension[3], x.dimension[4], x.dimension[5], \
x.dimension[6], x.dimension[7], x.dimension[8], \
x.dimension[9]

Referenced by TrivialArray< BoundaryAdjustmentArray, Range >::redim(), TrivialArray< BoundaryAdjustmentArray, Range >::reshape(), and TrivialArray< BoundaryAdjustmentArray, Range >::resize().