X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FSMESH%2FSMESH_Gen.cxx;h=4a020890e93a29e92dd8c2cb91c4cf7642b045ad;hb=3802af125181492680c38adf526421e398f7bd2a;hp=2a7e23af9cc1f9ab51a698f5bcae72fec78a0582;hpb=b60e215be81a131a861b11b5d778c5cd47b21459;p=modules%2Fsmesh.git diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx index 2a7e23af9..4a020890e 100644 --- a/src/SMESH/SMESH_Gen.cxx +++ b/src/SMESH/SMESH_Gen.cxx @@ -25,9 +25,8 @@ // Author : Paul RASCLE, EDF // Module : SMESH // - //#define CHRONODEF - +// #include "SMESH_Gen.hxx" #include "SMESH_DriverMesh.hxx" @@ -37,6 +36,8 @@ #include "SMESHDS_Document.hxx" #include "SMESH_HypoFilter.hxx" #include "SMESH_Mesh.hxx" +#include "SMESH_SequentialMesh.hxx" +#include "SMESH_ParallelMesh.hxx" #include "SMESH_MesherHelper.hxx" #include "SMESH_subMesh.hxx" @@ -56,10 +57,15 @@ #include +#ifndef WIN32 +#include +#endif + using namespace std; +#ifndef WIN32 #include -#include namespace fs = boost::filesystem; +#endif // Environment variable separator #ifdef WIN32 @@ -151,7 +157,8 @@ SMESH_Mesh* SMESH_Gen::CreateMesh(bool theIsEmbeddedMode) Unexpect aCatch(SalomeException); // create a new SMESH_mesh object - SMESH_Mesh *aMesh = new SMESH_Mesh(_localId++, + SMESH_Mesh *aMesh = new SMESH_SequentialMesh( + _localId++, this, theIsEmbeddedMode, _studyContext->myDocument); @@ -160,6 +167,27 @@ SMESH_Mesh* SMESH_Gen::CreateMesh(bool theIsEmbeddedMode) return aMesh; } +//============================================================================= +/*! + * Creates a parallel mesh in a study. + * if (theIsEmbeddedMode) { mesh modification commands are not logged } + */ +//============================================================================= + +SMESH_Mesh* SMESH_Gen::CreateParallelMesh(bool theIsEmbeddedMode) +{ + Unexpect aCatch(SalomeException); + + // create a new SMESH_mesh object + SMESH_Mesh *aMesh = new SMESH_ParallelMesh( + _localId++, + this, + theIsEmbeddedMode, + _studyContext->myDocument); + _studyContext->mapMesh[_localId-1] = aMesh; + + return aMesh; +} //============================================================================= /*! @@ -197,7 +225,7 @@ bool SMESH_Gen::sequentialComputeSubMeshes( continue; // check for preview dimension limitations - if ( aShapesId && GetShapeDim( shapeType ) > (int)aDim ) + if ( aShapesId && SMESH_Gen::GetShapeDim( shapeType ) > (int)aDim ) { // clear compute state not to show previous compute errors // if preview invoked less dimension less than previous @@ -240,7 +268,7 @@ const std::function - compute_function([&] (SMESH_subMesh* sm, + compute_function([] (SMESH_subMesh* sm, SMESH_subMesh::compute_event event, SMESH_subMesh *shapeSM, bool aShapeOnly, @@ -261,6 +289,7 @@ const std::function (int)aDim ) + if ( aShapesId && SMESH_Gen::GetShapeDim( shapeType ) > (int)aDim ) { // clear compute state not to show previous compute errors // if preview invoked less dimension less than previous smToCompute->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE ); continue; } - boost::asio::post(*(aMesh._pool), std::bind(compute_function, smToCompute, computeEvent, + boost::asio::post(*(aMesh.GetPool()), std::bind(compute_function, smToCompute, computeEvent, shapeSM, aShapeOnly, allowedSubShapes, aShapesId)); } @@ -359,9 +386,9 @@ bool SMESH_Gen::parallelComputeSubMeshes( aMesh.GetMeshDS()->Modified(); return ret; +#endif }; - //============================================================================= /* * Compute a mesh @@ -408,22 +435,14 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, // =============================================== // Mesh all the sub-shapes starting from vertices // =============================================== - if (aMesh.IsParallel()) - ret = parallelComputeSubMeshes( - aMesh, aShape, aDim, - aShapesId, allowedSubShapes, - computeEvent, - includeSelf, - complexShapeFirst, - aShapeOnly); - else - ret = sequentialComputeSubMeshes( - aMesh, aShape, aDim, - aShapesId, allowedSubShapes, - computeEvent, - includeSelf, - complexShapeFirst, - aShapeOnly); + ret = aMesh.ComputeSubMeshes( + this, + aMesh, aShape, aDim, + aShapesId, allowedSubShapes, + computeEvent, + includeSelf, + complexShapeFirst, + aShapeOnly); return ret; }