]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
1. First implementation of Min/Max filed's values calculation.
authorapo <apo@opencascade.com>
Tue, 13 Sep 2005 08:29:38 +0000 (08:29 +0000)
committerapo <apo@opencascade.com>
Tue, 13 Sep 2005 08:29:38 +0000 (08:29 +0000)
src/CONVERTOR/VISU_Convertor.hxx
src/CONVERTOR/VISU_Convertor_impl.cxx
src/CONVERTOR/VISU_Convertor_impl.hxx
src/VISU_I/VISU_CorbaMedConvertor.cxx

index 14500e14309ba982a1b12948d983a72bfbb5b5e5..4f2ff546ffe5ce0b336133577d02a204f9ef47d8 100644 (file)
@@ -163,6 +163,7 @@ namespace VISU
 
   //---------------------------------------------------------------
   typedef std::map<int,PValForTime> TValField;
+  typedef std::pair<float,float> 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)
     {}
index b4dbc4b10c7f63170507235b5b2a270d9bf16d9e..8fd0cbe9585a98717f7dd398016fd1d9ec2fc951 100644 (file)
@@ -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 = "<<aNbTuples<<endl);
     
     vtkDataSetAttributes* aDataSetAttributes;
index e8201f3b552cfbdef29126dca07cdc362bae50ce..bd102bcaedee5bdfac41ec782584b45f4072fecf 100644 (file)
@@ -418,12 +418,22 @@ namespace VISU
 
 
   //---------------------------------------------------------------
+  typedef TVector<TMinMax> TMinMaxArr;
+
   struct TFieldImpl: virtual TField
   {
     vtkIdType myDataSize;
 
-    TFieldImpl(): myDataSize(0)
-    {}
+    TMinMaxArr myMinMaxArr;
+
+    virtual
+    TMinMax 
+    GetMinMax(vtkIdType theCompID);
+
+    void 
+    InitArrays(vtkIdType theNbComp);
+
+    TFieldImpl();
   };
   typedef SharedPtr<TFieldImpl> PFieldImpl;
 
index c580b50e11ae72d1b233b1ffea70545546bdfab1..645c5059e970eaa4a3237f10d41dd0a1d6353599 100644 (file)
@@ -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 = "<<aMeshName<<"; myDim = "<<aMesh->myDim);
 
@@ -748,12 +746,10 @@ VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED)
          aField->myName = aFieldName.in();
          aField->myEntity = anEntity;
          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 = "<<aMeshOnEntity->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 = "<<aMeshOnEntity->myNbCells);
-      aField->myCompNames.resize(aField->myNbComp);
-      aField->myUnitNames.resize(aField->myNbComp);
     }
     TValField& aValField = aField->myValField;
     int anId = aMEDField->getIterationNumber();