//----------------------------------------------------------------------------
-template<typename TValueType>
+template<typename TValueType>
void
Module2Scalars(vtkDataArray *theInputDataArray,
- TValueType* theOutputPtr,
- vtkIdType theNbOfTuples,
- VISU::TGaussMetric theGaussMetric)
+ TValueType* theOutputPtr,
+ vtkIdType theNbOfTuples)
+{
+ vtkIdType aNbComp = theInputDataArray->GetNumberOfComponents();
+ std::vector<vtkFloatingPointType> anArray(aNbComp < 3? 3: aNbComp);
+ for(vtkIdType aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++){
+ theInputDataArray->GetTuple(aTupleId, &anArray[0]);
+ vtkFloatingPointType aVector[3] = {anArray[0], anArray[1], anArray[2]};
+ vtkFloatingPointType aScalar = sqrt(aVector[0]*aVector[0] +
+ aVector[1]*aVector[1] +
+ aVector[2]*aVector[2]);
+ *theOutputPtr = TValueType(aScalar);
+ theOutputPtr++;
+ }
+}
+
+template<typename TValueType>
+void
+Module2ScalarsMOD(vtkDataArray *theInputDataArray,
+ TValueType* theOutputPtr,
+ vtkIdType theNbOfTuples,
+ VISU::TGaussMetric theGaussMetric)
{
vtkIdType aNbComp = theInputDataArray->GetNumberOfComponents();
if (aNbComp != 3) // Min, Max, Avg
void *anOutputPtr = anOutputScalars->GetVoidPointer(0);
if (theScalarMode == 0) {
- aFieldArray = theInputData->GetArray("VISU_FIELD_GAUSS_MOD");
- if (!aFieldArray)
- return;
- switch (anInputDataType) {
- vtkTemplateMacro4(Module2Scalars,
- aFieldArray,
- (VTK_TT *)(anOutputPtr),
- theNbOfTuples,
- theGaussMetric);
- default:
- break;
+ vtkDataArray* aFieldArrayMOD = theInputData->GetArray("VISU_FIELD_GAUSS_MOD");
+ if (aFieldArrayMOD) {
+ switch (anInputDataType) {
+ vtkTemplateMacro4(Module2ScalarsMOD,
+ aFieldArrayMOD,
+ (VTK_TT *)(anOutputPtr),
+ theNbOfTuples,
+ theGaussMetric);
+ default:
+ break;
+ }
+ }
+ else {
+ switch (anInputDataType) {
+ vtkTemplateMacro3(Module2Scalars,
+ aFieldArray,
+ (VTK_TT *)(anOutputPtr),
+ theNbOfTuples);
+ default:
+ break;
+ }
}
} else {
switch (anInputDataType) {