Commit dec2384c authored by Andy Cedilnik's avatar Andy Cedilnik
Browse files

ENH: Add unsigned types support and int16 support

parent 70999e3e
......@@ -42,7 +42,11 @@ SET(ICE_PTR "void *")
SET(ICE_CHAR_VALID 1)
SET(ICE_CHAR "char")
SET(ICE_8_INT_VALID 1)
SET(ICE_8_INT "unsigned char")
SET(ICE_8_INT "char")
SET(ICE_8_U_INT "unsigned char")
SET(ICE_16_INT_VALID 1)
SET(ICE_16_INT "short")
SET(ICE_16_U_INT "unsigned short")
# These should be Valid
IF(${ICE_SIZEOF_FLOAT} MATCHES 4)
SET(ICE_32_FLOAT_VALID 1)
......
......@@ -51,6 +51,15 @@
#error ICE_8_INT not defined
#endif
#define ICE_8_INT @ICE_8_INT@
#define ICE_8_U_INT @ICE_8_U_INT@
#cmakedefine ICE_16_INT_VALID
#ifndef ICE_16_INT_VALID
/* Force an Error */
#error ICE_16_INT not defined
#endif
#define ICE_16_INT @ICE_16_INT@
#define ICE_16_U_INT @ICE_16_U_INT@
#cmakedefine ICE_32_INT_VALID
#ifndef ICE_32_INT_VALID
......
......@@ -499,6 +499,57 @@ delete [] ValueArray;
return( XDMF_SUCCESS );
}
XdmfInt32 XdmfArray::SetValues( XdmfInt64 Index, XdmfUInt8 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride,
XdmfInt64 ValuesStride ) {
XdmfPointer ArrayPointer;
ArrayPointer = this->GetDataPointer(Index);
if( ArrayPointer == NULL ){
this->SetNumberOfElements( NumberOfValues + Index );
ArrayPointer = this->GetDataPointer(Index);
}
XDMF_ARRAY_COPY( ArrayPointer, this->GetNumberType(), ArrayStride,
Values, XDMF_UINT8_TYPE, ValuesStride,
XDMF_ARRAY_IN, NumberOfValues );
return( XDMF_SUCCESS );
}
XdmfInt32 XdmfArray::SetValues( XdmfInt64 Index, XdmfUInt16 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride,
XdmfInt64 ValuesStride ) {
XdmfPointer ArrayPointer;
ArrayPointer = this->GetDataPointer(Index);
if( ArrayPointer == NULL ){
this->SetNumberOfElements( NumberOfValues + Index );
ArrayPointer = this->GetDataPointer(Index);
}
XDMF_ARRAY_COPY( ArrayPointer, this->GetNumberType(), ArrayStride,
Values, XDMF_UINT16_TYPE, ValuesStride,
XDMF_ARRAY_IN, NumberOfValues );
return( XDMF_SUCCESS );
}
XdmfInt32 XdmfArray::SetValues( XdmfInt64 Index, XdmfUInt32 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride,
XdmfInt64 ValuesStride ) {
XdmfPointer ArrayPointer;
ArrayPointer = this->GetDataPointer(Index);
if( ArrayPointer == NULL ){
this->SetNumberOfElements( NumberOfValues + Index );
ArrayPointer = this->GetDataPointer(Index);
}
XDMF_ARRAY_COPY( ArrayPointer, this->GetNumberType(), ArrayStride,
Values, XDMF_UINT32_TYPE, ValuesStride,
XDMF_ARRAY_IN, NumberOfValues );
return( XDMF_SUCCESS );
}
XdmfInt32 XdmfArray::SetValues( XdmfInt64 Index, XdmfInt8 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride,
......@@ -516,6 +567,23 @@ XDMF_ARRAY_COPY( ArrayPointer, this->GetNumberType(), ArrayStride,
return( XDMF_SUCCESS );
}
XdmfInt32 XdmfArray::SetValues( XdmfInt64 Index, XdmfInt16 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride,
XdmfInt64 ValuesStride ) {
XdmfPointer ArrayPointer;
ArrayPointer = this->GetDataPointer(Index);
if( ArrayPointer == NULL ){
this->SetNumberOfElements( NumberOfValues + Index );
ArrayPointer = this->GetDataPointer(Index);
}
XDMF_ARRAY_COPY( ArrayPointer, this->GetNumberType(), ArrayStride,
Values, XDMF_INT16_TYPE, ValuesStride,
XDMF_ARRAY_IN, NumberOfValues );
return( XDMF_SUCCESS );
}
XdmfInt32 XdmfArray::SetValues( XdmfInt64 Index, XdmfInt32 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride,
......@@ -646,6 +714,45 @@ return( Value );
}
XdmfInt32 XdmfArray::GetValues( XdmfInt64 Index, XdmfUInt8 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride,
XdmfInt64 ValuesStride ) {
XdmfPointer ArrayPointer;
ArrayPointer = this->GetDataPointer(Index);
XDMF_ARRAY_COPY( ArrayPointer, this->GetNumberType(), ArrayStride,
Values, XDMF_UINT8_TYPE, ValuesStride,
XDMF_ARRAY_OUT, NumberOfValues );
return( XDMF_SUCCESS );
}
XdmfInt32 XdmfArray::GetValues( XdmfInt64 Index, XdmfUInt16 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride,
XdmfInt64 ValuesStride ) {
XdmfPointer ArrayPointer;
ArrayPointer = this->GetDataPointer(Index);
XDMF_ARRAY_COPY( ArrayPointer, this->GetNumberType(), ArrayStride,
Values, XDMF_UINT16_TYPE, ValuesStride,
XDMF_ARRAY_OUT, NumberOfValues );
return( XDMF_SUCCESS );
}
XdmfInt32 XdmfArray::GetValues( XdmfInt64 Index, XdmfUInt32 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride,
XdmfInt64 ValuesStride ) {
XdmfPointer ArrayPointer;
ArrayPointer = this->GetDataPointer(Index);
XDMF_ARRAY_COPY( ArrayPointer, this->GetNumberType(), ArrayStride,
Values, XDMF_UINT32_TYPE, ValuesStride,
XDMF_ARRAY_OUT, NumberOfValues );
return( XDMF_SUCCESS );
}
XdmfInt32 XdmfArray::GetValues( XdmfInt64 Index, XdmfInt8 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride,
......@@ -659,6 +766,19 @@ XDMF_ARRAY_COPY( ArrayPointer, this->GetNumberType(), ArrayStride,
return( XDMF_SUCCESS );
}
XdmfInt32 XdmfArray::GetValues( XdmfInt64 Index, XdmfInt16 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride,
XdmfInt64 ValuesStride ) {
XdmfPointer ArrayPointer;
ArrayPointer = this->GetDataPointer(Index);
XDMF_ARRAY_COPY( ArrayPointer, this->GetNumberType(), ArrayStride,
Values, XDMF_INT16_TYPE, ValuesStride,
XDMF_ARRAY_OUT, NumberOfValues );
return( XDMF_SUCCESS );
}
XdmfInt32 XdmfArray::GetValues( XdmfInt64 Index, XdmfInt32 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride,
......@@ -821,7 +941,7 @@ Length = MIN( this->GetNumberOfElements(), Array.GetNumberOfElements() );
Vp = Values = new XdmfFloat64[ Length + 10 ];
Array.GetValues( 0, Values, Length );
ArrayPointer = this->GetDataPointer();
XDMF_ARRAY_OPERATE( +=, ArrayPointer, this->GetNumberType(), 1,
XDMF_ARRAY_OPERATE( XdmfArrayAddTag, ArrayPointer, this->GetNumberType(), 1,
Vp, XDMF_FLOAT64_TYPE, 1,
XDMF_ARRAY_IN, Length );
delete [] Values;
......@@ -834,7 +954,7 @@ XdmfPointer ArrayPointer;
XdmfFloat64 *Vp = &Value;
ArrayPointer = this->GetDataPointer();
XDMF_ARRAY_OPERATE( +=, ArrayPointer, this->GetNumberType(), 1,
XDMF_ARRAY_OPERATE( XdmfArrayAddTag, ArrayPointer, this->GetNumberType(), 1,
Vp, XDMF_FLOAT64_TYPE, 0,
XDMF_ARRAY_IN, this->GetNumberOfElements());
return( *this );
......@@ -850,7 +970,7 @@ Length = MIN( this->GetNumberOfElements(), Array.GetNumberOfElements() );
Vp = Values = new XdmfFloat64[ Length + 10 ];
Array.GetValues( 0, Values, Length );
ArrayPointer = this->GetDataPointer();
XDMF_ARRAY_OPERATE( -=, ArrayPointer, this->GetNumberType(), 1,
XDMF_ARRAY_OPERATE( XdmfArraySubtractTag, ArrayPointer, this->GetNumberType(), 1,
Vp, XDMF_FLOAT64_TYPE, 1,
XDMF_ARRAY_IN, Length );
delete [] Values;
......@@ -863,7 +983,7 @@ XdmfPointer ArrayPointer;
XdmfFloat64 *Vp = &Value;
ArrayPointer = this->GetDataPointer();
XDMF_ARRAY_OPERATE( -=, ArrayPointer, this->GetNumberType(), 1,
XDMF_ARRAY_OPERATE( XdmfArraySubtractTag, ArrayPointer, this->GetNumberType(), 1,
Vp, XDMF_FLOAT64_TYPE, 0,
XDMF_ARRAY_IN, this->GetNumberOfElements());
return( *this );
......@@ -879,7 +999,7 @@ Length = MIN( this->GetNumberOfElements(), Array.GetNumberOfElements() );
Vp = Values = new XdmfFloat64[ Length + 10 ];
Array.GetValues( 0, Values, Length );
ArrayPointer = this->GetDataPointer();
XDMF_ARRAY_OPERATE( *=, ArrayPointer, this->GetNumberType(), 1,
XDMF_ARRAY_OPERATE( XdmfArrayMultiplyTag, ArrayPointer, this->GetNumberType(), 1,
Vp, XDMF_FLOAT64_TYPE, 1,
XDMF_ARRAY_IN, Length );
delete [] Values;
......@@ -892,7 +1012,7 @@ XdmfPointer ArrayPointer;
XdmfFloat64 *Vp = &Value;
ArrayPointer = this->GetDataPointer();
XDMF_ARRAY_OPERATE( *=, ArrayPointer, this->GetNumberType(), 1,
XDMF_ARRAY_OPERATE( XdmfArrayMultiplyTag, ArrayPointer, this->GetNumberType(), 1,
Vp, XDMF_FLOAT64_TYPE, 0,
XDMF_ARRAY_IN, this->GetNumberOfElements());
return( *this );
......@@ -908,7 +1028,7 @@ Length = MIN( this->GetNumberOfElements(), Array.GetNumberOfElements() );
Vp = Values = new XdmfFloat64[ Length + 10 ];
Array.GetValues( 0, Values, Length );
ArrayPointer = this->GetDataPointer();
XDMF_ARRAY_OPERATE( /=, ArrayPointer, this->GetNumberType(), 1,
XDMF_ARRAY_OPERATE( XdmfArrayDivideTag, ArrayPointer, this->GetNumberType(), 1,
Vp, XDMF_FLOAT64_TYPE, 1,
XDMF_ARRAY_IN, Length );
delete [] Values;
......@@ -921,7 +1041,7 @@ XdmfPointer ArrayPointer;
XdmfFloat64 *Vp = &Value;
ArrayPointer = this->GetDataPointer();
XDMF_ARRAY_OPERATE( /=, ArrayPointer, this->GetNumberType(), 1,
XDMF_ARRAY_OPERATE( XdmfArrayDivideTag, ArrayPointer, this->GetNumberType(), 1,
Vp, XDMF_FLOAT64_TYPE, 0,
XDMF_ARRAY_IN, this->GetNumberOfElements());
return( *this );
......@@ -1056,9 +1176,21 @@ XdmfArray::GetMaxAsInt64( void ) {
return( static_cast<XdmfInt64>(this->GetMaxAsFloat64()) );
}
XdmfInt32 XdmfArray::SetValue( XdmfInt64 Index, XdmfUInt8 Value ) {
return(this->SetValueFromInt64( Index, Value ));
}
XdmfInt32 XdmfArray::SetValue( XdmfInt64 Index, XdmfUInt16 Value ) {
return(this->SetValueFromInt64( Index, Value ));
}
XdmfInt32 XdmfArray::SetValue( XdmfInt64 Index, XdmfUInt32 Value ) {
return(this->SetValueFromInt64( Index, Value ));
}
XdmfInt32 XdmfArray::SetValue( XdmfInt64 Index, XdmfInt8 Value ) {
return(this->SetValueFromInt64( Index, Value ));
}
XdmfInt32 XdmfArray::SetValue( XdmfInt64 Index, XdmfInt16 Value ) {
return(this->SetValueFromInt64( Index, Value ));
}
XdmfInt32 XdmfArray::SetValue( XdmfInt64 Index, XdmfInt32 Value ) {
return(this->SetValueFromInt64( Index, Value ));
}
......
......@@ -101,15 +101,35 @@ public:
#ifndef SWIG
/*! The Following Methods are NOT directly available via SWIG
*/
XdmfInt32 SetValue( XdmfInt64 Index, XdmfUInt8 Value );
XdmfInt32 SetValue( XdmfInt64 Index, XdmfUInt16 Value );
XdmfInt32 SetValue( XdmfInt64 Index, XdmfUInt32 Value );
XdmfInt32 SetValue( XdmfInt64 Index, XdmfInt8 Value );
XdmfInt32 SetValue( XdmfInt64 Index, XdmfInt16 Value );
XdmfInt32 SetValue( XdmfInt64 Index, XdmfInt32 Value );
XdmfInt32 SetValue( XdmfInt64 Index, XdmfInt64 Value );
XdmfInt32 SetValue( XdmfInt64 Index, XdmfFloat32 Value );
XdmfInt32 SetValue( XdmfInt64 Index, XdmfFloat64 Value );
XdmfInt32 SetValues( XdmfInt64 Index, XdmfUInt8 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride = 1,
XdmfInt64 ValuesStride = 1 );
XdmfInt32 SetValues( XdmfInt64 Index, XdmfUInt16 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride = 1,
XdmfInt64 ValuesStride = 1 );
XdmfInt32 SetValues( XdmfInt64 Index, XdmfUInt32 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride = 1,
XdmfInt64 ValuesStride = 1 );
XdmfInt32 SetValues( XdmfInt64 Index, XdmfInt8 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride = 1,
XdmfInt64 ValuesStride = 1 );
XdmfInt32 SetValues( XdmfInt64 Index, XdmfInt16 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride = 1,
XdmfInt64 ValuesStride = 1 );
XdmfInt32 SetValues( XdmfInt64 Index, XdmfInt32 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride = 1,
......@@ -127,11 +147,31 @@ public:
XdmfInt64 ArrayStride = 1,
XdmfInt64 ValuesStride = 1 );
XdmfInt32 GetValues( XdmfInt64 Index, XdmfUInt8 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride = 1,
XdmfInt64 ValuesStride = 1 );
XdmfInt32 GetValues( XdmfInt64 Index, XdmfUInt16 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride = 1,
XdmfInt64 ValuesStride = 1 );
XdmfInt32 GetValues( XdmfInt64 Index, XdmfUInt32 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride = 1,
XdmfInt64 ValuesStride = 1 );
XdmfInt32 GetValues( XdmfInt64 Index, XdmfInt8 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride = 1,
XdmfInt64 ValuesStride = 1 );
XdmfInt32 GetValues( XdmfInt64 Index, XdmfInt16 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride = 1,
XdmfInt64 ValuesStride = 1 );
XdmfInt32 GetValues( XdmfInt64 Index, XdmfInt32 *Values,
XdmfInt64 NumberOfValues,
XdmfInt64 ArrayStride = 1,
......@@ -290,6 +330,7 @@ public:
XdmfFloat32 GetValueAsFloat32( XdmfInt64 Index );
XdmfInt64 GetValueAsInt64( XdmfInt64 Index );
XdmfInt32 GetValueAsInt32( XdmfInt64 Index );
XdmfInt16 GetValueAsInt16( XdmfInt64 Index );
XdmfInt8 GetValueAsInt8( XdmfInt64 Index );
XdmfString GetValues( XdmfInt64 Index = 0,
XdmfInt64 NumberOfValues = 0,
......
......@@ -25,117 +25,63 @@
#define XDMF_ARRAY_IN 0
#define XDMF_ARRAY_OUT 1
#define XDMF_ARRAY_COPY(ArrayPointer, ArrayType, ArrayStride, ValuePointer, ValueType, ValueStride, Direction, NumberOfValues ) \
template<class ArrayType, class ValueType>
void XdmfArrayCopy(
ArrayType* ArrayPointer, XdmfInt64 ArrayStride,
ValueType* ValuePointer, XdmfInt64 ValueStride,
XdmfInt32 Direction, XdmfInt64 NumberOfValues)
{
XdmfInt64 i;
ArrayType *ap;
i = NumberOfValues;
ap = ArrayPointer;
if( Direction == XDMF_ARRAY_IN ) {
while(i--){
*ap = (ArrayType)*ValuePointer;
ap += ArrayStride;
ValuePointer += ValueStride;
}
} else {
while(i--){
*ValuePointer = (ValueType)*ap;
ap += ArrayStride;
ValuePointer += ValueStride;
}
}
}
#define XDMF_ARRAY_COPY(\
ArrayPointer, ArrayType, ArrayStride, \
ValuePointer, ValueType, ValueStride, Direction, NumberOfValues ) \
switch(ArrayType) { \
case XDMF_UINT8_TYPE : \
XdmfArrayCopy((XdmfUInt8*)ArrayPointer, ArrayStride, ValuePointer, ValueStride, Direction, NumberOfValues); \
break; \
case XDMF_UINT16_TYPE : \
XdmfArrayCopy((XdmfUInt16*)ArrayPointer, ArrayStride, ValuePointer, ValueStride, Direction, NumberOfValues); \
break; \
case XDMF_UINT32_TYPE : \
XdmfArrayCopy((XdmfUInt32*)ArrayPointer, ArrayStride, ValuePointer, ValueStride, Direction, NumberOfValues); \
break; \
case XDMF_INT8_TYPE : \
{ \
XdmfInt64 i; \
XdmfInt8 *ap; \
\
i = NumberOfValues; \
ap = (XdmfInt8 *)ArrayPointer; \
if( Direction == XDMF_ARRAY_IN ) { \
while(i--){ \
*ap = *ValuePointer; \
ap += ArrayStride; \
ValuePointer += ValueStride; \
} \
} else { \
while(i--){ \
*ValuePointer = *ap; \
ap += ArrayStride; \
ValuePointer += ValueStride; \
} \
} \
} \
XdmfArrayCopy((XdmfInt8*)ArrayPointer, ArrayStride, ValuePointer, ValueStride, Direction, NumberOfValues); \
break; \
case XDMF_INT16_TYPE : \
XdmfArrayCopy((XdmfInt16*)ArrayPointer, ArrayStride, ValuePointer, ValueStride, Direction, NumberOfValues); \
break; \
case XDMF_INT32_TYPE : \
{ \
XdmfInt64 i; \
XdmfInt32 *ap; \
\
i = NumberOfValues; \
ap = (XdmfInt32 *)ArrayPointer; \
if( Direction == XDMF_ARRAY_IN ) { \
while(i--){ \
*ap = *ValuePointer; \
ap += ArrayStride; \
ValuePointer += ValueStride; \
} \
} else { \
while(i--){ \
*ValuePointer = *ap; \
ap += ArrayStride; \
ValuePointer += ValueStride; \
} \
} \
} \
XdmfArrayCopy((XdmfInt32*)ArrayPointer, ArrayStride, ValuePointer, ValueStride, Direction, NumberOfValues); \
break; \
case XDMF_INT64_TYPE : \
{ \
XdmfInt64 i; \
XdmfInt64 *ap; \
\
i = NumberOfValues; \
ap = (XdmfInt64 *)ArrayPointer; \
if( Direction == XDMF_ARRAY_IN ) { \
while(i--){ \
*ap = *ValuePointer; \
ap += ArrayStride; \
ValuePointer += ValueStride; \
} \
} else { \
while(i--){ \
*ValuePointer = *ap; \
ap += ArrayStride; \
ValuePointer += ValueStride; \
} \
} \
} \
XdmfArrayCopy((XdmfInt64*)ArrayPointer, ArrayStride, ValuePointer, ValueStride, Direction, NumberOfValues); \
break; \
case XDMF_FLOAT32_TYPE : \
{ \
XdmfInt64 i; \
XdmfFloat32 *ap; \
\
i = NumberOfValues; \
ap = (XdmfFloat32 *)ArrayPointer; \
if( Direction == XDMF_ARRAY_IN ) { \
while(i--){ \
*ap = *ValuePointer; \
ap += ArrayStride; \
ValuePointer += ValueStride; \
} \
} else { \
while(i--){ \
*ValuePointer = *ap; \
ap += ArrayStride; \
ValuePointer += ValueStride; \
} \
} \
} \
XdmfArrayCopy((XdmfFloat32*)ArrayPointer, ArrayStride, ValuePointer, ValueStride, Direction, NumberOfValues); \
break; \
case XDMF_FLOAT64_TYPE : \
{ \
XdmfInt64 i; \
XdmfFloat64 *ap; \
\
i = NumberOfValues; \
ap = (XdmfFloat64 *)ArrayPointer; \
if( Direction == XDMF_ARRAY_IN ) { \
while(i--){ \
*ap = *ValuePointer; \
ap += ArrayStride; \
ValuePointer += ValueStride; \
} \
} else { \
while(i--){ \
*ValuePointer = *ap; \
ap += ArrayStride; \
ValuePointer += ValueStride; \
} \
} \
} \
XdmfArrayCopy((XdmfFloat64*)ArrayPointer, ArrayStride, ValuePointer, ValueStride, Direction, NumberOfValues); \
break; \
default : \
this->CopyCompound(ArrayPointer, ArrayType, ArrayStride, \
......@@ -144,118 +90,81 @@
break; \
}
class XdmfArrayAddTag{};
template<class Val1, class Val2>
void XdmfArrayOperator(Val1& v1, const Val2& v2, XdmfArrayAddTag*)
{ v1 += (Val1)v2; }
class XdmfArraySubtractTag{};
template<class Val1, class Val2>
void XdmfArrayOperator(Val1& v1, const Val2& v2, XdmfArraySubtractTag*)
{ v1 -= (Val1)v2; }
class XdmfArrayMultiplyTag{};
template<class Val1, class Val2>
void XdmfArrayOperator(Val1& v1, const Val2& v2, XdmfArrayMultiplyTag*)
{ v1 *= (Val1)v2; }
class XdmfArrayDivideTag{};
template<class Val1, class Val2>
void XdmfArrayOperator(Val1& v1, const Val2& v2, XdmfArrayDivideTag*)
{ v1 /= (Val1)v2; }
template<class ArrayType, class ValueType, class OperatorTag>
void XdmfArrayOperate(
ArrayType* ArrayPointer, XdmfInt64 ArrayStride,
ValueType* ValuePointer, XdmfInt64 ValueStride,
XdmfInt32 Direction, XdmfInt64 NumberOfValues, OperatorTag*)
{
XdmfInt64 i;
ArrayType *ap;
i = NumberOfValues;
ap = ArrayPointer;
if( Direction == XDMF_ARRAY_IN ) {
while(i--){
XdmfArrayOperator(*ap, *ValuePointer, (OperatorTag*)0);
ap += ArrayStride;
ValuePointer += ValueStride;
}
} else {
while(i--){
XdmfArrayOperator(*ValuePointer, *ap, (OperatorTag*)0);
ap += ArrayStride;
ValuePointer += ValueStride;
}
}
}
#define XDMF_ARRAY_OPERATE(OPERATOR, ArrayPointer, ArrayType, ArrayStride, ValuePointer, ValueType, ValueStride, Direction, NumberOfValues ) \
switch(ArrayType) { \
case XDMF_UINT8_TYPE : \
XdmfArrayOperate((XdmfUInt8*)ArrayPointer, ArrayStride, ValuePointer, ValueStride, Direction, NumberOfValues, (OPERATOR*)0); \
break; \
case XDMF_UINT16_TYPE : \
XdmfArrayOperate((XdmfUInt16*)ArrayPointer, ArrayStride, ValuePointer, ValueStride, Direction, NumberOfValues, (OPERATOR*)0); \
break; \
case XDMF_UINT32_TYPE : \
XdmfArrayOperate((XdmfUInt32*)ArrayPointer, ArrayStride, ValuePointer, ValueStride, Direction, NumberOfValues, (OPERATOR*)0); \
break; \
case XDMF_INT8_TYPE : \
{ \
XdmfInt64 i; \
XdmfInt8 *ap; \
\
i = NumberOfValues; \
ap = (XdmfInt8 *)ArrayPointer; \
if( Direction == XDMF_ARRAY_IN ) { \
while(i--){ \
*ap OPERATOR *ValuePointer; \
ap += ArrayStride; \
ValuePointer += ValueStride; \
} \
} else { \
while(i--){ \
*ValuePointer OPERATOR *ap; \
ap += ArrayStride; \
ValuePointer += ValueStride; \
} \
} \
} \
XdmfArrayOperate((XdmfInt8*)ArrayPointer, ArrayStride, ValuePointer, ValueStride, Direction, NumberOfValues, (OPERATOR*)0); \
break; \
case XDMF_INT16_TYPE : \
XdmfArrayOperate((XdmfInt16*)ArrayPointer, ArrayStride, ValuePointer, ValueStride, Direction, NumberOfValues, (OPERATOR*)0); \
break; \
case XDMF_INT32_TYPE : \
{ \
XdmfInt64 i; \
XdmfInt32 *ap; \
\
i = NumberOfValues; \
ap = (XdmfInt32 *)ArrayPointer; \
if( Direction == XDMF_ARRAY_IN ) { \
while(i--){ \
*ap OPERATOR *ValuePointer; \
ap += ArrayStride; \
ValuePointer += ValueStride; \
} \
} else { \
while(i--){ \
*ValuePointer OPERATOR *ap; \
ap += ArrayStride; \
ValuePointer += ValueStride; \
} \
} \
} \
XdmfArrayOperate((XdmfInt32*)ArrayPointer, ArrayStride, ValuePointer, ValueStride, Direction, NumberOfValues, (OPERATOR*)0); \
break; \
case XDMF_INT64_TYPE : \
{ \
XdmfInt64 i; \
XdmfInt64 *ap; \
\
i = NumberOfValues; \
ap = (XdmfInt64 *)ArrayPointer; \
if( Direction == XDMF_ARRAY_IN ) { \
while(i--){ \
*ap OPERATOR *ValuePointer; \
ap += ArrayStride; \
ValuePointer += ValueStride; \