]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for bug 10434: Lost fields reading the med file maill.3.med
authorjfa <jfa@opencascade.com>
Tue, 1 Nov 2005 12:59:24 +0000 (12:59 +0000)
committerjfa <jfa@opencascade.com>
Tue, 1 Nov 2005 12:59:24 +0000 (12:59 +0000)
src/CONVERTOR/VISU_MedConvertor.cxx
src/VISU_I/VISU_Gen_i.hh

index bc9e31d189302e56234b5228f9af575c97186180..5c47189b9081756454c329f21a91ca5a9cdfc6f0 100644 (file)
@@ -157,8 +157,8 @@ VISU_Convertor* VISU_MedConvertor::Build()  {
   MSG(MYDEBUG,"VISU_MedConvertor::Build()");
   INITMSG(MYDEBUG,"GetNbMeshes() = "<<aNbMeshes<<"\n");
 
-  for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++)
-    try{
+  for (TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++) {
+    try {
     PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
 
     PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
@@ -424,11 +424,13 @@ VISU_Convertor* VISU_MedConvertor::Build()  {
       TInt aNbComp = aFieldInfo->GetNbComp();
       const string& aFieldName = aFieldInfo->GetName();
 
+      MED::TErr anErr;
       MED::TGeom aTGeom;
       EEntiteMaillage aMEntity;
-      TInt aNbTimeStamps = aMed->GetNbTimeStamps(aFieldInfo,aEntityInfo,aMEntity,aTGeom);
-      if (aNbTimeStamps<1)
+      TInt aNbTimeStamps = aMed->GetNbTimeStamps(aFieldInfo,aEntityInfo,aMEntity,aTGeom,&anErr);
+      if (anErr < 0 || aNbTimeStamps < 1)
        continue;
+
       TEntity aVEntity = MEDEntityToVTK(aMEntity);
       VISU::PMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
       TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
@@ -457,10 +459,14 @@ VISU_Convertor* VISU_MedConvertor::Build()  {
        PTimeStampInfo aTimeStamp = aMed->GetPTimeStampInfo(aFieldInfo,
                                                            aMEntity,
                                                            aTGeom,
-                                                           iTimeStamp);
+                                                           iTimeStamp,
+                                                            &anErr);
+        if (anErr < 0)
+          continue;
+
        TFloat aDt = aTimeStamp->GetDt();
        const string& anUnitDt = aTimeStamp->GetUnitDt();
-       PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStamp);
+       PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStamp,&anErr);
        TValField& aValField = aField->myValField;
        PMEDValForTime aValForTime = aValField[iTimeStamp](new TMEDValForTime());
        aValForTime->myId = iTimeStamp;
@@ -477,6 +483,7 @@ VISU_Convertor* VISU_MedConvertor::Build()  {
   } catch(...){
     EXCEPTION(runtime_error,"Unknown exception !!!");
   }
+  }
 
   return this; 
 }
index abaac0a6e46e0d1dc3a7f46fd8e3d022e4211a6e..240b6beacb6be67d682c8fe464156e8515defccf 100644 (file)
@@ -69,8 +69,10 @@ namespace VISU{
       if(Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
        if(TPrs3d_i::IsPossible(pResult,theMeshName,theEntity,theFieldName,int(theIteration))){
          aPresent = new TPrs3d_i(pResult,theAddToStudy);
-         if(aPresent->Create(theMeshName,theEntity,theFieldName,int(theIteration)) == NULL)
+         if(aPresent->Create(theMeshName,theEntity,theFieldName,int(theIteration)) == NULL){
            aPresent->_remove_ref();
+           aPresent = NULL;
+         }
        }
       }
       return aPresent;