34 #include "MeshKernel/Mesh2D.hpp"
35 #include "MeshKernel/Polygons.hpp"
36 #include "MeshKernel/UndoActions/UndoAction.hpp"
47 [[nodiscard]]
static std::unique_ptr<meshkernel::UndoAction>
Compute(
Mesh2D& mesh);
53 [[nodiscard]]
static std::unique_ptr<meshkernel::UndoAction>
Compute(
Mesh2D& mesh,
const Polygons& polygon);
59 enum class NodeMask : char
70 static constexpr
UInt InitialEdgeArraySize = 100;
73 static constexpr
UInt MaximumNumberOfNodesInNewlyCreatedElements = 4;
77 using EdgeNodes = std::array<UInt, 4>;
83 static void InitialiseBoundaryNodes(
const Mesh2D& mesh, std::vector<NodeMask>& nodeMask);
89 static void InitialiseCornerNodes(
const Mesh2D& mesh, std::vector<NodeMask>& nodeMask);
95 static void InitialiseFaceNodes(
const Mesh2D& mesh, std::vector<NodeMask>& nodeMask);
101 static std::vector<NodeMask> InitialiseNodeMask(
const Mesh2D& mesh,
const Polygons& polygon);
108 static void ComputeNewNodes(
Mesh2D& mesh, std::vector<EdgeNodes>& newNodes, std::vector<NodeMask>& nodeMask);
115 static void ConnectNodes(
Mesh2D& mesh,
const std::vector<EdgeNodes>& newNodes,
const UInt numEdges);
118 static std::vector<UInt> GetNodesToConnect(
const Mesh2D& mesh,
119 const std::vector<NodeMask>& nodeMask,
120 const std::vector<UInt>& newEdges,
121 const std::vector<EdgeNodes>& newNodes,
122 const UInt edgeCount,
123 const UInt nodeIndex);
126 static void ConnectNodes(
Mesh2D& mesh,
127 const NodeMask nodeMask,
128 const std::vector<UInt>& nodesToConnect,
129 const UInt edgeCount,
130 const UInt nodeIndex);
138 static void CreateMissingBoundaryEdges(
Mesh2D& mesh,
const UInt numNodes,
const std::vector<EdgeNodes>& newNodes, std::vector<NodeMask>& nodeMask);
145 static void ComputeNewFaceNodes(
Mesh2D& mesh, std::vector<EdgeNodes>& newNodes, std::vector<NodeMask>& nodeMask);
153 static void ComputeNewEdgeNodes(
Mesh2D& mesh,
const UInt numEdges, std::vector<EdgeNodes>& newNodes, std::vector<NodeMask>& nodeMask);
162 static void ConnectEdges(
Mesh2D& mesh,
163 const UInt currentNode,
164 const std::vector<EdgeNodes>& newNodes,
166 std::vector<UInt>& newEdges);
174 static void ConnectFaceNodes(
Mesh2D& mesh,
175 const UInt currentFace,
176 const std::vector<EdgeNodes>& newNodes,
177 std::vector<NodeMask>& nodeMask);
187 static void ConnectNewNodes(
Mesh2D& mesh,
const std::vector<EdgeNodes>& newNodes,
const UInt numNodes,
const UInt numEdges,
const UInt numFaces, std::vector<NodeMask>& nodeMask);
197 static void StoreNewNode(
const Mesh2D& mesh,
const UInt nodeId,
const UInt edge1Index,
const UInt edge2Index,
const UInt newNodeId, std::vector<EdgeNodes>& newNodes);
206 static void FindPatchIds(
const Mesh2D& mesh,
207 const UInt currentNode,
208 std::vector<UInt>& sharedFaces,
209 std::vector<UInt>& connectedNodes,
210 std::vector<std::vector<UInt>>& faceNodeMapping);
217 static void Administrate(
Mesh2D& mesh,
const UInt numNodes,
const std::vector<NodeMask>& nodeMask);