/
CBBoxTargetClass.hpp
83 lines (75 loc) · 3.29 KB
/
CBBoxTargetClass.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*!
* \file CBBoxTargetClass.hpp
* \brief Class for storing the information of a possible bounding box candidate
during a minimum distance search.
* \author E. van der Weide
* \version 7.4.0 "Blackbird"
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2022, SU2 Contributors (cf. AUTHORS.md)
*
* SU2 is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* SU2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with SU2. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "../basic_types/datatype_structure.hpp"
/*!
* \class CBBoxTargetClass
* \brief Class for storing the information of a possible bounding box candidate
during a minimum distance search.
* \author E. van der Weide
* \version 7.4.0 "Blackbird"
*/
struct CBBoxTargetClass {
unsigned long boundingBoxID; /*!< \brief Corresponding bounding box ID. */
su2double possibleMinDist2; /*!< \brief Possible minimimum distance squared to the
given coordinate. */
su2double guaranteedMinDist2; /*!< \brief Guaranteed minimum distance squared to the
given coordinate. */
/*!
* \brief Constructor of the class. Nothing to be done.
*/
CBBoxTargetClass() = default;
/*!
* \brief Constructor of the class, which initializes the member variables.
* \param[in] val_BBoxID - ID of the bounding box to be stored.
* \param[in] val_posDist2 - Possible minimum distance squared to the target
for this bounding box.
* \param[in] val_guarDist2 - Guaranteed minimum distance squared to the target
for this bounding box.
*/
inline CBBoxTargetClass(const unsigned long val_BBoxID,
const su2double val_posDist2,
const su2double val_guarDist2)
: boundingBoxID(val_BBoxID),
possibleMinDist2(val_posDist2),
guaranteedMinDist2(val_guarDist2) {}
/*!
* \brief Less than operator. Needed for the sorting of the candidates.
* \param[in] other Object to which the current object must be compared.
*/
inline bool operator <(const CBBoxTargetClass &other) const{
/* Make sure that the bounding boxes with the smallest possible distances
are stored first. */
if(possibleMinDist2 < other.possibleMinDist2) return true;
if(possibleMinDist2 > other.possibleMinDist2) return false;
if(guaranteedMinDist2 < other.guaranteedMinDist2) return true;
if(guaranteedMinDist2 > other.guaranteedMinDist2) return false;
if(boundingBoxID < other.boundingBoxID) return true;
return false;
}
};