File indexing completed on 2025-01-18 10:03:13
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef _BRepMesh_CustomBaseMeshAlgo_HeaderFile
0017 #define _BRepMesh_CustomBaseMeshAlgo_HeaderFile
0018
0019 #include <BRepMesh_ConstrainedBaseMeshAlgo.hxx>
0020 #include <NCollection_Shared.hxx>
0021
0022 #include <BRepMesh_Delaun.hxx>
0023 #include <BRepMesh_MeshTool.hxx>
0024
0025
0026
0027
0028 class BRepMesh_CustomBaseMeshAlgo : public BRepMesh_ConstrainedBaseMeshAlgo
0029 {
0030 public:
0031
0032
0033 BRepMesh_CustomBaseMeshAlgo ()
0034 {
0035 }
0036
0037
0038 virtual ~BRepMesh_CustomBaseMeshAlgo ()
0039 {
0040 }
0041
0042 DEFINE_STANDARD_RTTIEXT(BRepMesh_CustomBaseMeshAlgo, BRepMesh_ConstrainedBaseMeshAlgo)
0043
0044 protected:
0045
0046
0047 virtual void generateMesh (const Message_ProgressRange& theRange) Standard_OVERRIDE
0048 {
0049 const Handle (BRepMesh_DataStructureOfDelaun)& aStructure = this->getStructure ();
0050 const Standard_Integer aNodesNb = aStructure->NbNodes ();
0051
0052 buildBaseTriangulation ();
0053
0054 std::pair<Standard_Integer, Standard_Integer> aCellsCount = this->getCellsCount (aStructure->NbNodes ());
0055 BRepMesh_Delaun aMesher (aStructure, aCellsCount.first, aCellsCount.second, Standard_False);
0056
0057 const Standard_Integer aNewNodesNb = aStructure->NbNodes ();
0058 const Standard_Boolean isRemoveAux = aNewNodesNb > aNodesNb;
0059 if (isRemoveAux)
0060 {
0061 IMeshData::VectorOfInteger aAuxVertices (aNewNodesNb - aNodesNb);
0062 for (Standard_Integer aExtNodesIt = aNodesNb + 1; aExtNodesIt <= aNewNodesNb; ++aExtNodesIt)
0063 {
0064 aAuxVertices.Append (aExtNodesIt);
0065 }
0066
0067
0068 aMesher.SetAuxVertices (aAuxVertices);
0069 }
0070
0071 aMesher.ProcessConstraints ();
0072
0073
0074 if (isRemoveAux)
0075 {
0076 aMesher.RemoveAuxElements ();
0077 }
0078
0079 BRepMesh_MeshTool aCleaner (aStructure);
0080 aCleaner.EraseFreeLinks ();
0081
0082 postProcessMesh (aMesher, theRange);
0083 }
0084
0085 protected:
0086
0087
0088 Standard_EXPORT virtual void buildBaseTriangulation() = 0;
0089 };
0090
0091 #endif