return;
vtkDataArray* aVectors = theInputData->GetVectors();
vtkDataArray* aFieldArray = theInputData->GetArray("VISU_FIELD");
- if(vtkDataArray* aDataArray = aVectors){
- if(vtkFloatArray *aFloatArray = dynamic_cast<vtkFloatArray*>(aDataArray)){
- int aNbComp = aFloatArray->GetNumberOfComponents();
- std::vector<float> 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<vtkFloatArray*>(aFieldArray)){
+ int aNbComp = aFloatArray->GetNumberOfComponents();
+ std::vector<float> 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();
}
}