MeshKernel
Mesh2DGenerateGlobal.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 
32 #include "MeshKernel/Definitions.hpp"
33 #include "MeshKernel/Mesh2D.hpp"
34 #include "MeshKernel/Point.hpp"
35 
36 namespace meshkernel
37 {
40  {
41  public:
48  static std::unique_ptr<Mesh2D> Compute(const UInt numLongitudeNodes, const UInt numLatitudeNodes, const Projection projection);
49 
50  private:
52  enum class GridExpansionDirection
53  {
54  Northwards = 1,
55  Southwards = -1
56  };
57 
59  static double DeltaLatitude(const double currentLatitude, const double longitudeDiscretization);
60 
62  static UInt NodeIndexFromPosition(const Mesh& mesh, const Point& position);
63 
65  static void AddFace(Mesh& mesh, const std::array<Point, 5>& points, const GridExpansionDirection growingDirection, const UInt numNodes);
66 
67  static constexpr UInt numIterations = 5;
68  static constexpr double toleranceDeltaLatitude = 1.0e-14;
69  };
70 } // namespace meshkernel
meshkernel::Projection
Projection
Enumerator describing the supported projections.
Definition: Definitions.hpp:41
meshkernel::Point
A struct describing a point in a two-dimensional space.
Definition: Point.hpp:40
meshkernel::Mesh2DGenerateGlobal
Construct a global grid in spherical coordinates, as a base for later mesh refinements.
Definition: Mesh2DGenerateGlobal.hpp:39
meshkernel::Mesh2DGenerateGlobal::Compute
static std::unique_ptr< Mesh2D > Compute(const UInt numLongitudeNodes, const UInt numLatitudeNodes, const Projection projection)
Compute the global mesh with a given number of points along the longitude and latitude directions.
meshkernel
Contains the logic of the C++ static library.
Definition: AveragingInterpolation.hpp:36
meshkernel::UInt
std::uint32_t UInt
Integer type used when indexing mesh graph entities.
Definition: Definitions.hpp:38
meshkernel::Mesh
A class describing an unstructured mesh. This class contains the shared functionality between 1d or 2...
Definition: Mesh.hpp:98