]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for Bug GVIEW10317 TG-D5-38-2003_D2006-06-01
authorapo <apo@opencascade.com>
Tue, 10 Jan 2006 07:21:55 +0000 (07:21 +0000)
committerapo <apo@opencascade.com>
Tue, 10 Jan 2006 07:21:55 +0000 (07:21 +0000)
 Incorrect reading of "maill.3.med" file in Post-Pro module.

src/CONVERTOR/VISU_Convertor_impl.cxx
src/CONVERTOR/VISU_Convertor_impl.hxx
src/CONVERTOR/VISU_MedConvertor.cxx
src/VISU_I/VISU_CorbaMedConvertor.cxx
src/VISU_I/VISU_Gen_i.cc
src/VISU_I/VISU_Gen_i.hh

index c1ef8027cdcccdd994aeda1d1f40ce4e47924c0a..85032edff0c5c4e4d5140dab4357a69fd42d6bcb 100644 (file)
@@ -59,7 +59,7 @@ static int MYVTKDEBUG = 0;
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
 static int MYDEBUGWITHFILES = 0;
-#define _DEXCEPT_
+//#define _DEXCEPT_
 #else
 static int MYDEBUG = 0;
 static int MYDEBUGWITHFILES = 0;
@@ -832,8 +832,7 @@ namespace VISU
   TValForTimeImpl
   ::TValForTimeImpl():
     myGaussPtsIDFilter(new TGaussPtsIDFilter()),
-    myIDMapperFilter(new TIDMapperFilter()),
-    myNbGauss(1)
+    myIDMapperFilter(new TIDMapperFilter())
   {}
 
   const TMeshValue& 
