Loading [MathJax]/extensions/tex2jax.js
MeshKernel
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages Concepts
SampleTriangulationInterpolator.hpp
1//---- GPL ---------------------------------------------------------------------
2//
3// Copyright (C) Stichting Deltares, 2011-2024.
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 <span>
32#include <vector>
33
34#include "MeshKernel/Definitions.hpp"
35#include "MeshKernel/Entities.hpp"
36#include "MeshKernel/Exceptions.hpp"
37#include "MeshKernel/Mesh2D.hpp"
38#include "MeshKernel/MeshTriangulation.hpp"
39#include "MeshKernel/Operations.hpp"
40#include "MeshKernel/Point.hpp"
41#include "MeshKernel/SampleInterpolator.hpp"
42#include "MeshKernel/Utilities/RTreeFactory.hpp"
43
44namespace meshkernel
45{
46
51 {
52 public:
54 SampleTriangulationInterpolator(const std::span<const double> xNodes,
55 const std::span<const double> yNodes,
56 const Projection projection)
57 : m_triangulation(xNodes, yNodes, projection) {}
58
60 SampleTriangulationInterpolator(const std::span<const Point> nodes,
61 const Projection projection)
62 : m_triangulation(nodes, projection) {}
63
65 UInt Size() const override;
66
68 void Interpolate(const int propertyId, const Mesh2D& mesh, const Location location, std::span<double> result) const override;
69
71 void Interpolate(const int propertyId, const std::span<const Point> iterpolationNodes, std::span<double> result) const override;
72
77 double InterpolateValue(const int propertyId, const Point& evaluationPoint) const override;
78
79 private:
81 double InterpolateOnElement(const UInt elementId, const Point& interpolationPoint, const std::vector<double>& sampleValues) const;
82
84 MeshTriangulation m_triangulation;
85 };
86
87} // namespace meshkernel
88
90{
91 return m_triangulation.NumberOfNodes();
92}
A class derived from Mesh, which describes unstructures 2d meshes.
Definition Mesh2D.hpp:58
Contains a mesh triangulated from a set of points.
Definition MeshTriangulation.hpp:112
UInt NumberOfNodes() const
Get the number of nodes in the triangulation.
Definition MeshTriangulation.hpp:192
A struct describing a point in a two-dimensional space.
Definition Point.hpp:41
Interface for sample interpolation.
Definition SampleInterpolator.hpp:53
Interpolator for sample data on a triangulated grid.
Definition SampleTriangulationInterpolator.hpp:51
double InterpolateValue(const int propertyId, const Point &evaluationPoint) const override
Interpolate the sample data set at a single interpolation point.
SampleTriangulationInterpolator(const std::span< const double > xNodes, const std::span< const double > yNodes, const Projection projection)
Constructor.
Definition SampleTriangulationInterpolator.hpp:54
void Interpolate(const int propertyId, const Mesh2D &mesh, const Location location, std::span< double > result) const override
Interpolate the sample data at the points for the location (nodes, edges, faces)
void Interpolate(const int propertyId, const std::span< const Point > iterpolationNodes, std::span< double > result) const override
Interpolate the sample data set at the interpolation nodes.
SampleTriangulationInterpolator(const std::span< const Point > nodes, const Projection projection)
Constructor.
Definition SampleTriangulationInterpolator.hpp:60
UInt Size() const override
Get the number of nodes of size of the sample data.
Definition SampleTriangulationInterpolator.hpp:89
Contains the logic of the C++ static library.
Definition AveragingInterpolation.hpp:37
Projection
Enumerator describing the supported projections.
Definition Definitions.hpp:43
Location
Mesh locations enumeration.
Definition Definitions.hpp:76
std::uint32_t UInt
Integer type used when indexing mesh graph entities.
Definition Definitions.hpp:39