File indexing completed on 2026-09-15 09:15:11
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 class BRepMesh_CustomBaseMeshAlgo : public BRepMesh_ConstrainedBaseMeshAlgo
0028 {
0029 public:
0030
0031 BRepMesh_CustomBaseMeshAlgo() = default;
0032
0033
0034 ~BRepMesh_CustomBaseMeshAlgo() override = default;
0035
0036 DEFINE_STANDARD_RTTIEXT(BRepMesh_CustomBaseMeshAlgo, BRepMesh_ConstrainedBaseMeshAlgo)
0037
0038 protected:
0039
0040 void generateMesh(const Message_ProgressRange& theRange) override
0041 {
0042 const occ::handle<BRepMesh_DataStructureOfDelaun>& aStructure = this->getStructure();
0043 const int aNodesNb = aStructure->NbNodes();
0044
0045 buildBaseTriangulation();
0046
0047 std::pair<int, int> aCellsCount = this->getCellsCount(aStructure->NbNodes());
0048 BRepMesh_Delaun aMesher(aStructure, aCellsCount.first, aCellsCount.second, false);
0049
0050 const int aNewNodesNb = aStructure->NbNodes();
0051 const bool isRemoveAux = aNewNodesNb > aNodesNb;
0052 if (isRemoveAux)
0053 {
0054 IMeshData::VectorOfInteger aAuxVertices(aNewNodesNb - aNodesNb);
0055 for (int aExtNodesIt = aNodesNb + 1; aExtNodesIt <= aNewNodesNb; ++aExtNodesIt)
0056 {
0057 aAuxVertices.Append(aExtNodesIt);
0058 }
0059
0060
0061 aMesher.SetAuxVertices(aAuxVertices);
0062 }
0063
0064 aMesher.ProcessConstraints();
0065
0066
0067
0068 if (isRemoveAux)
0069 {
0070 aMesher.RemoveAuxElements();
0071 }
0072
0073 BRepMesh_MeshTool aCleaner(aStructure);
0074 aCleaner.EraseFreeLinks();
0075
0076 postProcessMesh(aMesher, theRange);
0077 }
0078
0079 protected:
0080
0081 Standard_EXPORT virtual void buildBaseTriangulation() = 0;
0082 };
0083
0084 #endif