33 #include "MeshKernel/Mesh2D.hpp"
34 #include "MeshKernel/Polygons.hpp"
35 #include "MeshKernel/UndoActions/UndoAction.hpp"
46 [[nodiscard]]
static std::unique_ptr<meshkernel::UndoAction>
Compute(
Mesh2D& mesh);
52 [[nodiscard]]
static std::unique_ptr<meshkernel::UndoAction>
Compute(
Mesh2D& mesh,
const Polygons& polygon);
58 enum class NodeMask : char
69 static constexpr
UInt InitialEdgeArraySize = 100;
72 static constexpr
UInt MaximumNumberOfNodesInNewlyCreatedElements = 4;
76 using EdgeNodes = std::array<UInt, 4>;
82 static void InitialiseBoundaryNodes(
const Mesh2D& mesh, std::vector<NodeMask>& nodeMask);
88 static void InitialiseCornerNodes(
const Mesh2D& mesh, std::vector<NodeMask>& nodeMask);
94 static void InitialiseFaceNodes(
const Mesh2D& mesh, std::vector<NodeMask>& nodeMask);
100 static std::vector<NodeMask> InitialiseNodeMask(
const Mesh2D& mesh,
const Polygons& polygon);
107 [[nodiscard]]
static std::unique_ptr<meshkernel::UndoAction> ComputeNewNodes(
Mesh2D& mesh, std::vector<EdgeNodes>& newNodes, std::vector<NodeMask>& nodeMask);
114 [[nodiscard]]
static std::unique_ptr<meshkernel::UndoAction> ConnectNodes(
Mesh2D& mesh,
const std::vector<EdgeNodes>& newNodes,
const UInt numEdges);
122 [[nodiscard]]
static std::unique_ptr<meshkernel::UndoAction> CreateMissingBoundaryEdges(
Mesh2D& mesh,
const UInt numNodes,
const std::vector<EdgeNodes>& newNodes, std::vector<NodeMask>& nodeMask);
129 [[nodiscard]]
static std::unique_ptr<meshkernel::UndoAction> ComputeNewFaceNodes(
Mesh2D& mesh, std::vector<EdgeNodes>& newNodes, std::vector<NodeMask>& nodeMask);
137 [[nodiscard]]
static std::unique_ptr<meshkernel::UndoAction> ComputeNewEdgeNodes(
Mesh2D& mesh,
const UInt numEdges, std::vector<EdgeNodes>& newNodes, std::vector<NodeMask>& nodeMask);
146 [[nodiscard]]
static std::unique_ptr<meshkernel::UndoAction> ConnectEdges(
Mesh2D& mesh,
147 const UInt currentNode,
148 const std::vector<EdgeNodes>& newNodes,
150 std::vector<UInt>& newEdges);
158 [[nodiscard]]
static std::unique_ptr<meshkernel::UndoAction> ConnectFaceNodes(
Mesh2D& mesh,
159 const UInt currentFace,
160 const std::vector<EdgeNodes>& newNodes,
161 std::vector<NodeMask>& nodeMask);
171 [[nodiscard]]
static std::unique_ptr<meshkernel::UndoAction> ConnectNewNodes(
Mesh2D& mesh,
const std::vector<EdgeNodes>& newNodes,
const UInt numNodes,
const UInt numEdges,
const UInt numFaces, std::vector<NodeMask>& nodeMask);
181 static void StoreNewNode(
const Mesh2D& mesh,
const UInt nodeId,
const UInt edge1Index,
const UInt edge2Index,
const UInt newNodeId, std::vector<EdgeNodes>& newNodes);
190 static void FindPatchIds(
const Mesh2D& mesh,
191 const UInt currentNode,
192 std::vector<UInt>& sharedFaces,
193 std::vector<UInt>& connectedNodes,
194 std::vector<std::vector<UInt>>& faceNodeMapping);
201 [[nodiscard]]
static std::unique_ptr<meshkernel::UndoAction> Administrate(
Mesh2D& mesh,
const UInt numNodes,
const std::vector<NodeMask>& nodeMask);