]> SALOME platform Git repositories - modules/smesh.git/blobdiff - src/StdMeshers/StdMeshers_Cartesian_3D.cxx
Salome HOME
PR: synchro V6_main tag mergeto_V7_main_11Feb13
[modules/smesh.git] / src / StdMeshers / StdMeshers_Cartesian_3D.cxx
index b22843958ce647a57ac52b964290dbd3a426d25b..937c86806ba05bc6d30aa8a161bb05ed5154106a 100644 (file)
@@ -35,6 +35,7 @@
 
 #include "utilities.h"
 #include "Utils_ExceptHandlers.hxx"
+#include <Basics_OCCTVersion.hxx>
 
 #include <BRepAdaptor_Surface.hxx>
 #include <BRepBndLib.hxx>
 
 using namespace std;
 
+#ifdef _DEBUG_
 //#define _MY_DEBUG_
+#endif
 
-#define ELLIPSOLID_WORKAROUND // remove it as soon as http://tracker.dev.opencascade.org/view.php?id=22809 is solved
+#if OCC_VERSION_LARGE <= 0x06050300
+// workaround is required only for OCCT6.5.3 and older (see OCC22809)
+#define ELLIPSOLID_WORKAROUND
+#endif
 
 #ifdef ELLIPSOLID_WORKAROUND
 #include <BRepIntCurveSurface_Inter.hxx>
@@ -639,7 +645,7 @@ namespace
    */
   void Grid::ComputeNodes(SMESH_MesherHelper& helper)
   {
-    // state of each node of the grid relative to the geomerty
+    // state of each node of the grid relative to the geometry
     const size_t nbGridNodes = _coords[0].size() * _coords[1].size() * _coords[2].size();
     vector< bool > isNodeOut( nbGridNodes, false );
     _nodes.resize( nbGridNodes, 0 );
@@ -1610,7 +1616,7 @@ namespace
     intHexInd.resize( nbIntHex );
     tbb::parallel_for ( tbb::blocked_range<size_t>( 0, nbIntHex ),
                         ParallelHexahedron( intersectedHex, intHexInd ),
-                        tbb::simple_partitioner());
+                        tbb::simple_partitioner()); // ComputeElements() is called here
     for ( size_t i = 0; i < intHexInd.size(); ++i )
       if ( Hexahedron * hex = intersectedHex[ intHexInd[ i ]] )
         nbAdded += hex->addElements( helper );
@@ -1636,6 +1642,7 @@ namespace
    */
   int Hexahedron::addElements(SMESH_MesherHelper& helper)
   {
+    int nbAdded = 0;
     // add elements resulted from hexahedron intersection
     //for ( size_t i = 0; i < _volumeDefs.size(); ++i )
     {
@@ -1661,9 +1668,10 @@ namespace
           break;
         }
       }
+      nbAdded += int ( _volumeDefs._nodes.size() > 0 );
     }
 
-    return 1;//(int) _volumeDefs.size();
+    return nbAdded;
   }
   //================================================================================
   /*!
@@ -1915,6 +1923,9 @@ bool StdMeshers_Cartesian_3D::Compute(SMESH_Mesh &         theMesh,
   // - skip a cell, if it is too small according to the size threshold
   // - add a hexahedron in the mesh, if all nodes are inside
   // - add a polyhedron in the mesh, if some nodes are inside and some outside
+
+  _computeCanceled = false;
+
   try
   {
     Grid grid;
@@ -1960,6 +1971,7 @@ bool StdMeshers_Cartesian_3D::Compute(SMESH_Mesh &         theMesh,
 #endif
         }
     }
+    if ( _computeCanceled ) return false;
 
 #ifdef WITH_TBB
     { // copy partner faces and curves of not thread-safe types
@@ -1994,9 +2006,13 @@ bool StdMeshers_Cartesian_3D::Compute(SMESH_Mesh &         theMesh,
     helper.SetSubShape( solidExp.Current() );
     helper.SetElementsOnShape( true );
 
+    if ( _computeCanceled ) return false;
+
     // create nodes on the geometry
     grid.ComputeNodes(helper);
 
+    if ( _computeCanceled ) return false;
+
     // create volume elements
     Hexahedron hex( _hyp->GetSizeThreshold(), &grid );
     int nbAdded = hex.MakeElements( helper );