From: apo Date: Tue, 4 Oct 2005 11:34:56 +0000 (+0000) Subject: To use "VISU_FIELD" array instead of vtkVectors X-Git-Tag: BR-D5-38-2003_D2005-12-10~76 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c339fd419ee21329393e8ee4da73a6924986128c;p=modules%2Fvisu.git To use "VISU_FIELD" array instead of vtkVectors --- 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(); } }