From 7010bd2a4bf5032507b75e2fec27422ecfe36c67 Mon Sep 17 00:00:00 2001 From: apo Date: Tue, 27 Sep 2005 12:47:35 +0000 Subject: [PATCH] To improve Data assignment --- src/CONVERTOR/VISU_Convertor_impl.cxx | 86 ++++++++++----------------- 1 file changed, 31 insertions(+), 55 deletions(-) diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index 3a9db26d..6cf610fa 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -1061,9 +1061,10 @@ namespace default: aDataSetAttributes = theSource->GetCellData(); } - int aNumberOfComponents=theField->myNbComp; + + int aNbComp = theField->myNbComp; vtkFloatArray *aFloatArray = vtkFloatArray::New(); - switch(aNumberOfComponents) { + switch(aNbComp) { case 1: aFloatArray->SetNumberOfComponents(1); aDataSetAttributes->SetScalars(aFloatArray); @@ -1072,74 +1073,53 @@ namespace aFloatArray->SetNumberOfComponents(3); aDataSetAttributes->SetVectors(aFloatArray); } - aFloatArray->Delete(); aFloatArray->SetNumberOfTuples(aNbTuples); aFloatArray->SetName(aFieldName.c_str()); - // - vtkFloatArray *aFArr=vtkFloatArray::New(); - aFArr->SetNumberOfComponents(aNumberOfComponents); - aFArr->SetNumberOfTuples(aNbTuples); - aFArr->SetName("VISU_FIELD"); - aDataSetAttributes->AddArray(aFArr); - aFArr->Delete(); - // + + vtkFloatArray *aDataArray = vtkFloatArray::New(); + aDataArray->SetNumberOfComponents(aNbComp); + aDataArray->SetNumberOfTuples(aNbTuples); + aDataSetAttributes->AddArray(aDataArray); + aDataArray->SetName("VISU_FIELD"); + TGeom2Value& aGeom2Value = theValForTime->myGeom2Value; TGeom2Value::const_iterator anIter = aGeom2Value.begin(); - int aTupleIdx = 0, aTupleId = 0; - vectoraVal(aNumberOfComponents); - // - for(; anIter != aGeom2Value.end(); anIter++){ + TVector aDataValues(aNbComp); + for(int aTupleId = 0; anIter != aGeom2Value.end(); anIter++){ int aGeom = anIter->first; const TMeshValue& aMeshValue = anIter->second; int aNbElem = aMeshValue.myNbElem; int aNbGauss = aMeshValue.myNbGauss; - //int aNbComp = aMeshValue.myNbComp; INITMSG(MYDEBUG, "- aGeom = "<