Loading [MathJax]/extensions/tex2jax.js
MeshKernel
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages Concepts
SampleInterpolator.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 <string>
33#include <vector>
34
35#include "MeshKernel/AveragingInterpolation.hpp"
36#include "MeshKernel/AveragingStrategies/AveragingStrategy.hpp"
37#include "MeshKernel/AveragingStrategies/AveragingStrategyFactory.hpp"
38#include "MeshKernel/Constants.hpp"
39#include "MeshKernel/Definitions.hpp"
40#include "MeshKernel/Entities.hpp"
41#include "MeshKernel/Exceptions.hpp"
42#include "MeshKernel/Mesh2D.hpp"
43#include "MeshKernel/MeshTriangulation.hpp"
44#include "MeshKernel/Operations.hpp"
45#include "MeshKernel/Point.hpp"
46#include "MeshKernel/Utilities/RTreeFactory.hpp"
47
48namespace meshkernel
49{
50
53 {
54 public:
56 virtual ~SampleInterpolator() = default;
57
59 void SetData(const int propertyId, const std::span<const double> sampleData);
60
62 virtual UInt Size() const = 0;
63
65 bool Contains(const int propertyId) const;
66
68 virtual void Interpolate(const int propertyId, const std::span<const Point> iterpolationNodes, std::span<double> result) const = 0;
69
71 virtual void Interpolate(const int propertyId, const Mesh2D& mesh, const Location location, std::span<double> result) const = 0;
72
77 virtual double InterpolateValue(const int propertyId, const Point& evaluationPoint) const = 0;
78
79 protected:
81 const std::vector<double>& GetSampleData(const int propertyId) const;
82
83 private:
85 std::map<int, std::vector<double>> m_sampleData;
86 };
87
88} // namespace meshkernel
89
90inline bool meshkernel::SampleInterpolator::Contains(const int propertyId) const
91{
92 return m_sampleData.contains(propertyId);
93}
A class derived from Mesh, which describes unstructures 2d meshes.
Definition Mesh2D.hpp:58
A struct describing a point in a two-dimensional space.
Definition Point.hpp:41
Interface for sample interpolation.
Definition SampleInterpolator.hpp:53
virtual double InterpolateValue(const int propertyId, const Point &evaluationPoint) const =0
Interpolate the sample data set at a single interpolation point.
virtual void Interpolate(const int propertyId, const Mesh2D &mesh, const Location location, std::span< double > result) const =0
Interpolate the sample data.
virtual void Interpolate(const int propertyId, const std::span< const Point > iterpolationNodes, std::span< double > result) const =0
Interpolate the sample data set at the interpolation nodes.
void SetData(const int propertyId, const std::span< const double > sampleData)
Set sample data.
const std::vector< double > & GetSampleData(const int propertyId) const
Get the sample property data for the id.
virtual UInt Size() const =0
Get the number of sample points.
bool Contains(const int propertyId) const
Determine if the SampleInterpolator already has this sample set.
Definition SampleInterpolator.hpp:90
virtual ~SampleInterpolator()=default
Destructor.
Contains the logic of the C++ static library.
Definition AveragingInterpolation.hpp:37
Location
Mesh locations enumeration.
Definition Definitions.hpp:76
std::uint32_t UInt
Integer type used when indexing mesh graph entities.
Definition Definitions.hpp:39