@@ -857,16 +856,12 @@ namespace VISU
   TValForTimeImpl
   ::GetNbGauss(EGeometry theGeom) const
   {
-    if(PGaussMeshImpl aGaussMesh = myGaussMesh){
-      const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
-      TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.find(theGeom);
-      if(anIter != aGeom2GaussSubMesh.end()){
-       PGaussSubMeshImpl aGaussSubMesh = anIter->second;
-       PGaussImpl aGauss = aGaussSubMesh->myGauss;
-       return aGauss->myNbPoints;
-      }
+    TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.find(theGeom);
+    if(anIter == myGeom2NbGauss.end()){
+      //EXCEPTION(runtime_error,"TValForTimeImpl::GetNbGauss - myGeom2NbGauss.find(theGeom) fails");
+      return 1;
     }
-    return myNbGauss;
+    return anIter->second;
   }
   
 
@@ -1621,24 +1616,37 @@ namespace
       if(aNbGauss < 1)
        continue;
 
+      const TPointCoords& aCoords = aGaussSubMesh->myPointCoords;
+
       INITMSG(MYDEBUG,
              "- aEGeom = "<<aEGeom<<
              "; aNbElem = "<<aNbElem<<
              "; aNbGauss = "<<aNbGauss<<
+             "; aCoords.GetNbPoints() = "<<aCoords.GetNbPoints()<<
              endl);
 
-      int aNbComp2 = aNbComp;
-      if(aNbComp == 4)
-       aNbComp2 = 2;
-      else if(aNbComp > 4)
-       aNbComp2 = 3;
-
-      for(int iElem = 0; iElem < aNbElem; iElem++){
-       TCValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem);
-       for(int iGauss = 0; iGauss < aNbGauss; iGauss++, aTupleId++){
-         const TCValueSlice& aValueSlice = aValueSliceArr[iGauss];
+      if(aCoords.GetNbPoints() == aNbElem*aNbGauss){
+       for(int iElem = 0; iElem < aNbElem; iElem++){
+         TCValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem);
+         for(int iGauss = 0; iGauss < aNbGauss; iGauss++, aTupleId++){
+           const TCValueSlice& aValueSlice = aValueSliceArr[iGauss];
+           for(int iComp = 0; iComp < aNbComp; iComp++){
+             aDataValues[iComp] = aValueSlice[iComp];
+           }
+           aFloatArray->SetTuple(aTupleId,&aDataValues[0]);
+           aDataArray->SetTuple(aTupleId,&aDataValues[0]);
+         }
+       }
+      }else{
+       for(int iElem = 0; iElem < aNbElem; iElem++, aTupleId++){
+         TCValueSliceArr aValueSliceArr = aMeshValue.GetCompValueSliceArr(iElem);
          for(int iComp = 0; iComp < aNbComp; iComp++){
-           aDataValues[iComp] = aValueSlice[iComp];
+           const TCValueSlice& aValueSlice = aValueSliceArr[iComp];
+           aDataValues[iComp] = 0.0;
+           for(int iGauss = 0; iGauss < aNbGauss; iGauss++){
+             aDataValues[iComp] += aValueSlice[iGauss];
+           }
+           aDataValues[iComp] /= aNbGauss;
          }
          aFloatArray->SetTuple(aTupleId,&aDataValues[0]);
          aDataArray->SetTuple(aTupleId,&aDataValues[0]);
index 583fb0bf617eccaf4476e892f95f6b5ed30092b3..18e494cfd8124dc70cd398e894296da088d65a94 100644 (file)
@@ -744,6 +744,7 @@ namespace VISU
 
   //---------------------------------------------------------------
   typedef std::map<EGeometry,TMeshValue> TGeom2Value;
+  typedef std::map<EGeometry,vtkIdType> TGeom2NbGauss;
 
   //! Specialize TValForTime to provide VTK mapping for the entity
   struct TValForTimeImpl: virtual TValForTime
@@ -751,7 +752,7 @@ namespace VISU
     PGaussPtsIDFilter myGaussPtsIDFilter; //!< Keep VTK representation for mesh and data on Gauss Points
     PIDMapperFilter myIDMapperFilter; //!< Keep VTK representation for ordinary mesh and data
     TGeom2Value myGeom2Value; //!< Keep value that is assigned to the mesh
-    vtkIdType myNbGauss; //!< Keep number of Gauss Points
+    TGeom2NbGauss myGeom2NbGauss; //!< Keep number of Gauss Points
    
     TValForTimeImpl();
 
index cf80627d7f69ab795b6f6666c6dc4b83cfdba7c9..1d51be103ab942f4d6167f2ad9b864254b7e707f 100644 (file)
@@ -51,7 +51,7 @@ static int MYDEBUG = 0;
 static int MYVALUEDEBUG = 0;
 static int MY_FAMILY_DEBUG = 0;
 static int MY_GROUP_DEBUG = 0;
-#define _DEXCEPT_
+//#define _DEXCEPT_
 #else
 static int MYDEBUG = 0;
 static int MYVALUEDEBUG = 0;
@@ -687,9 +687,18 @@ namespace
        aValForTime->myFieldName = aField->myName;
        aValForTime->myEntity = aField->myEntity;
        aValForTime->myMeshName = aField->myMeshName;
-       aValForTime->myNbGauss = aTimeStampInfo->GetNbGauss();
        aValForTime->myTime = VISU::TTime(aDt,anUnitDt);
        INITMSG(MYDEBUG,"aDt = '"<<aDt<<", "<<anUnitDt<<"'\n");
+       
+       TGeom2NbGauss& aVGeom2NbGauss = aValForTime->myGeom2NbGauss;
+       const MED::TGeom2NbGauss& aMGeom2NbGauss = aTimeStampInfo->myGeom2NbGauss;
+       MED::TGeom2NbGauss::const_iterator anIter = aMGeom2NbGauss.begin();
+       for(; anIter != aMGeom2NbGauss.end(); anIter++){
+         const MED::EGeometrieElement& aMGeom = anIter->first;
+         EGeometry aEGeom = MEDGeom2VISU(aMGeom);
+         TInt aNbGauss = anIter->second;
+         aVGeom2NbGauss[aEGeom] = aNbGauss;
+       }
       }
     }
   }
@@ -1178,73 +1187,83 @@ VISU_MedConvertor
            TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPTimeStampInfo()");
            INITMSG(MYDEBUG,"- iTimeStamp = "<<iTimeStamp<<endl);
            
