Loading [MathJax]/jax/input/TeX/config.js
MeshKernel
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages Concepts
SplitRowColumnOfMesh.hpp
1//---- GPL ---------------------------------------------------------------------
2//
3// Copyright (C) Stichting Deltares, 2011-2024.
4//
5// This program is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation version 3.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16//
17// contact: delft3d.support@deltares.nl
18// Stichting Deltares
19// P.O. Box 177
20// 2600 MH Delft, The Netherlands
21//
22// All indications and logos of, and references to, "Delft3D" and "Deltares"
23// are registered trademarks of Stichting Deltares, and remain the property of
24// Stichting Deltares. All rights reserved.
25//
26//------------------------------------------------------------------------------
27
28#pragma once
29#include <array>
30#include <memory>
31#include <utility>
32#include <vector>
33
34#include "MeshKernel/Definitions.hpp"
35#include "MeshKernel/Mesh2D.hpp"
36#include "MeshKernel/UndoActions/CompoundUndoAction.hpp"
37#include "MeshKernel/UndoActions/UndoAction.hpp"
38
39namespace meshkernel
40{
43 {
44 public:
54 [[nodiscard]] std::unique_ptr<UndoAction> Compute(Mesh2D& mesh, const UInt edgeId) const;
55
56 private:
61 UInt SplitEdge(Mesh2D& mesh, const UInt edgeId, std::vector<UInt>& edgesToDelete, CompoundUndoAction& undoActions) const;
62
66 void SplitElement(Mesh2D& mesh,
67 const UInt elementId,
68 const UInt edgeId,
69 UInt& newNode,
70 CompoundUndoAction& undoActions,
71 std::vector<UInt>& edgesToDelete) const;
72
74 void SplitFirstLoopElement(Mesh2D& mesh,
75 const UInt elementId,
76 const UInt edgeId,
77 UInt& firstNode,
78 UInt& secondNode,
79 CompoundUndoAction& undoActions,
80 std::vector<UInt>& edgesToDelete) const;
81
83 void SplitAlongRow(Mesh2D& mesh,
84 const std::vector<UInt>& elementIds,
85 const std::vector<UInt>& edgeIds,
86 CompoundUndoAction& undoActions,
87 std::vector<UInt>& edgesToDelete) const;
88
90 void CollectElementsOneSideOfEdge(const Mesh2D& mesh,
91 const UInt edgeId,
92 const UInt whichSide,
93 std::vector<UInt>& partialElementIds,
94 std::vector<UInt>& partialEdgeIds,
95 bool& loopDetected) const;
96
98 void CollectElementsToSplit(const Mesh2D& mesh, const UInt edgeId, std::vector<UInt>& elementIds, std::vector<UInt>& edgeIds) const;
99
104 bool CanBeSplit(const Mesh2D& mesh, const UInt edgeId) const;
105
107 bool IsValidEdge(const Mesh2D& mesh, const UInt edgeId) const;
108
110 UInt OppositeEdgeId(const Mesh2D& mesh, const UInt elementId, const UInt edgeId) const;
111
113 bool IsQuadrilateral(const Mesh2D& mesh, const UInt elementId) const;
114
116 UInt GetNextElement(const Mesh2D& mesh, const UInt elementId, const UInt edgeId) const;
117
119 void GetNextEdge(const Mesh2D& mesh, UInt& elementId, UInt& edgeId) const;
120 };
121
122} // namespace meshkernel
A class derived from Mesh, which describes unstructures 2d meshes.
Definition Mesh2D.hpp:58
Split the row or column connected to the given edge.
Definition SplitRowColumnOfMesh.hpp:43
std::unique_ptr< UndoAction > Compute(Mesh2D &mesh, const UInt edgeId) const
Split the row or column connected to the given edge.
Contains the logic of the C++ static library.
Definition AveragingInterpolation.hpp:37
std::uint32_t UInt
Integer type used when indexing mesh graph entities.
Definition Definitions.hpp:39