From 4426b3131548c55d760f97f392ac6724637ed553 Mon Sep 17 00:00:00 2001 From: apo Date: Tue, 13 Sep 2005 08:29:38 +0000 Subject: [PATCH] 1. First implementation of Min/Max filed's values calculation. --- src/CONVERTOR/VISU_Convertor.hxx | 7 +++++- src/CONVERTOR/VISU_Convertor_impl.cxx | 31 ++++++++++++++++++++++++++- src/CONVERTOR/VISU_Convertor_impl.hxx | 14 ++++++++++-- src/VISU_I/VISU_CorbaMedConvertor.cxx | 12 +++-------- 4 files changed, 51 insertions(+), 13 deletions(-) diff --git a/src/CONVERTOR/VISU_Convertor.hxx b/src/CONVERTOR/VISU_Convertor.hxx index 14500e14..4f2ff546 100644 --- a/src/CONVERTOR/VISU_Convertor.hxx +++ b/src/CONVERTOR/VISU_Convertor.hxx @@ -163,6 +163,7 @@ namespace VISU //--------------------------------------------------------------- typedef std::map TValField; + typedef std::pair TMinMax; struct TField: virtual TIntId { @@ -172,7 +173,11 @@ namespace VISU TValField myValField; TNames myCompNames; TNames myUnitNames; - int myNbComp; + vtkIdType myNbComp; + + virtual + TMinMax + GetMinMax(vtkIdType theCompID) = 0; TField(): myNbComp(0) {} diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index b4dbc4b1..8fd0cbe9 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -521,6 +521,35 @@ namespace VISU } + //--------------------------------------------------------------- + TFieldImpl + ::TFieldImpl(): + myDataSize(0) + {} + + void + TFieldImpl + ::InitArrays(vtkIdType theNbComp) + { + myNbComp = theNbComp; + myCompNames.resize(theNbComp); + myUnitNames.resize(theNbComp); + myMinMaxArr.resize(theNbComp); + for(vtkIdType iComp = 0; iComp < theNbComp; iComp++){ + TMinMax& aMinMax = myMinMaxArr[iComp]; + aMinMax.first = -VTK_LARGE_FLOAT; + aMinMax.second = VTK_LARGE_FLOAT; + } + } + + TMinMax + TFieldImpl + ::GetMinMax(vtkIdType theCompID) + { + return myMinMaxArr[theCompID]; + } + + //--------------------------------------------------------------- void TMeshValue @@ -964,7 +993,7 @@ namespace const PValForTimeImpl& theValForTime) { int aNbTuples = theField->myDataSize/theField->myNbComp; - string aFieldName = GenerateFieldName(theField,theValForTime); + std::string aFieldName = GenerateFieldName(theField,theValForTime); INITMSG(MYDEBUG,"GetTimeStampOnProfile - aNbTuples = "< TMinMaxArr; + struct TFieldImpl: virtual TField { vtkIdType myDataSize; - TFieldImpl(): myDataSize(0) - {} + TMinMaxArr myMinMaxArr; + + virtual + TMinMax + GetMinMax(vtkIdType theCompID); + + void + InitArrays(vtkIdType theNbComp); + + TFieldImpl(); }; typedef SharedPtr PFieldImpl; diff --git a/src/VISU_I/VISU_CorbaMedConvertor.cxx b/src/VISU_I/VISU_CorbaMedConvertor.cxx index c580b50e..645c5059 100644 --- a/src/VISU_I/VISU_CorbaMedConvertor.cxx +++ b/src/VISU_I/VISU_CorbaMedConvertor.cxx @@ -365,10 +365,8 @@ VISU_MEDFieldConvertor::Build() aField->myName = aFieldName.in(); aField->myEntity = aVEntity; aField->myMeshName = aMeshName.in(); - aField->myNbComp = myField->getNumberOfComponents(); + aField->InitArrays(myField->getNumberOfComponents()); aField->myDataSize = aMeshOnEntity->myNbCells * aField->myNbComp; - aField->myCompNames.resize(aField->myNbComp); - aField->myUnitNames.resize(aField->myNbComp); if(MYDEBUG) MESSAGE("VISU_MEDFieldConvertor::Build - aMeshName = "<myNbCells = "<myNbCells); - aField->myCompNames.resize(aField->myNbComp); - aField->myUnitNames.resize(aField->myNbComp); }else aField = aFieldMapIter->second; @@ -840,12 +836,10 @@ VISU_MEDConvertor::Build(SALOMEDS::ChildIterator_ptr theTimeStampIterator) aField->myName = aFieldName.in(); aField->myEntity = aVEntity; aField->myMeshName = aMeshName.in(); - aField->myNbComp = aMEDField->getNumberOfComponents(); + aField->InitArrays(aMEDField->getNumberOfComponents()); aField->myDataSize = aMeshOnEntity->myNbCells * aField->myNbComp; if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aMeshOnEntity->myNbCells = "<myNbCells); - aField->myCompNames.resize(aField->myNbComp); - aField->myUnitNames.resize(aField->myNbComp); } TValField& aValField = aField->myValField; int anId = aMEDField->getIterationNumber(); -- 2.39.2