diff --git a/Common/include/drivers/CDriverBase.hpp b/Common/include/drivers/CDriverBase.hpp deleted file mode 100644 index 8f557e47b95..00000000000 --- a/Common/include/drivers/CDriverBase.hpp +++ /dev/null @@ -1,640 +0,0 @@ -/*! - * \file CDriverBase.hpp - * \brief Base class template for all drivers. - * \author H. Patel, A. Gastaldi - * \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 . - */ - -#pragma once - -#include "../../../SU2_CFD/include/numerics/CNumerics.hpp" -#include "../../../SU2_CFD/include/output/COutput.hpp" -#include "../../../SU2_CFD/include/solvers/CSolver.hpp" -#include "../CConfig.hpp" - -class CDriverBase { - protected: - int rank, /*!< \brief MPI Rank. */ - size; /*!< \brief MPI Size. */ - char* config_file_name; /*!< \brief Configuration file name of the problem. */ - - su2double StartTime, /*!< \brief Start point of the timer for performance benchmarking.*/ - StopTime, /*!< \brief Stop point of the timer for performance benchmarking.*/ - UsedTimePreproc, /*!< \brief Elapsed time between Start and Stop point of the timer for tracking preprocessing - phase.*/ - UsedTimeCompute, /*!< \brief Elapsed time between Start and Stop point of the timer for tracking compute phase.*/ - UsedTime; /*!< \brief Elapsed time between Start and Stop point of the timer.*/ - - unsigned long TimeIter; - - unsigned short iMesh, /*!< \brief Iterator on mesh levels. */ - iZone, /*!< \brief Iterator on zones. */ - nZone, /*!< \brief Total number of zones in the problem. */ - nDim, /*!< \brief Number of dimensions. */ - iInst, /*!< \brief Iterator on instance levels. */ - *nInst, /*!< \brief Total number of instances in the problem (per zone). */ - **interface_types; /*!< \brief Type of coupling between the distinct (physical) zones. */ - - CConfig* driver_config; /*!< \brief Definition of the driver configuration. */ - COutput* driver_output; /*!< \brief Definition of the driver output. */ - - CConfig** config_container; /*!< \brief Definition of the particular problem. */ - COutput** output_container; /*!< \brief Pointer to the COutput class. */ - CGeometry**** geometry_container; /*!< \brief Geometrical definition of the problem. */ - CSolver***** solver_container; /*!< \brief Container vector with all the solutions. */ - CNumerics****** numerics_container; /*!< \brief Description of the numerical method (the way in which the equations - are solved). */ - CSurfaceMovement** surface_movement; /*!< \brief Surface movement classes of the problem. */ - CVolumetricMovement*** grid_movement; /*!< \brief Volume grid movement classes of the problem. */ - CFreeFormDefBox*** FFDBox; /*!< \brief FFD FFDBoxes of the problem. */ - - CConfig* main_config; /*!< \brief Reference to base (i.e. ZONE 0) configuration (used in driver API). */ - CGeometry* main_geometry; /*!< \brief Reference to base (i.e. ZONE, INST, MESH 0) geometry (used in driver API). */ - - public: - /*! - * \brief Constructor of the class. - * \param[in] confFile - Configuration file name. - * \param[in] val_nZone - Total number of zones. - * \param[in] MPICommunicator - MPI communicator for SU2. - */ - CDriverBase(char* confFile, unsigned short val_nZone, SU2_Comm MPICommunicator); - - /*! - * \brief Destructor of the class. - */ - virtual ~CDriverBase(void); - - /*! - * \brief A virtual member. - */ - virtual void Preprocessing(){}; - - /*! - * \brief A virtual member. - */ - virtual void Run(){}; - - /*! - * \brief A virtual member. - */ - virtual void Update(){}; - - /*! - * \brief A virtual member. - */ - virtual void Update_Legacy(){}; - - /*! - * \brief A virtual member. - */ - virtual void Output(){}; - - /*! - * \brief A virtual member. - */ - virtual void Postprocessing(){}; - - /*! - * \brief Get the number of design variables. - * \return Number of design variables. - */ - unsigned short GetNumberDesignVariables() const; - - /*! - * \brief Get the number of FFD boxes. - * \return Number of FFD boxes. - */ - unsigned short GetNumberFFDBoxes() const; - - /*! - * \brief Get the number of FFD box corner points. - * \param[in] iFFDBox - FFD box index. - * \return Number of FFD box corner points. - */ - unsigned short GetNumberFFDBoxCornerPoints(unsigned short iFFDBox) const; - - /*! - * \brief Get the number of FFD box control points. - * \param[in] iFFDBox - FFD box index. - * \return Number of FFD box control points. - */ - unsigned short GetNumberFFDBoxControlPoints(unsigned short iFFDBox) const; - - /*! - * \brief Get the number of FFD box surface points. - * \param[in] iFFDBox - FFD box index. - * \return Number of FFD box surface points. - */ - unsigned long GetNumberFFDBoxSurfacePoints(unsigned short iFFDBox) const; - - /*! - * \brief Get the FFD box marker IDs. - * \param[in] iFFDBox - FFD box index. - * \return FFD box marker IDs. - */ - vector GetFFDBoxMarkerIDs(unsigned short iFFDBox) const; - - /*! - * \brief Get the FFD box vertex IDs. - * \param[in] iFFDBox - FFD box index. - * \return FFD box vertex IDs. - */ - vector GetFFDBoxVertexIDs(unsigned short iFFDBox) const; - - /*! - * \brief Get the FFD box grid point IDs. - * \param[in] iFFDBox - FFD box index. - * \return FFD box grid point IDs. - */ - vector GetFFDBoxPointIDs(unsigned short iFFDBox) const; - - /*! - * \brief Get the FFD box corner coordinates. - * \param[in] iFFDBox - FFD box index. - * \return FFD box corner coordinates. - */ - vector> GetFFDBoxCornerCoordinates(unsigned short iFFDBox) const; - - /*! - * \brief Get the FFD box control point coordinates. - * \param[in] iFFDBox - FFD box index. - * \return FFD box control point coordinates. - */ - vector> GetFFDBoxControlPointCoordinates(unsigned short iFFDBox) const; - - /*! - * \brief Get the FFD box control point coordinates. - * \param[in] iFFDBox - FFD box index. - * \param[in] iOrder - Local i-index of the control point. - * \param[in] jOrder - Local j-index of the control point. - * \param[in] kOrder - Local k-index of the control point. - * \return FFD box control point coordinates. - */ - vector GetFFDBoxControlPointCoordinates(unsigned short iFFDBox, unsigned int iOrder, - unsigned int jOrder, unsigned int kOrder) const; - - /*! - * \brief Get the FFD box surface coordinates. - * \param[in] iFFDBox - FFD box index. - * \param[in] parametric - Boolean to indicate if parametric coordinates should be returned. - * \return FFD box surface coordinates. - */ - vector> GetFFDBoxSurfaceCoordinates(unsigned short iFFDBox, bool parametric = false) const; - - /*! - * \brief Get the FFD box surface coordinates. - * \param[in] iFFDBox - FFD box index. - * \param[in] iPoint - FFD surface point index. - * \param[in] parametric - Boolean to indicate if parametric coordinates should be returned. - * \return FFD box surface coordinates. - */ - vector GetFFDBoxSurfaceCoordinates(unsigned short iFFDBox, unsigned long iPoint, - bool parametric = false) const; - - /*! - * \brief Get the number of markers in the mesh. - * \return Number of markers. - */ - unsigned short GetNumberMarkers() const; - - /*! - * \brief Get all the boundary markers tags with their associated indices. - * \return List of boundary markers tags with their indices. - */ - map GetMarkerIndices() const; - - /*! - * \brief Get all the boundary markers tags with their associated types. - * \return List of boundary markers tags with their types. - */ - map GetMarkerTypes() const; - - /*! - * \brief Get all the boundary marker tags. - * \return List of boundary markers tags. - */ - vector GetMarkerTags() const; - - /*! - * \brief Get all the deformable boundary marker tags. - * \return List of deformable boundary markers tags. - */ - vector GetDeformableMarkerTags() const; - - /*! - * \brief Get the number of dimensions of the mesh. - * \return Number of dimensions. - */ - unsigned long GetNumberDimensions() const; - - /*! - * \brief Get the number of elements in the mesh. - * \return Number of elements. - */ - unsigned long GetNumberElements() const; - - /*! - * \brief Get the number of elements in the marker. - * \param[in] iMarker - Marker index. - * \return Number of elements. - */ - unsigned long GetNumberMarkerElements(unsigned short iMarker) const; - - /*! - * \brief Get the global IDs of the mesh elements. - * \return Global element IDs. - */ - vector GetElementIDs() const; - - /*! - * \brief Get the global ID of a mesh element. - * \param[in] iElem - Mesh element index. - * \return Global element ID. - */ - unsigned long GetElementIDs(unsigned long iElem) const; - - /*! - * \brief Get the global IDs of the marker elements. - * \param[in] iMarker - Marker index. - * \return Global element IDs. - */ - vector GetMarkerElementIDs(unsigned short iMarker) const; - - /*! - * \brief Get the global IDs of a marker element. - * \param[in] iMarker - Marker index. - * \param[in] iBound - Marker element index. - * \return Global element ID. - */ - unsigned long GetMarkerElementIDs(unsigned short iMarker, unsigned long iBound) const; - - /*! - * \brief Get the table of vertex IDs belonging to the mesh elements. - * \return Element connectivities (nElem, nNode) - */ - vector> GetElementConnectivities() const; - - /*! - * \brief Get the row of vertex IDs belonging to a mesh element. - * \param[in] iElem - Mesh element index. - * \return Element connectivity (nNode) - */ - vector GetElementConnectivities(unsigned long iElem) const; - - /*! - * \brief Get the table of vertex IDs belonging to the marker elements. - * \param[in] iMarker - Marker index. - * \return Element connectivities (nBound, nNode). - */ - vector> GetMarkerElementConnectivities(unsigned short iMarker) const; - - /*! - * \brief Get the row of vertex IDs belonging to a marker element. - * \param[in] iMarker - Marker index. - * \param[in] iBound - Marker element index. - * \return Element connectivity (nNode). - */ - vector GetMarkerElementConnectivities(unsigned short iMarker, unsigned long iBound) const; - - /*! - * \brief Get the number of vertices in the mesh. - * \return Number of vertices. - */ - unsigned long GetNumberVertices() const; - - /*! - * \brief Get the number of vertices in the marker. - * \param[in] iMarker - Marker index. - * \return Number of vertices. - */ - unsigned long GetNumberMarkerVertices(unsigned short iMarker) const; - - /*! - * \brief Get the number of halo vertices in the mesh. - * \return Number of vertices. - */ - unsigned long GetNumberHaloVertices() const; - - /*! - * \brief Get the number of halo vertices in the marker. - * \param[in] iMarker - Marker index. - * \return Number of vertices. - */ - unsigned long GetNumberMarkerHaloVertices(unsigned short iMarker) const; - - /*! - * \brief Get the mesh vertex indices of the marker vertices. - * \param[in] iMarker - Marker index. - * \return Mesh vertex indices. - */ - vector GetMarkerVertexIndices(unsigned short iMarker) const; - - /*! - * \brief Get the mesh vertex index of a marker vertex. - * \param[in] iMarker - Marker index. - * \param[in] iVertex - Marker vertex index. - * \return Mesh vertex index. - */ - unsigned long GetMarkerVertexIndices(unsigned short iMarker, unsigned long iVertex) const; - - /*! - * \brief Get the global IDs of the mesh vertices. - * \return Global vertex IDs. - */ - vector GetVertexIDs() const; - - /*! - * \brief Get the global ID of a mesh vertex. - * \param[in] iPoint - Mesh vertex index. - * \return Global vertex ID. - */ - unsigned long GetVertexIDs(unsigned long iPoint) const; - - /*! - * \brief Get the global IDs of the marker vertices. - * \param[in] iMarker - Marker index. - * \return Global vertex IDs. - */ - vector GetMarkerVertexIDs(unsigned short iMarker) const; - - /*! - * \brief Get the global ID of a marker vertex. - * \param[in] iMarker - Marker index. - * \param[in] iVertex - Marker vertex index. - * \return Global vertex ID. - */ - unsigned long GetMarkerVertexIDs(unsigned short iMarker, unsigned long iVertex) const; - - /*! - * \brief Get the halo flags of the mesh vertices. - * \return Vertex domain flags. - */ - vector GetDomain() const; - - /*! - * \brief Get the halo flag of a mesh vertex. - * \param[in] iPoint - Mesh vertex index. - * \return Vertex domain flag. - */ - bool GetDomain(unsigned long iPoint) const; - - /*! - * \brief Get the halo flags of the marker vertices. - * \param[in] iMarker - Marker index. - * \return Vertex domain flags. - */ - vector GetMarkerDomain(unsigned short iMarker) const; - - /*! - * \brief Get the halo flag of a marker vertex. - * \param[in] iMarker - Marker index. - * \param[in] iVertex - Marker vertex index. - * \return Vertex domain flag. - */ - bool GetMarkerDomain(unsigned short iMarker, unsigned long iVertex) const; - - /*! - * \brief Get the initial (un-deformed) coordinates of the mesh vertices. - * \return Initial vertex coordinates (nPoint, nDim). - */ - vector> GetInitialCoordinates() const; - - /*! - * \brief Get the initial (un-deformed) coordinates of a mesh vertex. - * \param[in] iPoint - Mesh vertex index. - * \return Initial vertex coordinates (nDim). - */ - vector GetInitialCoordinates(unsigned long iPoint) const; - - /*! - * \brief Get the initial (un-deformed) coordinates of the marker vertices. - * \param[in] iMarker - Marker index. - * \return Initial vertex coordinates (nVertex, nDim). - */ - vector> GetMarkerInitialCoordinates(unsigned short iMarker) const; - - /*! - * \brief Get the initial (un-deformed) coordinates of a marker vertex. - * \param[in] iMarker - Marker index. - * \param[in] iVertex - Marker vertex index. - * \return Initial vertex coordinates (nDim). - */ - vector GetMarkerInitialCoordinates(unsigned short iMarker, unsigned long iVertex) const; - - /*! - * \brief Get the coordinates of the mesh vertices. - * \return Vertex coordinates (nPoint, nDim). - */ - vector> GetCoordinates() const; - - /*! - * \brief Get the coordinates of a mesh vertex. - * \param[in] iPoint - Mesh vertex index. - * \return Vertex coordinates (nDim). - */ - vector GetCoordinates(unsigned long iPoint) const; - - /*! - * \brief Get the coordinates of the marker vertices. - * \param[in] iMarker - Marker index. - * \return Vertex coordinates (nVertex, nDim). - */ - vector> GetMarkerCoordinates(unsigned short iMarker) const; - - /*! - * \brief Get the coordinates of a marker vertex. - * \param[in] iMarker - Marker index. - * \param[in] iVertex - Marker vertex index. - * \return Vertex coordinates (nDim). - */ - vector GetMarkerCoordinates(unsigned short iMarker, unsigned long iVertex) const; - - /*! - * \brief Set the coordinates of the mesh vertices. - * \param[in] values - Vertex coordinates (nPoint, nDim). - */ - void SetCoordinates(vector> values); - - /*! - * \brief Set the coordinates of a mesh vertex. - * \param[in] iPoint - Mesh vertex index. - * \param[in] values - Vertex coordinates (nDim). - */ - void SetCoordinates(unsigned long iPoint, vector values); - - /*! - * \brief Set the coordinates of the marker vertices. - * \param[in] iMarker - Marker index. - * \param[in] values - Vertex coordinates (nVertex, nDim). - */ - void SetMarkerCoordinates(unsigned short iMarker, vector> values); - - /*! - * \brief Set the coordinates of a marker vertex. - * \param[in] iMarker - Marker index. - * \param[in] iVertex - Marker vertex index. - * \param[in] values - Vertex coordinates (nDim). - */ - void SetMarkerCoordinates(unsigned short iMarker, unsigned long iVertex, vector values); - - /*! - * \brief Get the displacements of the marker vertices. - * \param[in] iMarker - Marker index. - * \return Vertex displacements (nVertex, nDim). - */ - vector> GetMarkerDisplacements(unsigned short iMarker) const; - - /*! - * \brief Get the displacements of a marker vertex. - * \param[in] iMarker - Marker index. - * \param[in] iVertex - Marker vertex index. - * \return Vertex displacements (nDim). - */ - vector GetMarkerDisplacements(unsigned short iMarker, unsigned long iVertex) const; - - /*! - * \brief Set the displacements of the marker vertices. - * \param[in] iMarker - Marker index. - * \param[in] values - Vertex displacements (nVertex, nDim). - */ - void SetMarkerDisplacements(unsigned short iMarker, vector> values); - - /*! - * \brief Set the displacements of a marker vertex. - * \param[in] iMarker - Marker index. - * \param[in] iVertex - Marker vertex index. - * \param[in] values - Vertex displacements (nDim). - */ - void SetMarkerDisplacements(unsigned short iMarker, unsigned long iVertex, vector values); - - /*! - * \brief Get the velocities of the marker vertices. - * \param[in] iMarker - Marker index. - * \return Vertex velocities (nVertex, nDim). - */ - vector> GetMarkerVelocities(unsigned short iMarker) const; - - /*! - * \brief Get the velocities of a marker vertex. - * \param[in] iMarker - Marker index. - * \param[in] iVertex - Marker vertex index. - * \return Vertex velocities (nDim). - */ - vector GetMarkerVelocities(unsigned short iMarker, unsigned long iVertex) const; - - /*! - * \brief Set the velocities of the marker vertices. - * \param[in] iMarker - Marker index. - * \param[in] values - Vertex velocities (nVertex, nDim). - */ - void SetMarkerVelocities(unsigned short iMarker, vector> values); - - /*! - * \brief Set the velocities of a marker vertex. - * \param[in] iMarker - Marker index. - * \param[in] iVertex - Marker vertex index. - * \param[in] values - Vertex velocities (nDim). - */ - void SetMarkerVelocities(unsigned short iMarker, unsigned long iVertex, vector values); - - /*! - * \brief Get the normal vectors at the marker vertices. - * \param[in] iMarker - Marker index. - * \param[in] normalize - If true, the unit (i.e. normalized) normal vector is returned. - * \return Normal vector at the vertex (nVertex, nDim). - */ - vector> GetMarkerVertexNormals(unsigned short iMarker, bool normalize = false) const; - - /*! - * \brief Get the normal vectors at a marker vertex. - * \param[in] iMarker - Marker index. - * \param[in] iVertex - Marker vertex index. - * \param[in] normalize - If true, the unit (i.e. normalized) normal vector is returned. - * \return Normal vector at the vertex (nDim). - */ - vector GetMarkerVertexNormals(unsigned short iMarker, unsigned long iVertex, - bool normalize = false) const; - - /*! - * \brief Communicate the boundary mesh displacements. - */ - void CommunicateMeshDisplacements(void); - - protected: - /*! - * \brief Initialize containers. - */ - void SetContainers_Null(); - - /*! - * \brief Read in the config and mesh files. - * \param[in] config - Definition of the particular problem. - * \param[in] driver_config - Definition of the driver configuration. - */ - void Input_Preprocessing(CConfig**& config, CConfig*& driver_config); - - /*! - * \brief Construction of the edge-based data structure and the multi-grid structure. - * \param[in] config - Definition of the particular problem. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] dummy - Definition of the dummy driver. - */ - void Geometrical_Preprocessing(CConfig* config, CGeometry**& geometry, bool dummy); - - /*! - * \brief Definition and allocation of all solution classes. - * \param[in] config - Definition of the particular problem. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] solver - Container vector with all the solutions. - */ - void Solver_Preprocessing(CConfig* config, CGeometry** geometry, CSolver***& solver); - - /*! - * \brief Definition and allocation of all solver classes. - * \param[in] config - Definition of the particular problem. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] solver - Container vector with all the solutions. - * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). - */ - void Numerics_Preprocessing(CConfig* config, CGeometry** geometry, CSolver*** solver, CNumerics****& numerics) const; - - /*! - * \brief Preprocess the output container. - * \param[in] config - Definition of the particular problem. - * \param[in] driver_config - Definition of the driver configuration. - * \param[in] output_container - Container vector with all the outputs. - * \param[in] driver_output - Definition of the driver output. - */ - void Output_Preprocessing(CConfig** config, CConfig* driver_config, COutput**& output_container, - COutput*& driver_output); - - /*! - * \brief Read the free form deformation box information from the input mesh file. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] config - Definition of the particular problem. - * \param[in] FFDBox - Definition of the FFD boxes of the problem. - * \param[in] val_mesh_filename - Name of the input mesh file. - */ - void ReadFFDInfo(CGeometry* geometry, CConfig* config, CFreeFormDefBox** FFDBox, string val_mesh_filename); -}; diff --git a/Common/src/drivers/CDriverBase.cpp b/Common/src/drivers/CDriverBase.cpp deleted file mode 100644 index dd1e3f9c88e..00000000000 --- a/Common/src/drivers/CDriverBase.cpp +++ /dev/null @@ -1,1308 +0,0 @@ -/*! - * \file CDriverBase.hpp - * \brief Base class template for all drivers. - * \author H. Patel, A. Gastaldi - * \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 . - */ - -#include "../../include/drivers/CDriverBase.hpp" - -#include "../../include/geometry/CPhysicalGeometry.hpp" -#include "../../include/toolboxes/geometry_toolbox.hpp" - -using namespace std; - -CDriverBase::CDriverBase(char* confFile, unsigned short val_nZone, SU2_Comm MPICommunicator) - : config_file_name(confFile), StartTime(0.0), StopTime(0.0), UsedTime(0.0), TimeIter(0), nZone(val_nZone) {} - -CDriverBase::~CDriverBase(void) {} - -void CDriverBase::SetContainers_Null() { - /*--- Create pointers to all the classes that may be used by drivers. In general, the pointers are instantiated - * down a hierarchy over all zones, multi-grid levels, equation sets, and equation terms as described in the comments - * below. ---*/ - - config_container = nullptr; - output_container = nullptr; - geometry_container = nullptr; - solver_container = nullptr; - numerics_container = nullptr; - - surface_movement = nullptr; - grid_movement = nullptr; - FFDBox = nullptr; - - config_container = new CConfig*[nZone](); - output_container = new COutput*[nZone](); - geometry_container = new CGeometry***[nZone](); - solver_container = new CSolver****[nZone](); - numerics_container = new CNumerics*****[nZone](); - surface_movement = new CSurfaceMovement*[nZone](); - grid_movement = new CVolumetricMovement**[nZone](); - FFDBox = new CFreeFormDefBox**[nZone](); - - nInst = new unsigned short[nZone]; - - for (iZone = 0; iZone < nZone; iZone++) { - nInst[iZone] = 1; - FFDBox[iZone] = new CFreeFormDefBox*[MAX_NUMBER_FFD]; - } - - driver_config = nullptr; - driver_output = nullptr; - - main_config = nullptr; - main_geometry = nullptr; -} - -unsigned short CDriverBase::GetNumberDesignVariables() const { return main_config->GetnDV(); } - -unsigned short CDriverBase::GetNumberFFDBoxes() const { return main_config->GetnFFDBox(); } - -unsigned short CDriverBase::GetNumberFFDBoxCornerPoints(unsigned short iFFDBox) const { - return FFDBox[ZONE_0][iFFDBox]->GetnCornerPoints(); -} - -unsigned short CDriverBase::GetNumberFFDBoxControlPoints(unsigned short iFFDBox) const { - return FFDBox[ZONE_0][iFFDBox]->GetnControlPoints(); -} - -unsigned long CDriverBase::GetNumberFFDBoxSurfacePoints(unsigned short iFFDBox) const { - return FFDBox[ZONE_0][iFFDBox]->GetnSurfacePoint(); -} - -vector CDriverBase::GetFFDBoxMarkerIDs(unsigned short iFFDBox) const { - vector values; - - for (auto iPoint = 0ul; iPoint < GetNumberFFDBoxSurfacePoints(iFFDBox); iPoint++) { - values.push_back(FFDBox[ZONE_0][iFFDBox]->Get_MarkerIndex(iPoint)); - } - return values; -} - -vector CDriverBase::GetFFDBoxVertexIDs(unsigned short iFFDBox) const { - vector values; - - for (auto iPoint = 0ul; iPoint < GetNumberFFDBoxSurfacePoints(iFFDBox); iPoint++) { - values.push_back(FFDBox[ZONE_0][iFFDBox]->Get_VertexIndex(iPoint)); - } - return values; -} - -vector CDriverBase::GetFFDBoxPointIDs(unsigned short iFFDBox) const { - vector values; - - for (auto iPoint = 0ul; iPoint < GetNumberFFDBoxSurfacePoints(iFFDBox); iPoint++) { - values.push_back(FFDBox[ZONE_0][iFFDBox]->Get_PointIndex(iPoint)); - } - return values; -} - -vector> CDriverBase::GetFFDBoxCornerCoordinates(unsigned short iFFDBox) const { - vector> values; - - for (auto iPoint = 0u; iPoint < GetNumberFFDBoxCornerPoints(iFFDBox); iPoint++) { - vector coords; - - const su2double* coord = FFDBox[ZONE_0][iFFDBox]->GetCoordCornerPoints(iPoint); - - for (auto iDim = 0u; iDim < nDim; iDim++) { - coords.push_back(SU2_TYPE::GetValue(coord[iDim])); - } - - values.push_back(coords); - } - - return values; -} - -vector> CDriverBase::GetFFDBoxControlPointCoordinates(unsigned short iFFDBox) const { - vector> values; - - for (auto iOrder = 0u; iOrder < FFDBox[ZONE_0][iFFDBox]->GetlOrder(); iOrder++) { - for (auto jOrder = 0u; jOrder < FFDBox[ZONE_0][iFFDBox]->GetmOrder(); jOrder++) { - for (auto kOrder = 0u; kOrder < FFDBox[ZONE_0][iFFDBox]->GetnOrder(); kOrder++) { - values.push_back(GetFFDBoxControlPointCoordinates(iFFDBox, iOrder, jOrder, kOrder)); - } - } - } - - return values; -} - -vector CDriverBase::GetFFDBoxControlPointCoordinates(unsigned short iFFDBox, unsigned int iOrder, - unsigned int jOrder, unsigned int kOrder) const { - vector values; - - const su2double* coord = FFDBox[ZONE_0][iFFDBox]->GetCoordControlPoints(iOrder, jOrder, kOrder); - - for (auto iDim = 0u; iDim < nDim; iDim++) { - values.push_back(SU2_TYPE::GetValue(coord[iDim])); - } - - return values; -} - -vector> CDriverBase::GetFFDBoxSurfaceCoordinates(unsigned short iFFDBox, bool parametric) const { - vector> values; - - for (auto iPoint = 0ul; iPoint < GetNumberFFDBoxSurfacePoints(iFFDBox); iPoint++) { - values.push_back(GetFFDBoxSurfaceCoordinates(iFFDBox, iPoint, parametric)); - } - - return values; -} - -vector CDriverBase::GetFFDBoxSurfaceCoordinates(unsigned short iFFDBox, unsigned long iPoint, - bool parametric) const { - vector values; - const su2double* coord; - - if (parametric) { - coord = FFDBox[ZONE_0][iFFDBox]->Get_ParametricCoord(iPoint); - } else { - coord = FFDBox[ZONE_0][iFFDBox]->Get_CartesianCoord(iPoint); - } - - for (auto iDim = 0u; iDim < nDim; iDim++) { - values.push_back(SU2_TYPE::GetValue(coord[iDim])); - } - - return values; -} - -unsigned short CDriverBase::GetNumberMarkers() const { return main_config->GetnMarker_All(); } - -map CDriverBase::GetMarkerIndices() const { - const auto nMarker = main_config->GetnMarker_All(); - map indexMap; - - for (auto iMarker = 0u; iMarker < nMarker; iMarker++) { - auto tag = main_config->GetMarker_All_TagBound(iMarker); - - indexMap[tag] = iMarker; - } - - return indexMap; -} - -map CDriverBase::GetMarkerTypes() const { - map typeMap; - string type; - - for (auto iMarker = 0u; iMarker < main_config->GetnMarker_All(); iMarker++) { - auto tag = main_config->GetMarker_All_TagBound(iMarker); - auto kindBC = main_config->GetMarker_All_KindBC(iMarker); - - switch (kindBC) { - case EULER_WALL: - type = "EULER_WALL"; - break; - case FAR_FIELD: - type = "FARFIELD"; - break; - case ISOTHERMAL: - type = "ISOTHERMAL"; - break; - case HEAT_FLUX: - type = "HEAT_FLUX"; - break; - case HEAT_TRANSFER: - type = "HEAT_TRANSFER"; - break; - case INLET_FLOW: - type = "INLET_FLOW"; - break; - case OUTLET_FLOW: - type = "OUTLET_FLOW"; - break; - case SUPERSONIC_INLET: - type = "SUPERSONIC_INLET"; - break; - case SUPERSONIC_OUTLET: - type = "SUPERSONIC_OUTLET"; - break; - case RIEMANN_BOUNDARY: - type = "RIEMANN"; - break; - case GILES_BOUNDARY: - type = "GILES"; - break; - case DISPLACEMENT_BOUNDARY: - type = "DISPLACEMENT"; - break; - case LOAD_BOUNDARY: - type = "LOAD"; - break; - case PERIODIC_BOUNDARY: - type = "PERIODIC"; - break; - case SYMMETRY_PLANE: - type = "SYMMETRY"; - break; - case SEND_RECEIVE: - type = "SEND_RECEIVE"; - break; - default: - type = "UNKNOWN_TYPE"; - } - typeMap[tag] = type; - } - - return typeMap; -} - -vector CDriverBase::GetMarkerTags() const { - vector tags; - const auto nMarker = main_config->GetnMarker_All(); - - for (auto iMarker = 0u; iMarker < nMarker; iMarker++) { - tags.push_back(main_config->GetMarker_All_TagBound(iMarker)); - } - - return tags; -} - -vector CDriverBase::GetDeformableMarkerTags() const { - vector tags; - const auto nMarker = main_config->GetnMarker_Deform_Mesh(); - - for (auto iMarker = 0u; iMarker < nMarker; iMarker++) { - tags.push_back(main_config->GetMarker_Deform_Mesh_TagBound(iMarker)); - } - - return tags; -} - -unsigned long CDriverBase::GetNumberDimensions() const { return main_geometry->GetnDim(); } - -unsigned long CDriverBase::GetNumberElements() const { return main_geometry->GetnElem(); } - -unsigned long CDriverBase::GetNumberMarkerElements(unsigned short iMarker) const { - if (iMarker >= GetNumberMarkers()) { - SU2_MPI::Error("Marker index exceeds size.", CURRENT_FUNCTION); - } - - return main_geometry->GetnElem_Bound(iMarker); -} - -vector CDriverBase::GetElementIDs() const { - const auto nElem = GetNumberElements(); - - vector values; - - for (auto iElem = 0ul; iElem < nElem; iElem++) { - values.push_back(GetElementIDs(iElem)); - } - - return values; -} - -unsigned long CDriverBase::GetElementIDs(unsigned long iElem) const { - if (iElem >= GetNumberElements()) { - SU2_MPI::Error("Element index exceeds size.", CURRENT_FUNCTION); - } - - return main_geometry->elem[iElem]->GetGlobalIndex(); -} - -vector CDriverBase::GetMarkerElementIDs(unsigned short iMarker) const { - const auto nBound = GetNumberMarkerElements(iMarker); - - vector values; - - for (auto iBound = 0ul; iBound < nBound; iBound++) { - values.push_back(GetMarkerElementIDs(iMarker, iBound)); - } - - return values; -} - -unsigned long CDriverBase::GetMarkerElementIDs(unsigned short iMarker, unsigned long iBound) const { - if (iBound >= GetNumberMarkerElements(iMarker)) { - SU2_MPI::Error("Marker element index exceeds size.", CURRENT_FUNCTION); - } - - return main_geometry->bound[iMarker][iBound]->GetGlobalIndex(); -} - -vector> CDriverBase::GetElementConnectivities() const { - const auto nElem = GetNumberElements(); - - vector> values; - - for (auto iElem = 0ul; iElem < nElem; iElem++) { - values.push_back(GetElementConnectivities(iElem)); - } - - return values; -} - -vector CDriverBase::GetElementConnectivities(unsigned long iElem) const { - if (iElem >= GetNumberElements()) { - SU2_MPI::Error("Element index exceeds size.", CURRENT_FUNCTION); - } - - unsigned short nNode = main_geometry->elem[iElem]->GetnNodes(); - - vector values; - - for (auto iNode = 0u; iNode < nNode; iNode++) { - unsigned long iPoint = main_geometry->elem[iElem]->GetNode(iNode); - - values.push_back(main_geometry->nodes->GetGlobalIndex(iPoint)); - } - - return values; -} - -vector> CDriverBase::GetMarkerElementConnectivities(unsigned short iMarker) const { - const auto nBound = GetNumberMarkerElements(iMarker); - - vector> values; - - for (auto iBound = 0ul; iBound < nBound; iBound++) { - values.push_back(GetMarkerElementConnectivities(iMarker, iBound)); - } - - return values; -} - -vector CDriverBase::GetMarkerElementConnectivities(unsigned short iMarker, unsigned long iBound) const { - if (iBound >= GetNumberMarkerElements(iMarker)) { - SU2_MPI::Error("Marker element index exceeds size.", CURRENT_FUNCTION); - } - - unsigned short nNode = main_geometry->bound[iMarker][iBound]->GetnNodes(); - - vector values; - - for (auto iNode = 0u; iNode < nNode; iNode++) { - unsigned long iPoint = main_geometry->bound[iMarker][iBound]->GetNode(iNode); - - values.push_back(main_geometry->nodes->GetGlobalIndex(iPoint)); - } - - return values; -} - -unsigned long CDriverBase::GetNumberVertices() const { return main_geometry->GetnPoint(); } - -unsigned long CDriverBase::GetNumberMarkerVertices(unsigned short iMarker) const { - if (iMarker >= GetNumberMarkers()) { - SU2_MPI::Error("Marker index exceeds size.", CURRENT_FUNCTION); - } - - return main_geometry->GetnVertex(iMarker); -} - -unsigned long CDriverBase::GetNumberHaloVertices() const { - const auto nPoint = GetNumberVertices(); - unsigned long nHalo = 0; - - for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) { - if (!(main_geometry->nodes->GetDomain(iPoint))) { - nHalo += 1; - } - } - - return nHalo; -} - -unsigned long CDriverBase::GetNumberMarkerHaloVertices(unsigned short iMarker) const { - const auto nVertex = GetNumberMarkerVertices(iMarker); - unsigned long nHalo = 0; - - for (auto iVertex = 0ul; iVertex < nVertex; iVertex++) { - auto iPoint = GetMarkerVertexIndices(iMarker, iVertex); - - if (!(main_geometry->nodes->GetDomain(iPoint))) { - nHalo += 1; - } - } - - return nHalo; -} - -vector CDriverBase::GetMarkerVertexIndices(unsigned short iMarker) const { - const auto nVertex = GetNumberMarkerVertices(iMarker); - - vector values; - - for (auto iVertex = 0ul; iVertex < nVertex; iVertex++) { - values.push_back(GetMarkerVertexIndices(iMarker, iVertex)); - } - - return values; -} - -unsigned long CDriverBase::GetMarkerVertexIndices(unsigned short iMarker, unsigned long iVertex) const { - if (iVertex >= GetNumberMarkerVertices(iMarker)) { - SU2_MPI::Error("Vertex index exceeds marker size.", CURRENT_FUNCTION); - } - - return geometry_container[MESH_0][INST_0][ZONE_0]->vertex[iMarker][iVertex]->GetNode(); -} - -vector CDriverBase::GetVertexIDs() const { - const auto nPoint = GetNumberVertices(); - - vector values; - - for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) { - values.push_back(GetVertexIDs(iPoint)); - } - - return values; -} - -unsigned long CDriverBase::GetVertexIDs(unsigned long iPoint) const { - if (iPoint >= GetNumberVertices()) { - SU2_MPI::Error("Vertex index exceeds mesh size.", CURRENT_FUNCTION); - } - - return main_geometry->nodes->GetGlobalIndex(iPoint); -} - -vector CDriverBase::GetMarkerVertexIDs(unsigned short iMarker) const { - const auto nVertex = GetNumberMarkerVertices(iMarker); - - vector values; - - for (auto iVertex = 0ul; iVertex < nVertex; iVertex++) { - values.push_back(GetMarkerVertexIDs(iMarker, iVertex)); - } - - return values; -} - -unsigned long CDriverBase::GetMarkerVertexIDs(unsigned short iMarker, unsigned long iVertex) const { - auto iPoint = GetMarkerVertexIndices(iMarker, iVertex); - - return main_geometry->nodes->GetGlobalIndex(iPoint); -} - -vector CDriverBase::GetDomain() const { - const auto nPoint = GetNumberVertices(); - - vector values; - - for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) { - values.push_back(GetDomain(iPoint)); - } - - return values; -} - -bool CDriverBase::GetDomain(unsigned long iPoint) const { - if (iPoint >= GetNumberVertices()) { - SU2_MPI::Error("Vertex index exceeds mesh size.", CURRENT_FUNCTION); - } - - return main_geometry->nodes->GetDomain(iPoint); -} - -vector CDriverBase::GetMarkerDomain(unsigned short iMarker) const { - const auto nVertex = GetNumberMarkerVertices(iMarker); - - vector values; - - for (auto iVertex = 0ul; iVertex < nVertex; iVertex++) { - values.push_back(GetMarkerDomain(iMarker, iVertex)); - } - - return values; -} - -bool CDriverBase::GetMarkerDomain(unsigned short iMarker, unsigned long iVertex) const { - auto iPoint = GetMarkerVertexIndices(iMarker, iVertex); - - return main_geometry->nodes->GetDomain(iPoint); -} - -vector> CDriverBase::GetInitialCoordinates() const { - const auto nPoint = GetNumberVertices(); - - vector> values; - - for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) { - values.push_back(GetInitialCoordinates(iPoint)); - } - - return values; -} - -vector CDriverBase::GetInitialCoordinates(unsigned long iPoint) const { - if (iPoint >= GetNumberVertices()) { - SU2_MPI::Error("Vertex index exceeds mesh size.", CURRENT_FUNCTION); - } - - vector values(nDim, 0.0); - - if (!main_config->GetDeform_Mesh()) { - return values; - } - - for (auto iDim = 0u; iDim < nDim; iDim++) { - const su2double value = solver_container[ZONE_0][INST_0][MESH_0][MESH_SOL]->GetNodes()->GetMesh_Coord(iPoint, iDim); - - values[iDim] = SU2_TYPE::GetValue(value); - } - - return values; -} - -vector> CDriverBase::GetMarkerInitialCoordinates(unsigned short iMarker) const { - const auto nVertex = GetNumberMarkerVertices(iMarker); - - vector> values; - - for (auto iVertex = 0ul; iVertex < nVertex; iVertex++) { - values.push_back(GetMarkerInitialCoordinates(iMarker, iVertex)); - } - - return values; -} - -vector CDriverBase::GetMarkerInitialCoordinates(unsigned short iMarker, unsigned long iVertex) const { - auto iPoint = GetMarkerVertexIndices(iMarker, iVertex); - - vector values(nDim, 0.0); - - if (!main_config->GetDeform_Mesh()) { - return values; - } - - for (auto iDim = 0u; iDim < nDim; iDim++) { - const su2double value = solver_container[ZONE_0][INST_0][MESH_0][MESH_SOL]->GetNodes()->GetMesh_Coord(iPoint, iDim); - - values[iDim] = SU2_TYPE::GetValue(value); - } - - return values; -} - -vector> CDriverBase::GetCoordinates() const { - const auto nPoint = GetNumberVertices(); - - vector> values; - - for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) { - values.push_back(GetCoordinates(iPoint)); - } - - return values; -} - -vector CDriverBase::GetCoordinates(unsigned long iPoint) const { - if (iPoint >= GetNumberVertices()) { - SU2_MPI::Error("Vertex index exceeds mesh size.", CURRENT_FUNCTION); - } - - vector values; - - for (auto iDim = 0u; iDim < nDim; iDim++) { - const su2double value = main_geometry->nodes->GetCoord(iPoint, iDim); - - values.push_back(SU2_TYPE::GetValue(value)); - } - - return values; -} - -vector> CDriverBase::GetMarkerCoordinates(unsigned short iMarker) const { - const auto nVertex = GetNumberMarkerVertices(iMarker); - - vector> values; - - for (auto iVertex = 0ul; iVertex < nVertex; iVertex++) { - values.push_back(GetMarkerCoordinates(iMarker, iVertex)); - } - - return values; -} - -vector CDriverBase::GetMarkerCoordinates(unsigned short iMarker, unsigned long iVertex) const { - auto iPoint = GetMarkerVertexIndices(iMarker, iVertex); - - vector values; - - for (auto iDim = 0u; iDim < nDim; iDim++) { - const su2double value = main_geometry->nodes->GetCoord(iPoint, iDim); - - values.push_back(SU2_TYPE::GetValue(value)); - } - - return values; -} - -void CDriverBase::SetCoordinates(vector> values) { - const auto nPoint = GetNumberVertices(); - - if (values.size() != nPoint) { - SU2_MPI::Error("Invalid number of vertices!", CURRENT_FUNCTION); - } - - for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) { - SetCoordinates(iPoint, values[iPoint]); - } -} - -void CDriverBase::SetCoordinates(unsigned long iPoint, vector values) { - if (iPoint >= GetNumberVertices()) { - SU2_MPI::Error("Vertex index exceeds mesh size.", CURRENT_FUNCTION); - } - if (values.size() != nDim) { - SU2_MPI::Error("Invalid number of dimensions!", CURRENT_FUNCTION); - } - - for (auto iDim = 0u; iDim < nDim; iDim++) { - main_geometry->nodes->SetCoord(iPoint, iDim, values[iDim]); - } -} - -void CDriverBase::SetMarkerCoordinates(unsigned short iMarker, vector> values) { - const auto nVertex = GetNumberMarkerVertices(iMarker); - - if (values.size() != nVertex) { - SU2_MPI::Error("Invalid number of marker vertices!", CURRENT_FUNCTION); - } - - for (auto iVertex = 0ul; iVertex < nVertex; iVertex++) { - SetMarkerCoordinates(iMarker, iVertex, values[iVertex]); - } -} - -void CDriverBase::SetMarkerCoordinates(unsigned short iMarker, unsigned long iVertex, vector values) { - auto iPoint = GetMarkerVertexIndices(iMarker, iVertex); - - if (values.size() != nDim) { - SU2_MPI::Error("Invalid number of dimensions!", CURRENT_FUNCTION); - } - - for (auto iDim = 0u; iDim < nDim; iDim++) { - main_geometry->nodes->SetCoord(iPoint, iDim, values[iDim]); - } -} - -vector> CDriverBase::GetMarkerDisplacements(unsigned short iMarker) const { - const auto nVertex = GetNumberMarkerVertices(iMarker); - - vector> values; - - for (auto iVertex = 0ul; iVertex < nVertex; iVertex++) { - values.push_back(GetMarkerDisplacements(iMarker, iVertex)); - } - - return values; -} - -vector CDriverBase::GetMarkerDisplacements(unsigned short iMarker, unsigned long iVertex) const { - auto iPoint = GetMarkerVertexIndices(iMarker, iVertex); - - vector values(nDim, 0.0); - - if (!main_config->GetDeform_Mesh()) { - return values; - } - - for (auto iDim = 0u; iDim < nDim; iDim++) { - const su2double value = solver_container[ZONE_0][INST_0][MESH_0][MESH_SOL]->GetNodes()->GetBound_Disp(iPoint, iDim); - - values[iDim] = SU2_TYPE::GetValue(value); - } - - return values; -} - -void CDriverBase::SetMarkerDisplacements(unsigned short iMarker, vector> values) { - if (!main_config->GetDeform_Mesh()) { - SU2_MPI::Error("Mesh solver is not defined!", CURRENT_FUNCTION); - } - - const auto nVertex = GetNumberMarkerVertices(iMarker); - - if (values.size() != nVertex) { - SU2_MPI::Error("Invalid number of marker vertices!", CURRENT_FUNCTION); - } - - for (auto iVertex = 0ul; iVertex < nVertex; iVertex++) { - SetMarkerDisplacements(iMarker, iVertex, values[iVertex]); - } -} - -void CDriverBase::SetMarkerDisplacements(unsigned short iMarker, unsigned long iVertex, vector values) { - if (!main_config->GetDeform_Mesh()) { - SU2_MPI::Error("Mesh solver is not defined!", CURRENT_FUNCTION); - } - - auto iPoint = GetMarkerVertexIndices(iMarker, iVertex); - - if (values.size() != nDim) { - SU2_MPI::Error("Invalid number of dimensions!", CURRENT_FUNCTION); - } - - for (auto iDim = 0u; iDim < nDim; iDim++) { - solver_container[ZONE_0][INST_0][MESH_0][MESH_SOL]->GetNodes()->SetBound_Disp(iPoint, iDim, values[iDim]); - } -} - -vector> CDriverBase::GetMarkerVelocities(unsigned short iMarker) const { - const auto nVertex = GetNumberMarkerVertices(iMarker); - - vector> values; - - for (auto iVertex = 0ul; iVertex < nVertex; iVertex++) { - values.push_back(GetMarkerVelocities(iMarker, iVertex)); - } - - return values; -} - -vector CDriverBase::GetMarkerVelocities(unsigned short iMarker, unsigned long iVertex) const { - auto iPoint = GetMarkerVertexIndices(iMarker, iVertex); - - vector values(nDim, 0.0); - - if (!main_config->GetDeform_Mesh()) { - return values; - } - - for (auto iDim = 0u; iDim < nDim; iDim++) { - const su2double value = solver_container[ZONE_0][INST_0][MESH_0][MESH_SOL]->GetNodes()->GetBound_Vel(iPoint, iDim); - - values[iDim] = SU2_TYPE::GetValue(value); - } - - return values; -} - -void CDriverBase::SetMarkerVelocities(unsigned short iMarker, vector> values) { - if (!main_config->GetDeform_Mesh()) { - SU2_MPI::Error("Mesh solver is not defined!", CURRENT_FUNCTION); - } - - const auto nVertex = GetNumberMarkerVertices(iMarker); - - if (values.size() != nVertex) { - SU2_MPI::Error("Invalid number of marker vertices!", CURRENT_FUNCTION); - } - - for (auto iVertex = 0ul; iVertex < nVertex; iVertex++) { - SetMarkerVelocities(iMarker, iVertex, values[iVertex]); - } -} - -void CDriverBase::SetMarkerVelocities(unsigned short iMarker, unsigned long iVertex, vector values) { - if (!main_config->GetDeform_Mesh()) { - SU2_MPI::Error("Mesh solver is not defined!", CURRENT_FUNCTION); - } - - auto iPoint = GetMarkerVertexIndices(iMarker, iVertex); - - if (values.size() != nDim) { - SU2_MPI::Error("Invalid number of dimensions!", CURRENT_FUNCTION); - } - - for (auto iDim = 0u; iDim < nDim; iDim++) { - solver_container[ZONE_0][INST_0][MESH_0][MESH_SOL]->GetNodes()->SetBound_Disp(iPoint, iDim, values[iDim]); - } -} - -vector> CDriverBase::GetMarkerVertexNormals(unsigned short iMarker, bool normalize) const { - const auto nVertex = GetNumberMarkerVertices(iMarker); - - vector> values; - - for (auto iVertex = 0ul; iVertex < nVertex; iVertex++) { - values.push_back(GetMarkerVertexNormals(iMarker, iVertex, normalize = normalize)); - } - - return values; -} - -vector CDriverBase::GetMarkerVertexNormals(unsigned short iMarker, unsigned long iVertex, - bool normalize) const { - if (iVertex >= GetNumberMarkerVertices(iMarker)) { - SU2_MPI::Error("Vertex index exceeds marker size.", CURRENT_FUNCTION); - } - - vector values(nDim, 0.0); - - auto normal = main_geometry->vertex[iMarker][iVertex]->GetNormal(); - auto area = GeometryToolbox::Norm(nDim, normal); - - for (auto iDim = 0u; iDim < nDim; iDim++) { - if (normalize) { - values[iDim] = SU2_TYPE::GetValue(normal[iDim] / area); - } else { - values[iDim] = SU2_TYPE::GetValue(normal[iDim]); - } - } - - return values; -} - -void CDriverBase::CommunicateMeshDisplacements(void) { - solver_container[ZONE_0][INST_0][MESH_0][MESH_SOL]->InitiateComms(main_geometry, main_config, MESH_DISPLACEMENTS); - solver_container[ZONE_0][INST_0][MESH_0][MESH_SOL]->CompleteComms(main_geometry, main_config, MESH_DISPLACEMENTS); -} - -void CDriverBase::ReadFFDInfo(CGeometry* geometry, CConfig* config, CFreeFormDefBox** FFDBox, string val_mesh_filename) { - string text_line, iTag; - ifstream mesh_file; - su2double CPcoord[3], coord[] = {0, 0, 0}; - unsigned short degree[3], iFFDBox, iCornerPoints, iControlPoints, iMarker, iDegree, jDegree, kDegree, iChar, - LevelFFDBox, nParentFFDBox, iParentFFDBox, nChildFFDBox, iChildFFDBox, nMarker, *nCornerPoints, *nControlPoints; - unsigned long iSurfacePoints, iPoint, jPoint, iVertex, nVertex, nPoint, iElem = 0, nElem, my_nSurfPoints, nSurfPoints, - *nSurfacePoints; - su2double XCoord, YCoord; - - bool polar = (config->GetFFD_CoordSystem() == POLAR); - unsigned short nDim = geometry->GetnDim(), iDim; - unsigned short SplineOrder[3]; - unsigned short Blending = 0; - - unsigned short nFFDBox = 0; - unsigned short nLevel = 0; - - mesh_file.open(val_mesh_filename); - if (mesh_file.fail()) { - SU2_MPI::Error("There is no geometry file (ReadFFDInfo)!!", CURRENT_FUNCTION); - } - - while (getline(mesh_file, text_line)) { - /*--- Read the inner elements. ---*/ - - string::size_type position = text_line.find("NELEM=", 0); - if (position != string::npos) { - text_line.erase(0, 6); - nElem = atoi(text_line.c_str()); - for (iElem = 0; iElem < nElem; iElem++) { - getline(mesh_file, text_line); - } - } - - /*--- Read the inner points. ---*/ - - position = text_line.find("NPOIN=", 0); - if (position != string::npos) { - text_line.erase(0, 6); - nPoint = atoi(text_line.c_str()); - for (iPoint = 0; iPoint < nPoint; iPoint++) { - getline(mesh_file, text_line); - } - } - - /*--- Read the boundaries. ---*/ - - position = text_line.find("NMARK=", 0); - if (position != string::npos) { - text_line.erase(0, 6); - nMarker = atoi(text_line.c_str()); - for (iMarker = 0; iMarker < nMarker; iMarker++) { - getline(mesh_file, text_line); - getline(mesh_file, text_line); - text_line.erase(0, 13); - nVertex = atoi(text_line.c_str()); - for (iVertex = 0; iVertex < nVertex; iVertex++) { - getline(mesh_file, text_line); - } - } - } - - /*--- Read the FFDBox information. ---*/ - - position = text_line.find("FFD_NBOX=", 0); - if (position != string::npos) { - text_line.erase(0, 9); - nFFDBox = atoi(text_line.c_str()); - - if (rank == MASTER_NODE) cout << nFFDBox << " Free Form Deformation boxes." << endl; - - nCornerPoints = new unsigned short[nFFDBox]; - nControlPoints = new unsigned short[nFFDBox]; - nSurfacePoints = new unsigned long[nFFDBox]; - - getline(mesh_file, text_line); - text_line.erase(0, 11); - nLevel = atoi(text_line.c_str()); - - if (rank == MASTER_NODE) cout << nLevel << " Free Form Deformation nested levels." << endl; - - for (iFFDBox = 0; iFFDBox < nFFDBox; iFFDBox++) { - /*--- Read the name of the FFD box. ---*/ - - getline(mesh_file, text_line); - text_line.erase(0, 8); - - /*--- Remove extra data from the FFDBox name. ---*/ - - string::size_type position; - for (iChar = 0; iChar < 20; iChar++) { - position = text_line.find(" ", 0); - if (position != string::npos) text_line.erase(position, 1); - position = text_line.find("\r", 0); - if (position != string::npos) text_line.erase(position, 1); - position = text_line.find("\n", 0); - if (position != string::npos) text_line.erase(position, 1); - } - - string TagFFDBox = text_line.c_str(); - - if (rank == MASTER_NODE) cout << "FFD box tag: " << TagFFDBox << ". "; - - /*--- Read the level of the FFD box. ---*/ - - getline(mesh_file, text_line); - text_line.erase(0, 10); - LevelFFDBox = atoi(text_line.c_str()); - - if (rank == MASTER_NODE) cout << "FFD box level: " << LevelFFDBox << ". "; - - /*--- Read the degree of the FFD box. ---*/ - - if (nDim == 2) { - if (polar) { - getline(mesh_file, text_line); - text_line.erase(0, 13); - degree[0] = atoi(text_line.c_str()); - degree[1] = 1; - getline(mesh_file, text_line); - text_line.erase(0, 13); - degree[2] = atoi(text_line.c_str()); - } else { - getline(mesh_file, text_line); - text_line.erase(0, 13); - degree[0] = atoi(text_line.c_str()); - getline(mesh_file, text_line); - text_line.erase(0, 13); - degree[1] = atoi(text_line.c_str()); - degree[2] = 1; - } - } else { - getline(mesh_file, text_line); - text_line.erase(0, 13); - degree[0] = atoi(text_line.c_str()); - getline(mesh_file, text_line); - text_line.erase(0, 13); - degree[1] = atoi(text_line.c_str()); - getline(mesh_file, text_line); - text_line.erase(0, 13); - degree[2] = atoi(text_line.c_str()); - } - - if (rank == MASTER_NODE) { - if (nDim == 2) { - if (polar) - cout << "Degrees: " << degree[0] << ", " << degree[2] << "." << endl; - else - cout << "Degrees: " << degree[0] << ", " << degree[1] << "." << endl; - } else - cout << "Degrees: " << degree[0] << ", " << degree[1] << ", " << degree[2] << "." << endl; - } - - getline(mesh_file, text_line); - if (text_line.substr(0, 12) != "FFD_BLENDING") { - SU2_MPI::Error( - string("Deprecated FFD information found in mesh file.\n") + - string( - "FFD information generated with SU2 version <= 4.3 is incompatible with the current version.") + - string("Run SU2_DEF again with DV_KIND= FFD_SETTING."), - CURRENT_FUNCTION); - } - text_line.erase(0, 14); - if (text_line == "BEZIER") { - Blending = BEZIER; - } - if (text_line == "BSPLINE_UNIFORM") { - Blending = BSPLINE_UNIFORM; - } - - if (Blending == BSPLINE_UNIFORM) { - getline(mesh_file, text_line); - text_line.erase(0, 17); - SplineOrder[0] = atoi(text_line.c_str()); - getline(mesh_file, text_line); - text_line.erase(0, 17); - SplineOrder[1] = atoi(text_line.c_str()); - if (nDim == 3) { - getline(mesh_file, text_line); - text_line.erase(0, 17); - SplineOrder[2] = atoi(text_line.c_str()); - } else { - SplineOrder[2] = 2; - } - } - if (rank == MASTER_NODE) { - if (Blending == BSPLINE_UNIFORM) { - cout << "FFD Blending using B-Splines. "; - cout << "Order: " << SplineOrder[0] << ", " << SplineOrder[1]; - if (nDim == 3) cout << ", " << SplineOrder[2]; - cout << ". " << endl; - } - if (Blending == BEZIER) { - cout << "FFD Blending using Bezier Curves." << endl; - } - } - - FFDBox[iFFDBox] = new CFreeFormDefBox(degree, SplineOrder, Blending); - FFDBox[iFFDBox]->SetTag(TagFFDBox); - FFDBox[iFFDBox]->SetLevel(LevelFFDBox); - - /*--- Read the number of parents boxes. ---*/ - - getline(mesh_file, text_line); - text_line.erase(0, 12); - nParentFFDBox = atoi(text_line.c_str()); - if (rank == MASTER_NODE) cout << "Number of parent boxes: " << nParentFFDBox << ". "; - for (iParentFFDBox = 0; iParentFFDBox < nParentFFDBox; iParentFFDBox++) { - getline(mesh_file, text_line); - - /*--- Remove extra data from the FFDBox name. ---*/ - - string::size_type position; - for (iChar = 0; iChar < 20; iChar++) { - position = text_line.find(" ", 0); - if (position != string::npos) text_line.erase(position, 1); - position = text_line.find("\r", 0); - if (position != string::npos) text_line.erase(position, 1); - position = text_line.find("\n", 0); - if (position != string::npos) text_line.erase(position, 1); - } - - string ParentFFDBox = text_line.c_str(); - FFDBox[iFFDBox]->SetParentFFDBox(ParentFFDBox); - } - - /*--- Read the number of children boxes. ---*/ - - getline(mesh_file, text_line); - text_line.erase(0, 13); - nChildFFDBox = atoi(text_line.c_str()); - if (rank == MASTER_NODE) cout << "Number of child boxes: " << nChildFFDBox << "." << endl; - - for (iChildFFDBox = 0; iChildFFDBox < nChildFFDBox; iChildFFDBox++) { - getline(mesh_file, text_line); - - /*--- Remove extra data from the FFDBox name. ---*/ - - string::size_type position; - for (iChar = 0; iChar < 20; iChar++) { - position = text_line.find(" ", 0); - if (position != string::npos) text_line.erase(position, 1); - position = text_line.find("\r", 0); - if (position != string::npos) text_line.erase(position, 1); - position = text_line.find("\n", 0); - if (position != string::npos) text_line.erase(position, 1); - } - - string ChildFFDBox = text_line.c_str(); - FFDBox[iFFDBox]->SetChildFFDBox(ChildFFDBox); - } - - /*--- Read the number of the corner points. ---*/ - - getline(mesh_file, text_line); - text_line.erase(0, 18); - nCornerPoints[iFFDBox] = atoi(text_line.c_str()); - if (rank == MASTER_NODE) cout << "Corner points: " << nCornerPoints[iFFDBox] << ". "; - if (nDim == 2) nCornerPoints[iFFDBox] = nCornerPoints[iFFDBox] * SU2_TYPE::Int(2); - - /*--- Read the coordinates of the corner points. ---*/ - - if (nDim == 2) { - if (polar) { - getline(mesh_file, text_line); - istringstream FFDBox_line_1(text_line); - FFDBox_line_1 >> XCoord; - FFDBox_line_1 >> YCoord; - - CPcoord[0] = XCoord; - CPcoord[1] = cos(0.1) * YCoord; - CPcoord[2] = -sin(0.1) * YCoord; - FFDBox[iFFDBox]->SetCoordCornerPoints(coord, 4); - - CPcoord[0] = XCoord; - CPcoord[1] = cos(0.1) * YCoord; - CPcoord[2] = sin(0.1) * YCoord; - FFDBox[iFFDBox]->SetCoordCornerPoints(coord, 7); - - getline(mesh_file, text_line); - istringstream FFDBox_line_2(text_line); - FFDBox_line_2 >> XCoord; - FFDBox_line_2 >> YCoord; - - CPcoord[0] = XCoord; - CPcoord[1] = cos(0.1) * YCoord; - CPcoord[2] = -sin(0.1) * YCoord; - FFDBox[iFFDBox]->SetCoordCornerPoints(CPcoord, 0); - - CPcoord[0] = XCoord; - CPcoord[1] = cos(0.1) * YCoord; - CPcoord[2] = sin(0.1) * YCoord; - FFDBox[iFFDBox]->SetCoordCornerPoints(CPcoord, 3); - - getline(mesh_file, text_line); - istringstream FFDBox_line_3(text_line); - FFDBox_line_3 >> XCoord; - FFDBox_line_3 >> YCoord; - - CPcoord[0] = XCoord; - CPcoord[1] = cos(0.1) * YCoord; - CPcoord[2] = -sin(0.1) * YCoord; - FFDBox[iFFDBox]->SetCoordCornerPoints(CPcoord, 1); - - CPcoord[0] = XCoord; - CPcoord[1] = cos(0.1) * YCoord; - CPcoord[2] = sin(0.1) * YCoord; - FFDBox[iFFDBox]->SetCoordCornerPoints(CPcoord, 2); - - getline(mesh_file, text_line); - istringstream FFDBox_line_4(text_line); - FFDBox_line_4 >> XCoord; - FFDBox_line_4 >> YCoord; - - CPcoord[0] = XCoord; - CPcoord[1] = cos(0.1) * YCoord; - CPcoord[2] = -sin(0.1) * YCoord; - FFDBox[iFFDBox]->SetCoordCornerPoints(CPcoord, 5); - - CPcoord[0] = XCoord; - CPcoord[1] = cos(0.1) * YCoord; - CPcoord[2] = sin(0.1) * YCoord; - FFDBox[iFFDBox]->SetCoordCornerPoints(CPcoord, 6); - - } else { - for (iCornerPoints = 0; iCornerPoints < nCornerPoints[iFFDBox]; iCornerPoints++) { - if (iCornerPoints < nCornerPoints[iFFDBox] / SU2_TYPE::Int(2)) { - getline(mesh_file, text_line); - istringstream FFDBox_line(text_line); - FFDBox_line >> CPcoord[0]; - FFDBox_line >> CPcoord[1]; - CPcoord[2] = -0.5; - } else { - CPcoord[0] = - FFDBox[iFFDBox]->GetCoordCornerPoints(0, iCornerPoints - nCornerPoints[iFFDBox] / SU2_TYPE::Int(2)); - CPcoord[1] = - FFDBox[iFFDBox]->GetCoordCornerPoints(1, iCornerPoints - nCornerPoints[iFFDBox] / SU2_TYPE::Int(2)); - CPcoord[2] = 0.5; - } - FFDBox[iFFDBox]->SetCoordCornerPoints(CPcoord, iCornerPoints); - } - } - - } else { - for (iCornerPoints = 0; iCornerPoints < nCornerPoints[iFFDBox]; iCornerPoints++) { - getline(mesh_file, text_line); - istringstream FFDBox_line(text_line); - FFDBox_line >> CPcoord[0]; - FFDBox_line >> CPcoord[1]; - FFDBox_line >> CPcoord[2]; - FFDBox[iFFDBox]->SetCoordCornerPoints(CPcoord, iCornerPoints); - } - } - - /*--- Read the number of the control points. ---*/ - - getline(mesh_file, text_line); - text_line.erase(0, 19); - nControlPoints[iFFDBox] = atoi(text_line.c_str()); - - if (rank == MASTER_NODE) cout << "Control points: " << nControlPoints[iFFDBox] << ". "; - - /*--- Read the coordinates of the control points. ---*/ - - for (iControlPoints = 0; iControlPoints < nControlPoints[iFFDBox]; iControlPoints++) { - getline(mesh_file, text_line); - istringstream FFDBox_line(text_line); - FFDBox_line >> iDegree; - FFDBox_line >> jDegree; - FFDBox_line >> kDegree; - FFDBox_line >> CPcoord[0]; - FFDBox_line >> CPcoord[1]; - FFDBox_line >> CPcoord[2]; - FFDBox[iFFDBox]->SetCoordControlPoints(CPcoord, iDegree, jDegree, kDegree); - FFDBox[iFFDBox]->SetCoordControlPoints_Copy(CPcoord, iDegree, jDegree, kDegree); - } - - getline(mesh_file, text_line); - text_line.erase(0, 19); - nSurfacePoints[iFFDBox] = atoi(text_line.c_str()); - - /*--- The surface points parametric coordinates (all the nodes read the FFD - * information but they only store their part). ---*/ - - my_nSurfPoints = 0; - for (iSurfacePoints = 0; iSurfacePoints < nSurfacePoints[iFFDBox]; iSurfacePoints++) { - getline(mesh_file, text_line); - istringstream FFDBox_line(text_line); - FFDBox_line >> iTag; - FFDBox_line >> iPoint; - - if (config->GetMarker_All_TagBound(iTag) != -1) { - iMarker = config->GetMarker_All_TagBound(iTag); - FFDBox_line >> CPcoord[0]; - FFDBox_line >> CPcoord[1]; - FFDBox_line >> CPcoord[2]; - - for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { - jPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - if (iPoint == geometry->nodes->GetGlobalIndex(jPoint)) { - for (iDim = 0; iDim < nDim; iDim++) { - coord[iDim] = geometry->nodes->GetCoord(jPoint, iDim); - } - FFDBox[iFFDBox]->Set_MarkerIndex(iMarker); - FFDBox[iFFDBox]->Set_VertexIndex(iVertex); - FFDBox[iFFDBox]->Set_PointIndex(jPoint); - FFDBox[iFFDBox]->Set_ParametricCoord(CPcoord); - FFDBox[iFFDBox]->Set_CartesianCoord(coord); - my_nSurfPoints++; - } - } - } - } - - nSurfacePoints[iFFDBox] = my_nSurfPoints; - -#ifdef HAVE_MPI - nSurfPoints = 0; - SU2_MPI::Allreduce(&my_nSurfPoints, &nSurfPoints, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); - if (rank == MASTER_NODE) cout << "Surface points: " << nSurfPoints << "." << endl; -#else - nSurfPoints = my_nSurfPoints; - if (rank == MASTER_NODE) cout << "Surface points: " << nSurfPoints << "." << endl; -#endif - } - - delete[] nCornerPoints; - delete[] nControlPoints; - delete[] nSurfacePoints; - } - } - mesh_file.close(); - - if (nFFDBox == 0) { - if (rank == MASTER_NODE) cout << "There is no FFD box definition. Just in case, check the .su2 file" << endl; - } -} diff --git a/Common/src/drivers/meson.build b/Common/src/drivers/meson.build deleted file mode 100644 index bcee2ba35cb..00000000000 --- a/Common/src/drivers/meson.build +++ /dev/null @@ -1 +0,0 @@ -common_src += files(['CDriverBase.cpp']) diff --git a/Common/src/meson.build b/Common/src/meson.build index 2182c672f5d..f385c4a32ed 100644 --- a/Common/src/meson.build +++ b/Common/src/meson.build @@ -13,7 +13,6 @@ subdir('geometry/elements') subdir('geometry/dual_grid') subdir('geometry/primal_grid') subdir('geometry/meshreader') -subdir('drivers') subdir('containers') subdir('interface_interpolation') subdir('fem')