-           MED::PTimeStampInfo aTimeStampInfo = aMed->GetPTimeStampInfo(aFieldInfo,
-                                                                        aMEntity,
-                                                                        aGeom2Size,
-                                                                        iTimeStamp);
-           
-           MED::PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStampInfo,
-                                                                     aMKey2Profile,
-                                                                     aKey2Gauss);
-           
-           const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
-
-           const MED::TTimeStampVal& aTimeStampValRef = aTimeStampVal;
-           
-           const MED::TGeom2Value& aGeom2Value = aTimeStampValRef.myGeom2Value;
-           MED::TGeom2Value::const_iterator anIter = aGeom2Value.begin();
-           for(; anIter != aGeom2Value.end(); anIter++){
-             const MED::TMeshValue& aMMeshValue = anIter->second;
-             MED::EGeometrieElement aMGeom = anIter->first;
+#ifndef _DEXCEPT_
+           try{
+#endif
+             MED::PTimeStampInfo aTimeStampInfo = aMed->GetPTimeStampInfo(aFieldInfo,
+                                                                          aMEntity,
+                                                                          aGeom2Size,
+                                                                          iTimeStamp);
              
-             TInt aNbElem = aMMeshValue.myNbElem;
-             TInt aNbGauss = aMMeshValue.myNbGauss;
+             MED::PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStampInfo,
+                                                                       aMKey2Profile,
+                                                                       aKey2Gauss);
              
-             MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
-             if(aGaussIter == aGeom2Gauss.end())
-               aNbGauss = 1;
-
-             INITMSG(MYDEBUG,
-                     "- aMGeom = "<<aMGeom<<
-                     "; aNbElem = "<<aNbElem<<
-                     "; aNbGauss = "<<aNbGauss<<
-                     endl);
+             const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
              
-             // To calculate min/max per components
-             for(TInt iElem = 0; iElem < aNbElem; iElem++){
-               MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
-               for(TInt iComp = 0; iComp < aNbComp; iComp++){
-                 const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iComp];
-                 TMinMax& aMinMax = aMinMaxArr[iComp+1];
-                 float& aMin = aMinMax.first;
-                 float& aMax = aMinMax.second;
-                 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
-                   const float& aVal = aMValueSlice[iGauss];
-                   aMin = min(aMin,aVal);
-                   aMax = max(aMax,aVal);
+             const MED::TTimeStampVal& aTimeStampValRef = aTimeStampVal;
+             
+             const MED::TGeom2Value& aGeom2Value = aTimeStampValRef.myGeom2Value;
+             MED::TGeom2Value::const_iterator anIter = aGeom2Value.begin();
+             for(; anIter != aGeom2Value.end(); anIter++){
+               const MED::TMeshValue& aMMeshValue = anIter->second;
+               MED::EGeometrieElement aMGeom = anIter->first;
+               
+               TInt aNbElem = aMMeshValue.myNbElem;
+               TInt aNbGauss = aMMeshValue.myNbGauss;
+               
+               MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
+               if(aGaussIter == aGeom2Gauss.end())
+                 aNbGauss = 1;
+               
+               INITMSG(MYDEBUG,
+                       "- aMGeom = "<<aMGeom<<
+                       "; aNbElem = "<<aNbElem<<
+                       "; aNbGauss = "<<aNbGauss<<
+                       endl);
+               
+               // To calculate min/max per components
+               for(TInt iElem = 0; iElem < aNbElem; iElem++){
+                 MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
+                 for(TInt iComp = 0; iComp < aNbComp; iComp++){
+                   const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iComp];
+                   TMinMax& aMinMax = aMinMaxArr[iComp+1];
+                   float& aMin = aMinMax.first;
+                   float& aMax = aMinMax.second;
+                   for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+                     const float& aVal = aMValueSlice[iGauss];
+                     aMin = min(aMin,aVal);
+                     aMax = max(aMax,aVal);
+                   }
                  }
                }
-             }
-             
-             // To calculate min/max per vector modulus
-             TMinMax& aMinMax = aMinMaxArr[0];
-             float& aMin = aMinMax.first;
-             float& aMax = aMinMax.second;
-             for(TInt iElem = 0; iElem < aNbElem; iElem++){
-               MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
-               for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
-                 const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
-                 float aValue = 0.0;
-                 for(TInt iComp = 0; iComp < aNbComp2; iComp++){
-                   float aVal = aMValueSlice[iComp];
-                   aValue += aVal*aVal;
+               
+               // To calculate min/max per vector modulus
+               TMinMax& aMinMax = aMinMaxArr[0];
+               float& aMin = aMinMax.first;
+               float& aMax = aMinMax.second;
+               for(TInt iElem = 0; iElem < aNbElem; iElem++){
+                 MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
+                 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+                   const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
+                   float aValue = 0.0;
+                   for(TInt iComp = 0; iComp < aNbComp2; iComp++){
+                     float aVal = aMValueSlice[iComp];
+                     aValue += aVal*aVal;
+                   }
+                   aValue = sqrt(aValue);
+                   aMin = min(aMin,aValue);
+                   aMax = max(aMax,aValue);
                  }
-                 aValue = sqrt(aValue);
-                 aMin = min(aMin,aValue);
-                 aMax = max(aMax,aValue);
                }
              }
