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 <map>
31#include <memory>
32
33#include "MeshKernel/Contacts.hpp"
34#include "MeshKernel/CurvilinearGrid/CurvilinearGridFromSplines.hpp"
35#include "MeshKernel/CurvilinearGrid/CurvilinearGridLineShift.hpp"
36#include "MeshKernel/CurvilinearGrid/CurvilinearGridOrthogonalization.hpp"
37#include "MeshKernel/CurvilinearGrid/CurvilinearGridSmoothing.hpp"
38#include "MeshKernel/Mesh1D.hpp"
39#include "MeshKernel/Mesh2D.hpp"
40#include "MeshKernel/OrthogonalizationAndSmoothing.hpp"
41
42#include "MeshKernelApi/ApiCache/CurvilinearBoundariesAsPolygonCache.hpp"
43#include "MeshKernelApi/ApiCache/FacePolygonPropertyCache.hpp"
44#include "MeshKernelApi/ApiCache/HangingEdgeCache.hpp"
45#include "MeshKernelApi/ApiCache/NodeInPolygonCache.hpp"
46#include "MeshKernelApi/ApiCache/ObtuseTriangleCentreCache.hpp"
47#include "MeshKernelApi/ApiCache/PolygonRefinementCache.hpp"
48#include "MeshKernelApi/ApiCache/SmallFlowEdgeCentreCache.hpp"
49#include "MeshKernelApi/PropertyCalculator.hpp"
50
51#include "ApiCache/MeshBoundariesAsPolygonCache.hpp"
52
53namespace meshkernelapi
54{
55
58 {
59
61 MeshKernelState() = default;
62
64 explicit MeshKernelState(meshkernel::Projection projection) : m_projection(projection)
65 {
66 m_mesh1d = std::make_shared<meshkernel::Mesh1D>(projection);
67 m_mesh2d = std::make_shared<meshkernel::Mesh2D>(projection);
68 m_network1d = std::make_shared<meshkernel::Network1D>(projection);
69 m_contacts = std::make_shared<meshkernel::Contacts>(*m_mesh1d, *m_mesh2d);
70 m_curvilinearGrid = std::make_shared<meshkernel::CurvilinearGrid>(projection);
72 }
73
74 // Geometrical entities instances
75 std::shared_ptr<meshkernel::Mesh1D> m_mesh1d;
76 std::shared_ptr<meshkernel::Network1D> m_network1d;
77 std::shared_ptr<meshkernel::Mesh2D> m_mesh2d;
78 std::shared_ptr<meshkernel::Contacts> m_contacts;
79 std::shared_ptr<meshkernel::CurvilinearGrid> m_curvilinearGrid;
80
81 // Algorithms instances (interactivity)
82 std::shared_ptr<meshkernel::OrthogonalizationAndSmoothing> m_meshOrthogonalization;
83 std::shared_ptr<meshkernel::CurvilinearGridFromSplines> m_curvilinearGridFromSplines;
84 std::shared_ptr<meshkernel::CurvilinearGridLineShift> m_curvilinearGridLineShift;
85 std::shared_ptr<meshkernel::CurvilinearGridOrthogonalization> m_curvilinearGridOrthogonalization;
86 std::map<int, std::shared_ptr<PropertyCalculator>> m_propertyCalculators;
87 std::unordered_map<meshkernel::UInt, std::pair<meshkernel::Point, meshkernel::Point>> m_frozenLines;
89
90 // Exclusively owned state
91 meshkernel::Projection m_projection{meshkernel::Projection::cartesian};
92
93 // Cached values, used when dimensions are computed first, followed by values being retrieved in a separate call
94 std::shared_ptr<FacePolygonPropertyCache> m_facePropertyCache;
95 std::shared_ptr<CurvilinearBoundariesAsPolygonCache> m_boundariesAsPolygonCache;
96 std::shared_ptr<MeshBoundariesAsPolygonCache> m_meshBoundariesAsPolygonCache;
97 std::shared_ptr<PolygonRefinementCache> m_polygonRefinementCache;
98 std::shared_ptr<NodeInPolygonCache> m_nodeInPolygonCache;
99 std::shared_ptr<SmallFlowEdgeCentreCache> m_smallFlowEdgeCentreCache;
100 std::shared_ptr<HangingEdgeCache> m_hangingEdgeCache;
101 std::shared_ptr<ObtuseTriangleCentreCache> m_obtuseTriangleCentreCache;
102 };
103
104} // 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:58
meshkernel::UInt m_frozenLinesCounter
An increasing counter for returning the id of frozen lines to the client.
Definition State.hpp:88
std::map< int, std::shared_ptr< PropertyCalculator > > m_propertyCalculators
Property calculators for the mesh2d.
Definition State.hpp:86
std::shared_ptr< SmallFlowEdgeCentreCache > m_smallFlowEdgeCentreCache
small flow edge centres cache
Definition State.hpp:99
std::shared_ptr< CurvilinearBoundariesAsPolygonCache > m_boundariesAsPolygonCache
boundaries as polygon cache
Definition State.hpp:95
std::shared_ptr< meshkernel::Network1D > m_network1d
Shared pointer to meshkernel::Network1D instance.
Definition State.hpp:76
std::shared_ptr< NodeInPolygonCache > m_nodeInPolygonCache
node in polygon cache
Definition State.hpp:98
std::shared_ptr< meshkernel::Mesh1D > m_mesh1d
Shared pointer to meshkernel::Mesh1D instance.
Definition State.hpp:75
std::shared_ptr< meshkernel::CurvilinearGridOrthogonalization > m_curvilinearGridOrthogonalization
Shared pointer to meshkernel::CurvilinearGridOrthogonalization instance.
Definition State.hpp:85
std::shared_ptr< meshkernel::CurvilinearGridFromSplines > m_curvilinearGridFromSplines
Shared pointer to meshkernel::CurvilinearGridFromSplines instance.
Definition State.hpp:83
MeshKernelState()=default
Default constructor.
meshkernel::Projection m_projection
Projection used by the meshes.
Definition State.hpp:91
std::shared_ptr< meshkernel::OrthogonalizationAndSmoothing > m_meshOrthogonalization
Shared pointer to meshkernel::OrthogonalizationAndSmoothing instance.
Definition State.hpp:82
std::shared_ptr< HangingEdgeCache > m_hangingEdgeCache
hanging edge id cache
Definition State.hpp:100
std::shared_ptr< ObtuseTriangleCentreCache > m_obtuseTriangleCentreCache
centre of obtuse triangles cache
Definition State.hpp:101
MeshKernelState(meshkernel::Projection projection)
Simple constructor.
Definition State.hpp:64
std::shared_ptr< meshkernel::CurvilinearGrid > m_curvilinearGrid
Shared pointer to meshkernel::CurvilinearGrid instance.
Definition State.hpp:79
std::shared_ptr< meshkernel::Mesh2D > m_mesh2d
Shared pointer to meshkernel::Mesh2D instance.
Definition State.hpp:77
std::shared_ptr< meshkernel::Contacts > m_contacts
Shared pointer to meshkernel::Contacts instance.
Definition State.hpp:78
std::shared_ptr< PolygonRefinementCache > m_polygonRefinementCache
polygon refinement cache
Definition State.hpp:97
std::shared_ptr< meshkernel::CurvilinearGridLineShift > m_curvilinearGridLineShift
Shared pointer to meshkernel::CurvilinearGridLineShift instance.
Definition State.hpp:84
std::unordered_map< meshkernel::UInt, std::pair< meshkernel::Point, meshkernel::Point > > m_frozenLines
Map for string the frozen lines.
Definition State.hpp:87
std::shared_ptr< FacePolygonPropertyCache > m_facePropertyCache
face property cache
Definition State.hpp:94
std::shared_ptr< MeshBoundariesAsPolygonCache > m_meshBoundariesAsPolygonCache
boundaries as polygon cache
Definition State.hpp:96