diff --git a/src/BRepMesh/BRepMesh_IncrementalMesh.cdl b/src/BRepMesh/BRepMesh_IncrementalMesh.cdl index f717fe3f61..f145a28631 100755 --- a/src/BRepMesh/BRepMesh_IncrementalMesh.cdl +++ b/src/BRepMesh/BRepMesh_IncrementalMesh.cdl @@ -44,10 +44,11 @@ is returns IncrementalMesh from BRepMesh; ---C++: alias "Standard_EXPORT virtual ~BRepMesh_IncrementalMesh();" - Create (S : Shape from TopoDS; - D : Real from Standard; - Relatif : Boolean from Standard = Standard_False; - Ang : Real from Standard = 0.5) + Create (S : Shape from TopoDS; + D : Real from Standard; + Relatif : Boolean from Standard = Standard_False; + Ang : Real from Standard = 0.5; + InParallel : Boolean from Standard = Standard_False) returns IncrementalMesh from BRepMesh; ---Purpose: If the boolean is True, the -- deflection used for the polygonalisation of diff --git a/src/BRepMesh/BRepMesh_IncrementalMesh.cxx b/src/BRepMesh/BRepMesh_IncrementalMesh.cxx index d4246b7934..8c3aa81c88 100755 --- a/src/BRepMesh/BRepMesh_IncrementalMesh.cxx +++ b/src/BRepMesh/BRepMesh_IncrementalMesh.cxx @@ -86,9 +86,10 @@ BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh() BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh (const TopoDS_Shape& theShape, const Standard_Real theDeflection, const Standard_Boolean theRelative, - const Standard_Real theAngle) + const Standard_Real theAngle, + const Standard_Boolean theInParallel) : myRelative (theRelative), - myInParallel (Standard_False), + myInParallel (theInParallel), myModified (Standard_False), myStatus (0) { diff --git a/src/MeshTest/MeshTest.cxx b/src/MeshTest/MeshTest.cxx index ecab187972..956c2833a0 100755 --- a/src/MeshTest/MeshTest.cxx +++ b/src/MeshTest/MeshTest.cxx @@ -189,13 +189,28 @@ static Standard_Integer planesection(Draw_Interpretor&, Standard_Integer nbarg, static Standard_Integer incrementalmesh(Draw_Interpretor& di, Standard_Integer nbarg, const char** argv) { - if (nbarg < 3) return 1; + if (nbarg < 3) { + di << " use incmesh shape deflection [inParallel (0/1) : 0 by default]\n"; + return 0; + } - Standard_Real d = atof(argv[2]); - TopoDS_Shape S = DBRep::Get(argv[1]); - if (S.IsNull()) return 1; + TopoDS_Shape aShape = DBRep::Get(argv[1]); + if (aShape.IsNull()) { + di << " null shapes is not allowed here\n"; + return 0; + } + Standard_Real aDeflection = atof(argv[2]); - BRepMesh_IncrementalMesh MESH(S,d); + Standard_Boolean isInParallel = Standard_False; + if (nbarg == 4) { + isInParallel = atoi(argv[3]) == 1; + } + di << "Incremental Mesh, multi-threading " + << (isInParallel ? "ON\n" : "OFF\n"); + + Standard::SetReentrant(isInParallel); + + BRepMesh_IncrementalMesh MESH(aShape, aDeflection, Standard_False, 0.5, isInParallel); Standard_Integer statusFlags = MESH.GetStatusFlags(); di << "Meshing statuses: "; @@ -1597,7 +1612,7 @@ void MeshTest::Commands(Draw_Interpretor& theCommands) theCommands.Add("shpsec","shpsec result shape shape",__FILE__, shapesection, g); theCommands.Add("plnsec","plnsec result shape plane",__FILE__, planesection, g); - theCommands.Add("incmesh","incmesh shape deflection",__FILE__, incrementalmesh, g); + theCommands.Add("incmesh","incmesh shape deflection [inParallel (0/1) : 0 by default]",__FILE__, incrementalmesh, g); theCommands.Add("MemLeakTest","MemLeakTest",__FILE__, MemLeakTest, g); theCommands.Add("fastdiscret","fastdiscret shape deflection [shared [nbiter]]",__FILE__, fastdiscret, g); theCommands.Add("mesh","mesh result Shape deflection [save partage]",__FILE__, triangule, g); diff --git a/src/QAAMINO/QAAMINO.cxx b/src/QAAMINO/QAAMINO.cxx index ebc578c92a..6c620c91c5 100755 --- a/src/QAAMINO/QAAMINO.cxx +++ b/src/QAAMINO/QAAMINO.cxx @@ -191,7 +191,7 @@ static Standard_Integer OCC1048 (Draw_Interpretor& di, Standard_Integer argc, co Standard_Real theDeflection = 0.006; Handle(StlMesh_Mesh) theStlMesh = new StlMesh_Mesh; - StlTransfer::BuildIncrementalMesh(aShape, theDeflection, theStlMesh); + StlTransfer::BuildIncrementalMesh(aShape, theDeflection, Standard_False, theStlMesh); Standard_Integer NBTRIANGLES = theStlMesh->NbTriangles(); di<<"Info: Number of triangles = "< #include #include -#include +#include #include #include #include @@ -113,15 +113,16 @@ static void Normal(const TopoDS_Face& aFace, } void StlTransfer::BuildIncrementalMesh (const TopoDS_Shape& Shape, - const Standard_Real Deflection, - const Handle(StlMesh_Mesh)& Mesh) + const Standard_Real Deflection, + const Standard_Boolean InParallel, + const Handle(StlMesh_Mesh)& Mesh) { if (Deflection <= Precision::Confusion ()) { Standard_ConstructionError::Raise ("StlTransfer::BuildIncrementalMesh"); } Standard_Integer NbVertices, NbTriangles; - BRepMesh::Mesh (Shape, Deflection); + BRepMesh_IncrementalMesh aMesher(Shape, Deflection, Standard_False, 0.5, InParallel); for (TopExp_Explorer itf(Shape,TopAbs_FACE); itf.More(); itf.Next()) { TopoDS_Face face = TopoDS::Face(itf.Current()); TopLoc_Location Loc, loc; diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx index d10ab17dd9..d6dd714002 100755 --- a/src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx +++ b/src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx @@ -89,15 +89,24 @@ static Standard_Integer writestl (Draw_Interpretor& di, Standard_Integer argc, const char** argv) { - if (argc<3 || argc>4) di << "Use: " << argv[0] << "shape file [ascii/binary (0/1) : 1 by default]" << "\n"; - else { - TopoDS_Shape shape = DBRep::Get(argv[1]); + if (argc < 3 || argc > 5) { + di << "Use: " << argv[0] + << " shape file [ascii/binary (0/1) : 1 by default] [InParallel (0/1) : 0 by default]" << "\n"; + } else { + TopoDS_Shape aShape = DBRep::Get(argv[1]); Standard_Boolean anASCIIMode = Standard_False; + Standard_Boolean isInParallel = Standard_False; if (argc==4) { Standard_Integer mode = atoi(argv[3]); if (mode==0) anASCIIMode = Standard_True; } - StlAPI::Write(shape, argv[2],anASCIIMode); + if (argc==5) { + isInParallel = atoi(argv[4]) == 1; + Standard::SetReentrant(isInParallel); + } + StlAPI_Writer aWriter; + aWriter.ASCIIMode() = anASCIIMode; + aWriter.Write (aShape, argv[2], isInParallel); } return 0; } @@ -961,7 +970,7 @@ void XSDRAWSTLVRML::InitCommands (Draw_Interpretor& theCommands) //XSDRAW::LoadDraw(theCommands); theCommands.Add ("writevrml", "shape file",__FILE__,writevrml,g); - theCommands.Add ("writestl", "shape file [ascii/binary (0/1) : 1 by default]",__FILE__,writestl,g); + theCommands.Add ("writestl", "shape file [ascii/binary (0/1) : 1 by default] [InParallel (0/1) : 0 by default]",__FILE__,writestl,g); theCommands.Add ("readstl", "shape file",__FILE__,readstl,g); theCommands.Add ("loadvrml" , "shape file",__FILE__,loadvrml,g); theCommands.Add ("storevrml" , "shape file defl [type]",__FILE__,storevrml,g);