Documentation 6b54b78464
Loading...
Searching...
No Matches
CADTPointsOnlyClass.hpp
Go to the documentation of this file.
1/*!
2 * \file CADTPointsOnlyClass.hpp
3 * \brief Class for storing an ADT of only points in an arbitrary number of dimensions.
4 * \author E. van der Weide
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
28#pragma once
29#include "./CADTBaseClass.hpp"
30
31/*!
32 * \class CADTPointsOnlyClass
33 * \ingroup ADT
34 * \brief Class for storing an ADT of only points in an arbitrary number of dimensions.
35 * \author E. van der Weide
36 */
38 private:
39 vector<su2double> coorPoints; /*!< \brief Vector, which contains the coordinates
40 of the points in the ADT. */
41 vector<unsigned long> localPointIDs; /*!< \brief Vector, which contains the local point ID's
42 of the points in the ADT. */
43 vector<int> ranksOfPoints; /*!< \brief Vector, which contains the ranks
44 of the points in the ADT. */
45 public:
46 /*!
47 * \brief Constructor of the class.
48 * \param[in] nDim Number of spatial dimensions of the problem.
49 * \param[in] nPoints Number of local points to be stored in the ADT.
50 * \param[in] coor Coordinates of the local points.
51 * \param[in] pointID Local point IDs of the local points.
52 * \param[in] globalTree Whether or not a global tree must be built. If false
53 a local ADT is built.
54 */
55 CADTPointsOnlyClass(unsigned short nDim, unsigned long nPoints, const su2double* coor, const unsigned long* pointID,
56 const bool globalTree);
57
58 /*!
59 * \brief Function, which determines the nearest node in the ADT for the given coordinate.
60 * \note This simply forwards the call to the implementation function selecting the right
61 * working variables for the current thread.
62 * \param[in] coor Coordinate for which the nearest node in the ADT must be determined.
63 * \param[out] dist Distance to the nearest node in the ADT.
64 * \param[out] pointID Local point ID of the nearest node in the ADT.
65 * \param[out] rankID Rank on which the nearest node in the ADT is stored.
66 */
67 inline void DetermineNearestNode(const su2double* coor, su2double& dist, unsigned long& pointID, int& rankID) {
68 const auto iThread = omp_get_thread_num();
69 DetermineNearestNode_impl(FrontLeaves[iThread], FrontLeavesNew[iThread], coor, dist, pointID, rankID);
70 }
71
72 /*!
73 * \brief Default constructor of the class, disabled.
74 */
76
77 private:
78 /*!
79 * \brief Implementation of DetermineNearestNode.
80 * \note Working variables (first two) passed explicitly for thread safety.
81 */
82 void DetermineNearestNode_impl(vector<unsigned long>& frontLeaves, vector<unsigned long>& frontLeavesNew,
83 const su2double* coor, su2double& dist, unsigned long& pointID, int& rankID) const;
84};
Base class for storing an ADT in an arbitrary number of dimensions.
Base class for storing an ADT in an arbitrary number of dimensions.
Definition CADTBaseClass.hpp:45
array< vector< unsigned long >, 1 > FrontLeaves
Definition CADTBaseClass.hpp:57
array< vector< unsigned long >, 1 > FrontLeavesNew
Definition CADTBaseClass.hpp:58
Class for storing an ADT of only points in an arbitrary number of dimensions.
Definition CADTPointsOnlyClass.hpp:37
CADTPointsOnlyClass()=delete
Default constructor of the class, disabled.
void DetermineNearestNode(const su2double *coor, su2double &dist, unsigned long &pointID, int &rankID)
Function, which determines the nearest node in the ADT for the given coordinate.
Definition CADTPointsOnlyClass.hpp:67
passivedouble su2double
Definition code_config.hpp:181
constexpr int omp_get_thread_num()
Index of current thread, akin to MPI rank.
Definition omp_structure.hpp:85