X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH%2FSMESH_subMesh.cxx;h=bc3aa8792e0dfa6789bd966c8cfa0298d2ca9c5e;hb=d328a1d7b8ebcd3d3f02ea9996d56d50016be3a4;hp=ae22959495f11b75eab0f1e126ef5f0507cd4986;hpb=640594fef60ebbc9c623a99a76fff8a8662f9dc7;p=modules%2Fsmesh.git diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index ae2295949..bc3aa8792 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -37,6 +37,7 @@ #include "SMESH_Mesh.hxx" #include "SMESH_MesherHelper.hxx" #include "SMESH_subMeshEventListener.hxx" +#include "SMESH_MeshLocker.hxx" #include "utilities.h" #include "Basics_Utils.hxx" @@ -62,10 +63,9 @@ using namespace std; #ifdef _DEBUG_ // enable printing algo + shape id + hypo used while meshing -//#define PRINT_WHO_COMPUTE_WHAT +#define PRINT_WHO_COMPUTE_WHAT #endif -//#define PRINT_WHO_COMPUTE_WHAT //============================================================================= /*! * \brief Allocate some memory at construction and release it at destruction. @@ -1393,16 +1393,13 @@ bool SMESH_subMesh::ComputeStateEngine(compute_event event) else if (( event == COMPUTE || event == COMPUTE_SUBMESH ) && !_alwaysComputed ) { - // LOCK: Adding node to mesh - _father->Lock(); + SMESH_MeshLocker myLocker(_father); const TopoDS_Vertex & V = TopoDS::Vertex( _subShape ); gp_Pnt P = BRep_Tool::Pnt(V); if ( SMDS_MeshNode * n = _father->GetMeshDS()->AddNode(P.X(), P.Y(), P.Z()) ) { _father->GetMeshDS()->SetNodeOnVertex(n,_Id); _computeState = COMPUTE_OK; } - _father->Unlock(); - // UNLOCK } if ( event == MODIF_ALGO_STATE ) cleanDependants(); @@ -1516,11 +1513,10 @@ bool SMESH_subMesh::ComputeStateEngine(compute_event event) break; } TopoDS_Shape shape = _subShape; - _father->Lock(); - algo->SubMeshesToCompute().assign( 1, this ); - _father->Unlock(); + algo->setSubMeshesToCompute(this); // check submeshes needed - // In parallel there would be no submesh to check + // When computing in parallel mode we do not have a additional layer of submesh + // The check should not be done in parallel as that check is not thread-safe if (_father->HasShapeToMesh() && !_father->IsParallel()) { bool subComputed = false, subFailed = false; if (!algo->OnlyUnaryInput()) { @@ -1650,10 +1646,9 @@ bool SMESH_subMesh::ComputeStateEngine(compute_event event) #ifdef PRINT_WHO_COMPUTE_WHAT for (subS.ReInit(); subS.More(); subS.Next()) { - _father->Lock(); + SMESH_MeshLocker myLocker(_father); const std::list & hyps = - _algo->GetUsedHypothesis( *_father, _subShape ); - _father->Unlock(); + _algo->GetUsedHypothesis( *_father, _subShape ); SMESH_Comment hypStr; if ( !hyps.empty() ) { @@ -1907,7 +1902,7 @@ bool SMESH_subMesh::ComputeStateEngine(compute_event event) break; } - //notifyListenersOnEvent( event, COMPUTE_EVENT ); + notifyListenersOnEvent( event, COMPUTE_EVENT ); return ret; }