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; \
} \
numberOfDimensions = numberOfDimensions_; \
basePointer = dataPointer; \
for (i=0; i<numberOfDimensions; 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