]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
#16927: Error when loading a med file with 140 millions elements
authoreap <eap@opencascade.com>
Tue, 14 May 2019 13:58:34 +0000 (16:58 +0300)
committereap <eap@opencascade.com>
Tue, 14 May 2019 13:58:34 +0000 (16:58 +0300)
src/MEDWrapper/MED_Wrapper.cxx
src/MEDWrapper/MED_Wrapper.hxx

index 157f9834285bc7cb20ace11d84957ed797257e68..85a8d9f35d1214b01962c4f13f3c2735f404f654 100644 (file)
@@ -195,8 +195,8 @@ namespace MED
     if ( write ) {
       myFile->Open(eLECTURE_ECRITURE, &aRet);
       if (aRet < 0) {
-       myFile->Close();
-       myFile->Open(eCREATION, &aRet);
+        myFile->Close();
+        myFile->Open(eCREATION, &aRet);
       }
     }
     else {
@@ -2058,6 +2058,24 @@ namespace MED
     TValueHolder<EConnectivite, med_connectivity_mode> aConnMode    (theInfo.myConnMode);
 
     TErr aRet;
+    med_bool dummy;
+    aRet = MEDmeshnEntity(myFile->Id(),
+                          &aMeshName,
+                          MED_NO_DT,
+                          MED_NO_IT,
+                          anEntity,
+                          aGeom,
+                          MED_NAME,
+                          aConnMode,
+                          &dummy, &dummy);
+    if ( aRet > 0 )
+    {
+      // names are present in the file, they will be read in spite of theInfo.myIsElemNames
+      theInfo.myIsElemNames = eVRAI;
+      theInfo.myElemNames.reset( new TString( theInfo.myNbElem * GetPNOMLength() + 1 ));
+      anElemNames.myRepresentation = & ((TString&) theInfo.myElemNames )[0];
+    }
+
     aRet = MEDmeshElementRd(myFile->Id(),
                             &aMeshName,
                             MED_NO_DT,
@@ -2080,11 +2098,11 @@ namespace MED
       EXCEPTION(std::runtime_error, "GetCellInfo - MEDmeshElementRd(...)");
 
     if (anIsFamNum == MED_FALSE)
-      {
-        int mySize = (int) theInfo.myFamNum->size();
-        theInfo.myFamNum->clear();
-        theInfo.myFamNum->resize(mySize, 0);
-      }
+    {
+      int mySize = (int) theInfo.myFamNum->size();
+      theInfo.myFamNum->clear();
+      theInfo.myFamNum->resize(mySize, 0);
+    }
 
   }
 
index e236f206cb09240db23736801c9ac29597498db0..6761a19e82a8d8d9880da0e6e5084a8192e6e1ba 100644 (file)
@@ -279,7 +279,7 @@ namespace MED
                EModeSwitch theMode = eFULL_INTERLACE,
                ERepere theSystem = eCART,
                EBooleen theIsElemNum = eVRAI,
-               EBooleen theIsElemNames = eVRAI);
+               EBooleen theIsElemNames = eFAUX);
 
     //! Create a MEDWrapper MED Nodes representation
     virtual
@@ -521,7 +521,7 @@ namespace MED
                TInt theNbElem,
                EConnectivite theConnMode = eNOD,
                EBooleen theIsElemNum = eVRAI,
-               EBooleen theIsElemNames = eVRAI,
+               EBooleen theIsElemNames = eFAUX,
                EModeSwitch theMode = eFULL_INTERLACE);
 
     //! Create a MEDWrapper MED Cells representation