Salome HOME
"viscous layer 3d around foil"
[modules/smesh.git] / src / SMESH / SMESH_subMesh.cxx
index 7f96a76fdb0505717158b8b207d4f0c7e13f8058..df1c1b70cc14929a2712e29fcd806bf009c80844 100644 (file)
@@ -385,9 +385,9 @@ int SMESH_subMesh::computeCost() const
     int computeCost;
     switch ( _subShape.ShapeType() ) {
     case TopAbs_SOLID:
-    case TopAbs_SHELL: computeCost = 1000; break;
-    case TopAbs_FACE:  computeCost = 100; break;
-    case TopAbs_EDGE:  computeCost = 10; break;
+    case TopAbs_SHELL: computeCost = 5000; break;
+    case TopAbs_FACE:  computeCost = 500; break;
+    case TopAbs_EDGE:  computeCost = 2; break;
     default:           computeCost = 1;
     }
     SMESH_subMeshIteratorPtr childIt = getDependsOnIterator(/*includeSelf=*/false);
@@ -1561,6 +1561,9 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
         }
         // Compute
 
+        // to restore cout that may be redirected by algo
+        std::streambuf* coutBuffer = std::cout.rdbuf();
+
         //cleanDependants(); for "UseExisting_*D" algos
         //removeSubMeshElementsAndNodes();
         loadDependentMeshes();
@@ -1568,9 +1571,8 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
         _computeState = FAILED_TO_COMPUTE;
         _computeError = SMESH_ComputeError::New(COMPERR_OK,"",algo);
         try {
-#if OCC_VERSION_LARGE > 0x06010000
           OCC_CATCH_SIGNALS;
-#endif
+
           algo->InitComputeError();
 
           MemoryReserve aMemoryReserve;
@@ -1641,6 +1643,8 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
           else
             ret = false;
         }
+        std::cout.rdbuf( coutBuffer ); // restore cout that could be redirected by algo
+
         // check if an error reported on any sub-shape
         bool isComputeErrorSet = !checkComputeError( algo, ret, shape );
         if ( isComputeErrorSet )
@@ -1650,7 +1654,10 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
         if (ret)
         {
           for (; ret && subS.More(); subS.Next())
-            ret = _father->GetSubMesh( subS.Current() )->IsMeshComputed();
+            if ( !_father->GetSubMesh( subS.Current() )->IsMeshComputed() &&
+                 ( _subShape.ShapeType() != TopAbs_EDGE ||
+                   !algo->isDegenerated( TopoDS::Edge( subS.Current() ))))
+              ret = false;
         }
         // Set _computeError
         if (!ret && !isComputeErrorSet)
@@ -2281,7 +2288,7 @@ void SMESH_subMesh::setEventListener(EventListener*     listener,
         EventListenerData* curData = l_d->second;
         if ( curData && curData != data && curData->IsDeletable() )
           delete curData;
-        if ( l_d->first->IsDeletable() )
+        if ( l_d->first != listener && l_d->first->IsDeletable() )
           delete l_d->first;
         _eventListeners.erase( l_d );
         break;