Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure grid_movement and adt_structure, remove SU2_MSH and grid_adaptation #1035

Merged
merged 12 commits into from
Sep 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions Common/include/adt/CADTBaseClass.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*!
* \file CADTBaseClass.hpp
* \brief Base class for storing an ADT in an arbitrary number of dimensions.
* \author E. van der Weide
* \version 7.0.6 "Blackbird"
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2020, 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 <vector>
#include <array>

#include "../basic_types/datatype_structure.hpp"
#include "./CADTNodeClass.hpp"
#include "../omp_structure.hpp"

using namespace std;

/*!
* \class CADTBaseClass
* \brief Base class for storing an ADT in an arbitrary number of dimensions.
* \author E. van der Weide
*/
class CADTBaseClass {
protected:
unsigned long nLeaves; /*!< \brief Number of leaves in the ADT. */
unsigned short nDimADT; /*!< \brief Number of dimensions of the ADT. */
bool isEmpty; /*!< \brief Whether or not the ADT is empty. */

vector<CADTNodeClass> leaves; /*!< \brief Vector, which contains all the leaves of the ADT. */

#ifdef HAVE_OMP
vector<vector<unsigned long> > FrontLeaves; /*!< \brief Vector used in the tree traversal. */
vector<vector<unsigned long> > FrontLeavesNew; /*!< \brief Vector used in the tree traversal. */
#else
array<vector<unsigned long>,1> FrontLeaves;
array<vector<unsigned long>,1> FrontLeavesNew;
#endif
private:
vector<su2double> coorMinLeaves; /*!< \brief Vector, which contains all the minimum coordinates
of the leaves. */
vector<su2double> coorMaxLeaves; /*!< \brief Vector, which contains all the maximum coordinates
of the leaves. */
protected:
/*!
* \brief Constructor of the class. Nothing to be done.
*/
CADTBaseClass() = default;

/*--- Disable copy operations ---*/
CADTBaseClass(const CADTBaseClass &) = delete;
CADTBaseClass& operator=(const CADTBaseClass &) = delete;

/*!
* \brief Function, which builds the ADT of the given coordinates.
* \param[in] nDim Number of dimensions of the ADT.
* \param[in] nPoints Number of points present in the ADT.
* \param[in] coor Coordinates of the points.
*/
void BuildADT(unsigned short nDim,
unsigned long nPoints,
const su2double *coor);

public:

/*!
* \brief Function, which returns whether or not the ADT is empty.
* \return Whether or not the ADT is empty.
*/
inline bool IsEmpty(void) const { return isEmpty;}

};
68 changes: 68 additions & 0 deletions Common/include/adt/CADTComparePointClass.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*!
* \file CADTComparePointClass.hpp
* \brief subroutines for comparing two points in an alternating digital tree (ADT).
* \author E. van der Weide
* \version 7.0.6 "Blackbird"
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2020, 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 CADTComparePointClass
* \brief Functor, used for the sorting of the points when building an ADT.
* \author E. van der Weide
*/
class CADTComparePointClass {
private:
const su2double *pointCoor; /*!< \brief Pointer to the coordinates of the points. */
const unsigned short splitDirection; /*!< \brief Split direction used in the sorting. */
const unsigned short nDim; /*!< \brief Number of spatial dimensions stored in the coordinates. */

public:
/*!
* \brief Constructor of the class. The member variables are initialized.
* \param[in] coor Pointer to the coordinates of the points.
* \param[in] splitDir Direction that must be used to sort the coordinates.
* \param[in] nDimADT Number of spatial dimensions of the ADT and coordinates.
*/
CADTComparePointClass(const su2double *coor,
const unsigned short splitDir,
const unsigned short nDimADT) : pointCoor(coor), splitDirection(splitDir), nDim(nDimADT) {}

/*!
* \brief Operator used for the sorting of the points.
* \param[in] p0 Index of the first point to be compared.
* \param[in] p1 Index of the second point to be compared.
*/
inline bool operator()(const unsigned long p0,
const unsigned long p1) const {
return pointCoor[nDim*p0+splitDirection] < pointCoor[nDim*p1+splitDirection];
}

/*!
* \brief Default constructor of the class, disabled.
*/
CADTComparePointClass() = delete;

};
Loading