33 #include "MeshKernel/Definitions.hpp"
34 #include "MeshKernel/Mesh2D.hpp"
35 #include "MeshKernel/Point.hpp"
66 static constexpr
UInt m_maximumNumberOfIrregularElementsAlongEdge = 5;
69 enum class MergeIndicator
77 using BoundedIntegerArray = std::array<UInt, m_maximumNumberOfIrregularElementsAlongEdge>;
80 using NodesToMerge = std::pair<UInt, UInt>;
83 struct IrregularEdgeInfo
86 BoundedIntegerArray hangingNodes{constants::missing::uintValue,
87 constants::missing::uintValue,
88 constants::missing::uintValue,
89 constants::missing::uintValue,
90 constants::missing::uintValue};
94 UInt startNode = constants::missing::uintValue;
96 UInt endNode = constants::missing::uintValue;
100 using IrregularEdgeInfoArray = std::vector<IrregularEdgeInfo>;
111 static void AreEdgesAdjacent(
const Mesh2D& mesh,
112 const double separationFraction,
124 static void GetQuadrilateralElementsOnDomainBoundary(
const Mesh2D& mesh,
125 std::vector<UInt>& elementsOnDomainBoundary,
126 std::vector<UInt>& edgesOnDomainBoundary);
135 static void GetOrderedDistanceFromPoint(
const Mesh2D& mesh,
136 const std::vector<UInt>& nodeIndices,
137 const UInt numberOfNodes,
139 BoundedIntegerArray& nearestNeighbours);
146 static std::unique_ptr<meshkernel::UndoAction> MergeNodes(Mesh2D& mesh,
const std::vector<NodesToMerge>& nodesToMerge, std::vector<MergeIndicator>& mergeIndicator);
154 [[nodiscard]]
static std::unique_ptr<meshkernel::UndoAction> FreeOneHangingNode(Mesh2D& mesh,
155 const BoundedIntegerArray& hangingNodes,
156 const UInt startNode,
167 [[nodiscard]]
static std::unique_ptr<meshkernel::UndoAction> FreeTwoHangingNodes(Mesh2D& mesh,
170 const BoundedIntegerArray& hangingNodes,
171 const UInt startNode,
182 [[nodiscard]]
static std::unique_ptr<meshkernel::UndoAction> FreeThreeHangingNodes(Mesh2D& mesh,
185 const BoundedIntegerArray& hangingNodes,
186 const UInt startNode,
197 [[nodiscard]]
static std::unique_ptr<meshkernel::UndoAction> FreeFourHangingNodes(Mesh2D& mesh,
200 const BoundedIntegerArray& hangingNodes,
201 const UInt startNode,
213 [[nodiscard]]
static std::unique_ptr<meshkernel::UndoAction> FreeHangingNodes(Mesh2D& mesh,
214 const UInt numberOfHangingNodes,
215 const std::vector<UInt>& hangingNodesOnEdge,
217 const Edge& boundaryEdge,
218 const Point& boundaryNode,
227 static void GatherHangingNodeIds(
const Mesh2D& mesh,
228 const double separationFraction,
229 const std::vector<UInt>& edgesOnDomainBoundary,
230 IrregularEdgeInfoArray& irregularEdges);
241 static void GatherNodesToMerge(
const UInt startNode,
243 const Edge& boundaryEdge,
244 std::vector<NodesToMerge>& nodesToMerge,
245 std::vector<MergeIndicator>& mergeIndicator);
255 static void GatherHangingNodes(
const UInt primaryStartNode,
256 const UInt primaryEndNode,
257 const Edge& irregularEdge,
258 std::vector<UInt>& hangingNodesOnEdge,
259 UInt& numberOfHangingNodes,
260 std::vector<MergeIndicator>& mergeIndicator);