]> 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:25:39 +0000 (08:25 +0000)
committerapo <apo@opencascade.com>
Tue, 13 Sep 2005 08:25:39 +0000 (08:25 +0000)
2. Porting to new MEDWrapper feature
  - iteration by Gauss Points values through components

src/CONVERTOR/VISU_MedConvertor.cxx

index eb9222d5c511ad2be450e5022aa118028c69c9e2..1e36439ce78a6b75c3f947446fe5ecb9bf9a5c12 100644 (file)
@@ -512,6 +512,59 @@ namespace
   }
 
 
+  //---------------------------------------------------------------
+  void
+  CalculateMinMax(MED::PTimeStampVal theTimeStampVal,
+                 PMEDField theField,
+                 PMEDValForTime theValForTime)
+  {
+    TInt aNbComp = theField->myNbComp;
+    TMinMaxArr& aMinMaxArr = theField->myMinMaxArr;
+    const MED::TTimeStampVal& aTimeStampValRef = theTimeStampVal;
+
+    PMEDProfile aProfile = theValForTime->myProfile;
+    TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+    TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
+    for(; anIter != aGeom2SubProfile.end(); anIter++){
+      vtkIdType aVGeom = anIter->first;
+      PMEDSubProfile aSubProfile(anIter->second);
+      
+      TInt aNbElem = aSubProfile->myNbCells;
+      TInt aNbGauss = theValForTime->GetNbGauss(aVGeom);
+      
+      if(aSubProfile->myStatus != eRemoveAll){
+       INITMSG(MYDEBUG,
+               "- aVGeom = "<<aVGeom<<
+               "; aNbElem = "<<aNbElem<<
+               "; aNbGauss = "<<aNbGauss<<
+               endl);
+       
+       MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
+       const MED::TMeshValue& aMMeshValue = aTimeStampValRef.GetMeshValue(aMGeom);
+       for(TInt iElem = 0; iElem < aNbElem; iElem++){
+         MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
+         ADDMSG(MYVALUEDEBUG,"{");
+         for(TInt iComp = 0; iComp < aNbComp; iComp++){
+           const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iComp];
+           TMinMax& aMinMax = aMinMaxArr[iComp];
+           float& aMin = aMinMax.first;
+           float& aMax = aMinMax.second;
+           for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+             const float& aVal = aMValueSlice[iGauss];
+             ADDMSG(MYVALUEDEBUG,aVal<<" ");
+             aMin = min(aMin,aVal);
+             aMax = max(aMax,aVal);
+           }
+           ADDMSG(MYVALUEDEBUG,"| ");
+         }
+         ADDMSG(MYVALUEDEBUG,"} ");
+       }
+       ADDMSG(MYDEBUG,"\n");
+      }
+    }
+  }
+
+
   //---------------------------------------------------------------
   void
   BuildFieldMap(PMEDMesh theMesh,
@@ -543,13 +596,11 @@ namespace
       TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
       PMEDField aField = aFieldMap[aFieldName](new TMEDField());
       aField->myId = iField;
-      aField->myNbComp = aNbComp;
+      aField->InitArrays(aNbComp);
       aField->myEntity = aVEntity;
       aField->myName = aFieldName;
       aField->myMeshName = aMeshName;
       aField->myDataSize = aMeshOnEntity->myNbCells * aNbComp;
-      aField->myCompNames.resize(aNbComp);
-      aField->myUnitNames.resize(aNbComp);
       
       INITMSG(MYDEBUG,"myName = '"<<aField->myName<<"'"<<
              "; myId = "<<aField->myId<<
@@ -586,6 +637,10 @@ namespace
                         aMeshOnEntity,
                         aGeom2Size,
                         aValForTime);
+       
+       CalculateMinMax(aTimeStampVal,
+                       aField,
+                       aValForTime);
       }
     }
   }
@@ -1611,7 +1666,7 @@ LoadValForTime(const MED::PWrapper& theMed,
 
   theField->myDataSize = 0;
 
-  const MED::TTimeStampVal& aTimeVal = aTimeStampVal;
+  const MED::TTimeStampVal& aTimeStampValRef = aTimeStampVal;
   TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
   for(; anIter != aGeom2SubProfile.end(); anIter++){
     vtkIdType aVGeom = anIter->first;
@@ -1633,10 +1688,10 @@ LoadValForTime(const MED::PWrapper& theMed,
       aVMeshValue.Init(aNbElem,aNbGauss,aNbComp);
 
       MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
-      const MED::TMeshValue& aMMeshValue = aTimeVal.GetMeshValue(aMGeom);
+      const MED::TMeshValue& aMMeshValue = aTimeStampValRef.GetMeshValue(aMGeom);
       for(TInt iElem = 0; iElem < aNbElem; iElem++){
        TValueSliceArr aVValueSliceArr = aVMeshValue.GetGaussValueSliceArr(iElem);
-       MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetValueSliceArr(iElem);
+       MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
        ADDMSG(MYVALUEDEBUG,"{");
        for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
          TValueSlice& aVValueSlice = aVValueSliceArr[iGauss];