Loading [MathJax]/extensions/tex2jax.js
MeshKernel
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages Concepts
State.hpp
1//---- GPL ---------------------------------------------------------------------
2//
3// Copyright (C) Stichting Deltares, 2011-2021.
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 "ApiCache/MeshBoundariesAsPolygonCache.hpp"
31
32#include <memory>
33
34#include "MeshKernel/Contacts.hpp"
35#include "MeshKernel/CurvilinearGrid/CurvilinearGridFromSplines.hpp"
36#include "MeshKernel/CurvilinearGrid/CurvilinearGridLineShift.hpp"
37#include "MeshKernel/CurvilinearGrid/CurvilinearGridOrthogonalization.hpp"
38#include "MeshKernel/CurvilinearGrid/CurvilinearGridSmoothing.hpp"
39#include "MeshKernel/Mesh1D.hpp"
40#include "MeshKernel/Mesh2D.hpp"
41#include "MeshKernel/OrthogonalizationAndSmoothing.hpp"
42
43#include "MeshKernelApi/ApiCache/CurvilinearBoundariesAsPolygonCache.hpp"
44#include "MeshKernelApi/ApiCache/FacePolygonPropertyCache.hpp"
45#include "MeshKernelApi/ApiCache/HangingEdgeCache.hpp"
46#include "MeshKernelApi/ApiCache/NodeInPolygonCache.hpp"
47#include "MeshKernelApi/ApiCache/ObtuseTriangleCentreCache.hpp"
48#include "MeshKernelApi/ApiCache/PolygonRefinementCache.hpp"
49#include "MeshKernelApi/ApiCache/SmallFlowEdgeCentreCache.hpp"
50
51namespace meshkernelapi
52{
53
56 {
57
59 MeshKernelState() = default;
60
62 explicit MeshKernelState(meshkernel::Projection projection) : m_projection(projection)
63 {
64 m_mesh1d = std::make_shared<meshkernel::Mesh1D>(projection);
65 m_mesh2d = std::make_shared<meshkernel::Mesh2D>(projection);
66 m_network1d = std::make_shared<meshkernel::Network1D>(projection);
67 m_contacts = std::make_shared<meshkernel::Contacts>(*m_mesh1d, *m_mesh2d);
68 m_curvilinearGrid = std::make_shared<meshkernel::CurvilinearGrid>(projection);
70 }
71
72 // Geometrical entities instances
73 std::shared_ptr<meshkernel::Mesh1D> m_mesh1d;
74 std::shared_ptr<meshkernel::Network1D> m_network1d;
75 std::shared_ptr<meshkernel::Mesh2D> m_mesh2d;
76 std::shared_ptr<meshkernel::Contacts> m_contacts;
77 std::shared_ptr<meshkernel::CurvilinearGrid> m_curvilinearGrid;
78
79 // Algorithms instances (interactivity)
80 std::shared_ptr<meshkernel::OrthogonalizationAndSmoothing> m_meshOrthogonalization;
81 std::shared_ptr<meshkernel::CurvilinearGridFromSplines> m_curvilinearGridFromSplines;
82 std::shared_ptr<meshkernel::CurvilinearGridLineShift> m_curvilinearGridLineShift;
83 std::unordered_map<meshkernel::UInt, std::pair<meshkernel::Point, meshkernel::Point>> m_frozenLines;
85
86 // Exclusively owned state
87 meshkernel::Projection m_projection{meshkernel::Projection::cartesian};
88
89 // Cached values, used when dimensions are computed first, followed by values being retrieved in a separate call
90 std::shared_ptr<FacePolygonPropertyCache> m_facePropertyCache;
91 std::shared_ptr<CurvilinearBoundariesAsPolygonCache> m_boundariesAsPolygonCache;
92 std::shared_ptr<MeshBoundariesAsPolygonCache> m_meshBoundariesAsPolygonCache;
93 std::shared_ptr<PolygonRefinementCache> m_polygonRefinementCache;
94 std::shared_ptr<NodeInPolygonCache> m_nodeInPolygonCache;
95 std::shared_ptr<SmallFlowEdgeCentreCache> m_smallFlowEdgeCentreCache;
96 std::shared_ptr<HangingEdgeCache> m_hangingEdgeCache;
97 std::shared_ptr<ObtuseTriangleCentreCache> m_obtuseTriangleCentreCache;
98 };
99
100} // namespace meshkernelapi
Projection
Enumerator describing the supported projections.
Definition Definitions.hpp:43
std::uint32_t UInt
Integer type used when indexing mesh graph entities.
Definition Definitions.hpp:39
Contains all structs and functions exposed at the API level.
Definition BoundingBox.hpp:33
The class holding the state of the C API library.
Definition State.hpp:56
meshkernel::UInt m_frozenLinesCounter
An increasing counter for returning the id of frozen lines to the client.
Definition State.hpp:84
std::shared_ptr< SmallFlowEdgeCentreCache > m_smallFlowEdgeCentreCache
small flow edge centres cache
Definition State.hpp:95
std::shared_ptr< CurvilinearBoundariesAsPolygonCache > m_boundariesAsPolygonCache
boundaries as polygon cache
Definition State.hpp:91
std::shared_ptr< meshkernel::Network1D > m_network1d
Shared pointer to meshkernel::Network1D instance.
Definition State.hpp:74
std::shared_ptr< NodeInPolygonCache > m_nodeInPolygonCache
node in polygon cache
Definition State.hpp:94
std::shared_ptr< meshkernel::Mesh1D > m_mesh1d
Shared pointer to meshkernel::Mesh1D instance.
Definition State.hpp:73
std::shared_ptr< meshkernel::CurvilinearGridFromSplines > m_curvilinearGridFromSplines
Shared pointer to meshkernel::CurvilinearGridFromSplines instance.
Definition State.hpp:81
MeshKernelState()=default
Default constructor.
meshkernel::Projection m_projection
Projection used by the meshes.
Definition State.hpp:87
std::shared_ptr< meshkernel::OrthogonalizationAndSmoothing > m_meshOrthogonalization
Shared pointer to meshkernel::OrthogonalizationAndSmoothing instance.
Definition State.hpp:80
std::shared_ptr< HangingEdgeCache > m_hangingEdgeCache
hanging edge id cache
Definition State.hpp:96
std::shared_ptr< ObtuseTriangleCentreCache > m_obtuseTriangleCentreCache
centre of obtuse triangles cache
Definition State.hpp:97
MeshKernelState(meshkernel::Projection projection)
Simple constructor.
Definition State.hpp:62
std::shared_ptr< meshkernel::CurvilinearGrid > m_curvilinearGrid
Shared pointer to meshkernel::CurvilinearGrid instance.
Definition State.hpp:77
std::shared_ptr< meshkernel::Mesh2D > m_mesh2d
Shared pointer to meshkernel::Mesh2D instance.
Definition State.hpp:75
std::shared_ptr< meshkernel::Contacts > m_contacts
Shared pointer to meshkernel::Contacts instance.
Definition State.hpp:76
std::shared_ptr< PolygonRefinementCache > m_polygonRefinementCache
polygon refinement cache
Definition State.hpp:93
std::shared_ptr< meshkernel::CurvilinearGridLineShift > m_curvilinearGridLineShift
Shared pointer to meshkernel::CurvilinearGridLineShift instance.
Definition State.hpp:82
std::unordered_map< meshkernel::UInt, std::pair< meshkernel::Point, meshkernel::Point > > m_frozenLines
Map for string the frozen lines.
Definition State.hpp:83
std::shared_ptr< FacePolygonPropertyCache > m_facePropertyCache
face property cache
Definition State.hpp:90
std::shared_ptr< MeshBoundariesAsPolygonCache > m_meshBoundariesAsPolygonCache
boundaries as polygon cache
Definition State.hpp:92