Skip to content

Commit f7fdb29

Browse files
authored
Merge branch 'develop' into feature_aero_thermo_elasticity
2 parents 9896026 + 16620a2 commit f7fdb29

66 files changed

Lines changed: 10533 additions & 14693 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/*!
2+
* \file CADTBaseClass.hpp
3+
* \brief Base class for storing an ADT in an arbitrary number of dimensions.
4+
* \author E. van der Weide
5+
* \version 7.0.6 "Blackbird"
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-2020, 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+
30+
#include <vector>
31+
#include <array>
32+
33+
#include "../basic_types/datatype_structure.hpp"
34+
#include "./CADTNodeClass.hpp"
35+
#include "../omp_structure.hpp"
36+
37+
using namespace std;
38+
39+
/*!
40+
* \class CADTBaseClass
41+
* \brief Base class for storing an ADT in an arbitrary number of dimensions.
42+
* \author E. van der Weide
43+
*/
44+
class CADTBaseClass {
45+
protected:
46+
unsigned long nLeaves; /*!< \brief Number of leaves in the ADT. */
47+
unsigned short nDimADT; /*!< \brief Number of dimensions of the ADT. */
48+
bool isEmpty; /*!< \brief Whether or not the ADT is empty. */
49+
50+
vector<CADTNodeClass> leaves; /*!< \brief Vector, which contains all the leaves of the ADT. */
51+
52+
#ifdef HAVE_OMP
53+
vector<vector<unsigned long> > FrontLeaves; /*!< \brief Vector used in the tree traversal. */
54+
vector<vector<unsigned long> > FrontLeavesNew; /*!< \brief Vector used in the tree traversal. */
55+
#else
56+
array<vector<unsigned long>,1> FrontLeaves;
57+
array<vector<unsigned long>,1> FrontLeavesNew;
58+
#endif
59+
private:
60+
vector<su2double> coorMinLeaves; /*!< \brief Vector, which contains all the minimum coordinates
61+
of the leaves. */
62+
vector<su2double> coorMaxLeaves; /*!< \brief Vector, which contains all the maximum coordinates
63+
of the leaves. */
64+
protected:
65+
/*!
66+
* \brief Constructor of the class. Nothing to be done.
67+
*/
68+
CADTBaseClass() = default;
69+
70+
/*--- Disable copy operations ---*/
71+
CADTBaseClass(const CADTBaseClass &) = delete;
72+
CADTBaseClass& operator=(const CADTBaseClass &) = delete;
73+
74+
/*!
75+
* \brief Function, which builds the ADT of the given coordinates.
76+
* \param[in] nDim Number of dimensions of the ADT.
77+
* \param[in] nPoints Number of points present in the ADT.
78+
* \param[in] coor Coordinates of the points.
79+
*/
80+
void BuildADT(unsigned short nDim,
81+
unsigned long nPoints,
82+
const su2double *coor);
83+
84+
public:
85+
86+
/*!
87+
* \brief Function, which returns whether or not the ADT is empty.
88+
* \return Whether or not the ADT is empty.
89+
*/
90+
inline bool IsEmpty(void) const { return isEmpty;}
91+
92+
};
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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 7.0.6 "Blackbird"
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-2020, 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+
* \brief Functor, used for the sorting of the points when building an ADT.
34+
* \author E. van der Weide
35+
*/
36+
class CADTComparePointClass {
37+
private:
38+
const su2double *pointCoor; /*!< \brief Pointer to the coordinates of the points. */
39+
const unsigned short splitDirection; /*!< \brief Split direction used in the sorting. */
40+
const unsigned short nDim; /*!< \brief Number of spatial dimensions stored in the coordinates. */
41+
42+
public:
43+
/*!
44+
* \brief Constructor of the class. The member variables are initialized.
45+
* \param[in] coor Pointer to the coordinates of the points.
46+
* \param[in] splitDir Direction that must be used to sort the coordinates.
47+
* \param[in] nDimADT Number of spatial dimensions of the ADT and coordinates.
48+
*/
49+
CADTComparePointClass(const su2double *coor,
50+
const unsigned short splitDir,
51+
const unsigned short nDimADT) : 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,
59+
const unsigned long p1) const {
60+
return pointCoor[nDim*p0+splitDirection] < pointCoor[nDim*p1+splitDirection];
61+
}
62+
63+
/*!
64+
* \brief Default constructor of the class, disabled.
65+
*/
66+
CADTComparePointClass() = delete;
67+
68+
};

0 commit comments

Comments
 (0)