From c339fd419ee21329393e8ee4da73a6924986128c Mon Sep 17 00:00:00 2001 From: apo Date: Tue, 4 Oct 2005 11:34:56 +0000 Subject: [PATCH] To use "VISU_FIELD" array instead of vtkVectors --- src/PIPELINE/VISU_Extractor.cxx | 44 ++++++++++++++++----------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/src/PIPELINE/VISU_Extractor.cxx b/src/PIPELINE/VISU_Extractor.cxx index 90511302..74cef5a8 100644 --- a/src/PIPELINE/VISU_Extractor.cxx +++ b/src/PIPELINE/VISU_Extractor.cxx @@ -64,31 +64,29 @@ execute(int theNbElems, return; vtkDataArray* aVectors = theInputData->GetVectors(); vtkDataArray* aFieldArray = theInputData->GetArray("VISU_FIELD"); - if(vtkDataArray* aDataArray = aVectors){ - if(vtkFloatArray *aFloatArray = dynamic_cast(aDataArray)){ - int aNbComp = aFloatArray->GetNumberOfComponents(); - std::vector anArray(aNbComp); - // - vtkFloatArray *aScalars = vtkFloatArray::New(); - aScalars->SetNumberOfTuples(theNbElems); - aScalars->SetNumberOfComponents(1); - // - if(!theScalarMode){ - for(int anId = 0; anId < theNbElems; anId++){ - aFloatArray->GetTuple(anId,&anArray[0]); - float aVector[3] = {anArray[0], anArray[1], anArray[2]}; - float aScalar = sqrt(aVector[0]*aVector[0] + aVector[1]*aVector[1] + aVector[2]*aVector[2]); - aScalars->SetTuple1(anId,aScalar); - } - }else{ - for(int anId = 0; anId < theNbElems; anId++){ - aFloatArray->GetTuple(anId,&anArray[0]); - aScalars->SetTuple1(anId,anArray[theScalarMode - 1]); - } + if(vtkFloatArray *aFloatArray = dynamic_cast(aFieldArray)){ + int aNbComp = aFloatArray->GetNumberOfComponents(); + std::vector anArray(aNbComp); + // + vtkFloatArray *aScalars = vtkFloatArray::New(); + aScalars->SetNumberOfTuples(theNbElems); + aScalars->SetNumberOfComponents(1); + // + if(!theScalarMode){ + for(int anId = 0; anId < theNbElems; anId++){ + aFloatArray->GetTuple(anId,&anArray[0]); + float aVector[3] = {anArray[0], anArray[1], anArray[2]}; + float aScalar = sqrt(aVector[0]*aVector[0] + aVector[1]*aVector[1] + aVector[2]*aVector[2]); + aScalars->SetTuple1(anId,aScalar); + } + }else{ + for(int anId = 0; anId < theNbElems; anId++){ + aFloatArray->GetTuple(anId,&anArray[0]); + aScalars->SetTuple1(anId,anArray[theScalarMode - 1]); } - theOutputData->SetScalars(aScalars); - aScalars->Delete(); } + theOutputData->SetScalars(aScalars); + aScalars->Delete(); } } -- 2.39.2