Documentation 6b54b78464
Loading...
Searching...
No Matches
CADTComparePointClass.hpp
Go to the documentation of this file.
1/*!
2 * \file CADTComparePointClass.hpp
3 * \brief subroutines for comparing two points in an alternating digital tree (ADT).
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 "../basic_types/datatype_structure.hpp"
30
31/*!
32 * \class CADTComparePointClass
33 * \ingroup ADT
34 * \brief Functor, used for the sorting of the points when building an ADT.
35 * \author E. van der Weide
36 */
38 private:
39 const su2double* pointCoor; /*!< \brief Pointer to the coordinates of the points. */
40 const unsigned short splitDirection; /*!< \brief Split direction used in the sorting. */
41 const unsigned short nDim; /*!< \brief Number of spatial dimensions stored in the coordinates. */
42
43 public:
44 /*!
45 * \brief Constructor of the class. The member variables are initialized.
46 * \param[in] coor Pointer to the coordinates of the points.
47 * \param[in] splitDir Direction that must be used to sort the coordinates.
48 * \param[in] nDimADT Number of spatial dimensions of the ADT and coordinates.
49 */
50 CADTComparePointClass(const su2double* coor, const unsigned short splitDir, const unsigned short nDimADT)
51 : pointCoor(coor), splitDirection(splitDir), nDim(nDimADT) {}
52
53 /*!
54 * \brief Operator used for the sorting of the points.
55 * \param[in] p0 Index of the first point to be compared.
56 * \param[in] p1 Index of the second point to be compared.
57 */
58 inline bool operator()(const unsigned long p0, const unsigned long p1) const {
59 return pointCoor[nDim * p0 + splitDirection] < pointCoor[nDim * p1 + splitDirection];
60 }
61
62 /*!
63 * \brief Default constructor of the class, disabled.
64 */
66};
Functor, used for the sorting of the points when building an ADT.
Definition CADTComparePointClass.hpp:37
CADTComparePointClass(const su2double *coor, const unsigned short splitDir, const unsigned short nDimADT)
Constructor of the class. The member variables are initialized.
Definition CADTComparePointClass.hpp:50
bool operator()(const unsigned long p0, const unsigned long p1) const
Operator used for the sorting of the points.
Definition CADTComparePointClass.hpp:58
CADTComparePointClass()=delete
Default constructor of the class, disabled.
passivedouble su2double
Definition code_config.hpp:181