Salome HOME
comment unnecessary call
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_ComputeDlg.cxx
index f5a901582db8ae988e1543a5bb803fb513e8c86c..8ceb87a5b538526e65c4ace37e29b3affef017ac 100644 (file)
@@ -1,7 +1,4 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
@@ -19,6 +16,7 @@
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 // File   : SMESHGUI_ComputeDlg.cxx
 // Author : Edward AGAPOV, Open CASCADE S.A.S.
 // SMESH includes
 
 #define COLONIZE(str)   (QString(str).contains(":") > 0 ? QString(str) : QString(str) + " :" )
 
+/* OBSOLETE
 static void addSeparator( QWidget* parent )
 {
   QGridLayout* l = qobject_cast<QGridLayout*>( parent->layout() );
@@ -111,6 +110,7 @@ static void addSeparator( QWidget* parent )
     l->addWidget( hline, row, i );
   }
 }
+*/
 
 enum TCol {
   COL_ALGO = 0, COL_SHAPE, COL_ERROR, COL_SHAPEID, COL_PUBLISHED, COL_BAD_MESH, NB_COLUMNS
@@ -343,7 +343,6 @@ namespace SMESH
       CASE2TEXT( COMPERR_EXCEPTION     );
       CASE2TEXT( COMPERR_MEMORY_PB     );
       CASE2TEXT( COMPERR_BAD_SHAPE     );
-      CASE2TEXT( COMPERR_BAD_FACE      );
     case SMESH::COMPERR_ALGO_FAILED:
       if ( strlen(comment) == 0 )
         text = QObject::tr("COMPERR_ALGO_FAILED");
@@ -701,11 +700,17 @@ void SMESHGUI_BaseComputeOp::computeMesh()
     if ( errors->length() > 0 ) {
       aHypErrors = SMESH::GetMessageOnAlgoStateErrors( errors.in() );
     }
+    if ( myMesh->HasModificationsToDiscard() && // issue 0020693
+         SUIT_MessageBox::question( desktop(), tr( "SMESH_WARNING" ),
+                                    tr( "FULL_RECOMPUTE_QUESTION" ),
+                                    tr( "SMESH_BUT_YES" ), tr( "SMESH_BUT_NO" ), 1, 0 ) == 0 )
+      myMesh->Clear();
     SUIT_OverrideCursor aWaitCursor;
     try {
 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
       OCC_CATCH_SIGNALS;
 #endif
+      //SMESH::UpdateNulData(myIObject, true);
       if (gen->Compute(myMesh, myMainShape))
         computeFailed = false;
     }
@@ -732,25 +737,38 @@ void SMESHGUI_BaseComputeOp::computeMesh()
 
       // SHOW MESH
       // NPAL16631: if ( getSMESHGUI()->automaticUpdate() )
-      if ( !memoryLack && getSMESHGUI()->automaticUpdate() )
+      SUIT_ResourceMgr* resMgr = SMESH::GetResourceMgr( SMESHGUI::GetSMESHGUI() );
+      long newSize = myMesh->NbElements();
+      long limitSize = resMgr->integerValue( "SMESH", "update_limit", 500000 );
+      bool limitExceeded;
+      if ( !memoryLack )
       {
-        try {
+        if ( getSMESHGUI()->automaticUpdate( newSize, &limitExceeded ) )
+        {
+          try {
 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
-          OCC_CATCH_SIGNALS;
+            OCC_CATCH_SIGNALS;
 #endif
-          SMESH::Update(myIObject, true);
-        }
-        catch (...) {
+            SMESH::Update(myIObject, true);
+          }
+          catch (...) {
 #ifdef _DEBUG_
-          MESSAGE ( "Exception thrown during mesh visualization" );
+            MESSAGE ( "Exception thrown during mesh visualization" );
 #endif
-          if ( SMDS_Mesh::CheckMemory(true) ) { // has memory to show warning?
-            SMESH::OnVisuException();
-          }
-          else {
-            memoryLack = true;
+            if ( SMDS_Mesh::CheckMemory(true) ) { // has memory to show warning?
+              SMESH::OnVisuException();
+            }
+            else {
+              memoryLack = true;
+            }
           }
         }
+        else if ( limitExceeded )
+        {
+          SUIT_MessageBox::warning( desktop(),
+                                    tr( "SMESH_WRN_WARNING" ),
+                                    tr( "SMESH_WRN_SIZE_LIMIT_EXCEEDED" ).arg( newSize ).arg( limitSize ) );
+        }
       }
       LightApp_SelectionMgr *Sel = selectionMgr();
       if ( Sel )
@@ -802,7 +820,7 @@ void SMESHGUI_BaseComputeOp::computeMesh()
 void SMESHGUI_BaseComputeOp::showComputeResult( const bool theMemoryLack,
                                                 const bool theNoCompError,
                                                 SMESH::compute_error_array_var& theCompErrors,
-                                                const bool     theNoHypoError,
+                                                const bool theNoHypoError,
                                                 const QString& theHypErrors )
 {
   bool hasShape = myMesh->HasShapeToMesh();
@@ -830,7 +848,7 @@ void SMESHGUI_BaseComputeOp::showComputeResult( const bool theMemoryLack,
   {
     QTableWidget* tbl = aCompDlg->myTable;
     SMESH::long_array_var aRes = myMesh->GetMeshInfo();
-    aCompDlg->myFullInfo->SetMeshInfo( aRes );
+    aCompDlg->myBriefInfo->SetMeshInfo( aRes );
     aCompDlg->myBriefInfo->show();
     aCompDlg->myFullInfo->hide();
 
@@ -1560,6 +1578,7 @@ void SMESHGUI_PrecomputeOp::onPreview()
       
     SMESH::MeshPreviewStruct_var previewData =
       gen->Precompute(myMesh, myMainShape, (SMESH::Dimension)dim, aShapesId);
+
     SMESH::MeshPreviewStruct* previewRes = previewData._retn();
     if ( previewRes && previewRes->nodesXYZ.length() > 0 )
     {