Documentation 6b54b78464
Loading...
Searching...
No Matches
CNearestNeighbor.hpp
Go to the documentation of this file.
1/*!
2 * \file CNearestNeighbor.hpp
3 * \brief Nearest Neighbor interpolation class.
4 * \author H. Kline
5 * \version 8.5.0 "Harrier"
6 *
7 * SU2 Project Website: https://su2code.github.io
8 *
9 * The SU2 Project is maintained by the SU2 Foundation
10 * (http://su2foundation.org)
11 *
12 * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)
13 *
14 * SU2 is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * SU2 is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
26 */
27#pragma once
28
29#include "CInterpolator.hpp"
30
31/*!
32 * \brief Nearest Neighbor(s) interpolation.
33 * \note The closest k neighbors are used for IDW interpolation, the computational
34 * cost of setting up the interpolation is O(N^2 log(k)), this can be improved
35 * by using an ADT.
36 * \ingroup Interfaces
37 */
38class CNearestNeighbor final : public CInterpolator {
39 private:
40 su2double AvgDistance = 0.0, MaxDistance = 0.0;
41
42 /*! \brief Helper struct to (partially) sort neighbours according to distance while
43 * keeping track of the origin of the point (i.e. index and processor). */
44 struct DonorInfo {
45 su2double dist;
46 unsigned pidx;
47 int proc;
48 DonorInfo(su2double d = 0.0, unsigned i = 0, int p = 0) : dist(d), pidx(i), proc(p) {}
49 };
50
51 public:
52 /*!
53 * \brief Constructor of the class.
54 * \param[in] geometry - Geometrical definition of the problem.
55 * \param[in] config - Definition of the particular problem.
56 * \param[in] iZone - index of the donor zone.
57 * \param[in] jZone - index of the target zone.
58 */
59 CNearestNeighbor(CGeometry**** geometry_container, const CConfig* const* config, unsigned int iZone,
60 unsigned int jZone);
61
62 /*!
63 * \brief Set up transfer matrix defining relation between two meshes.
64 * \param[in] config - Definition of the particular problem.
65 */
66 void SetTransferCoeff(CGeometry**** geometry, const CConfig* const* config) override;
67
68 /*!
69 * \brief Print interpolation statistics.
70 */
71 void PrintStatistics(void) const override;
72};
Base class for multiphysics interpolation.
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Parent class for defining the geometry of the problem (complete geometry, multigrid agglomerated geom...
Definition CGeometry.hpp:75
Main class for defining the interpolator, it requires a child class for each particular interpolation...
Definition CInterpolator.hpp:47
Nearest Neighbor(s) interpolation.
Definition CNearestNeighbor.hpp:38
void SetTransferCoeff(CGeometry ****geometry, const CConfig *const *config) override
Set up transfer matrix defining relation between two meshes.
Definition CNearestNeighbor.cpp:44
void PrintStatistics(void) const override
Print interpolation statistics.
Definition CNearestNeighbor.cpp:39
passivedouble su2double
Definition code_config.hpp:181