|
| 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 | +}; |
0 commit comments