0025304: Visualization, TKOpenGl - support texturing within built-in GLSL programs
[occt.git] / src / BRepMesh / BRepMesh_IncrementalMesh.cxx
CommitLineData
b311480e 1// Created on: 1995-06-20
2// Created by: Stagiaire Alain JOURDAIN
3// Copyright (c) 1995-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
9bdafcbe 17#include <BRepMesh_IncrementalMesh.hxx>
7fd59977 18
fc9b36d6 19#include <Precision.hxx>
ceb418e1 20#include <Standard_ErrorHandler.hxx>
fc9b36d6 21
22#include <BRepMesh_FaceChecker.hxx>
23#include <BRepMesh_ShapeTool.hxx>
7fd59977 24#include <BRepMesh_Edge.hxx>
0b97567d 25#include <BRepMesh_PluginMacro.hxx>
7fd59977 26
27#include <Bnd_Box.hxx>
28#include <BRep_Builder.hxx>
29#include <BRep_Tool.hxx>
9bdafcbe 30#include <BRepTools.hxx>
7fd59977 31#include <BRepLib.hxx>
32#include <BRepBndLib.hxx>
33#include <BRepAdaptor_Curve.hxx>
fc9b36d6 34
35#include <Poly_Triangulation.hxx>
36#include <Poly_Polygon3D.hxx>
37#include <Poly_PolygonOnTriangulation.hxx>
38
39#include <TopoDS.hxx>
40#include <TopoDS_Edge.hxx>
41#include <TopoDS_Face.hxx>
42#include <TopoDS_Shape.hxx>
43#include <TopAbs.hxx>
7fd59977 44#include <TopExp.hxx>
45#include <TopExp_Explorer.hxx>
fc9b36d6 46
7fd59977 47#include <TopTools_ListIteratorOfListOfShape.hxx>
48#include <TColgp_Array1OfPnt.hxx>
ceb418e1 49#include <TColgp_Array1OfPnt2d.hxx>
7fd59977 50#include <TColStd_Array1OfReal.hxx>
7fd59977 51#include <TopTools_HArray1OfShape.hxx>
ceb418e1 52#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
fc9b36d6 53
54#include <GCPnts_TangentialDeflection.hxx>
7fd59977 55
7fd59977 56#ifdef HAVE_TBB
0b97567d
K
57 // paralleling using Intel TBB
58 #include <tbb/parallel_for_each.h>
7fd59977 59#endif
60
0b97567d
K
61namespace
62{
63 //! Default flag to control parallelization for BRepMesh_IncrementalMesh
64 //! tool returned for Mesh Factory
65 static Standard_Boolean IS_IN_PARALLEL = Standard_False;
66};
67
9bdafcbe 68IMPLEMENT_STANDARD_HANDLE (BRepMesh_IncrementalMesh, BRepMesh_DiscretRoot)
69IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_IncrementalMesh, BRepMesh_DiscretRoot)
70
71//=======================================================================
fc9b36d6 72//function : Default constructor
9bdafcbe 73//purpose :
74//=======================================================================
fc9b36d6 75BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh()
0b97567d 76: myRelative (Standard_False),
9bdafcbe 77 myInParallel (Standard_False)
7fd59977 78{
7fd59977 79}
80
81//=======================================================================
fc9b36d6 82//function : Constructor
7fd59977 83//purpose :
84//=======================================================================
fc9b36d6 85BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh(
86 const TopoDS_Shape& theShape,
14434f3e 87 const Standard_Real theLinDeflection,
88 const Standard_Boolean isRelative,
89 const Standard_Real theAngDeflection,
90 const Standard_Boolean isInParallel)
91 : myRelative (isRelative),
92 myInParallel(isInParallel)
7fd59977 93{
ceb418e1 94 myDeflection = theLinDeflection;
95 myAngle = theAngDeflection;
96 myShape = theShape;
97
0b97567d 98 Perform();
7fd59977 99}
100
101//=======================================================================
fc9b36d6 102//function : Destructor
7fd59977 103//purpose :
104//=======================================================================
fc9b36d6 105BRepMesh_IncrementalMesh::~BRepMesh_IncrementalMesh()
7fd59977 106{
107}
108
109//=======================================================================
2caff0b3 110//function : clear
111//purpose :
112//=======================================================================
113void BRepMesh_IncrementalMesh::clear()
114{
115 myEmptyEdges.Clear();
116 myEdgeDeflection.Clear();
117 myFaces.Clear();
118 myMesh.Nullify();
119}
120
121//=======================================================================
fc9b36d6 122//function : init
7fd59977 123//purpose :
124//=======================================================================
fc9b36d6 125void BRepMesh_IncrementalMesh::init()
7fd59977 126{
fc9b36d6 127 myStatus = 0;
9bdafcbe 128 myModified = Standard_False;
7fd59977 129
fc9b36d6 130 setDone();
2caff0b3 131 clear();
9bdafcbe 132
133 if (!isCorrectPolyData())
134 BRepTools::Clean(myShape);
135
7fd59977 136 Bnd_Box aBox;
fc9b36d6 137 BRepBndLib::Add(myShape, aBox, Standard_False);
138
139 if (aBox.IsVoid())
140 {
141 // Nothing to mesh.
fc9b36d6 142 return;
8e3006e4 143 }
fc9b36d6 144
145 BRepMesh_ShapeTool::BoxMaxDimension(aBox, myMaxShapeSize);
fc9b36d6 146
ceb418e1 147 myMesh = new BRepMesh_FastDiscret(myDeflection, myAngle, aBox,
fc9b36d6 148 Standard_True, Standard_True, myRelative, Standard_True, myInParallel);
ceb418e1 149
150 myMesh->InitSharedFaces(myShape);
7fd59977 151}
152
8e3006e4 153//=======================================================================
fc9b36d6 154//function : isCorrectPolyData
8e3006e4
O
155//purpose :
156//=======================================================================
fc9b36d6 157Standard_Boolean BRepMesh_IncrementalMesh::isCorrectPolyData()
8e3006e4 158{
fc9b36d6 159 collectFaces();
160
161 BRepMesh_FaceChecker aFaceChecker(myInParallel);
162
163#ifdef HAVE_TBB
164 if (myInParallel)
165 {
166 // check faces in parallel threads using TBB
167 tbb::parallel_for_each(myFaces.begin(), myFaces.end(), aFaceChecker);
168 }
169 else
170 {
171#endif
2caff0b3 172 NCollection_Vector<TopoDS_Face>::Iterator aFaceIt(myFaces);
173 for (; aFaceIt.More(); aFaceIt.Next())
174 aFaceChecker(aFaceIt.Value());
fc9b36d6 175#ifdef HAVE_TBB
176 }
177#endif
178
179 return aFaceChecker.IsValid();
8e3006e4 180}
7fd59977 181
182//=======================================================================
9bdafcbe 183//function : collectFaces
184//purpose :
185//=======================================================================
186void BRepMesh_IncrementalMesh::collectFaces()
187{
188 TopTools_ListOfShape aFaceList;
189 BRepLib::ReverseSortFaces(myShape, aFaceList);
190 TopTools_MapOfShape aFaceMap;
9bdafcbe 191
192 // make array of faces suitable for processing (excluding faces without surface)
193 TopLoc_Location aDummyLoc;
194 const TopLoc_Location aEmptyLoc;
195 TopTools_ListIteratorOfListOfShape aFaceIter(aFaceList);
196 for (; aFaceIter.More(); aFaceIter.Next())
197 {
198 TopoDS_Shape aFaceNoLoc = aFaceIter.Value();
199 aFaceNoLoc.Location(aEmptyLoc);
200 if (!aFaceMap.Add (aFaceNoLoc))
201 continue; // already processed
202
203 TopoDS_Face aFace = TopoDS::Face(aFaceIter.Value());
204 const Handle(Geom_Surface)& aSurf = BRep_Tool::Surface(aFace, aDummyLoc);
205 if (aSurf.IsNull())
206 continue;
207
2caff0b3 208 myFaces.Append(aFace);
9bdafcbe 209 }
210}
211
212//=======================================================================
fc9b36d6 213//function : Perform
214//purpose :
7fd59977 215//=======================================================================
fc9b36d6 216void BRepMesh_IncrementalMesh::Perform()
7fd59977 217{
fc9b36d6 218 init();
7fd59977 219
ceb418e1 220 if (myMesh.IsNull())
7fd59977 221 return;
0d36f7e4 222
fc9b36d6 223 update();
224}
225
226//=======================================================================
227//function : update()
228//purpose :
229//=======================================================================
230void BRepMesh_IncrementalMesh::update()
231{
232 // Update edges data
233 TopExp_Explorer aExplorer(myShape, TopAbs_EDGE);
234 for (; aExplorer.More(); aExplorer.Next())
235 {
236 const TopoDS_Edge& aEdge = TopoDS::Edge(aExplorer.Current());
237 if(!BRep_Tool::IsGeometric(aEdge))
238 continue;
239
240 update(aEdge);
7fd59977 241 }
242
fc9b36d6 243 // Update faces data
2caff0b3 244 NCollection_Vector<TopoDS_Face>::Iterator aFaceIt(myFaces);
245 for (; aFaceIt.More(); aFaceIt.Next())
246 update(aFaceIt.Value());
7fd59977 247
fc9b36d6 248 // Mesh faces
249#ifdef HAVE_TBB
0b97567d
K
250 if (myInParallel)
251 {
ceb418e1 252 tbb::parallel_for_each(myFaces.begin(), myFaces.end(), *myMesh);
0b97567d 253 }
7fd59977 254 else
0b97567d 255 {
fc9b36d6 256#endif
2caff0b3 257 for (aFaceIt.Init(myFaces); aFaceIt.More(); aFaceIt.Next())
258 myMesh->Process(aFaceIt.Value());
fc9b36d6 259#ifdef HAVE_TBB
0b97567d 260 }
fc9b36d6 261#endif
7fd59977 262
ceb418e1 263 commit();
2caff0b3 264 clear();
fc9b36d6 265}
7fd59977 266
fc9b36d6 267//=======================================================================
268//function : discretizeFreeEdges
269//purpose :
270//=======================================================================
271void BRepMesh_IncrementalMesh::discretizeFreeEdges()
272{
273 TopExp_Explorer aExplorer(myShape ,TopAbs_EDGE, TopAbs_FACE);
274 for (; aExplorer.More(); aExplorer.Next())
275 {
276 const TopoDS_Edge& aEdge = TopoDS::Edge(aExplorer.Current());
277 if(!BRep_Tool::IsGeometric(aEdge))
7fd59977 278 continue;
7fd59977 279
fc9b36d6 280 TopLoc_Location aLoc;
281 Standard_Real aEdgeDeflection = edgeDeflection(aEdge);
282 Handle(Poly_Polygon3D) aPoly3D = BRep_Tool::Polygon3D(aEdge, aLoc);
283 if (!aPoly3D.IsNull() && aPoly3D->Deflection() < 1.1 * aEdgeDeflection)
284 continue;
285
286 BRepAdaptor_Curve aCurve(aEdge);
287 GCPnts_TangentialDeflection aDiscret(aCurve, aCurve.FirstParameter(),
288 aCurve.LastParameter(), myAngle, aEdgeDeflection, 2);
289
290 Standard_Integer aNodesNb = aDiscret.NbPoints();
291 TColgp_Array1OfPnt aNodes (1, aNodesNb);
292 TColStd_Array1OfReal aUVNodes(1, aNodesNb);
293 for (Standard_Integer i = 1; i <= aNodesNb; ++i)
294 {
295 aNodes (i) = aDiscret.Value(i);
296 aUVNodes(i) = aDiscret.Parameter(i);
7fd59977 297 }
fc9b36d6 298
299 aPoly3D = new Poly_Polygon3D(aNodes, aUVNodes);
300 aPoly3D->Deflection(myDeflection);
7fd59977 301
fc9b36d6 302 BRep_Builder aBuilder;
303 aBuilder.UpdateEdge(aEdge, aPoly3D);
7fd59977 304 }
0b97567d
K
305}
306
7fd59977 307//=======================================================================
fc9b36d6 308//function : edgeDeflection
309//purpose :
7fd59977 310//=======================================================================
fc9b36d6 311Standard_Real BRepMesh_IncrementalMesh::edgeDeflection(
312 const TopoDS_Edge& theEdge)
7fd59977 313{
fc9b36d6 314 if (myEdgeDeflection.IsBound(theEdge))
315 return myEdgeDeflection(theEdge);
7fd59977 316
fc9b36d6 317 Standard_Real aEdgeDeflection;
318 if (myRelative)
319 {
320 Standard_Real aScale;
321 aEdgeDeflection = BRepMesh_ShapeTool::RelativeEdgeDeflection(theEdge,
322 myDeflection, myMaxShapeSize, aScale);
323 }
324 else
325 aEdgeDeflection = myDeflection;
326
327 myEdgeDeflection.Bind(theEdge, aEdgeDeflection);
328 return aEdgeDeflection;
7fd59977 329}
330
fc9b36d6 331//=======================================================================
332//function : faceDeflection
333//purpose :
334//=======================================================================
335Standard_Real BRepMesh_IncrementalMesh::faceDeflection(
336 const TopoDS_Face& theFace)
337{
338 if (!myRelative)
339 return myDeflection;
340
341 Standard_Integer aEdgesNb = 0;
342 Standard_Real aFaceDeflection = 0.;
343
344 TopExp_Explorer aEdgeIt(theFace, TopAbs_EDGE);
345 for (; aEdgeIt.More(); aEdgeIt.Next(), ++aEdgesNb)
346 {
347 const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Current());
348 aFaceDeflection += edgeDeflection(aEdge);
349 }
350
351 return (aEdgesNb == 0) ? myDeflection : (aFaceDeflection / aEdgesNb);
352}
7fd59977 353
354//=======================================================================
fc9b36d6 355//function : update(edge)
356//purpose :
7fd59977 357//=======================================================================
fc9b36d6 358void BRepMesh_IncrementalMesh::update(const TopoDS_Edge& theEdge)
7fd59977 359{
fc9b36d6 360 Standard_Integer aPolyIndex = 1;
361 Standard_Real aEdgeDeflection = edgeDeflection(theEdge);
362 Handle(Poly_PolygonOnTriangulation) aPolygon;
363 do
364 {
365 TopLoc_Location aLoc;
366 Handle(Poly_Triangulation) aTriangulation;
367 BRep_Tool::PolygonOnTriangulation(theEdge, aPolygon,
368 aTriangulation, aLoc, aPolyIndex++);
369
370 if (!aTriangulation.IsNull() && !aPolygon.IsNull())
371 {
ceb418e1 372 if (aPolygon->Deflection() < 1.1 * aEdgeDeflection &&
373 aPolygon->HasParameters())
374 {
fc9b36d6 375 continue;
ceb418e1 376 }
80d659a5 377 else
378 {
379 // Check that triangulation relies to face of the given shape.
380 const TopTools_IndexedDataMapOfShapeListOfShape& aMapOfSharedFaces =
381 myMesh->SharedFaces();
382
383 const TopTools_ListOfShape& aSharedFaces =
384 aMapOfSharedFaces.FindFromKey(theEdge);
385
386 Standard_Boolean isCurrentShape = Standard_False;
387 TopTools_ListIteratorOfListOfShape aSharedFaceIt(aSharedFaces);
388 for (; aSharedFaceIt.More() && !isCurrentShape; aSharedFaceIt.Next())
389 {
390 TopLoc_Location aLoc;
391 const TopoDS_Face& aFace = TopoDS::Face(aSharedFaceIt.Value());
392 Handle(Poly_Triangulation) aFaceTriangulation =
393 BRep_Tool::Triangulation(aFace, aLoc);
394
395 isCurrentShape = (aFaceTriangulation == aTriangulation);
396 }
397
398 if (!isCurrentShape)
399 continue;
400 }
fc9b36d6 401
402 myModified = Standard_True;
403 BRepMesh_ShapeTool::NullifyEdge(theEdge, aTriangulation, aLoc);
7fd59977 404 }
fc9b36d6 405
406 if (!myEmptyEdges.IsBound(theEdge))
848fa7e3 407 myEmptyEdges.Bind(theEdge, BRepMesh::MapOfTriangulation());
fc9b36d6 408
ceb418e1 409 if (!aTriangulation.IsNull())
410 myEmptyEdges(theEdge).Add(aTriangulation);
7fd59977 411 }
fc9b36d6 412 while (!aPolygon.IsNull());
413}
7fd59977 414
fc9b36d6 415//=======================================================================
416//function : isToBeMeshed
417//purpose :
418//=======================================================================
419Standard_Boolean BRepMesh_IncrementalMesh::toBeMeshed(
420 const TopoDS_Face& theFace,
421 const Standard_Boolean isWithCheck)
422{
423 TopLoc_Location aLoc;
80d659a5 424 const Handle(Poly_Triangulation)& aTriangulation =
fc9b36d6 425 BRep_Tool::Triangulation(theFace, aLoc);
426
427 if (aTriangulation.IsNull())
428 return Standard_True;
429
430 if (isWithCheck)
ab58a62b 431 {
fc9b36d6 432 Standard_Real aFaceDeflection = faceDeflection(theFace);
433 if (aTriangulation->Deflection() < 1.1 * aFaceDeflection)
ab58a62b 434 {
fc9b36d6 435 Standard_Boolean isEdgesConsistent = Standard_True;
436 TopExp_Explorer aEdgeIt(theFace, TopAbs_EDGE);
437 for (; aEdgeIt.More() && isEdgesConsistent; aEdgeIt.Next())
ab58a62b 438 {
fc9b36d6 439 const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Current());
440 if (!myEmptyEdges.IsBound(aEdge))
441 continue;
442
848fa7e3 443 BRepMesh::MapOfTriangulation& aTriMap = myEmptyEdges(aEdge);
ceb418e1 444 isEdgesConsistent &= !aTriMap.IsEmpty() && !aTriMap.Contains(aTriangulation);
7fd59977 445 }
fc9b36d6 446
447 if (isEdgesConsistent)
448 return Standard_False;
ab58a62b 449 }
7fd59977 450 }
451
fc9b36d6 452 // Nullify edges
453 TopExp_Explorer aEdgeIt(theFace, TopAbs_EDGE);
454 for (; aEdgeIt.More(); aEdgeIt.Next())
455 {
456 const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Current());
457 BRepMesh_ShapeTool::NullifyEdge(aEdge, aTriangulation, aLoc);
458 }
7fd59977 459
fc9b36d6 460 BRepMesh_ShapeTool::NullifyFace(theFace);
461 return Standard_True;
462}
7fd59977 463
fc9b36d6 464//=======================================================================
465//function : update(face)
466//purpose :
467//=======================================================================
468void BRepMesh_IncrementalMesh::update(const TopoDS_Face& theFace)
469{
470 if (!toBeMeshed(theFace, Standard_True))
471 return;
472
473 myModified = Standard_True;
ceb418e1 474 Standard_Integer aStatus = myMesh->Add(theFace);
fc9b36d6 475
ceb418e1 476 myStatus |= aStatus;
fc9b36d6 477 if (aStatus != BRepMesh_ReMesh)
478 return;
479
848fa7e3 480 BRepMesh::MapOfShape aUsedFaces;
fc9b36d6 481 aUsedFaces.Add(theFace);
482
ceb418e1 483 const TopTools_IndexedDataMapOfShapeListOfShape& aMapOfSharedFaces =
484 myMesh->SharedFaces();
485
fc9b36d6 486 TopExp_Explorer aEdgeIt(theFace, TopAbs_EDGE);
487 for (; aEdgeIt.More(); aEdgeIt.Next())
488 {
489 const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Current());
ceb418e1 490 if (aMapOfSharedFaces.FindIndex(aEdge) == 0)
fc9b36d6 491 continue;
492
ceb418e1 493 const TopTools_ListOfShape& aSharedFaces = aMapOfSharedFaces.FindFromKey(aEdge);
fc9b36d6 494 TopTools_ListIteratorOfListOfShape aSharedFaceIt(aSharedFaces);
495 for (; aSharedFaceIt.More(); aSharedFaceIt.Next())
496 {
497 const TopoDS_Face& aFace = TopoDS::Face(aSharedFaceIt.Value());
498 if (aUsedFaces.Contains(aFace))
499 continue;
500
501 aUsedFaces.Add(aFace);
502 toBeMeshed(aFace, Standard_False);
503
ceb418e1 504 myStatus |= myMesh->Add(aFace);
505 }
506 }
507}
508
509//=======================================================================
510//function : commit
511//purpose :
512//=======================================================================
513void BRepMesh_IncrementalMesh::commit()
514{
2caff0b3 515 NCollection_Vector<TopoDS_Face>::Iterator aFaceIt(myFaces);
516 for (; aFaceIt.More(); aFaceIt.Next())
517 commitEdges(aFaceIt.Value());
ceb418e1 518
519 discretizeFreeEdges();
520}
521
522//=======================================================================
fcf15f5c 523//function : commitEdges
ceb418e1 524//purpose :
525//=======================================================================
fcf15f5c 526void BRepMesh_IncrementalMesh::commitEdges(const TopoDS_Face& theFace)
ceb418e1 527{
528 TopoDS_Face aFace = theFace;
529 aFace.Orientation(TopAbs_FORWARD);
530
531 Handle(BRepMesh_FaceAttribute) aFaceAttribute;
532 if (!myMesh->GetFaceAttribute(aFace, aFaceAttribute))
533 return;
534
ceb418e1 535 if (!aFaceAttribute->IsValid())
536 {
537 myStatus |= aFaceAttribute->GetStatus();
538 return;
539 }
540
80d659a5 541 TopLoc_Location aLoc;
fcf15f5c 542 Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation(aFace, aLoc);
543
544 if (aTriangulation.IsNull())
fcf15f5c 545 return;
ceb418e1 546
547 try
548 {
549 OCC_CATCH_SIGNALS
550
ceb418e1 551 // Store discretization of edges
848fa7e3 552 BRepMesh::HDMapOfShapePairOfPolygon& aInternalEdges = aFaceAttribute->ChangeInternalEdges();
553 BRepMesh::DMapOfShapePairOfPolygon::Iterator aEdgeIt(*aInternalEdges);
ceb418e1 554 for (; aEdgeIt.More(); aEdgeIt.Next())
555 {
556 const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Key());
557 const BRepMesh_PairOfPolygon& aPolyPair = aEdgeIt.Value();
558 const Handle(Poly_PolygonOnTriangulation)& aPolygon1 = aPolyPair.First();
559 const Handle(Poly_PolygonOnTriangulation)& aPolygon2 = aPolyPair.Last();
560
ceb418e1 561 if (aPolygon1 == aPolygon2)
fcf15f5c 562 BRepMesh_ShapeTool::UpdateEdge(aEdge, aPolygon1, aTriangulation, aLoc);
ceb418e1 563 else
fcf15f5c 564 BRepMesh_ShapeTool::UpdateEdge(aEdge, aPolygon1, aPolygon2, aTriangulation, aLoc);
ceb418e1 565 }
566 }
567 catch (Standard_Failure)
568 {
569 myStatus |= BRepMesh_Failure;
7fd59977 570 }
571}
0b97567d
K
572
573//=======================================================================
574//function : Discret
575//purpose :
576//=======================================================================
fc9b36d6 577Standard_Integer BRepMesh_IncrementalMesh::Discret(
578 const TopoDS_Shape& theShape,
579 const Standard_Real theDeflection,
580 const Standard_Real theAngle,
ceb418e1 581 BRepMesh_DiscretRoot* &theAlgo)
0b97567d
K
582{
583 BRepMesh_IncrementalMesh* anAlgo = new BRepMesh_IncrementalMesh();
fc9b36d6 584 anAlgo->SetDeflection(theDeflection);
585 anAlgo->SetAngle (theAngle);
586 anAlgo->SetShape (theShape);
587 anAlgo->SetParallel (IS_IN_PARALLEL);
0b97567d
K
588 theAlgo = anAlgo;
589 return 0; // no error
590}
591
592//=======================================================================
593//function : IsParallelDefault
594//purpose :
595//=======================================================================
596Standard_Boolean BRepMesh_IncrementalMesh::IsParallelDefault()
597{
598#ifdef HAVE_TBB
599 return IS_IN_PARALLEL;
600#else
601 // no alternative parallelization yet - flag has no meaning
602 return Standard_False;
603#endif
604}
605
606//=======================================================================
607//function : Discret
608//purpose :
609//=======================================================================
fc9b36d6 610void BRepMesh_IncrementalMesh::SetParallelDefault(
611 const Standard_Boolean theInParallel)
0b97567d
K
612{
613 IS_IN_PARALLEL = theInParallel;
614}
615
616//! Export Mesh Plugin entry function
617DISCRETPLUGIN(BRepMesh_IncrementalMesh)