New classes BRepMesh_ConstrainedBaseMeshAlgo, BRepMesh_CustomBaseMeshAlgo and BRepMesh_CustomDelaunayBaseMeshAlgo are added.
These classes allow to add any custom triangulation algorithm to BRepMesh and perform post-processing and optimization of base mesh generated by those algorithms.
BRepMesh_Delaun: added possibility to process constraints when base mesh is generated by different algorithm.
BRepMesh_DelaunayNodeInsertionMeshAlgo: added PreProcessSurfaceNodes flag controlling addition of surface nodes (either before creation of base mesh or after) to gain maximum performance from triangulation algorithms.
Minor changes:
Use simple algorithm for cylinders when internal vertices mode is switched off to speed up computations.
BRepMesh_IncrementalMesh: added Perform method allowing to execute algorithm using manually created Context.
myFaceMax = theMax;
}
+ //! Retruns true if cell filter contains no circle.
+ inline Standard_Boolean IsEmpty () const
+ {
+ return mySelector.Circles ().IsEmpty ();
+ }
+
//! Binds the circle to the tool.
//! @param theIndex index a circle should be bound with.
//! @param theCircle circle to be bound.
--- /dev/null
+// Created on: 2019-07-08
+// Copyright (c) 2019 OPEN CASCADE SAS
+// Created by: Oleg AGASHIN
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _BRepMesh_ConstrainedBaseMeshAlgo_HeaderFile
+#define _BRepMesh_ConstrainedBaseMeshAlgo_HeaderFile
+
+#include <BRepMesh_BaseMeshAlgo.hxx>
+#include <NCollection_Shared.hxx>
+#include <IMeshTools_Parameters.hxx>
+
+class BRepMesh_DataStructureOfDelaun;
+class BRepMesh_Delaun;
+
+//! Class provides base fuctionality to build face triangulation using Dealunay approach.
+//! Performs generation of mesh using raw data from model.
+class BRepMesh_ConstrainedBaseMeshAlgo : public BRepMesh_BaseMeshAlgo
+{
+public:
+
+ //! Constructor.
+ BRepMesh_ConstrainedBaseMeshAlgo ()
+ {
+ }
+
+ //! Destructor.
+ virtual ~BRepMesh_ConstrainedBaseMeshAlgo ()
+ {
+ }
+
+ DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ConstrainedBaseMeshAlgo, BRepMesh_BaseMeshAlgo)
+
+protected:
+
+ //! Returns size of cell to be used by acceleration circles grid structure.
+ virtual std::pair<Standard_Integer, Standard_Integer> getCellsCount (const Standard_Integer /*theVerticesNb*/)
+ {
+ return std::pair<Standard_Integer, Standard_Integer> (-1, -1);
+ }
+
+ //! Perfroms processing of generated mesh.
+ //! By default does nothing.
+ //! Expected to be called from method generateMesh() in successor classes.
+ virtual void postProcessMesh (BRepMesh_Delaun& /*theMesher*/)
+ {
+ }
+};
+
+#endif
--- /dev/null
+// Created on: 2019-06-07
+// Copyright (c) 2019 OPEN CASCADE SAS
+// Created by: Oleg AGASHIN
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _BRepMesh_CustomBaseMeshAlgo_HeaderFile
+#define _BRepMesh_CustomBaseMeshAlgo_HeaderFile
+
+#include <BRepMesh_ConstrainedBaseMeshAlgo.hxx>
+#include <NCollection_Shared.hxx>
+#include <IMeshTools_Parameters.hxx>
+
+#include <BRepMesh_Delaun.hxx>
+#include <BRepMesh_MeshTool.hxx>
+
+class BRepMesh_DataStructureOfDelaun;
+
+//! Class provides base fuctionality to build face triangulation using custom triangulation algorithm.
+//! Performs generation of mesh using raw data from model.
+class BRepMesh_CustomBaseMeshAlgo : public BRepMesh_ConstrainedBaseMeshAlgo
+{
+public:
+
+ //! Constructor.
+ Standard_EXPORT BRepMesh_CustomBaseMeshAlgo ()
+ {
+ }
+
+ //! Destructor.
+ Standard_EXPORT virtual ~BRepMesh_CustomBaseMeshAlgo ()
+ {
+ }
+
+ DEFINE_STANDARD_RTTI_INLINE(BRepMesh_CustomBaseMeshAlgo, BRepMesh_ConstrainedBaseMeshAlgo)
+
+protected:
+
+ //! Generates mesh for the contour stored in data structure.
+ Standard_EXPORT virtual void generateMesh () Standard_OVERRIDE
+ {
+ const Handle (BRepMesh_DataStructureOfDelaun)& aStructure = this->getStructure ();
+ buildBaseTriangulation ();
+
+ std::pair<Standard_Integer, Standard_Integer> aCellsCount = this->getCellsCount (aStructure->NbNodes ());
+ BRepMesh_Delaun aMesher (aStructure, aCellsCount.first, aCellsCount.second, Standard_False);
+ aMesher.ProcessConstraints ();
+
+ BRepMesh_MeshTool aCleaner (aStructure);
+ aCleaner.EraseFreeLinks ();
+
+ postProcessMesh (aMesher);
+ }
+
+protected:
+
+ //! Builds base triangulation using custom triangulation algorithm.
+ Standard_EXPORT virtual void buildBaseTriangulation() = 0;
+};
+
+#endif
--- /dev/null
+// Created on: 2019-06-07
+// Copyright (c) 2019 OPEN CASCADE SAS
+// Created by: Oleg AGASHIN
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _BRepMesh_CustomDelaunayBaseMeshAlgo_HeaderFile
+#define _BRepMesh_CustomDelaunayBaseMeshAlgo_HeaderFile
+
+class BRepMesh_DataStructureOfDelaun;
+class BRepMesh_Delaun;
+
+//! Class provides base fuctionality to build face triangulation using custom
+//! triangulation algorithm with possibility to modify final mesh.
+//! Performs generation of mesh using raw data from model.
+template<class BaseAlgo>
+class BRepMesh_CustomDelaunayBaseMeshAlgo : public BaseAlgo
+{
+public:
+
+ //! Constructor.
+ BRepMesh_CustomDelaunayBaseMeshAlgo ()
+ {
+ }
+
+ //! Destructor.
+ virtual ~BRepMesh_CustomDelaunayBaseMeshAlgo ()
+ {
+ }
+
+protected:
+
+ //! Perfroms processing of generated mesh.
+ virtual void postProcessMesh(BRepMesh_Delaun& theMesher)
+ {
+ BaseAlgo::postProcessMesh (theMesher);
+
+ const Handle(BRepMesh_DataStructureOfDelaun)& aStructure = this->getStructure();
+ std::pair<Standard_Integer, Standard_Integer> aCellsCount = this->getCellsCount (aStructure->NbNodes());
+ theMesher.InitCirclesTool (aCellsCount.first, aCellsCount.second);
+ }
+};
+
+#endif
}
} // anonymous namespace
+//=======================================================================
+//function : BRepMesh_Delaun
+//purpose :
+//=======================================================================
+BRepMesh_Delaun::BRepMesh_Delaun (
+ const Handle(BRepMesh_DataStructureOfDelaun)& theOldMesh,
+ const Standard_Integer theCellsCountU,
+ const Standard_Integer theCellsCountV,
+ const Standard_Boolean isFillCircles)
+: myMeshData ( theOldMesh ),
+ myCircles (new NCollection_IncAllocator(
+ IMeshData::MEMORY_BLOCK_SIZE_HUGE))
+{
+ if (isFillCircles)
+ {
+ InitCirclesTool (theCellsCountU, theCellsCountV);
+ }
+}
+
//=======================================================================
//function : BRepMesh_Delaun
//purpose : Creates the triangulation with an empty Mesh data structure
const Handle(BRepMesh_DataStructureOfDelaun)& theOldMesh,
IMeshData::Array1OfVertexOfDelaun& theVertices)
: myMeshData( theOldMesh ),
- myCircles ( theVertices.Length(), theOldMesh->Allocator() )
+ myCircles ( theVertices.Length(), new NCollection_IncAllocator(
+ IMeshData::MEMORY_BLOCK_SIZE_HUGE))
{
if ( theVertices.Length() > 2 )
{
const Handle(BRepMesh_DataStructureOfDelaun)& theOldMesh,
IMeshData::VectorOfInteger& theVertexIndices)
: myMeshData( theOldMesh ),
- myCircles ( theVertexIndices.Length(), theOldMesh->Allocator() )
+ myCircles ( theVertexIndices.Length(), new NCollection_IncAllocator(
+ IMeshData::MEMORY_BLOCK_SIZE_HUGE))
{
perform(theVertexIndices);
}
const Standard_Integer theCellsCountU,
const Standard_Integer theCellsCountV)
: myMeshData (theOldMesh),
- myCircles (theVertexIndices.Length (), theOldMesh->Allocator ())
+ myCircles (theVertexIndices.Length (), new NCollection_IncAllocator(
+ IMeshData::MEMORY_BLOCK_SIZE_HUGE))
{
perform (theVertexIndices, theCellsCountU, theCellsCountV);
}
perform( aVertexIndexes );
}
+//=======================================================================
+//function : InitCirclesTool
+//purpose :
+//=======================================================================
+void BRepMesh_Delaun::InitCirclesTool (const Standard_Integer theCellsCountU,
+ const Standard_Integer theCellsCountV)
+{
+ Bnd_Box2d aBox;
+ for (Standard_Integer aNodeIt = 1; aNodeIt <= myMeshData->NbNodes(); ++aNodeIt)
+ {
+ aBox.Add (gp_Pnt2d (GetVertex (aNodeIt).Coord ()));
+ }
+ aBox.Enlarge (Precision);
+
+ initCirclesTool (aBox, theCellsCountU, theCellsCountV);
+
+ IMeshData::IteratorOfMapOfInteger aTriangleIt (myMeshData->ElementsOfDomain());
+ for (; aTriangleIt.More(); aTriangleIt.Next())
+ {
+ Standard_Integer aNodesIndices[3];
+ const BRepMesh_Triangle& aTriangle = myMeshData->GetElement (aTriangleIt.Key());
+ myMeshData->ElementNodes (aTriangle, aNodesIndices);
+ myCircles.Bind (aTriangleIt.Key(),
+ GetVertex( aNodesIndices[0] ).Coord(),
+ GetVertex( aNodesIndices[1] ).Coord(),
+ GetVertex( aNodesIndices[2] ).Coord());
+ }
+}
+
+//=======================================================================
+//function : initCirclesTool
+//purpose :
+//=======================================================================
+void BRepMesh_Delaun::initCirclesTool (const Bnd_Box2d& theBox,
+ const Standard_Integer theCellsCountU,
+ const Standard_Integer theCellsCountV)
+{
+ Standard_Real aMinX, aMinY, aMaxX, aMaxY;
+ theBox.Get ( aMinX, aMinY, aMaxX, aMaxY );
+ const Standard_Real aDeltaX = aMaxX - aMinX;
+ const Standard_Real aDeltaY = aMaxY - aMinY;
+
+ Standard_Integer aScaler = 2;
+ if ( myMeshData->NbNodes() > 100 )
+ {
+ aScaler = 5;
+ }
+ else if( myMeshData->NbNodes() > 1000 )
+ {
+ aScaler = 7;
+ }
+
+ myCircles.SetMinMaxSize( gp_XY( aMinX, aMinY ), gp_XY( aMaxX, aMaxY ) );
+ myCircles.SetCellSize ( aDeltaX / Max (theCellsCountU, aScaler),
+ aDeltaY / Max (theCellsCountV, aScaler));
+}
+
//=======================================================================
//function : perform
//purpose : Create super mesh and run triangulation procedure
aBox.Enlarge (Precision);
- Standard_Integer aScaler = 2;
- if ( myMeshData->NbNodes() > 100 )
- {
- aScaler = 5;
- }
- else if( myMeshData->NbNodes() > 1000 )
- {
- aScaler = 7;
- }
-
- superMesh (aBox, Max (theCellsCountU, aScaler),
- Max (theCellsCountV, aScaler));
+ initCirclesTool (aBox, theCellsCountU, theCellsCountV);
+ superMesh (aBox);
ComparatorOfIndexedVertexOfDelaun aCmp(myMeshData);
std::make_heap(theVertexIndices.begin(), theVertexIndices.end(), aCmp);
//function : superMesh
//purpose : Build the super mesh
//=======================================================================
-void BRepMesh_Delaun::superMesh(const Bnd_Box2d& theBox,
- const Standard_Integer theCellsCountU,
- const Standard_Integer theCellsCountV)
+void BRepMesh_Delaun::superMesh(const Bnd_Box2d& theBox)
{
Standard_Real aMinX, aMinY, aMaxX, aMaxY;
theBox.Get ( aMinX, aMinY, aMaxX, aMaxY );
Standard_Real aDeltaMax = Max( aDeltaX, aDeltaY );
Standard_Real aDelta = aDeltaX + aDeltaY;
- myCircles.SetMinMaxSize( gp_XY( aMinX, aMinY ), gp_XY( aMaxX, aMaxY ) );
- myCircles.SetCellSize( aDeltaX / theCellsCountU, aDeltaY / theCellsCountV);
-
mySupVert[0] = myMeshData->AddNode(
BRepMesh_Vertex( ( aMinX + aMaxX ) / 2, aMaxY + aDeltaMax, BRepMesh_Free ) );
void BRepMesh_Delaun::deleteTriangle(const Standard_Integer theIndex,
IMeshData::MapOfIntegerInteger& theLoopEdges )
{
- myCircles.Delete( theIndex );
+ if (!myCircles.IsEmpty())
+ {
+ myCircles.Delete (theIndex);
+ }
const BRepMesh_Triangle& aElement = GetTriangle(theIndex);
const Standard_Integer(&e)[3] = aElement.myEdges;
//=======================================================================
void BRepMesh_Delaun::compute(IMeshData::VectorOfInteger& theVertexIndexes)
{
- // Insertion of edges of super triangles in the list of free edges:
- IMeshData::MapOfIntegerInteger aLoopEdges(10, myMeshData->Allocator());
+ // Insertion of edges of super triangles in the list of free edges:
+ Handle(NCollection_IncAllocator) aAllocator = new NCollection_IncAllocator(
+ IMeshData::MEMORY_BLOCK_SIZE_HUGE);
+
+ IMeshData::MapOfIntegerInteger aLoopEdges(10, aAllocator);
const Standard_Integer(&e)[3] = mySupTrian.myEdges;
aLoopEdges.Bind( e[0], Standard_True );
}
}
- insertInternalEdges();
-
- // Adjustment of meshes to boundary edges
- frontierAdjust();
+ ProcessConstraints();
}
//=======================================================================
DEFINE_STANDARD_ALLOC
+ //! Creates instance of triangulator, but do not run the algorithm automatically.
+ Standard_EXPORT BRepMesh_Delaun (const Handle(BRepMesh_DataStructureOfDelaun)& theOldMesh,
+ const Standard_Integer theCellsCountU,
+ const Standard_Integer theCellsCountV,
+ const Standard_Boolean isFillCircles);
+
//! Creates the triangulation with an empty Mesh data structure.
Standard_EXPORT BRepMesh_Delaun (IMeshData::Array1OfVertexOfDelaun& theVertices);
//! Initializes the triangulation with an array of vertices.
Standard_EXPORT void Init (IMeshData::Array1OfVertexOfDelaun& theVertices);
+ //! Forces initialization of circles cell filter using working structure.
+ Standard_EXPORT void InitCirclesTool (const Standard_Integer theCellsCountU,
+ const Standard_Integer theCellsCountV);
+
//! Removes a vertex from the triangulation.
Standard_EXPORT void RemoveVertex (const BRepMesh_Vertex& theVertex);
return myMeshData;
}
+ //! Forces insertion of constraint edges into the base triangulation.
+ inline void ProcessConstraints()
+ {
+ insertInternalEdges();
+
+ // Adjustment of meshes to boundary edges
+ frontierAdjust();
+ }
+
//! Gives the list of frontier edges.
inline Handle(IMeshData::MapOfInteger) Frontier() const
{
typedef NCollection_DataMap<Standard_Integer, IMeshData::MapOfInteger> DataMapOfMap;
+ //! Performs initialization of circles cell filter tool.
+ void initCirclesTool (const Bnd_Box2d& theBox,
+ const Standard_Integer theCellsCountU,
+ const Standard_Integer theCellsCountV);
+
//! Add boundig box for edge defined by start & end point to
//! the given vector of bounding boxes for triangulation edges.
void fillBndBox (IMeshData::SequenceOfBndB2d& theBoxes,
const Standard_Integer theCellsCountV = -1);
//! Build the super mesh.
- void superMesh (const Bnd_Box2d& theBox,
- const Standard_Integer theCellsCountU,
- const Standard_Integer theCellsCountV);
+ void superMesh (const Bnd_Box2d& theBox);
//! Computes the triangulation and adds the vertices,
//! edges and triangles to the Mesh data structure.
#ifndef _BRepMesh_DelaunayBaseMeshAlgo_HeaderFile
#define _BRepMesh_DelaunayBaseMeshAlgo_HeaderFile
-#include <BRepMesh_BaseMeshAlgo.hxx>
+#include <BRepMesh_ConstrainedBaseMeshAlgo.hxx>
#include <NCollection_Shared.hxx>
#include <IMeshTools_Parameters.hxx>
//! Class provides base fuctionality to build face triangulation using Dealunay approach.
//! Performs generation of mesh using raw data from model.
-class BRepMesh_DelaunayBaseMeshAlgo : public BRepMesh_BaseMeshAlgo
+class BRepMesh_DelaunayBaseMeshAlgo : public BRepMesh_ConstrainedBaseMeshAlgo
{
public:
//! Destructor.
Standard_EXPORT virtual ~BRepMesh_DelaunayBaseMeshAlgo();
- DEFINE_STANDARD_RTTI_INLINE(BRepMesh_DelaunayBaseMeshAlgo, BRepMesh_BaseMeshAlgo)
+ DEFINE_STANDARD_RTTI_INLINE(BRepMesh_DelaunayBaseMeshAlgo, BRepMesh_ConstrainedBaseMeshAlgo)
protected:
- //! Returns size of cell to be used by acceleration circles grid structure.
- virtual std::pair<Standard_Integer, Standard_Integer> getCellsCount (const Standard_Integer /*theVerticesNb*/)
- {
- return std::pair<Standard_Integer, Standard_Integer> (-1, -1);
- }
-
//! Generates mesh for the contour stored in data structure.
Standard_EXPORT virtual void generateMesh() Standard_OVERRIDE;
-
- //! Perfroms processing of generated mesh.
- //! By default does nothing.
- virtual void postProcessMesh(BRepMesh_Delaun& /*theMesher*/)
- {
- }
};
#endif
//! Extends node insertion Delaunay meshing algo in order to control
//! deflection of generated trianges. Splits triangles failing the check.
-template<class RangeSplitter>
-class BRepMesh_DelaunayDeflectionControlMeshAlgo : public BRepMesh_DelaunayNodeInsertionMeshAlgo<RangeSplitter>
+template<class RangeSplitter, class BaseAlgo>
+class BRepMesh_DelaunayDeflectionControlMeshAlgo : public BRepMesh_DelaunayNodeInsertionMeshAlgo<RangeSplitter, BaseAlgo>
{
private:
// Typedef for OCCT RTTI
- typedef BRepMesh_DelaunayNodeInsertionMeshAlgo<RangeSplitter> DelaunayInsertionBaseClass;
+ typedef BRepMesh_DelaunayNodeInsertionMeshAlgo<RangeSplitter, BaseAlgo> DelaunayInsertionBaseClass;
public:
//! Extends base Delaunay meshing algo in order to enable possibility
//! of addition of free vertices and internal nodes into the mesh.
-template<class RangeSplitter>
-class BRepMesh_DelaunayNodeInsertionMeshAlgo : public BRepMesh_NodeInsertionMeshAlgo<RangeSplitter, BRepMesh_DelaunayBaseMeshAlgo>
+template<class RangeSplitter, class BaseAlgo>
+class BRepMesh_DelaunayNodeInsertionMeshAlgo : public BRepMesh_NodeInsertionMeshAlgo<RangeSplitter, BaseAlgo>
{
private:
// Typedef for OCCT RTTI
- typedef BRepMesh_NodeInsertionMeshAlgo<RangeSplitter, BRepMesh_DelaunayBaseMeshAlgo> InsertionBaseClass;
+ typedef BRepMesh_NodeInsertionMeshAlgo<RangeSplitter, BaseAlgo> InsertionBaseClass;
public:
//! Constructor.
BRepMesh_DelaunayNodeInsertionMeshAlgo()
+ : myIsPreProcessSurfaceNodes (Standard_False)
{
}
{
}
+ //! Returns PreProcessSurfaceNodes flag.
+ inline Standard_Boolean IsPreProcessSurfaceNodes () const
+ {
+ return myIsPreProcessSurfaceNodes;
+ }
+
+ //! Sets PreProcessSurfaceNodes flag.
+ //! If TRUE, registers surface nodes before generation of base mesh.
+ //! If FALSE, inserts surface nodes after generation of base mesh.
+ inline void SetPreProcessSurfaceNodes (const Standard_Boolean isPreProcessSurfaceNodes)
+ {
+ myIsPreProcessSurfaceNodes = isPreProcessSurfaceNodes;
+ }
+
protected:
+ //! Performs initialization of data structure using existing model data.
+ virtual Standard_Boolean initDataStructure() Standard_OVERRIDE
+ {
+ if (!InsertionBaseClass::initDataStructure())
+ {
+ return Standard_False;
+ }
+
+ if (myIsPreProcessSurfaceNodes)
+ {
+ const Handle(IMeshData::ListOfPnt2d) aSurfaceNodes =
+ this->getRangeSplitter().GenerateSurfaceNodes(this->getParameters());
+
+ registerSurfaceNodes (aSurfaceNodes);
+ }
+
+ return Standard_True;
+ }
+
//! Returns size of cell to be used by acceleration circles grid structure.
virtual std::pair<Standard_Integer, Standard_Integer> getCellsCount (const Standard_Integer theVerticesNb) Standard_OVERRIDE
{
{
InsertionBaseClass::postProcessMesh(theMesher);
- const Handle(IMeshData::ListOfPnt2d) aSurfaceNodes =
- this->getRangeSplitter().GenerateSurfaceNodes(this->getParameters());
+ if (!myIsPreProcessSurfaceNodes)
+ {
+ const Handle(IMeshData::ListOfPnt2d) aSurfaceNodes =
+ this->getRangeSplitter().GenerateSurfaceNodes(this->getParameters());
- insertNodes(aSurfaceNodes, theMesher);
+ insertNodes(aSurfaceNodes, theMesher);
+ }
}
//! Inserts nodes into mesh.
theMesher.AddVertices(aVertexIndexes);
return !aVertexIndexes.IsEmpty();
}
+
+private:
+
+ //! Registers surface nodes in data structure.
+ Standard_Boolean registerSurfaceNodes(
+ const Handle(IMeshData::ListOfPnt2d)& theNodes)
+ {
+ if (theNodes.IsNull() || theNodes->IsEmpty())
+ {
+ return Standard_False;
+ }
+
+ Standard_Boolean isAdded = Standard_False;
+ IMeshData::ListOfPnt2d::Iterator aNodesIt(*theNodes);
+ for (Standard_Integer aNodeIt = 1; aNodesIt.More(); aNodesIt.Next(), ++aNodeIt)
+ {
+ const gp_Pnt2d& aPnt2d = aNodesIt.Value();
+ if (this->getClassifier()->Perform(aPnt2d) == TopAbs_IN)
+ {
+ isAdded = Standard_True;
+ this->registerNode(this->getRangeSplitter().Point(aPnt2d),
+ aPnt2d, BRepMesh_Free, Standard_False);
+ }
+ }
+
+ return isAdded;
+ }
+
+private:
+
+ Standard_Boolean myIsPreProcessSurfaceNodes;
};
#endif
Handle(BRepMesh_FaceChecker::ArrayOfBndBoxTree)& myWiresBndBoxTree;
};
- //! Selector.
- //! Used to identify segments with overlapped bounding boxes.
//! Selector.
//! Used to identify segments with overlapped bounding boxes.
class BndBox2dTreeSelector : public IMeshData::BndBox2dTree::Selector
//purpose :
//=======================================================================
void BRepMesh_IncrementalMesh::Perform()
+{
+ Handle(BRepMesh_Context) aContext = new BRepMesh_Context;
+ Perform (aContext);
+}
+
+//=======================================================================
+//function : Perform
+//purpose :
+//=======================================================================
+void BRepMesh_IncrementalMesh::Perform(const Handle(IMeshTools_Context)& theContext)
{
initParameters();
- Handle(BRepMesh_Context) aContext = new BRepMesh_Context;
- aContext->SetShape(Shape());
- aContext->ChangeParameters() = myParameters;
- aContext->ChangeParameters().CleanModel = Standard_False;
+ theContext->SetShape(Shape());
+ theContext->ChangeParameters() = myParameters;
+ theContext->ChangeParameters().CleanModel = Standard_False;
- IMeshTools_MeshBuilder aIncMesh(aContext);
+ IMeshTools_MeshBuilder aIncMesh(theContext);
aIncMesh.Perform();
myStatus = IMeshData_NoError;
- const Handle(IMeshData_Model)& aModel = aContext->GetModel();
+ const Handle(IMeshData_Model)& aModel = theContext->GetModel();
for (Standard_Integer aFaceIt = 0; aFaceIt < aModel->FacesNb(); ++aFaceIt)
{
const IMeshData::IFaceHandle& aDFace = aModel->GetFace(aFaceIt);
#include <BRepMesh_DiscretRoot.hxx>
#include <IMeshTools_Parameters.hxx>
+#include <IMeshTools_Context.hxx>
//! Builds the mesh of a shape with respect of their
//! correctly triangulated parts
Standard_EXPORT BRepMesh_IncrementalMesh(const TopoDS_Shape& theShape,
const IMeshTools_Parameters& theParameters);
-//! Performs meshing ot the shape.
+ //! Performs meshing ot the shape.
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
+
+ //! Performs meshing using custom context;
+ Standard_EXPORT void Perform(const Handle(IMeshTools_Context)& theContext);
public: //! @name accessing to parameters.
template<class RangeSplitter>
struct NodeInsertionMeshAlgo
{
- typedef BRepMesh_DelaunayNodeInsertionMeshAlgo<RangeSplitter> Type;
+ typedef BRepMesh_DelaunayNodeInsertionMeshAlgo<RangeSplitter, BRepMesh_DelaunayBaseMeshAlgo> Type;
};
template<class RangeSplitter>
struct DeflectionControlMeshAlgo
{
- typedef BRepMesh_DelaunayDeflectionControlMeshAlgo<RangeSplitter> Type;
+ typedef BRepMesh_DelaunayDeflectionControlMeshAlgo<RangeSplitter, BRepMesh_DelaunayBaseMeshAlgo> Type;
};
}
break;
case GeomAbs_Cylinder:
- return new NodeInsertionMeshAlgo<BRepMesh_CylinderRangeSplitter>::Type;
+ return theParameters.InternalVerticesMode ?
+ new NodeInsertionMeshAlgo<BRepMesh_CylinderRangeSplitter>::Type :
+ new BaseMeshAlgo::Type;
break;
case GeomAbs_Cone:
BRepMesh_BaseMeshAlgo.cxx
BRepMesh_BaseMeshAlgo.hxx
+BRepMesh_ConstrainedBaseMeshAlgo.hxx
BRepMesh_BoundaryParamsRangeSplitter.hxx
BRepMesh_Circle.hxx
BRepMesh_CircleInspector.hxx
BRepMesh_Vertex.hxx
BRepMesh_VertexInspector.hxx
BRepMesh_VertexTool.cxx
-BRepMesh_VertexTool.hxx
\ No newline at end of file
+BRepMesh_VertexTool.hxx
+BRepMesh_CustomBaseMeshAlgo.hxx
+BRepMesh_CustomDelaunayBaseMeshAlgo.hxx