MeshKernel
Mesh1D.hpp
1 //---- GPL ---------------------------------------------------------------------
2 //
3 // Copyright (C) Stichting Deltares, 2011-2020.
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 
30 #include <MeshKernel/Entities.hpp>
31 #include <MeshKernel/Mesh.hpp>
32 #include <MeshKernel/Network1D.hpp>
33 
36 namespace meshkernel
37 {
42  class Mesh1D final : public Mesh
43  {
44 
45  public:
47  ~Mesh1D() override = default;
48 
50  Mesh1D() = default;
51 
54  explicit Mesh1D(Projection projection);
55 
60  Mesh1D(std::vector<Edge> const& edges,
61  std::vector<Point> const& nodes,
62  Projection projection);
63 
67  Mesh1D(Network1D& network1d, double minFaceSize);
68 
72  [[nodiscard]] bool IsNodeOnBoundary(UInt node) const { return m_nodesNumEdges[node] == 1; }
73 
78  [[nodiscard]] Point ComputeProjectedNode(UInt node, double distanceFactor) const;
79  };
80 
81 } // namespace meshkernel
meshkernel::Projection
Projection
Enumerator describing the supported projections.
Definition: Definitions.hpp:41
meshkernel::Mesh1D::Mesh1D
Mesh1D()=default
Default constructor.
meshkernel::Mesh1D::ComputeProjectedNode
Point ComputeProjectedNode(UInt node, double distanceFactor) const
Compute a projected node along a line normal to the edges connected to the node.
meshkernel::Mesh::m_nodesNumEdges
std::vector< UInt > m_nodesNumEdges
For each node, the number of connected edges (nmk)
Definition: Mesh.hpp:468
meshkernel::Mesh1D
A class derived from Mesh, which describes 1d meshes.
Definition: Mesh1D.hpp:42
meshkernel::Point
A struct describing a point in a two-dimensional space.
Definition: Point.hpp:40
meshkernel
Contains the logic of the C++ static library.
Definition: AveragingInterpolation.hpp:36
meshkernel::Mesh1D::IsNodeOnBoundary
bool IsNodeOnBoundary(UInt node) const
Inquire if a mesh 1d-node is on boundary.
Definition: Mesh1D.hpp:72
meshkernel::UInt
std::uint32_t UInt
Integer type used when indexing mesh graph entities.
Definition: Definitions.hpp:38
meshkernel::Mesh1D::~Mesh1D
~Mesh1D() override=default
Default destructor.
meshkernel::Network1D
A class describing a network 1d.
Definition: Network1D.hpp:39
meshkernel::Mesh
A class describing an unstructured mesh. This class contains the shared functionality between 1d or 2...
Definition: Mesh.hpp:98