Salome HOME
BUG: impossible to import a med file of size more than MAX_INT (~2.1 Gb)
authoreap <eap@opencascade.com>
Thu, 9 Jun 2016 11:22:37 +0000 (14:22 +0300)
committereap <eap@opencascade.com>
Thu, 9 Jun 2016 11:22:37 +0000 (14:22 +0300)
  (SMESH_File.*)

Fix an error of porting to OCCT-7
  (StdMeshers_Cartesian_3D.cxx)

Remove useless MESSAGE's

src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx
src/SMESH/SMESH_Mesh.cxx
src/SMESHClient/SMESH_Client.cxx
src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx
src/SMESHGUI/SMESHGUI_VTKUtils.cxx
src/SMESHUtils/SMESH_File.cxx
src/SMESHUtils/SMESH_File.hxx
src/StdMeshers/StdMeshers_Cartesian_3D.cxx

index 64aa6f5bdf2b5249c9aa9d5a48dd35e0826b84ad..f279c08c8f0452e244f19391a1a3c3284a2a7fcc 100644 (file)
@@ -317,7 +317,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
     return DRS_FAIL;
   }
   try {
-    MESSAGE("Perform - myFile : "<<myFile);
+    //MESSAGE("Perform - myFile : "<<myFile);
 
     // Creating the MED mesh for corresponding SMDS structure
     //-------------------------------------------------------
@@ -430,7 +430,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
     
     MED::PWrapper myMed = CrWrapper(myFile,myMedVersion);
     PMeshInfo aMeshInfo = myMed->CrMeshInfo(aMeshDimension,aSpaceDimension,aMeshName);
-    MESSAGE("Add - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
+    //MESSAGE("Add - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
     myMed->SetMeshInfo(aMeshInfo);
 
     // Storing SMDS groups and sub-meshes as med families
@@ -454,7 +454,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
     if (myDoGroupOf0DElems && nb0DElements) my0DElementsDefaultFamilyId = REST_0DELEM_FAMILY;
     if (myDoGroupOfBalls && nbBalls) myBallsDefaultFamilyId = REST_BALL_FAMILY;
 
-    MESSAGE("Perform - aFamilyInfo");
+    //MESSAGE("Perform - aFamilyInfo");
     list<DriverMED_FamilyPtr> aFamilies;
     if (myAllSubMeshes) {
       aFamilies = DriverMED_Family::MakeFamilies
@@ -529,8 +529,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
       aNodeInfo->SetCoordUnit( iCoord, aCoordHelperPtr->GetUnit(iCoord));
     }
 
-    //cout << " SetNodeInfo(aNodeInfo)" << endl;
-    MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbNodes);
+    //MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbNodes);
     myMed->SetNodeInfo(aNodeInfo);
     aNodeInfo.reset(); // free memory used for arrays
 
index 13747255c7afff32fca9f70317b74800fa29c528..ba8715cb48d61964eaae41b8fb7ef7cf1ceef974 100644 (file)
@@ -1604,7 +1604,7 @@ double SMESH_Mesh::GetComputeProgress() const
       const std::vector<SMESH_subMesh*>& smToCompute = algo->SubMeshesToCompute();
       for ( size_t i = 0; i < smToCompute.size(); ++i )
       {
-        if ( smToCompute[i]->IsEmpty() )
+        if ( smToCompute[i]->IsEmpty() || smToCompute.size() == 1 )
           algoNotDoneCost += smToCompute[i]->GetComputeCost();
         else
           algoDoneCost += smToCompute[i]->GetComputeCost();
index c9c4fdc7f60569175f305433e685c0e75a2189aa..5fa6bc833185c7fb4648c6600eca64a823254178 100644 (file)
@@ -815,22 +815,19 @@ SMESH_Client::SMESH_Client(CORBA::ORB_ptr theORB,
   mySMESHDSMesh(NULL),
   mySMDSMesh(NULL)
 {
-  MESSAGE("SMESH_Client::SMESH_Client");
+  if ( MYDEBUG ) MESSAGE("SMESH_Client::SMESH_Client");
   myMeshServer->Register();
 
   CORBA::Boolean anIsEmbeddedMode;
   GetSMESHGen(theORB,anIsEmbeddedMode);
   if(anIsEmbeddedMode){
-    if ( MYDEBUG )
-      MESSAGE("Info: The same process, update mesh by pointer ");
+    if ( MYDEBUG ) MESSAGE("Info: The same process, update mesh by pointer ");
     // just set client mesh pointer to server mesh pointer
     //SMESH_Mesh* aMesh = reinterpret_cast<SMESH_Mesh*>(theMesh->GetMeshPtr());
     CORBA::LongLong pointeur = theMesh->GetMeshPtr();
-    if( MYDEBUG )
-      MESSAGE("SMESH_Client::SMESH_Client pointeur "<<pointeur);
+    if( MYDEBUG ) MESSAGE("SMESH_Client::SMESH_Client pointeur "<<pointeur);
     SMESH_Mesh* aMesh = reinterpret_cast<SMESH_Mesh*> (pointeur);
-    if ( MYDEBUG )
-      MESSAGE("SMESH_Client::SMESH_Client aMesh "<<aMesh);
+    if ( MYDEBUG ) MESSAGE("SMESH_Client::SMESH_Client aMesh "<<aMesh);
     //if(aMesh->GetMeshDS()->IsEmbeddedMode()){
     if(anIsEmbeddedMode){
       mySMESHDSMesh = aMesh->GetMeshDS();
index f93ec46ea2ed46544e744c00d50126c35230d751..fc1f8c5e2b84acaffaf20d423ed597131efadbb3 100644 (file)
@@ -74,7 +74,7 @@
 #endif
 
 #ifdef _DEBUG_
-static int MYDEBUG = 1;
+static int MYDEBUG = 0;
 #else
 static int MYDEBUG = 0;
 #endif
index b79e6955efc810b1e126e41ef76868eb4a446261..390335532c7c769fd461a4a76e6fef0ec43147ec 100644 (file)
@@ -251,9 +251,7 @@ namespace SMESH
   void OnVisuException()
   {
     try {
-#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
       OCC_CATCH_SIGNALS;
-#endif
       // PAL16774 (Crash after display of many groups). Salome sometimes crashes just
       // after or at showing this message, so we do an additional check of available memory
 //       char* buf = new char[100*1024];
@@ -284,9 +282,7 @@ namespace SMESH
     TVisualObjPtr aVisualObj;
     TVisualObjCont::key_type aKey(theStudyId,theEntry);
     try{
-#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
       OCC_CATCH_SIGNALS;
-#endif
       TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.find(aKey);
       if(anIter != VISUAL_OBJ_CONT.end()){
         aVisualObj = anIter->second;
@@ -351,19 +347,14 @@ namespace SMESH
     bool objModified = false;
     if ( aVisualObj ) {
       try {
-#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
         OCC_CATCH_SIGNALS;
-#endif
-        //MESSAGE("GetVisualObj");
         if (nulData)
                 objModified = aVisualObj->NulData();
         else
           objModified = aVisualObj->Update();
       }
       catch (...) {
-#ifdef _DEBUG_
         MESSAGE ( "Exception in SMESHGUI_VTKUtils::GetVisualObj()" );
-#endif
         RemoveVisualObjectWithActors( theEntry ); // remove this object
         OnVisuException();
         aVisualObj.reset();
@@ -377,7 +368,7 @@ namespace SMESH
       // TODO: estimate memory usage in other modes and take current mode into account
       int freeMB = SMDS_Mesh::CheckMemory(true);
       int usedMB = aVisualObj->GetUnstructuredGrid()->GetActualMemorySize() / 1024;
-      MESSAGE("SMESHGUI_VTKUtils::GetVisualObj(), freeMB=" << freeMB << ", usedMB=" <<usedMB);
+      //MESSAGE("SMESHGUI_VTKUtils::GetVisualObj(), freeMB=" << freeMB << ", usedMB=" <<usedMB);
       if ( freeMB > 0 && usedMB * 5 > freeMB ) {
        bool continu = false;
        if ( usedMB * 3 > freeMB )
@@ -476,16 +467,12 @@ namespace SMESH
     if (SVTK_ViewWindow* wnd = GetCurrentVtkView())
     {
       try {
-#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
         OCC_CATCH_SIGNALS;
-#endif
         wnd->getRenderer()->Render();
         wnd->Repaint(false);
       }
       catch (...) {
-#ifdef _DEBUG_
         MESSAGE ( "Exception in SMESHGUI_VTKUtils::RepaintCurrentView()" );
-#endif
         OnVisuException();
       }
     }
@@ -494,16 +481,12 @@ namespace SMESH
   void RepaintViewWindow(SVTK_ViewWindow* theWindow)
   {
     try {
-#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
       OCC_CATCH_SIGNALS;
-#endif
       theWindow->getRenderer()->Render();
       theWindow->Repaint();
     }
     catch (...) {
-#ifdef _DEBUG_
       MESSAGE ( "Exception in SMESHGUI_VTKUtils::RepaintViewWindow(SVTK_ViewWindow*)" );
-#endif
       OnVisuException();
     }
   }
@@ -511,16 +494,12 @@ namespace SMESH
   void RenderViewWindow(SVTK_ViewWindow* theWindow)
   {
     try {
-#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
       OCC_CATCH_SIGNALS;
-#endif
       theWindow->getRenderer()->Render();
       theWindow->Repaint();
     }
     catch (...) {
-#ifdef _DEBUG_
       MESSAGE ( "Exception in SMESHGUI_VTKUtils::RenderViewWindow(SVTK_ViewWindow*)" );
-#endif
       OnVisuException();
     }
   }
@@ -528,16 +507,12 @@ namespace SMESH
   void FitAll(){
     if(SVTK_ViewWindow* wnd = GetCurrentVtkView() ){
       try {
-#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
         OCC_CATCH_SIGNALS;
-#endif
         wnd->onFitAll();
         wnd->Repaint();
       }
       catch (...) {
-#ifdef _DEBUG_
         MESSAGE ( "Exception in SMESHGUI_VTKUtils::FitAll()" );
-#endif
         OnVisuException();
       }
     }
@@ -637,7 +612,7 @@ namespace SMESH
         }
       }
     }
-    MESSAGE("CreateActor " << anActor);
+    //MESSAGE("CreateActor " << anActor);
     if( anActor )
       if( SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI() )
         aSMESHGUI->addActorAsObserver( anActor );
@@ -648,26 +623,23 @@ namespace SMESH
   void DisplayActor( SUIT_ViewWindow *theWnd, SMESH_Actor* theActor){
     if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(theWnd)){
       try {
-#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
         OCC_CATCH_SIGNALS;
-#endif
-        MESSAGE("DisplayActor " << theActor);
+        //MESSAGE("DisplayActor " << theActor);
         vtkWnd->AddActor(theActor);
         vtkWnd->Repaint();
       }
       catch (...) {
-#ifdef _DEBUG_
         MESSAGE ( "Exception in SMESHGUI_VTKUtils::DisplayActor()" );
-#endif
         OnVisuException();
       }
     }
   }
 
 
-  void RemoveActor( SUIT_ViewWindow *theWnd, SMESH_Actor* theActor){
-    if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(theWnd)){
-        MESSAGE("RemoveActor " << theActor);
+  void RemoveActor( SUIT_ViewWindow *theWnd, SMESH_Actor* theActor)
+  {
+    if ( SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(theWnd)) {
+      //MESSAGE("RemoveActor " << theActor);
       vtkWnd->RemoveActor(theActor);
       if(theActor->hasIO()){
         Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
@@ -706,7 +678,7 @@ namespace SMESH
 
   bool UpdateView(SUIT_ViewWindow *theWnd, EDisplaing theAction, const char* theEntry)
   {
-        //MESSAGE("UpdateView");
+    //MESSAGE("UpdateView");
     bool OK = false;
     SVTK_ViewWindow* aViewWnd = GetVtkViewWindow(theWnd);
     if (!aViewWnd)
@@ -732,7 +704,7 @@ namespace SMESH
       case eDisplayAll: {
         while (vtkActor *anAct = aCollection->GetNextActor()) {
           if (SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)) {
-                MESSAGE("--- display " << anActor);
+            //MESSAGE("--- display " << anActor);
             anActor->SetVisibility(true);
 
             if(anActor->hasIO()){
@@ -750,7 +722,7 @@ namespace SMESH
         //MESSAGE("---case eDisplayOnly");
         while (vtkActor *anAct = aCollection->GetNextActor()) {
           if (SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)) {
-                //MESSAGE("--- erase " << anActor);
+            //MESSAGE("--- erase " << anActor);
             anActor->SetVisibility(false);
           }
         }
@@ -761,14 +733,14 @@ namespace SMESH
           switch (theAction) {
             case eDisplay:
             case eDisplayOnly:
-                //MESSAGE("--- display " << anActor);
+              //MESSAGE("--- display " << anActor);
               anActor->Update();
               anActor->SetVisibility(true);
               if (theAction == eDisplayOnly) aRenderer->ResetCameraClippingRange();
               aStudy->setVisibilityState(theEntry, Qtx::ShownState);
               break;
             case eErase:
-                //MESSAGE("--- erase " << anActor);
+              //MESSAGE("--- erase " << anActor);
               anActor->SetVisibility(false);
               aStudy->setVisibilityState(theEntry, Qtx::HiddenState);
               break;
@@ -779,7 +751,7 @@ namespace SMESH
           case eDisplay:
           case eDisplayOnly:
             {
-                //MESSAGE("---");
+              //MESSAGE("---");
               SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(theWnd->getViewManager()->study());
               _PTR(Study) aDocument = aStudy->studyDS();
               // Pass non-visual objects (hypotheses, etc.), return true in this case
@@ -810,7 +782,7 @@ namespace SMESH
 
 
   bool UpdateView(EDisplaing theAction, const char* theEntry) {
-        //MESSAGE("UpdateView");
+    //MESSAGE("UpdateView");
     SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( GetActiveStudy() );
     SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( aStudy->application() );
     if ( SUIT_ViewManager* vm = app->activeViewManager() )
index fd3daf555c0f3209d713feacf35a55971e25e68c..556212201577637d642265fd613a4cc9ecde78b8 100644 (file)
@@ -75,7 +75,7 @@ SMESH_File::~SMESH_File()
 
 bool SMESH_File::open()
 {
-  int length = size();
+  long length = size();
   if ( !_map && length > 0 )
   {
 #ifdef WIN32
@@ -188,7 +188,7 @@ long SMESH_File::size()
   boost::uintmax_t size = boofs::file_size( _name, err );
   _error = err.message();
 
-  return err ? -1 : (long) size;
+  return !err ? (long) size : -1;
 }
 
 //================================================================================
index e9881e030eebccf53eed77cc0b56efc2fa91d132..c30b69db160a7d7baf7f956b76102b06dd64962e 100644 (file)
@@ -109,7 +109,7 @@ public:
 private:
 
   std::string _name; //!< file name
-  int         _size; //!< file size
+  long        _size; //!< file size
   std::string _error;
 #ifdef WIN32
   HANDLE      _file, _mapObj;
index ccd11a0eca135bed908bdb0808639d617927fb52..0c386f09ae343a52be31b1ac275cfbcc033b0d65 100644 (file)
@@ -1416,7 +1416,7 @@ namespace
 #if OCC_VERSION_MAJOR < 7
       if ( !edgeIsSafe && !noSafeTShapes.insert((const Standard_Transient*) e.TShape() ).second )
 #else
-      if ( !edgeIsSafe && !noSafeTShapes.insert( _face.TShape().get() ).second )
+      if ( !edgeIsSafe && !noSafeTShapes.insert( e.TShape().get() ).second )
 #endif
         isSafe = false;
     }