Loading [MathJax]/extensions/tex2jax.js
MeshKernel
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages Concepts
RemoveDisconnectedRegions.hpp
1//---- GPL ---------------------------------------------------------------------
2//
3// Copyright (C) Stichting Deltares, 2011-2023.
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 <utility>
31#include <vector>
32
33#include "MeshKernel/Definitions.hpp"
34#include "MeshKernel/Mesh2D.hpp"
35#include "MeshKernel/UndoActions/UndoAction.hpp"
36
37namespace meshkernel
38{
46 {
47 public:
49 [[nodiscard]] std::unique_ptr<UndoAction> Compute(Mesh2D& mesh) const;
50
51 private:
55 UInt GetNeighbour(const std::array<UInt, 2>& edge, const UInt elementId) const;
56
61 void LabelConnectedRegion(const Mesh2D& mesh, const UInt regionId, std::vector<UInt>& elementRegionId, const UInt unlabledElementId, UInt& elementCount) const;
62
66 void LabelSingleDomainRegion(const Mesh2D& mesh, const UInt regionId, std::vector<UInt>& elementRegionId, UInt& elementCount) const;
67
72 void LabelAllDomainRegions(const Mesh2D& mesh, std::vector<UInt>& elementRegionId, std::vector<std::pair<UInt, UInt>>& regionCount) const;
73
75 [[nodiscard]] std::unique_ptr<UndoAction> RemoveDetachedRegions(Mesh2D& mesh, const UInt regionId, std::vector<UInt>& elementRegionId, UInt& numberOfElementsRemoved) const;
76 };
77
78} // namespace meshkernel
A class derived from Mesh, which describes unstructures 2d meshes.
Definition Mesh2D.hpp:58
Removes any small regions that are disconnected from the main part of the domain.
Definition RemoveDisconnectedRegions.hpp:46
std::unique_ptr< UndoAction > Compute(Mesh2D &mesh) const
Remove the disconnected regions.
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