+#ifndef _DEXCEPT_
+           }catch(std::exception& exc){
+             MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
+           }catch(...){
+             MSG(MYDEBUG,"Unknown exception !!!");
            }
+#endif
          }
          for(TInt iComp = 0; iComp <= aNbComp; iComp++){
            VISU::TMinMax aMinMax = aField->GetMinMax(iComp);
@@ -2141,6 +2160,8 @@ LoadGaussMesh(const MED::PWrapper& theMed,
              "- aEGeom = "<<aEGeom<<
              "; aName = '"<<aName<<"'"<<
              "; aStatus = "<<aGaussSubMesh->myStatus<<
+             "; aNbElem = "<<aNbElem<<
+             "; aNbGauss = "<<aNbGauss<<
              "; aNbCells = "<<aNbCells<<
              endl);
     }
@@ -2238,9 +2259,9 @@ LoadValForTime(const MED::PWrapper& theMed,
     TInt aNbElem = aSubProfile->myNbCells;
     theField->myDataSize += aNbElem*aNbComp;
 
-    TInt aNbGauss = theValForTime->GetNbGauss(aEGeom);
-
     if(aSubProfile->myStatus != eRemoveAll){
+      TInt aNbGauss = theValForTime->GetNbGauss(aEGeom);
+
       INITMSG(MYDEBUG,
              "- aEGeom = "<<aEGeom<<
              "; aNbElem = "<<aNbElem<<
index a7f9fec0e9e2b49bc44df572b589917e929aa7bf..98e81b68e6ac55e1aad273a530b8bf1feef65cf2 100644 (file)
@@ -39,7 +39,7 @@ using namespace VISU;
 #define USER_INTERLACE MED_FULL_INTERLACE
 
 #ifdef _DEBUG_
-static int MYDEBUG = 1;
+static int MYDEBUG = 0;
 #else
 static int MYDEBUG = 0;
 #endif
index c48f47df10d69c5d0ba04a1a61a28c2d99ad1108..5e0a5867cc6fcae7c427b1042d348c2e71c0c744 100644 (file)
@@ -91,7 +91,7 @@ static QFileInfo aFileInfo;
 
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
-#define _DEXCEPT_
+//#define _DEXCEPT_
 #else
 static int MYDEBUG = 0;
 #endif
@@ -244,10 +244,8 @@ namespace VISU
 #ifndef _DEXCEPT_
     }catch(std::exception& exc){
       INFOS("Follow exception was occured :\n"<<exc.what());
-      throw;
     }catch(...){
       INFOS("Unknown exception was occured!");
-      throw;
     }
 #endif
     return false;
index 2be677ade9e6fc98e6fd3181080402d72b461877..d1ab542439b44692d4c010201fe7bffe3d85db4b 100644 (file)
@@ -337,6 +337,4 @@ namespace VISU
   };
 }
 
-#undef _VISU_GEN_DEXCEPT_
-
 #endif