33 #include "MeshKernel/Mesh2D.hpp"
34 #include "MeshKernel/Polygons.hpp"
35 #include "MeshKernel/UndoActions/UndoAction.hpp"
46 [[nodiscard]]
static std::unique_ptr<UndoAction>
Compute(
Mesh2D& mesh);
61 static constexpr
UInt maxIterationCount = 1000;
64 static constexpr
UInt maximumSize = 1000;
71 enum class ElementType
82 static bool ElementIsSeed(
const Mesh2D& mesh,
83 const std::vector<int>& nodeTypes,
87 static UInt FindElementSeedIndex(
const Mesh2D& mesh,
88 const std::vector<int>& nodeTypes);
91 static void FindDirectlyConnectedCells(
const Mesh2D& mesh,
93 std::vector<UInt>& connected);
96 static void FindIndirectlyConnectedCells(
const Mesh2D& mesh,
98 const std::vector<UInt>& directlyConnected,
99 std::vector<UInt>& indirectlyConnected);
102 static void FindAdjacentCells(
const Mesh2D& mesh,
103 const std::vector<UInt>& directlyConnected,
104 const std::vector<UInt>& indirectlyConnected,
105 std::vector<std::array<int, 2>>& kne);
108 static void FindSurroundingCells(
const Mesh2D& mesh,
109 const UInt elementId,
110 std::vector<UInt>& directlyConnected,
111 std::vector<UInt>& indirectlyConnected,
112 std::vector<std::array<int, 2>>& kne);
115 static std::vector<ElementType> InitialiseElementType(
const Mesh2D& mesh,
116 const std::vector<int>& nodeTypes);
119 static bool ElementCannotBeDeleted(
const Mesh2D& mesh,
120 const std::vector<int>& nodeTypes,
122 const UInt elementId);
125 static Point ComputeNewNodeCoordinates(
const Mesh2D& mesh,
126 const std::vector<int>& nodeTypes,
130 [[nodiscard]]
static bool UpdateDirectlyConnectedElements(
Mesh2D& mesh,
131 const UInt elementId,
132 const std::vector<UInt>& directlyConnected,
133 const std::vector<std::array<int, 2>>& kne);
136 static bool UpdateDirectlyConnectedTriangleElements(
Mesh2D& mesh,
138 const UInt connectedElementId,
139 const std::vector<std::array<int, 2>>& kne);
144 static void UpdateDirectlyConnectedNonTriangleElements(
Mesh2D& mesh,
146 const UInt elementId,
147 const UInt connectedElementId);
150 static int GetNodeCode(
const Mesh2D& mesh,
151 const std::vector<int>& nodeTypes,
152 const UInt elementId);
157 static void AddElementToList(
const Mesh& mesh,
158 const std::vector<UInt>& frontList,
159 std::vector<UInt>& frontListCopy,
160 const UInt elementId);
163 static void RedirectNodesOfConnectedElements(
Mesh2D& mesh,
164 const UInt elementId,
166 const std::vector<UInt>& indirectlyConnected);
169 [[nodiscard]]
static bool RemoveUnwantedBoundaryNodes(
Mesh2D& mesh,
170 const std::vector<int>& nodeTypes,
172 const std::vector<UInt>& indirectlyConnected);
175 [[nodiscard]]
static bool DeleteElement(
Mesh2D& mesh,
176 std::vector<int>& nodeTypes,
178 const UInt elementId,
179 const std::vector<UInt>& directlyConnected,
180 const std::vector<UInt>& indirectlyConnected,
181 const std::vector<std::array<int, 2>>& kne);
186 [[nodiscard]]
static bool CleanUpEdge(
Mesh2D& mesh,
const UInt edgeId);
189 [[nodiscard]]
static bool DoDeRefinement(
Mesh2D& mesh,
const Polygons& polygon);
194 static std::vector<int> ComputeNodeTypes(
const Mesh2D& mesh,
const Polygons& polygon);