diff --git a/Common/include/geometry/CGeometry.hpp b/Common/include/geometry/CGeometry.hpp
index e5ade36110ff..3e3e4392a032 100644
--- a/Common/include/geometry/CGeometry.hpp
+++ b/Common/include/geometry/CGeometry.hpp
@@ -191,7 +191,7 @@ class CGeometry {
CPrimalGrid** elem; /*!< \brief Element vector (primal grid information). */
CPrimalGrid** face; /*!< \brief Face vector (primal grid information). */
CPrimalGrid*** bound; /*!< \brief Boundary vector (primal grid information). */
- CPoint** node; /*!< \brief Node vector (dual grid information). */
+ CPoint* nodes; /*!< \brief Node vector (dual grid information). */
CEdge* edges; /*!< \brief Edge vector (dual grid information). */
CVertex*** vertex; /*!< \brief Boundary Vertex vector (dual grid information). */
CTurboVertex**** turbovertex; /*!< \brief Boundary Vertex vector ordered for turbomachinery calculation(dual grid information). */
@@ -585,9 +585,9 @@ class CGeometry {
inline virtual void SetPositive_ZArea(CConfig *config) {}
/*!
- * \brief Setas connectivity between points.
+ * \brief Set connectivity between points.
*/
- inline virtual void SetPoint_Connectivity(void) {}
+ inline virtual void SetPoint_Connectivity() {}
/*!
* \brief Orders the RCM.
diff --git a/Common/include/geometry/CPhysicalGeometry.hpp b/Common/include/geometry/CPhysicalGeometry.hpp
index a2aa34aee0cf..9bde45df4fd5 100644
--- a/Common/include/geometry/CPhysicalGeometry.hpp
+++ b/Common/include/geometry/CPhysicalGeometry.hpp
@@ -391,7 +391,7 @@ class CPhysicalGeometry final : public CGeometry {
/*!
* \brief Set points which surround a point.
*/
- void SetPoint_Connectivity(void) override;
+ void SetPoint_Connectivity() override;
/*!
* \brief Set a renumbering using a Reverse Cuthill-McKee Algorithm
@@ -800,7 +800,7 @@ class CPhysicalGeometry final : public CGeometry {
*/
void SetWallDistance(su2double val) override {
for (unsigned long iPoint = 0; iPoint < GetnPoint(); iPoint++){
- node[iPoint]->SetWall_Distance(val);
+ nodes->SetWall_Distance(iPoint, val);
}
}
diff --git a/Common/include/geometry/dual_grid/CPoint.hpp b/Common/include/geometry/dual_grid/CPoint.hpp
index 3355d357f8ab..c3da9184527b 100644
--- a/Common/include/geometry/dual_grid/CPoint.hpp
+++ b/Common/include/geometry/dual_grid/CPoint.hpp
@@ -1,7 +1,7 @@
/*!
* \file CPoint.hpp
- * \brief Headers of the main subroutines for doing the complete dual grid structure.
- * The subroutines and functions are in the CPoint.cpp file.
+ * \brief Declaration of the point class that stores geometric and adjacency
+ * information for dual control volumes.
* \author F. Palacios, T. Economon
* \version 7.0.4 "Blackbird"
*
@@ -28,756 +28,762 @@
#pragma once
-#include "CDualGrid.hpp"
+#include "../../toolboxes/C2DContainer.hpp"
+#include "../../toolboxes/graph_toolbox.hpp"
+#include
+
+using namespace std;
+
+class CConfig;
/*!
* \class CPoint
- * \brief Class for point definition (including control volume definition).
+ * \brief Class for point definition (dual control volumes).
* \author F. Palacios
*/
-class CPoint final : public CDualGrid {
+class CPoint {
private:
- unsigned short nElem, /*!< \brief Number of elements that set up the control volume. */
- nPoint; /*!< \brief Number of points that set up the control volume */
- vector Elem; /*!< \brief Elements that set up a control volume around a node. */
- vector Point; /*!< \brief Points surrounding the central node of the control volume. */
- vector Edge; /*!< \brief Edges that set up a control volume. */
- su2double *Volume; /*!< \brief Volume or Area of the control volume in 3D and 2D. */
- su2double Periodic_Volume; /*!< \brief Missing component of volume or area of a control volume on a periodic marker in 3D and 2D. */
- bool Domain, /*!< \brief Indicates if a point must be computed or belong to another boundary */
- Boundary, /*!< \brief To see if a point belong to the boundary (including MPI). */
- PhysicalBoundary, /*!< \brief To see if a point belong to the physical boundary (without includin MPI). */
- SolidBoundary, /*!< \brief To see if a point belong to the physical boundary (without includin MPI). */
- PeriodicBoundary; /*!< \brief To see if a point belongs to a periodic boundary (without including MPI). */
- long *Vertex; /*!< \brief Index of the vertex that correspond which the control volume (we need one for each marker in the same node). */
- su2double *Coord, /*!< \brief vector with the coordinates of the node. */
- *Coord_Old, /*!< \brief Old coordinates vector for primal solution reloading for Disc.Adj. with dynamic grid. */
- *Coord_Sum, /*!< \brief Sum of coordinates vector for geometry smoothing. */
- *Coord_n, /*!< \brief Coordinates at time n for use with dynamic meshes. */
- *Coord_n1, /*!< \brief Coordinates at time n-1 for use with dynamic meshes. */
- *Coord_p1; /*!< \brief Coordinates at time n+1 for use with dynamic meshes. */
- su2double *GridVel; /*!< \brief Velocity of the grid for dynamic mesh cases. */
- su2double **GridVel_Grad; /*!< \brief Gradient of the grid velocity for dynamic meshes. */
- unsigned long Parent_CV; /*!< \brief Index of the parent control volume in the agglomeration process. */
- unsigned short nChildren_CV; /*!< \brief Number of children in the agglomeration process. */
- vector Children_CV; /*!< \brief Index of the children control volumes in the agglomeration process. */
- bool Agglomerate_Indirect, /*!< \brief This flag indicates if the indirect points can be agglomerated. */
- Agglomerate; /*!< \brief This flag indicates if the element has been agglomerated. */
- bool Move; /*!< \brief This flag indicates if the point is going to be move in the grid deformation process. */
- unsigned long color; /*!< \brief Color of the point in the partitioning strategy. */
- su2double Wall_Distance; /*!< \brief Distance to the nearest wall. */
- su2double SharpEdge_Distance; /*!< \brief Distance to a sharp edge. */
- su2double Curvature; /*!< \brief Value of the surface curvature (SU2_GEO). */
- unsigned long GlobalIndex; /*!< \brief Global index in the parallel simulation. */
- unsigned short nNeighbor; /*!< \brief Number of neighbors. */
- bool Flip_Orientation; /*!< \brief Flip the orientation of the normal. */
- su2double MaxLength; /*!< \brief The maximum cell-center to cell-center length. */
- int *AD_InputIndex, /*!< \brief Indices of Coord variables in the adjoint vector. */
- *AD_OutputIndex; /*!< \brief Indices of Coord variables in the adjoint vector after having been updated. */
+ const unsigned long nDim = 0;
-public:
+ su2vector GlobalIndex; /*!< \brief Global index in the parallel simulation. */
+ su2vector Color; /*!< \brief Color of the point in the partitioning strategy. */
- /*!
- * \brief Constructor of the class.
- * \param[in] val_nDim - Number of dimensions of the problem.
- * \param[in] val_globalindex Global index in the parallel simulation.
- * \param[in] config - Definition of the particular problem.
- */
- CPoint(unsigned short val_nDim, unsigned long val_globalindex, CConfig *config);
+ CCompressedSparsePatternUL Point; /*!< \brief Points surrounding the central node of the control volume. */
+ CCompressedSparsePatternL Edge; /*!< \brief Edges that set up a control volume (same sparse structure as Point). */
+ CCompressedSparsePatternL Elem; /*!< \brief Elements that set up a control volume around a node. */
+ vector > Vertex; /*!< \brief Index of the vertex that correspond which the control volume (we need one for each marker in the same node). */
- /*!
- * \overload
- * \param[in] val_coord_0 First coordinate of the point.
- * \param[in] val_coord_1 Second coordinate of the point.
- * \param[in] val_globalindex Global index in the parallel simulation.
- * \param[in] config - Definition of the particular problem.
- */
- CPoint(su2double val_coord_0, su2double val_coord_1, unsigned long val_globalindex, CConfig *config);
+ su2activevector Volume; /*!< \brief Volume or Area of the control volume in 3D and 2D. */
+ su2activevector Volume_n; /*!< \brief Volume at time n. */
+ su2activevector Volume_nM1; /*!< \brief Volume at time n-1. */
+ su2activevector Periodic_Volume; /*!< \brief Missing component of volume or area of a control volume on a periodic marker in 3D and 2D. */
- /*!
- * \overload
- * \param[in] val_coord_0 First coordinate of the point.
- * \param[in] val_coord_1 Second coordinate of the point.
- * \param[in] val_coord_2 Third coordinate of the point.
- * \param[in] val_globalindex Global index in the parallel simulation.
- * \param[in] config - Definition of the particular problem.
- */
- CPoint(su2double val_coord_0, su2double val_coord_1, su2double val_coord_2, unsigned long val_globalindex, CConfig *config);
+ su2vector Domain; /*!< \brief Indicates if a point must be computed or belong to another boundary */
+ su2vector Boundary; /*!< \brief To see if a point belong to the boundary (including MPI). */
+ su2vector PhysicalBoundary; /*!< \brief To see if a point belong to the physical boundary (without includin MPI). */
+ su2vector SolidBoundary; /*!< \brief To see if a point belong to the physical boundary (without includin MPI). */
+ su2vector PeriodicBoundary; /*!< \brief To see if a point belongs to a periodic boundary (without including MPI). */
- /*!
- * \brief Destructor of the class.
- */
- ~CPoint(void) override;
+ su2activematrix Coord; /*!< \brief vector with the coordinates of the node. */
+ su2activematrix Coord_Old; /*!< \brief Old coordinates vector for primal solution reloading for Disc.Adj. with dynamic grid. */
+ su2activematrix Coord_Sum; /*!< \brief Sum of coordinates vector for geometry smoothing. */
+ su2activematrix Coord_n; /*!< \brief Coordinates at time n for use with dynamic meshes. */
+ su2activematrix Coord_n1; /*!< \brief Coordinates at time n-1 for use with dynamic meshes. */
+ su2activematrix Coord_p1; /*!< \brief Coordinates at time n+1 for use with dynamic meshes. */
- /*!
- * \brief For parallel computation, its indicates if a point must be computed or not.
- * \param[in] val_domain - TRUE if the point belong to the domain; otherwise FALSE.
- */
- inline void SetDomain(bool val_domain) { Domain = val_domain; }
+ su2activematrix GridVel; /*!< \brief Velocity of the grid for dynamic mesh cases. */
+ CVectorOfMatrix GridVel_Grad; /*!< \brief Gradient of the grid velocity for dynamic meshes. */
- /*!
- * \brief For parallel computation, its indicates if a point must be computed or not.
- * \return TRUE if the node belong to the physical domain; otherwise FALSE.
- */
- inline bool GetDomain(void) const { return Domain; }
-
- /*!
- * \brief Set the value of the distance to the nearest wall.
- * \param[in] val_distance - Value of the distance.
- */
- inline void SetWall_Distance(su2double val_distance) { Wall_Distance = val_distance; }
+ su2vector Parent_CV; /*!< \brief Index of the parent control volume in the agglomeration process. */
+ su2vector nChildren_CV; /*!< \brief Number of children in the agglomeration process. */
+ vector > Children_CV; /*!< \brief Index of the children control volumes in the agglomeration process. */
+ su2vector Agglomerate_Indirect; /*!< \brief This flag indicates if the indirect points can be agglomerated. */
+ su2vector Agglomerate; /*!< \brief This flag indicates if the element has been agglomerated. */
- /*!
- * \brief Set the value of the distance to a sharp edge.
- * \param[in] val_distance - Value of the distance.
- */
- inline void SetSharpEdge_Distance(su2double val_distance) { SharpEdge_Distance = val_distance; }
+ su2vector nNeighbor; /*!< \brief Number of neighbors, needed by some numerical methods. */
+ su2activevector Wall_Distance; /*!< \brief Distance to the nearest wall. */
+ su2activevector SharpEdge_Distance; /*!< \brief Distance to a sharp edge. */
+ su2activevector Curvature; /*!< \brief Value of the surface curvature (SU2_GEO). */
+ su2activevector MaxLength; /*!< \brief The maximum cell-center to cell-center length. */
- /*!
- * \brief Get the value of the distance to the nearest wall.
- * \return Value of the distance to the nearest wall.
- */
- inline su2double GetWall_Distance(void) const { return Wall_Distance; }
+ su2matrix AD_InputIndex; /*!< \brief Indices of Coord variables in the adjoint vector. */
+ su2matrix AD_OutputIndex; /*!< \brief Indices of Coord variables in the adjoint vector after having been updated. */
/*!
- * \brief Set the value of the curvature at a surface node.
- * \param[in] val_curvature - Value of the curvature.
+ * \brief Allocate fields required by the minimal constructor.
*/
- inline void SetCurvature(su2double val_curvature) { Curvature = val_curvature; }
+ void MinimalAllocation(unsigned long npoint);
+public:
/*!
- * \brief Get the value of the curvature at a surface node.
- * \return Value of the curvature.
+ * \brief "Full" constructor of the class.
+ * \param[in] npoint - Number of points (dual volumes) in the problem.
+ * \param[in] ndim - Number of spatial dimensions of the problem.
+ * \param[in] imesh - Index of the grid allocating the points.
+ * \param[in] config - Definition of the particular problem.
*/
- inline su2double GetCurvature(void) const { return Curvature; }
+ CPoint(unsigned long npoint, unsigned long ndim, unsigned short imesh, const CConfig* config);
/*!
- * \brief Get the value of the distance to a sharp edge
- * \return Value of the distance to the nearest wall.
+ * \brief Minimal constructor, only allocates the structures required to read and partition a mesh file.
+ * \param[in] npoint - Number of points (dual volumes) in the problem.
+ * \param[in] ndim - Number of spatial dimensions of the problem.
*/
- inline su2double GetSharpEdge_Distance(void) const { return SharpEdge_Distance; }
+ CPoint(unsigned long npoint, unsigned long ndim);
/*!
- * \brief Set the number of elements that compose the control volume.
- * \param[in] val_nElem - Number of elements that make the control volume around a node.
+ * \brief Default construction is not allowed.
*/
- inline void SetnElem(unsigned short val_nElem) { nElem = val_nElem; }
+ CPoint() = delete;
/*!
- * \brief Set the number of points that compose the control volume.
- * \param[in] val_nPoint - Number of points that compose the control volume (points surrounding points).
+ * \brief Allocate the variables not covered by the minimal constructor.
*/
- inline void SetnPoint(unsigned short val_nPoint) { nPoint = val_nPoint; }
+ void FullAllocation(unsigned short imesh, const CConfig* config);
/*!
* \brief Get the coordinates dor the control volume.
- * \param[in] val_dim - Number of dimensions of the problem.
- * \return Coordinate that correspond with val_dim.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] iDim - Number of dimensions of the problem.
+ * \return Coordinate that correspond with iDim.
*/
- inline su2double GetCoord(unsigned short val_dim) const { return Coord[val_dim]; }
+ inline su2double GetCoord(unsigned long iPoint, unsigned long iDim) const { return Coord(iPoint,iDim); }
/*!
* \brief Get the coordinates of the control volume.
+ * \param[in] iPoint - Index of the point.
* \return pointer to the coordinate of the point.
*/
- inline su2double *GetCoord(void) override { return Coord; }
+ inline su2double *GetCoord(unsigned long iPoint) { return Coord[iPoint]; }
/*!
* \brief Set the coordinates for the control volume.
- * \param[in] val_dim - Position to store the coordinate.
- * \param[in] val_coord - Coordinate for val_dim.
- */
- inline void SetCoord(unsigned short val_dim, su2double val_coord) { Coord[val_dim] = val_coord; }
-
- /*!
- * \brief Set the adjoint vector indices of Coord vector.
- * \param[in] input - Save them to the input or output indices vector.
- */
- void SetIndex(bool input);
-
- /*!
- * \brief Set the adjoint values of the (geometric) coordinates.
- * \param[in] adj_sol - Adjoint values of the Coord variables.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] iDim - Position to store the coordinate.
+ * \param[in] coord - Coordinate for iDim.
*/
- void SetAdjointSolution(const su2double *adj_sol);
+ inline void SetCoord(unsigned long iPoint, unsigned long iDim, su2double coord) { Coord(iPoint,iDim) = coord; }
/*!
- * \brief Get the adjoint values of the (geometric) coordinates.
- * \param[in] adj_sol - Adjoint values of the Coord variables.
- */
- su2double GetAdjointSolution(unsigned short iDim) const;
-
- /*!
- * \brief Get the coordinates of the control volume.
- * \return pointer to the coordinate of the point.
+ * \brief Set the coordinates for the control volume.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] iDim - Position to store the coordinate.
+ * \param[in] coord - Coordinate for iDim.
*/
- inline bool GetFlip_Orientation(void) const { return Flip_Orientation; }
+ inline void AddCoord(unsigned long iPoint, unsigned long iDim, su2double coord) { Coord(iPoint,iDim) += coord; }
/*!
- * \brief Set the coordinates for the control volume.
- * \param[in] val_dim - Position to store the coordinate.
- * \param[in] val_coord - Coordinate for val_dim.
+ * \brief Set the point coordinates.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] coord - Coordinate of the point.
*/
- inline void SetFlip_Orientation(void) { Flip_Orientation = true; }
+ inline void SetCoord(unsigned long iPoint, const su2double *coord) {
+ for (unsigned long iDim = 0; iDim < nDim; iDim++)
+ Coord(iPoint,iDim) = coord[iDim];
+ }
/*!
- * \brief Set the coordinates for the control volume.
- * \param[in] val_dim - Position to store the coordinate.
- * \param[in] val_coord - Coordinate for val_dim.
+ * \brief Set the elements that are connected to each point.
+ * \param[in] elemsMatrix - List of lists with the neighbor points connected to each point.
*/
- inline void AddCoord(unsigned short val_dim, su2double val_coord) { Coord[val_dim] += val_coord; }
+ void SetElems(const vector >& elemsMatrix);
/*!
- * \overload
- * \param[in] val_coord - Coordinate of the point.
+ * \brief Reset the elements of a control volume.
*/
- inline void SetCoord(const su2double *val_coord) override {
- for (unsigned short iDim = 0; iDim < nDim; iDim++)
- Coord[iDim]=val_coord[iDim];
- }
+ inline void ResetElems() { Elem = CCompressedSparsePatternL(); }
/*!
* \brief Get the number of elements that compose the control volume.
+ * \param[in] iPoint - Index of the point.
* \return Number of elements that compose the control volume.
*/
- inline unsigned short GetnElem(void) const { return nElem; }
+ inline unsigned short GetnElem(unsigned long iPoint) const { return Elem.getNumNonZeros(iPoint); }
/*!
- * \brief Get the number of points that compose the control volume.
- * \return Number of points that compose the control volume.
+ * \brief Get all the elements that compose the control volume.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] nelem - Position where the element is stored.
+ * \return Index of the element.
*/
- inline unsigned short GetnPoint(void) const { return nPoint; }
+ inline unsigned long GetElem(unsigned long iPoint, unsigned long nelem) const { return Elem.getInnerIdx(iPoint,nelem); }
/*!
- * \brief Set the elements that set the control volume.
- * \param[in] val_elem - Element to be added.
+ * \brief Set the points that compose the control volume.
+ * \param[in] pointsMatrix - List of lists with the neighbor points connected to each point.
*/
- inline void SetElem(unsigned long val_elem) { Elem.push_back(val_elem); nElem = Elem.size(); }
+ void SetPoints(const vector >& pointsMatrix);
/*!
- * \brief Reset the elements of a control volume.
+ * \brief Get the entire point adjacency information in compressed format (CSR).
*/
- inline void ResetElem(void) { Elem.clear(); nElem = 0; }
+ const CCompressedSparsePatternUL& GetPoints() const { return Point; }
/*!
* \brief Reset the points that compose the control volume.
*/
- inline void ResetPoint(void) { Point.clear(); Edge.clear(); nPoint = 0; }
+ inline void ResetPoints() { Point = CCompressedSparsePatternUL(); Edge = CCompressedSparsePatternL(); }
/*!
- * \brief Set the points that compose the control volume.
- * \param[in] val_point - Point to be added.
- */
- void SetPoint(unsigned long val_point);
-
- /*!
- * \brief Set the edges that compose the control volume.
- * \param[in] val_edge - Edge to be added.
- * \param[in] val_nEdge - Position in which is going to be stored the edge for each control volume.
+ * \brief Get the number of points that compose the control volume.
+ * \param[in] iPoint - Index of the point.
+ * \return Number of points that compose the control volume.
*/
- inline void SetEdge(long val_edge, unsigned short val_nedge) { Edge[val_nedge] = val_edge; }
+ inline unsigned short GetnPoint(unsigned long iPoint) const { return Point.getNumNonZeros(iPoint); }
/*!
- * \brief Set the boundary vertex that compose the control volume.
- * \param[in] val_vertex - Vertex to be added.
- * \param[in] val_nMarker - Marker of the vertex to be added (position where is going to be stored).
+ * \brief Get all the points that compose the control volume.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] point - Position where the point is stored.
+ * \return Index of the point.
*/
- inline void SetVertex(long val_vertex, unsigned short val_nmarker) {
- if (Boundary) Vertex[val_nmarker] = val_vertex;
- }
+ inline unsigned long GetPoint(unsigned long iPoint, unsigned long npoint) const { return Point.getInnerIdx(iPoint,npoint); }
/*!
- * \brief Get all the elements that compose the control volume.
- * \param[in] val_elem - Position where the element is stored.
- * \return Index of the element.
+ * \brief Set the edges that compose the control volume.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] iedge - Edge to be added.
+ * \param[in] nedge - Position in which is going to be stored the edge for each control volume.
*/
- inline unsigned long GetElem(unsigned short val_elem) const { return Elem[val_elem]; }
+ inline void SetEdge(unsigned long iPoint, long iedge, unsigned long nedge) { Edge.getInnerIdx(iPoint,nedge) = iedge; }
/*!
- * \brief Get all the points that compose the control volume.
- * \param[in] val_point - Position where the point is stored.
- * \return Index of the point.
+ * \brief Get all the edges that compose the control volume.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] nedge - Position where the edge is stored.
+ * \return Index of the edge.
*/
- inline unsigned long GetPoint(unsigned short val_point) const { return Point[val_point]; }
+ inline long GetEdge(unsigned long iPoint, unsigned long nedge) const { return Edge.getInnerIdx(iPoint,nedge); }
/*!
- * \brief Get all the edges that compose the control volume.
- * \param[in] val_edge - Position where the edge is stored.
- * \return Index of the edge.
+ * \brief Set the boundary vertex that compose the control volume.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] iVertex - Vertex to be added.
+ * \param[in] iMarker - Marker of the vertex to be added (position where is going to be stored).
*/
- inline long GetEdge(unsigned short val_edge) const { return Edge[val_edge]; }
+ inline void SetVertex(unsigned long iPoint, long iVertex, unsigned long iMarker) {
+ if (Boundary(iPoint)) Vertex[iPoint][iMarker] = iVertex;
+ }
/*!
* \brief Get the vertex that compose the control volume for a marker.
- * \param[in] val_marker - Position where the vertex is stored.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] iMarker - Position where the vertex is stored.
* \return Index of the vertex.
*/
- inline long GetVertex(unsigned short val_marker) const {
- if (Boundary) return Vertex[val_marker];
+ inline long GetVertex(unsigned long iPoint, unsigned long iMarker) const {
+ if (Boundary(iPoint)) return Vertex[iPoint][iMarker];
else return -1;
}
/*!
- * \brief Adds some area or volume of the CV.
- * \param[in] val_Volume - Local volume to be added to the total one.
+ * \brief Set if a point belong to the boundary.
+ * \param[in] iPoint - Index of the point.
+ * \note It also create the structure to store the vertex.
+ * \param[in] nMarker - Max number of marker.
*/
- inline void AddVolume(su2double val_Volume) { Volume[0] += val_Volume; }
+ inline void SetBoundary(unsigned long iPoint, unsigned short nMarker) {
+ if (!Boundary(iPoint)) Vertex[iPoint].resize(nMarker,-1);
+ Boundary(iPoint) = true;
+ }
/*!
- * \brief Get area or volume of the control volume.
- * \return Area or volume of the control volume.
+ * \brief Reset the boundary of a control volume.
+ * \param[in] iPoint - Index of the point.
*/
- inline su2double GetVolume(void) const { return Volume[0]; }
+ inline void ResetBoundary(unsigned long iPoint) { Vertex[iPoint].clear(); Boundary(iPoint) = false; }
/*!
- * \brief Get the missing component of area or volume for a control volume on a periodic marker.
- * \return Periodic component of area or volume for a control volume on a periodic marker.
+ * \brief Mark the point as boundary.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] boundary - TRUE if the point belong to the boundary; otherwise FALSE.
*/
- inline su2double GetPeriodicVolume(void) const { return Periodic_Volume; }
+ inline void SetBoundary(unsigned long iPoint, bool boundary) { Boundary(iPoint) = boundary; }
/*!
- * \brief Set the missing component of area or volume for a control volume on a periodic marker.
- * \param[in] val_volume - Value of the volume from the missing components of the CV on the periodic marker.
+ * \brief Provides information about if a point belong to the boundaries.
+ * \param[in] iPoint - Index of the point.
+ * \return TRUE if the point belong to the boundary; otherwise FALSE.
*/
- inline void SetPeriodicVolume(su2double val_volume) { Periodic_Volume = val_volume; }
+ inline bool GetBoundary(unsigned long iPoint) const { return Boundary(iPoint); }
/*!
- * \brief Get the maximum cell-center to cell-center length.
- * \return The maximum cell-center to cell-center length.
+ * \brief Set if a point belong to the boundary.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] boundary - TRUE if the point belong to the physical boundary; otherwise FALSE.
*/
- inline su2double GetMaxLength(void) const {return MaxLength;}
+ inline void SetPhysicalBoundary(unsigned long iPoint, bool boundary) { PhysicalBoundary(iPoint) = boundary; }
/*!
- * \brief Get information about the movement of the node.
- * \return TRUE if the point is going to be moved; otherwise FALSE.
+ * \brief Provides information about if a point belong to the physical boundaries (without MPI).
+ * \param[in] iPoint - Index of the point.
+ * \return TRUE if the point belong to the boundary; otherwise FALSE.
*/
- inline bool GetMove(void) const { return Move; }
+ inline bool GetPhysicalBoundary(unsigned long iPoint) const { return PhysicalBoundary(iPoint); }
/*!
* \brief Set if a point belong to the boundary.
- * \note It also create the structure to store the vertex.
- * \param[in] val_nmarker - Max number of marker.
- */
- void SetBoundary(unsigned short val_nmarker);
-
- /*!
- * \brief Reset the boundary of a control volume.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] boundary - TRUE if the point belong to the physical boundary; otherwise FALSE.
*/
- inline void ResetBoundary(void) { if (Vertex != NULL) delete [] Vertex; Boundary = false; }
+ inline void SetSolidBoundary(unsigned long iPoint, bool boundary) { SolidBoundary(iPoint) = boundary; }
/*!
- * \overload
- * \param[in] val_boundary - TRUE if the point belong to the boundary; otherwise FALSE.
+ * \brief Provides information about if a point belong to the physical boundaries (without MPI).
+ * \param[in] iPoint - Index of the point.
+ * \return TRUE if the point belong to the boundary; otherwise FALSE.
*/
- inline void SetBoundary(bool val_boundary) { Boundary = val_boundary; }
+ inline bool GetSolidBoundary(unsigned long iPoint) const { return SolidBoundary(iPoint); }
/*!
- * \brief Provides information about if a point belong to the boundaries.
- * \return TRUE if the point belong to the boundary; otherwise FALSE.
+ * \brief Set if a point belongs to a periodic boundary.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] boundary - TRUE if the point belongs to a periodic boundary; otherwise FALSE.
*/
- inline bool GetBoundary(void) const { return Boundary; }
+ inline void SetPeriodicBoundary(unsigned long iPoint, bool boundary) { PeriodicBoundary(iPoint) = boundary; }
/*!
- * \brief Set if a point belong to the boundary.
- * \param[in] val_boundary - TRUE if the point belong to the physical boundary; otherwise FALSE.
+ * \brief Provides information about if a point belongs to a periodic boundary (without MPI).
+ * \param[in] iPoint - Index of the point.
+ * \return TRUE if the point belongs to a periodic boundary; otherwise FALSE.
*/
- inline void SetPhysicalBoundary(bool val_boundary) { PhysicalBoundary = val_boundary; }
+ inline bool GetPeriodicBoundary(unsigned long iPoint) const { return PeriodicBoundary(iPoint); }
/*!
- * \brief Set if a point belong to the boundary.
- * \param[in] val_boundary - TRUE if the point belong to the physical boundary; otherwise FALSE.
+ * \brief For parallel computation, its indicates if a point must be computed or not.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] domain - TRUE if the point belong to the domain; otherwise FALSE.
*/
- inline void SetSolidBoundary(bool val_boundary) { SolidBoundary = val_boundary; }
+ inline void SetDomain(unsigned long iPoint, bool domain) { Domain(iPoint) = domain; }
/*!
- * \brief Set if a point belongs to a periodic boundary.
- * \param[in] val_boundary - TRUE if the point belongs to a periodic boundary; otherwise FALSE.
+ * \brief For parallel computation, its indicates if a point must be computed or not.
+ * \param[in] iPoint - Index of the point.
+ * \return TRUE if the node belong to the physical domain; otherwise FALSE.
*/
- inline void SetPeriodicBoundary(bool val_boundary) { PeriodicBoundary = val_boundary; }
+ inline bool GetDomain(unsigned long iPoint) const { return Domain(iPoint); }
/*!
- * \brief Provides information about if a point belong to the physical boundaries (without MPI).
- * \return TRUE if the point belong to the boundary; otherwise FALSE.
+ * \brief Set a color to the point that comes from the grid partitioning.
+ * \param[in] iPoint - Index of the point.
+ * \note Each domain has a different color.
+ * \param[in] color - Color of the point.
*/
- inline bool GetPhysicalBoundary(void) const { return PhysicalBoundary; }
+ inline void SetColor(unsigned long iPoint, unsigned long color) { Color(iPoint) = color; }
/*!
- * \brief Provides information about if a point belong to the physical boundaries (without MPI).
- * \return TRUE if the point belong to the boundary; otherwise FALSE.
+ * \brief Get the color of a point, the color indicates to which subdomain the point belong to.
+ * \param[in] iPoint - Index of the point.
+ * \return Color of the point.
*/
- inline bool GetSolidBoundary(void) const { return SolidBoundary; }
+ inline unsigned long GetColor(unsigned long iPoint) const { return Color(iPoint); }
/*!
- * \brief Provides information about if a point belongs to a periodic boundary (without MPI).
- * \return TRUE if the point belongs to a periodic boundary; otherwise FALSE.
+ * \brief Set the global index in a parallel computation.
+ * \param[in] iPoint - Index of the point.
+ * \return Global index in a parallel computation.
*/
- inline bool GetPeriodicBoundary(void) const { return PeriodicBoundary; }
+ inline void SetGlobalIndex(unsigned long iPoint, unsigned long globalindex) { GlobalIndex(iPoint) = globalindex; }
/*!
- * \brief Set a color to the point that comes from the grid partitioning.
- * \note Each domain has a different color.
- * \param[in] val_color - Color of the point.
+ * \brief Get the global index in a parallel computation.
+ * \param[in] iPoint - Index of the point.
+ * \return Global index in a parallel computation.
*/
- inline void SetColor(unsigned long val_color) { color = val_color; }
+ inline unsigned long GetGlobalIndex(unsigned long iPoint) const { return GlobalIndex(iPoint); }
/*!
* \brief Set the number of neighbor (artificial dissipation).
- * \param[in] val_nneighbor - Number of neighbors.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] nneighbor - Number of neighbors.
*/
- inline void SetnNeighbor(unsigned short val_nneighbor) { nNeighbor = val_nneighbor; }
+ inline void SetnNeighbor(unsigned long iPoint, unsigned short nneighbor) { nNeighbor(iPoint) = nneighbor; }
/*!
* \brief Get the number of neighbor of a point.
+ * \param[in] iPoint - Index of the point.
* \return Number of neighbors.
*/
- inline unsigned short GetnNeighbor(void) const { return nNeighbor; }
+ inline unsigned short GetnNeighbor(unsigned long iPoint) const { return nNeighbor(iPoint); }
/*!
- * \brief Get the color of a point, the color indicates to which subdomain the point belong to.
- * \return Color of the point.
+ * \brief Set the value of the distance to the nearest wall.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] distance - Value of the distance.
*/
- inline unsigned long GetColor(void) const { return color; }
+ inline void SetWall_Distance(unsigned long iPoint, su2double distance) { Wall_Distance(iPoint) = distance; }
/*!
- * \brief Get the global index in a parallel computation.
- * \return Global index in a parallel computation.
+ * \brief Get the value of the distance to the nearest wall.
+ * \param[in] iPoint - Index of the point.
+ * \return Value of the distance to the nearest wall.
*/
- inline unsigned long GetGlobalIndex(void) const { return GlobalIndex; }
+ inline su2double GetWall_Distance(unsigned long iPoint) const { return Wall_Distance(iPoint); }
/*!
- * \brief Set the global index in a parallel computation.
- * \return Global index in a parallel computation.
+ * \brief Set the value of the distance to a sharp edge.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] distance - Value of the distance.
*/
- inline void SetGlobalIndex(unsigned long val_globalindex) { GlobalIndex = val_globalindex; }
+ inline void SetSharpEdge_Distance(unsigned long iPoint, su2double distance) { SharpEdge_Distance(iPoint) = distance; }
/*!
- * \brief Get the volume of the control volume at time n.
- * \return Volume of the control volume at time n
+ * \brief Get the value of the distance to a sharp edge
+ * \param[in] iPoint - Index of the point.
+ * \return Value of the distance to the nearest wall.
*/
- inline su2double GetVolume_n(void) const { return Volume[1]; }
+ inline su2double GetSharpEdge_Distance(unsigned long iPoint) const { return SharpEdge_Distance(iPoint); }
/*!
- * \brief Get the volume of the control volume at time n+1.
- * \return Volume of the control volume at time n+1
+ * \brief Set the value of the curvature at a surface node.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] curvature - Value of the curvature.
*/
- inline su2double GetVolume_nM1(void) const { return Volume[2]; }
+ inline void SetCurvature(unsigned long iPoint, su2double curvature) { Curvature(iPoint) = curvature; }
/*!
- * \brief Set the volume of the control volume at time n.
+ * \brief Get the value of the curvature at a surface node.
+ * \param[in] iPoint - Index of the point.
+ * \return Value of the curvature.
*/
- inline void SetVolume_n(void) { Volume[1] = Volume[0]; }
+ inline su2double GetCurvature(unsigned long iPoint) const { return Curvature(iPoint); }
/*!
- * \brief Set the volume of the control volume at time n+1.
+ * \brief Set the max cell-center to cell-center length.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] max_length - Value of the max length
*/
- inline void SetVolume_nM1(void) { Volume[2] = Volume[1]; }
+ inline void SetMaxLength(unsigned long iPoint, su2double max_length) { MaxLength(iPoint) = max_length; }
/*!
- * \brief Get the coordinates of the control volume at time n.
- * \return Coordinates of the control volume at time n.
+ * \brief Get the maximum cell-center to cell-center length.
+ * \param[in] iPoint - Index of the point.
+ * \return The maximum cell-center to cell-center length.
*/
- inline su2double *GetCoord_n(void) { return Coord_n; }
+ inline su2double GetMaxLength(unsigned long iPoint) const { return MaxLength(iPoint); }
/*!
- * \brief Get the coordinates of the control volume at time n-1.
- * \return Volume of the control volume at time n-1
+ * \brief Get area or volume of the control volume.
+ * \param[in] iPoint - Index of the point.
+ * \return Area or volume of the control volume.
*/
- inline su2double *GetCoord_n1(void) { return Coord_n1; }
+ inline su2double GetVolume(unsigned long iPoint) const { return Volume(iPoint); }
/*!
- * \brief Get the coordinates of the control volume at time n+1.
- * \return Volume of the control volume at time n+1
+ * \brief Set the volume of the control volume.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] volume - Value of the volume.
*/
- inline su2double *GetCoord_p1(void) { return Coord_p1; }
+ inline void SetVolume(unsigned long iPoint, su2double volume) { Volume(iPoint) = volume; }
/*!
- * \brief Set the coordinates of the control volume at time n to the ones in Coord.
+ * \brief Adds some area or volume of the CV.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] volume - Local volume to be added to the total one.
*/
- inline void SetCoord_n(void) {
- for (unsigned short iDim = 0; iDim < nDim; iDim++)
- Coord_n[iDim] = Coord[iDim];
- }
+ inline void AddVolume(unsigned long iPoint, su2double volume) { Volume(iPoint) += volume; }
/*!
- * \brief Set the coordinates of the control volume at time n-1 to the ones in Coord_n.
+ * \brief Get the missing component of area or volume for a control volume on a periodic marker.
+ * \param[in] iPoint - Index of the point.
+ * \return Periodic component of area or volume for a control volume on a periodic marker.
*/
- inline void SetCoord_n1(void) {
- for (unsigned short iDim = 0; iDim < nDim; iDim++)
- Coord_n1[iDim] = Coord_n[iDim];
- }
+ inline su2double GetPeriodicVolume(unsigned long iPoint) const { return Periodic_Volume(iPoint); }
/*!
- * \brief Set the coordinates of the control volume at time n, for restart cases.
- * \param[in] val_coord - Value of the grid coordinates at time n.
+ * \brief Set the missing component of area or volume for a control volume on a periodic marker.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] volume - Value of the volume from the missing components of the CV on the periodic marker.
*/
- inline void SetCoord_n(su2double *val_coord) {
- for (unsigned short iDim = 0; iDim < nDim; iDim++)
- Coord_n[iDim] = val_coord[iDim];
- }
+ inline void SetPeriodicVolume(unsigned long iPoint, su2double volume) { Periodic_Volume(iPoint) = volume; }
/*!
- * \brief Set the coordinates of the control volume at time n-1, for restart cases.
- * \param[in] val_coord - Value of the grid coordinates at time n-1.
- */
- inline void SetCoord_n1(su2double *val_coord) {
- for (unsigned short iDim = 0; iDim < nDim; iDim++)
- Coord_n1[iDim] = val_coord[iDim];
- }
- /*!
- * \brief Set the coordinates of the control volume at time n+1.
- * \param[in] val_coord - Value of the grid coordinates at time n+1.
+ * \brief Get the volume of the control volume at time n.
+ * \param[in] iPoint - Index of the point.
+ * \return Volume of the control volume at time n
*/
- inline void SetCoord_p1(su2double *val_coord) {
- for (unsigned short iDim = 0; iDim < nDim; iDim++)
- Coord_p1[iDim] = val_coord[iDim];
- }
+ inline su2double GetVolume_n(unsigned long iPoint) const { return Volume_n(iPoint); }
/*!
- * \brief Set the volume of the control volume.
- * \param[in] val_Volume - Value of the volume.
+ * \brief Get the volume of the control volume at time n+1.
+ * \param[in] iPoint - Index of the point.
+ * \return Volume of the control volume at time n+1
*/
- inline void SetVolume(su2double val_Volume) { Volume[0] = val_Volume; }
+ inline su2double GetVolume_nM1(unsigned long iPoint) const { return Volume_nM1(iPoint); }
/*!
- * \brief Set the max cell-center to cell-center length.
- * \param[in] val_max_length - Value of the max length
+ * \brief Set the volume of the control volume at time n.
*/
- inline void SetMaxLength(su2double val_max_length) { MaxLength = val_max_length; }
+ void SetVolume_n();
/*!
- * \brief Set if a element is going to be moved on the deformation process.
- * \param[in] val_move - true or false depending if the point will be moved.
+ * \brief Set the volume of the control volume at time n+1.
*/
- inline void SetMove(bool val_move) { Move = val_move; }
+ void SetVolume_nM1();
/*!
* \brief Set the parent control volume of an agglomerated control volume.
- * \param[in] val_parent_CV - Index of the parent control volume.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] parent_CV - Index of the parent control volume.
*/
- inline void SetParent_CV(unsigned long val_parent_CV) { Parent_CV = val_parent_CV; Agglomerate = true; }
+ inline void SetParent_CV(unsigned long iPoint, unsigned long parent_CV) {
+ Parent_CV(iPoint) = parent_CV; Agglomerate(iPoint) = true;
+ }
/*!
* \brief Set the children control volumes of an agglomerated control volume.
- * \param[in] val_nchildren_CV - Number of children.
- * \param[in] val_children_CV - Index of the children control volume.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] nchildren_CV - Number of children.
+ * \param[in] children_CV - Index of the children control volume.
*/
- inline void SetChildren_CV(unsigned short val_nchildren_CV, unsigned long val_children_CV) {
- if (Children_CV.size() <= val_nchildren_CV) Children_CV.resize(val_nchildren_CV+1);
- Children_CV[val_nchildren_CV] = val_children_CV;
+ inline void SetChildren_CV(unsigned long iPoint, unsigned long nchildren_CV, unsigned long children_CV) {
+ Children_CV[iPoint].resize(nchildren_CV+1);
+ Children_CV[iPoint][nchildren_CV] = children_CV;
}
/*!
* \brief Get the parent control volume of an agglomerated control volume.
+ * \param[in] iPoint - Index of the point.
* \return Index of the parent control volume.
*/
- inline unsigned long GetParent_CV(void) const { return Parent_CV; }
+ inline unsigned long GetParent_CV(unsigned long iPoint) const { return Parent_CV(iPoint); }
/*!
* \brief Get the children control volume of an agglomerated control volume.
- * \param[in] val_nchildren_CV - Number of the children.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] nchildren_CV - Number of the children.
* \return Index of the parent control volume.
*/
- inline unsigned long GetChildren_CV(unsigned short val_nchildren_CV) const { return Children_CV[val_nchildren_CV]; }
+ inline unsigned long GetChildren_CV(unsigned long iPoint, unsigned short nchildren_CV) const {
+ return Children_CV[iPoint][nchildren_CV];
+ }
/*!
* \brief Get information about if a control volume has been agglomerated.
+ * \param[in] iPoint - Index of the point.
* \return TRUE if the point has been agglomerated; otherwise FALSE.
*/
- inline bool GetAgglomerate(void) const { return Agglomerate; }
+ inline bool GetAgglomerate(unsigned long iPoint) const { return Agglomerate(iPoint); }
/*!
* \brief Get information about if the indirect neighbors can be agglomerated.
+ * \param[in] iPoint - Index of the point.
* \return TRUE if the indirect neigbors can be agglomerated; otherwise FALSE.
*/
- inline bool GetAgglomerate_Indirect(void) const { return Agglomerate_Indirect; }
+ inline bool GetAgglomerate_Indirect(unsigned long iPoint) const { return Agglomerate_Indirect(iPoint); }
/*!
* \brief Set information about if the indirect neighbors can be agglomerated.
- * \param[in] val_agglomerate - The indirect neigbors can be agglomerated.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] agglomerate - The indirect neigbors can be agglomerated.
*/
- inline void SetAgglomerate_Indirect(bool val_agglomerate) { Agglomerate_Indirect = val_agglomerate; };
+ inline void SetAgglomerate_Indirect(unsigned long iPoint, bool agglomerate) { Agglomerate_Indirect(iPoint) = agglomerate; };
/*!
* \brief Get the number of children of an agglomerated control volume.
+ * \param[in] iPoint - Index of the point.
* \return Number of children control volume.
*/
- inline unsigned short GetnChildren_CV(void) const { return nChildren_CV; }
+ inline unsigned short GetnChildren_CV(unsigned long iPoint) const { return nChildren_CV(iPoint); }
/*!
* \brief Set the number of children of an agglomerated control volume.
- * \param[in] val_nchildren_CV - Number of children of the control volume.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] nchildren_CV - Number of children of the control volume.
*/
- inline void SetnChildren_CV(unsigned short val_nchildren_CV) { nChildren_CV = val_nchildren_CV; }
+ inline void SetnChildren_CV(unsigned long iPoint, unsigned short nchildren_CV) { nChildren_CV(iPoint) = nchildren_CV; }
/*!
- * \brief Get the value of the summed coordinates for implicit smoothing.
- * \return Sum of coordinates at a point.
+ * \brief Get the coordinates of the control volume at time n.
+ * \param[in] iPoint - Index of the point.
+ * \return Coordinates of the control volume at time n.
*/
- inline su2double *GetCoord_Sum(void) { return Coord_Sum; }
+ inline su2double *GetCoord_n(unsigned long iPoint) { return Coord_n[iPoint]; }
/*!
- * \brief Get the value of the old coordinates for implicit smoothing.
- * \return Old coordinates at a point.
+ * \brief Get the coordinates of the control volume at time n-1.
+ * \param[in] iPoint - Index of the point.
+ * \return Volume of the control volume at time n-1
*/
- inline su2double *GetCoord_Old(void) { return Coord_Old; }
+ inline su2double *GetCoord_n1(unsigned long iPoint) { return Coord_n1[iPoint]; }
/*!
- * \brief Get the value of the grid velocity at the point.
- * \return Grid velocity at the point.
+ * \brief Get the coordinates of the control volume at time n+1.
+ * \param[in] iPoint - Index of the point.
+ * \return Volume of the control volume at time n+1
*/
- inline su2double *GetGridVel(void) { return GridVel; }
+ inline su2double *GetCoord_p1(unsigned long iPoint) { return Coord_p1[iPoint]; }
/*!
- * \brief Get the value of the grid velocity gradient at the point.
- * \return Grid velocity gradient at the point.
+ * \brief Set the coordinates of the control volume at time n to the ones in Coord.
*/
- inline su2double **GetGridVel_Grad(void) { return GridVel_Grad; }
+ void SetCoord_n();
/*!
- * \brief Add the value of the coordinates to the Coord_Sum vector for implicit smoothing.
- * \param[in] val_coord_sum - Value of the coordinates to add.
+ * \brief Set the coordinates of the control volume at time n-1 to the ones in Coord_n.
*/
- inline void AddCoord_Sum(const su2double *val_coord_sum) {
- for (unsigned short iDim = 0; iDim < nDim; iDim++)
- Coord_Sum[iDim] += val_coord_sum[iDim];
- }
+ void SetCoord_n1();
/*!
- * \brief Initialize the vector Coord_Sum.
+ * \brief Set the coordinates of the control volume at time n, for restart cases.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] coord - Value of the grid coordinates at time n.
*/
- inline void SetCoord_SumZero(void) {
- for (unsigned short iDim = 0; iDim < nDim; iDim++)
- Coord_Sum[iDim] = 0.0;
+ inline void SetCoord_n(unsigned long iPoint, const su2double *coord) {
+ for (unsigned long iDim = 0; iDim < nDim; iDim++)
+ Coord_n(iPoint,iDim) = coord[iDim];
}
/*!
- * \brief Set the value of the vector Coord_Old for implicit smoothing.
- * \param[in] val_coord_old - Value of the coordinates.
+ * \brief Set the coordinates of the control volume at time n-1, for restart cases.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] coord - Value of the grid coordinates at time n-1.
*/
- inline void SetCoord_Old(const su2double *val_coord_old) {
- for (unsigned short iDim = 0; iDim < nDim; iDim++)
- Coord_Old[iDim] = val_coord_old[iDim];
+ inline void SetCoord_n1(unsigned long iPoint, const su2double *coord) {
+ for (unsigned long iDim = 0; iDim < nDim; iDim++)
+ Coord_n1(iPoint,iDim) = coord[iDim];
}
/*!
- * \brief Set the value of the vector Coord_Old to Coord.
+ * \brief Set the coordinates of the control volume at time n+1.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] coord - Value of the grid coordinates at time n+1.
*/
- inline void SetCoord_Old (void) {
- for (unsigned short iDim = 0; iDim < nDim; iDim++)
- Coord_Old[iDim] = Coord[iDim];
+ inline void SetCoord_p1(unsigned long iPoint, const su2double *coord) {
+ for (unsigned long iDim = 0; iDim < nDim; iDim++)
+ Coord_p1(iPoint,iDim) = coord[iDim];
}
/*!
- * \brief Set the value of the grid velocity at the point.
- * \param[in] val_dim - Index of the coordinate.
- * \param[in] val_gridvel - Value of the grid velocity.
+ * \brief Get the value of the old coordinates for implicit smoothing.
+ * \param[in] iPoint - Index of the point.
+ * \return Old coordinates at a point.
*/
- inline void SetGridVel(unsigned short val_dim, su2double val_gridvel) { GridVel[val_dim] = val_gridvel; }
+ inline su2double *GetCoord_Old(unsigned long iPoint) { return Coord_Old[iPoint]; }
/*!
- * \overload
- * \brief Set the value of the grid velocity at the point.
- * \param[in] val_gridvel - Value of the grid velocity.
+ * \brief Set the value of the vector Coord_Old for implicit smoothing.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] coord_old - Value of the coordinates.
*/
- inline void SetGridVel(const su2double *val_gridvel) {
- for (unsigned short iDim = 0; iDim < nDim; iDim++)
- GridVel[iDim] = val_gridvel[iDim];
+ inline void SetCoord_Old(unsigned long iPoint, const su2double *coord_old) {
+ for (unsigned long iDim = 0; iDim < nDim; iDim++)
+ Coord_Old(iPoint,iDim) = coord_old[iDim];
}
/*!
- * \brief Set the gradient of the grid velocity.
- * \param[in] val_var - Index of the variable.
- * \param[in] val_dim - Index of the dimension.
- * \param[in] val_value - Value of the gradient.
+ * \brief Set the value of the vector Coord_Old to Coord.
+ */
+ void SetCoord_Old();
+
+ /*!
+ * \brief Get the value of the summed coordinates for implicit smoothing.
+ * \param[in] iPoint - Index of the point.
+ * \return Sum of coordinates at a point.
+ */
+ inline su2double *GetCoord_Sum(unsigned long iPoint) { return Coord_Sum[iPoint]; }
+
+ /*!
+ * \brief Add the value of the coordinates to the Coord_Sum vector for implicit smoothing.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] coord_sum - Value of the coordinates to add.
*/
- inline void SetGridVel_Grad(unsigned short val_var, unsigned short val_dim, su2double val_value) {
- GridVel_Grad[val_var][val_dim] = val_value;
+ inline void AddCoord_Sum(unsigned long iPoint, const su2double *coord_sum) {
+ for (unsigned long iDim = 0; iDim < nDim; iDim++)
+ Coord_Sum(iPoint,iDim) += coord_sum[iDim];
}
/*!
- * \brief This function does nothing (it comes from a pure virtual function, that implies the
- * definition of the function in all the derived classes).
+ * \brief Initialize the vector Coord_Sum.
*/
- inline void SetNodes_Coord(su2double *val_coord_Edge_CG, su2double *val_coord_FaceElem_CG,
- su2double *val_coord_Elem_CG) override { }
+ void SetCoord_SumZero();
+ /*!
+ * \brief Get the value of the grid velocity at the point.
+ * \param[in] iPoint - Index of the point.
+ * \return Grid velocity at the point.
+ */
+ inline su2double *GetGridVel(unsigned long iPoint) { return GridVel[iPoint]; }
/*!
- * \brief This function does nothing (it comes from a pure virtual function, that implies the
- * definition of the function in all the derived classes).
+ * \brief Get the grid velocity matrix for the entire domain.
*/
- inline void SetNodes_Coord(su2double *val_coord_Edge_CG, su2double *val_coord_Elem_CG) override { }
+ inline const su2activematrix& GetGridVel() const { return GridVel; }
/*!
- * \brief This function does nothing (it comes from a pure virtual function, that implies the
- * definition of the function in all the derived classes).
+ * \brief Set the value of the grid velocity at the point.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] iDim - Index of the coordinate.
+ * \param[in] gridvel - Value of the grid velocity.
*/
- inline void GetNormal(su2double *val_normal) const override { }
+ inline void SetGridVel(unsigned long iPoint, unsigned long iDim, su2double gridvel) { GridVel(iPoint,iDim) = gridvel; }
/*!
- * \brief This function does nothing (it comes from a pure virtual function, that implies the
- * definition of the function in all the derived classes).
+ * \brief Set the value of the grid velocity at the point.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] gridvel - Value of the grid velocity.
*/
- inline su2double *GetNormal(void) override { return nullptr; }
+ inline void SetGridVel(unsigned long iPoint, const su2double *gridvel) {
+ for (unsigned long iDim = 0; iDim < nDim; iDim++)
+ GridVel(iPoint,iDim) = gridvel[iDim];
+ }
/*!
- * \brief This function does nothing (it comes from a pure virtual function, that implies the
- * definition of the function in all the derived classes).
+ * \brief Get the grid velocity gradients for the entire domain.
*/
- inline void SetNormal(const su2double *val_face_normal) override { }
+ inline CVectorOfMatrix& GetGridVel_Grad() { return GridVel_Grad; }
/*!
- * \brief This function does nothing (it comes from a pure virtual function, that implies the
- * definition of the function in all the derived classes).
+ * \brief Get the value of the grid velocity gradient at the point.
+ * \param[in] iPoint - Index of the point.
+ * \return Grid velocity gradient at the point.
*/
- inline unsigned short GetnNodes() const override { return 0; }
+ inline const su2double* const* GetGridVel_Grad(unsigned long iPoint) const { return GridVel_Grad[iPoint]; }
/*!
- * \brief This function does nothing (it comes from a pure virtual function, that implies the
- * definition of the function in all the derived classes).
+ * \brief Set the adjoint values of the (geometric) coordinates.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] adj_sol - Adjoint values of the Coord variables.
*/
- inline void SetZeroValues(void) override { }
+ inline void SetAdjointSolution(unsigned long iPoint, const su2double *adj_sol) {
+ for (unsigned long iDim = 0; iDim < nDim; iDim++)
+ AD::SetDerivative(AD_OutputIndex(iPoint,iDim), SU2_TYPE::GetValue(adj_sol[iDim]));
+ }
/*!
- * \brief This function does nothing (it comes from a pure virtual function, that implies the
- * definition of the function in all the derived classes).
+ * \brief Get the adjoint values of the (geometric) coordinates.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] iDim - Dimension.
*/
- inline void AddNormal(const su2double *val_face_normal) override { }
+ inline su2double GetAdjointSolution(unsigned long iPoint, unsigned long iDim) const {
+ return AD::GetDerivative(AD_InputIndex(iPoint,iDim));
+ }
/*!
* \brief Set the adjoint values of the coordinates.
+ * \param[in] iPoint - Index of the point.
* \param[in] adj_sol - The adjoint values of the coordinates.
*/
- inline void SetAdjointCoord(const su2double *adj_coor){
- for (unsigned short iDim = 0; iDim < nDim; iDim++)
- SU2_TYPE::SetDerivative(Coord[iDim], SU2_TYPE::GetValue(adj_coor[iDim]));
+ inline void SetAdjointCoord(unsigned long iPoint, const su2double *adj_coor) {
+ for (unsigned long iDim = 0; iDim < nDim; iDim++)
+ SU2_TYPE::SetDerivative(Coord(iPoint,iDim), SU2_TYPE::GetValue(adj_coor[iDim]));
}
/*!
* \brief Set the adjoint values of the coordinates.
+ * \param[in] iPoint - Index of the point.
* \param[in] adj_sol - The adjoint values of the coordinates.
*/
- inline void SetAdjointCoord_LocalIndex(const su2double *adj_coor){
- for (unsigned short iDim = 0; iDim < nDim; iDim++)
- AD::SetDerivative(AD_OutputIndex[iDim], SU2_TYPE::GetValue(adj_coor[iDim]));
+ inline void SetAdjointCoord_LocalIndex(unsigned long iPoint, const su2double *adj_coor) {
+ for (unsigned long iDim = 0; iDim < nDim; iDim++)
+ AD::SetDerivative(AD_OutputIndex(iPoint,iDim), SU2_TYPE::GetValue(adj_coor[iDim]));
}
/*!
* \brief Get the adjoint values of the coordinates.
+ * \param[in] iPoint - Index of the point.
* \param[in] adj_sol - The adjoint values of the coordinates.
*/
- inline void GetAdjointCoord(su2double *adj_coor) const {
- for (unsigned short iDim = 0; iDim < nDim; iDim++)
- adj_coor[iDim] = SU2_TYPE::GetDerivative(Coord[iDim]);
+ inline void GetAdjointCoord(unsigned long iPoint, su2double *adj_coor) const {
+ for (unsigned long iDim = 0; iDim < nDim; iDim++)
+ adj_coor[iDim] = SU2_TYPE::GetDerivative(Coord(iPoint,iDim));
}
/*!
* \brief Get the adjoint values of the coordinates.
+ * \param[in] iPoint - Index of the point.
* \param[in] adj_sol - The adjoint values of the coordinates.
*/
- inline void GetAdjointCoord_LocalIndex(su2double *adj_coor) const {
- for (unsigned short iDim = 0; iDim < nDim; iDim++)
- adj_coor[iDim] = AD::GetDerivative(AD_InputIndex[iDim]);
+ inline void GetAdjointCoord_LocalIndex(unsigned long iPoint, su2double *adj_coor) const {
+ for (unsigned long iDim = 0; iDim < nDim; iDim++)
+ adj_coor[iDim] = AD::GetDerivative(AD_InputIndex(iPoint,iDim));
}
+ /*!
+ * \brief Set the adjoint vector indices of Coord vector.
+ * \param[in] iPoint - Index of the point.
+ * \param[in] input - Save them to the input or output indices vector.
+ */
+ void SetIndex(unsigned long iPoint, bool input);
+
};
diff --git a/Common/include/omp_structure.hpp b/Common/include/omp_structure.hpp
index d5a41b245d7d..d214480c53cb 100644
--- a/Common/include/omp_structure.hpp
+++ b/Common/include/omp_structure.hpp
@@ -156,7 +156,7 @@ inline size_t computeStaticChunkSize(size_t totalWork,
template
void parallelCopy(size_t size, const T* src, U* dst)
{
- SU2_OMP_FOR_STAT(4196)
+ SU2_OMP_FOR_STAT(4096)
for(size_t i=0; i
void parallelSet(size_t size, T val, U* dst)
{
- SU2_OMP_FOR_STAT(4196)
+ SU2_OMP_FOR_STAT(4096)
for(size_t i=0; i using su2vector = C2DContainer;
+template using su2matrix = C2DContainer;
+
+using su2activevector = su2vector;
+using su2activematrix = su2matrix;
+
+using su2passivevector = su2vector;
+using su2passivematrix = su2matrix;
+
+/*!
+ * \class CVectorOfMatrix
+ * \brief This contrived container is used to store small matrices in a contiguous manner
+ * but still present the "su2double**" interface to the outside world.
+ * The "interface" part should be replaced by something more efficient, e.g. a "matrix view".
+ */
+struct CVectorOfMatrix {
+ su2activevector storage;
+ su2matrix interface;
+ unsigned long M, N;
+
+ CVectorOfMatrix() = default;
+
+ CVectorOfMatrix(unsigned long length, unsigned long rows, unsigned long cols, su2double value = 0.0) {
+ resize(length, rows, cols, value);
+ }
+
+ void resize(unsigned long length, unsigned long rows, unsigned long cols, su2double value = 0.0) {
+ M = rows;
+ N = cols;
+ storage.resize(length*rows*cols) = value;
+ interface.resize(length,rows);
+
+ for(unsigned long i=0; i using su2vector = C2DContainer;
-template using su2matrix = C2DContainer;
-
-using su2activevector = su2vector;
-using su2activematrix = su2matrix;
-
-using su2passivevector = su2vector;
-using su2passivematrix = su2matrix;
diff --git a/Common/include/toolboxes/graph_toolbox.hpp b/Common/include/toolboxes/graph_toolbox.hpp
index 23a406c853e6..a869d9a00ffd 100644
--- a/Common/include/toolboxes/graph_toolbox.hpp
+++ b/Common/include/toolboxes/graph_toolbox.hpp
@@ -67,6 +67,24 @@ class CCompressedSparsePattern {
CCompressedSparsePattern() = default;
+ /*!
+ * \brief Construct with default inner indices.
+ * \param[in] outerPtrBegin - Start of outer pointers.
+ * \param[in] outerPtrEnd - End of outer pointers.
+ * \param[in] defaultInnerIdx - Default value for inner indices.
+ */
+ template
+ CCompressedSparsePattern(Iterator outerPtrBegin, Iterator outerPtrEnd, Index_t defaultInnerIdx)
+ {
+ const auto size = outerPtrEnd - outerPtrBegin;
+ m_outerPtr.resize(size);
+ Index_t k = 0;
+ for(auto it = outerPtrBegin; it != outerPtrEnd; ++it)
+ m_outerPtr(k++) = *it;
+
+ m_innerIdx.resize(m_outerPtr(size-1)) = defaultInnerIdx;
+ }
+
/*!
* \brief Construct from rvalue refs.
* \note This is the most efficient constructor as no data copy occurs.
@@ -102,6 +120,25 @@ class CCompressedSparsePattern {
assert(m_innerIdx.size() == m_outerPtr(m_outerPtr.size()-1));
}
+ /*!
+ * \brief Build from a "list of lists" type object
+ * \param[in] lil - An object with operator [][] and method "size" e.g. vector >.
+ */
+ template
+ CCompressedSparsePattern(const T& lil)
+ {
+ m_outerPtr.resize(lil.size()+1);
+ m_outerPtr(0) = 0;
+ for(Index_t i=1; i < Index_t(m_outerPtr.size()); ++i)
+ m_outerPtr(i) = m_outerPtr(i-1) + lil[i-1].size();
+
+ m_innerIdx.resize(m_outerPtr(lil.size()));
+ Index_t k = 0;
+ for(Index_t i=0; i < Index_t(lil.size()); ++i)
+ for(Index_t j=0; j < Index_t(lil[i].size()); ++j)
+ m_innerIdx(k++) = lil[i][j];
+ }
+
/*!
* \brief Build a list of pointers to the diagonal entries of the pattern.
*/
@@ -172,6 +209,16 @@ class CCompressedSparsePattern {
return m_innerIdx(m_outerPtr(iOuterIdx) + iNonZero);
}
+ /*!
+ * \param[in] iOuterIdx - Outer index.
+ * \param[in] iNonZero - Relative position of the inner index.
+ * \return The index of the i'th inner index associated with the outer index.
+ */
+ inline Index_t& getInnerIdx(Index_t iOuterIdx, Index_t iNonZero) {
+ assert(iNonZero >= 0 && iNonZero < getNumNonZeros(iOuterIdx));
+ return m_innerIdx(m_outerPtr(iOuterIdx) + iNonZero);
+ }
+
/*!
* \param[in] iOuterIdx - Outer index (row/col).
* \param[in] iInnerIdx - Inner index (col/row).
@@ -285,6 +332,7 @@ using CEdgeToNonZeroMap = C2DContainer;
+using CCompressedSparsePatternL = CCompressedSparsePattern;
using CEdgeToNonZeroMapUL = CEdgeToNonZeroMap;
@@ -335,14 +383,12 @@ CCompressedSparsePattern buildCSRPattern(Geometry_t& geometry,
* neighbors, not duplicating any existing neighbor. ---*/
for(auto jPoint : addedNeighbors)
{
- auto point = geometry.node[jPoint];
-
if(type == ConnectivityType::FiniteVolume)
{
/*--- For FVM we know the neighbors of point j directly. ---*/
- for(unsigned short iNeigh = 0; iNeigh < point->GetnPoint(); ++iNeigh)
+ for(unsigned short iNeigh = 0; iNeigh < geometry.nodes->GetnPoint(jPoint); ++iNeigh)
{
- Index_t kPoint = point->GetPoint(iNeigh);
+ Index_t kPoint = geometry.nodes->GetPoint(jPoint, iNeigh);
if(neighbors.count(kPoint) == 0) // no duplication
newNeighbors.insert(kPoint);
@@ -351,9 +397,9 @@ CCompressedSparsePattern buildCSRPattern(Geometry_t& geometry,
else // FiniteElement
{
/*--- For FEM we need the nodes of all elements that contain point j. ---*/
- for(unsigned short iNeigh = 0; iNeigh < point->GetnElem(); ++iNeigh)
+ for(unsigned short iNeigh = 0; iNeigh < geometry.nodes->GetnElem(jPoint); ++iNeigh)
{
- auto elem = geometry.elem[point->GetElem(iNeigh)];
+ auto elem = geometry.elem[geometry.nodes->GetElem(jPoint, iNeigh)];
for(unsigned short iNode = 0; iNode < elem->GetnNodes(); ++iNode)
{
diff --git a/Common/src/CMultiGridQueue.cpp b/Common/src/CMultiGridQueue.cpp
index 31028ca07e70..51e4cc75fcc6 100644
--- a/Common/src/CMultiGridQueue.cpp
+++ b/Common/src/CMultiGridQueue.cpp
@@ -183,9 +183,9 @@ void CMultiGridQueue::Update(unsigned long updatePoint, CGeometry *fineGrid) {
RemoveCV(updatePoint);
- for (auto iNode = 0u; iNode < fineGrid->node[updatePoint]->GetnPoint(); ++iNode) {
- const auto jPoint = fineGrid->node[updatePoint]->GetPoint(iNode);
- if (!fineGrid->node[jPoint]->GetAgglomerate())
+ for (auto iNode = 0u; iNode < fineGrid->nodes->GetnPoint(updatePoint); ++iNode) {
+ const auto jPoint = fineGrid->nodes->GetPoint(updatePoint,iNode);
+ if (!fineGrid->nodes->GetAgglomerate(jPoint))
IncrPriorityCV(jPoint);
}
}
diff --git a/Common/src/fem_geometry_structure.cpp b/Common/src/fem_geometry_structure.cpp
index b7650f70947c..c8411f49a28f 100644
--- a/Common/src/fem_geometry_structure.cpp
+++ b/Common/src/fem_geometry_structure.cpp
@@ -352,7 +352,7 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) {
of the points. ---*/
map globalPointIDToLocalInd;
for(unsigned long i=0; iGetnPoint(); ++i)
- globalPointIDToLocalInd[geometry->node[i]->GetGlobalIndex()] = i;
+ globalPointIDToLocalInd[geometry->nodes->GetGlobalIndex(i)] = i;
/*----------------------------------------------------------------------------*/
/*--- Step 1: Communicate the elements and the boundary elements to the ---*/
@@ -468,7 +468,7 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) {
unsigned long ind = LMI->second;
for(unsigned short l=0; lnode[ind]->GetCoord(l));
+ doubleSendBuf[i].push_back(geometry->nodes->GetCoord(ind, l));
}
}
@@ -6950,7 +6950,7 @@ CDummyMeshFEM_DG::CDummyMeshFEM_DG(CConfig *config): CMeshFEM_DG() {
elem = NULL;
face = NULL;
bound = NULL;
- node = NULL;
+ nodes = NULL;
edges = NULL;
vertex = NULL;
nVertex = NULL;
diff --git a/Common/src/geometry/CDummyGeometry.cpp b/Common/src/geometry/CDummyGeometry.cpp
index f8b657018b92..171a9eda8617 100644
--- a/Common/src/geometry/CDummyGeometry.cpp
+++ b/Common/src/geometry/CDummyGeometry.cpp
@@ -46,7 +46,7 @@ CDummyGeometry::CDummyGeometry(CConfig *config){
elem = NULL;
face = NULL;
bound = NULL;
- node = NULL;
+ nodes = NULL;
edges = NULL;
vertex = NULL;
nVertex = NULL;
diff --git a/Common/src/geometry/CGeometry.cpp b/Common/src/geometry/CGeometry.cpp
index 06d1c2cb0264..c5233288d648 100644
--- a/Common/src/geometry/CGeometry.cpp
+++ b/Common/src/geometry/CGeometry.cpp
@@ -32,8 +32,8 @@
/*--- Cross product ---*/
#define CROSS(dest,v1,v2) \
-(dest)[0] = (v1)[1]*(v2)[2] - (v1)[2]*(v2)[1]; \
-(dest)[1] = (v1)[2]*(v2)[0] - (v1)[0]*(v2)[2]; \
+(dest)[0] = (v1)[1]*(v2)[2] - (v1)[2]*(v2)[1]; \
+(dest)[1] = (v1)[2]*(v2)[0] - (v1)[0]*(v2)[2]; \
(dest)[2] = (v1)[0]*(v2)[1] - (v1)[1]*(v2)[0];
/*--- Cross product ---*/
@@ -43,8 +43,8 @@
/*--- a = b - c ---*/
#define SUB(dest,v1,v2) \
-(dest)[0] = (v1)[0] - (v2)[0]; \
-(dest)[1] = (v1)[1] - (v2)[1]; \
+(dest)[0] = (v1)[0] - (v2)[0]; \
+(dest)[1] = (v1)[1] - (v2)[1]; \
(dest)[2] = (v1)[2] - (v2)[2];
CGeometry::CGeometry(void) {
@@ -65,7 +65,7 @@ CGeometry::CGeometry(void) {
elem = NULL;
face = NULL;
bound = NULL;
- node = NULL;
+ nodes = NULL;
edges = NULL;
vertex = NULL;
nVertex = NULL;
@@ -143,7 +143,7 @@ CGeometry::CGeometry(void) {
CGeometry::~CGeometry(void) {
- unsigned long iElem, iElem_Bound, iFace, iPoint, iVertex;
+ unsigned long iElem, iElem_Bound, iFace, iVertex;
unsigned short iMarker;
if (elem != NULL) {
@@ -168,11 +168,7 @@ CGeometry::~CGeometry(void) {
delete[] face;
}
- if (node != NULL) {
- for (iPoint = 0; iPoint < nPointNode; iPoint ++)
- if (node[iPoint] != NULL) delete node[iPoint];
- delete[] node;
- }
+ delete nodes;
delete edges;
@@ -817,32 +813,32 @@ void CGeometry::InitiateComms(CGeometry *geometry,
switch (commType) {
case COORDINATES:
- vector = node[iPoint]->GetCoord();
+ vector = nodes->GetCoord(iPoint);
for (iDim = 0; iDim < nDim; iDim++)
bufDSend[buf_offset+iDim] = vector[iDim];
break;
case GRID_VELOCITY:
- vector = node[iPoint]->GetGridVel();
+ vector = nodes->GetGridVel(iPoint);
for (iDim = 0; iDim < nDim; iDim++)
bufDSend[buf_offset+iDim] = vector[iDim];
break;
case COORDINATES_OLD:
- vector = node[iPoint]->GetCoord_n();
+ vector = nodes->GetCoord_n(iPoint);
for (iDim = 0; iDim < nDim; iDim++) {
bufDSend[buf_offset+iDim] = vector[iDim];
}
if (config->GetTime_Marching() == DT_STEPPING_2ND) {
- vector = node[iPoint]->GetCoord_n1();
+ vector = nodes->GetCoord_n1(iPoint);
for (iDim = 0; iDim < nDim; iDim++) {
bufDSend[buf_offset+nDim+iDim] = vector[iDim];
}
}
break;
case MAX_LENGTH:
- bufDSend[buf_offset] = node[iPoint]->GetMaxLength();
+ bufDSend[buf_offset] = nodes->GetMaxLength(iPoint);
break;
case NEIGHBORS:
- bufSSend[buf_offset] = geometry->node[iPoint]->GetnNeighbor();
+ bufSSend[buf_offset] = geometry->nodes->GetnNeighbor(iPoint);
break;
default:
SU2_MPI::Error("Unrecognized quantity for point-to-point MPI comms.",
@@ -922,22 +918,22 @@ void CGeometry::CompleteComms(CGeometry *geometry,
switch (commType) {
case COORDINATES:
for (iDim = 0; iDim < nDim; iDim++)
- node[iPoint]->SetCoord(iDim, bufDRecv[buf_offset+iDim]);
+ nodes->SetCoord(iPoint, iDim, bufDRecv[buf_offset+iDim]);
break;
case GRID_VELOCITY:
for (iDim = 0; iDim < nDim; iDim++)
- node[iPoint]->SetGridVel(iDim, bufDRecv[buf_offset+iDim]);
+ nodes->SetGridVel(iPoint, iDim, bufDRecv[buf_offset+iDim]);
break;
case COORDINATES_OLD:
- node[iPoint]->SetCoord_n(&bufDRecv[buf_offset]);
+ nodes->SetCoord_n(iPoint, &bufDRecv[buf_offset]);
if (config->GetTime_Marching() == DT_STEPPING_2ND)
- node[iPoint]->SetCoord_n1(&bufDRecv[buf_offset+nDim]);
+ nodes->SetCoord_n1(iPoint, &bufDRecv[buf_offset+nDim]);
break;
case MAX_LENGTH:
- node[iPoint]->SetMaxLength(bufDRecv[buf_offset]);
+ nodes->SetMaxLength(iPoint, bufDRecv[buf_offset]);
break;
case NEIGHBORS:
- node[iPoint]->SetnNeighbor(bufSRecv[buf_offset]);
+ nodes->SetnNeighbor(iPoint, bufSRecv[buf_offset]);
break;
default:
SU2_MPI::Error("Unrecognized quantity for point-to-point MPI comms.",
@@ -1006,7 +1002,7 @@ void CGeometry::PreprocessPeriodicComms(CGeometry *geometry,
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Get the rank that holds the matching periodic point
on the other marker in the periodic pair. ---*/
@@ -1155,7 +1151,7 @@ void CGeometry::PreprocessPeriodicComms(CGeometry *geometry,
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Get the rank that holds the matching periodic point
on the other marker in the periodic pair. ---*/
@@ -1518,47 +1514,39 @@ su2double CGeometry::Point2Plane_Distance(su2double *Coord, su2double *iCoord, s
}
long CGeometry::FindEdge(unsigned long first_point, unsigned long second_point) {
- unsigned long iPoint = 0;
- unsigned short iNode;
- for (iNode = 0; iNode < node[first_point]->GetnPoint(); iNode++) {
- iPoint = node[first_point]->GetPoint(iNode);
- if (iPoint == second_point) break;
- }
- if (iPoint == second_point) return node[first_point]->GetEdge(iNode);
- else {
- char buf[100];
- SPRINTF(buf, "Can't find the edge that connects %lu and %lu.", first_point, second_point);
- SU2_MPI::Error(buf, CURRENT_FUNCTION);
- return 0;
+ for (unsigned short iNode = 0; iNode < nodes->GetnPoint(first_point); iNode++) {
+ auto iPoint = nodes->GetPoint(first_point, iNode);
+ if (iPoint == second_point) return nodes->GetEdge(first_point, iNode);
}
+
+ char buf[100];
+ SPRINTF(buf, "Can't find the edge that connects %lu and %lu.", first_point, second_point);
+ SU2_MPI::Error(buf, CURRENT_FUNCTION);
+ return 0;
}
bool CGeometry::CheckEdge(unsigned long first_point, unsigned long second_point) {
- unsigned long iPoint = 0;
- unsigned short iNode;
- for (iNode = 0; iNode < node[first_point]->GetnPoint(); iNode++) {
- iPoint = node[first_point]->GetPoint(iNode);
- if (iPoint == second_point) break;
- }
-
- if (iPoint == second_point) return true;
- else return false;
+ for (unsigned short iNode = 0; iNode < nodes->GetnPoint(first_point); iNode++) {
+ auto iPoint = nodes->GetPoint(first_point, iNode);
+ if (iPoint == second_point) return true;
+ }
+ return false;
}
void CGeometry::SetEdges(void) {
nEdge = 0;
for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) {
- for (auto iNode = 0u; iNode < node[iPoint]->GetnPoint(); iNode++) {
- auto jPoint = node[iPoint]->GetPoint(iNode);
- for (auto jNode = 0u; jNode < node[jPoint]->GetnPoint(); jNode++) {
- if (node[jPoint]->GetPoint(jNode) == iPoint) {
- auto TestEdge = node[jPoint]->GetEdge(jNode);
+ for (auto iNode = 0u; iNode < nodes->GetnPoint(iPoint); iNode++) {
+ auto jPoint = nodes->GetPoint(iPoint, iNode);
+ for (auto jNode = 0u; jNode < nodes->GetnPoint(jPoint); jNode++) {
+ if (nodes->GetPoint(jPoint, jNode) == iPoint) {
+ auto TestEdge = nodes->GetEdge(jPoint, jNode);
if (TestEdge == -1) {
- node[iPoint]->SetEdge(nEdge, iNode);
- node[jPoint]->SetEdge(nEdge, jNode);
+ nodes->SetEdge(iPoint, nEdge, iNode);
+ nodes->SetEdge(jPoint, nEdge, jNode);
nEdge++;
}
break;
@@ -1570,8 +1558,8 @@ void CGeometry::SetEdges(void) {
edges = new CEdge(nEdge,nDim);
for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) {
- for (auto iNode = 0u; iNode < node[iPoint]->GetnPoint(); iNode++) {
- auto jPoint = node[iPoint]->GetPoint(iNode);
+ for (auto iNode = 0u; iNode < nodes->GetnPoint(iPoint); iNode++) {
+ auto jPoint = nodes->GetPoint(iPoint, iNode);
if (iPoint < jPoint) {
auto iEdge = FindEdge(iPoint, jPoint);
edges->SetNodes(iEdge, iPoint, jPoint);
@@ -1581,34 +1569,34 @@ void CGeometry::SetEdges(void) {
}
void CGeometry::SetFaces(void) {
- // unsigned long iPoint, jPoint, iFace;
- // unsigned short jNode, iNode;
- // long TestFace = 0;
+ // unsigned long iPoint, jPoint, iFace;
+ // unsigned short jNode, iNode;
+ // long TestFace = 0;
//
- // nFace = 0;
- // for (iPoint = 0; iPoint < nPoint; iPoint++)
- // for (iNode = 0; iNode < node[iPoint]->GetnPoint(); iNode++) {
- // jPoint = node[iPoint]->GetPoint(iNode);
- // for (jNode = 0; jNode < node[jPoint]->GetnPoint(); jNode++)
- // if (node[jPoint]->GetPoint(jNode) == iPoint) {
- // TestFace = node[jPoint]->GetFace(jNode);
- // break;
- // }
- // if (TestFace == -1) {
- // node[iPoint]->SetFace(nFace, iNode);
- // node[jPoint]->SetFace(nFace, jNode);
- // nFace++;
- // }
- // }
+ // nFace = 0;
+ // for (iPoint = 0; iPoint < nPoint; iPoint++)
+ // for (iNode = 0; iNode < nodes->GetnPoint(iPoint); iNode++) {
+ // jPoint = nodes->GetPoint(iPoint, iNode);
+ // for (jNode = 0; jNode < nodes->GetnPoint(jPoint); jNode++)
+ // if (nodes->GetPoint(jPoint, jNode) == iPoint) {
+ // TestFace = nodes->GetFace(jPoint, jNode);
+ // break;
+ // }
+ // if (TestFace == -1) {
+ // nodes->SetFace(iPoint, nFace, iNode);
+ // nodes->SetFace(jPoint, nFace, jNode);
+ // nFace++;
+ // }
+ // }
//
- // face = new CFace*[nFace];
+ // face = new CFace*[nFace];
//
- // for (iPoint = 0; iPoint < nPoint; iPoint++)
- // for (iNode = 0; iNode < node[iPoint]->GetnPoint(); iNode++) {
- // jPoint = node[iPoint]->GetPoint(iNode);
- // iFace = FindFace(iPoint, jPoint);
- // if (iPoint < jPoint) face[iFace] = new CFace(iPoint, jPoint, nDim);
- // }
+ // for (iPoint = 0; iPoint < nPoint; iPoint++)
+ // for (iNode = 0; iNode < nodes->GetnPoint(iPoint); iNode++) {
+ // jPoint = nodes->GetPoint(iPoint, iNode);
+ // iFace = FindFace(iPoint, jPoint);
+ // if (iPoint < jPoint) face[iFace] = new CFace(iPoint, jPoint, nDim);
+ // }
}
void CGeometry::TestGeometry(void) {
@@ -1641,7 +1629,7 @@ void CGeometry::TestGeometry(void) {
para_file << " Point index: " << vertex[iMarker][iVertex]->GetNode() << endl;
para_file << " Point coordinates : ";
for (unsigned short iDim = 0; iDim < nDim; iDim++) {
- para_file << node[vertex[iMarker][iVertex]->GetNode()]->GetCoord(iDim) << "\t";}
+ para_file << nodes->GetCoord(vertex[iMarker][iVertex]->GetNode(), iDim) << "\t";}
para_file << endl;
vertex[iMarker][iVertex]->GetNormal(Normal);
para_file << " Face normal : ";
@@ -1661,17 +1649,17 @@ void CGeometry::SetSpline(vector &x, vector &y, unsigned l
u = new su2double [n];
- if (yp1 > 0.99e30) // The lower boundary condition is set either to be "nat
- y2[0]=u[0]=0.0; // -ural"
- else { // or else to have a specified first derivative.
+ if (yp1 > 0.99e30) // The lower boundary condition is set either to be "nat
+ y2[0]=u[0]=0.0; // -ural"
+ else { // or else to have a specified first derivative.
y2[0] = -0.5;
u[0]=(3.0/(x[1]-x[0]))*((y[1]-y[0])/(x[1]-x[0])-yp1);
}
- for (i=2; i<=n-1; i++) { // This is the decomposition loop of the tridiagonal al-
- sig=(x[i-1]-x[i-2])/(x[i]-x[i-2]); // gorithm. y2 and u are used for tem-
- p=sig*y2[i-2]+2.0; // porary storage of the decomposed
- y2[i-1]=(sig-1.0)/p; // factors.
+ for (i=2; i<=n-1; i++) { // This is the decomposition loop of the tridiagonal al-
+ sig=(x[i-1]-x[i-2])/(x[i]-x[i-2]); // gorithm. y2 and u are used for tem-
+ p=sig*y2[i-2]+2.0; // porary storage of the decomposed
+ y2[i-1]=(sig-1.0)/p; // factors.
su2double a1 = (y[i]-y[i-1])/(x[i]-x[i-1]); if (x[i] == x[i-1]) a1 = 1.0;
su2double a2 = (y[i-1]-y[i-2])/(x[i-1]-x[i-2]); if (x[i-1] == x[i-2]) a2 = 1.0;
@@ -1680,15 +1668,15 @@ void CGeometry::SetSpline(vector &x, vector &y, unsigned l
}
- if (ypn > 0.99e30) // The upper boundary condition is set either to be
- qn=un=0.0; // "natural"
- else { // or else to have a specified first derivative.
+ if (ypn > 0.99e30) // The upper boundary condition is set either to be
+ qn=un=0.0; // "natural"
+ else { // or else to have a specified first derivative.
qn=0.5;
un=(3.0/(x[n-1]-x[n-2]))*(ypn-(y[n-1]-y[n-2])/(x[n-1]-x[n-2]));
}
y2[n-1]=(un-qn*u[n-2])/(qn*y2[n-2]+1.0);
- for (k=n-1; k>=1; k--) // This is the backsubstitution loop of the tridiagonal
- y2[k-1]=y2[k-1]*y2[k]+u[k-1]; // algorithm.
+ for (k=n-1; k>=1; k--) // This is the backsubstitution loop of the tridiagonal algorithm.
+ y2[k-1]=y2[k-1]*y2[k]+u[k-1];
delete[] u;
@@ -1701,17 +1689,17 @@ su2double CGeometry::GetSpline(vector&xa, vector&ya, vecto
if (x < xa[0]) x = xa[0]; // Clip max and min values
if (x > xa[n-1]) x = xa[n-1];
- klo = 1; // We will find the right place in the table by means of
- khi = n; // bisection. This is optimal if sequential calls to this
- while (khi-klo > 1) { // routine are at random values of x. If sequential calls
- k = (khi+klo) >> 1; // are in order, and closely spaced, one would do better
- if (xa[k-1] > x) khi = k; // to store previous values of klo and khi and test if
- else klo=k; // they remain appropriate on the next call.
- } // klo and khi now bracket the input value of x
+ klo = 1; // We will find the right place in the table by means of
+ khi = n; // bisection. This is optimal if sequential calls to this
+ while (khi-klo > 1) { // routine are at random values of x. If sequential calls
+ k = (khi+klo) >> 1; // are in order, and closely spaced, one would do better
+ if (xa[k-1] > x) khi = k; // to store previous values of klo and khi and test if
+ else klo=k; // they remain appropriate on the next call.
+ } // klo and khi now bracket the input value of x
h = xa[khi-1] - xa[klo-1];
- if (h == 0.0) h = EPS; // cout << "Bad xa input to routine splint" << endl; // The xa?s must be distinct.
+ if (h == 0.0) h = EPS; // cout << "Bad xa input to routine splint" << endl; // The xa?s must be distinct.
a = (xa[khi-1]-x)/h;
- b = (x-xa[klo-1])/h; // Cubic spline polynomial is now evaluated.
+ b = (x-xa[klo-1])/h; // Cubic spline polynomial is now evaluated.
y = a*ya[klo-1]+b*ya[khi-1]+((a*a*a-a)*y2a[klo-1]+(b*b*b-b)*y2a[khi-1])*(h*h)/6.0;
return y;
@@ -2000,9 +1988,9 @@ void CGeometry::ComputeAirfoil_Section(su2double *Plane_P0, su2double *Plane_Nor
for (iNode = 0; iNode < bound[iMarker][iElem]->GetnNodes(); iNode++) {
iPoint = bound[iMarker][iElem]->GetNode(iNode);
- AveXCoord += node[iPoint]->GetCoord(0);
- AveYCoord += node[iPoint]->GetCoord(1);
- if (nDim == 3) AveZCoord += node[iPoint]->GetCoord(2);
+ AveXCoord += nodes->GetCoord(iPoint, 0);
+ AveYCoord += nodes->GetCoord(iPoint, 1);
+ if (nDim == 3) AveZCoord += nodes->GetCoord(iPoint, 2);
}
AveXCoord /= su2double(bound[iMarker][iElem]->GetnNodes());
@@ -2075,12 +2063,12 @@ void CGeometry::ComputeAirfoil_Section(su2double *Plane_P0, su2double *Plane_Nor
for (iDim = 0; iDim < nDim; iDim++) {
if (original_surface == true) {
- Segment_P0[iDim] = node[iPoint]->GetCoord(iDim);
- Segment_P1[iDim] = node[jPoint]->GetCoord(iDim);
+ Segment_P0[iDim] = nodes->GetCoord(iPoint, iDim);
+ Segment_P1[iDim] = nodes->GetCoord(jPoint, iDim);
}
else {
- Segment_P0[iDim] = node[iPoint]->GetCoord(iDim) + Coord_Variation[iPoint][iDim];
- Segment_P1[iDim] = node[jPoint]->GetCoord(iDim) + Coord_Variation[jPoint][iDim];
+ Segment_P0[iDim] = nodes->GetCoord(iPoint, iDim) + Coord_Variation[iPoint][iDim];
+ Segment_P1[iDim] = nodes->GetCoord(jPoint, iDim) + Coord_Variation[jPoint][iDim];
}
}
@@ -2096,8 +2084,8 @@ void CGeometry::ComputeAirfoil_Section(su2double *Plane_P0, su2double *Plane_Nor
Ycoord_Index0.push_back(Segment_P0[2]); Ycoord_Index1.push_back(Segment_P1[2]);
Zcoord_Index0.push_back(Segment_P0[1]); Zcoord_Index1.push_back(Segment_P1[1]);
Variable_Index0.push_back(Variable_P0); Variable_Index1.push_back(Variable_P1);
- IGlobalID_Index0.push_back(node[iPoint]->GetGlobalIndex()); IGlobalID_Index1.push_back(node[jPoint]->GetGlobalIndex());
- JGlobalID_Index0.push_back(node[iPoint]->GetGlobalIndex()); JGlobalID_Index1.push_back(node[jPoint]->GetGlobalIndex());
+ IGlobalID_Index0.push_back(nodes->GetGlobalIndex(iPoint)); IGlobalID_Index1.push_back(nodes->GetGlobalIndex(jPoint));
+ JGlobalID_Index0.push_back(nodes->GetGlobalIndex(iPoint)); JGlobalID_Index1.push_back(nodes->GetGlobalIndex(jPoint));
PointIndex++;
}
@@ -2111,16 +2099,16 @@ void CGeometry::ComputeAirfoil_Section(su2double *Plane_P0, su2double *Plane_Nor
Ycoord_Index0.push_back(Intersection[1]);
Zcoord_Index0.push_back(Intersection[2]);
Variable_Index0.push_back(Variable_Interp);
- IGlobalID_Index0.push_back(node[iPoint]->GetGlobalIndex());
- JGlobalID_Index0.push_back(node[jPoint]->GetGlobalIndex());
+ IGlobalID_Index0.push_back(nodes->GetGlobalIndex(iPoint));
+ JGlobalID_Index0.push_back(nodes->GetGlobalIndex(jPoint));
}
if (PointIndex == 1) {
Xcoord_Index1.push_back(Intersection[0]);
Ycoord_Index1.push_back(Intersection[1]);
Zcoord_Index1.push_back(Intersection[2]);
Variable_Index1.push_back(Variable_Interp);
- IGlobalID_Index1.push_back(node[iPoint]->GetGlobalIndex());
- JGlobalID_Index1.push_back(node[jPoint]->GetGlobalIndex());
+ IGlobalID_Index1.push_back(nodes->GetGlobalIndex(iPoint));
+ JGlobalID_Index1.push_back(nodes->GetGlobalIndex(jPoint));
}
PointIndex++;
}
@@ -2648,12 +2636,10 @@ void CGeometry::RegisterCoordinates(CConfig *config) {
for (iPoint = 0; iPoint < nPoint; iPoint++) {
for (iDim = 0; iDim < nDim; iDim++) {
- AD::RegisterInput(node[iPoint]->GetCoord()[iDim], push_index);
+ AD::RegisterInput(nodes->GetCoord(iPoint)[iDim], push_index);
}
if(!push_index) {
- for (iDim = 0; iDim < nDim; iDim++) {
- node[iPoint]->SetIndex(input);
- }
+ nodes->SetIndex(iPoint, input);
}
}
}
@@ -2665,12 +2651,12 @@ void CGeometry::RegisterOutput_Coordinates(CConfig *config){
for (iPoint = 0; iPoint < nPoint; iPoint++){
if(config->GetMultizone_Problem()) {
for (iDim = 0; iDim < nDim; iDim++) {
- AD::RegisterOutput(node[iPoint]->GetCoord()[iDim]);
+ AD::RegisterOutput(nodes->GetCoord(iPoint)[iDim]);
}
}
else {
for (iDim = 0; iDim < nDim; iDim++) {
- AD::RegisterOutput(node[iPoint]->GetCoord()[iDim]);
+ AD::RegisterOutput(nodes->GetCoord(iPoint)[iDim]);
}
}
}
@@ -2912,15 +2898,15 @@ void CGeometry::ComputeSurf_Straightness(CConfig *config,
void CGeometry::ComputeSurf_Curvature(CConfig *config) {
+
unsigned short iMarker, iNeigh_Point, iDim, iNode, iNeighbor_Nodes, Neighbor_Node;
unsigned long Neighbor_Point, iVertex, iPoint, jPoint, iElem_Bound, iEdge, nLocalVertex, MaxLocalVertex , *Buffer_Send_nVertex, *Buffer_Receive_nVertex, TotalnPointDomain;
- int iProcessor, nProcessor;
vector Point_NeighborList, Elem_NeighborList, Point_Triangle, Point_Edge, Point_Critical;
vector::iterator it;
su2double U[3] = {0.0,0.0,0.0}, V[3] = {0.0,0.0,0.0}, W[3] = {0.0,0.0,0.0}, Length_U, Length_V, Length_W, CosValue, Angle_Value, *K, *Angle_Defect, *Area_Vertex, *Angle_Alpha, *Angle_Beta, **NormalMeanK, MeanK, GaussK, MaxPrinK, cot_alpha, cot_beta, delta, X1, X2, X3, Y1, Y2, Y3, radius, *Buffer_Send_Coord, *Buffer_Receive_Coord, *Coord, Dist, MinDist, MaxK, MinK, SigmaK;
bool *Check_Edge;
- bool fea = ((config->GetKind_Solver()==FEM_ELASTICITY) || (config->GetKind_Solver()==DISC_ADJ_FEM));
+ const bool fea = config->GetStructuralProblem();
/*--- Allocate surface curvature ---*/
K = new su2double [nPoint];
@@ -2938,17 +2924,17 @@ void CGeometry::ComputeSurf_Curvature(CConfig *config) {
for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) {
iPoint = vertex[iMarker][iVertex]->GetNode();
- if (node[iPoint]->GetDomain()) {
+ if (nodes->GetDomain(iPoint)) {
/*--- Loop through neighbors. In 2-D, there should be 2 nodes on either
side of this vertex that lie on the same surface. ---*/
Point_Edge.clear();
- for (iNeigh_Point = 0; iNeigh_Point < node[iPoint]->GetnPoint(); iNeigh_Point++) {
- Neighbor_Point = node[iPoint]->GetPoint(iNeigh_Point);
+ for (iNeigh_Point = 0; iNeigh_Point < nodes->GetnPoint(iPoint); iNeigh_Point++) {
+ Neighbor_Point = nodes->GetPoint(iPoint, iNeigh_Point);
/*--- Check if this neighbor lies on the surface. If so,
add to the list of neighbors. ---*/
- if (node[Neighbor_Point]->GetPhysicalBoundary()) {
+ if (nodes->GetPhysicalBoundary(Neighbor_Point)) {
Point_Edge.push_back(Neighbor_Point);
}
@@ -2957,12 +2943,12 @@ void CGeometry::ComputeSurf_Curvature(CConfig *config) {
if (Point_Edge.size() == 2) {
/*--- Compute the curvature using three points ---*/
- X1 = node[iPoint]->GetCoord(0);
- X2 = node[Point_Edge[0]]->GetCoord(0);
- X3 = node[Point_Edge[1]]->GetCoord(0);
- Y1 = node[iPoint]->GetCoord(1);
- Y2 = node[Point_Edge[0]]->GetCoord(1);
- Y3 = node[Point_Edge[1]]->GetCoord(1);
+ X1 = nodes->GetCoord(iPoint, 0);
+ X2 = nodes->GetCoord(Point_Edge[0], 0);
+ X3 = nodes->GetCoord(Point_Edge[1], 0);
+ Y1 = nodes->GetCoord(iPoint, 1);
+ Y2 = nodes->GetCoord(Point_Edge[0], 1);
+ Y3 = nodes->GetCoord(Point_Edge[1], 1);
radius = sqrt(((X2-X1)*(X2-X1) + (Y2-Y1)*(Y2-Y1))*
((X2-X3)*(X2-X3) + (Y2-Y3)*(Y2-Y3))*
@@ -2970,7 +2956,7 @@ void CGeometry::ComputeSurf_Curvature(CConfig *config) {
(2.0*fabs(X1*Y2+X2*Y3+X3*Y1-X1*Y3-X2*Y1-X3*Y2)+EPS);
K[iPoint] = 1.0/radius;
- node[iPoint]->SetCurvature(K[iPoint]);
+ nodes->SetCurvature(iPoint, K[iPoint]);
}
}
@@ -3036,8 +3022,8 @@ void CGeometry::ComputeSurf_Curvature(CConfig *config) {
iEdge = FindEdge(Point_Triangle[0], Point_Triangle[1]);
for (iDim = 0; iDim < nDim; iDim++) {
- U[iDim] = node[Point_Triangle[0]]->GetCoord(iDim) - node[iPoint]->GetCoord(iDim);
- V[iDim] = node[Point_Triangle[1]]->GetCoord(iDim) - node[iPoint]->GetCoord(iDim);
+ U[iDim] = nodes->GetCoord(Point_Triangle[0], iDim) - nodes->GetCoord(iPoint, iDim);
+ V[iDim] = nodes->GetCoord(Point_Triangle[1], iDim) - nodes->GetCoord(iPoint, iDim);
}
W[0] = 0.5*(U[1]*V[2]-U[2]*V[1]); W[1] = -0.5*(U[0]*V[2]-U[2]*V[0]); W[2] = 0.5*(U[0]*V[1]-U[1]*V[0]);
@@ -3084,8 +3070,8 @@ void CGeometry::ComputeSurf_Curvature(CConfig *config) {
/*--- iPoint, and jPoint ---*/
for (iDim = 0; iDim < nDim; iDim++) {
- if (Area_Vertex[iPoint] != 0.0) NormalMeanK[iPoint][iDim] += 3.0 * (cot_alpha + cot_beta) * (node[iPoint]->GetCoord(iDim) - node[jPoint]->GetCoord(iDim)) / Area_Vertex[iPoint];
- if (Area_Vertex[jPoint] != 0.0) NormalMeanK[jPoint][iDim] += 3.0 * (cot_alpha + cot_beta) * (node[jPoint]->GetCoord(iDim) - node[iPoint]->GetCoord(iDim)) / Area_Vertex[jPoint];
+ if (Area_Vertex[iPoint] != 0.0) NormalMeanK[iPoint][iDim] += 3.0 * (cot_alpha + cot_beta) * (nodes->GetCoord(iPoint, iDim) - nodes->GetCoord(jPoint, iDim)) / Area_Vertex[iPoint];
+ if (Area_Vertex[jPoint] != 0.0) NormalMeanK[jPoint][iDim] += 3.0 * (cot_alpha + cot_beta) * (nodes->GetCoord(jPoint, iDim) - nodes->GetCoord(iPoint, iDim)) / Area_Vertex[jPoint];
}
}
@@ -3104,7 +3090,7 @@ void CGeometry::ComputeSurf_Curvature(CConfig *config) {
for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) {
iPoint = vertex[iMarker][iVertex]->GetNode();
- if (node[iPoint]->GetDomain()) {
+ if (nodes->GetDomain(iPoint)) {
if (Area_Vertex[iPoint] != 0.0) GaussK = 3.0*Angle_Defect[iPoint]/Area_Vertex[iPoint];
else GaussK = 0.0;
@@ -3120,7 +3106,7 @@ void CGeometry::ComputeSurf_Curvature(CConfig *config) {
/*--- Store the curvature value ---*/
K[iPoint] = MaxPrinK;
- node[iPoint]->SetCurvature(K[iPoint]);
+ nodes->SetCurvature(iPoint, K[iPoint]);
}
}
@@ -3147,7 +3133,7 @@ void CGeometry::ComputeSurf_Curvature(CConfig *config) {
if (config->GetMarker_All_KindBC(iMarker) != SEND_RECEIVE) {
for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) {
iPoint = vertex[iMarker][iVertex]->GetNode();
- if (node[iPoint]->GetDomain()) {
+ if (nodes->GetDomain(iPoint)) {
MaxK = max(MaxK, fabs(K[iPoint]));
MinK = min(MinK, fabs(K[iPoint]));
MeanK += fabs(K[iPoint]);
@@ -3157,14 +3143,12 @@ void CGeometry::ComputeSurf_Curvature(CConfig *config) {
}
}
-#ifdef HAVE_MPI
su2double MyMeanK = MeanK; MeanK = 0.0;
su2double MyMaxK = MaxK; MaxK = 0.0;
unsigned long MynPointDomain = TotalnPointDomain; TotalnPointDomain = 0;
SU2_MPI::Allreduce(&MyMeanK, &MeanK, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
SU2_MPI::Allreduce(&MyMaxK, &MaxK, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
SU2_MPI::Allreduce(&MynPointDomain, &TotalnPointDomain, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD);
-#endif
/*--- Compute the mean ---*/
MeanK /= su2double(TotalnPointDomain);
@@ -3175,17 +3159,15 @@ void CGeometry::ComputeSurf_Curvature(CConfig *config) {
if (config->GetMarker_All_KindBC(iMarker) != SEND_RECEIVE) {
for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) {
iPoint = vertex[iMarker][iVertex]->GetNode();
- if (node[iPoint]->GetDomain()) {
+ if (nodes->GetDomain(iPoint)) {
SigmaK += (fabs(K[iPoint]) - MeanK) * (fabs(K[iPoint]) - MeanK);
}
}
}
}
-#ifdef HAVE_MPI
su2double MySigmaK = SigmaK; SigmaK = 0.0;
SU2_MPI::Allreduce(&MySigmaK, &SigmaK, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
-#endif
SigmaK = sqrt(SigmaK/su2double(TotalnPointDomain));
@@ -3198,7 +3180,7 @@ void CGeometry::ComputeSurf_Curvature(CConfig *config) {
if (config->GetMarker_All_KindBC(iMarker) != SEND_RECEIVE) {
for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) {
iPoint = vertex[iMarker][iVertex]->GetNode();
- if (node[iPoint]->GetDomain()) {
+ if (nodes->GetDomain(iPoint)) {
if (fabs(K[iPoint]) > MeanK + config->GetRefSharpEdges()*SigmaK) {
Point_Critical.push_back(iPoint);
}
@@ -3209,14 +3191,8 @@ void CGeometry::ComputeSurf_Curvature(CConfig *config) {
/*--- Variables and buffers needed for MPI ---*/
-#ifdef HAVE_MPI
- SU2_MPI::Comm_size(MPI_COMM_WORLD, &nProcessor);
-#else
- nProcessor = 1;
-#endif
-
Buffer_Send_nVertex = new unsigned long [1];
- Buffer_Receive_nVertex = new unsigned long [nProcessor];
+ Buffer_Receive_nVertex = new unsigned long [size];
/*--- Count the total number of critical edge nodes. ---*/
@@ -3225,31 +3201,16 @@ void CGeometry::ComputeSurf_Curvature(CConfig *config) {
/*--- Communicate to all processors the total number of critical edge nodes. ---*/
-#ifdef HAVE_MPI
MaxLocalVertex = 0;
SU2_MPI::Allreduce(&nLocalVertex, &MaxLocalVertex, 1, MPI_UNSIGNED_LONG, MPI_MAX, MPI_COMM_WORLD);
SU2_MPI::Allgather(Buffer_Send_nVertex, 1, MPI_UNSIGNED_LONG, Buffer_Receive_nVertex, 1, MPI_UNSIGNED_LONG, MPI_COMM_WORLD);
-#else
- MaxLocalVertex = nLocalVertex;
- Buffer_Receive_nVertex[0] = nLocalVertex;
-#endif
-
/*--- Create and initialize to zero some buffers to hold the coordinates
of the boundary nodes that are communicated from each partition (all-to-all). ---*/
- Buffer_Send_Coord = new su2double [MaxLocalVertex*nDim];
- Buffer_Receive_Coord = new su2double [nProcessor*MaxLocalVertex*nDim];
-
-#ifdef HAVE_MPI
- unsigned long nBuffer = MaxLocalVertex*nDim;
-#endif
-
- for (iVertex = 0; iVertex < MaxLocalVertex; iVertex++) {
- for (iDim = 0; iDim < nDim; iDim++) {
- Buffer_Send_Coord[iVertex*nDim+iDim] = 0.0;
- }
- }
+ const unsigned long nBuffer = MaxLocalVertex*nDim;
+ Buffer_Send_Coord = new su2double [nBuffer] ();
+ Buffer_Receive_Coord = new su2double [size*nBuffer];
/*--- Retrieve and store the coordinates of the sharp edges boundary nodes on
the local partition and broadcast them to all partitions. ---*/
@@ -3257,28 +3218,20 @@ void CGeometry::ComputeSurf_Curvature(CConfig *config) {
for (iVertex = 0; iVertex < Point_Critical.size(); iVertex++) {
iPoint = Point_Critical[iVertex];
for (iDim = 0; iDim < nDim; iDim++)
- Buffer_Send_Coord[iVertex*nDim+iDim] = node[iPoint]->GetCoord(iDim);
+ Buffer_Send_Coord[iVertex*nDim+iDim] = nodes->GetCoord(iPoint, iDim);
}
-#ifdef HAVE_MPI
SU2_MPI::Allgather(Buffer_Send_Coord, nBuffer, MPI_DOUBLE, Buffer_Receive_Coord, nBuffer, MPI_DOUBLE, MPI_COMM_WORLD);
-#else
- for (iVertex = 0; iVertex < Point_Critical.size(); iVertex++) {
- for (iDim = 0; iDim < nDim; iDim++) {
- Buffer_Receive_Coord[iVertex*nDim+iDim] = Buffer_Send_Coord[iVertex*nDim+iDim];
- }
- }
-#endif
/*--- Loop over all interior mesh nodes on the local partition and compute
the distances to each of the no-slip boundary nodes in the entire mesh.
Store the minimum distance to the wall for each interior mesh node. ---*/
for (iPoint = 0; iPoint < GetnPoint(); iPoint++) {
- Coord = node[iPoint]->GetCoord();
+ Coord = nodes->GetCoord(iPoint);
MinDist = 1E20;
- for (iProcessor = 0; iProcessor < nProcessor; iProcessor++) {
+ for (int iProcessor = 0; iProcessor < size; iProcessor++) {
for (iVertex = 0; iVertex < Buffer_Receive_nVertex[iProcessor]; iVertex++) {
Dist = 0.0;
for (iDim = 0; iDim < nDim; iDim++) {
@@ -3290,7 +3243,7 @@ void CGeometry::ComputeSurf_Curvature(CConfig *config) {
if (Dist < MinDist) MinDist = Dist;
}
}
- node[iPoint]->SetSharpEdge_Distance(MinDist);
+ nodes->SetSharpEdge_Distance(iPoint, MinDist);
}
/*--- Deallocate Max curvature ---*/
@@ -3712,7 +3665,7 @@ void CGeometry::SetElemVolume(CConfig *config)
for (unsigned short iNode=0; iNodeGetnNodes(); ++iNode) {
unsigned long node_idx = elem[iElem]->GetNode(iNode);
for (unsigned short iDim=0; iDimGetCoord(iDim);
+ su2double coord = nodes->GetCoord(node_idx, iDim);
element->SetRef_Coord(iNode, iDim, coord);
}
}
@@ -3762,9 +3715,9 @@ void CGeometry::SetGeometryPlanes(CConfig *config) {
(config->GetMarker_All_KindBC(iMarker) == EULER_WALL) )
for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) {
iPoint = vertex[iMarker][iVertex]->GetNode();
- Xcoord[iVertex_Wall] = node[iPoint]->GetCoord(0);
- Ycoord[iVertex_Wall] = node[iPoint]->GetCoord(1);
- if (nDim==3) Zcoord[iVertex_Wall] = node[iPoint]->GetCoord(2);
+ Xcoord[iVertex_Wall] = nodes->GetCoord(iPoint, 0);
+ Ycoord[iVertex_Wall] = nodes->GetCoord(iPoint, 1);
+ if (nDim==3) Zcoord[iVertex_Wall] = nodes->GetCoord(iPoint, 2);
Face_Normal = vertex[iMarker][iVertex]->GetNormal();
FaceArea[iVertex_Wall] = fabs(Face_Normal[nDim-1]);
iVertex_Wall ++;
@@ -3794,17 +3747,17 @@ void CGeometry::SetGeometryPlanes(CConfig *config) {
/*--- Distribute the values among the different PhiAngles ---*/
for (iPoint = 0; iPoint < nPoint; iPoint++) {
- if (node[iPoint]->GetDomain()) {
+ if (nodes->GetDomain(iPoint)) {
loop_on = true;
for (ixCoord = 0; ixCoord < XCoordList.size()-1 && loop_on; ixCoord++) {
- dist_ratio = (node[iPoint]->GetCoord(0) - XCoordList[ixCoord])/(XCoordList[ixCoord+1]- XCoordList[ixCoord]);
+ dist_ratio = (nodes->GetCoord(iPoint, 0) - XCoordList[ixCoord])/(XCoordList[ixCoord+1]- XCoordList[ixCoord]);
if (dist_ratio >= 0 && dist_ratio <= 1.0) {
if (dist_ratio <= 0.5) iCoord = ixCoord;
else iCoord = ixCoord+1;
- Xcoord_plane[iCoord].push_back(node[iPoint]->GetCoord(0) );
- Ycoord_plane[iCoord].push_back(node[iPoint]->GetCoord(1) );
- if (nDim==3) Zcoord_plane[iCoord].push_back(node[iPoint]->GetCoord(2) );
- FaceArea_plane[iCoord].push_back(node[iPoint]->GetVolume()); ///// CHECK AREA CALCULATION
+ Xcoord_plane[iCoord].push_back(nodes->GetCoord(iPoint, 0) );
+ Ycoord_plane[iCoord].push_back(nodes->GetCoord(iPoint, 1) );
+ if (nDim==3) Zcoord_plane[iCoord].push_back(nodes->GetCoord(iPoint, 2) );
+ FaceArea_plane[iCoord].push_back(nodes->GetVolume(iPoint)); ///// CHECK AREA CALCULATION
Plane_points[iCoord].push_back(iPoint );
loop_on = false;
}
@@ -3863,7 +3816,7 @@ void CGeometry::SetRotationalVelocity(CConfig *config, bool print) {
/*--- Get the coordinates of the current node ---*/
- const su2double* Coord = node[iPoint]->GetCoord();
+ const su2double* Coord = nodes->GetCoord(iPoint);
/*--- Calculate the non-dim. distance from the rotation center ---*/
@@ -3878,7 +3831,7 @@ void CGeometry::SetRotationalVelocity(CConfig *config, bool print) {
/*--- Store the grid velocity at this node ---*/
- node[iPoint]->SetGridVel(RotVel);
+ nodes->SetGridVel(iPoint, RotVel);
}
@@ -3896,7 +3849,7 @@ void CGeometry::SetShroudVelocity(CConfig *config) {
if(config->GetMarker_Shroud(iMarkerShroud) == config->GetMarker_All_TagBound(iMarker)){
for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) {
iPoint = vertex[iMarker][iVertex]->GetNode();
- node[iPoint]->SetGridVel(RotVel);
+ nodes->SetGridVel(iPoint, RotVel);
}
}
}
@@ -3922,7 +3875,7 @@ void CGeometry::SetTranslationalVelocity(CConfig *config, bool print) {
/*--- Loop over all nodes and set the translational velocity ---*/
for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++)
- node[iPoint]->SetGridVel(xDot);
+ nodes->SetGridVel(iPoint, xDot);
}
@@ -3941,9 +3894,9 @@ void CGeometry::SetGridVelocity(CConfig *config, unsigned long iter) {
/*--- Coordinates of the current point at n+1, n, & n-1 time levels ---*/
- const su2double *Coord_nM1 = node[iPoint]->GetCoord_n1();
- const su2double *Coord_n = node[iPoint]->GetCoord_n();
- const su2double *Coord_nP1 = node[iPoint]->GetCoord();
+ const su2double *Coord_nM1 = nodes->GetCoord_n1(iPoint);
+ const su2double *Coord_n = nodes->GetCoord_n(iPoint);
+ const su2double *Coord_nP1 = nodes->GetCoord(iPoint);
/*--- Compute and store mesh velocity with 1st or 2nd-order approximation ---*/
@@ -3957,7 +3910,7 @@ void CGeometry::SetGridVelocity(CConfig *config, unsigned long iter) {
if (SecondOrder)
GridVel = (1.5*Coord_nP1[iDim] - 2.0*Coord_n[iDim] + 0.5*Coord_nM1[iDim]) / TimeStep;
- node[iPoint]->SetGridVel(iDim, GridVel);
+ nodes->SetGridVel(iPoint, iDim, GridVel);
}
}
@@ -4017,7 +3970,6 @@ const CCompressedSparsePatternUL& CGeometry::GetEdgeColoring(su2double* efficien
}
/*--- Create a temporary sparse pattern from the edges. ---*/
- /// TODO: Try to avoid temporary once grid information is made contiguous.
su2vector outerPtr(nEdge+1);
su2vector innerIdx(nEdge*2);
@@ -4070,7 +4022,6 @@ const CCompressedSparsePatternUL& CGeometry::GetElementColoring(su2double* effic
}
/*--- Create a temporary sparse pattern from the elements. ---*/
- /// TODO: Try to avoid temporary once grid information is made contiguous.
vector outerPtr(nElem+1);
vector innerIdx; innerIdx.reserve(nElem);
diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp
index db05047f27b8..46891dd09bef 100644
--- a/Common/src/geometry/CMultiGridGeometry.cpp
+++ b/Common/src/geometry/CMultiGridGeometry.cpp
@@ -72,14 +72,14 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con
if (iMesh == MESH_1) {
for (iPoint = 0; iPoint < fine_grid->GetnPoint(); iPoint ++)
- fine_grid->node[iPoint]->SetAgglomerate_Indirect(false);
+ fine_grid->nodes->SetAgglomerate_Indirect(iPoint, false);
for (iElem = 0; iElem < fine_grid->GetnElem(); iElem++) {
if ((fine_grid->elem[iElem]->GetVTK_Type() == HEXAHEDRON) ||
(fine_grid->elem[iElem]->GetVTK_Type() == QUADRILATERAL)) {
for (iNode = 0; iNode < fine_grid->elem[iElem]->GetnNodes(); iNode++) {
iPoint = fine_grid->elem[iElem]->GetNode(iNode);
- fine_grid->node[iPoint]->SetAgglomerate_Indirect(true);
+ fine_grid->nodes->SetAgglomerate_Indirect(iPoint, true);
}
}
}
@@ -91,17 +91,8 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con
CMultiGridQueue MGQueue_InnerCV(fine_grid->GetnPoint());
nPointNode = fine_grid->GetnPoint();
- node = new CPoint*[fine_grid->GetnPoint()];
- for (iPoint = 0; iPoint < fine_grid->GetnPoint(); iPoint ++) {
-
- /*--- Create node structure ---*/
- node[iPoint] = new CPoint(nDim, iPoint, config);
-
- /*--- Set the indirect agglomeration to false ---*/
-
- node[iPoint]->SetAgglomerate_Indirect(false);
- }
+ nodes = new CPoint(fine_grid->GetnPoint(), nDim, iMesh, config);
Index_CoarseCV = 0;
@@ -115,26 +106,26 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con
/*--- If the element has not being previously agglomerated and it belongs
to the physical domain, then the agglomeration is studied ---*/
- if ((fine_grid->node[iPoint]->GetAgglomerate() == false) &&
- (fine_grid->node[iPoint]->GetDomain()) &&
+ if ((fine_grid->nodes->GetAgglomerate(iPoint) == false) &&
+ (fine_grid->nodes->GetDomain(iPoint)) &&
(GeometricalCheck(iPoint, fine_grid, config))) {
nChildren = 1;
/*--- We set an index for the parent control volume ---*/
- fine_grid->node[iPoint]->SetParent_CV(Index_CoarseCV);
+ fine_grid->nodes->SetParent_CV(iPoint, Index_CoarseCV);
/*--- We add the seed point (child) to the parent control volume ---*/
- node[Index_CoarseCV]->SetChildren_CV(0, iPoint);
+ nodes->SetChildren_CV(Index_CoarseCV, 0, iPoint);
agglomerate_seed = true; counter = 0; marker_seed = iMarker;
/*--- For a particular point in the fine grid we save all the markers
that are in that point ---*/
for (jMarker = 0; jMarker < fine_grid->GetnMarker(); jMarker ++)
- if (fine_grid->node[iPoint]->GetVertex(jMarker) != -1) {
+ if (fine_grid->nodes->GetVertex(iPoint, jMarker) != -1) {
copy_marker[counter] = jMarker;
counter++;
}
@@ -164,9 +155,9 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con
/*--- Now we do a sweep over all the nodes that surround the seed point ---*/
- for (iNode = 0; iNode < fine_grid->node[iPoint]->GetnPoint(); iNode ++) {
+ for (iNode = 0; iNode < fine_grid->nodes->GetnPoint(iPoint); iNode ++) {
- CVPoint = fine_grid->node[iPoint]->GetPoint(iNode);
+ CVPoint = fine_grid->nodes->GetPoint(iPoint, iNode);
/*--- The new point can be agglomerated ---*/
@@ -174,11 +165,11 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con
/*--- We set the value of the parent ---*/
- fine_grid->node[CVPoint]->SetParent_CV(Index_CoarseCV);
+ fine_grid->nodes->SetParent_CV(CVPoint, Index_CoarseCV);
/*--- We set the value of the child ---*/
- node[Index_CoarseCV]->SetChildren_CV(nChildren, CVPoint);
+ nodes->SetChildren_CV(Index_CoarseCV, nChildren, CVPoint);
nChildren++;
}
@@ -186,7 +177,7 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con
Suitable_Indirect_Neighbors.clear();
- if (fine_grid->node[iPoint]->GetAgglomerate_Indirect())
+ if (fine_grid->nodes->GetAgglomerate_Indirect(iPoint))
SetSuitableNeighbors(&Suitable_Indirect_Neighbors, iPoint, Index_CoarseCV, fine_grid);
/*--- Now we do a sweep over all the indirect nodes that can be added ---*/
@@ -201,16 +192,16 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con
/*--- We set the value of the parent ---*/
- fine_grid->node[CVPoint]->SetParent_CV(Index_CoarseCV);
+ fine_grid->nodes->SetParent_CV(CVPoint, Index_CoarseCV);
/*--- We set the indirect agglomeration information ---*/
- if (fine_grid->node[CVPoint]->GetAgglomerate_Indirect())
- node[Index_CoarseCV]->SetAgglomerate_Indirect(true);
+ if (fine_grid->nodes->GetAgglomerate_Indirect(CVPoint))
+ nodes->SetAgglomerate_Indirect(Index_CoarseCV, true);
/*--- We set the value of the child ---*/
- node[Index_CoarseCV]->SetChildren_CV(nChildren, CVPoint);
+ nodes->SetChildren_CV(Index_CoarseCV, nChildren, CVPoint);
nChildren++;
}
}
@@ -220,7 +211,7 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con
/*--- Update the number of child of the control volume ---*/
- node[Index_CoarseCV]->SetnChildren_CV(nChildren);
+ nodes->SetnChildren_CV(Index_CoarseCV, nChildren);
Index_CoarseCV++;
}
}
@@ -233,11 +224,11 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con
for (iMarker = 0; iMarker < fine_grid->GetnMarker(); iMarker++)
for (iVertex = 0; iVertex < fine_grid->GetnVertex(iMarker); iVertex++) {
iPoint = fine_grid->vertex[iMarker][iVertex]->GetNode();
- if ((fine_grid->node[iPoint]->GetAgglomerate() == false) &&
- (fine_grid->node[iPoint]->GetDomain())) {
- fine_grid->node[iPoint]->SetParent_CV(Index_CoarseCV);
- node[Index_CoarseCV]->SetChildren_CV(0, iPoint);
- node[Index_CoarseCV]->SetnChildren_CV(1);
+ if ((fine_grid->nodes->GetAgglomerate(iPoint) == false) &&
+ (fine_grid->nodes->GetDomain(iPoint))) {
+ fine_grid->nodes->SetParent_CV(iPoint, Index_CoarseCV);
+ nodes->SetChildren_CV(Index_CoarseCV, 0, iPoint);
+ nodes->SetnChildren_CV(Index_CoarseCV, 1);
Index_CoarseCV++;
}
}
@@ -248,7 +239,7 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con
/*--- The CV has been agglomerated, remove form the list ---*/
- if (fine_grid->node[iPoint]->GetAgglomerate() == true) {
+ if (fine_grid->nodes->GetAgglomerate(iPoint) == true) {
MGQueue_InnerCV.RemoveCV(iPoint);
@@ -259,9 +250,9 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con
/*--- Count the number of agglomerated neighbors, and modify the queue ---*/
priority = 0;
- for (iNode = 0; iNode < fine_grid->node[iPoint]->GetnPoint(); iNode ++) {
- jPoint = fine_grid->node[iPoint]->GetPoint(iNode);
- if (fine_grid->node[jPoint]->GetAgglomerate() == true) priority++;
+ for (iNode = 0; iNode < fine_grid->nodes->GetnPoint(iPoint); iNode ++) {
+ jPoint = fine_grid->nodes->GetPoint(iPoint, iNode);
+ if (fine_grid->nodes->GetAgglomerate(jPoint) == true) priority++;
}
MGQueue_InnerCV.MoveCV(iPoint, priority);
}
@@ -278,19 +269,19 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con
/*--- If the element has not being previously agglomerated, belongs to the physical domain,
and satisfies several geometrical criteria then the seed CV is acepted for agglomeration ---*/
- if ((fine_grid->node[iPoint]->GetAgglomerate() == false) &&
- (fine_grid->node[iPoint]->GetDomain()) &&
+ if ((fine_grid->nodes->GetAgglomerate(iPoint) == false) &&
+ (fine_grid->nodes->GetDomain(iPoint)) &&
(GeometricalCheck(iPoint, fine_grid, config))) {
nChildren = 1;
/*--- We set an index for the parent control volume ---*/
- fine_grid->node[iPoint]->SetParent_CV(Index_CoarseCV);
+ fine_grid->nodes->SetParent_CV(iPoint, Index_CoarseCV);
/*--- We add the seed point (child) to the parent control volume ---*/
- node[Index_CoarseCV]->SetChildren_CV(0, iPoint);
+ nodes->SetChildren_CV(Index_CoarseCV, 0, iPoint);
/*--- Update the queue with the seed point (remove the seed and
increase the priority of the neighbors) ---*/
@@ -299,23 +290,23 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con
/*--- Now we do a sweep over all the nodes that surround the seed point ---*/
- for (iNode = 0; iNode < fine_grid->node[iPoint]->GetnPoint(); iNode ++) {
+ for (iNode = 0; iNode < fine_grid->nodes->GetnPoint(iPoint); iNode ++) {
- CVPoint = fine_grid->node[iPoint]->GetPoint(iNode);
+ CVPoint = fine_grid->nodes->GetPoint(iPoint, iNode);
/*--- Determine if the CVPoint can be agglomerated ---*/
- if ((fine_grid->node[CVPoint]->GetAgglomerate() == false) &&
- (fine_grid->node[CVPoint]->GetDomain()) &&
+ if ((fine_grid->nodes->GetAgglomerate(CVPoint) == false) &&
+ (fine_grid->nodes->GetDomain(CVPoint)) &&
(GeometricalCheck(CVPoint, fine_grid, config))) {
/*--- We set the value of the parent ---*/
- fine_grid->node[CVPoint]->SetParent_CV(Index_CoarseCV);
+ fine_grid->nodes->SetParent_CV(CVPoint, Index_CoarseCV);
/*--- We set the value of the child ---*/
- node[Index_CoarseCV]->SetChildren_CV(nChildren, CVPoint);
+ nodes->SetChildren_CV(Index_CoarseCV, nChildren, CVPoint);
nChildren++;
/*--- Update the queue with the new control volume (remove the CV and
@@ -330,7 +321,7 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con
/*--- Subrotuine to identify the indirect neighbors ---*/
Suitable_Indirect_Neighbors.clear();
- if (fine_grid->node[iPoint]->GetAgglomerate_Indirect())
+ if (fine_grid->nodes->GetAgglomerate_Indirect(iPoint))
SetSuitableNeighbors(&Suitable_Indirect_Neighbors, iPoint, Index_CoarseCV, fine_grid);
/*--- Now we do a sweep over all the indirect nodes that can be added ---*/
@@ -341,21 +332,21 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con
/*--- The new point can be agglomerated ---*/
- if ((fine_grid->node[CVPoint]->GetAgglomerate() == false) &&
- (fine_grid->node[CVPoint]->GetDomain())) {
+ if ((fine_grid->nodes->GetAgglomerate(CVPoint) == false) &&
+ (fine_grid->nodes->GetDomain(CVPoint))) {
/*--- We set the value of the parent ---*/
- fine_grid->node[CVPoint]->SetParent_CV(Index_CoarseCV);
+ fine_grid->nodes->SetParent_CV(CVPoint, Index_CoarseCV);
/*--- We set the indirect agglomeration information ---*/
- if (fine_grid->node[CVPoint]->GetAgglomerate_Indirect())
- node[Index_CoarseCV]->SetAgglomerate_Indirect(true);
+ if (fine_grid->nodes->GetAgglomerate_Indirect(CVPoint))
+ nodes->SetAgglomerate_Indirect(Index_CoarseCV, true);
/*--- We set the value of the child ---*/
- node[Index_CoarseCV]->SetChildren_CV(nChildren, CVPoint);
+ nodes->SetChildren_CV(Index_CoarseCV, nChildren, CVPoint);
nChildren++;
/*--- Update the queue with the new control volume (remove the CV and
@@ -368,7 +359,7 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con
/*--- Update the number of control of childrens ---*/
- node[Index_CoarseCV]->SetnChildren_CV(nChildren);
+ nodes->SetnChildren_CV(Index_CoarseCV, nChildren);
Index_CoarseCV++;
}
else {
@@ -384,14 +375,14 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con
/*--- Add all the elements that have not being agglomerated, in the previous stage ---*/
for (iPoint = 0; iPoint < fine_grid->GetnPoint(); iPoint ++) {
- if ((fine_grid->node[iPoint]->GetAgglomerate() == false) && (fine_grid->node[iPoint]->GetDomain())) {
+ if ((fine_grid->nodes->GetAgglomerate(iPoint) == false) && (fine_grid->nodes->GetDomain(iPoint))) {
nChildren = 1;
- fine_grid->node[iPoint]->SetParent_CV(Index_CoarseCV);
- if (fine_grid->node[iPoint]->GetAgglomerate_Indirect())
- node[Index_CoarseCV]->SetAgglomerate_Indirect(true);
- node[Index_CoarseCV]->SetChildren_CV(0, iPoint);
- node[Index_CoarseCV]->SetnChildren_CV(nChildren);
+ fine_grid->nodes->SetParent_CV(iPoint, Index_CoarseCV);
+ if (fine_grid->nodes->GetAgglomerate_Indirect(iPoint))
+ nodes->SetAgglomerate_Indirect(Index_CoarseCV, true);
+ nodes->SetChildren_CV(Index_CoarseCV, 0, iPoint);
+ nodes->SetnChildren_CV(Index_CoarseCV, nChildren);
Index_CoarseCV++;
}
@@ -405,46 +396,55 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con
unsigned short iChildren;
/*--- Find the point surrounding a point ---*/
-
- for (iCoarsePoint = 0; iCoarsePoint < nPointDomain; iCoarsePoint ++) {
- for (iChildren = 0; iChildren < node[iCoarsePoint]->GetnChildren_CV(); iChildren ++) {
- iFinePoint = node[iCoarsePoint]->GetChildren_CV(iChildren);
- for (iNode = 0; iNode < fine_grid->node[iFinePoint]->GetnPoint(); iNode ++) {
- iFinePoint_Neighbor = fine_grid->node[iFinePoint]->GetPoint(iNode);
- iParent = fine_grid->node[iFinePoint_Neighbor]->GetParent_CV();
- if (iParent != iCoarsePoint) node[iCoarsePoint]->SetPoint(iParent);
+ {
+ /*--- Temporary, CPoint (nodes) then compresses the information ---*/
+ vector > points(fine_grid->GetnPoint());
+
+ for (iCoarsePoint = 0; iCoarsePoint < nPointDomain; iCoarsePoint ++) {
+ for (iChildren = 0; iChildren < nodes->GetnChildren_CV(iCoarsePoint); iChildren ++) {
+ iFinePoint = nodes->GetChildren_CV(iCoarsePoint, iChildren);
+ for (iNode = 0; iNode < fine_grid->nodes->GetnPoint(iFinePoint); iNode ++) {
+ iFinePoint_Neighbor = fine_grid->nodes->GetPoint(iFinePoint, iNode);
+ iParent = fine_grid->nodes->GetParent_CV(iFinePoint_Neighbor);
+ if (iParent != iCoarsePoint) {
+ auto End = points[iCoarsePoint].end();
+ if (find(points[iCoarsePoint].begin(), End, iParent) == End)
+ points[iCoarsePoint].push_back(iParent);
+ }
+ }
}
}
+ nodes->SetPoints(points);
}
/*--- Detect isolated points and merge them with its correct neighbor ---*/
for (iCoarsePoint = 0; iCoarsePoint < nPointDomain; iCoarsePoint ++) {
- if (node[iCoarsePoint]->GetnPoint() == 1) {
+ if (nodes->GetnPoint(iCoarsePoint) == 1) {
/*--- Find the neighbor of the isolated point. This neighbor is the right control volume ---*/
- iCoarsePoint_Complete = node[iCoarsePoint]->GetPoint(0);
+ iCoarsePoint_Complete = nodes->GetPoint(iCoarsePoint, 0);
/*--- Add the children to the connected control volume (and modify it parent indexing).
Identify the child CV from the finest grid and added to the correct control volume.
Set the parent CV of iFinePoint. Instead of using the original
(iCoarsePoint) one use the new one (iCoarsePoint_Complete) ---*/
- nChildren = node[iCoarsePoint_Complete]->GetnChildren_CV();
+ nChildren = nodes->GetnChildren_CV(iCoarsePoint_Complete);
- for (iChildren = 0; iChildren < node[iCoarsePoint]->GetnChildren_CV(); iChildren ++) {
- iFinePoint = node[iCoarsePoint]->GetChildren_CV(iChildren);
- node[iCoarsePoint_Complete]->SetChildren_CV(nChildren, iFinePoint);
+ for (iChildren = 0; iChildren < nodes->GetnChildren_CV(iCoarsePoint); iChildren ++) {
+ iFinePoint = nodes->GetChildren_CV(iCoarsePoint, iChildren);
+ nodes->SetChildren_CV(iCoarsePoint_Complete, nChildren, iFinePoint);
nChildren++;
- fine_grid->node[iFinePoint]->SetParent_CV(iCoarsePoint_Complete);
+ fine_grid->nodes->SetParent_CV(iFinePoint, iCoarsePoint_Complete);
}
/*--- Update the number of children control volumes ---*/
- node[iCoarsePoint_Complete]->SetnChildren_CV(nChildren);
- node[iCoarsePoint]->SetnChildren_CV(0);
+ nodes->SetnChildren_CV(iCoarsePoint_Complete, nChildren);
+ nodes->SetnChildren_CV(iCoarsePoint, 0);
}
}
@@ -454,21 +454,21 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con
//
// do {
//
- // if (node[iCoarsePoint]->GetnChildren_CV() == 0) {
+ // if (nodes->GetnChildren_CV(iCoarsePoint) == 0) {
//
- // while (node[iPointFree]->GetnChildren_CV() == 0) {
+ // while (nodes->GetnChildren_CV(iPointFree) == 0) {
// Index_CoarseCV--;
// iPointFree--;
// }
//
- // nChildren = node[iPointFree]->GetnChildren_CV();
+ // nChildren = nodes->GetnChildren_CV(iPointFree);
// for (iChildren = 0; iChildren < nChildren; iChildren ++) {
- // iFinePoint = node[iPointFree]->GetChildren_CV(iChildren);
- // node[iCoarsePoint]->SetChildren_CV(iChildren, iFinePoint);
- // fine_grid->node[iFinePoint]->SetParent_CV(iCoarsePoint);
+ // iFinePoint = nodes->GetChildren_CV(iPointFree, iChildren);
+ // nodes->SetChildren_CV(iCoarsePoint, iChildren, iFinePoint);
+ // fine_grid->nodes->SetParent_CV(iFinePoint, iCoarsePoint);
// }
- // node[iCoarsePoint]->SetnChildren_CV(nChildren);
- // node[iPointFree]->SetnChildren_CV(0);
+ // nodes->SetnChildren_CV(iCoarsePoint, nChildren);
+ // nodes->SetnChildren_CV(iPointFree, 0);
//
// Index_CoarseCV--;
// iPointFree--;
@@ -483,9 +483,7 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con
/*--- Reset the point surrounding a point ---*/
- for (iCoarsePoint = 0; iCoarsePoint < nPointDomain; iCoarsePoint ++) {
- node[iCoarsePoint]->ResetPoint();
- }
+ nodes->ResetPoints();
/*--- Dealing with MPI parallelization, the objective is that the received nodes must be agglomerated
in the same way as the donor nodes. Send the node agglomeration information of the donor
@@ -519,7 +517,7 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con
for (iVertex = 0; iVertex < nVertexS; iVertex++) {
iPoint = fine_grid->vertex[MarkerS][iVertex]->GetNode();
Buffer_Send_Children[iVertex] = iPoint;
- Buffer_Send_Parent[iVertex] = fine_grid->node[iPoint]->GetParent_CV();
+ Buffer_Send_Parent[iVertex] = fine_grid->nodes->GetParent_CV(iPoint);
}
#ifdef HAVE_MPI
@@ -590,11 +588,11 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con
/*--- Be careful, it is possible that a node change the agglomeration configuration, the priority
is always, when receive the information ---*/
- fine_grid->node[Children_Local[iVertex]]->SetParent_CV(Parent_Local[iVertex]);
- node[Parent_Local[iVertex]]->SetChildren_CV(nChildren_MPI[Parent_Local[iVertex]], Children_Local[iVertex]);
+ fine_grid->nodes->SetParent_CV(Children_Local[iVertex], Parent_Local[iVertex]);
+ nodes->SetChildren_CV(Parent_Local[iVertex], nChildren_MPI[Parent_Local[iVertex]], Children_Local[iVertex]);
nChildren_MPI[Parent_Local[iVertex]]++;
- node[Parent_Local[iVertex]]->SetnChildren_CV(nChildren_MPI[Parent_Local[iVertex]]);
- node[Parent_Local[iVertex]]->SetDomain(false);
+ nodes->SetnChildren_CV(Parent_Local[iVertex], nChildren_MPI[Parent_Local[iVertex]]);
+ nodes->SetDomain(Parent_Local[iVertex], false);
}
@@ -688,19 +686,19 @@ bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, short mark
/*--- Basic condition, the element has not being previously agglomerated, it belongs to the domain,
and has passed some basic geometrical check ---*/
- if ((fine_grid->node[CVPoint]->GetAgglomerate() == false) &&
- (fine_grid->node[CVPoint]->GetDomain()) &&
+ if ((fine_grid->nodes->GetAgglomerate(CVPoint) == false) &&
+ (fine_grid->nodes->GetDomain(CVPoint)) &&
(GeometricalCheck(CVPoint, fine_grid, config))) {
/*--- If the element belong to the boundary, we must be careful ---*/
- if (fine_grid->node[CVPoint]->GetBoundary()) {
+ if (fine_grid->nodes->GetBoundary(CVPoint)) {
/*--- Identify the markers of the vertex that we want to agglomerate ---*/
counter = 0;
for (jMarker = 0; jMarker < fine_grid->GetnMarker(); jMarker ++)
- if (fine_grid->node[CVPoint]->GetVertex(jMarker) != -1) {
+ if (fine_grid->nodes->GetVertex(CVPoint, jMarker) != -1) {
copy_marker[counter] = jMarker;
counter++;
}
@@ -763,7 +761,7 @@ bool CMultiGridGeometry::GeometricalCheck(unsigned long iPoint, CGeometry *fine_
/*--- Evaluate the total size of the element ---*/
bool Volume = true;
- su2double ratio = pow(fine_grid->node[iPoint]->GetVolume(), 1.0/su2double(nDim))*max_dimension;
+ su2double ratio = pow(fine_grid->nodes->GetVolume(iPoint), 1.0/su2double(nDim))*max_dimension;
su2double limit = pow(config->GetDomainVolume(), 1.0/su2double(nDim));
if ( ratio > limit ) Volume = false;
@@ -773,11 +771,11 @@ bool CMultiGridGeometry::GeometricalCheck(unsigned long iPoint, CGeometry *fine_
/* unsigned short iNode, iDim;
unsigned long jPoint;
- su2double *Coord_i = fine_grid->node[iPoint]->GetCoord();
+ su2double *Coord_i = fine_grid->nodes->GetCoord(iPoint);
su2double max_dist = 0.0 ; su2double min_dist = 1E20;
- for (iNode = 0; iNode < fine_grid->node[iPoint]->GetnPoint(); iNode ++) {
- jPoint = fine_grid->node[iPoint]->GetPoint(iNode);
- su2double *Coord_j = fine_grid->node[jPoint]->GetCoord();
+ for (iNode = 0; iNode < fine_grid->nodes->GetnPoint(iPoint); iNode ++) {
+ jPoint = fine_grid->nodes->GetPoint(iPoint, iNode);
+ su2double *Coord_j = fine_grid->nodes->GetCoord(jPoint);
su2double distance = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
distance += (Coord_j[iDim]-Coord_i[iDim])*(Coord_j[iDim]-Coord_i[iDim]);
@@ -803,8 +801,8 @@ void CMultiGridGeometry::SetSuitableNeighbors(vector *Suitable_In
vector First_Neighbor_Points;
First_Neighbor_Points.push_back(iPoint);
- for (iNode = 0; iNode < fine_grid->node[iPoint]->GetnPoint(); iNode ++) {
- jPoint = fine_grid->node[iPoint]->GetPoint(iNode);
+ for (iNode = 0; iNode < fine_grid->nodes->GetnPoint(iPoint); iNode ++) {
+ jPoint = fine_grid->nodes->GetPoint(iPoint, iNode);
First_Neighbor_Points.push_back(jPoint);
}
@@ -812,11 +810,11 @@ void CMultiGridGeometry::SetSuitableNeighbors(vector *Suitable_In
vector Second_Neighbor_Points, Second_Origin_Points, Suitable_Second_Neighbors;
- for (iNode = 0; iNode < fine_grid->node[iPoint]->GetnPoint(); iNode ++) {
- jPoint = fine_grid->node[iPoint]->GetPoint(iNode);
+ for (iNode = 0; iNode < fine_grid->nodes->GetnPoint(iPoint); iNode ++) {
+ jPoint = fine_grid->nodes->GetPoint(iPoint, iNode);
- for (jNode = 0; jNode < fine_grid->node[jPoint]->GetnPoint(); jNode ++) {
- kPoint = fine_grid->node[jPoint]->GetPoint(jNode);
+ for (jNode = 0; jNode < fine_grid->nodes->GetnPoint(jPoint); jNode ++) {
+ kPoint = fine_grid->nodes->GetPoint(jPoint, jNode);
/*--- Check that the second neighbor do not belong to the first neighbor or the seed ---*/
@@ -875,8 +873,8 @@ void CMultiGridGeometry::SetSuitableNeighbors(vector *Suitable_In
for (jNode = 0; jNode < Suitable_Second_Neighbors.size(); jNode ++) {
kPoint = Suitable_Second_Neighbors[jNode];
- for (kNode = 0; kNode < fine_grid->node[kPoint]->GetnPoint(); kNode ++) {
- lPoint = fine_grid->node[kPoint]->GetPoint(kNode);
+ for (kNode = 0; kNode < fine_grid->nodes->GetnPoint(kPoint); kNode ++) {
+ lPoint = fine_grid->nodes->GetPoint(kPoint, kNode);
/*--- Check that the third neighbor do not belong to the first neighbors or the seed ---*/
@@ -934,22 +932,29 @@ void CMultiGridGeometry::SetPoint_Connectivity(CGeometry *fine_grid) {
/*--- Set the point surrounding a point ---*/
+ vector > points(nPoint);
+
for (iCoarsePoint = 0; iCoarsePoint < nPoint; iCoarsePoint ++) {
- for (iChildren = 0; iChildren < node[iCoarsePoint]->GetnChildren_CV(); iChildren ++) {
- iFinePoint = node[iCoarsePoint]->GetChildren_CV(iChildren);
- for (iNode = 0; iNode < fine_grid->node[iFinePoint]->GetnPoint(); iNode ++) {
- iFinePoint_Neighbor = fine_grid->node[iFinePoint]->GetPoint(iNode);
- iParent = fine_grid->node[iFinePoint_Neighbor]->GetParent_CV();
- if (iParent != iCoarsePoint) node[iCoarsePoint]->SetPoint(iParent);
+ for (iChildren = 0; iChildren < nodes->GetnChildren_CV(iCoarsePoint); iChildren ++) {
+ iFinePoint = nodes->GetChildren_CV(iCoarsePoint, iChildren);
+ for (iNode = 0; iNode < fine_grid->nodes->GetnPoint(iFinePoint); iNode ++) {
+ iFinePoint_Neighbor = fine_grid->nodes->GetPoint(iFinePoint, iNode);
+ iParent = fine_grid->nodes->GetParent_CV(iFinePoint_Neighbor);
+ if (iParent != iCoarsePoint) {
+ auto End = points[iCoarsePoint].end();
+ if (find(points[iCoarsePoint].begin(), End, iParent) == End)
+ points[iCoarsePoint].push_back(iParent);
+ }
}
}
}
+ nodes->SetPoints(points);
/*--- Set the number of neighbors variable, this is
important for JST and multigrid in parallel ---*/
for (iCoarsePoint = 0; iCoarsePoint < nPoint; iCoarsePoint ++)
- node[iCoarsePoint]->SetnNeighbor(node[iCoarsePoint]->GetnPoint());
+ nodes->SetnNeighbor(iCoarsePoint, nodes->GetnPoint(iCoarsePoint));
}
@@ -963,10 +968,10 @@ void CMultiGridGeometry::SetVertex(CGeometry *fine_grid, CConfig *config) {
/*--- If any children node belong to the boundary then the entire control
volume will belong to the boundary ---*/
for (iCoarsePoint = 0; iCoarsePoint < nPoint; iCoarsePoint ++)
- for (iChildren = 0; iChildren < node[iCoarsePoint]->GetnChildren_CV(); iChildren ++) {
- iFinePoint = node[iCoarsePoint]->GetChildren_CV(iChildren);
- if (fine_grid->node[iFinePoint]->GetBoundary()) {
- node[iCoarsePoint]->SetBoundary(nMarker);
+ for (iChildren = 0; iChildren < nodes->GetnChildren_CV(iCoarsePoint); iChildren ++) {
+ iFinePoint = nodes->GetChildren_CV(iCoarsePoint, iChildren);
+ if (fine_grid->nodes->GetBoundary(iFinePoint)) {
+ nodes->SetBoundary(iCoarsePoint, nMarker);
break;
}
}
@@ -983,13 +988,13 @@ void CMultiGridGeometry::SetVertex(CGeometry *fine_grid, CConfig *config) {
for (iCoarsePoint = 0; iCoarsePoint < nPoint; iCoarsePoint ++) {
- if (node[iCoarsePoint]->GetBoundary()) {
- for (iChildren = 0; iChildren < node[iCoarsePoint]->GetnChildren_CV(); iChildren ++) {
- iFinePoint = node[iCoarsePoint]->GetChildren_CV(iChildren);
+ if (nodes->GetBoundary(iCoarsePoint)) {
+ for (iChildren = 0; iChildren < nodes->GetnChildren_CV(iCoarsePoint); iChildren ++) {
+ iFinePoint = nodes->GetChildren_CV(iCoarsePoint, iChildren);
for (iMarker = 0; iMarker < nMarker; iMarker ++) {
- if ((fine_grid->node[iFinePoint]->GetVertex(iMarker) != -1) && (node[iCoarsePoint]->GetVertex(iMarker) == -1)) {
+ if ((fine_grid->nodes->GetVertex(iFinePoint, iMarker) != -1) && (nodes->GetVertex(iCoarsePoint, iMarker) == -1)) {
iVertex = nVertex[iMarker];
- node[iCoarsePoint]->SetVertex(iVertex, iMarker);
+ nodes->SetVertex(iCoarsePoint, iVertex, iMarker);
nVertex[iMarker]++;
}
}
@@ -1003,24 +1008,24 @@ void CMultiGridGeometry::SetVertex(CGeometry *fine_grid, CConfig *config) {
}
for (iCoarsePoint = 0; iCoarsePoint < nPoint; iCoarsePoint ++)
- if (node[iCoarsePoint]->GetBoundary())
+ if (nodes->GetBoundary(iCoarsePoint))
for (iMarker = 0; iMarker < nMarker; iMarker ++)
- node[iCoarsePoint]->SetVertex(-1, iMarker);
+ nodes->SetVertex(iCoarsePoint, -1, iMarker);
for (iMarker = 0; iMarker < nMarker; iMarker++) nVertex[iMarker] = 0;
for (iCoarsePoint = 0; iCoarsePoint < nPoint; iCoarsePoint ++) {
- if (node[iCoarsePoint]->GetBoundary()) {
- for (iChildren = 0; iChildren < node[iCoarsePoint]->GetnChildren_CV(); iChildren ++) {
- iFinePoint = node[iCoarsePoint]->GetChildren_CV(iChildren);
+ if (nodes->GetBoundary(iCoarsePoint)) {
+ for (iChildren = 0; iChildren < nodes->GetnChildren_CV(iCoarsePoint); iChildren ++) {
+ iFinePoint = nodes->GetChildren_CV(iCoarsePoint, iChildren);
for (iMarker = 0; iMarker < fine_grid->GetnMarker(); iMarker ++) {
- if ((fine_grid->node[iFinePoint]->GetVertex(iMarker) != -1) && (node[iCoarsePoint]->GetVertex(iMarker) == -1)) {
+ if ((fine_grid->nodes->GetVertex(iFinePoint, iMarker) != -1) && (nodes->GetVertex(iCoarsePoint, iMarker) == -1)) {
iVertex = nVertex[iMarker];
vertex[iMarker][iVertex] = new CVertex(iCoarsePoint, nDim);
- node[iCoarsePoint]->SetVertex(iVertex, iMarker);
+ nodes->SetVertex(iCoarsePoint, iVertex, iMarker);
/*--- Set the transformation to apply ---*/
- unsigned long ChildVertex = fine_grid->node[iFinePoint]->GetVertex(iMarker);
+ unsigned long ChildVertex = fine_grid->nodes->GetVertex(iFinePoint, iMarker);
unsigned short RotationKind = fine_grid->vertex[iMarker][ChildVertex]->GetRotation_Type();
vertex[iMarker][iVertex]->SetRotation_Type(RotationKind);
nVertex[iMarker]++;
@@ -1041,8 +1046,8 @@ void CMultiGridGeometry::MatchNearField(CConfig *config) {
if (config->GetMarker_All_KindBC(iMarker) == NEARFIELD_BOUNDARY) {
for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) {
iPoint = vertex[iMarker][iVertex]->GetNode();
- if (node[iPoint]->GetDomain()) {
- vertex[iMarker][iVertex]->SetDonorPoint(iPoint, node[iPoint]->GetGlobalIndex(), iVertex, iMarker, iProcessor);
+ if (nodes->GetDomain(iPoint)) {
+ vertex[iMarker][iVertex]->SetDonorPoint(iPoint, nodes->GetGlobalIndex(iPoint), iVertex, iMarker, iProcessor);
}
}
}
@@ -1061,8 +1066,8 @@ void CMultiGridGeometry::MatchActuator_Disk(CConfig *config) {
(config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)) {
for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) {
iPoint = vertex[iMarker][iVertex]->GetNode();
- if (node[iPoint]->GetDomain()) {
- vertex[iMarker][iVertex]->SetDonorPoint(iPoint, node[iPoint]->GetGlobalIndex(), iVertex, iMarker, iProcessor);
+ if (nodes->GetDomain(iPoint)) {
+ vertex[iMarker][iVertex]->SetDonorPoint(iPoint, nodes->GetGlobalIndex(iPoint), iVertex, iMarker, iProcessor);
}
}
}
@@ -1087,8 +1092,8 @@ void CMultiGridGeometry::MatchPeriodic(CConfig *config, unsigned short val_perio
(iPeriodic == val_periodic + nPeriodic/2)) {
for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) {
iPoint = vertex[iMarker][iVertex]->GetNode();
- if (node[iPoint]->GetDomain()) {
- vertex[iMarker][iVertex]->SetDonorPoint(iPoint, node[iPoint]->GetGlobalIndex(), iVertex, iMarker, iProcessor);
+ if (nodes->GetDomain(iPoint)) {
+ vertex[iMarker][iVertex]->SetDonorPoint(iPoint, nodes->GetGlobalIndex(iPoint), iVertex, iMarker, iProcessor);
}
}
}
@@ -1107,13 +1112,13 @@ void CMultiGridGeometry::SetControlVolume(CConfig *config, CGeometry *fine_grid,
/*--- Compute the area of the coarse volume ---*/
for (iCoarsePoint = 0; iCoarsePoint < nPoint; iCoarsePoint ++) {
- node[iCoarsePoint]->SetVolume(0.0);
+ nodes->SetVolume(iCoarsePoint, 0.0);
Coarse_Volume = 0.0;
- for (iChildren = 0; iChildren < node[iCoarsePoint]->GetnChildren_CV(); iChildren ++) {
- iFinePoint = node[iCoarsePoint]->GetChildren_CV(iChildren);
- Coarse_Volume += fine_grid->node[iFinePoint]->GetVolume();
+ for (iChildren = 0; iChildren < nodes->GetnChildren_CV(iCoarsePoint); iChildren ++) {
+ iFinePoint = nodes->GetChildren_CV(iCoarsePoint, iChildren);
+ Coarse_Volume += fine_grid->nodes->GetVolume(iFinePoint);
}
- node[iCoarsePoint]->SetVolume(Coarse_Volume);
+ nodes->SetVolume(iCoarsePoint, Coarse_Volume);
}
/*--- Update or not the values of faces at the edge ---*/
@@ -1122,12 +1127,12 @@ void CMultiGridGeometry::SetControlVolume(CConfig *config, CGeometry *fine_grid,
}
for (iCoarsePoint = 0; iCoarsePoint < nPoint; iCoarsePoint ++)
- for (iChildren = 0; iChildren < node[iCoarsePoint]->GetnChildren_CV(); iChildren ++) {
- iFinePoint = node[iCoarsePoint]->GetChildren_CV(iChildren);
+ for (iChildren = 0; iChildren < nodes->GetnChildren_CV(iCoarsePoint); iChildren ++) {
+ iFinePoint = nodes->GetChildren_CV(iCoarsePoint, iChildren);
- for (iNode = 0; iNode < fine_grid->node[iFinePoint]->GetnPoint(); iNode ++) {
- iFinePoint_Neighbor = fine_grid->node[iFinePoint]->GetPoint(iNode);
- iParent = fine_grid->node[iFinePoint_Neighbor]->GetParent_CV();
+ for (iNode = 0; iNode < fine_grid->nodes->GetnPoint(iFinePoint); iNode ++) {
+ iFinePoint_Neighbor = fine_grid->nodes->GetPoint(iFinePoint, iNode);
+ iParent = fine_grid->nodes->GetParent_CV(iFinePoint_Neighbor);
if ((iParent != iCoarsePoint) && (iParent < iCoarsePoint)) {
FineEdge = fine_grid->FindEdge(iFinePoint, iFinePoint_Neighbor);
@@ -1179,10 +1184,10 @@ void CMultiGridGeometry::SetBoundControlVolume(CConfig *config, CGeometry *fine_
for (iMarker = 0; iMarker < nMarker; iMarker ++)
for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) {
iCoarsePoint = vertex[iMarker][iVertex]->GetNode();
- for (iChildren = 0; iChildren < node[iCoarsePoint]->GetnChildren_CV(); iChildren ++) {
- iFinePoint = node[iCoarsePoint]->GetChildren_CV(iChildren);
- if (fine_grid->node[iFinePoint]->GetVertex(iMarker)!=-1) {
- FineVertex = fine_grid->node[iFinePoint]->GetVertex(iMarker);
+ for (iChildren = 0; iChildren < nodes->GetnChildren_CV(iCoarsePoint); iChildren ++) {
+ iFinePoint = nodes->GetChildren_CV(iCoarsePoint, iChildren);
+ if (fine_grid->nodes->GetVertex(iFinePoint, iMarker)!=-1) {
+ FineVertex = fine_grid->nodes->GetVertex(iFinePoint, iMarker);
fine_grid->vertex[iMarker][FineVertex]->GetNormal(Normal);
vertex[iMarker][iVertex]->AddNormal(Normal);
}
@@ -1210,17 +1215,17 @@ void CMultiGridGeometry::SetCoord(CGeometry *geometry) {
Coordinates = new su2double[nDim];
for (Point_Coarse = 0; Point_Coarse < GetnPoint(); Point_Coarse++) {
- Area_Parent = node[Point_Coarse]->GetVolume();
+ Area_Parent = nodes->GetVolume(Point_Coarse);
for (iDim = 0; iDim < nDim; iDim++) Coordinates[iDim] = 0.0;
- for (iChildren = 0; iChildren < node[Point_Coarse]->GetnChildren_CV(); iChildren++) {
- Point_Fine = node[Point_Coarse]->GetChildren_CV(iChildren);
- Area_Children = geometry->node[Point_Fine]->GetVolume();
- Coordinates_Fine = geometry->node[Point_Fine]->GetCoord();
+ for (iChildren = 0; iChildren < nodes->GetnChildren_CV(Point_Coarse); iChildren++) {
+ Point_Fine = nodes->GetChildren_CV(Point_Coarse, iChildren);
+ Area_Children = geometry->nodes->GetVolume(Point_Fine);
+ Coordinates_Fine = geometry->nodes->GetCoord(Point_Fine);
for (iDim = 0; iDim < nDim; iDim++)
Coordinates[iDim] += Coordinates_Fine[iDim]*Area_Children/Area_Parent;
}
for (iDim = 0; iDim < nDim; iDim++)
- node[Point_Coarse]->SetCoord(iDim, Coordinates[iDim]);
+ nodes->SetCoord(Point_Coarse, iDim, Coordinates[iDim]);
}
delete[] Coordinates;
}
@@ -1237,27 +1242,27 @@ void CMultiGridGeometry::SetMultiGridWallHeatFlux(CGeometry *geometry, unsigned
for(iVertex=0; iVertex < nVertex[val_marker]; iVertex++){
Point_Coarse = vertex[val_marker][iVertex]->GetNode();
- if (node[Point_Coarse]->GetDomain()){
+ if (nodes->GetDomain(Point_Coarse)){
Area_Parent = 0.0;
WallHeatFlux_Coarse = 0.0;
numberVertexChildren = 0;
/*--- Compute area parent by taking into account only volumes that are on the marker ---*/
- for(iChildren=0; iChildren < node[Point_Coarse]->GetnChildren_CV(); iChildren++){
- Point_Fine = node[Point_Coarse]->GetChildren_CV(iChildren);
- isVertex = (node[Point_Fine]->GetDomain() && geometry->node[Point_Fine]->GetVertex(val_marker) != -1);
+ for(iChildren=0; iChildren < nodes->GetnChildren_CV(Point_Coarse); iChildren++){
+ Point_Fine = nodes->GetChildren_CV(Point_Coarse, iChildren);
+ isVertex = (nodes->GetDomain(Point_Fine) && geometry->nodes->GetVertex(Point_Fine, val_marker) != -1);
if (isVertex){
numberVertexChildren += 1;
- Area_Parent += geometry->node[Point_Fine]->GetVolume();
+ Area_Parent += geometry->nodes->GetVolume(Point_Fine);
}
}
/*--- Loop again and propagate values to the coarser level ---*/
- for(iChildren=0; iChildren < node[Point_Coarse]->GetnChildren_CV(); iChildren++){
- Point_Fine = node[Point_Coarse]->GetChildren_CV(iChildren);
- Vertex_Fine = geometry->node[Point_Fine]->GetVertex(val_marker);
- isVertex = (node[Point_Fine]->GetDomain() && Vertex_Fine != -1);
+ for(iChildren=0; iChildren < nodes->GetnChildren_CV(Point_Coarse); iChildren++){
+ Point_Fine = nodes->GetChildren_CV(Point_Coarse, iChildren);
+ Vertex_Fine = geometry->nodes->GetVertex(Point_Fine, val_marker);
+ isVertex = (nodes->GetDomain(Point_Fine) && Vertex_Fine != -1);
if(isVertex){
- Area_Children = geometry->node[Point_Fine]->GetVolume();
+ Area_Children = geometry->nodes->GetVolume(Point_Fine);
//Get the customized BC values on fine level and compute the values at coarse level
WallHeatFlux_Fine = geometry->GetCustomBoundaryHeatFlux(val_marker, Vertex_Fine);
WallHeatFlux_Coarse += WallHeatFlux_Fine*Area_Children/Area_Parent;
@@ -1283,27 +1288,27 @@ void CMultiGridGeometry::SetMultiGridWallTemperature(CGeometry *geometry, unsign
for(iVertex=0; iVertex < nVertex[val_marker]; iVertex++){
Point_Coarse = vertex[val_marker][iVertex]->GetNode();
- if (node[Point_Coarse]->GetDomain()){
+ if (nodes->GetDomain(Point_Coarse)){
Area_Parent = 0.0;
WallTemperature_Coarse = 0.0;
numberVertexChildren = 0;
/*--- Compute area parent by taking into account only volumes that are on the marker ---*/
- for(iChildren=0; iChildren < node[Point_Coarse]->GetnChildren_CV(); iChildren++){
- Point_Fine = node[Point_Coarse]->GetChildren_CV(iChildren);
- isVertex = (node[Point_Fine]->GetDomain() && geometry->node[Point_Fine]->GetVertex(val_marker) != -1);
+ for(iChildren=0; iChildren < nodes->GetnChildren_CV(Point_Coarse); iChildren++){
+ Point_Fine = nodes->GetChildren_CV(Point_Coarse, iChildren);
+ isVertex = (nodes->GetDomain(Point_Fine) && geometry->nodes->GetVertex(Point_Fine, val_marker) != -1);
if (isVertex){
numberVertexChildren += 1;
- Area_Parent += geometry->node[Point_Fine]->GetVolume();
+ Area_Parent += geometry->nodes->GetVolume(Point_Fine);
}
}
/*--- Loop again and propagate values to the coarser level ---*/
- for(iChildren=0; iChildren < node[Point_Coarse]->GetnChildren_CV(); iChildren++){
- Point_Fine = node[Point_Coarse]->GetChildren_CV(iChildren);
- Vertex_Fine = geometry->node[Point_Fine]->GetVertex(val_marker);
- isVertex = (node[Point_Fine]->GetDomain() && Vertex_Fine != -1);
+ for(iChildren=0; iChildren < nodes->GetnChildren_CV(Point_Coarse); iChildren++){
+ Point_Fine = nodes->GetChildren_CV(Point_Coarse, iChildren);
+ Vertex_Fine = geometry->nodes->GetVertex(Point_Fine, val_marker);
+ isVertex = (nodes->GetDomain(Point_Fine) && Vertex_Fine != -1);
if(isVertex){
- Area_Children = geometry->node[Point_Fine]->GetVolume();
+ Area_Children = geometry->nodes->GetVolume(Point_Fine);
//Get the customized BC values on fine level and compute the values at coarse level
WallTemperature_Fine = geometry->GetCustomBoundaryTemperature(val_marker, Vertex_Fine);
WallTemperature_Coarse += WallTemperature_Fine*Area_Children/Area_Parent;
@@ -1321,24 +1326,24 @@ void CMultiGridGeometry::SetRestricted_GridVelocity(CGeometry *fine_mesh, CConfi
/*--- Loop over all coarse mesh points. ---*/
for (unsigned long Point_Coarse = 0; Point_Coarse < nPoint; Point_Coarse++) {
- su2double Area_Parent = node[Point_Coarse]->GetVolume();
+ su2double Area_Parent = nodes->GetVolume(Point_Coarse);
/*--- Initialize coarse grid velocity to zero. ---*/
su2double Grid_Vel[3] = {0.0, 0.0, 0.0};
/*--- Loop over all of the children for this coarse CV and compute
a grid velocity based on the values in the child CVs (fine mesh). ---*/
- for (unsigned short iChild = 0; iChild < node[Point_Coarse]->GetnChildren_CV(); iChild++) {
- unsigned long Point_Fine = node[Point_Coarse]->GetChildren_CV(iChild);
- su2double Area_Child = fine_mesh->node[Point_Fine]->GetVolume();
- const su2double* Grid_Vel_Fine = fine_mesh->node[Point_Fine]->GetGridVel();
+ for (unsigned short iChild = 0; iChild < nodes->GetnChildren_CV(Point_Coarse); iChild++) {
+ unsigned long Point_Fine = nodes->GetChildren_CV(Point_Coarse, iChild);
+ su2double Area_Child = fine_mesh->nodes->GetVolume(Point_Fine);
+ const su2double* Grid_Vel_Fine = fine_mesh->nodes->GetGridVel(Point_Fine);
for (unsigned short iDim = 0; iDim < nDim; iDim++)
Grid_Vel[iDim] += Grid_Vel_Fine[iDim]*Area_Child/Area_Parent;
}
/*--- Set the grid velocity for this coarse node. ---*/
for (unsigned short iDim = 0; iDim < nDim; iDim++)
- node[Point_Coarse]->SetGridVel(iDim, Grid_Vel[iDim]);
+ nodes->SetGridVel(Point_Coarse, iDim, Grid_Vel[iDim]);
}
}
@@ -1359,7 +1364,7 @@ void CMultiGridGeometry::FindNormal_Neighbor(CConfig *config) {
iPoint = vertex[iMarker][iVertex]->GetNode();
/*--- If the node belong to the domain ---*/
- if (node[iPoint]->GetDomain()) {
+ if (nodes->GetDomain(iPoint)) {
/*--- Compute closest normal neighbor ---*/
su2double cos_max, scalar_prod, norm_vect, norm_Normal, cos_alpha, diff_coord;
@@ -1367,11 +1372,11 @@ void CMultiGridGeometry::FindNormal_Neighbor(CConfig *config) {
unsigned short iNeigh;
su2double *Normal = vertex[iMarker][iVertex]->GetNormal();
cos_max = -1.0;
- for (iNeigh = 0; iNeigh < node[iPoint]->GetnPoint(); iNeigh++) {
- jPoint = node[iPoint]->GetPoint(iNeigh);
+ for (iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); iNeigh++) {
+ jPoint = nodes->GetPoint(iPoint, iNeigh);
scalar_prod = 0.0; norm_vect = 0.0; norm_Normal = 0.0;
for (iDim = 0; iDim < nDim; iDim++) {
- diff_coord = node[jPoint]->GetCoord(iDim)-node[iPoint]->GetCoord(iDim);
+ diff_coord = nodes->GetCoord(jPoint, iDim)-nodes->GetCoord(iPoint, iDim);
scalar_prod += diff_coord*Normal[iDim];
norm_vect += diff_coord*diff_coord;
norm_Normal += Normal[iDim]*Normal[iDim];
diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp
index adbca0834db4..ecacbd2a3ca6 100644
--- a/Common/src/geometry/CPhysicalGeometry.cpp
+++ b/Common/src/geometry/CPhysicalGeometry.cpp
@@ -29,6 +29,7 @@
#include "../../include/adt_structure.hpp"
#include "../../include/toolboxes/printing_toolbox.hpp"
#include "../../include/toolboxes/CLinearPartitioner.hpp"
+#include "../../include/toolboxes/geometry_toolbox.hpp"
#include "../../include/geometry/meshreader/CSU2ASCIIMeshReaderFVM.hpp"
#include "../../include/geometry/meshreader/CCGNSMeshReaderFVM.hpp"
#include "../../include/geometry/meshreader/CRectangularMeshReaderFVM.hpp"
@@ -48,6 +49,7 @@
#include
#include
#include
+#include
#ifdef _MSC_VER
#include
#endif
@@ -157,7 +159,6 @@ CPhysicalGeometry::CPhysicalGeometry(CConfig *config, unsigned short val_iZone,
ifstream mesh_file;
unsigned short iDim, iMarker, iNodes;
unsigned long iPoint, iElem_Bound;
- su2double *NewCoord;
nZone = val_nZone;
ofstream boundary_file;
string Grid_Marker;
@@ -206,21 +207,16 @@ CPhysicalGeometry::CPhysicalGeometry(CConfig *config, unsigned short val_iZone,
if (config->GetKind_SU2() == SU2_CFD) {
- NewCoord = new su2double [nDim];
-
/*--- The US system uses feet, but SU2 assumes that the grid is in inches ---*/
if (config->GetSystemMeasurements() == US) {
for (iPoint = 0; iPoint < nPoint; iPoint++) {
for (iDim = 0; iDim < nDim; iDim++) {
- NewCoord[iDim] = node[iPoint]->GetCoord(iDim)/12.0;
+ nodes->SetCoord(iPoint, iDim, nodes->GetCoord(iPoint, iDim)/12.0);
}
- node[iPoint]->SetCoord(NewCoord);
}
}
- delete [] NewCoord;
-
}
/*--- If SU2_DEF then write a file with the boundary information ---*/
@@ -682,7 +678,7 @@ CPhysicalGeometry::~CPhysicalGeometry(void) {
void CPhysicalGeometry::SetGlobal_to_Local_Point(void) {
Global_to_Local_Point.clear();
for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) {
- Global_to_Local_Point[node[iPoint]->GetGlobalIndex()] = iPoint;
+ Global_to_Local_Point[nodes->GetGlobalIndex(iPoint)] = iPoint;
}
}
@@ -732,7 +728,7 @@ void CPhysicalGeometry::DistributeColoring(CConfig *config,
unordered_map Global2Local;
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) {
- Global2Local[geometry->node[iPoint]->GetGlobalIndex()] = iPoint;
+ Global2Local[geometry->nodes->GetGlobalIndex(iPoint)] = iPoint;
}
/*--- Find extra points that carry an index higher than nPoint. ---*/
@@ -868,8 +864,8 @@ void CPhysicalGeometry::DistributeColoring(CConfig *config,
/*--- Load the data values. ---*/
- idSend[nn] = geometry->node[iPoint]->GetGlobalIndex();
- colorSend[nn] = geometry->node[iPoint]->GetColor();
+ idSend[nn] = geometry->nodes->GetGlobalIndex(iPoint);
+ colorSend[nn] = geometry->nodes->GetColor(iPoint);
/*--- Increment the index by the message length ---*/
@@ -1421,12 +1417,12 @@ void CPhysicalGeometry::DistributePoints(CConfig *config, CGeometry *geometry) {
/*--- Load the global ID, color, and coordinate values. ---*/
- idSend[nn] = geometry->node[iPoint]->GetGlobalIndex();
- colorSend[nn] = geometry->node[iPoint]->GetColor();
+ idSend[nn] = geometry->nodes->GetGlobalIndex(iPoint);
+ colorSend[nn] = geometry->nodes->GetColor(iPoint);
nn = coordIndex[iProcessor];
for (iDim = 0; iDim < nDim; iDim++) {
- coordSend[nn] = geometry->node[iPoint]->GetCoord(iDim); nn++;
+ coordSend[nn] = geometry->nodes->GetCoord(iPoint, iDim); nn++;
}
/*--- Increment the index by the message length ---*/
@@ -2345,7 +2341,7 @@ void CPhysicalGeometry::LoadPoints(CConfig *config, CGeometry *geometry) {
nPointDomain = nLocal_PointDomain;
nPointNode = nPoint;
- node = new CPoint*[nPoint];
+ nodes = new CPoint(nPoint, nDim, MESH_0, config);
Local_to_Global_Point = new long[nPoint];
@@ -2384,19 +2380,12 @@ void CPhysicalGeometry::LoadPoints(CConfig *config, CGeometry *geometry) {
/*--- Allocating the Point object ---*/
- if ( nDim == 2 )
- node[jPoint] = new CPoint(Local_Coords[iPoint*nDim+0],
- Local_Coords[iPoint*nDim+1],
- Local_to_Global_Point[jPoint], config);
- if ( nDim == 3 )
- node[jPoint] = new CPoint(Local_Coords[iPoint*nDim+0],
- Local_Coords[iPoint*nDim+1],
- Local_Coords[iPoint*nDim+2],
- Local_to_Global_Point[jPoint], config);
+ nodes->SetCoord(jPoint, &Local_Coords[iPoint*nDim]);
+ nodes->SetGlobalIndex(jPoint, Local_to_Global_Point[jPoint]);
/*--- Set the color ---*/
- node[jPoint]->SetColor(Local_Colors[iPoint]);
+ nodes->SetColor(jPoint, Local_Colors[iPoint]);
/*--- Increment the correct counter before moving to the next point. ---*/
@@ -3448,13 +3437,13 @@ void CPhysicalGeometry::SetSendReceive(CConfig *config) {
for (iNode = 0; iNode < elem[iElem]->GetnNodes(); iNode++) {
iPoint = elem[iElem]->GetNode(iNode);
- iDomain = node[iPoint]->GetColor();
+ iDomain = nodes->GetColor(iPoint);
if (iDomain == (unsigned long) rank) {
for (jNode = 0; jNode < elem[iElem]->GetnNodes(); jNode++) {
jPoint = elem[iElem]->GetNode(jNode);
- jDomain = node[jPoint]->GetColor();
+ jDomain = nodes->GetColor(jPoint);
/*--- If one of the neighbors is a different color and connected
by an edge, then we add them to the list. ---*/
@@ -3860,7 +3849,7 @@ void CPhysicalGeometry::SetBoundaries(CConfig *config) {
for (iElem_Bound = 0; iElem_Bound < nElem_Bound[iMarker]; iElem_Bound++) {
if (config->GetMarker_All_SendRecv(iMarker) < 0)
- node[bound[iMarker][iElem_Bound]->GetNode(0)]->SetDomain(false);
+ nodes->SetDomain(bound[iMarker][iElem_Bound]->GetNode(0), false);
}
}
@@ -3873,18 +3862,18 @@ void CPhysicalGeometry::SetBoundaries(CConfig *config) {
for (iElem_Surface = 0; iElem_Surface < nElem_Bound[iMarker]; iElem_Surface++) {
for (iNode_Surface = 0; iNode_Surface < bound[iMarker][iElem_Surface]->GetnNodes(); iNode_Surface++) {
Point_Surface = bound[iMarker][iElem_Surface]->GetNode(iNode_Surface);
- node[Point_Surface]->SetBoundary(nMarker);
+ nodes->SetBoundary(Point_Surface, nMarker);
if (config->GetMarker_All_KindBC(iMarker) != SEND_RECEIVE &&
config->GetMarker_All_KindBC(iMarker) != INTERFACE_BOUNDARY &&
config->GetMarker_All_KindBC(iMarker) != NEARFIELD_BOUNDARY &&
config->GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)
- node[Point_Surface]->SetPhysicalBoundary(true);
+ nodes->SetPhysicalBoundary(Point_Surface, true);
if (config->GetSolid_Wall(iMarker))
- node[Point_Surface]->SetSolidBoundary(true);
+ nodes->SetSolidBoundary(Point_Surface, true);
if (config->GetMarker_All_KindBC(iMarker) == PERIODIC_BOUNDARY)
- node[Point_Surface]->SetPeriodicBoundary(true);
+ nodes->SetPeriodicBoundary(Point_Surface, true);
}
}
@@ -3994,13 +3983,12 @@ void CPhysicalGeometry::LoadLinearlyPartitionedPoints(CConfig *config,
/*--- Get the linearly partitioned coordinates from the mesh object. ---*/
- const vector > &gridCoords =
- mesh->GetLocalPointCoordinates();
+ const auto& gridCoords = mesh->GetLocalPointCoordinates();
/*--- Initialize point counts and the grid node data structure. ---*/
nPointNode = nPoint;
- node = new CPoint*[nPoint];
+ nodes = new CPoint(nPoint, nDim);
/*--- Loop over the CGNS grid nodes and load into the SU2 data
structure. Note that since we have performed a linear partitioning
@@ -4010,23 +3998,10 @@ void CPhysicalGeometry::LoadLinearlyPartitionedPoints(CConfig *config,
CLinearPartitioner pointPartitioner(Global_nPointDomain,0);
unsigned long GlobalIndex = pointPartitioner.GetFirstIndexOnRank(rank);
for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) {
- switch(nDim) {
- case 2:
- node[iPoint] = new CPoint(gridCoords[0][iPoint],
- gridCoords[1][iPoint],
- GlobalIndex,
- config);
- GlobalIndex++;
- break;
- case 3:
- node[iPoint] = new CPoint(gridCoords[0][iPoint],
- gridCoords[1][iPoint],
- gridCoords[2][iPoint],
- GlobalIndex,
- config);
- GlobalIndex++;
- break;
- }
+ for (unsigned short iDim = 0; iDim < nDim; ++iDim)
+ nodes->SetCoord(iPoint, iDim, gridCoords[iDim][iPoint]);
+ nodes->SetGlobalIndex(iPoint, GlobalIndex);
+ ++GlobalIndex;
}
}
@@ -4596,9 +4571,9 @@ void CPhysicalGeometry::Check_IntElem_Orientation(CConfig *config) {
if (elem[iElem]->GetVTK_Type() == TRIANGLE) {
- Point_1 = elem[iElem]->GetNode(0); Coord_1 = node[Point_1]->GetCoord();
- Point_2 = elem[iElem]->GetNode(1); Coord_2 = node[Point_2]->GetCoord();
- Point_3 = elem[iElem]->GetNode(2); Coord_3 = node[Point_3]->GetCoord();
+ Point_1 = elem[iElem]->GetNode(0); Coord_1 = nodes->GetCoord(Point_1);
+ Point_2 = elem[iElem]->GetNode(1); Coord_2 = nodes->GetCoord(Point_2);
+ Point_3 = elem[iElem]->GetNode(2); Coord_3 = nodes->GetCoord(Point_3);
for (iDim = 0; iDim < nDim; iDim++) {
a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
@@ -4615,10 +4590,10 @@ void CPhysicalGeometry::Check_IntElem_Orientation(CConfig *config) {
if (elem[iElem]->GetVTK_Type() == QUADRILATERAL) {
- Point_1 = elem[iElem]->GetNode(0); Coord_1 = node[Point_1]->GetCoord();
- Point_2 = elem[iElem]->GetNode(1); Coord_2 = node[Point_2]->GetCoord();
- Point_3 = elem[iElem]->GetNode(2); Coord_3 = node[Point_3]->GetCoord();
- Point_4 = elem[iElem]->GetNode(3); Coord_4 = node[Point_4]->GetCoord();
+ Point_1 = elem[iElem]->GetNode(0); Coord_1 = nodes->GetCoord(Point_1);
+ Point_2 = elem[iElem]->GetNode(1); Coord_2 = nodes->GetCoord(Point_2);
+ Point_3 = elem[iElem]->GetNode(2); Coord_3 = nodes->GetCoord(Point_3);
+ Point_4 = elem[iElem]->GetNode(3); Coord_4 = nodes->GetCoord(Point_4);
for (iDim = 0; iDim < nDim; iDim++) {
a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
@@ -4650,10 +4625,10 @@ void CPhysicalGeometry::Check_IntElem_Orientation(CConfig *config) {
if (elem[iElem]->GetVTK_Type() == TETRAHEDRON) {
- Point_1 = elem[iElem]->GetNode(0); Coord_1 = node[Point_1]->GetCoord();
- Point_2 = elem[iElem]->GetNode(1); Coord_2 = node[Point_2]->GetCoord();
- Point_3 = elem[iElem]->GetNode(2); Coord_3 = node[Point_3]->GetCoord();
- Point_4 = elem[iElem]->GetNode(3); Coord_4 = node[Point_4]->GetCoord();
+ Point_1 = elem[iElem]->GetNode(0); Coord_1 = nodes->GetCoord(Point_1);
+ Point_2 = elem[iElem]->GetNode(1); Coord_2 = nodes->GetCoord(Point_2);
+ Point_3 = elem[iElem]->GetNode(2); Coord_3 = nodes->GetCoord(Point_3);
+ Point_4 = elem[iElem]->GetNode(3); Coord_4 = nodes->GetCoord(Point_4);
for (iDim = 0; iDim < nDim; iDim++) {
a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
@@ -4675,12 +4650,12 @@ void CPhysicalGeometry::Check_IntElem_Orientation(CConfig *config) {
if (elem[iElem]->GetVTK_Type() == PRISM) {
- Point_1 = elem[iElem]->GetNode(0); Coord_1 = node[Point_1]->GetCoord();
- Point_2 = elem[iElem]->GetNode(1); Coord_2 = node[Point_2]->GetCoord();
- Point_3 = elem[iElem]->GetNode(2); Coord_3 = node[Point_3]->GetCoord();
- Point_4 = elem[iElem]->GetNode(3); Coord_4 = node[Point_4]->GetCoord();
- Point_5 = elem[iElem]->GetNode(4); Coord_5 = node[Point_5]->GetCoord();
- Point_6 = elem[iElem]->GetNode(5); Coord_6 = node[Point_6]->GetCoord();
+ Point_1 = elem[iElem]->GetNode(0); Coord_1 = nodes->GetCoord(Point_1);
+ Point_2 = elem[iElem]->GetNode(1); Coord_2 = nodes->GetCoord(Point_2);
+ Point_3 = elem[iElem]->GetNode(2); Coord_3 = nodes->GetCoord(Point_3);
+ Point_4 = elem[iElem]->GetNode(3); Coord_4 = nodes->GetCoord(Point_4);
+ Point_5 = elem[iElem]->GetNode(4); Coord_5 = nodes->GetCoord(Point_5);
+ Point_6 = elem[iElem]->GetNode(5); Coord_6 = nodes->GetCoord(Point_6);
for (iDim = 0; iDim < nDim; iDim++) {
a[iDim] = 0.5*(Coord_3[iDim]-Coord_1[iDim]);
@@ -4721,10 +4696,10 @@ void CPhysicalGeometry::Check_IntElem_Orientation(CConfig *config) {
if (elem[iElem]->GetVTK_Type() == HEXAHEDRON) {
- Point_1 = elem[iElem]->GetNode(0); Coord_1 = node[Point_1]->GetCoord();
- Point_2 = elem[iElem]->GetNode(1); Coord_2 = node[Point_2]->GetCoord();
- Point_3 = elem[iElem]->GetNode(2); Coord_3 = node[Point_3]->GetCoord();
- Point_4 = elem[iElem]->GetNode(5); Coord_4 = node[Point_4]->GetCoord();
+ Point_1 = elem[iElem]->GetNode(0); Coord_1 = nodes->GetCoord(Point_1);
+ Point_2 = elem[iElem]->GetNode(1); Coord_2 = nodes->GetCoord(Point_2);
+ Point_3 = elem[iElem]->GetNode(2); Coord_3 = nodes->GetCoord(Point_3);
+ Point_4 = elem[iElem]->GetNode(5); Coord_4 = nodes->GetCoord(Point_4);
for (iDim = 0; iDim < nDim; iDim++) {
a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
@@ -4736,10 +4711,10 @@ void CPhysicalGeometry::Check_IntElem_Orientation(CConfig *config) {
test_1 = n[0]*c[0]+n[1]*c[1]+n[2]*c[2];
- Point_1 = elem[iElem]->GetNode(2); Coord_1 = node[Point_1]->GetCoord();
- Point_2 = elem[iElem]->GetNode(3); Coord_2 = node[Point_2]->GetCoord();
- Point_3 = elem[iElem]->GetNode(0); Coord_3 = node[Point_3]->GetCoord();
- Point_4 = elem[iElem]->GetNode(7); Coord_4 = node[Point_4]->GetCoord();
+ Point_1 = elem[iElem]->GetNode(2); Coord_1 = nodes->GetCoord(Point_1);
+ Point_2 = elem[iElem]->GetNode(3); Coord_2 = nodes->GetCoord(Point_2);
+ Point_3 = elem[iElem]->GetNode(0); Coord_3 = nodes->GetCoord(Point_3);
+ Point_4 = elem[iElem]->GetNode(7); Coord_4 = nodes->GetCoord(Point_4);
for (iDim = 0; iDim < nDim; iDim++) {
a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
@@ -4751,10 +4726,10 @@ void CPhysicalGeometry::Check_IntElem_Orientation(CConfig *config) {
test_2 = n[0]*c[0]+n[1]*c[1]+n[2]*c[2];
- Point_1 = elem[iElem]->GetNode(1); Coord_1 = node[Point_1]->GetCoord();
- Point_2 = elem[iElem]->GetNode(2); Coord_2 = node[Point_2]->GetCoord();
- Point_3 = elem[iElem]->GetNode(3); Coord_3 = node[Point_3]->GetCoord();
- Point_4 = elem[iElem]->GetNode(6); Coord_4 = node[Point_4]->GetCoord();
+ Point_1 = elem[iElem]->GetNode(1); Coord_1 = nodes->GetCoord(Point_1);
+ Point_2 = elem[iElem]->GetNode(2); Coord_2 = nodes->GetCoord(Point_2);
+ Point_3 = elem[iElem]->GetNode(3); Coord_3 = nodes->GetCoord(Point_3);
+ Point_4 = elem[iElem]->GetNode(6); Coord_4 = nodes->GetCoord(Point_4);
for (iDim = 0; iDim < nDim; iDim++) {
a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
@@ -4766,10 +4741,10 @@ void CPhysicalGeometry::Check_IntElem_Orientation(CConfig *config) {
test_3 = n[0]*c[0]+n[1]*c[1]+n[2]*c[2];
- Point_1 = elem[iElem]->GetNode(3); Coord_1 = node[Point_1]->GetCoord();
- Point_2 = elem[iElem]->GetNode(0); Coord_2 = node[Point_2]->GetCoord();
- Point_3 = elem[iElem]->GetNode(1); Coord_3 = node[Point_3]->GetCoord();
- Point_4 = elem[iElem]->GetNode(4); Coord_4 = node[Point_4]->GetCoord();
+ Point_1 = elem[iElem]->GetNode(3); Coord_1 = nodes->GetCoord(Point_1);
+ Point_2 = elem[iElem]->GetNode(0); Coord_2 = nodes->GetCoord(Point_2);
+ Point_3 = elem[iElem]->GetNode(1); Coord_3 = nodes->GetCoord(Point_3);
+ Point_4 = elem[iElem]->GetNode(4); Coord_4 = nodes->GetCoord(Point_4);
for (iDim = 0; iDim < nDim; iDim++) {
a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
@@ -4791,10 +4766,10 @@ void CPhysicalGeometry::Check_IntElem_Orientation(CConfig *config) {
if (elem[iElem]->GetVTK_Type() == PYRAMID) {
- Point_1 = elem[iElem]->GetNode(0); Coord_1 = node[Point_1]->GetCoord();
- Point_2 = elem[iElem]->GetNode(1); Coord_2 = node[Point_2]->GetCoord();
- Point_3 = elem[iElem]->GetNode(2); Coord_3 = node[Point_3]->GetCoord();
- Point_4 = elem[iElem]->GetNode(4); Coord_4 = node[Point_4]->GetCoord();
+ Point_1 = elem[iElem]->GetNode(0); Coord_1 = nodes->GetCoord(Point_1);
+ Point_2 = elem[iElem]->GetNode(1); Coord_2 = nodes->GetCoord(Point_2);
+ Point_3 = elem[iElem]->GetNode(2); Coord_3 = nodes->GetCoord(Point_3);
+ Point_4 = elem[iElem]->GetNode(4); Coord_4 = nodes->GetCoord(Point_4);
for (iDim = 0; iDim < nDim; iDim++) {
a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
@@ -4806,10 +4781,10 @@ void CPhysicalGeometry::Check_IntElem_Orientation(CConfig *config) {
test_1 = n[0]*c[0]+n[1]*c[1]+n[2]*c[2];
- Point_1 = elem[iElem]->GetNode(2); Coord_1 = node[Point_1]->GetCoord();
- Point_2 = elem[iElem]->GetNode(3); Coord_2 = node[Point_2]->GetCoord();
- Point_3 = elem[iElem]->GetNode(0); Coord_3 = node[Point_3]->GetCoord();
- Point_4 = elem[iElem]->GetNode(4); Coord_4 = node[Point_4]->GetCoord();
+ Point_1 = elem[iElem]->GetNode(2); Coord_1 = nodes->GetCoord(Point_1);
+ Point_2 = elem[iElem]->GetNode(3); Coord_2 = nodes->GetCoord(Point_2);
+ Point_3 = elem[iElem]->GetNode(0); Coord_3 = nodes->GetCoord(Point_3);
+ Point_4 = elem[iElem]->GetNode(4); Coord_4 = nodes->GetCoord(Point_4);
for (iDim = 0; iDim < nDim; iDim++) {
a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
@@ -4888,9 +4863,9 @@ void CPhysicalGeometry::Check_BoundElem_Orientation(CConfig *config) {
if (bound[iMarker][iElem_Surface]->GetVTK_Type() == LINE) {
- Point_1_Surface = bound[iMarker][iElem_Surface]->GetNode(0); Coord_1 = node[Point_1_Surface]->GetCoord();
- Point_2_Surface = bound[iMarker][iElem_Surface]->GetNode(1); Coord_2 = node[Point_2_Surface]->GetCoord();
- Coord_3 = node[Point_Domain]->GetCoord();
+ Point_1_Surface = bound[iMarker][iElem_Surface]->GetNode(0); Coord_1 = nodes->GetCoord(Point_1_Surface);
+ Point_2_Surface = bound[iMarker][iElem_Surface]->GetNode(1); Coord_2 = nodes->GetCoord(Point_2_Surface);
+ Coord_3 = nodes->GetCoord(Point_Domain);
for (iDim = 0; iDim < nDim; iDim++) {
a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
@@ -4900,8 +4875,6 @@ void CPhysicalGeometry::Check_BoundElem_Orientation(CConfig *config) {
if (test < 0.0) {
bound[iMarker][iElem_Surface]->Change_Orientation();
- node[Point_1_Surface]->SetFlip_Orientation();
- node[Point_2_Surface]->SetFlip_Orientation();
line_flip++;
}
@@ -4911,10 +4884,10 @@ void CPhysicalGeometry::Check_BoundElem_Orientation(CConfig *config) {
if (bound[iMarker][iElem_Surface]->GetVTK_Type() == TRIANGLE) {
- Point_1_Surface = bound[iMarker][iElem_Surface]->GetNode(0); Coord_1 = node[Point_1_Surface]->GetCoord();
- Point_2_Surface = bound[iMarker][iElem_Surface]->GetNode(1); Coord_2 = node[Point_2_Surface]->GetCoord();
- Point_3_Surface = bound[iMarker][iElem_Surface]->GetNode(2); Coord_3 = node[Point_3_Surface]->GetCoord();
- Coord_4 = node[Point_Domain]->GetCoord();
+ Point_1_Surface = bound[iMarker][iElem_Surface]->GetNode(0); Coord_1 = nodes->GetCoord(Point_1_Surface);
+ Point_2_Surface = bound[iMarker][iElem_Surface]->GetNode(1); Coord_2 = nodes->GetCoord(Point_2_Surface);
+ Point_3_Surface = bound[iMarker][iElem_Surface]->GetNode(2); Coord_3 = nodes->GetCoord(Point_3_Surface);
+ Coord_4 = nodes->GetCoord(Point_Domain);
for (iDim = 0; iDim < nDim; iDim++) {
a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
@@ -4928,9 +4901,6 @@ void CPhysicalGeometry::Check_BoundElem_Orientation(CConfig *config) {
test = n[0]*c[0]+n[1]*c[1]+n[2]*c[2];
if (test < 0.0) {
bound[iMarker][iElem_Surface]->Change_Orientation();
- node[Point_1_Surface]->SetFlip_Orientation();
- node[Point_2_Surface]->SetFlip_Orientation();
- node[Point_3_Surface]->SetFlip_Orientation();
triangle_flip++;
}
@@ -4940,11 +4910,11 @@ void CPhysicalGeometry::Check_BoundElem_Orientation(CConfig *config) {
if (bound[iMarker][iElem_Surface]->GetVTK_Type() == QUADRILATERAL) {
- Point_1_Surface = bound[iMarker][iElem_Surface]->GetNode(0); Coord_1 = node[Point_1_Surface]->GetCoord();
- Point_2_Surface = bound[iMarker][iElem_Surface]->GetNode(1); Coord_2 = node[Point_2_Surface]->GetCoord();
- Point_3_Surface = bound[iMarker][iElem_Surface]->GetNode(2); Coord_3 = node[Point_3_Surface]->GetCoord();
- Point_4_Surface = bound[iMarker][iElem_Surface]->GetNode(3); Coord_4 = node[Point_4_Surface]->GetCoord();
- Coord_5 = node[Point_Domain]->GetCoord();
+ Point_1_Surface = bound[iMarker][iElem_Surface]->GetNode(0); Coord_1 = nodes->GetCoord(Point_1_Surface);
+ Point_2_Surface = bound[iMarker][iElem_Surface]->GetNode(1); Coord_2 = nodes->GetCoord(Point_2_Surface);
+ Point_3_Surface = bound[iMarker][iElem_Surface]->GetNode(2); Coord_3 = nodes->GetCoord(Point_3_Surface);
+ Point_4_Surface = bound[iMarker][iElem_Surface]->GetNode(3); Coord_4 = nodes->GetCoord(Point_4_Surface);
+ Coord_5 = nodes->GetCoord(Point_Domain);
for (iDim = 0; iDim < nDim; iDim++) {
a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
@@ -4988,10 +4958,6 @@ void CPhysicalGeometry::Check_BoundElem_Orientation(CConfig *config) {
if ((test_1 < 0.0) && (test_2 < 0.0) && (test_3 < 0.0) && (test_4 < 0.0)) {
bound[iMarker][iElem_Surface]->Change_Orientation();
- node[Point_1_Surface]->SetFlip_Orientation();
- node[Point_2_Surface]->SetFlip_Orientation();
- node[Point_3_Surface]->SetFlip_Orientation();
- node[Point_4_Surface]->SetFlip_Orientation();
quad_flip++;
}
@@ -5047,13 +5013,13 @@ void CPhysicalGeometry::SetPositive_ZArea(CConfig *config) {
for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) {
iPoint = vertex[iMarker][iVertex]->GetNode();
- if (node[iPoint]->GetDomain()) {
+ if (nodes->GetDomain(iPoint)) {
Normal = vertex[iMarker][iVertex]->GetNormal();
- CoordX = node[iPoint]->GetCoord(0);
- CoordY = node[iPoint]->GetCoord(1);
- if (nDim == 3) CoordZ = node[iPoint]->GetCoord(2);
+ CoordX = nodes->GetCoord(iPoint, 0);
+ CoordY = nodes->GetCoord(iPoint, 1);
+ if (nDim == 3) CoordZ = nodes->GetCoord(iPoint, 2);
- if (axisymmetric) AxiFactor = 2.0*PI_NUMBER*node[iPoint]->GetCoord(1);
+ if (axisymmetric) AxiFactor = 2.0*PI_NUMBER*nodes->GetCoord(iPoint, 1);
else AxiFactor = 1.0;
if (nDim == 2) WettedArea += AxiFactor * sqrt (Normal[0]*Normal[0] + Normal[1]*Normal[1]);
@@ -5079,7 +5045,6 @@ void CPhysicalGeometry::SetPositive_ZArea(CConfig *config) {
}
-#ifdef HAVE_MPI
SU2_MPI::Allreduce(&PositiveXArea, &TotalPositiveXArea, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
SU2_MPI::Allreduce(&PositiveYArea, &TotalPositiveYArea, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
SU2_MPI::Allreduce(&PositiveZArea, &TotalPositiveZArea, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
@@ -5093,21 +5058,6 @@ void CPhysicalGeometry::SetPositive_ZArea(CConfig *config) {
SU2_MPI::Allreduce(&MaxCoordZ, &TotalMaxCoordZ, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
SU2_MPI::Allreduce(&WettedArea, &TotalWettedArea, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
-#else
- TotalPositiveXArea = PositiveXArea;
- TotalPositiveYArea = PositiveYArea;
- TotalPositiveZArea = PositiveZArea;
-
- TotalMinCoordX = MinCoordX;
- TotalMinCoordY = MinCoordY;
- TotalMinCoordZ = MinCoordZ;
-
- TotalMaxCoordX = MaxCoordX;
- TotalMaxCoordY = MaxCoordY;
- TotalMaxCoordZ = MaxCoordZ;
-
- TotalWettedArea = WettedArea;
-#endif
/*--- Set a reference area if no value is provided ---*/
@@ -5190,77 +5140,86 @@ void CPhysicalGeometry::SetPositive_ZArea(CConfig *config) {
}
-void CPhysicalGeometry::SetPoint_Connectivity(void) {
+void CPhysicalGeometry::SetPoint_Connectivity() {
+
+ vector > points(nPoint);
+ SU2_OMP_PARALLEL
+ {
unsigned short Node_Neighbor, iNode, iNeighbor;
unsigned long jElem, Point_Neighbor, iPoint, iElem;
/*--- Loop over all the elements ---*/
+ SU2_OMP_MASTER
+ {
+ vector > elems(nPoint);
- for (iElem = 0; iElem < nElem; iElem++)
-
- /*--- Loop over all the nodes of an element ---*/
-
- for (iNode = 0; iNode < elem[iElem]->GetnNodes(); iNode++) {
- iPoint = elem[iElem]->GetNode(iNode);
-
- /*--- Store the element into the point ---*/
+ for (iElem = 0; iElem < nElem; iElem++) {
- node[iPoint]->SetElem(iElem);
+ /*--- Loop over all the nodes of an element ---*/
+ for (iNode = 0; iNode < elem[iElem]->GetnNodes(); iNode++) {
+ iPoint = elem[iElem]->GetNode(iNode);
+ elems[iPoint].push_back(iElem);
+ }
}
+ nodes->SetElems(elems);
+ }
+ SU2_OMP_BARRIER
/*--- Loop over all the points ---*/
- for (iPoint = 0; iPoint < nPoint; iPoint++)
+ SU2_OMP_FOR_DYN(roundUpDiv(nPoint,2*omp_get_max_threads()))
+ for (iPoint = 0; iPoint < nPoint; iPoint++) {
- /*--- Loop over all elements shared by the point ---*/
+ /*--- Loop over all elements shared by the point ---*/
- for (iElem = 0; iElem < node[iPoint]->GetnElem(); iElem++) {
+ for (iElem = 0; iElem < nodes->GetnElem(iPoint); iElem++) {
- jElem = node[iPoint]->GetElem(iElem);
+ jElem = nodes->GetElem(iPoint, iElem);
/*--- If we find the point iPoint in the surronding element ---*/
- for (iNode = 0; iNode < elem[jElem]->GetnNodes(); iNode++)
+ for (iNode = 0; iNode < elem[jElem]->GetnNodes(); iNode++) {
- if (elem[jElem]->GetNode(iNode) == iPoint)
+ if (elem[jElem]->GetNode(iNode) != iPoint) continue;
/*--- Localize the local index of the neighbor of iPoint in the element ---*/
- for (iNeighbor = 0; iNeighbor < elem[jElem]->GetnNeighbor_Nodes(iNode); iNeighbor++) {
- Node_Neighbor = elem[jElem]->GetNeighbor_Nodes(iNode, iNeighbor);
- Point_Neighbor = elem[jElem]->GetNode(Node_Neighbor);
-
- /*--- Store the point into the point ---*/
+ for (iNeighbor = 0; iNeighbor < elem[jElem]->GetnNeighbor_Nodes(iNode); iNeighbor++) {
+ Node_Neighbor = elem[jElem]->GetNeighbor_Nodes(iNode, iNeighbor);
+ Point_Neighbor = elem[jElem]->GetNode(Node_Neighbor);
- node[iPoint]->SetPoint(Point_Neighbor);
- }
+ /*--- Store the point into the point, if it is new ---*/
+ auto End = points[iPoint].end();
+ if (find(points[iPoint].begin(), End, Point_Neighbor) == End)
+ points[iPoint].push_back(Point_Neighbor);
+ }
+ }
}
- /*--- Set the number of neighbors variable, this is
- important for JST and multigrid in parallel ---*/
+ /*--- Set the number of neighbors variable, this is important for JST and multigrid in parallel. ---*/
+ nodes->SetnNeighbor(iPoint, points[iPoint].size());
+ }
- for (iPoint = 0; iPoint < nPoint; iPoint++)
- node[iPoint]->SetnNeighbor(node[iPoint]->GetnPoint());
+ SU2_OMP_MASTER
+ nodes->SetPoints(points);
+ } // end SU2_OMP_PARALLEL
}
void CPhysicalGeometry::SetRCM_Ordering(CConfig *config) {
- unsigned long iPoint, AdjPoint, AuxPoint, AddPoint, iElem, iNode, jNode;
- vector Queue, AuxQueue, Result;
- unsigned short Degree, MinDegree, iDim, iMarker;
- bool *inQueue;
-
- inQueue = new bool [nPoint];
- for (iPoint = 0; iPoint < nPoint; iPoint++)
- inQueue[iPoint] = false;
+ queue Queue;
+ vector inQueue(nPoint, false);
+ vector AuxQueue, Result;
+ Result.reserve(nPoint);
/*--- Select the node with the lowest degree in the grid. ---*/
- MinDegree = node[0]->GetnNeighbor(); AddPoint = 0;
- for (iPoint = 1; iPoint < nPointDomain; iPoint++) {
- Degree = node[iPoint]->GetnPoint();
+ unsigned long AddPoint = 0;
+ auto MinDegree = nodes->GetnPoint(AddPoint);
+ for (auto iPoint = 1ul; iPoint < nPointDomain; iPoint++) {
+ auto Degree = nodes->GetnPoint(iPoint);
if (Degree < MinDegree) { MinDegree = Degree; AddPoint = iPoint; }
}
@@ -5277,30 +5236,26 @@ void CPhysicalGeometry::SetRCM_Ordering(CConfig *config) {
in the Queue. ---*/
AuxQueue.clear();
- for (iNode = 0; iNode < node[AddPoint]->GetnPoint(); iNode++) {
- AdjPoint = node[AddPoint]->GetPoint(iNode);
+ for (auto iNode = 0u; iNode < nodes->GetnPoint(AddPoint); iNode++) {
+ auto AdjPoint = nodes->GetPoint(AddPoint, iNode);
if ((!inQueue[AdjPoint]) && (AdjPoint < nPointDomain)) {
AuxQueue.push_back(AdjPoint);
}
}
- if (AuxQueue.size() != 0) {
+ if (!AuxQueue.empty()) {
/*--- Sort the auxiliar queue based on the number of neighbors ---*/
- for (iNode = 0; iNode < AuxQueue.size(); iNode++) {
- for (jNode = 0; jNode < AuxQueue.size() - 1 - iNode; jNode++) {
- if (node[AuxQueue[jNode]]->GetnPoint() > node[AuxQueue[jNode+1]]->GetnPoint()) {
- AuxPoint = AuxQueue[jNode];
- AuxQueue[jNode] = AuxQueue[jNode+1];
- AuxQueue[jNode+1] = AuxPoint;
- }
+ stable_sort(AuxQueue.begin(), AuxQueue.end(),
+ [&](unsigned long iPoint, unsigned long jPoint) {
+ return nodes->GetnPoint(iPoint) < nodes->GetnPoint(jPoint);
}
- }
+ );
- Queue.insert(Queue.end(), AuxQueue.begin(), AuxQueue.end());
- for (iNode = 0; iNode < AuxQueue.size(); iNode++) {
- inQueue[AuxQueue[iNode]] = true;
+ for (auto iPoint : AuxQueue) {
+ Queue.push(iPoint);
+ inQueue[iPoint] = true;
}
}
@@ -5308,122 +5263,100 @@ void CPhysicalGeometry::SetRCM_Ordering(CConfig *config) {
/*--- Extract the first node from the queue and add it in the first free
position. ---*/
- if (Queue.size() != 0) {
- AddPoint = Queue[0];
- Result.push_back(Queue[0]);
- Queue.erase (Queue.begin(), Queue.begin()+1);
+ if (!Queue.empty()) {
+ AddPoint = Queue.front();
+ Result.push_back(AddPoint);
+ Queue.pop();
}
- /*--- Add to the queue all the nodes adjacent in the increasing
- order of their degree, checking if the element is already
- in the Queue. ---*/
-
- } while (Queue.size() != 0);
+ } while (!Queue.empty());
/*--- Check that all the points have been added ---*/
- for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
+ for (auto iPoint = 0ul; iPoint < nPointDomain; iPoint++) {
if (inQueue[iPoint] == false) Result.push_back(iPoint);
}
- delete[] inQueue;
-
reverse(Result.begin(), Result.end());
/*--- Add the MPI points ---*/
- for (iPoint = nPointDomain; iPoint < nPoint; iPoint++) {
+ for (auto iPoint = nPointDomain; iPoint < nPoint; iPoint++) {
Result.push_back(iPoint);
}
/*--- Reset old data structures ---*/
- for (iPoint = 0; iPoint < nPoint; iPoint++) {
- node[iPoint]->ResetElem();
- node[iPoint]->ResetPoint();
- node[iPoint]->ResetBoundary();
- node[iPoint]->SetPhysicalBoundary(false);
- node[iPoint]->SetSolidBoundary(false);
- node[iPoint]->SetPeriodicBoundary(false);
- node[iPoint]->SetDomain(true);
+ nodes->ResetElems();
+ nodes->ResetPoints();
+
+ for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) {
+ nodes->ResetBoundary(iPoint);
+ nodes->SetPhysicalBoundary(iPoint, false);
+ nodes->SetSolidBoundary(iPoint, false);
+ nodes->SetPeriodicBoundary(iPoint, false);
+ nodes->SetDomain(iPoint, true);
}
/*--- Set the new coordinates ---*/
- su2double **AuxCoord;
- unsigned long *AuxGlobalIndex;
-
- AuxGlobalIndex = new unsigned long [nPoint];
- AuxCoord = new su2double* [nPoint];
- for (iPoint = 0; iPoint < nPoint; iPoint++)
- AuxCoord[iPoint] = new su2double [nDim];
+ su2activematrix AuxCoord(nPoint, nDim);
+ vector AuxGlobalIndex(nPoint);
- for (iPoint = 0; iPoint < nPoint; iPoint++) {
- AuxGlobalIndex[iPoint] = node[iPoint]->GetGlobalIndex();
- for (iDim = 0; iDim < nDim; iDim++) {
- AuxCoord[iPoint][iDim] = node[iPoint]->GetCoord(iDim);
+ for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) {
+ AuxGlobalIndex[iPoint] = nodes->GetGlobalIndex(iPoint);
+ for (auto iDim = 0u; iDim < nDim; iDim++) {
+ AuxCoord(iPoint,iDim) = nodes->GetCoord(iPoint, iDim);
}
}
- for (iPoint = 0; iPoint < nPoint; iPoint++) {
- node[iPoint]->SetGlobalIndex(AuxGlobalIndex[Result[iPoint]]);
- for (iDim = 0; iDim < nDim; iDim++)
- node[iPoint]->SetCoord(iDim, AuxCoord[Result[iPoint]][iDim]);
+ for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) {
+ nodes->SetGlobalIndex(iPoint, AuxGlobalIndex[Result[iPoint]]);
+ nodes->SetCoord(iPoint, AuxCoord[Result[iPoint]]);
}
- for (iPoint = 0; iPoint < nPoint; iPoint++)
- delete[] AuxCoord[iPoint];
- delete[] AuxCoord;
- delete[] AuxGlobalIndex;
-
/*--- Set the new conectivities ---*/
- unsigned long *InvResult;
- InvResult = new unsigned long [nPoint];
- for (iPoint = 0; iPoint < nPoint; iPoint++)
+ auto& InvResult = AuxGlobalIndex; // alias to re-use storage
+ for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) {
InvResult[Result[iPoint]] = iPoint;
+ }
- for (iElem = 0; iElem < nElem; iElem++) {
- for (iNode = 0; iNode < elem[iElem]->GetnNodes(); iNode++) {
- iPoint = elem[iElem]->GetNode(iNode);
+ for (auto iElem = 0ul; iElem < nElem; iElem++) {
+ for (auto iNode = 0u; iNode < elem[iElem]->GetnNodes(); iNode++) {
+ auto iPoint = elem[iElem]->GetNode(iNode);
elem[iElem]->SetNode(iNode, InvResult[iPoint]);
}
}
- for (iMarker = 0; iMarker < nMarker; iMarker++) {
- for (iElem = 0; iElem < nElem_Bound[iMarker]; iElem++) {
+ for (auto iMarker = 0u; iMarker < nMarker; iMarker++) {
+ for (auto iElem = 0ul; iElem < nElem_Bound[iMarker]; iElem++) {
- string Marker_Tag = config->GetMarker_All_TagBound(iMarker);
- if (Marker_Tag == "SEND_RECEIVE") {
- for (unsigned long iElem_Bound = 0; iElem_Bound < nElem_Bound[iMarker]; iElem_Bound++) {
- if (config->GetMarker_All_SendRecv(iMarker) < 0)
- node[bound[iMarker][iElem_Bound]->GetNode(0)]->SetDomain(false);
- }
+ if (config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE &&
+ config->GetMarker_All_SendRecv(iMarker) < 0) {
+ nodes->SetDomain(bound[iMarker][iElem]->GetNode(0), false);
}
- for (iNode = 0; iNode < bound[iMarker][iElem]->GetnNodes(); iNode++) {
- iPoint = bound[iMarker][iElem]->GetNode(iNode);
+ for (auto iNode = 0u; iNode < bound[iMarker][iElem]->GetnNodes(); iNode++) {
+ auto iPoint = bound[iMarker][iElem]->GetNode(iNode);
bound[iMarker][iElem]->SetNode(iNode, InvResult[iPoint]);
- node[InvResult[iPoint]]->SetBoundary(nMarker);
+ nodes->SetBoundary(InvResult[iPoint], nMarker);
if (config->GetMarker_All_KindBC(iMarker) != SEND_RECEIVE &&
config->GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY &&
config->GetMarker_All_KindBC(iMarker) != INTERFACE_BOUNDARY &&
config->GetMarker_All_KindBC(iMarker) != NEARFIELD_BOUNDARY &&
config->GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)
- node[InvResult[iPoint]]->SetPhysicalBoundary(true);
+ nodes->SetPhysicalBoundary(InvResult[iPoint], true);
if (config->GetSolid_Wall(iMarker))
- node[InvResult[iPoint]]->SetSolidBoundary(true);
+ nodes->SetSolidBoundary(InvResult[iPoint], true);
if (config->GetMarker_All_KindBC(iMarker) == PERIODIC_BOUNDARY)
- node[InvResult[iPoint]]->SetPeriodicBoundary(true);
+ nodes->SetPeriodicBoundary(InvResult[iPoint], true);
}
}
}
-
- delete[] InvResult;
-
}
void CPhysicalGeometry::SetElement_Connectivity(void) {
@@ -5439,8 +5372,8 @@ void CPhysicalGeometry::SetElement_Connectivity(void) {
/*--- Loop over all elements sharing the face point ---*/
- for (jElem = 0; jElem < node[face_point]->GetnElem(); jElem++) {
- Test_Elem = node[face_point]->GetElem(jElem);
+ for (jElem = 0; jElem < nodes->GetnElem(face_point); jElem++) {
+ Test_Elem = nodes->GetElem(face_point, jElem);
/*--- If it is a new element in this face ---*/
@@ -5472,9 +5405,9 @@ void CPhysicalGeometry::SetBoundVolume(void) {
Point = bound[iMarker][iElem_Surface]->GetNode(0);
CheckVol = false;
- for (iElem = 0; iElem < node[Point]->GetnElem(); iElem++) {
+ for (iElem = 0; iElem < nodes->GetnElem(Point); iElem++) {
/*--- Look for elements surronding that point --*/
- cont = 0; iElem_Domain = node[Point]->GetElem(iElem);
+ cont = 0; iElem_Domain = nodes->GetElem(Point, iElem);
for (iNode_Domain = 0; iNode_Domain < elem[iElem_Domain]->GetnNodes(); iNode_Domain++) {
Point_Domain = elem[iElem_Domain]->GetNode(iNode_Domain);
for (iNode_Surface = 0; iNode_Surface < bound[iMarker][iElem_Surface]->GetnNodes(); iNode_Surface++) {
@@ -5507,7 +5440,7 @@ void CPhysicalGeometry::SetVertex(CConfig *config) {
for (iPoint = 0; iPoint < nPoint; iPoint++)
for (iMarker = 0; iMarker < nMarker; iMarker++)
- node[iPoint]->SetVertex(-1, iMarker);
+ nodes->SetVertex(iPoint, -1, iMarker);
/*--- Create and compute the vector with the number of vertex per marker ---*/
@@ -5523,8 +5456,8 @@ void CPhysicalGeometry::SetVertex(CConfig *config) {
/*--- Set the vertex in the node information ---*/
- if ((node[iPoint]->GetVertex(iMarker) == -1) || (config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE)) {
- node[iPoint]->SetVertex(nVertex[iMarker], iMarker);
+ if ((nodes->GetVertex(iPoint, iMarker) == -1) || (config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE)) {
+ nodes->SetVertex(iPoint, nVertex[iMarker], iMarker);
nVertex[iMarker]++;
}
}
@@ -5534,7 +5467,7 @@ void CPhysicalGeometry::SetVertex(CConfig *config) {
for (iPoint = 0; iPoint < nPoint; iPoint++)
for (iMarker = 0; iMarker < nMarker; iMarker++)
- node[iPoint]->SetVertex(-1, iMarker);
+ nodes->SetVertex(iPoint, -1, iMarker);
/*--- Create the bound vertex structure, note that the order
is the same as in the input file, this is important for Send/Receive part ---*/
@@ -5552,14 +5485,14 @@ void CPhysicalGeometry::SetVertex(CConfig *config) {
/*--- Set the vertex in the node information ---*/
- if ((node[iPoint]->GetVertex(iMarker) == -1) || (config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE)) {
+ if ((nodes->GetVertex(iPoint, iMarker) == -1) || (config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE)) {
iVertex = nVertex[iMarker];
vertex[iMarker][iVertex] = new CVertex(iPoint, nDim);
if (config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) {
vertex[iMarker][iVertex]->SetRotation_Type(bound[iMarker][iElem]->GetRotation_Type());
}
- node[iPoint]->SetVertex(nVertex[iMarker], iMarker);
+ nodes->SetVertex(iPoint, nVertex[iMarker], iMarker);
nVertex[iMarker]++;
}
}
@@ -5610,7 +5543,7 @@ void CPhysicalGeometry::ComputeNSpan(CConfig *config, unsigned short val_iZone,
for (jMarker = 0; jMarker < nMarker; jMarker++){
if (config->GetMarker_All_KindBC(jMarker) == PERIODIC_BOUNDARY) {
PeriodicBoundary = config->GetMarker_All_PerBound(jMarker);
- jVertex = node[iPoint]->GetVertex(jMarker);
+ jVertex = nodes->GetVertex(iPoint, jMarker);
if ((jVertex != -1) && (PeriodicBoundary == (val_iZone + 1))){
nSpan++;
}
@@ -5653,9 +5586,9 @@ void CPhysicalGeometry::ComputeNSpan(CConfig *config, unsigned short val_iZone,
for (jMarker = 0; jMarker < nMarker; jMarker++){
if (config->GetMarker_All_KindBC(jMarker) == PERIODIC_BOUNDARY) {
PeriodicBoundary = config->GetMarker_All_PerBound(jMarker);
- jVertex = node[iPoint]->GetVertex(jMarker);
+ jVertex = nodes->GetVertex(iPoint, jMarker);
if ((jVertex != -1) && (PeriodicBoundary == (val_iZone + 1))){
- coord = node[iPoint]->GetCoord();
+ coord = nodes->GetCoord(iPoint);
switch (config->GetKind_TurboMachinery(val_iZone)){
case CENTRIFUGAL:
valueSpan[nSpan_loc] = coord[2];
@@ -5786,9 +5719,9 @@ void CPhysicalGeometry::ComputeNSpan(CConfig *config, unsigned short val_iZone,
for (jMarker = 0; jMarker < nMarker; jMarker++){
if (config->GetMarker_All_KindBC(jMarker) == PERIODIC_BOUNDARY) {
PeriodicBoundary = config->GetMarker_All_PerBound(jMarker);
- jVertex = node[iPoint]->GetVertex(jMarker);
+ jVertex = nodes->GetVertex(iPoint, jMarker);
if ((jVertex != -1) && (PeriodicBoundary == (val_iZone + 1))){
- coord = node[iPoint]->GetCoord();
+ coord = nodes->GetCoord(iPoint);
switch (config->GetKind_TurboMachinery(val_iZone)){
case CENTRIFUGAL: case CENTRIPETAL:
if (coord[2] < min) min = coord[2];
@@ -5965,7 +5898,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig *config, unsigned short val_iZone
if (nDim == 3){
dist = 10E+06;
jSpan = -1;
- coord = node[iPoint]->GetCoord();
+ coord = nodes->GetCoord(iPoint);
switch (config->GetKind_TurboMachinery(val_iZone)){
case CENTRIFUGAL: case CENTRIPETAL:
@@ -6032,7 +5965,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig *config, unsigned short val_iZone
jSpan = 0;
}
- if(node[iPoint]->GetDomain()){
+ if(nodes->GetDomain(iPoint)){
nVertexSpan[iMarker][jSpan]++;
}
nVertexSpanHalo[jSpan]++;
@@ -6067,7 +6000,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig *config, unsigned short val_iZone
dist = 10E+06;
jSpan = -1;
- coord = node[iPoint]->GetCoord();
+ coord = nodes->GetCoord(iPoint);
switch (config->GetKind_TurboMachinery(val_iZone)){
case CENTRIFUGAL: case CENTRIPETAL:
for(iSpan = 0; iSpan < nSpanWiseSections[marker_flag-1]; iSpan++){
@@ -6158,7 +6091,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig *config, unsigned short val_iZone
max = -10E+06;
for(iSpanVertex = 0; iSpanVertex < nVertexSpanHalo[iSpan]; iSpanVertex++){
iPoint = disordered[iSpan][iSpanVertex];
- coord = node[iPoint]->GetCoord();
+ coord = nodes->GetCoord(iPoint);
/*--- find nodes at minimum pitch among all nodes---*/
if (coord[1]GetDomain()){
+ if(nodes->GetDomain(iPoint)){
minInt = coord[1];
if (nDim == 2 && config->GetKind_TurboMachinery(val_iZone) == AXIAL){
minIntAngPitch[iSpan] = coord[1];
@@ -6187,7 +6120,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig *config, unsigned short val_iZone
/*--- find nodes at maximum pitch among the internal nodes---*/
if (coord[1]>max){
- if(node[iPoint]->GetDomain()){
+ if(nodes->GetDomain(iPoint)){
max =coord[1];
if (nDim == 2 && config->GetKind_TurboMachinery(val_iZone) == AXIAL){
MaxAngularCoord[iMarker][iSpan] = coord[1];
@@ -6207,7 +6140,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig *config, unsigned short val_iZone
dist = 10E+06;
ordered[iSpan][iSpanVertex] = disordered[iSpan][kSpanVertex];
checkAssign[iSpan][kSpanVertex] = true;
- coord = node[ordered[iSpan][iSpanVertex]]->GetCoord();
+ coord = nodes->GetCoord(ordered[iSpan][iSpanVertex]);
target = coord[1];
if (nDim == 2 && config->GetKind_TurboMachinery(val_iZone) == AXIAL){
angPitch[iSpan][iSpanVertex]=coord[1];
@@ -6222,7 +6155,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig *config, unsigned short val_iZone
deltaAngPitch[iSpan][iSpanVertex]= angPitch[iSpan][iSpanVertex] - angPitch[iSpan][iSpanVertex - 1];
}
/*---create turbovertex structure only for the internal nodes---*/
- if(node[ordered[iSpan][iSpanVertex]]->GetDomain()){
+ if(nodes->GetDomain(ordered[iSpan][iSpanVertex])){
if (allocate){
turbovertex[iMarker][iSpan][iInternalVertex] = new CTurboVertex(ordered[iSpan][iSpanVertex], nDim);
}
@@ -6320,7 +6253,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig *config, unsigned short val_iZone
for(jSpanVertex = 0; jSpanVertexGetCoord();
+ coord = nodes->GetCoord(disordered[iSpan][jSpanVertex]);
if(dist >= (coord[1] - target) && !checkAssign[iSpan][jSpanVertex] && (coord[1] - target) >= 0.0){
dist= coord[1] - target;
kSpanVertex =jSpanVertex;
@@ -6438,7 +6371,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig *config, unsigned short val_iZone
for(iSpan = 0; iSpan < nSpanWiseSections[marker_flag-1]; iSpan++){
for(iSpanVertex = 0; iSpanVertexGetNode();
- coord = node[iPoint]->GetCoord();
+ coord = nodes->GetCoord(iPoint);
x_loc[iSpan][iSpanVertex] = coord[0];
y_loc[iSpan][iSpanVertex] = coord[1];
if (nDim == 3){
@@ -6652,7 +6585,7 @@ void CPhysicalGeometry::UpdateTurboVertex(CConfig *config, unsigned short val_iZ
for(iSpan = 0; iSpan < nSpanWiseSections[marker_flag-1]; iSpan++){
for(iSpanVertex = 0; iSpanVertexGetNode();
- coord = node[iPoint]->GetCoord();
+ coord = nodes->GetCoord(iPoint);
/*--- compute appropriate turbo normal ---*/
switch (config->GetKind_TurboMachinery(val_iZone)){
case CENTRIFUGAL:
@@ -6822,7 +6755,7 @@ void CPhysicalGeometry::SetAvgTurboValue(CConfig *config, unsigned short val_iZo
iPoint = turbovertex[iMarker][iSpan][iVertex]->GetNode();
turbovertex[iMarker][iSpan][iVertex]->GetTurboNormal(TurboNormal);
turbovertex[iMarker][iSpan][iVertex]->GetNormal(Normal);
- coord = node[iPoint]->GetCoord();
+ coord = nodes->GetCoord(iPoint);
if (nDim == 3){
radius = sqrt(coord[0]*coord[0] + coord[1]*coord[1]);
@@ -6838,7 +6771,7 @@ void CPhysicalGeometry::SetAvgTurboValue(CConfig *config, unsigned short val_iZo
TotalNormal[iDim] +=Normal[iDim];
}
if (grid_movement){
- gridVel = node[iPoint]->GetGridVel();
+ gridVel = nodes->GetGridVel(iPoint);
for (iDim = 0; iDim < nDim; iDim++) TotalGridVel[iDim] +=gridVel[iDim];
}
}
@@ -7180,6 +7113,9 @@ void CPhysicalGeometry::GatherInOutAverageValues(CConfig *config, bool allocate)
void CPhysicalGeometry::SetCoord_CG(void) {
+
+ SU2_OMP_PARALLEL
+ {
unsigned short iMarker, iNode;
unsigned long elem_poin, edge_poin, iElem, iEdge;
@@ -7188,13 +7124,14 @@ void CPhysicalGeometry::SetCoord_CG(void) {
/*--- Compute the center of gravity for elements ---*/
+ SU2_OMP_FOR_STAT(roundUpDiv(nElem,2*omp_get_max_threads()))
for (iElem = 0; iElemGetnNodes() <= N_POINTS_MAXIMUM && "Insufficient N_POINTS_MAXIMUM");
/*--- Store the coordinates for all the element nodes ---*/
for (iNode = 0; iNode < elem[iElem]->GetnNodes(); iNode++) {
elem_poin = elem[iElem]->GetNode(iNode);
- Coord[iNode] = node[elem_poin]->GetCoord();
+ Coord[iNode] = nodes->GetCoord(elem_poin);
}
/*--- Compute the element CG coordinates ---*/
@@ -7203,13 +7140,14 @@ void CPhysicalGeometry::SetCoord_CG(void) {
/*--- Center of gravity for face elements ---*/
+ SU2_OMP_FOR_DYN(1)
for (iMarker = 0; iMarker < nMarker; iMarker++) {
for (iElem = 0; iElem < nElem_Bound[iMarker]; iElem++) {
/*--- Store the coordinates for all the element nodes ---*/
for (iNode = 0; iNode < bound[iMarker][iElem]->GetnNodes(); iNode++) {
elem_poin = bound[iMarker][iElem]->GetNode(iNode);
- Coord[iNode] = node[elem_poin]->GetCoord();
+ Coord[iNode] = nodes->GetCoord(elem_poin);
}
/*--- Compute the element CG coordinates ---*/
@@ -7219,18 +7157,20 @@ void CPhysicalGeometry::SetCoord_CG(void) {
/*--- Center of gravity for edges ---*/
+ SU2_OMP_FOR_STAT(roundUpDiv(nEdge,2*omp_get_max_threads()))
for (iEdge = 0; iEdge < nEdge; iEdge++) {
/*--- Store the coordinates for all the element nodes ---*/
for (iNode = 0; iNode < edges->GetnNodes(); iNode++) {
edge_poin=edges->GetNode(iEdge,iNode);
- Coord[iNode] = node[edge_poin]->GetCoord();
+ Coord[iNode] = nodes->GetCoord(edge_poin);
}
/*--- Compute the edge CG coordinates ---*/
edges->SetCoord_CG(iEdge, Coord.data());
}
+ } // end SU2_OMP_PARALLEL
}
void CPhysicalGeometry::SetBoundControlVolume(CConfig *config, unsigned short action) {
@@ -7262,7 +7202,7 @@ void CPhysicalGeometry::SetBoundControlVolume(CConfig *config, unsigned short ac
for (iNode = 0; iNode < bound[iMarker][iElem]->GetnNodes(); iNode++) {
iPoint = bound[iMarker][iElem]->GetNode(iNode);
- iVertex = node[iPoint]->GetVertex(iMarker);
+ iVertex = nodes->GetVertex(iPoint, iMarker);
/*--- Loop over the neighbor nodes, there is a face for each one ---*/
@@ -7276,7 +7216,7 @@ void CPhysicalGeometry::SetBoundControlVolume(CConfig *config, unsigned short ac
for (iDim = 0; iDim < nDim; iDim++) {
Coord_Edge_CG[iDim] = edges->GetCG(iEdge,iDim);
Coord_Elem_CG[iDim] = bound[iMarker][iElem]->GetCG(iDim);
- Coord_Vertex[iDim] = node[iPoint]->GetCoord(iDim);
+ Coord_Vertex[iDim] = nodes->GetCoord(iPoint, iDim);
}
switch (nDim) {
case 2:
@@ -7316,8 +7256,8 @@ void CPhysicalGeometry::SetBoundControlVolume(CConfig *config, unsigned short ac
void CPhysicalGeometry::SetMaxLength(CConfig* config) {
for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++){
- const unsigned short nNeigh = node[iPoint]->GetnPoint();
- const su2double* Coord_i = node[iPoint]->GetCoord();
+ const unsigned short nNeigh = nodes->GetnPoint(iPoint);
+ const su2double* Coord_i = nodes->GetCoord(iPoint);
/*--- If using AD, computing the maximum grid length can generate
* a lot of unnecessary overhead since we would store all computations
@@ -7332,8 +7272,8 @@ void CPhysicalGeometry::SetMaxLength(CConfig* config) {
/*-- Calculate the cell-center to cell-center length ---*/
- const unsigned long jPoint = node[iPoint]->GetPoint(iNeigh);
- const su2double* Coord_j = node[jPoint]->GetCoord();
+ const unsigned long jPoint = nodes->GetPoint(iPoint, iNeigh);
+ const su2double* Coord_j = nodes->GetCoord(jPoint);
passivedouble delta_aux = 0;
for (unsigned short iDim = 0;iDim < nDim; iDim++){
@@ -7351,8 +7291,8 @@ void CPhysicalGeometry::SetMaxLength(CConfig* config) {
/*--- Now that we know where the maximum distance is, repeat
* calculation with the AD-friendly su2double datatype ---*/
- const unsigned long jPoint = node[iPoint]->GetPoint(max_neighbor);
- const su2double* Coord_j = node[jPoint]->GetCoord();
+ const unsigned long jPoint = nodes->GetPoint(iPoint, max_neighbor);
+ const su2double* Coord_j = nodes->GetCoord(jPoint);
su2double max_delta = 0;
for (unsigned short iDim = 0;iDim < nDim; iDim++) {
@@ -7360,7 +7300,7 @@ void CPhysicalGeometry::SetMaxLength(CConfig* config) {
}
max_delta = sqrt(max_delta);
- node[iPoint]->SetMaxLength(max_delta);
+ nodes->SetMaxLength(iPoint, max_delta);
}
InitiateComms(this, config, MAX_LENGTH);
@@ -7396,7 +7336,7 @@ void CPhysicalGeometry::MatchNearField(CConfig *config) {
if (config->GetMarker_All_KindBC(iMarker) == NEARFIELD_BOUNDARY)
for (iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) {
iPoint = vertex[iMarker][iVertex]->GetNode();
- if (node[iPoint]->GetDomain()) nLocalVertex_NearField ++;
+ if (nodes->GetDomain(iPoint)) nLocalVertex_NearField ++;
}
Buffer_Send_nVertex[0] = nLocalVertex_NearField;
@@ -7440,14 +7380,14 @@ void CPhysicalGeometry::MatchNearField(CConfig *config) {
if (config->GetMarker_All_KindBC(iMarker) == NEARFIELD_BOUNDARY)
for (iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) {
iPoint = vertex[iMarker][iVertex]->GetNode();
- iPointGlobal = node[iPoint]->GetGlobalIndex();
- if (node[iPoint]->GetDomain()) {
+ iPointGlobal = nodes->GetGlobalIndex(iPoint);
+ if (nodes->GetDomain(iPoint)) {
Buffer_Send_Point[nLocalVertex_NearField] = iPoint;
Buffer_Send_GlobalIndex[nLocalVertex_NearField] = iPointGlobal;
Buffer_Send_Vertex[nLocalVertex_NearField] = iVertex;
Buffer_Send_Marker[nLocalVertex_NearField] = iMarker;
for (iDim = 0; iDim < nDim; iDim++)
- Buffer_Send_Coord[nLocalVertex_NearField*nDim+iDim] = node[iPoint]->GetCoord(iDim);
+ Buffer_Send_Coord[nLocalVertex_NearField*nDim+iDim] = nodes->GetCoord(iPoint, iDim);
nLocalVertex_NearField++;
}
}
@@ -7467,13 +7407,13 @@ void CPhysicalGeometry::MatchNearField(CConfig *config) {
for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) {
iPoint = vertex[iMarker][iVertex]->GetNode();
- iPointGlobal = node[iPoint]->GetGlobalIndex();
+ iPointGlobal = nodes->GetGlobalIndex(iPoint);
- if (node[iPoint]->GetDomain()) {
+ if (nodes->GetDomain(iPoint)) {
/*--- Coordinates of the boundary point ---*/
- Coord_i = node[iPoint]->GetCoord(); mindist = 1E6; pProcessor = 0; pPoint = 0;
+ Coord_i = nodes->GetCoord(iPoint); mindist = 1E6; pProcessor = 0; pPoint = 0;
/*--- Loop over all the boundaries to find the pair ---*/
for (iProcessor = 0; iProcessor < nProcessor; iProcessor++)
@@ -7581,7 +7521,7 @@ void CPhysicalGeometry::MatchActuator_Disk(CConfig *config) {
if (config->GetMarker_All_KindBC(iMarker) == Donor) {
for (iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) {
iPoint = vertex[iMarker][iVertex]->GetNode();
- if (node[iPoint]->GetDomain()) nLocalVertex_ActDisk ++;
+ if (nodes->GetDomain(iPoint)) nLocalVertex_ActDisk ++;
}
}
}
@@ -7629,14 +7569,14 @@ void CPhysicalGeometry::MatchActuator_Disk(CConfig *config) {
if (config->GetMarker_All_KindBC(iMarker) == Donor) {
for (iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) {
iPoint = vertex[iMarker][iVertex]->GetNode();
- iPointGlobal = node[iPoint]->GetGlobalIndex();
- if (node[iPoint]->GetDomain()) {
+ iPointGlobal = nodes->GetGlobalIndex(iPoint);
+ if (nodes->GetDomain(iPoint)) {
Buffer_Send_Point[nLocalVertex_ActDisk] = iPoint;
Buffer_Send_GlobalIndex[nLocalVertex_ActDisk] = iPointGlobal;
Buffer_Send_Vertex[nLocalVertex_ActDisk] = iVertex;
Buffer_Send_Marker[nLocalVertex_ActDisk] = iMarker;
for (iDim = 0; iDim < nDim; iDim++)
- Buffer_Send_Coord[nLocalVertex_ActDisk*nDim+iDim] = node[iPoint]->GetCoord(iDim);
+ Buffer_Send_Coord[nLocalVertex_ActDisk*nDim+iDim] = nodes->GetCoord(iPoint, iDim);
nLocalVertex_ActDisk++;
}
}
@@ -7658,14 +7598,14 @@ void CPhysicalGeometry::MatchActuator_Disk(CConfig *config) {
for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) {
iPoint = vertex[iMarker][iVertex]->GetNode();
- iPointGlobal = node[iPoint]->GetGlobalIndex();
+ iPointGlobal = nodes->GetGlobalIndex(iPoint);
- if (node[iPoint]->GetDomain()) {
+ if (nodes->GetDomain(iPoint)) {
/*--- Coordinates of the boundary point ---*/
- Coord_i = node[iPoint]->GetCoord(); mindist = 1E6; pProcessor = 0; pPoint = 0;
+ Coord_i = nodes->GetCoord(iPoint); mindist = 1E6; pProcessor = 0; pPoint = 0;
/*--- Loop over all the boundaries to find the pair ---*/
@@ -7804,7 +7744,7 @@ void CPhysicalGeometry::MatchPeriodic(CConfig *config,
(iPeriodic == val_periodic + nPeriodic/2)) {
for (iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) {
iPoint = vertex[iMarker][iVertex]->GetNode();
- if (node[iPoint]->GetDomain()) nLocalVertex_Periodic++;
+ if (nodes->GetDomain(iPoint)) nLocalVertex_Periodic++;
}
}
}
@@ -7868,14 +7808,14 @@ void CPhysicalGeometry::MatchPeriodic(CConfig *config,
(iPeriodic == val_periodic + nPeriodic/2)) {
for (iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) {
iPoint = vertex[iMarker][iVertex]->GetNode();
- iPointGlobal = node[iPoint]->GetGlobalIndex();
- if (node[iPoint]->GetDomain()) {
+ iPointGlobal = nodes->GetGlobalIndex(iPoint);
+ if (nodes->GetDomain(iPoint)) {
Buffer_Send_Point[nLocalVertex_Periodic] = iPoint;
Buffer_Send_GlobalIndex[nLocalVertex_Periodic] = iPointGlobal;
Buffer_Send_Vertex[nLocalVertex_Periodic] = iVertex;
Buffer_Send_Marker[nLocalVertex_Periodic] = iMarker;
for (iDim = 0; iDim < nDim; iDim++)
- Buffer_Send_Coord[nLocalVertex_Periodic*nDim+iDim] = node[iPoint]->GetCoord(iDim);
+ Buffer_Send_Coord[nLocalVertex_Periodic*nDim+iDim] = nodes->GetCoord(iPoint, iDim);
nLocalVertex_Periodic++;
}
}
@@ -7954,15 +7894,15 @@ void CPhysicalGeometry::MatchPeriodic(CConfig *config,
/*--- Local and global index for the owned periodic point. ---*/
iPoint = vertex[iMarker][iVertex]->GetNode();
- iPointGlobal = node[iPoint]->GetGlobalIndex();
+ iPointGlobal = nodes->GetGlobalIndex(iPoint);
/*--- If this is not a ghost, find the periodic match. ---*/
- if (node[iPoint]->GetDomain()) {
+ if (nodes->GetDomain(iPoint)) {
/*--- Coordinates of the current boundary point ---*/
- Coord_i = node[iPoint]->GetCoord();
+ Coord_i = nodes->GetCoord(iPoint);
/*--- Get the position vector from rotation center to point. ---*/
@@ -8140,27 +8080,19 @@ void CPhysicalGeometry::MatchPeriodic(CConfig *config,
}
void CPhysicalGeometry::SetControlVolume(CConfig *config, unsigned short action) {
+
unsigned long face_iPoint = 0, face_jPoint = 0, iPoint, iElem;
- long iEdge;
unsigned short nEdgesFace = 1, iFace, iEdgesFace, iDim;
- su2double *Coord_Edge_CG, *Coord_FaceElem_CG, *Coord_Elem_CG, *Coord_FaceiPoint, *Coord_FacejPoint, Area,
- Volume, DomainVolume, my_DomainVolume;
- bool change_face_orientation;
+ su2double Coord_Edge_CG[3] = {0.0}, Coord_FaceElem_CG[3] = {0.0}, Coord_Elem_CG[3] = {0.0};
/*--- Update values of faces of the edge ---*/
if (action != ALLOCATE) {
edges->SetZeroValues();
for (iPoint = 0; iPoint < nPoint; iPoint++)
- node[iPoint]->SetVolume (0.0);
+ nodes->SetVolume(iPoint, 0.0);
}
- Coord_Edge_CG = new su2double [nDim];
- Coord_FaceElem_CG = new su2double [nDim];
- Coord_Elem_CG = new su2double [nDim];
- Coord_FaceiPoint = new su2double [nDim];
- Coord_FacejPoint = new su2double [nDim];
-
- my_DomainVolume = 0.0;
+ su2double my_DomainVolume = 0.0;
for (iElem = 0; iElem < nElem; iElem++) {
for (iFace = 0; iFace < elem[iElem]->GetnFaces(); iFace++) {
@@ -8188,67 +8120,66 @@ void CPhysicalGeometry::SetControlVolume(CConfig *config, unsigned short action)
}
/*--- We define a direction (from the smalest index to the greatest) --*/
- change_face_orientation = false;
- if (face_iPoint > face_jPoint) change_face_orientation = true;
- iEdge = FindEdge(face_iPoint, face_jPoint);
+ const bool change_face_orientation = (face_iPoint > face_jPoint);
+ const auto iEdge = FindEdge(face_iPoint, face_jPoint);
for (iDim = 0; iDim < nDim; iDim++) {
Coord_Edge_CG[iDim] = edges->GetCG(iEdge,iDim);
Coord_Elem_CG[iDim] = elem[iElem]->GetCG(iDim);
Coord_FaceElem_CG[iDim] = elem[iElem]->GetFaceCG(iFace, iDim);
- Coord_FaceiPoint[iDim] = node[face_iPoint]->GetCoord(iDim);
- Coord_FacejPoint[iDim] = node[face_jPoint]->GetCoord(iDim);
}
- switch (nDim) {
- case 2:
- /*--- Two dimensional problem ---*/
- if (change_face_orientation) edges->SetNodes_Coord(iEdge, Coord_Elem_CG, Coord_Edge_CG);
- else edges->SetNodes_Coord(iEdge, Coord_Edge_CG, Coord_Elem_CG);
- Area = CEdge::GetVolume(Coord_FaceiPoint, Coord_Edge_CG, Coord_Elem_CG);
- node[face_iPoint]->AddVolume(Area); my_DomainVolume +=Area;
- Area = CEdge::GetVolume(Coord_FacejPoint, Coord_Edge_CG, Coord_Elem_CG);
- node[face_jPoint]->AddVolume(Area); my_DomainVolume +=Area;
- break;
- case 3:
- /*--- Three dimensional problem ---*/
- if (change_face_orientation) edges->SetNodes_Coord(iEdge, Coord_FaceElem_CG, Coord_Edge_CG, Coord_Elem_CG);
- else edges->SetNodes_Coord(iEdge, Coord_Edge_CG, Coord_FaceElem_CG, Coord_Elem_CG);
- Volume = CEdge::GetVolume(Coord_FaceiPoint, Coord_Edge_CG, Coord_FaceElem_CG, Coord_Elem_CG);
- node[face_iPoint]->AddVolume(Volume); my_DomainVolume +=Volume;
- Volume = CEdge::GetVolume(Coord_FacejPoint, Coord_Edge_CG, Coord_FaceElem_CG, Coord_Elem_CG);
- node[face_jPoint]->AddVolume(Volume); my_DomainVolume +=Volume;
- break;
+ const su2double* Coord_FaceiPoint = nodes->GetCoord(face_iPoint);
+ const su2double* Coord_FacejPoint = nodes->GetCoord(face_jPoint);
+
+ su2double Volume_i, Volume_j;
+
+ if (nDim == 2) {
+ /*--- Two dimensional problem ---*/
+ if (change_face_orientation)
+ edges->SetNodes_Coord(iEdge, Coord_Elem_CG, Coord_Edge_CG);
+ else
+ edges->SetNodes_Coord(iEdge, Coord_Edge_CG, Coord_Elem_CG);
+
+ Volume_i = CEdge::GetVolume(Coord_FaceiPoint, Coord_Edge_CG, Coord_Elem_CG);
+ Volume_j = CEdge::GetVolume(Coord_FacejPoint, Coord_Edge_CG, Coord_Elem_CG);
}
+ else {
+ /*--- Three dimensional problem ---*/
+ if (change_face_orientation)
+ edges->SetNodes_Coord(iEdge, Coord_FaceElem_CG, Coord_Edge_CG, Coord_Elem_CG);
+ else
+ edges->SetNodes_Coord(iEdge, Coord_Edge_CG, Coord_FaceElem_CG, Coord_Elem_CG);
+
+ Volume_i = CEdge::GetVolume(Coord_FaceiPoint, Coord_Edge_CG, Coord_FaceElem_CG, Coord_Elem_CG);
+ Volume_j = CEdge::GetVolume(Coord_FacejPoint, Coord_Edge_CG, Coord_FaceElem_CG, Coord_Elem_CG);
+ }
+
+ nodes->AddVolume(face_iPoint, Volume_i);
+ nodes->AddVolume(face_jPoint, Volume_j);
+
+ my_DomainVolume += Volume_i+Volume_j;
}
}
}
/*--- Check if there is a normal with null area ---*/
- for (iEdge = 0; iEdge < (long)nEdge; iEdge++) {
- const auto NormalFace = edges->GetNormal(iEdge);
- Area = 0.0; for (iDim = 0; iDim < nDim; iDim++) Area += NormalFace[iDim]*NormalFace[iDim];
- Area = sqrt(Area);
- if (Area == 0.0) {
+ for (auto iEdge = 0ul; iEdge < nEdge; iEdge++) {
+ const auto Area2 = GeometryToolbox::SquaredNorm(nDim, edges->GetNormal(iEdge));
+ if (Area2 == 0.0) {
su2double DefaultArea[3] = {EPS*EPS};
edges->SetNormal(iEdge, DefaultArea);
}
}
+ su2double DomainVolume;
SU2_MPI::Allreduce(&my_DomainVolume, &DomainVolume, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
+ config->SetDomainVolume(DomainVolume);
if ((rank == MASTER_NODE) && (action == ALLOCATE)) {
if (nDim == 2) cout <<"Area of the computational grid: "<< DomainVolume <<"."<< endl;
if (nDim == 3) cout <<"Volume of the computational grid: "<< DomainVolume <<"."<< endl;
}
-
- config->SetDomainVolume(DomainVolume);
-
- delete[] Coord_Edge_CG;
- delete[] Coord_FaceElem_CG;
- delete[] Coord_Elem_CG;
- delete[] Coord_FaceiPoint;
- delete[] Coord_FacejPoint;
}
void CPhysicalGeometry::VisualizeControlVolume(CConfig *config, unsigned short action) {
@@ -8318,8 +8249,8 @@ void CPhysicalGeometry::VisualizeControlVolume(CConfig *config, unsigned short a
Coord_Edge_CG[iDim] = edges->GetCG(iEdge,iDim);
Coord_Elem_CG[iDim] = elem[iElem]->GetCG(iDim);
Coord_FaceElem_CG[iDim] = elem[iElem]->GetFaceCG(iFace, iDim);
- Coord_FaceiPoint[iDim] = node[face_iPoint]->GetCoord(iDim);
- Coord_FacejPoint[iDim] = node[face_jPoint]->GetCoord(iDim);
+ Coord_FaceiPoint[iDim] = nodes->GetCoord(face_iPoint, iDim);
+ Coord_FacejPoint[iDim] = nodes->GetCoord(face_jPoint, iDim);
}
/*--- Print out the coordinates for a set of triangles making
@@ -8438,11 +8369,11 @@ void CPhysicalGeometry::SetMeshFile (CConfig *config, string val_mesh_out_filena
output_file.precision(15);
for (iPoint = 0; iPoint < nPoint; iPoint++) {
for (iDim = 0; iDim < nDim; iDim++)
- output_file << scientific << "\t" << node[iPoint]->GetCoord(iDim) ;
+ output_file << scientific << "\t" << nodes->GetCoord(iPoint, iDim) ;
#ifndef HAVE_MPI
output_file << "\t" << iPoint << endl;
#else
- output_file << "\t" << iPoint << "\t" << node[iPoint]->GetGlobalIndex() << endl;
+ output_file << "\t" << iPoint << "\t" << nodes->GetGlobalIndex(iPoint) << endl;
#endif
}
@@ -8504,37 +8435,32 @@ void CPhysicalGeometry::SetCoord_Smoothing (unsigned short val_nSmooth, su2doubl
Coord = new su2double [nDim];
- for (iPoint = 0; iPoint < GetnPoint(); iPoint++) {
- su2double *Coord = node[iPoint]->GetCoord();
- node[iPoint]->SetCoord_Old(Coord);
- }
+ nodes->SetCoord_Old();
/*--- Jacobi iterations ---*/
for (iSmooth = 0; iSmooth < val_nSmooth; iSmooth++) {
- for (iPoint = 0; iPoint < nPoint; iPoint++)
- node[iPoint]->SetCoord_SumZero();
-
+ nodes->SetCoord_SumZero();
/*--- Loop over Interior edges ---*/
for (iEdge = 0; iEdge < nEdge; iEdge++) {
iPoint = edges->GetNode(iEdge,0);
- Coord_i = node[iPoint]->GetCoord();
+ Coord_i = nodes->GetCoord(iPoint);
jPoint = edges->GetNode(iEdge,1);
- Coord_j = node[jPoint]->GetCoord();
+ Coord_j = nodes->GetCoord(jPoint);
/*--- Accumulate nearest neighbor Coord to Res_sum for each variable ---*/
- node[iPoint]->AddCoord_Sum(Coord_j);
- node[jPoint]->AddCoord_Sum(Coord_i);
+ nodes->AddCoord_Sum(iPoint, Coord_j);
+ nodes->AddCoord_Sum(jPoint, Coord_i);
}
/*--- Loop over all mesh points (Update Coords with averaged sum) ---*/
for (iPoint = 0; iPoint < nPoint; iPoint++) {
- nneigh = node[iPoint]->GetnPoint();
- Coord_Sum = node[iPoint]->GetCoord_Sum();
- Coord_Old = node[iPoint]->GetCoord_Old();
+ nneigh = nodes->GetnPoint(iPoint);
+ Coord_Sum = nodes->GetCoord_Sum(iPoint);
+ Coord_Old = nodes->GetCoord_Old(iPoint);
if (nDim == 2) {
Coord[0] =(Coord_Old[0] + val_smooth_coeff*Coord_Sum[0]) /(1.0 + val_smooth_coeff*su2double(nneigh));
@@ -8551,15 +8477,15 @@ void CPhysicalGeometry::SetCoord_Smoothing (unsigned short val_nSmooth, su2doubl
Coord[2] = Coord_Old[2];
}
- node[iPoint]->SetCoord(Coord);
+ nodes->SetCoord(iPoint, Coord);
}
/*--- Copy boundary values ---*/
for (iMarker = 0; iMarker < nMarker; iMarker++)
for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) {
iPoint = vertex[iMarker][iVertex]->GetNode();
- Coord_Old = node[iPoint]->GetCoord_Old();
- node[iPoint]->SetCoord(Coord_Old);
+ Coord_Old = nodes->GetCoord_Old(iPoint);
+ nodes->SetCoord(iPoint, Coord_Old);
}
}
@@ -8664,7 +8590,7 @@ void CPhysicalGeometry::SetTecPlot(char mesh_filename[MAX_STRING_SIZE], bool new
for (iPoint = 0; iPoint < nPoint; iPoint++) {
for (iDim = 0; iDim < nDim; iDim++)
- Tecplot_File << scientific << node[iPoint]->GetCoord(iDim) << "\t";
+ Tecplot_File << scientific << nodes->GetCoord(iPoint, iDim) << "\t";
Tecplot_File << "\n";
}
@@ -8725,7 +8651,7 @@ void CPhysicalGeometry::SetBoundTecPlot(char mesh_filename[MAX_STRING_SIZE], boo
PointSurface = new unsigned long[nPoint];
for (iPoint = 0; iPoint < nPoint; iPoint++)
- if (node[iPoint]->GetBoundary()) {
+ if (nodes->GetBoundary(iPoint)) {
PointSurface[iPoint] = nPointSurface;
nPointSurface++;
}
@@ -8764,17 +8690,17 @@ void CPhysicalGeometry::SetBoundTecPlot(char mesh_filename[MAX_STRING_SIZE], boo
if (nDim == 3) {
for (iPoint = 0; iPoint < nPoint; iPoint++)
- if (node[iPoint]->GetBoundary()) {
+ if (nodes->GetBoundary(iPoint)) {
for (Coord_i = 0; Coord_i < nDim-1; Coord_i++)
- Tecplot_File << node[iPoint]->GetCoord(Coord_i) << " ";
- Tecplot_File << node[iPoint]->GetCoord(nDim-1) << "\n";
+ Tecplot_File << nodes->GetCoord(iPoint, Coord_i) << " ";
+ Tecplot_File << nodes->GetCoord(iPoint, nDim-1) << "\n";
}
}
else {
for (iPoint = 0; iPoint < nPoint; iPoint++)
- if (node[iPoint]->GetBoundary()) {
+ if (nodes->GetBoundary(iPoint)) {
for (Coord_i = 0; Coord_i < nDim; Coord_i++)
- Tecplot_File << node[iPoint]->GetCoord(Coord_i) << " ";
+ Tecplot_File << nodes->GetCoord(iPoint, Coord_i) << " ";
Tecplot_File << "\n";
}
}
@@ -8832,7 +8758,7 @@ void CPhysicalGeometry::SetColorGrid_Parallel(CConfig *config) {
/*--- Initialize the color vector ---*/
for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++)
- node[iPoint]->SetColor(0);
+ nodes->SetColor(iPoint, 0);
/*--- We need to have parallel support with MPI and have the ParMETIS
library compiled and linked for parallel graph partitioning. ---*/
@@ -8899,7 +8825,7 @@ void CPhysicalGeometry::SetColorGrid_Parallel(CConfig *config) {
results for its initial piece of the grid. ---*/
for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) {
- node[iPoint]->SetColor(part[iPoint]);
+ nodes->SetColor(iPoint, part[iPoint]);
}
/*--- Free all memory needed for the ParMETIS structures ---*/
@@ -8948,8 +8874,8 @@ void CPhysicalGeometry::ComputeMeshQualityStatistics(CConfig *config) {
const unsigned long iPoint = edges->GetNode(iEdge,0);
const unsigned long jPoint = edges->GetNode(iEdge,1);
- const unsigned long GlobalIndex_i = node[iPoint]->GetGlobalIndex();
- const unsigned long GlobalIndex_j = node[iPoint]->GetGlobalIndex();
+ const unsigned long GlobalIndex_i = nodes->GetGlobalIndex(iPoint);
+ const unsigned long GlobalIndex_j = nodes->GetGlobalIndex(iPoint);
/*-- Area normal for the current edge. Recall that this normal
is computed by summing the normals of adjacent faces along
@@ -8959,8 +8885,8 @@ void CPhysicalGeometry::ComputeMeshQualityStatistics(CConfig *config) {
/*--- Get the coordinates for point i & j. ---*/
- const su2double *Coord_i = node[iPoint]->GetCoord();
- const su2double *Coord_j = node[jPoint]->GetCoord();
+ const su2double *Coord_i = nodes->GetCoord(iPoint);
+ const su2double *Coord_j = nodes->GetCoord(jPoint);
/*--- Compute the vector pointing from iPoint to jPoint and
its distance. We also compute face area (norm of the normal vector). ---*/
@@ -8981,12 +8907,12 @@ void CPhysicalGeometry::ComputeMeshQualityStatistics(CConfig *config) {
of the aspect ratio of the dual control volume. Smaller
is better (closer to isotropic). ----*/
- if (node[iPoint]->GetDomain()) {
+ if (nodes->GetDomain(iPoint)) {
Area_Min[iPoint] = min(Area_Min[iPoint], area);
Area_Max[iPoint] = max(Area_Max[iPoint], area);
}
- if (node[jPoint]->GetDomain()) {
+ if (nodes->GetDomain(jPoint)) {
Area_Min[jPoint] = min(Area_Min[jPoint], area);
Area_Max[jPoint] = max(Area_Max[jPoint], area);
}
@@ -9013,24 +8939,24 @@ void CPhysicalGeometry::ComputeMeshQualityStatistics(CConfig *config) {
not aligned, the orthogonality will reduce from there. Good values
are close to 90 degress, poor values are typically below 20 degress. ---*/
- if (node[iPoint]->GetDomain()) {
+ if (nodes->GetDomain(iPoint)) {
Orthogonality[iPoint] += area*(90.0 - acos(dotProduct)*180.0/PI_NUMBER);
SurfaceArea[iPoint] += area;
}
- if (node[jPoint]->GetDomain()) {
+ if (nodes->GetDomain(jPoint)) {
Orthogonality[jPoint] += area*(90.0 - acos(dotProduct)*180.0/PI_NUMBER);
SurfaceArea[jPoint] += area;
}
/*--- Error check for zero volume of the dual CVs. ---*/
- if (node[iPoint]->GetVolume() <= 0.0) {
+ if (nodes->GetVolume(iPoint) <= 0.0) {
char buf[200];
SPRINTF(buf, "Zero-area CV face found for point %lu.", GlobalIndex_i);
SU2_MPI::Error(string(buf), CURRENT_FUNCTION);
}
- if (node[jPoint]->GetVolume() <= 0.0) {
+ if (nodes->GetVolume(jPoint) <= 0.0) {
char buf[200];
SPRINTF(buf, "Zero-area CV face found for point %lu.", GlobalIndex_j);
SU2_MPI::Error(string(buf), CURRENT_FUNCTION);
@@ -9048,7 +8974,7 @@ void CPhysicalGeometry::ComputeMeshQualityStatistics(CConfig *config) {
const unsigned long iPoint = vertex[iMarker][iVertex]->GetNode();
const su2double *Normal = vertex[iMarker][iVertex]->GetNormal();
- if (node[iPoint]->GetDomain()) {
+ if (nodes->GetDomain(iPoint)) {
/*--- Face area (norm of the normal vector) ---*/
@@ -9125,8 +9051,8 @@ void CPhysicalGeometry::ComputeMeshQualityStatistics(CConfig *config) {
Coord_Edge_CG[iDim] = edges->GetCG(iEdge,iDim);
Coord_Elem_CG[iDim] = elem[iElem]->GetCG(iDim);
Coord_FaceElem_CG[iDim] = elem[iElem]->GetFaceCG(iFace, iDim);
- Coord_FaceiPoint[iDim] = node[face_iPoint]->GetCoord(iDim);
- Coord_FacejPoint[iDim] = node[face_jPoint]->GetCoord(iDim);
+ Coord_FaceiPoint[iDim] = nodes->GetCoord(face_iPoint, iDim);
+ Coord_FacejPoint[iDim] = nodes->GetCoord(face_jPoint, iDim);
}
/*--- Access the sub-volume of the element separately in 2D or 3D. ---*/
@@ -9157,14 +9083,14 @@ void CPhysicalGeometry::ComputeMeshQualityStatistics(CConfig *config) {
/*--- Check if sub-elem volume is the min or max for iPoint. ---*/
- if (node[face_iPoint]->GetDomain()) {
+ if (nodes->GetDomain(face_iPoint)) {
SubVolume_Min[face_iPoint] = min(SubVolume_Min[face_iPoint], Volume_i);
SubVolume_Max[face_iPoint] = max(SubVolume_Max[face_iPoint], Volume_i);
}
/*--- Check if sub-elem volume is the min or max for jPoint. ---*/
- if (node[face_jPoint]->GetDomain()) {
+ if (nodes->GetDomain(face_jPoint)) {
SubVolume_Min[face_jPoint] = min(SubVolume_Min[face_jPoint], Volume_j);
SubVolume_Max[face_jPoint] = max(SubVolume_Max[face_jPoint], Volume_j);
}
@@ -9255,11 +9181,11 @@ void CPhysicalGeometry::FindNormal_Neighbor(CConfig *config) {
/*--- Compute closest normal neighbor, note that the normal are oriented inwards ---*/
Point_Normal = 0; cos_max = -1.0;
- for (iNeigh = 0; iNeigh < node[iPoint]->GetnPoint(); iNeigh++) {
- jPoint = node[iPoint]->GetPoint(iNeigh);
+ for (iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); iNeigh++) {
+ jPoint = nodes->GetPoint(iPoint, iNeigh);
scalar_prod = 0.0; norm_vect = 0.0; norm_Normal = 0.0;
for (iDim = 0; iDim < nDim; iDim++) {
- diff_coord = node[jPoint]->GetCoord(iDim)-node[iPoint]->GetCoord(iDim);
+ diff_coord = nodes->GetCoord(jPoint, iDim)-nodes->GetCoord(iPoint, iDim);
scalar_prod += diff_coord*Normal[iDim];
norm_vect += diff_coord*diff_coord;
norm_Normal += Normal[iDim]*Normal[iDim];
@@ -9300,7 +9226,7 @@ void CPhysicalGeometry::SetBoundSensitivity(CConfig *config) {
for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) {
/*--- The sensitivity file uses the global numbering ---*/
- iPoint = node[vertex[iMarker][iVertex]->GetNode()]->GetGlobalIndex();
+ iPoint = nodes->GetGlobalIndex(vertex[iMarker][iVertex]->GetNode());
if (vertex[iMarker][iVertex]->GetNode() < GetnPointDomain()) {
Point2Vertex[iPoint][0] = iMarker;
@@ -9990,7 +9916,7 @@ void CPhysicalGeometry::ReadUnorderedSensitivity(CConfig *config) {
for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
PointIDs[iPoint] = iPoint;
for (iDim = 0; iDim < nDim; iDim++)
- Coords[iPoint*nDim + iDim] = node[iPoint]->GetCoord(iDim);
+ Coords[iPoint*nDim + iDim] = nodes->GetCoord(iPoint, iDim);
}
/*--- Build the ADT of all interior nodes. ---*/
@@ -11624,7 +11550,7 @@ std::unique_ptr CPhysicalGeometry::ComputeViscousWallADT(const CC
meshToSurface[i] = nVertex_SolidWall++;
for(unsigned short k=0; kGetCoord(k));
+ surfaceCoor.push_back(nodes->GetCoord(i, k));
}
}
@@ -11665,8 +11591,8 @@ void CPhysicalGeometry::SetWallDistance(const CConfig *config, CADTElemClass *Wa
unsigned long elemID;
int rankID;
su2double dist;
- WallADT->DetermineNearestElement(node[iPoint]->GetCoord(), dist, markerID, elemID, rankID);
- node[iPoint]->SetWall_Distance(min(dist,node[iPoint]->GetWall_Distance()));
+ WallADT->DetermineNearestElement(nodes->GetCoord(iPoint), dist, markerID, elemID, rankID);
+ nodes->SetWall_Distance(iPoint, min(dist,nodes->GetWall_Distance(iPoint)));
}
}
// end SU2_OMP_PARALLEL
diff --git a/Common/src/geometry/dual_grid/CPoint.cpp b/Common/src/geometry/dual_grid/CPoint.cpp
index 03bcf18774cc..95010e40cde5 100644
--- a/Common/src/geometry/dual_grid/CPoint.cpp
+++ b/Common/src/geometry/dual_grid/CPoint.cpp
@@ -26,430 +26,155 @@
*/
#include "../../../include/geometry/dual_grid/CPoint.hpp"
+#include "../../../include/CConfig.hpp"
+#include "../../../include/omp_structure.hpp"
-CPoint::CPoint(unsigned short val_nDim, unsigned long val_globalindex, CConfig *config) : CDualGrid(val_nDim) {
+CPoint::CPoint(unsigned long npoint, unsigned long ndim) : nDim(ndim) {
- unsigned short iDim, jDim;
-
- /*--- Element, point and edge structures initialization ---*/
- Elem.clear(); nElem = 0;
- Point.clear(); nPoint = 0;
- Edge.clear();
-
- Volume = NULL; Vertex = NULL;
- Coord = NULL; Coord_Old = NULL; Coord_Sum = NULL;
- Coord_n = NULL; Coord_n1 = NULL; Coord_p1 = NULL;
- GridVel = NULL; GridVel_Grad = NULL;
- AD_InputIndex = NULL; AD_OutputIndex = NULL;
-
- /*--- Volume (0 -> Vol_nP1, 1-> Vol_n, 2 -> Vol_nM1 ) and coordinates of the control volume ---*/
-
- if (config->GetTime_Marching() == NO) {
- Volume = new su2double[1];
- Volume[0] = 0.0;
- }
- else {
- Volume = new su2double[3];
- Volume[0] = 0.0;
- Volume[1] = 0.0;
- Volume[2] = 0.0;
- }
-
- Coord = new su2double[nDim];
-
- if(config->GetAD_Mode() && config->GetMultizone_Problem()) {
- AD_InputIndex = new int[nDim];
- AD_OutputIndex = new int[nDim];
- }
-
- /*--- Indicator if the control volume has been agglomerated ---*/
- Parent_CV = 0;
- Agglomerate = false;
-
- /*--- Flip the normal orientation ---*/
- Flip_Orientation = false;
-
- /*--- Indicator if the point is going to be moved in a volumetric deformation ---*/
- Move = true;
-
- /*--- Identify boundaries, physical boundaries (not send-receive
- condition), detect if an element belong to the domain or it must
- be computed with other processor ---*/
- Domain = true;
- Boundary = false;
- SolidBoundary = false;
- PhysicalBoundary = false;
- PeriodicBoundary = false;
-
- /*--- Set the global index in the parallel simulation ---*/
- GlobalIndex = val_globalindex;
-
- /*--- Set the color for mesh partitioning ---*/
- color = 0;
-
- /*--- For smoothing the numerical grid coordinates ---*/
- if ( config->GetSmoothNumGrid() ) {
- Coord_Old = new su2double[nDim];
- Coord_Sum = new su2double[nDim];
- }
-
- /* A grid is defined as dynamic if there's rigid grid movement or grid deformation AND the problem is time domain */
- bool dynamic_grid = config->GetDynamic_Grid();
-
- /*--- Grid velocity gradients are only needed for the continuous adjoint ---*/
- bool continuous_adjoint = (config->GetKind_Solver() == ADJ_EULER ||
- config->GetKind_Solver() == ADJ_NAVIER_STOKES ||
- config->GetKind_Solver() == ADJ_RANS);
-
- /*--- Storage of grid velocities for dynamic meshes ---*/
-
- if ( dynamic_grid ) {
- GridVel = new su2double[nDim];
-
- for (iDim = 0; iDim < nDim; iDim++)
- GridVel[iDim] = 0.0;
-
- if (continuous_adjoint){
- /*--- Gradient of the grid velocity ---*/
- GridVel_Grad = new su2double*[nDim];
-
- for (iDim = 0; iDim < nDim; iDim++) {
- GridVel_Grad[iDim] = new su2double[nDim];
- for (jDim = 0; jDim < nDim; jDim++)
- GridVel_Grad[iDim][jDim] = 0.0;
- }
- }
-
- /*--- Structures for storing old node coordinates for computing grid
- velocities via finite differencing with dynamically deforming meshes. ---*/
- /*--- In the case of deformable mesh solver, these coordinates are stored as solutions to the mesh problem ---*/
- if ( config->GetGrid_Movement() && (config->GetTime_Marching() != NO)) {
- Coord_p1 = new su2double[nDim];
- Coord_n = new su2double[nDim];
- Coord_n1 = new su2double[nDim];
- Coord_Old = new su2double[nDim];
- }
- }
-
- /*--- Intialize the value of the curvature ---*/
- Curvature = 0.0;
-
- /*--- Intialize the value of the periodic volume. ---*/
- Periodic_Volume = 0.0;
-
- /*--- Init walldistance ---*/
-
- Wall_Distance = 0.0;
+ MinimalAllocation(npoint);
}
-CPoint::CPoint(su2double val_coord_0, su2double val_coord_1, unsigned long val_globalindex, CConfig *config) : CDualGrid(2) {
-
- unsigned short iDim, jDim;
-
- /*--- Element, point and edge structures initialization ---*/
- Elem.clear(); nElem = 0;
- Point.clear(); nPoint = 0;
- Edge.clear();
-
- Volume = NULL; Vertex = NULL;
- Coord = NULL; Coord_Old = NULL; Coord_Sum = NULL;
- Coord_n = NULL; Coord_n1 = NULL; Coord_p1 = NULL;
- GridVel = NULL; GridVel_Grad = NULL;
- AD_InputIndex = NULL; AD_OutputIndex = NULL;
-
- /*--- Volume (0 -> Vol_nP1, 1-> Vol_n, 2 -> Vol_nM1 ) and coordinates of the control volume ---*/
-
- if (config->GetTime_Marching() == NO) {
- Volume = new su2double[1];
- Volume[0] = 0.0;
- }
- else{
- Volume = new su2double[3];
- Volume[0] = 0.0;
- Volume[1] = 0.0;
- Volume[2] = 0.0;
- }
-
- Coord = new su2double[nDim];
- Coord[0] = val_coord_0;
- Coord[1] = val_coord_1;
-
- if(config->GetAD_Mode() && config->GetMultizone_Problem()) {
- AD_InputIndex = new int[nDim];
- AD_OutputIndex = new int[nDim];
- }
-
- /*--- Indicator if the control volume has been agglomerated ---*/
- Parent_CV = 0;
- Agglomerate = false;
+void CPoint::MinimalAllocation(unsigned long npoint) {
- /*--- Flip the normal orientation ---*/
- Flip_Orientation = false;
+ /*--- Global index a parallel simulation. ---*/
+ GlobalIndex.resize(npoint) = 0;
- /*--- Indicator if the point is going to be moved in a volumetric deformation ---*/
- Move = true;
+ /*--- Set the color for mesh partitioning. ---*/
+ Color.resize(npoint) = 0;
- /*--- Identify boundaries, physical boundaries (not send-receive
- condition), detect if an element belong to the domain or it must
- be computed with other processor ---*/
- Domain = true;
- Boundary = false;
- SolidBoundary = false;
- PhysicalBoundary = false;
- PeriodicBoundary = false;
+ /*--- Coordinates. ---*/
+ Coord.resize(npoint,nDim) = su2double(0.0);
- /*--- Set the color for mesh partitioning ---*/
- color = 0;
-
- /*--- Set the global index in the parallel simulation ---*/
- GlobalIndex = val_globalindex;
-
- /*--- For smoothing the numerical grid coordinates ---*/
- if ( config->GetSmoothNumGrid() ) {
- Coord_Old = new su2double[nDim];
- Coord_Sum = new su2double[nDim];
- }
-
- /* A grid is defined as dynamic if there's rigid grid movement or grid deformation AND the problem is time domain */
- bool dynamic_grid = config->GetDynamic_Grid();
-
- /*--- Grid velocity gradients are only needed for the continuous adjoint ---*/
- bool continuous_adjoint = (config->GetKind_Solver() == ADJ_EULER ||
- config->GetKind_Solver() == ADJ_NAVIER_STOKES ||
- config->GetKind_Solver() == ADJ_RANS);
-
- /*--- Storage of grid velocities for dynamic meshes ---*/
- if ( dynamic_grid ) {
- GridVel = new su2double[nDim];
- for (iDim = 0; iDim < nDim; iDim++)
- GridVel[iDim] = 0.0;
-
- if (continuous_adjoint){
- /*--- Gradient of the grid velocity ---*/
- GridVel_Grad = new su2double*[nDim];
- for (iDim = 0; iDim < nDim; iDim++) {
- GridVel_Grad[iDim] = new su2double[nDim];
- for (jDim = 0; jDim < nDim; jDim++)
- GridVel_Grad[iDim][jDim] = 0.0;
- }
- }
-
- /*--- Structures for storing old node coordinates for computing grid
- velocities via finite differencing with dynamically deforming meshes. ---*/
- /*--- In the case of deformable mesh solver, these coordinates are stored as solutions to the mesh problem ---*/
- if ( config->GetGrid_Movement() && (config->GetTime_Marching() != NO)) {
- Coord_p1 = new su2double[nDim];
- Coord_n = new su2double[nDim];
- Coord_n1 = new su2double[nDim];
- Coord_Old = new su2double[nDim];
- for (iDim = 0; iDim < nDim; iDim ++) {
- Coord_p1[iDim] = Coord[iDim];
- Coord_n[iDim] = Coord[iDim];
- Coord_n1[iDim] = Coord[iDim];
- }
- }
- }
+}
- /*--- Intialize the value of the curvature ---*/
- Curvature = 0.0;
+CPoint::CPoint(unsigned long npoint, unsigned long ndim, unsigned short imesh, const CConfig *config) : nDim(ndim) {
- /*--- Intialize the value of the periodic volume. ---*/
- Periodic_Volume = 0.0;
+ MinimalAllocation(npoint);
+ FullAllocation(imesh, config);
}
-CPoint::CPoint(su2double val_coord_0, su2double val_coord_1, su2double val_coord_2, unsigned long val_globalindex, CConfig *config) : CDualGrid(3) {
+void CPoint::FullAllocation(unsigned short imesh, const CConfig *config) {
- unsigned short iDim, jDim;
+ const auto npoint = GlobalIndex.size();
- /*--- Element, point and edge structures initialization ---*/
- Elem.clear(); nElem = 0;
- Point.clear(); nPoint = 0;
- Edge.clear();
+ /*--- Volumes ---*/
- Volume = NULL; Vertex = NULL;
- Coord = NULL; Coord_Old = NULL; Coord_Sum = NULL;
- Coord_n = NULL; Coord_n1 = NULL; Coord_p1 = NULL;
- GridVel = NULL; GridVel_Grad = NULL;
- AD_InputIndex = NULL; AD_OutputIndex = NULL;
+ Volume.resize(npoint) = su2double(0.0);
+ Periodic_Volume.resize(npoint) = su2double(0.0);
- /*--- Volume (0 -> Vol_nP1, 1-> Vol_n, 2 -> Vol_nM1 ) and coordinates of the control volume ---*/
- if ( config->GetTime_Marching() == NO ) {
- Volume = new su2double[1];
- Volume[0] = 0.0;
+ if (config->GetTime_Marching() != NO) {
+ Volume_n.resize(npoint) = su2double(0.0);
+ Volume_nM1.resize(npoint) = su2double(0.0);
}
- else{
- Volume = new su2double[3];
- Volume[0] = 0.0;
- Volume[1] = 0.0;
- Volume[2] = 0.0;
- }
-
- Coord = new su2double[nDim];
- Coord[0] = val_coord_0;
- Coord[1] = val_coord_1;
- Coord[2] = val_coord_2;
if(config->GetAD_Mode() && config->GetMultizone_Problem()) {
- AD_InputIndex = new int[nDim];
- AD_OutputIndex = new int[nDim];
+ AD_InputIndex.resize(npoint,nDim) = 0;
+ AD_OutputIndex.resize(npoint,nDim) = 0;
+ }
+
+ /*--- Multigrid structures. ---*/
+ if (config->GetnMGLevels() > 0) {
+ Parent_CV.resize(npoint) = 0;
+ Agglomerate.resize(npoint) = false;
+ Agglomerate_Indirect.resize(npoint) = false;
+ /*--- The finest grid does not have children CV's. ---*/
+ if (imesh != MESH_0) {
+ nChildren_CV.resize(npoint) = 0;
+ Children_CV.resize(npoint);
+ }
}
- /*--- Indicator if the control volume has been agglomerated ---*/
- Parent_CV = 0;
- Agglomerate = false;
+ /*--- Identify boundaries, physical boundaries (not send-receive condition), detect if
+ * an element belong to the domain or it must be computed with other processor. ---*/
+ Domain.resize(npoint) = true;
+ Boundary.resize(npoint) = false;
+ SolidBoundary.resize(npoint) = false;
+ PhysicalBoundary.resize(npoint) = false;
+ PeriodicBoundary.resize(npoint) = false;
- /*--- Indicator if the point is going to be moved in a volumetric deformation ---*/
- Move = true;
-
- /*--- Flip the normal orientation ---*/
- Flip_Orientation = false;
-
- /*--- Identify boundaries, physical boundaries (not send-receive
- condition), detect if an element belong to the domain or it must
- be computed with other processor ---*/
- Domain = true;
- Boundary = false;
- SolidBoundary = false;
- PhysicalBoundary = false;
- PeriodicBoundary = false;
-
- /*--- Set the color for mesh partitioning ---*/
- color = 0;
-
- /*--- Set the global index in the parallel simulation ---*/
- GlobalIndex = val_globalindex;
+ Vertex.resize(npoint);
/*--- For smoothing the numerical grid coordinates ---*/
if (config->GetSmoothNumGrid()) {
- Coord_Old = new su2double[nDim];
- Coord_Sum = new su2double[nDim];
+ Coord_Old.resize(npoint,nDim) = su2double(0.0);
+ Coord_Sum.resize(npoint,nDim) = su2double(0.0);
}
- /* A grid is defined as dynamic if there's rigid grid movement or grid deformation AND the problem is time domain */
- bool dynamic_grid = config->GetDynamic_Grid();
-
- /*--- Grid velocity gradients are only needed for the continuous adjoint ---*/
- bool continuous_adjoint = (config->GetKind_Solver() == ADJ_EULER ||
- config->GetKind_Solver() == ADJ_NAVIER_STOKES ||
- config->GetKind_Solver() == ADJ_RANS);
-
- /*--- Storage of grid velocities for dynamic meshes ---*/
-
- if (dynamic_grid) {
- GridVel = new su2double[nDim];
- for (iDim = 0; iDim < nDim; iDim ++)
- GridVel[iDim] = 0.0;
-
- if (continuous_adjoint){
- /*--- Gradient of the grid velocity ---*/
- GridVel_Grad = new su2double*[nDim];
- for (iDim = 0; iDim < nDim; iDim++) {
- GridVel_Grad[iDim] = new su2double[nDim];
- for (jDim = 0; jDim < nDim; jDim++)
- GridVel_Grad[iDim][jDim] = 0.0;
- }
- }
+ /*--- Storage of grid velocities for dynamic meshes. ---*/
+
+ if (config->GetDynamic_Grid()) {
+ GridVel.resize(npoint,nDim) = su2double(0.0);
+
+ /*--- Grid velocity gradients are needed for the continuous adjoint. ---*/
+ if (config->GetContinuous_Adjoint())
+ GridVel_Grad.resize(npoint,nDim,nDim,0.0);
/*--- Structures for storing old node coordinates for computing grid
- velocities via finite differencing with dynamically deforming meshes. ---*/
- /*--- In the case of deformable mesh solver, these coordinates are stored as solutions to the mesh problem ---*/
- if ( config->GetGrid_Movement() && (config->GetTime_Marching() != NO)) {
- Coord_p1 = new su2double[nDim];
- Coord_n = new su2double[nDim];
- Coord_n1 = new su2double[nDim];
- Coord_Old = new su2double[nDim];
- for (iDim = 0; iDim < nDim; iDim ++) {
- Coord_p1[iDim] = Coord[iDim];
- Coord_n[iDim] = Coord[iDim];
- Coord_n1[iDim] = Coord[iDim];
- }
+ * velocities via finite differencing with dynamically deforming meshes. ---*/
+ /*--- In the case of CMeshSolver, these coordinates are stored as solutions to the mesh problem. ---*/
+ if (config->GetGrid_Movement() && (config->GetTime_Marching() != NO)) {
+ Coord_n.resize(npoint,nDim) = su2double(0.0);
+ Coord_p1.resize(npoint,nDim) = su2double(0.0);
+ Coord_n1.resize(npoint,nDim) = su2double(0.0);
+ if (Coord_Old.empty()) Coord_Old.resize(npoint,nDim) = su2double(0.0);
}
}
- /*--- Intialize the value of the curvature ---*/
- Curvature = 0.0;
-
- /*--- Intialize the value of the periodic volume. ---*/
- Periodic_Volume = 0.0;
+ /*--- Other geometric properties of the CV's required by numerical methods. ---*/
+ nNeighbor.resize(npoint) = 0;
+ MaxLength.resize(npoint) = su2double(0.0);
+ Curvature.resize(npoint) = su2double(0.0);
+ Wall_Distance.resize(npoint) = su2double(0.0);
+ SharpEdge_Distance.resize(npoint) = su2double(0.0);
}
-CPoint::~CPoint() {
-
- if (Vertex != NULL && Boundary) delete[] Vertex;
- if (Volume != NULL) delete[] Volume;
- if (Coord != NULL) delete[] Coord;
- if (Coord_Old != NULL) delete[] Coord_Old;
- if (Coord_Sum != NULL) delete[] Coord_Sum;
- if (Coord_n != NULL) delete[] Coord_n;
- if (Coord_n1 != NULL) delete[] Coord_n1;
- if (Coord_p1 != NULL) delete[] Coord_p1;
- if (GridVel != NULL) delete[] GridVel;
- if (GridVel_Grad != NULL) {
- for (unsigned short iDim = 0; iDim < nDim; iDim++)
- delete [] GridVel_Grad[iDim];
- delete [] GridVel_Grad;
- }
- if (AD_InputIndex != NULL) delete[] AD_InputIndex;
- if (AD_OutputIndex != NULL) delete[] AD_OutputIndex;
- }
-
-void CPoint::SetPoint(unsigned long val_point) {
-
- unsigned short iPoint;
- bool new_point;
-
- /*--- Look for the point in the list ---*/
- new_point = true;
- for (iPoint = 0; iPoint < GetnPoint(); iPoint++)
- if (Point[iPoint] == val_point) {
- new_point = false;
- break;
- }
-
- /*--- Store the point structure and dimensionalizate edge structure ---*/
- if (new_point) {
- Point.push_back(val_point);
- Edge.push_back(-1);
- nPoint = Point.size();
- }
+void CPoint::SetElems(const vector >& elemsMatrix) {
+ Elem = CCompressedSparsePatternL(elemsMatrix);
}
-void CPoint::SetBoundary(unsigned short val_nmarker) {
-
- unsigned short imarker;
-
- /*--- To be sure that we are not goint to initializate twice the same vertex ---*/
- if (!Boundary) {
- Vertex = new long[val_nmarker];
-
- /*--- The initialization is made with -1 ---*/
- for (imarker = 0; imarker < val_nmarker; imarker++)
- Vertex[imarker] = -1;
- }
- Boundary = true;
+void CPoint::SetPoints(const vector >& pointsMatrix) {
+ Point = CCompressedSparsePatternUL(pointsMatrix);
+ Edge = CCompressedSparsePatternL(Point.outerPtr(), Point.outerPtr()+Point.getOuterSize()+1, long(-1));
}
-void CPoint::SetIndex(bool input) {
- for (unsigned short iDim = 0; iDim < nDim; iDim++) {
+void CPoint::SetIndex(unsigned long iPoint, bool input) {
+ for (unsigned long iDim = 0; iDim < nDim; iDim++) {
if(input) {
- AD::SetIndex(AD_InputIndex[iDim], Coord[iDim]);
+ AD::SetIndex(AD_InputIndex(iPoint,iDim), Coord(iPoint,iDim));
}
else {
- AD::SetIndex(AD_OutputIndex[iDim], Coord[iDim]);
+ AD::SetIndex(AD_OutputIndex(iPoint,iDim), Coord(iPoint,iDim));
}
}
}
-void CPoint::SetAdjointSolution(const su2double *adj_sol) {
- for (unsigned short iDim = 0; iDim < nDim; iDim++) {
- AD::SetDerivative(AD_OutputIndex[iDim], SU2_TYPE::GetValue(adj_sol[iDim]));
- }
+void CPoint::SetVolume_n() {
+ assert(Volume_n.size() == Volume.size());
+ parallelCopy(Volume.size(), Volume.data(), Volume_n.data());
+}
+
+void CPoint::SetVolume_nM1() {
+ assert(Volume_nM1.size() == Volume_n.size());
+ parallelCopy(Volume_n.size(), Volume_n.data(), Volume_nM1.data());
}
-su2double CPoint::GetAdjointSolution(unsigned short iDim) const {
- return AD::GetDerivative(AD_InputIndex[iDim]);
+void CPoint::SetCoord_n() {
+ assert(Coord_n.size() == Coord.size());
+ parallelCopy(Coord.size(), Coord.data(), Coord_n.data());
}
+
+void CPoint::SetCoord_n1() {
+ assert(Coord_n1.size() == Coord_n.size());
+ parallelCopy(Coord_n.size(), Coord_n.data(), Coord_n1.data());
+}
+
+void CPoint::SetCoord_Old() {
+ assert(Coord_Old.size() == Coord.size());
+ parallelCopy(Coord.size(), Coord.data(), Coord_Old.data());
+}
+
+void CPoint::SetCoord_SumZero() { parallelSet(Coord_Sum.size(), 0.0, Coord_Sum.data()); }
diff --git a/Common/src/geometry_structure_fem_part.cpp b/Common/src/geometry_structure_fem_part.cpp
index 43d1a1e02c98..e3c1f65f7fdc 100644
--- a/Common/src/geometry_structure_fem_part.cpp
+++ b/Common/src/geometry_structure_fem_part.cpp
@@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
- * The SU2 Project is maintained by the SU2 Foundation
+ * The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md)
@@ -584,7 +584,7 @@ void CPhysicalGeometry::Read_SU2_Format_Parallel_FEM(CConfig *config,
/*--- Allocate the memory for the coordinates to be stored on this rank. ---*/
nPoint = nodeIDsElemLoc.size();
nPointNode = nPoint;
- node = new CPoint*[nPoint];
+ nodes = new CPoint(nPoint, nDim);
/*--- Open the grid file again and go to the position where
the correct zone is stored. ---*/
@@ -618,24 +618,13 @@ void CPhysicalGeometry::Read_SU2_Format_Parallel_FEM(CConfig *config,
if( binary_search(nodeIDsElemLoc.begin(), nodeIDsElemLoc.end(), i) ) {
istringstream point_line(text_line);
-
- switch(nDim) {
- case 2: {
- su2double Coord_2D[2];
- point_line >> Coord_2D[0]; point_line >> Coord_2D[1];
- node[ii] = new CPoint(Coord_2D[0], Coord_2D[1], i, config);
- ii++;
- break;
- }
-
- case 3: {
- su2double Coord_3D[3];
- point_line >> Coord_3D[0]; point_line >> Coord_3D[1]; point_line >> Coord_3D[2];
- node[ii] = new CPoint(Coord_3D[0], Coord_3D[1], Coord_3D[2], i, config);
- ii++;
- break;
- }
- }
+ su2double Coord[3] = {0.0};
+ point_line >> Coord[0];
+ point_line >> Coord[1];
+ if (nDim==3) point_line >> Coord[2];
+ nodes->SetCoord(ii, Coord);
+ nodes->SetGlobalIndex(ii, i);
+ ++ii;
}
}
@@ -1159,7 +1148,7 @@ void CPhysicalGeometry::Read_CGNS_Format_Parallel_FEM(CConfig *config,
/*--- Allocate the memory for the coordinates to be stored on this rank. ---*/
nPoint = nodeIDsElemLoc.size();
nPointNode = nPoint;
- node = new CPoint*[nPoint];
+ nodes = new CPoint(nPoint, nDim);
/*--- Store the global ID's of the nodes in such a way that they can
be sent to the rank that actually stores the coordinates.. ---*/
@@ -1274,28 +1263,12 @@ void CPhysicalGeometry::Read_CGNS_Format_Parallel_FEM(CConfig *config,
This data is created by taking the offset of the source rank into
account. In this way the nodes are numbered with increading
global node ID. ---*/
- switch ( nDim ) {
- case 2: {
- for(unsigned long j=0; jSetCoord(kk, &coorRecvBuf[jj]);
+ nodes->SetGlobalIndex(kk, nodeBuf[source][j]);
}
}
@@ -1312,21 +1285,12 @@ void CPhysicalGeometry::Read_CGNS_Format_Parallel_FEM(CConfig *config,
number of points equals the local number of points. ---*/
nPoint = Global_nPoint;
nPointNode = nPoint;
- node = new CPoint*[nPoint];
-
- switch(nDim) {
- case 2: {
- for(unsigned long i=0; iSetCoord(i, iDim, coorBuf[iDim][i]);
+ nodes->SetGlobalIndex(i, i);
}
#endif
@@ -2769,7 +2733,7 @@ void CPhysicalGeometry::DeterminePeriodicFacesFEMGrid(CConfig *co
of the points. ---*/
map globalPointIDToLocalInd;
for(unsigned i=0; iGetGlobalIndex()] = i;
+ globalPointIDToLocalInd[nodes->GetGlobalIndex(i)] = i;
}
/*--- Loop over the number of markers present in the grid and check for a periodic one. ---*/
@@ -2856,7 +2820,7 @@ void CPhysicalGeometry::DeterminePeriodicFacesFEMGrid(CConfig *co
unsigned long ind = MI->second;
for(unsigned l=0; lGetCoord(l);
+ facesDonor[k].cornerCoor[j][l] = nodes->GetCoord(ind, l);
}
/*--- Create the tolerance for this face and sort the coordinates. ---*/
@@ -3038,7 +3002,7 @@ void CPhysicalGeometry::DeterminePeriodicFacesFEMGrid(CConfig *co
map::const_iterator MI;
MI = globalPointIDToLocalInd.find(faceConn[0][j]);
unsigned long ind = MI->second;
- const su2double *coor = node[ind]->GetCoord();
+ const su2double *coor = nodes->GetCoord(ind);
const su2double dx = coor[0] - center[0];
const su2double dy = coor[1] - center[1];
@@ -3083,7 +3047,7 @@ void CPhysicalGeometry::DetermineFEMConstantJacobiansAndLenScale(CConfig *config
of the points. ---*/
map globalPointIDToLocalInd;
for(unsigned long i=0; iGetGlobalIndex()] = i;
+ globalPointIDToLocalInd[nodes->GetGlobalIndex(i)] = i;
}
/*--- Define the vectors to store the standard elements for the volume elements
@@ -3135,7 +3099,7 @@ void CPhysicalGeometry::DetermineFEMConstantJacobiansAndLenScale(CConfig *config
map::const_iterator MI = globalPointIDToLocalInd.find(nodeID);
unsigned long ind = MI->second;
for(unsigned short k=0; kGetCoord(k);
+ vecRHS[jj] = nodes->GetCoord(ind, k);
}
/*--- Get the pointer to the matrix storage of the basis functions and its
@@ -3414,7 +3378,7 @@ void CPhysicalGeometry::DetermineDonorElementsWallFunctions(CConfig *config) {
of the points. */
map globalPointIDToLocalInd;
for(unsigned long i=0; iGetGlobalIndex()] = i;
+ globalPointIDToLocalInd[nodes->GetGlobalIndex(i)] = i;
}
/* Define the vector to store the standard element for the volume elements. */
@@ -3497,7 +3461,7 @@ void CPhysicalGeometry::DetermineDonorElementsWallFunctions(CConfig *config) {
unsigned long jj = 0;
for(unsigned long l=0; lGetCoord(k);
+ volCoor[jj] = nodes->GetCoord(l, k);
}
/* Build the local ADT. */
@@ -3658,7 +3622,7 @@ void CPhysicalGeometry::DetermineDonorElementsWallFunctions(CConfig *config) {
MI = globalPointIDToLocalInd.find(nodeID);
nodeID = MI->second;
for(unsigned short k=0; kGetCoord(k);
+ coorBoundFace[ii] = nodes->GetCoord(nodeID, k);
}
/* Set the multiplication factor for the normal, such that
diff --git a/Common/src/grid_adaptation_structure.cpp b/Common/src/grid_adaptation_structure.cpp
index dd936eda15f5..d05c48c3e1d0 100644
--- a/Common/src/grid_adaptation_structure.cpp
+++ b/Common/src/grid_adaptation_structure.cpp
@@ -42,211 +42,211 @@ CGridAdaptation::CGridAdaptation(CGeometry *geometry, CConfig *config) {
size = SU2_MPI::GetSize();
rank = SU2_MPI::GetRank();
- unsigned long iPoint;
-
- nDim = geometry->GetnDim();
-
- switch (config->GetKind_Solver()) {
-
- default:
- nVar = geometry->GetnDim()+2;
- break;
- }
-
- ConsVar_Sol = new su2double* [geometry->GetnPoint()];
- AdjVar_Sol = new su2double* [geometry->GetnPoint()];
- LinVar_Sol = new su2double* [geometry->GetnPoint()];
- ConsVar_Res = new su2double* [geometry->GetnPoint()];
- AdjVar_Res = new su2double* [geometry->GetnPoint()];
- LinVar_Res = new su2double* [geometry->GetnPoint()];
- Gradient = new su2double* [geometry->GetnPoint()];
- Gradient_Flow = new su2double* [geometry->GetnPoint()];
- Gradient_Adj = new su2double* [geometry->GetnPoint()];
-
- Index = new su2double [geometry->GetnPoint()];
-
- for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++) {
- ConsVar_Sol[iPoint] = new su2double [nVar];
- AdjVar_Sol[iPoint] = new su2double [nVar];
- LinVar_Sol[iPoint] = new su2double [nVar];
- ConsVar_Res[iPoint] = new su2double [nVar];
- LinVar_Res[iPoint] = new su2double [nVar];
- AdjVar_Res[iPoint] = new su2double [nVar];
- Gradient[iPoint] = new su2double [nDim];
- Gradient_Flow[iPoint] = new su2double [nDim];
- Gradient_Adj[iPoint] = new su2double [nDim];
- }
+ unsigned long iPoint;
+
+ nDim = geometry->GetnDim();
+
+ switch (config->GetKind_Solver()) {
+
+ default:
+ nVar = geometry->GetnDim()+2;
+ break;
+ }
+
+ ConsVar_Sol = new su2double* [geometry->GetnPoint()];
+ AdjVar_Sol = new su2double* [geometry->GetnPoint()];
+ LinVar_Sol = new su2double* [geometry->GetnPoint()];
+ ConsVar_Res = new su2double* [geometry->GetnPoint()];
+ AdjVar_Res = new su2double* [geometry->GetnPoint()];
+ LinVar_Res = new su2double* [geometry->GetnPoint()];
+ Gradient = new su2double* [geometry->GetnPoint()];
+ Gradient_Flow = new su2double* [geometry->GetnPoint()];
+ Gradient_Adj = new su2double* [geometry->GetnPoint()];
+
+ Index = new su2double [geometry->GetnPoint()];
+
+ for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++) {
+ ConsVar_Sol[iPoint] = new su2double [nVar];
+ AdjVar_Sol[iPoint] = new su2double [nVar];
+ LinVar_Sol[iPoint] = new su2double [nVar];
+ ConsVar_Res[iPoint] = new su2double [nVar];
+ LinVar_Res[iPoint] = new su2double [nVar];
+ AdjVar_Res[iPoint] = new su2double [nVar];
+ Gradient[iPoint] = new su2double [nDim];
+ Gradient_Flow[iPoint] = new su2double [nDim];
+ Gradient_Adj[iPoint] = new su2double [nDim];
+ }
}
CGridAdaptation::~CGridAdaptation(void) {
- unsigned short iVar, iDim;
-
- for (iVar = 0; iVar < nVar; iVar++) {
- delete [] ConsVar_Adapt[iVar];
- delete [] ConsVar_Sol[iVar];
- delete [] ConsVar_Res[iVar];
- delete [] AdjVar_Adapt[iVar];
- delete [] AdjVar_Sol[iVar];
- delete [] AdjVar_Res[iVar];
- delete [] LinVar_Adapt[iVar];
- delete [] LinVar_Sol[iVar];
- delete [] LinVar_Res[iVar];
- }
-
- for (iDim = 0; iDim < nDim; iDim++) {
- delete [] Gradient[iDim];
- delete [] Gradient_Flow[iDim];
- delete [] Gradient_Adj[iDim];
- }
- delete [] ConsVar_Adapt;
- delete [] ConsVar_Sol;
- delete [] ConsVar_Res;
- delete [] AdjVar_Adapt;
- delete [] AdjVar_Sol;
- delete [] AdjVar_Res;
- delete [] LinVar_Adapt;
- delete [] LinVar_Sol;
- delete [] LinVar_Res;
- delete [] Gradient;
- delete [] Gradient_Flow;
- delete [] Gradient_Adj;
- delete [] Index;
+ unsigned short iVar, iDim;
+
+ for (iVar = 0; iVar < nVar; iVar++) {
+ delete [] ConsVar_Adapt[iVar];
+ delete [] ConsVar_Sol[iVar];
+ delete [] ConsVar_Res[iVar];
+ delete [] AdjVar_Adapt[iVar];
+ delete [] AdjVar_Sol[iVar];
+ delete [] AdjVar_Res[iVar];
+ delete [] LinVar_Adapt[iVar];
+ delete [] LinVar_Sol[iVar];
+ delete [] LinVar_Res[iVar];
+ }
+
+ for (iDim = 0; iDim < nDim; iDim++) {
+ delete [] Gradient[iDim];
+ delete [] Gradient_Flow[iDim];
+ delete [] Gradient_Adj[iDim];
+ }
+ delete [] ConsVar_Adapt;
+ delete [] ConsVar_Sol;
+ delete [] ConsVar_Res;
+ delete [] AdjVar_Adapt;
+ delete [] AdjVar_Sol;
+ delete [] AdjVar_Res;
+ delete [] LinVar_Adapt;
+ delete [] LinVar_Sol;
+ delete [] LinVar_Res;
+ delete [] Gradient;
+ delete [] Gradient_Flow;
+ delete [] Gradient_Adj;
+ delete [] Index;
}
void CGridAdaptation::GetFlowSolution(CGeometry *geometry, CConfig *config) {
- unsigned long iPoint, index;
- unsigned short iVar;
+ unsigned long iPoint, index;
+ unsigned short iVar;
su2double dummy;
- string text_line;
+ string text_line;
- string mesh_filename = config->GetSolution_FileName();
- ifstream restart_file;
+ string mesh_filename = config->GetSolution_FileName();
+ ifstream restart_file;
- char *cstr = new char [mesh_filename.size()+1];
+ char *cstr = new char [mesh_filename.size()+1];
- strcpy (cstr, mesh_filename.c_str());
- restart_file.open(cstr, ios::in);
- if (restart_file.fail()) {
+ strcpy (cstr, mesh_filename.c_str());
+ restart_file.open(cstr, ios::in);
+ if (restart_file.fail()) {
SU2_MPI::Error("There is no flow restart file!!", CURRENT_FUNCTION);
}
/*--- Read the header of the file ---*/
getline(restart_file, text_line);
- for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) {
- getline(restart_file, text_line);
- istringstream point_line(text_line);
+ for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) {
+ getline(restart_file, text_line);
+ istringstream point_line(text_line);
- point_line >> index;
+ point_line >> index;
if (nDim == 2) point_line >> dummy >> dummy;
else point_line >> dummy >> dummy >> dummy;
- for (iVar = 0; iVar < nVar; iVar ++)
- point_line >> ConsVar_Sol[iPoint][iVar];
- }
- restart_file.close();
+ for (iVar = 0; iVar < nVar; iVar ++)
+ point_line >> ConsVar_Sol[iPoint][iVar];
+ }
+ restart_file.close();
}
void CGridAdaptation::GetFlowResidual(CGeometry *geometry, CConfig *config) {
- unsigned long iPoint, index;
- unsigned short iVar;
+ unsigned long iPoint, index;
+ unsigned short iVar;
-// su2double dummy[5];
- su2double dummy;
- string text_line;
+// su2double dummy[5];
+ su2double dummy;
+ string text_line;
- string mesh_filename = config->GetSolution_FileName();
- ifstream restart_file;
+ string mesh_filename = config->GetSolution_FileName();
+ ifstream restart_file;
- char *cstr = new char [mesh_filename.size()+1];
+ char *cstr = new char [mesh_filename.size()+1];
- strcpy (cstr, mesh_filename.c_str());
- restart_file.open(cstr, ios::in);
- if (restart_file.fail()) {
+ strcpy (cstr, mesh_filename.c_str());
+ restart_file.open(cstr, ios::in);
+ if (restart_file.fail()) {
SU2_MPI::Error(string("There is no flow restart file ") + mesh_filename, CURRENT_FUNCTION );
}
/*--- Read the header of the file ---*/
getline(restart_file, text_line);
- for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) {
- getline(restart_file, text_line);
- istringstream point_line(text_line);
+ for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) {
+ getline(restart_file, text_line);
+ istringstream point_line(text_line);
point_line >> index;
if (nDim == 2) point_line >> dummy >> dummy;
else point_line >> dummy >> dummy >> dummy;
- for (iVar = 0; iVar < nVar; iVar++)
- point_line >> dummy;
- for (iVar = 0; iVar < nVar; iVar++)
- point_line >> ConsVar_Res[iPoint][iVar];
- }
- restart_file.close();
+ for (iVar = 0; iVar < nVar; iVar++)
+ point_line >> dummy;
+ for (iVar = 0; iVar < nVar; iVar++)
+ point_line >> ConsVar_Res[iPoint][iVar];
+ }
+ restart_file.close();
}
void CGridAdaptation::GetAdjSolution(CGeometry *geometry, CConfig *config) {
- unsigned long iPoint, index;
- unsigned short iVar;
+ unsigned long iPoint, index;
+ unsigned short iVar;
su2double dummy;
- string text_line;
+ string text_line;
- string copy, mesh_filename;
- ifstream restart_file;
+ string copy, mesh_filename;
+ ifstream restart_file;
/*--- Get the adjoint solution file name ---*/
- mesh_filename = config->GetSolution_AdjFileName();
+ mesh_filename = config->GetSolution_AdjFileName();
mesh_filename = config->GetObjFunc_Extension(mesh_filename);
- restart_file.open(mesh_filename.c_str(), ios::in);
- if (restart_file.fail()) {
+ restart_file.open(mesh_filename.c_str(), ios::in);
+ if (restart_file.fail()) {
SU2_MPI::Error(string("There is no adjoint restart file ") + mesh_filename, CURRENT_FUNCTION );
}
/*--- Read the header of the file ---*/
getline(restart_file, text_line);
- for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) {
- getline(restart_file, text_line);
- istringstream point_line(text_line);
+ for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) {
+ getline(restart_file, text_line);
+ istringstream point_line(text_line);
point_line >> index;
if (nDim == 2) point_line >> dummy >> dummy;
else point_line >> dummy >> dummy >> dummy;
- for (iVar = 0; iVar < nVar; iVar ++)
- point_line >> AdjVar_Sol[iPoint][iVar];
- }
+ for (iVar = 0; iVar < nVar; iVar ++)
+ point_line >> AdjVar_Sol[iPoint][iVar];
+ }
- restart_file.close();
+ restart_file.close();
}
void CGridAdaptation::GetAdjResidual(CGeometry *geometry, CConfig *config) {
- unsigned long iPoint, index;
- string text_line;
- su2double dummy;
+ unsigned long iPoint, index;
+ string text_line;
+ su2double dummy;
- string mesh_filename, copy;
- ifstream restart_file;
+ string mesh_filename, copy;
+ ifstream restart_file;
- char buffer[50], cstr[MAX_STRING_SIZE];
- mesh_filename = config->GetSolution_AdjFileName();
- copy.assign(mesh_filename);
+ char buffer[50], cstr[MAX_STRING_SIZE];
+ mesh_filename = config->GetSolution_AdjFileName();
+ copy.assign(mesh_filename);
unsigned short lastindex = copy.find_last_of(".");
copy = copy.substr(0, lastindex);
- strcpy (cstr, copy.c_str());
- if (config->GetnObj() > 1) {
- SPRINTF (buffer, "_combo.dat");
- }
- else {
+ strcpy (cstr, copy.c_str());
+ if (config->GetnObj() > 1) {
+ SPRINTF (buffer, "_combo.dat");
+ }
+ else {
if (config->GetKind_ObjFunc() == DRAG_COEFFICIENT) SPRINTF (buffer, "_cd.dat");
if (config->GetKind_ObjFunc() == LIFT_COEFFICIENT) SPRINTF (buffer, "_cl.dat");
if (config->GetKind_ObjFunc() == SIDEFORCE_COEFFICIENT) SPRINTF (buffer, "_csf.dat");
@@ -266,3003 +266,3011 @@ void CGridAdaptation::GetAdjResidual(CGeometry *geometry, CConfig *config) {
if (config->GetKind_ObjFunc() == SURFACE_MASSFLOW) SPRINTF (buffer, "_mfr.dat");
if (config->GetKind_ObjFunc() == SURFACE_MACH) SPRINTF (buffer, "_mach.dat");
if (config->GetKind_ObjFunc() == CUSTOM_OBJFUNC) SPRINTF (buffer, "_custom.dat");
- }
+ }
- strcat(cstr, buffer);
+ strcat(cstr, buffer);
- restart_file.open(cstr, ios::in);
+ restart_file.open(cstr, ios::in);
- if (restart_file.fail()) {
- if (rank == MASTER_NODE)
+ if (restart_file.fail()) {
+ if (rank == MASTER_NODE)
SU2_MPI::Error(string("There is no flow restart file ") + mesh_filename, CURRENT_FUNCTION );
}
- for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) {
- getline(restart_file, text_line);
- istringstream point_line(text_line);
+ for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) {
+ getline(restart_file, text_line);
+ istringstream point_line(text_line);
point_line >> index;
if (nDim == 2) point_line >> dummy >> dummy;
else point_line >> dummy >> dummy >> dummy;
- if (nVar == 1) point_line >> dummy >> AdjVar_Res[iPoint][0];
- if (nVar == 4) point_line >> dummy >> dummy >> dummy >> dummy >>
- AdjVar_Res[iPoint][0] >> AdjVar_Res[iPoint][1] >> AdjVar_Res[iPoint][2] >>
- AdjVar_Res[iPoint][3];
- if (nVar == 5) point_line >> dummy >> dummy >> dummy >> dummy >> dummy >>
- AdjVar_Res[iPoint][0] >> AdjVar_Res[iPoint][1] >> AdjVar_Res[iPoint][2] >>
- AdjVar_Res[iPoint][3] >> AdjVar_Res[iPoint][4];
- }
- restart_file.close();
+ if (nVar == 1) point_line >> dummy >> AdjVar_Res[iPoint][0];
+ if (nVar == 4) point_line >> dummy >> dummy >> dummy >> dummy >>
+ AdjVar_Res[iPoint][0] >> AdjVar_Res[iPoint][1] >> AdjVar_Res[iPoint][2] >>
+ AdjVar_Res[iPoint][3];
+ if (nVar == 5) point_line >> dummy >> dummy >> dummy >> dummy >> dummy >>
+ AdjVar_Res[iPoint][0] >> AdjVar_Res[iPoint][1] >> AdjVar_Res[iPoint][2] >>
+ AdjVar_Res[iPoint][3] >> AdjVar_Res[iPoint][4];
+ }
+ restart_file.close();
}
void CGridAdaptation::SetComplete_Refinement(CGeometry *geometry, unsigned short strength) {
- unsigned long iElem;
+ unsigned long iElem;
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- geometry->elem[iElem]->SetDivide (true);
- }
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ geometry->elem[iElem]->SetDivide (true);
+ }
}
void CGridAdaptation::SetNo_Refinement(CGeometry *geometry, unsigned short strength) {
- unsigned long iElem;
+ unsigned long iElem;
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- geometry->elem[iElem]->SetDivide (false);
- }
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ geometry->elem[iElem]->SetDivide (false);
+ }
}
void CGridAdaptation::SetWake_Refinement(CGeometry *geometry, unsigned short strength) {
- unsigned long iElem, iPoint;
- unsigned short iNode;
- su2double Coordx, Coordy, dist, wake = 0.5;
-
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++)
- for (iNode = 0; iNode < geometry->elem[iElem]->GetnNodes(); iNode++) {
- iPoint = geometry->elem[iElem]->GetNode(iNode);
- Coordx = geometry->node[iPoint]->GetCoord(0);
- Coordy = geometry->node[iPoint]->GetCoord(1);
- dist = sqrt(Coordx*Coordx+Coordy*Coordy);
- if (dist < wake) {
- geometry->elem[iElem]->SetDivide (true);
- }
- if ((Coordx > 0) && ((Coordy > -wake) && (Coordy < wake))) {
- geometry->elem[iElem]->SetDivide (true);
- }
- }
+ unsigned long iElem, iPoint;
+ unsigned short iNode;
+ su2double Coordx, Coordy, dist, wake = 0.5;
+
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++)
+ for (iNode = 0; iNode < geometry->elem[iElem]->GetnNodes(); iNode++) {
+ iPoint = geometry->elem[iElem]->GetNode(iNode);
+ Coordx = geometry->nodes->GetCoord(iPoint, 0);
+ Coordy = geometry->nodes->GetCoord(iPoint, 1);
+ dist = sqrt(Coordx*Coordx+Coordy*Coordy);
+ if (dist < wake) {
+ geometry->elem[iElem]->SetDivide (true);
+ }
+ if ((Coordx > 0) && ((Coordy > -wake) && (Coordy < wake))) {
+ geometry->elem[iElem]->SetDivide (true);
+ }
+ }
}
void CGridAdaptation::SetSupShock_Refinement(CGeometry *geometry, CConfig *config) {
- unsigned long iElem, iPoint;
- unsigned short iNode;
- su2double Coordx, Coordy;
- su2double mu_1 = asin(1/config->GetMach()-0.1);
- su2double mu_2 = asin(1/(config->GetMach()-0.7));
-
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++)
- for (iNode = 0; iNode < geometry->elem[iElem]->GetnNodes(); iNode++) {
- iPoint = geometry->elem[iElem]->GetNode(iNode);
- Coordx = geometry->node[iPoint]->GetCoord(0);
- Coordy = geometry->node[iPoint]->GetCoord(1);
- if (Coordy < 0.0)
- if ((Coordx > fabs(Coordy/tan(mu_2))-0.25) && (Coordx < fabs(Coordy/tan(mu_1))+1.25)) {
- geometry->elem[iElem]->SetDivide (true);
- }
- }
+ unsigned long iElem, iPoint;
+ unsigned short iNode;
+ su2double Coordx, Coordy;
+ su2double mu_1 = asin(1/config->GetMach()-0.1);
+ su2double mu_2 = asin(1/(config->GetMach()-0.7));
+
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++)
+ for (iNode = 0; iNode < geometry->elem[iElem]->GetnNodes(); iNode++) {
+ iPoint = geometry->elem[iElem]->GetNode(iNode);
+ Coordx = geometry->nodes->GetCoord(iPoint, 0);
+ Coordy = geometry->nodes->GetCoord(iPoint, 1);
+ if (Coordy < 0.0)
+ if ((Coordx > fabs(Coordy/tan(mu_2))-0.25) && (Coordx < fabs(Coordy/tan(mu_1))+1.25)) {
+ geometry->elem[iElem]->SetDivide (true);
+ }
+ }
}
long CGridAdaptation::CheckRectCode(bool *AdaptCode) {
- int Code = -1;
+ int Code = -1;
- // Default
+ // Default
- if ((AdaptCode[0] == true) || (AdaptCode[1] == true) || (AdaptCode[2] == true) || (AdaptCode[3] == true)) { Code = 0; }
+ if ((AdaptCode[0] == true) || (AdaptCode[1] == true) || (AdaptCode[2] == true) || (AdaptCode[3] == true)) { Code = 0; }
- // Combination 1:4
+ // Combination 1:4
- if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == true)) {Code = 1; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == true)) {Code = 1; return Code;}
- // Combination 1:2
+ // Combination 1:2
- if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == true) && (AdaptCode[3] == false)) {Code = 2; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == true) && (AdaptCode[3] == false)) {Code = 2; return Code;}
- if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == false) && (AdaptCode[3] == true)) {Code = 3; return Code;}
+ if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == false) && (AdaptCode[3] == true)) {Code = 3; return Code;}
- return Code;
+ return Code;
}
long CGridAdaptation::CheckRectExtCode(bool *AdaptCode) {
- int Code = -1;
+ int Code = -1;
- if ((AdaptCode[0] == true) || (AdaptCode[1] == true) || (AdaptCode[2] == true) || (AdaptCode[3] == true)) {Code = 0;}
+ if ((AdaptCode[0] == true) || (AdaptCode[1] == true) || (AdaptCode[2] == true) || (AdaptCode[3] == true)) {Code = 0;}
- // Combination 1R -> 3T
+ // Combination 1R -> 3T
- if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == false) && (AdaptCode[3] == false)) {Code = 2; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == false) && (AdaptCode[3] == false)) {Code = 2; return Code;}
- if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == false) && (AdaptCode[3] == false)) {Code = 3; return Code;}
+ if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == false) && (AdaptCode[3] == false)) {Code = 3; return Code;}
- if ((AdaptCode[0] == false) && (AdaptCode[1] == false) && (AdaptCode[2] == true) && (AdaptCode[3] == false)) {Code = 4; return Code;}
+ if ((AdaptCode[0] == false) && (AdaptCode[1] == false) && (AdaptCode[2] == true) && (AdaptCode[3] == false)) {Code = 4; return Code;}
- if ((AdaptCode[0] == false) && (AdaptCode[1] == false) && (AdaptCode[2] == false) && (AdaptCode[3] == true)) {Code = 5; return Code;}
+ if ((AdaptCode[0] == false) && (AdaptCode[1] == false) && (AdaptCode[2] == false) && (AdaptCode[3] == true)) {Code = 5; return Code;}
- // Combination 1R -> 4T
+ // Combination 1R -> 4T
- if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == false) && (AdaptCode[3] == false)) {Code = 6; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == false) && (AdaptCode[3] == false)) {Code = 6; return Code;}
- if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == false)) {Code = 7; return Code;}
+ if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == false)) {Code = 7; return Code;}
- if ((AdaptCode[0] == false) && (AdaptCode[1] == false) && (AdaptCode[2] == true) && (AdaptCode[3] == true)) {Code = 8; return Code;}
+ if ((AdaptCode[0] == false) && (AdaptCode[1] == false) && (AdaptCode[2] == true) && (AdaptCode[3] == true)) {Code = 8; return Code;}
- if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == false) && (AdaptCode[3] == true)) {Code = 9; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == false) && (AdaptCode[3] == true)) {Code = 9; return Code;}
- // Combination 1R -> 1R+3T
+ // Combination 1R -> 1R+3T
- if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == false)) {Code = 12; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == false)) {Code = 12; return Code;}
- if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == true)) {Code = 13; return Code;}
+ if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == true)) {Code = 13; return Code;}
- if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == true) && (AdaptCode[3] == true)) {Code = 14; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == true) && (AdaptCode[3] == true)) {Code = 14; return Code;}
- if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == false) && (AdaptCode[3] == true)) {Code = 15; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == false) && (AdaptCode[3] == true)) {Code = 15; return Code;}
- return Code;
+ return Code;
}
long CGridAdaptation::CheckTriangleCode(bool *AdaptCode) {
- int Code = -1;
+ int Code = -1;
- if ((AdaptCode[0] == true) || (AdaptCode[1] == true) || (AdaptCode[2] == true)) {Code = 0;}
+ if ((AdaptCode[0] == true) || (AdaptCode[1] == true) || (AdaptCode[2] == true)) {Code = 0;}
- // Combination 1T -> 3T
+ // Combination 1T -> 3T
- if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == true)) {Code = 1; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == true)) {Code = 1; return Code;}
- // Combination 1T -> 2T
+ // Combination 1T -> 2T
- if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == false)) {Code = 2; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == false)) {Code = 2; return Code;}
- if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == false)) {Code = 3; return Code;}
+ if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == false)) {Code = 3; return Code;}
- if ((AdaptCode[0] == false) && (AdaptCode[1] == false) && (AdaptCode[2] == true)) {Code = 4; return Code;}
+ if ((AdaptCode[0] == false) && (AdaptCode[1] == false) && (AdaptCode[2] == true)) {Code = 4; return Code;}
- // Combination 1T -> 1R+1T (2D) or 3T (3D)
+ // Combination 1T -> 1R+1T (2D) or 3T (3D)
- if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == false)) {Code = 5; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == false)) {Code = 5; return Code;}
- if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == true)) {Code = 6; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == true)) {Code = 6; return Code;}
- if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == true)) {Code = 7; return Code;}
+ if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == true)) {Code = 7; return Code;}
- return Code;
+ return Code;
}
long CGridAdaptation::CheckTetraCode(bool *AdaptCode) {
- int Code = -1;
- unsigned short nDivEdges, iVar;
+ int Code = -1;
+ unsigned short nDivEdges, iVar;
- // Default
+ // Default
- if ((AdaptCode[0] == true) || (AdaptCode[1] == true) || (AdaptCode[2] == true) || (AdaptCode[3] == true) || (AdaptCode[4] == true) ||
- (AdaptCode[5] == true) ) { Code = 0; }
+ if ((AdaptCode[0] == true) || (AdaptCode[1] == true) || (AdaptCode[2] == true) || (AdaptCode[3] == true) || (AdaptCode[4] == true) ||
+ (AdaptCode[5] == true) ) { Code = 0; }
- // Combination 1:8
+ // Combination 1:8
- if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == true) && (AdaptCode[4] == true) &&
- (AdaptCode[5] == true) ) {Code = 1; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == true) && (AdaptCode[4] == true) &&
+ (AdaptCode[5] == true) ) {Code = 1; return Code;}
- // Combination 1:4
+ // Combination 1:4
- if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == true) && (AdaptCode[3] == false) && (AdaptCode[4] == true) &&
- (AdaptCode[5] == false) ) {Code = 2; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == true) && (AdaptCode[3] == false) && (AdaptCode[4] == true) &&
+ (AdaptCode[5] == false) ) {Code = 2; return Code;}
- if ((AdaptCode[0] == false) && (AdaptCode[1] == false) && (AdaptCode[2] == false) && (AdaptCode[3] == true) && (AdaptCode[4] == true) &&
- (AdaptCode[5] == true) ) {Code = 3; return Code;}
+ if ((AdaptCode[0] == false) && (AdaptCode[1] == false) && (AdaptCode[2] == false) && (AdaptCode[3] == true) && (AdaptCode[4] == true) &&
+ (AdaptCode[5] == true) ) {Code = 3; return Code;}
- if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == false) && (AdaptCode[4] == false) &&
- (AdaptCode[5] == true) ) {Code = 4; return Code;}
+ if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == false) && (AdaptCode[4] == false) &&
+ (AdaptCode[5] == true) ) {Code = 4; return Code;}
- if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == false) && (AdaptCode[3] == true) && (AdaptCode[4] == false) &&
- (AdaptCode[5] == false) ) {Code = 5; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == false) && (AdaptCode[3] == true) && (AdaptCode[4] == false) &&
+ (AdaptCode[5] == false) ) {Code = 5; return Code;}
- // Combinations with 1, 2, and 3 (no regular) divided edges.
+ // Combinations with 1, 2, and 3 (no regular) divided edges.
- nDivEdges = 0;
- for (iVar = 0; iVar < 6; iVar ++)
- if (AdaptCode[iVar] == true) nDivEdges++;
+ nDivEdges = 0;
+ for (iVar = 0; iVar < 6; iVar ++)
+ if (AdaptCode[iVar] == true) nDivEdges++;
- if ((nDivEdges == 1) || (nDivEdges == 2) || (nDivEdges == 3)) {Code = 6; return Code;}
+ if ((nDivEdges == 1) || (nDivEdges == 2) || (nDivEdges == 3)) {Code = 6; return Code;}
- return Code;
+ return Code;
}
long CGridAdaptation::CheckHexaCode(bool *AdaptCode) {
- int Code = -1;
+ int Code = -1;
- // Default
+ // Default
- if ((AdaptCode[0] == true) || (AdaptCode[1] == true) || (AdaptCode[2] == true) || (AdaptCode[3] == true) || (AdaptCode[4] == true) ||
- (AdaptCode[5] == true) || (AdaptCode[6] == true) || (AdaptCode[7] == true) || (AdaptCode[8] == true) || (AdaptCode[9] == true) ||
- (AdaptCode[10] == true) || (AdaptCode[11] == true)) { Code = 0; }
+ if ((AdaptCode[0] == true) || (AdaptCode[1] == true) || (AdaptCode[2] == true) || (AdaptCode[3] == true) || (AdaptCode[4] == true) ||
+ (AdaptCode[5] == true) || (AdaptCode[6] == true) || (AdaptCode[7] == true) || (AdaptCode[8] == true) || (AdaptCode[9] == true) ||
+ (AdaptCode[10] == true) || (AdaptCode[11] == true)) { Code = 0; }
- // Combination 1:8
+ // Combination 1:8
- if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == true) && (AdaptCode[4] == true) &&
- (AdaptCode[5] == true) && (AdaptCode[6] == true) && (AdaptCode[7] == true) && (AdaptCode[8] == true) && (AdaptCode[9] == true) &&
- (AdaptCode[10] == true) && (AdaptCode[11] == true)) {Code = 1; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == true) && (AdaptCode[4] == true) &&
+ (AdaptCode[5] == true) && (AdaptCode[6] == true) && (AdaptCode[7] == true) && (AdaptCode[8] == true) && (AdaptCode[9] == true) &&
+ (AdaptCode[10] == true) && (AdaptCode[11] == true)) {Code = 1; return Code;}
- // Combination 1:4
+ // Combination 1:4
- if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == true) && (AdaptCode[3] == false) && (AdaptCode[4] == true) &&
- (AdaptCode[5] == false) && (AdaptCode[6] == true) && (AdaptCode[7] == false) && (AdaptCode[8] == true) && (AdaptCode[9] == true) &&
- (AdaptCode[10] == true) && (AdaptCode[11] == true)) {Code = 2; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == true) && (AdaptCode[3] == false) && (AdaptCode[4] == true) &&
+ (AdaptCode[5] == false) && (AdaptCode[6] == true) && (AdaptCode[7] == false) && (AdaptCode[8] == true) && (AdaptCode[9] == true) &&
+ (AdaptCode[10] == true) && (AdaptCode[11] == true)) {Code = 2; return Code;}
- if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == false) && (AdaptCode[3] == true) && (AdaptCode[4] == false) &&
- (AdaptCode[5] == true) && (AdaptCode[6] == false) && (AdaptCode[7] == true) && (AdaptCode[8] == true) && (AdaptCode[9] == true) &&
- (AdaptCode[10] == true) && (AdaptCode[11] == true)) {Code = 3; return Code;}
+ if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == false) && (AdaptCode[3] == true) && (AdaptCode[4] == false) &&
+ (AdaptCode[5] == true) && (AdaptCode[6] == false) && (AdaptCode[7] == true) && (AdaptCode[8] == true) && (AdaptCode[9] == true) &&
+ (AdaptCode[10] == true) && (AdaptCode[11] == true)) {Code = 3; return Code;}
- if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == true) && (AdaptCode[4] == true) &&
- (AdaptCode[5] == true) && (AdaptCode[6] == true) && (AdaptCode[7] == true) && (AdaptCode[8] == false) && (AdaptCode[9] == false) &&
- (AdaptCode[10] == false) && (AdaptCode[11] == false)) {Code = 4; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == true) && (AdaptCode[4] == true) &&
+ (AdaptCode[5] == true) && (AdaptCode[6] == true) && (AdaptCode[7] == true) && (AdaptCode[8] == false) && (AdaptCode[9] == false) &&
+ (AdaptCode[10] == false) && (AdaptCode[11] == false)) {Code = 4; return Code;}
- // Combination 1:2
+ // Combination 1:2
- if ((AdaptCode[0] == false) && (AdaptCode[1] == false) && (AdaptCode[2] == false) && (AdaptCode[3] == false) && (AdaptCode[4] == false) &&
- (AdaptCode[5] == false) && (AdaptCode[6] == false) && (AdaptCode[7] == false) && (AdaptCode[8] == true) && (AdaptCode[9] == true) &&
- (AdaptCode[10] == true) && (AdaptCode[11] == true)) {Code = 5; return Code;}
+ if ((AdaptCode[0] == false) && (AdaptCode[1] == false) && (AdaptCode[2] == false) && (AdaptCode[3] == false) && (AdaptCode[4] == false) &&
+ (AdaptCode[5] == false) && (AdaptCode[6] == false) && (AdaptCode[7] == false) && (AdaptCode[8] == true) && (AdaptCode[9] == true) &&
+ (AdaptCode[10] == true) && (AdaptCode[11] == true)) {Code = 5; return Code;}
- if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == false) && (AdaptCode[3] == true) && (AdaptCode[4] == false) &&
- (AdaptCode[5] == true) && (AdaptCode[6] == false) && (AdaptCode[7] == true) && (AdaptCode[8] == false) && (AdaptCode[9] == false) &&
- (AdaptCode[10] == false) && (AdaptCode[11] == false)) {Code = 6; return Code;}
+ if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == false) && (AdaptCode[3] == true) && (AdaptCode[4] == false) &&
+ (AdaptCode[5] == true) && (AdaptCode[6] == false) && (AdaptCode[7] == true) && (AdaptCode[8] == false) && (AdaptCode[9] == false) &&
+ (AdaptCode[10] == false) && (AdaptCode[11] == false)) {Code = 6; return Code;}
- if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == true) && (AdaptCode[3] == false) && (AdaptCode[4] == true) &&
- (AdaptCode[5] == false) && (AdaptCode[6] == true) && (AdaptCode[7] == false) && (AdaptCode[8] == false) && (AdaptCode[9] == false) &&
- (AdaptCode[10] == false) && (AdaptCode[11] == false)) {Code = 7; return Code; }
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == true) && (AdaptCode[3] == false) && (AdaptCode[4] == true) &&
+ (AdaptCode[5] == false) && (AdaptCode[6] == true) && (AdaptCode[7] == false) && (AdaptCode[8] == false) && (AdaptCode[9] == false) &&
+ (AdaptCode[10] == false) && (AdaptCode[11] == false)) {Code = 7; return Code; }
- return Code;
+ return Code;
}
long CGridAdaptation::CheckPyramCode(bool *AdaptCode) {
- int Code = -1;
+ int Code = -1;
- if ((AdaptCode[0] == true) || (AdaptCode[1] == true) || (AdaptCode[2] == true) || (AdaptCode[3] == true)) {Code = 0;}
+ if ((AdaptCode[0] == true) || (AdaptCode[1] == true) || (AdaptCode[2] == true) || (AdaptCode[3] == true)) {Code = 0;}
- // Combination 1P -> 1P
+ // Combination 1P -> 1P
- if ((AdaptCode[0] == false) && (AdaptCode[1] == false) && (AdaptCode[2] == false) && (AdaptCode[3] == false)) {Code = 1; return Code;}
+ if ((AdaptCode[0] == false) && (AdaptCode[1] == false) && (AdaptCode[2] == false) && (AdaptCode[3] == false)) {Code = 1; return Code;}
- // Combination 1P -> 3T
+ // Combination 1P -> 3T
- if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == false) && (AdaptCode[3] == false)) {Code = 2; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == false) && (AdaptCode[3] == false)) {Code = 2; return Code;}
- if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == false) && (AdaptCode[3] == false)) {Code = 3; return Code;}
+ if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == false) && (AdaptCode[3] == false)) {Code = 3; return Code;}
- if ((AdaptCode[0] == false) && (AdaptCode[1] == false) && (AdaptCode[2] == true) && (AdaptCode[3] == false)) {Code = 4; return Code;}
+ if ((AdaptCode[0] == false) && (AdaptCode[1] == false) && (AdaptCode[2] == true) && (AdaptCode[3] == false)) {Code = 4; return Code;}
- if ((AdaptCode[0] == false) && (AdaptCode[1] == false) && (AdaptCode[2] == false) && (AdaptCode[3] == true)) {Code = 5; return Code;}
+ if ((AdaptCode[0] == false) && (AdaptCode[1] == false) && (AdaptCode[2] == false) && (AdaptCode[3] == true)) {Code = 5; return Code;}
- // Combination 1P -> 4T
+ // Combination 1P -> 4T
- if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == false) && (AdaptCode[3] == false)) {Code = 6; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == false) && (AdaptCode[3] == false)) {Code = 6; return Code;}
- if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == false)) {Code = 7; return Code;}
+ if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == false)) {Code = 7; return Code;}
- if ((AdaptCode[0] == false) && (AdaptCode[1] == false) && (AdaptCode[2] == true) && (AdaptCode[3] == true)) {Code = 8; return Code;}
+ if ((AdaptCode[0] == false) && (AdaptCode[1] == false) && (AdaptCode[2] == true) && (AdaptCode[3] == true)) {Code = 8; return Code;}
- if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == false) && (AdaptCode[3] == true)) {Code = 9; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == false) && (AdaptCode[3] == true)) {Code = 9; return Code;}
- // Combination 1P -> 2P
+ // Combination 1P -> 2P
- if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == true) && (AdaptCode[3] == false)) {Code = 10; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == true) && (AdaptCode[3] == false)) {Code = 10; return Code;}
- if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == false) && (AdaptCode[3] == true)) {Code = 11; return Code;}
+ if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == false) && (AdaptCode[3] == true)) {Code = 11; return Code;}
- // Combination 1P -> 1P+3T
+ // Combination 1P -> 1P+3T
- if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == false)) {Code = 12; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == false)) {Code = 12; return Code;}
- if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == true)) {Code = 13; return Code;}
+ if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == true)) {Code = 13; return Code;}
- if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == true) && (AdaptCode[3] == true)) {Code = 14; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == false) && (AdaptCode[2] == true) && (AdaptCode[3] == true)) {Code = 14; return Code;}
- if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == false) && (AdaptCode[3] == true)) {Code = 15; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == false) && (AdaptCode[3] == true)) {Code = 15; return Code;}
- // Combination 1P -> 4P
+ // Combination 1P -> 4P
- if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == true)) {Code = 16; return Code;}
+ if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == true)) {Code = 16; return Code;}
- return Code;
+ return Code;
}
void CGridAdaptation::RectDivision(long code , long *nodes, long **Division, long *nPart) {
- if (code == 1) {
+ if (code == 1) {
- // number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
- *nPart = 4;
+ // number of nodes at each new element
+ Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
+ *nPart = 4;
- // nodes that compose each element
- Division[0][1] = nodes[8]; Division[0][2] = nodes[7]; Division[0][3] = nodes[0]; Division[0][4] = nodes[4];
+ // nodes that compose each element
+ Division[0][1] = nodes[8]; Division[0][2] = nodes[7]; Division[0][3] = nodes[0]; Division[0][4] = nodes[4];
- Division[1][1] = nodes[8]; Division[1][2] = nodes[4]; Division[1][3] = nodes[1]; Division[1][4] = nodes[5];
+ Division[1][1] = nodes[8]; Division[1][2] = nodes[4]; Division[1][3] = nodes[1]; Division[1][4] = nodes[5];
- Division[2][1] = nodes[8]; Division[2][2] = nodes[5]; Division[2][3] = nodes[2]; Division[2][4] = nodes[6];
+ Division[2][1] = nodes[8]; Division[2][2] = nodes[5]; Division[2][3] = nodes[2]; Division[2][4] = nodes[6];
- Division[3][1] = nodes[8]; Division[3][2] = nodes[6]; Division[3][3] = nodes[3]; Division[3][4] = nodes[7];
+ Division[3][1] = nodes[8]; Division[3][2] = nodes[6]; Division[3][3] = nodes[3]; Division[3][4] = nodes[7];
- }
+ }
- if (code == 2) {
- // number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 5;
- *nPart = 2;
+ if (code == 2) {
+ // number of nodes at each new element
+ Division[0][0] = 5; Division[1][0] = 5;
+ *nPart = 2;
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[4]; Division[0][3] = nodes[6]; Division[0][4] = nodes[3];
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[4]; Division[0][3] = nodes[6]; Division[0][4] = nodes[3];
- Division[1][1] = nodes[4]; Division[1][2] = nodes[1]; Division[1][3] = nodes[2]; Division[1][4] = nodes[6];
+ Division[1][1] = nodes[4]; Division[1][2] = nodes[1]; Division[1][3] = nodes[2]; Division[1][4] = nodes[6];
- }
+ }
- if (code == 3) {
- // number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 5;
- *nPart = 2;
+ if (code == 3) {
+ // number of nodes at each new element
+ Division[0][0] = 5; Division[1][0] = 5;
+ *nPart = 2;
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[5]; Division[0][4] = nodes[7];
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[5]; Division[0][4] = nodes[7];
- Division[1][1] = nodes[5]; Division[1][2] = nodes[2]; Division[1][3] = nodes[3]; Division[1][4] = nodes[7];
+ Division[1][1] = nodes[5]; Division[1][2] = nodes[2]; Division[1][3] = nodes[3]; Division[1][4] = nodes[7];
- }
+ }
}
void CGridAdaptation::RectExtDivision(long code , long *nodes, long **Division, long *nPart) {
- if (code == 2) {
- // number of nodes at each new element
- Division[0][0] = 4; Division[1][0] = 4; Division[2][0] = 4;
- *nPart = 3;
+ if (code == 2) {
+ // number of nodes at each new element
+ Division[0][0] = 4; Division[1][0] = 4; Division[2][0] = 4;
+ *nPart = 3;
- // nodes that compose each element
- Division[0][1] = nodes[4]; Division[0][2] = nodes[1]; Division[0][3] = nodes[2];
+ // nodes that compose each element
+ Division[0][1] = nodes[4]; Division[0][2] = nodes[1]; Division[0][3] = nodes[2];
- Division[1][1] = nodes[4]; Division[1][2] = nodes[2]; Division[1][3] = nodes[3];
+ Division[1][1] = nodes[4]; Division[1][2] = nodes[2]; Division[1][3] = nodes[3];
- Division[2][1] = nodes[4]; Division[2][2] = nodes[3]; Division[2][3] = nodes[0];
+ Division[2][1] = nodes[4]; Division[2][2] = nodes[3]; Division[2][3] = nodes[0];
- }
+ }
- if (code == 3) {
- // number of nodes at each new element
- Division[0][0] = 4; Division[1][0] = 4; Division[2][0] = 4;
- *nPart = 3;
+ if (code == 3) {
+ // number of nodes at each new element
+ Division[0][0] = 4; Division[1][0] = 4; Division[2][0] = 4;
+ *nPart = 3;
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[5];
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[5];
- Division[1][1] = nodes[0]; Division[1][2] = nodes[5]; Division[1][3] = nodes[3];
+ Division[1][1] = nodes[0]; Division[1][2] = nodes[5]; Division[1][3] = nodes[3];
- Division[2][1] = nodes[3]; Division[2][2] = nodes[5]; Division[2][3] = nodes[2];
+ Division[2][1] = nodes[3]; Division[2][2] = nodes[5]; Division[2][3] = nodes[2];
- }
+ }
- if (code == 4) {
- // number of nodes at each new element
- Division[0][0] = 4; Division[1][0] = 4; Division[2][0] = 4;
- *nPart = 3;
+ if (code == 4) {
+ // number of nodes at each new element
+ Division[0][0] = 4; Division[1][0] = 4; Division[2][0] = 4;
+ *nPart = 3;
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[6];
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[6];
- Division[1][1] = nodes[1]; Division[1][2] = nodes[2]; Division[1][3] = nodes[6];
+ Division[1][1] = nodes[1]; Division[1][2] = nodes[2]; Division[1][3] = nodes[6];
- Division[2][1] = nodes[0]; Division[2][2] = nodes[6]; Division[2][3] = nodes[3];
+ Division[2][1] = nodes[0]; Division[2][2] = nodes[6]; Division[2][3] = nodes[3];
- }
+ }
- if (code == 5) {
- // number of nodes at each new element
- Division[0][0] = 4; Division[1][0] = 4; Division[2][0] = 4;
- *nPart = 3;
+ if (code == 5) {
+ // number of nodes at each new element
+ Division[0][0] = 4; Division[1][0] = 4; Division[2][0] = 4;
+ *nPart = 3;
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[7];
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[7];
- Division[1][1] = nodes[1]; Division[1][2] = nodes[2]; Division[1][3] = nodes[7];
+ Division[1][1] = nodes[1]; Division[1][2] = nodes[2]; Division[1][3] = nodes[7];
- Division[2][1] = nodes[7]; Division[2][2] = nodes[2]; Division[2][3] = nodes[3];
+ Division[2][1] = nodes[7]; Division[2][2] = nodes[2]; Division[2][3] = nodes[3];
- }
+ }
- if (code == 6) {
- // number of nodes at each new element
- Division[0][0] = 4; Division[1][0] = 4; Division[2][0] = 4; Division[3][0] = 4;
- *nPart = 4;
+ if (code == 6) {
+ // number of nodes at each new element
+ Division[0][0] = 4; Division[1][0] = 4; Division[2][0] = 4; Division[3][0] = 4;
+ *nPart = 4;
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[4]; Division[0][3] = nodes[3];
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[4]; Division[0][3] = nodes[3];
- Division[1][1] = nodes[4]; Division[1][2] = nodes[1]; Division[1][3] = nodes[5];
+ Division[1][1] = nodes[4]; Division[1][2] = nodes[1]; Division[1][3] = nodes[5];
- Division[2][1] = nodes[4]; Division[2][2] = nodes[5]; Division[2][3] = nodes[3];
+ Division[2][1] = nodes[4]; Division[2][2] = nodes[5]; Division[2][3] = nodes[3];
- Division[3][1] = nodes[5]; Division[3][2] = nodes[2]; Division[3][3] = nodes[3];
+ Division[3][1] = nodes[5]; Division[3][2] = nodes[2]; Division[3][3] = nodes[3];
- }
+ }
- if (code == 7) {
- // number of nodes at each new element
- Division[0][0] = 4; Division[1][0] = 4; Division[2][0] = 4; Division[3][0] = 4;
- *nPart = 4;
+ if (code == 7) {
+ // number of nodes at each new element
+ Division[0][0] = 4; Division[1][0] = 4; Division[2][0] = 4; Division[3][0] = 4;
+ *nPart = 4;
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[5];
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[5];
- Division[1][1] = nodes[0]; Division[1][2] = nodes[5]; Division[1][3] = nodes[6];
+ Division[1][1] = nodes[0]; Division[1][2] = nodes[5]; Division[1][3] = nodes[6];
- Division[2][1] = nodes[5]; Division[2][2] = nodes[2]; Division[2][3] = nodes[6];
+ Division[2][1] = nodes[5]; Division[2][2] = nodes[2]; Division[2][3] = nodes[6];
- Division[3][1] = nodes[0]; Division[3][2] = nodes[6]; Division[3][3] = nodes[3];
+ Division[3][1] = nodes[0]; Division[3][2] = nodes[6]; Division[3][3] = nodes[3];
- }
+ }
- if (code == 8) {
- // number of nodes at each new element
- Division[0][0] = 4; Division[1][0] = 4; Division[2][0] = 4; Division[3][0] = 4;
- *nPart = 4;
+ if (code == 8) {
+ // number of nodes at each new element
+ Division[0][0] = 4; Division[1][0] = 4; Division[2][0] = 4; Division[3][0] = 4;
+ *nPart = 4;
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[7];
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[7];
- Division[1][1] = nodes[7]; Division[1][2] = nodes[1]; Division[1][3] = nodes[6];
+ Division[1][1] = nodes[7]; Division[1][2] = nodes[1]; Division[1][3] = nodes[6];
- Division[2][1] = nodes[1]; Division[2][2] = nodes[2]; Division[2][3] = nodes[6];
+ Division[2][1] = nodes[1]; Division[2][2] = nodes[2]; Division[2][3] = nodes[6];
- Division[3][1] = nodes[7]; Division[3][2] = nodes[6]; Division[3][3] = nodes[3];
+ Division[3][1] = nodes[7]; Division[3][2] = nodes[6]; Division[3][3] = nodes[3];
- }
+ }
- if (code == 9) {
- // number of nodes at each new element
- Division[0][0] = 4; Division[1][0] = 4; Division[2][0] = 4; Division[3][0] = 4;
- *nPart = 4;
+ if (code == 9) {
+ // number of nodes at each new element
+ Division[0][0] = 4; Division[1][0] = 4; Division[2][0] = 4; Division[3][0] = 4;
+ *nPart = 4;
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[4]; Division[0][3] = nodes[7];
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[4]; Division[0][3] = nodes[7];
- Division[1][1] = nodes[4]; Division[1][2] = nodes[1]; Division[1][3] = nodes[2];
+ Division[1][1] = nodes[4]; Division[1][2] = nodes[1]; Division[1][3] = nodes[2];
- Division[2][1] = nodes[7]; Division[2][2] = nodes[4]; Division[2][3] = nodes[2];
+ Division[2][1] = nodes[7]; Division[2][2] = nodes[4]; Division[2][3] = nodes[2];
- Division[3][1] = nodes[7]; Division[3][2] = nodes[2]; Division[3][3] = nodes[3];
+ Division[3][1] = nodes[7]; Division[3][2] = nodes[2]; Division[3][3] = nodes[3];
- }
+ }
- if (code == 12) {
- // number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 4; Division[2][0] = 4; Division[3][0] = 4;
- *nPart = 4;
+ if (code == 12) {
+ // number of nodes at each new element
+ Division[0][0] = 5; Division[1][0] = 4; Division[2][0] = 4; Division[3][0] = 4;
+ *nPart = 4;
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[4]; Division[0][3] = nodes[6]; Division[0][4] = nodes[3];
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[4]; Division[0][3] = nodes[6]; Division[0][4] = nodes[3];
- Division[1][1] = nodes[4]; Division[1][2] = nodes[1]; Division[1][3] = nodes[5];
+ Division[1][1] = nodes[4]; Division[1][2] = nodes[1]; Division[1][3] = nodes[5];
- Division[2][1] = nodes[4]; Division[2][2] = nodes[5]; Division[2][3] = nodes[6];
+ Division[2][1] = nodes[4]; Division[2][2] = nodes[5]; Division[2][3] = nodes[6];
- Division[3][1] = nodes[5]; Division[3][2] = nodes[2]; Division[3][3] = nodes[6];
+ Division[3][1] = nodes[5]; Division[3][2] = nodes[2]; Division[3][3] = nodes[6];
- }
+ }
- if (code == 13) {
- // number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 4; Division[2][0] = 4; Division[3][0] = 4;
- *nPart = 4;
+ if (code == 13) {
+ // number of nodes at each new element
+ Division[0][0] = 5; Division[1][0] = 4; Division[2][0] = 4; Division[3][0] = 4;
+ *nPart = 4;
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[5]; Division[0][4] = nodes[7];
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[5]; Division[0][4] = nodes[7];
- Division[1][1] = nodes[5]; Division[1][2] = nodes[2]; Division[1][3] = nodes[6];
+ Division[1][1] = nodes[5]; Division[1][2] = nodes[2]; Division[1][3] = nodes[6];
- Division[2][1] = nodes[7]; Division[2][2] = nodes[5]; Division[2][3] = nodes[6];
+ Division[2][1] = nodes[7]; Division[2][2] = nodes[5]; Division[2][3] = nodes[6];
- Division[3][1] = nodes[7]; Division[3][2] = nodes[6]; Division[3][3] = nodes[3];
+ Division[3][1] = nodes[7]; Division[3][2] = nodes[6]; Division[3][3] = nodes[3];
- }
+ }
- if (code == 14) {
- // number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 4; Division[2][0] = 4; Division[3][0] = 4;
- *nPart = 4;
+ if (code == 14) {
+ // number of nodes at each new element
+ Division[0][0] = 5; Division[1][0] = 4; Division[2][0] = 4; Division[3][0] = 4;
+ *nPart = 4;
- // nodes that compose each element
- Division[0][1] = nodes[4]; Division[0][2] = nodes[1]; Division[0][3] = nodes[2]; Division[0][4] = nodes[6];
+ // nodes that compose each element
+ Division[0][1] = nodes[4]; Division[0][2] = nodes[1]; Division[0][3] = nodes[2]; Division[0][4] = nodes[6];
- Division[1][1] = nodes[0]; Division[1][2] = nodes[4]; Division[1][3] = nodes[7];
+ Division[1][1] = nodes[0]; Division[1][2] = nodes[4]; Division[1][3] = nodes[7];
- Division[2][1] = nodes[7]; Division[2][2] = nodes[4]; Division[2][3] = nodes[6];
+ Division[2][1] = nodes[7]; Division[2][2] = nodes[4]; Division[2][3] = nodes[6];
- Division[3][1] = nodes[7]; Division[3][2] = nodes[6]; Division[3][3] = nodes[3];
+ Division[3][1] = nodes[7]; Division[3][2] = nodes[6]; Division[3][3] = nodes[3];
- }
+ }
- if (code == 15) {
- // number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 4; Division[2][0] = 4; Division[3][0] = 4;
- *nPart = 4;
+ if (code == 15) {
+ // number of nodes at each new element
+ Division[0][0] = 5; Division[1][0] = 4; Division[2][0] = 4; Division[3][0] = 4;
+ *nPart = 4;
- // nodes that compose each element
- Division[0][1] = nodes[7]; Division[0][2] = nodes[5]; Division[0][3] = nodes[2]; Division[0][4] = nodes[3];
+ // nodes that compose each element
+ Division[0][1] = nodes[7]; Division[0][2] = nodes[5]; Division[0][3] = nodes[2]; Division[0][4] = nodes[3];
- Division[1][1] = nodes[0]; Division[1][2] = nodes[4]; Division[1][3] = nodes[7];
+ Division[1][1] = nodes[0]; Division[1][2] = nodes[4]; Division[1][3] = nodes[7];
- Division[2][1] = nodes[4]; Division[2][2] = nodes[1]; Division[2][3] = nodes[5];
+ Division[2][1] = nodes[4]; Division[2][2] = nodes[1]; Division[2][3] = nodes[5];
- Division[3][1] = nodes[4]; Division[3][2] = nodes[5]; Division[3][3] = nodes[7];
+ Division[3][1] = nodes[4]; Division[3][2] = nodes[5]; Division[3][3] = nodes[7];
- }
+ }
}
void CGridAdaptation::TriangleDivision(long code , long *nodes, long *edges, long **Division, long *nPart) {
- if (code == 1) {
- // number of nodes at each new element
- Division[0][0] = 4; Division[1][0] = 4; Division[2][0] = 4; Division[3][0] = 4;
- *nPart = 4;
-
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[3]; Division[0][3] = nodes[5];
+ if (code == 1) {
+ // number of nodes at each new element
+ Division[0][0] = 4; Division[1][0] = 4; Division[2][0] = 4; Division[3][0] = 4;
+ *nPart = 4;
- Division[1][1] = nodes[3]; Division[1][2] = nodes[1]; Division[1][3] = nodes[4];
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[3]; Division[0][3] = nodes[5];
- Division[2][1] = nodes[5]; Division[2][2] = nodes[4]; Division[2][3] = nodes[2];
+ Division[1][1] = nodes[3]; Division[1][2] = nodes[1]; Division[1][3] = nodes[4];
- Division[3][1] = nodes[3]; Division[3][2] = nodes[4]; Division[3][3] = nodes[5];
- return;
- }
+ Division[2][1] = nodes[5]; Division[2][2] = nodes[4]; Division[2][3] = nodes[2];
- if (code == 2) {
- // number of nodes at each new element
- Division[0][0] = 4; Division[1][0] = 4;
- *nPart = 2;
+ Division[3][1] = nodes[3]; Division[3][2] = nodes[4]; Division[3][3] = nodes[5];
+ return;
+ }
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[3]; Division[0][3] = nodes[2];
+ if (code == 2) {
+ // number of nodes at each new element
+ Division[0][0] = 4; Division[1][0] = 4;
+ *nPart = 2;
- Division[1][1] = nodes[3]; Division[1][2] = nodes[1]; Division[1][3] = nodes[2];
- return;
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[3]; Division[0][3] = nodes[2];
- }
+ Division[1][1] = nodes[3]; Division[1][2] = nodes[1]; Division[1][3] = nodes[2];
+ return;
- if (code == 3) {
- // number of nodes at each new element
- Division[0][0] = 4; Division[1][0] = 4;
- *nPart = 2;
+ }
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[4];
+ if (code == 3) {
+ // number of nodes at each new element
+ Division[0][0] = 4; Division[1][0] = 4;
+ *nPart = 2;
- Division[1][1] = nodes[0]; Division[1][2] = nodes[4]; Division[1][3] = nodes[2];
- return;
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[4];
- }
+ Division[1][1] = nodes[0]; Division[1][2] = nodes[4]; Division[1][3] = nodes[2];
+ return;
- if (code == 4) {
- // number of nodes at each new element
- Division[0][0] = 4; Division[1][0] = 4;
- *nPart = 2;
+ }
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[5];
+ if (code == 4) {
+ // number of nodes at each new element
+ Division[0][0] = 4; Division[1][0] = 4;
+ *nPart = 2;
- Division[1][1] = nodes[5]; Division[1][2] = nodes[1]; Division[1][3] = nodes[2];
- return;
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[5];
- }
+ Division[1][1] = nodes[5]; Division[1][2] = nodes[1]; Division[1][3] = nodes[2];
+ return;
- if (edges == NULL) {
+ }
- if (code == 5) {
- // number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 4;
- *nPart = 2;
+ if (edges == NULL) {
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[3]; Division[0][3] = nodes[4]; Division[0][4] = nodes[2];
+ if (code == 5) {
+ // number of nodes at each new element
+ Division[0][0] = 5; Division[1][0] = 4;
+ *nPart = 2;
- Division[1][1] = nodes[3]; Division[1][2] = nodes[1]; Division[1][3] = nodes[4];
- return;
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[3]; Division[0][3] = nodes[4]; Division[0][4] = nodes[2];
- }
+ Division[1][1] = nodes[3]; Division[1][2] = nodes[1]; Division[1][3] = nodes[4];
+ return;
- if (code == 6) {
- // number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 4;
- *nPart = 2;
+ }
- // nodes that compose each element
- Division[0][1] = nodes[3]; Division[0][2] = nodes[1]; Division[0][3] = nodes[2]; Division[0][4] = nodes[5];
+ if (code == 6) {
+ // number of nodes at each new element
+ Division[0][0] = 5; Division[1][0] = 4;
+ *nPart = 2;
- Division[1][1] = nodes[0]; Division[1][2] = nodes[3]; Division[1][3] = nodes[5];
- return;
+ // nodes that compose each element
+ Division[0][1] = nodes[3]; Division[0][2] = nodes[1]; Division[0][3] = nodes[2]; Division[0][4] = nodes[5];
- }
+ Division[1][1] = nodes[0]; Division[1][2] = nodes[3]; Division[1][3] = nodes[5];
+ return;
- if (code == 7) {
- // number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 4;
- *nPart = 2;
+ }
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[4]; Division[0][4] = nodes[5];
+ if (code == 7) {
+ // number of nodes at each new element
+ Division[0][0] = 5; Division[1][0] = 4;
+ *nPart = 2;
- Division[1][1] = nodes[5]; Division[1][2] = nodes[4]; Division[1][3] = nodes[2];
- return;
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[4]; Division[0][4] = nodes[5];
- }
+ Division[1][1] = nodes[5]; Division[1][2] = nodes[4]; Division[1][3] = nodes[2];
+ return;
- }
- else {
+ }
- unsigned short iDiv, nDiv, edge_div[6][3], max_iVar, iVar, nElem, iElem, iNode, iTriangle;
- bool set_0, set_1, new_div, new_triangle[8][10];
- long max_edge;
+ }
+ else {
- nDiv = 0;
- do { new_div = false;
+ unsigned short iDiv, nDiv, edge_div[6][3], max_iVar, iVar, nElem, iElem, iNode, iTriangle;
+ bool set_0, set_1, new_div, new_triangle[8][10];
+ long max_edge;
- // Compute the greatest edge index
- max_edge = 0; max_iVar = 0;
- for (iVar = 0; iVar < 3; iVar ++) {
- max_edge = max(max_edge, edges[iVar]);
- if ( max_edge == edges[iVar] ) max_iVar = iVar;
- }
+ nDiv = 0;
+ do { new_div = false;
- // If the edge is divided compose the vector with the information of the division
- if (edges[max_iVar] >= 0) {
- if (max_iVar == 0) { edge_div[nDiv][0] = 3; edge_div[nDiv][1] = 0; edge_div[nDiv][2] = 1; }
- if (max_iVar == 1) { edge_div[nDiv][0] = 4; edge_div[nDiv][1] = 0; edge_div[nDiv][2] = 2; }
- if (max_iVar == 2) { edge_div[nDiv][0] = 5; edge_div[nDiv][1] = 1; edge_div[nDiv][2] = 2; }
- nDiv++; new_div = true;
- }
- // In order to do not repeat the egde, restart the code
- edges[max_iVar] = -1;
- } while (new_div);
+ // Compute the greatest edge index
+ max_edge = 0; max_iVar = 0;
+ for (iVar = 0; iVar < 3; iVar ++) {
+ max_edge = max(max_edge, edges[iVar]);
+ if ( max_edge == edges[iVar] ) max_iVar = iVar;
+ }
+ // If the edge is divided compose the vector with the information of the division
+ if (edges[max_iVar] >= 0) {
+ if (max_iVar == 0) { edge_div[nDiv][0] = 3; edge_div[nDiv][1] = 0; edge_div[nDiv][2] = 1; }
+ if (max_iVar == 1) { edge_div[nDiv][0] = 4; edge_div[nDiv][1] = 0; edge_div[nDiv][2] = 2; }
+ if (max_iVar == 2) { edge_div[nDiv][0] = 5; edge_div[nDiv][1] = 1; edge_div[nDiv][2] = 2; }
+ nDiv++; new_div = true;
+ }
+ // In order to do not repeat the egde, restart the code
+ edges[max_iVar] = -1;
+ } while (new_div);
- // Inicializa
- for (iVar = 0; iVar < 3; iVar ++) new_triangle[0][iVar] = true;
- for (iVar = 3; iVar < 6; iVar ++) new_triangle[0][iVar] = false;
- nElem = 1;
- for (iDiv = 0; iDiv < nDiv; iDiv++) {
- short target_elem = -1;
+ // Inicializa
+ for (iVar = 0; iVar < 3; iVar ++) new_triangle[0][iVar] = true;
+ for (iVar = 3; iVar < 6; iVar ++) new_triangle[0][iVar] = false;
- for (iElem = 0; iElem < nElem; iElem++) {
- set_0 = false; set_1 = false;
- if (new_triangle[iElem][edge_div[iDiv][1]]) set_0 = true;
- if (new_triangle[iElem][edge_div[iDiv][2]]) set_1 = true;
- if (set_0 && set_1) target_elem = iElem;
- }
+ nElem = 1;
+ for (iDiv = 0; iDiv < nDiv; iDiv++) {
+ short target_elem = -1;
- if (target_elem != -1) {
- for (iNode = 0; iNode < 6; iNode++)
- new_triangle[nElem][iNode] = new_triangle[target_elem][iNode];
- new_triangle[target_elem][edge_div[iDiv][0]] = true;
- new_triangle[target_elem][edge_div[iDiv][2]] = false;
- new_triangle[nElem][edge_div[iDiv][0]] = true;
- new_triangle[nElem][edge_div[iDiv][1]] = false;
- nElem++;
- }
- }
-
- *nPart = nElem;
-
- for (iTriangle = 0; iTriangle < nElem; iTriangle++) {
- Division[iTriangle][0] = 3;
- iVar = 1;
- for (iNode = 0; iNode < 6; iNode++)
- if (new_triangle[iTriangle][iNode] == true) {
- if (iNode == 0) Division[iTriangle][iVar] = nodes[0];
- if (iNode == 1) Division[iTriangle][iVar] = nodes[1];
- if (iNode == 2) Division[iTriangle][iVar] = nodes[2];
- if (iNode == 3) Division[iTriangle][iVar] = nodes[3];
- if (iNode == 4) Division[iTriangle][iVar] = nodes[4];
- if (iNode == 5) Division[iTriangle][iVar] = nodes[5];
- iVar++;
- }
-
- }
-
- }
-}
+ for (iElem = 0; iElem < nElem; iElem++) {
+ set_0 = false; set_1 = false;
+ if (new_triangle[iElem][edge_div[iDiv][1]]) set_0 = true;
+ if (new_triangle[iElem][edge_div[iDiv][2]]) set_1 = true;
+ if (set_0 && set_1) target_elem = iElem;
+ }
-void CGridAdaptation::TetraDivision(long code , long *nodes, long *edges, long **Division, long *nPart) {
+ if (target_elem != -1) {
+ for (iNode = 0; iNode < 6; iNode++)
+ new_triangle[nElem][iNode] = new_triangle[target_elem][iNode];
+ new_triangle[target_elem][edge_div[iDiv][0]] = true;
+ new_triangle[target_elem][edge_div[iDiv][2]] = false;
+ new_triangle[nElem][edge_div[iDiv][0]] = true;
+ new_triangle[nElem][edge_div[iDiv][1]] = false;
+ nElem++;
+ }
+ }
+ *nPart = nElem;
+
+ for (iTriangle = 0; iTriangle < nElem; iTriangle++) {
+ Division[iTriangle][0] = 3;
+ iVar = 1;
+ for (iNode = 0; iNode < 6; iNode++)
+ if (new_triangle[iTriangle][iNode] == true) {
+ if (iNode == 0) Division[iTriangle][iVar] = nodes[0];
+ if (iNode == 1) Division[iTriangle][iVar] = nodes[1];
+ if (iNode == 2) Division[iTriangle][iVar] = nodes[2];
+ if (iNode == 3) Division[iTriangle][iVar] = nodes[3];
+ if (iNode == 4) Division[iTriangle][iVar] = nodes[4];
+ if (iNode == 5) Division[iTriangle][iVar] = nodes[5];
+ iVar++;
+ }
- if (code == 1) {
-
- // number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
- Division[4][0] = 5; Division[5][0] = 5; Division[6][0] = 5; Division[7][0] = 5;
- *nPart = 8;
-
- // nodes that compose each element
- Division[0][1] = nodes[6]; Division[0][2] = nodes[5]; Division[0][3] = nodes[4]; Division[0][4] = nodes[0];
- Division[1][1] = nodes[8]; Division[1][2] = nodes[4]; Division[1][3] = nodes[7]; Division[1][4] = nodes[1];
- Division[2][1] = nodes[6]; Division[2][2] = nodes[8]; Division[2][3] = nodes[9]; Division[2][4] = nodes[3];
- Division[3][1] = nodes[9]; Division[3][2] = nodes[7]; Division[3][3] = nodes[5]; Division[3][4] = nodes[2];
- Division[4][1] = nodes[6]; Division[4][2] = nodes[8]; Division[4][3] = nodes[7]; Division[4][4] = nodes[9];
- Division[5][1] = nodes[6]; Division[5][2] = nodes[7]; Division[5][3] = nodes[5]; Division[5][4] = nodes[9];
- Division[6][1] = nodes[7]; Division[6][2] = nodes[8]; Division[6][3] = nodes[6]; Division[6][4] = nodes[4];
- Division[7][1] = nodes[5]; Division[7][2] = nodes[7]; Division[7][3] = nodes[6]; Division[7][4] = nodes[4];
-
- }
-
- if (code == 2) {
- // number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
- *nPart = 4;
-
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[4]; Division[0][3] = nodes[6]; Division[0][4] = nodes[2];
- Division[1][1] = nodes[6]; Division[1][2] = nodes[4]; Division[1][3] = nodes[8]; Division[1][4] = nodes[2];
- Division[2][1] = nodes[6]; Division[2][2] = nodes[8]; Division[2][3] = nodes[3]; Division[2][4] = nodes[2];
- Division[3][1] = nodes[4]; Division[3][2] = nodes[1]; Division[3][3] = nodes[8]; Division[3][4] = nodes[2];
-
- }
-
- if (code == 3) {
- // number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
- *nPart = 4;
-
- // nodes that compose each element
- Division[0][1] = nodes[2]; Division[0][2] = nodes[7]; Division[0][3] = nodes[9]; Division[0][4] = nodes[0];
- Division[1][1] = nodes[7]; Division[1][2] = nodes[8]; Division[1][3] = nodes[9]; Division[1][4] = nodes[0];
- Division[2][1] = nodes[7]; Division[2][2] = nodes[1]; Division[2][3] = nodes[8]; Division[2][4] = nodes[0];
- Division[3][1] = nodes[9]; Division[3][2] = nodes[8]; Division[3][3] = nodes[3]; Division[3][4] = nodes[0];
-
- }
-
- if (code == 4) {
- // number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
- *nPart = 4;
-
- // nodes that compose each element
- Division[0][1] = nodes[2]; Division[0][2] = nodes[5]; Division[0][3] = nodes[9]; Division[0][4] = nodes[1];
- Division[1][1] = nodes[9]; Division[1][2] = nodes[5]; Division[1][3] = nodes[6]; Division[1][4] = nodes[1];
- Division[2][1] = nodes[5]; Division[2][2] = nodes[0]; Division[2][3] = nodes[6]; Division[2][4] = nodes[1];
- Division[3][1] = nodes[9]; Division[3][2] = nodes[6]; Division[3][3] = nodes[3]; Division[3][4] = nodes[1];
-
- }
-
- if (code == 5) {
- // number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
- *nPart = 4;
-
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[4]; Division[0][3] = nodes[5]; Division[0][4] = nodes[3];
- Division[1][1] = nodes[5]; Division[1][2] = nodes[4]; Division[1][3] = nodes[7]; Division[1][4] = nodes[3];
- Division[2][1] = nodes[2]; Division[2][2] = nodes[5]; Division[2][3] = nodes[7]; Division[2][4] = nodes[3];
- Division[3][1] = nodes[7]; Division[3][2] = nodes[4]; Division[3][3] = nodes[1]; Division[3][4] = nodes[3];
-
- }
-
- if (code == 6) {
-
- unsigned short iDiv, nDiv, edge_div[6][3], max_iVar, iVar, nElem, iElem, iNode, iTetra;
- bool set_0, set_1, new_div, new_tetra[8][10];
- long max_edge;
-
- nDiv = 0;
- do { new_div = false;
-
- // Compute the greatest node at the divided edge
- max_edge = 0; max_iVar = 0;
- for (iVar = 0; iVar < 6; iVar ++) {
- max_edge = max(max_edge, edges[iVar]);
- if ( max_edge == edges[iVar] ) max_iVar = iVar;
- }
-
- // If the edge is divided compose the vector with the information of the division
- if (edges[max_iVar] >= 0) {
- if (max_iVar == 0) { edge_div[nDiv][0] = 4; edge_div[nDiv][1] = 0; edge_div[nDiv][2] = 1; }
- if (max_iVar == 1) { edge_div[nDiv][0] = 5; edge_div[nDiv][1] = 0; edge_div[nDiv][2] = 2; }
- if (max_iVar == 2) { edge_div[nDiv][0] = 6; edge_div[nDiv][1] = 0; edge_div[nDiv][2] = 3; }
- if (max_iVar == 3) { edge_div[nDiv][0] = 7; edge_div[nDiv][1] = 1; edge_div[nDiv][2] = 2; }
- if (max_iVar == 4) { edge_div[nDiv][0] = 8; edge_div[nDiv][1] = 1; edge_div[nDiv][2] = 3; }
- if (max_iVar == 5) { edge_div[nDiv][0] = 9; edge_div[nDiv][1] = 2; edge_div[nDiv][2] = 3; }
- nDiv++; new_div = true;
- }
- // In order to do not repeat the egde, restart the code
- edges[max_iVar] = -1;
- } while (new_div);
-
-
- // Inicializa
- for (iVar = 0; iVar < 4; iVar ++) new_tetra[0][iVar] = true;
- for (iVar = 4; iVar < 10; iVar ++) new_tetra[0][iVar] = false;
-
- nElem = 1;
- for (iDiv = 0; iDiv < nDiv; iDiv++) {
- for (iVar = 0; iVar < 3; iVar++) {
- short target_elem = -1;
-
- for (iElem = 0; iElem < nElem; iElem++) {
- set_0 = false; set_1 = false;
- if (new_tetra[iElem][edge_div[iDiv][1]]) set_0 = true;
- if (new_tetra[iElem][edge_div[iDiv][2]]) set_1 = true;
- if (set_0 && set_1) target_elem = iElem;
- }
-
- if (target_elem != -1) {
- for (iNode = 0; iNode < 10; iNode++)
- new_tetra[nElem][iNode] = new_tetra[target_elem][iNode];
- new_tetra[target_elem][edge_div[iDiv][0]] = true;
- new_tetra[target_elem][edge_div[iDiv][2]] = false;
- new_tetra[nElem][edge_div[iDiv][0]] = true;
- new_tetra[nElem][edge_div[iDiv][1]] = false;
- nElem++;
- }
- }
- }
-
- *nPart = nElem;
-
- for (iTetra = 0; iTetra < nElem; iTetra++) {
- Division[iTetra][0] = 4;
- iVar = 1;
- for (iNode = 0; iNode < 10; iNode++)
- if (new_tetra[iTetra][iNode] == true) {
- if (iNode == 0) Division[iTetra][iVar] = nodes[0];
- if (iNode == 1) Division[iTetra][iVar] = nodes[1];
- if (iNode == 2) Division[iTetra][iVar] = nodes[2];
- if (iNode == 3) Division[iTetra][iVar] = nodes[3];
- if (iNode == 4) Division[iTetra][iVar] = nodes[4];
- if (iNode == 5) Division[iTetra][iVar] = nodes[5];
- if (iNode == 6) Division[iTetra][iVar] = nodes[6];
- if (iNode == 7) Division[iTetra][iVar] = nodes[7];
- if (iNode == 8) Division[iTetra][iVar] = nodes[8];
- if (iNode == 9) Division[iTetra][iVar] = nodes[9];
- iVar++;
- }
-
-// cout <<"Boolean "<< new_tetra[iTetra][0] <<" "<< new_tetra[iTetra][1] <<" "<< new_tetra[iTetra][2] <<" "<< new_tetra[iTetra][3] <<" "<< new_tetra[iTetra][4]
-// <<" "<< new_tetra[iTetra][5] <<" "<< new_tetra[iTetra][6] <<" "<< new_tetra[iTetra][7] <<" "<< new_tetra[iTetra][8] <<" "<< new_tetra[iTetra][9] << endl;
-
-// cout <<"Nodes "<< nodes[0] <<" "<< nodes[1] <<" "<< nodes[2] <<" "<< nodes[3] <<" "<< nodes[4]
-// <<" "<< nodes[5] <<" "<< nodes[6] <<" "<< nodes[7] <<" "<< nodes[8] <<" "<< nodes[9] << endl;
-
-// cout <<"Tets "<< Division[iTetra][0] <<" "<< Division[iTetra][1] <<" "<< Division[iTetra][2] <<" "<< Division[iTetra][3] <<" "<< Division[iTetra][4]
-// <<" "<< Division[iTetra][5] <<" "<< Division[iTetra][6] <<" "<< Division[iTetra][7] <<" "<< Division[iTetra][8] <<" "<< Division[iTetra][9] << endl;
-
-// cin.get();
- }
-
- }
+ }
+ }
}
-void CGridAdaptation::HexaDivision(long code , long *nodes, long **Division, long *nPart) {
-
- if (code == 1) {
+void CGridAdaptation::TetraDivision(long code , long *nodes, long *edges, long **Division, long *nPart) {
- // number of nodes at each new element
- Division[0][0] = 9; Division[1][0] = 9; Division[2][0] = 9; Division[3][0] = 9;
- Division[4][0] = 9; Division[5][0] = 9; Division[6][0] = 9; Division[7][0] = 9;
- *nPart = 8;
- // nodes that compose each element
- Division[0][1] = nodes[20]; Division[0][2] = nodes[8]; Division[0][3] = nodes[1]; Division[0][4] = nodes[9];
- Division[0][5] = nodes[26]; Division[0][6] = nodes[25]; Division[0][7] = nodes[17]; Division[0][8] = nodes[22];
+ if (code == 1) {
- Division[1][1] = nodes[20]; Division[1][2] = nodes[9]; Division[1][3] = nodes[2]; Division[1][4] = nodes[10];
- Division[1][5] = nodes[26]; Division[1][6] = nodes[22]; Division[1][7] = nodes[18]; Division[1][8] = nodes[23];
+ // number of nodes at each new element
+ Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
+ Division[4][0] = 5; Division[5][0] = 5; Division[6][0] = 5; Division[7][0] = 5;
+ *nPart = 8;
- Division[2][1] = nodes[20]; Division[2][2] = nodes[10]; Division[2][3] = nodes[3]; Division[2][4] = nodes[11];
- Division[2][5] = nodes[26]; Division[2][6] = nodes[23]; Division[2][7] = nodes[19]; Division[2][8] = nodes[24];
+ // nodes that compose each element
+ Division[0][1] = nodes[6]; Division[0][2] = nodes[5]; Division[0][3] = nodes[4]; Division[0][4] = nodes[0];
+ Division[1][1] = nodes[8]; Division[1][2] = nodes[4]; Division[1][3] = nodes[7]; Division[1][4] = nodes[1];
+ Division[2][1] = nodes[6]; Division[2][2] = nodes[8]; Division[2][3] = nodes[9]; Division[2][4] = nodes[3];
+ Division[3][1] = nodes[9]; Division[3][2] = nodes[7]; Division[3][3] = nodes[5]; Division[3][4] = nodes[2];
+ Division[4][1] = nodes[6]; Division[4][2] = nodes[8]; Division[4][3] = nodes[7]; Division[4][4] = nodes[9];
+ Division[5][1] = nodes[6]; Division[5][2] = nodes[7]; Division[5][3] = nodes[5]; Division[5][4] = nodes[9];
+ Division[6][1] = nodes[7]; Division[6][2] = nodes[8]; Division[6][3] = nodes[6]; Division[6][4] = nodes[4];
+ Division[7][1] = nodes[5]; Division[7][2] = nodes[7]; Division[7][3] = nodes[6]; Division[7][4] = nodes[4];
- Division[3][1] = nodes[20]; Division[3][2] = nodes[11]; Division[3][3] = nodes[0]; Division[3][4] = nodes[8];
- Division[3][5] = nodes[26]; Division[3][6] = nodes[24]; Division[3][7] = nodes[16]; Division[3][8] = nodes[25];
+ }
- Division[4][1] = nodes[26]; Division[4][2] = nodes[25]; Division[4][3] = nodes[17]; Division[4][4] = nodes[22];
- Division[4][5] = nodes[21]; Division[4][6] = nodes[12]; Division[4][7] = nodes[5]; Division[4][8] = nodes[13];
+ if (code == 2) {
+ // number of nodes at each new element
+ Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
+ *nPart = 4;
- Division[5][1] = nodes[26]; Division[5][2] = nodes[22]; Division[5][3] = nodes[18]; Division[5][4] = nodes[23];
- Division[5][5] = nodes[21]; Division[5][6] = nodes[13]; Division[5][7] = nodes[6]; Division[5][8] = nodes[14];
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[4]; Division[0][3] = nodes[6]; Division[0][4] = nodes[2];
+ Division[1][1] = nodes[6]; Division[1][2] = nodes[4]; Division[1][3] = nodes[8]; Division[1][4] = nodes[2];
+ Division[2][1] = nodes[6]; Division[2][2] = nodes[8]; Division[2][3] = nodes[3]; Division[2][4] = nodes[2];
+ Division[3][1] = nodes[4]; Division[3][2] = nodes[1]; Division[3][3] = nodes[8]; Division[3][4] = nodes[2];
- Division[6][1] = nodes[26]; Division[6][2] = nodes[23]; Division[6][3] = nodes[19]; Division[6][4] = nodes[24];
- Division[6][5] = nodes[21]; Division[6][6] = nodes[14]; Division[6][7] = nodes[7]; Division[6][8] = nodes[15];
+ }
- Division[7][1] = nodes[26]; Division[7][2] = nodes[24]; Division[7][3] = nodes[16]; Division[7][4] = nodes[25];
- Division[7][5] = nodes[21]; Division[7][6] = nodes[15]; Division[7][7] = nodes[4]; Division[7][8] = nodes[12];
+ if (code == 3) {
+ // number of nodes at each new element
+ Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
+ *nPart = 4;
- }
+ // nodes that compose each element
+ Division[0][1] = nodes[2]; Division[0][2] = nodes[7]; Division[0][3] = nodes[9]; Division[0][4] = nodes[0];
+ Division[1][1] = nodes[7]; Division[1][2] = nodes[8]; Division[1][3] = nodes[9]; Division[1][4] = nodes[0];
+ Division[2][1] = nodes[7]; Division[2][2] = nodes[1]; Division[2][3] = nodes[8]; Division[2][4] = nodes[0];
+ Division[3][1] = nodes[9]; Division[3][2] = nodes[8]; Division[3][3] = nodes[3]; Division[3][4] = nodes[0];
- if (code == 2) {
- // number of nodes at each new element
- Division[0][0] = 9; Division[1][0] = 9; Division[2][0] = 9; Division[3][0] = 9;
- *nPart = 4;
+ }
- // nodes that compose each element
- Division[0][1] = nodes[8]; Division[0][2] = nodes[1]; Division[0][3] = nodes[2]; Division[0][4] = nodes[10];
- Division[0][5] = nodes[25]; Division[0][17] = nodes[25]; Division[0][7] = nodes[18]; Division[0][8] = nodes[23];
+ if (code == 4) {
+ // number of nodes at each new element
+ Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
+ *nPart = 4;
- Division[1][1] = nodes[0]; Division[1][2] = nodes[8]; Division[1][3] = nodes[10]; Division[1][4] = nodes[3];
- Division[1][5] = nodes[16]; Division[1][6] = nodes[25]; Division[1][7] = nodes[23]; Division[1][8] = nodes[19];
+ // nodes that compose each element
+ Division[0][1] = nodes[2]; Division[0][2] = nodes[5]; Division[0][3] = nodes[9]; Division[0][4] = nodes[1];
+ Division[1][1] = nodes[9]; Division[1][2] = nodes[5]; Division[1][3] = nodes[6]; Division[1][4] = nodes[1];
+ Division[2][1] = nodes[5]; Division[2][2] = nodes[0]; Division[2][3] = nodes[6]; Division[2][4] = nodes[1];
+ Division[3][1] = nodes[9]; Division[3][2] = nodes[6]; Division[3][3] = nodes[3]; Division[3][4] = nodes[1];
- Division[2][1] = nodes[25]; Division[2][2] = nodes[17]; Division[2][3] = nodes[18]; Division[2][4] = nodes[23];
- Division[2][5] = nodes[12]; Division[2][6] = nodes[5]; Division[2][7] = nodes[6]; Division[2][8] = nodes[14];
+ }
- Division[3][1] = nodes[16]; Division[3][2] = nodes[25]; Division[3][3] = nodes[23]; Division[3][4] = nodes[19];
- Division[3][5] = nodes[4]; Division[3][6] = nodes[12]; Division[3][7] = nodes[14]; Division[3][8] = nodes[7];
+ if (code == 5) {
+ // number of nodes at each new element
+ Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
+ *nPart = 4;
- }
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[4]; Division[0][3] = nodes[5]; Division[0][4] = nodes[3];
+ Division[1][1] = nodes[5]; Division[1][2] = nodes[4]; Division[1][3] = nodes[7]; Division[1][4] = nodes[3];
+ Division[2][1] = nodes[2]; Division[2][2] = nodes[5]; Division[2][3] = nodes[7]; Division[2][4] = nodes[3];
+ Division[3][1] = nodes[7]; Division[3][2] = nodes[4]; Division[3][3] = nodes[1]; Division[3][4] = nodes[3];
- if (code == 3) {
- // number of nodes at each new element
- Division[0][0] = 9; Division[1][0] = 9; Division[2][0] = 9; Division[3][0] = 9;
- *nPart = 4;
+ }
- // nodes that compose each element
- Division[0][1] = nodes[11]; Division[0][2] = nodes[0]; Division[0][3] = nodes[1]; Division[0][4] = nodes[9];
- Division[0][5] = nodes[24]; Division[0][6] = nodes[16]; Division[0][7] = nodes[17]; Division[0][8] = nodes[22];
+ if (code == 6) {
- Division[1][1] = nodes[3]; Division[1][2] = nodes[11]; Division[1][9] = nodes[2]; Division[1][4] = nodes[2];
- Division[1][5] = nodes[19]; Division[1][6] = nodes[24]; Division[1][7] = nodes[22]; Division[1][8] = nodes[18];
+ unsigned short iDiv, nDiv, edge_div[6][3], max_iVar, iVar, nElem, iElem, iNode, iTetra;
+ bool set_0, set_1, new_div, new_tetra[8][10];
+ long max_edge;
- Division[2][1] = nodes[24]; Division[2][2] = nodes[16]; Division[2][3] = nodes[17]; Division[2][4] = nodes[22];
- Division[2][5] = nodes[15]; Division[2][6] = nodes[4]; Division[2][7] = nodes[5]; Division[2][8] = nodes[13];
+ nDiv = 0;
+ do { new_div = false;
- Division[3][1] = nodes[19]; Division[3][2] = nodes[24]; Division[3][3] = nodes[22]; Division[3][4] = nodes[18];
- Division[3][5] = nodes[7]; Division[3][6] = nodes[15]; Division[3][7] = nodes[13]; Division[3][8] = nodes[6];
+ // Compute the greatest node at the divided edge
+ max_edge = 0; max_iVar = 0;
+ for (iVar = 0; iVar < 6; iVar ++) {
+ max_edge = max(max_edge, edges[iVar]);
+ if ( max_edge == edges[iVar] ) max_iVar = iVar;
+ }
- }
+ // If the edge is divided compose the vector with the information of the division
+ if (edges[max_iVar] >= 0) {
+ if (max_iVar == 0) { edge_div[nDiv][0] = 4; edge_div[nDiv][1] = 0; edge_div[nDiv][2] = 1; }
+ if (max_iVar == 1) { edge_div[nDiv][0] = 5; edge_div[nDiv][1] = 0; edge_div[nDiv][2] = 2; }
+ if (max_iVar == 2) { edge_div[nDiv][0] = 6; edge_div[nDiv][1] = 0; edge_div[nDiv][2] = 3; }
+ if (max_iVar == 3) { edge_div[nDiv][0] = 7; edge_div[nDiv][1] = 1; edge_div[nDiv][2] = 2; }
+ if (max_iVar == 4) { edge_div[nDiv][0] = 8; edge_div[nDiv][1] = 1; edge_div[nDiv][2] = 3; }
+ if (max_iVar == 5) { edge_div[nDiv][0] = 9; edge_div[nDiv][1] = 2; edge_div[nDiv][2] = 3; }
+ nDiv++; new_div = true;
+ }
+ // In order to do not repeat the egde, restart the code
+ edges[max_iVar] = -1;
+ } while (new_div);
- if (code == 4) {
- // number of nodes at each new element
- Division[0][0] = 9; Division[1][0] = 9; Division[2][0] = 9; Division[3][0] = 9;
- *nPart = 4;
- // nodes that compose each element
- Division[0][1] = nodes[20]; Division[0][2] = nodes[8]; Division[0][3] = nodes[1]; Division[0][4] = nodes[9];
- Division[0][5] = nodes[21]; Division[0][6] = nodes[12]; Division[0][7] = nodes[5]; Division[0][8] = nodes[13];
+ // Inicializa
+ for (iVar = 0; iVar < 4; iVar ++) new_tetra[0][iVar] = true;
+ for (iVar = 4; iVar < 10; iVar ++) new_tetra[0][iVar] = false;
- Division[1][1] = nodes[20]; Division[1][2] = nodes[9]; Division[1][3] = nodes[2]; Division[1][4] = nodes[10];
- Division[1][5] = nodes[21]; Division[1][6] = nodes[13]; Division[1][7] = nodes[6]; Division[1][8] = nodes[14];
+ nElem = 1;
+ for (iDiv = 0; iDiv < nDiv; iDiv++) {
+ for (iVar = 0; iVar < 3; iVar++) {
+ short target_elem = -1;
- Division[2][1] = nodes[20]; Division[2][2] = nodes[10]; Division[2][3] = nodes[0]; Division[2][4] = nodes[8];
- Division[2][5] = nodes[21]; Division[2][6] = nodes[15]; Division[2][7] = nodes[4]; Division[2][8] = nodes[12];
+ for (iElem = 0; iElem < nElem; iElem++) {
+ set_0 = false; set_1 = false;
+ if (new_tetra[iElem][edge_div[iDiv][1]]) set_0 = true;
+ if (new_tetra[iElem][edge_div[iDiv][2]]) set_1 = true;
+ if (set_0 && set_1) target_elem = iElem;
+ }
- Division[3][1] = nodes[20]; Division[3][2] = nodes[10]; Division[3][3] = nodes[3]; Division[3][4] = nodes[11];
- Division[3][5] = nodes[21]; Division[3][6] = nodes[14]; Division[3][7] = nodes[7]; Division[3][8] = nodes[15];
+ if (target_elem != -1) {
+ for (iNode = 0; iNode < 10; iNode++)
+ new_tetra[nElem][iNode] = new_tetra[target_elem][iNode];
+ new_tetra[target_elem][edge_div[iDiv][0]] = true;
+ new_tetra[target_elem][edge_div[iDiv][2]] = false;
+ new_tetra[nElem][edge_div[iDiv][0]] = true;
+ new_tetra[nElem][edge_div[iDiv][1]] = false;
+ nElem++;
+ }
+ }
+ }
- }
+ *nPart = nElem;
+
+ for (iTetra = 0; iTetra < nElem; iTetra++) {
+ Division[iTetra][0] = 4;
+ iVar = 1;
+ for (iNode = 0; iNode < 10; iNode++)
+ if (new_tetra[iTetra][iNode] == true) {
+ if (iNode == 0) Division[iTetra][iVar] = nodes[0];
+ if (iNode == 1) Division[iTetra][iVar] = nodes[1];
+ if (iNode == 2) Division[iTetra][iVar] = nodes[2];
+ if (iNode == 3) Division[iTetra][iVar] = nodes[3];
+ if (iNode == 4) Division[iTetra][iVar] = nodes[4];
+ if (iNode == 5) Division[iTetra][iVar] = nodes[5];
+ if (iNode == 6) Division[iTetra][iVar] = nodes[6];
+ if (iNode == 7) Division[iTetra][iVar] = nodes[7];
+ if (iNode == 8) Division[iTetra][iVar] = nodes[8];
+ if (iNode == 9) Division[iTetra][iVar] = nodes[9];
+ iVar++;
+ }
- if (code == 5) {
- // number of nodes at each new element
- Division[0][0] = 9; Division[1][0] = 9;
- *nPart = 2;
+// cout <<"Boolean "<< new_tetra[iTetra][0] <<" "<< new_tetra[iTetra][1] <<" "<< new_tetra[iTetra][2] <<" "<< new_tetra[iTetra][3] <<" "<< new_tetra[iTetra][4]
+// <<" "<< new_tetra[iTetra][5] <<" "<< new_tetra[iTetra][6] <<" "<< new_tetra[iTetra][7] <<" "<< new_tetra[iTetra][8] <<" "<< new_tetra[iTetra][9] << endl;
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[2]; Division[0][4] = nodes[3];
- Division[0][5] = nodes[16]; Division[0][6] = nodes[17]; Division[0][7] = nodes[18]; Division[0][8] = nodes[19];
+// cout <<"Nodes "<< nodes[0] <<" "<< nodes[1] <<" "<< nodes[2] <<" "<< nodes[3] <<" "<< nodes[4]
+// <<" "<< nodes[5] <<" "<< nodes[6] <<" "<< nodes[7] <<" "<< nodes[8] <<" "<< nodes[9] << endl;
- Division[1][1] = nodes[16]; Division[1][2] = nodes[17]; Division[1][3] = nodes[18]; Division[1][4] = nodes[19];
- Division[1][5] = nodes[4]; Division[1][6] = nodes[5]; Division[1][7] = nodes[6]; Division[1][8] = nodes[7];
+// cout <<"Tets "<< Division[iTetra][0] <<" "<< Division[iTetra][1] <<" "<< Division[iTetra][2] <<" "<< Division[iTetra][3] <<" "<< Division[iTetra][4]
+// <<" "<< Division[iTetra][5] <<" "<< Division[iTetra][6] <<" "<< Division[iTetra][7] <<" "<< Division[iTetra][8] <<" "<< Division[iTetra][9] << endl;
- }
+// cin.get();
+ }
- if (code == 6) {
- // number of nodes at each new element
- Division[0][0] = 9; Division[1][0] = 9;
- *nPart = 2;
+ }
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[9]; Division[0][4] = nodes[11];
- Division[0][5] = nodes[4]; Division[0][6] = nodes[5]; Division[0][7] = nodes[13]; Division[0][8] = nodes[15];
+}
- Division[1][1] = nodes[9]; Division[1][2] = nodes[2]; Division[1][3] = nodes[3]; Division[1][4] = nodes[11];
- Division[1][5] = nodes[13]; Division[1][6] = nodes[6]; Division[1][7] = nodes[7]; Division[1][8] = nodes[15];
+void CGridAdaptation::HexaDivision(long code , long *nodes, long **Division, long *nPart) {
- }
+ if (code == 1) {
- if (code == 7) {
- // number of nodes at each new element
- Division[0][0] = 9; Division[1][0] = 9;
- *nPart = 2;
+ // number of nodes at each new element
+ Division[0][0] = 9; Division[1][0] = 9; Division[2][0] = 9; Division[3][0] = 9;
+ Division[4][0] = 9; Division[5][0] = 9; Division[6][0] = 9; Division[7][0] = 9;
+ *nPart = 8;
- // nodes that compose each element
- Division[0][1] = nodes[8]; Division[0][2] = nodes[1]; Division[0][3] = nodes[2]; Division[0][4] = nodes[10];
- Division[0][5] = nodes[12]; Division[0][5] = nodes[5]; Division[0][7] = nodes[6]; Division[0][8] = nodes[14];
+ // nodes that compose each element
+ Division[0][1] = nodes[20]; Division[0][2] = nodes[8]; Division[0][3] = nodes[1]; Division[0][4] = nodes[9];
+ Division[0][5] = nodes[26]; Division[0][6] = nodes[25]; Division[0][7] = nodes[17]; Division[0][8] = nodes[22];
- Division[1][1] = nodes[0]; Division[1][2] = nodes[8]; Division[1][3] = nodes[10]; Division[1][4] = nodes[3];
- Division[1][5] = nodes[4]; Division[1][6] = nodes[12]; Division[1][7] = nodes[14]; Division[1][8] = nodes[7];
+ Division[1][1] = nodes[20]; Division[1][2] = nodes[9]; Division[1][3] = nodes[2]; Division[1][4] = nodes[10];
+ Division[1][5] = nodes[26]; Division[1][6] = nodes[22]; Division[1][7] = nodes[18]; Division[1][8] = nodes[23];
- }
+ Division[2][1] = nodes[20]; Division[2][2] = nodes[10]; Division[2][3] = nodes[3]; Division[2][4] = nodes[11];
+ Division[2][5] = nodes[26]; Division[2][6] = nodes[23]; Division[2][7] = nodes[19]; Division[2][8] = nodes[24];
-}
+ Division[3][1] = nodes[20]; Division[3][2] = nodes[11]; Division[3][3] = nodes[0]; Division[3][4] = nodes[8];
+ Division[3][5] = nodes[26]; Division[3][6] = nodes[24]; Division[3][7] = nodes[16]; Division[3][8] = nodes[25];
-void CGridAdaptation::PyramDivision(long code , long *nodes, long **Division, long *nPart) {
+ Division[4][1] = nodes[26]; Division[4][2] = nodes[25]; Division[4][3] = nodes[17]; Division[4][4] = nodes[22];
+ Division[4][5] = nodes[21]; Division[4][6] = nodes[12]; Division[4][7] = nodes[5]; Division[4][8] = nodes[13];
- if (code == 1) {
+ Division[5][1] = nodes[26]; Division[5][2] = nodes[22]; Division[5][3] = nodes[18]; Division[5][4] = nodes[23];
+ Division[5][5] = nodes[21]; Division[5][6] = nodes[13]; Division[5][7] = nodes[6]; Division[5][8] = nodes[14];
- // number of nodes at each new element
- Division[0][0] = 6;
- *nPart = 1;
+ Division[6][1] = nodes[26]; Division[6][2] = nodes[23]; Division[6][3] = nodes[19]; Division[6][4] = nodes[24];
+ Division[6][5] = nodes[21]; Division[6][6] = nodes[14]; Division[6][7] = nodes[7]; Division[6][8] = nodes[15];
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[2]; Division[0][4] = nodes[3]; Division[0][5] = nodes[4];
+ Division[7][1] = nodes[26]; Division[7][2] = nodes[24]; Division[7][3] = nodes[16]; Division[7][4] = nodes[25];
+ Division[7][5] = nodes[21]; Division[7][6] = nodes[15]; Division[7][7] = nodes[4]; Division[7][8] = nodes[12];
- }
+ }
- if (code == 2) {
- // number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5;
- *nPart = 3;
+ if (code == 2) {
+ // number of nodes at each new element
+ Division[0][0] = 9; Division[1][0] = 9; Division[2][0] = 9; Division[3][0] = 9;
+ *nPart = 4;
- // nodes that compose each element
- Division[0][1] = nodes[5]; Division[0][2] = nodes[1]; Division[0][3] = nodes[2]; Division[0][4] = nodes[4];
+ // nodes that compose each element
+ Division[0][1] = nodes[8]; Division[0][2] = nodes[1]; Division[0][3] = nodes[2]; Division[0][4] = nodes[10];
+ Division[0][5] = nodes[25]; Division[0][17] = nodes[25]; Division[0][7] = nodes[18]; Division[0][8] = nodes[23];
- Division[1][1] = nodes[5]; Division[1][2] = nodes[2]; Division[1][3] = nodes[3]; Division[1][4] = nodes[4];
+ Division[1][1] = nodes[0]; Division[1][2] = nodes[8]; Division[1][3] = nodes[10]; Division[1][4] = nodes[3];
+ Division[1][5] = nodes[16]; Division[1][6] = nodes[25]; Division[1][7] = nodes[23]; Division[1][8] = nodes[19];
- Division[2][1] = nodes[5]; Division[2][2] = nodes[3]; Division[2][3] = nodes[0]; Division[2][4] = nodes[4];
+ Division[2][1] = nodes[25]; Division[2][2] = nodes[17]; Division[2][3] = nodes[18]; Division[2][4] = nodes[23];
+ Division[2][5] = nodes[12]; Division[2][6] = nodes[5]; Division[2][7] = nodes[6]; Division[2][8] = nodes[14];
- }
+ Division[3][1] = nodes[16]; Division[3][2] = nodes[25]; Division[3][3] = nodes[23]; Division[3][4] = nodes[19];
+ Division[3][5] = nodes[4]; Division[3][6] = nodes[12]; Division[3][7] = nodes[14]; Division[3][8] = nodes[7];
- if (code == 3) {
- // number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5;
- *nPart = 3;
+ }
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[6]; Division[0][4] = nodes[4];
+ if (code == 3) {
+ // number of nodes at each new element
+ Division[0][0] = 9; Division[1][0] = 9; Division[2][0] = 9; Division[3][0] = 9;
+ *nPart = 4;
- Division[1][1] = nodes[0]; Division[1][2] = nodes[6]; Division[1][3] = nodes[3]; Division[1][4] = nodes[4];
+ // nodes that compose each element
+ Division[0][1] = nodes[11]; Division[0][2] = nodes[0]; Division[0][3] = nodes[1]; Division[0][4] = nodes[9];
+ Division[0][5] = nodes[24]; Division[0][6] = nodes[16]; Division[0][7] = nodes[17]; Division[0][8] = nodes[22];
- Division[2][1] = nodes[3]; Division[2][2] = nodes[6]; Division[2][3] = nodes[2]; Division[2][4] = nodes[4];
+ Division[1][1] = nodes[3]; Division[1][2] = nodes[11]; Division[1][9] = nodes[2]; Division[1][4] = nodes[2];
+ Division[1][5] = nodes[19]; Division[1][6] = nodes[24]; Division[1][7] = nodes[22]; Division[1][8] = nodes[18];
- }
+ Division[2][1] = nodes[24]; Division[2][2] = nodes[16]; Division[2][3] = nodes[17]; Division[2][4] = nodes[22];
+ Division[2][5] = nodes[15]; Division[2][6] = nodes[4]; Division[2][7] = nodes[5]; Division[2][8] = nodes[13];
- if (code == 4) {
- // number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5;
- *nPart = 3;
+ Division[3][1] = nodes[19]; Division[3][2] = nodes[24]; Division[3][3] = nodes[22]; Division[3][4] = nodes[18];
+ Division[3][5] = nodes[7]; Division[3][6] = nodes[15]; Division[3][7] = nodes[13]; Division[3][8] = nodes[6];
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[7]; Division[0][4] = nodes[4];
+ }
- Division[1][1] = nodes[1]; Division[1][2] = nodes[2]; Division[1][3] = nodes[7]; Division[1][4] = nodes[4];
+ if (code == 4) {
+ // number of nodes at each new element
+ Division[0][0] = 9; Division[1][0] = 9; Division[2][0] = 9; Division[3][0] = 9;
+ *nPart = 4;
- Division[2][1] = nodes[0]; Division[2][2] = nodes[7]; Division[2][3] = nodes[3]; Division[2][4] = nodes[4];
+ // nodes that compose each element
+ Division[0][1] = nodes[20]; Division[0][2] = nodes[8]; Division[0][3] = nodes[1]; Division[0][4] = nodes[9];
+ Division[0][5] = nodes[21]; Division[0][6] = nodes[12]; Division[0][7] = nodes[5]; Division[0][8] = nodes[13];
- }
+ Division[1][1] = nodes[20]; Division[1][2] = nodes[9]; Division[1][3] = nodes[2]; Division[1][4] = nodes[10];
+ Division[1][5] = nodes[21]; Division[1][6] = nodes[13]; Division[1][7] = nodes[6]; Division[1][8] = nodes[14];
- if (code == 5) {
- // number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5;
- *nPart = 3;
+ Division[2][1] = nodes[20]; Division[2][2] = nodes[10]; Division[2][3] = nodes[0]; Division[2][4] = nodes[8];
+ Division[2][5] = nodes[21]; Division[2][6] = nodes[15]; Division[2][7] = nodes[4]; Division[2][8] = nodes[12];
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[8]; Division[0][4] = nodes[4];
+ Division[3][1] = nodes[20]; Division[3][2] = nodes[10]; Division[3][3] = nodes[3]; Division[3][4] = nodes[11];
+ Division[3][5] = nodes[21]; Division[3][6] = nodes[14]; Division[3][7] = nodes[7]; Division[3][8] = nodes[15];
- Division[1][1] = nodes[1]; Division[1][2] = nodes[2]; Division[1][3] = nodes[8]; Division[1][4] = nodes[4];
+ }
- Division[2][1] = nodes[8]; Division[2][2] = nodes[2]; Division[2][3] = nodes[3]; Division[2][4] = nodes[4];
+ if (code == 5) {
+ // number of nodes at each new element
+ Division[0][0] = 9; Division[1][0] = 9;
+ *nPart = 2;
- }
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[2]; Division[0][4] = nodes[3];
+ Division[0][5] = nodes[16]; Division[0][6] = nodes[17]; Division[0][7] = nodes[18]; Division[0][8] = nodes[19];
- if (code == 6) {
- // number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
- *nPart = 4;
+ Division[1][1] = nodes[16]; Division[1][2] = nodes[17]; Division[1][3] = nodes[18]; Division[1][4] = nodes[19];
+ Division[1][5] = nodes[4]; Division[1][6] = nodes[5]; Division[1][7] = nodes[6]; Division[1][8] = nodes[7];
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[5]; Division[0][3] = nodes[3]; Division[0][4] = nodes[4];
+ }
- Division[1][1] = nodes[5]; Division[1][2] = nodes[1]; Division[1][3] = nodes[6]; Division[1][4] = nodes[4];
+ if (code == 6) {
+ // number of nodes at each new element
+ Division[0][0] = 9; Division[1][0] = 9;
+ *nPart = 2;
- Division[2][1] = nodes[5]; Division[2][2] = nodes[6]; Division[2][3] = nodes[3]; Division[2][4] = nodes[4];
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[9]; Division[0][4] = nodes[11];
+ Division[0][5] = nodes[4]; Division[0][6] = nodes[5]; Division[0][7] = nodes[13]; Division[0][8] = nodes[15];
- Division[3][1] = nodes[6]; Division[3][2] = nodes[2]; Division[3][3] = nodes[3]; Division[3][4] = nodes[4];
+ Division[1][1] = nodes[9]; Division[1][2] = nodes[2]; Division[1][3] = nodes[3]; Division[1][4] = nodes[11];
+ Division[1][5] = nodes[13]; Division[1][6] = nodes[6]; Division[1][7] = nodes[7]; Division[1][8] = nodes[15];
- }
+ }
- if (code == 7) {
- // number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
- *nPart = 4;
+ if (code == 7) {
+ // number of nodes at each new element
+ Division[0][0] = 9; Division[1][0] = 9;
+ *nPart = 2;
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[6]; Division[0][4] = nodes[4];
+ // nodes that compose each element
+ Division[0][1] = nodes[8]; Division[0][2] = nodes[1]; Division[0][3] = nodes[2]; Division[0][4] = nodes[10];
+ Division[0][5] = nodes[12]; Division[0][5] = nodes[5]; Division[0][7] = nodes[6]; Division[0][8] = nodes[14];
- Division[1][1] = nodes[0]; Division[1][2] = nodes[6]; Division[1][3] = nodes[7]; Division[1][4] = nodes[4];
+ Division[1][1] = nodes[0]; Division[1][2] = nodes[8]; Division[1][3] = nodes[10]; Division[1][4] = nodes[3];
+ Division[1][5] = nodes[4]; Division[1][6] = nodes[12]; Division[1][7] = nodes[14]; Division[1][8] = nodes[7];
- Division[2][1] = nodes[6]; Division[2][2] = nodes[2]; Division[2][3] = nodes[7]; Division[2][4] = nodes[4];
+ }
- Division[3][1] = nodes[0]; Division[3][2] = nodes[7]; Division[3][3] = nodes[3]; Division[3][4] = nodes[4];
+}
- }
+void CGridAdaptation::PyramDivision(long code , long *nodes, long **Division, long *nPart) {
- if (code == 8) {
- // number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
- *nPart = 4;
+ if (code == 1) {
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[8]; Division[0][4] = nodes[4];
+ // number of nodes at each new element
+ Division[0][0] = 6;
+ *nPart = 1;
- Division[1][1] = nodes[8]; Division[1][2] = nodes[1]; Division[1][3] = nodes[7]; Division[1][4] = nodes[4];
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[2]; Division[0][4] = nodes[3]; Division[0][5] = nodes[4];
- Division[2][1] = nodes[1]; Division[2][2] = nodes[2]; Division[2][3] = nodes[7]; Division[2][4] = nodes[4];
+ }
- Division[3][1] = nodes[8]; Division[3][2] = nodes[7]; Division[3][3] = nodes[3]; Division[3][4] = nodes[4];
+ if (code == 2) {
+ // number of nodes at each new element
+ Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5;
+ *nPart = 3;
- }
+ // nodes that compose each element
+ Division[0][1] = nodes[5]; Division[0][2] = nodes[1]; Division[0][3] = nodes[2]; Division[0][4] = nodes[4];
- if (code == 9) {
- // number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
- *nPart = 4;
+ Division[1][1] = nodes[5]; Division[1][2] = nodes[2]; Division[1][3] = nodes[3]; Division[1][4] = nodes[4];
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[5]; Division[0][3] = nodes[8]; Division[0][4] = nodes[4];
+ Division[2][1] = nodes[5]; Division[2][2] = nodes[3]; Division[2][3] = nodes[0]; Division[2][4] = nodes[4];
- Division[1][1] = nodes[5]; Division[1][2] = nodes[1]; Division[1][3] = nodes[2]; Division[1][4] = nodes[4];
+ }
- Division[2][1] = nodes[8]; Division[2][2] = nodes[5]; Division[2][3] = nodes[2]; Division[2][4] = nodes[4];
+ if (code == 3) {
+ // number of nodes at each new element
+ Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5;
+ *nPart = 3;
- Division[3][1] = nodes[8]; Division[3][2] = nodes[2]; Division[3][3] = nodes[3]; Division[3][4] = nodes[4];
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[6]; Division[0][4] = nodes[4];
- }
+ Division[1][1] = nodes[0]; Division[1][2] = nodes[6]; Division[1][3] = nodes[3]; Division[1][4] = nodes[4];
- if (code == 10) {
- // number of nodes at each new element
- Division[0][0] = 6; Division[1][0] = 6;
- *nPart = 2;
+ Division[2][1] = nodes[3]; Division[2][2] = nodes[6]; Division[2][3] = nodes[2]; Division[2][4] = nodes[4];
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[5]; Division[0][3] = nodes[7]; Division[0][4] = nodes[3]; Division[0][5] = nodes[4];
+ }
- Division[1][1] = nodes[5]; Division[1][2] = nodes[1]; Division[1][3] = nodes[2]; Division[1][4] = nodes[7]; Division[1][5] = nodes[4];
+ if (code == 4) {
+ // number of nodes at each new element
+ Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5;
+ *nPart = 3;
- }
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[7]; Division[0][4] = nodes[4];
- if (code == 11) {
- // number of nodes at each new element
- Division[0][0] = 6; Division[1][0] = 6;
- *nPart = 2;
+ Division[1][1] = nodes[1]; Division[1][2] = nodes[2]; Division[1][3] = nodes[7]; Division[1][4] = nodes[4];
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[6]; Division[0][4] = nodes[8]; Division[0][5] = nodes[4];
+ Division[2][1] = nodes[0]; Division[2][2] = nodes[7]; Division[2][3] = nodes[3]; Division[2][4] = nodes[4];
- Division[1][1] = nodes[8]; Division[1][2] = nodes[6]; Division[1][3] = nodes[2]; Division[1][4] = nodes[3]; Division[1][5] = nodes[4];
+ }
- }
+ if (code == 5) {
+ // number of nodes at each new element
+ Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5;
+ *nPart = 3;
- if (code == 12) {
- // number of nodes at each new element
- Division[0][0] = 6; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
- *nPart = 4;
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[8]; Division[0][4] = nodes[4];
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[5]; Division[0][3] = nodes[7]; Division[0][4] = nodes[3]; Division[0][5] = nodes[4];
+ Division[1][1] = nodes[1]; Division[1][2] = nodes[2]; Division[1][3] = nodes[8]; Division[1][4] = nodes[4];
- Division[1][1] = nodes[5]; Division[1][2] = nodes[1]; Division[1][3] = nodes[6]; Division[1][4] = nodes[4];
+ Division[2][1] = nodes[8]; Division[2][2] = nodes[2]; Division[2][3] = nodes[3]; Division[2][4] = nodes[4];
- Division[2][1] = nodes[5]; Division[2][2] = nodes[6]; Division[2][3] = nodes[7]; Division[2][4] = nodes[4];
+ }
- Division[3][1] = nodes[6]; Division[3][2] = nodes[2]; Division[3][3] = nodes[7]; Division[3][4] = nodes[4];
+ if (code == 6) {
+ // number of nodes at each new element
+ Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
+ *nPart = 4;
- }
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[5]; Division[0][3] = nodes[3]; Division[0][4] = nodes[4];
- if (code == 13) {
- // number of nodes at each new element
- Division[0][0] = 6; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
- *nPart = 4;
+ Division[1][1] = nodes[5]; Division[1][2] = nodes[1]; Division[1][3] = nodes[6]; Division[1][4] = nodes[4];
- // nodes that compose each element
- Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[6]; Division[0][4] = nodes[8]; Division[0][5] = nodes[4];
+ Division[2][1] = nodes[5]; Division[2][2] = nodes[6]; Division[2][3] = nodes[3]; Division[2][4] = nodes[4];
- Division[1][1] = nodes[6]; Division[1][2] = nodes[2]; Division[1][3] = nodes[7]; Division[1][4] = nodes[4];
+ Division[3][1] = nodes[6]; Division[3][2] = nodes[2]; Division[3][3] = nodes[3]; Division[3][4] = nodes[4];
- Division[2][1] = nodes[8]; Division[2][2] = nodes[6]; Division[2][3] = nodes[7]; Division[2][4] = nodes[4];
+ }
- Division[3][1] = nodes[8]; Division[3][2] = nodes[7]; Division[3][3] = nodes[3]; Division[3][4] = nodes[4];
+ if (code == 7) {
+ // number of nodes at each new element
+ Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
+ *nPart = 4;
- }
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[6]; Division[0][4] = nodes[4];
- if (code == 14) {
- // number of nodes at each new element
- Division[0][0] = 6; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
- *nPart = 4;
+ Division[1][1] = nodes[0]; Division[1][2] = nodes[6]; Division[1][3] = nodes[7]; Division[1][4] = nodes[4];
- // nodes that compose each element
- Division[0][1] = nodes[5]; Division[0][2] = nodes[1]; Division[0][3] = nodes[2]; Division[0][4] = nodes[7]; Division[0][5] = nodes[4];
+ Division[2][1] = nodes[6]; Division[2][2] = nodes[2]; Division[2][3] = nodes[7]; Division[2][4] = nodes[4];
- Division[1][1] = nodes[0]; Division[1][2] = nodes[5]; Division[1][3] = nodes[8]; Division[1][4] = nodes[4];
+ Division[3][1] = nodes[0]; Division[3][2] = nodes[7]; Division[3][3] = nodes[3]; Division[3][4] = nodes[4];
- Division[2][1] = nodes[8]; Division[2][2] = nodes[5]; Division[2][3] = nodes[7]; Division[2][4] = nodes[4];
+ }
- Division[3][1] = nodes[8]; Division[3][2] = nodes[7]; Division[3][3] = nodes[3]; Division[3][4] = nodes[4];
+ if (code == 8) {
+ // number of nodes at each new element
+ Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
+ *nPart = 4;
- }
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[8]; Division[0][4] = nodes[4];
- if (code == 15) {
- // number of nodes at each new element
- Division[0][0] = 6; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
- *nPart = 4;
+ Division[1][1] = nodes[8]; Division[1][2] = nodes[1]; Division[1][3] = nodes[7]; Division[1][4] = nodes[4];
- // nodes that compose each element
- Division[0][1] = nodes[8]; Division[0][2] = nodes[6]; Division[0][3] = nodes[2]; Division[0][4] = nodes[3]; Division[0][5] = nodes[4];
+ Division[2][1] = nodes[1]; Division[2][2] = nodes[2]; Division[2][3] = nodes[7]; Division[2][4] = nodes[4];
- Division[1][1] = nodes[0]; Division[1][2] = nodes[5]; Division[1][3] = nodes[8]; Division[1][4] = nodes[4];
+ Division[3][1] = nodes[8]; Division[3][2] = nodes[7]; Division[3][3] = nodes[3]; Division[3][4] = nodes[4];
- Division[2][1] = nodes[5]; Division[2][2] = nodes[1]; Division[2][3] = nodes[6]; Division[2][4] = nodes[4];
+ }
- Division[3][1] = nodes[5]; Division[3][2] = nodes[6]; Division[3][3] = nodes[8]; Division[3][4] = nodes[4];
+ if (code == 9) {
+ // number of nodes at each new element
+ Division[0][0] = 5; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
+ *nPart = 4;
- }
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[5]; Division[0][3] = nodes[8]; Division[0][4] = nodes[4];
- if (code == 16) {
- // number of nodes at each new element
- Division[0][0] = 6; Division[1][0] = 6; Division[2][0] = 6; Division[3][0] = 6;
- *nPart = 4;
+ Division[1][1] = nodes[5]; Division[1][2] = nodes[1]; Division[1][3] = nodes[2]; Division[1][4] = nodes[4];
- // nodes that compose each element
- Division[0][1] = nodes[9]; Division[0][2] = nodes[8]; Division[0][3] = nodes[0]; Division[0][4] = nodes[5]; Division[0][5] = nodes[4];
+ Division[2][1] = nodes[8]; Division[2][2] = nodes[5]; Division[2][3] = nodes[2]; Division[2][4] = nodes[4];
- Division[1][1] = nodes[9]; Division[1][2] = nodes[5]; Division[1][3] = nodes[1]; Division[1][4] = nodes[6]; Division[1][5] = nodes[4];
+ Division[3][1] = nodes[8]; Division[3][2] = nodes[2]; Division[3][3] = nodes[3]; Division[3][4] = nodes[4];
- Division[2][1] = nodes[9]; Division[2][2] = nodes[6]; Division[2][3] = nodes[2]; Division[2][4] = nodes[7]; Division[2][5] = nodes[4];
+ }
- Division[3][1] = nodes[9]; Division[3][2] = nodes[7]; Division[3][3] = nodes[3]; Division[3][4] = nodes[8]; Division[3][5] = nodes[4];
+ if (code == 10) {
+ // number of nodes at each new element
+ Division[0][0] = 6; Division[1][0] = 6;
+ *nPart = 2;
- }
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[5]; Division[0][3] = nodes[7]; Division[0][4] = nodes[3]; Division[0][5] = nodes[4];
-}
+ Division[1][1] = nodes[5]; Division[1][2] = nodes[1]; Division[1][3] = nodes[2]; Division[1][4] = nodes[7]; Division[1][5] = nodes[4];
-void CGridAdaptation::SetHomothetic_Adaptation2D(CGeometry *geometry, CPhysicalGeometry *geo_adapt,
- CConfig *config) {
+ }
- unsigned long iPoint, iElem, iEdge, ip_0, ip_1, ip_2, ip_3, iVertex;
- unsigned short iDim, iMarker, iVar;
- long no_0 = 0, no_1 = 0, no_2 = 0, no_3 = 0;
- unsigned short nMarker_Max = config->GetnMarker_Max();
+ if (code == 11) {
+ // number of nodes at each new element
+ Division[0][0] = 6; Division[1][0] = 6;
+ *nPart = 2;
- long *TriangleAdaptCode;
- long **TriangleEdgeIndex; bool **TriangleEdgeCode; long **TriangleEdgeNode;
-
- long *RectAdaptCode;
- long **RectEdgeIndex; bool **RectEdgeCode; long **RectEdgeNode;
- long **RectElemIndex; bool **RectElemCode; long **RectElemNode;
-
- bool Restart_Flow = false;
- bool Restart_Adjoint = false;
-
- if ((config->GetKind_Adaptation() == FULL_FLOW) ||
- (config->GetKind_Adaptation() == GRAD_FLOW) ||
- (config->GetKind_Adaptation() == FULL_ADJOINT) ||
- (config->GetKind_Adaptation() == GRAD_ADJOINT) ||
- (config->GetKind_Adaptation() == GRAD_FLOW_ADJ) ||
- (config->GetKind_Adaptation() == REMAINING) ||
- (config->GetKind_Adaptation() == COMPUTABLE)) Restart_Flow = true;
-
- if ((config->GetKind_Adaptation() == FULL_ADJOINT) ||
- (config->GetKind_Adaptation() == GRAD_ADJOINT) ||
- (config->GetKind_Adaptation() == GRAD_FLOW_ADJ) ||
- (config->GetKind_Adaptation() == REMAINING) ||
- (config->GetKind_Adaptation() == COMPUTABLE)) Restart_Adjoint = true;
-
- TriangleAdaptCode = new long[geometry->GetnElem()];
- TriangleEdgeIndex = new long*[geometry->GetnElem()];
- TriangleEdgeCode = new bool*[geometry->GetnElem()];
- TriangleEdgeNode = new long*[geometry->GetnElem()];
-
- RectAdaptCode = new long[geometry->GetnElem()];
- RectEdgeIndex = new long*[geometry->GetnElem()];
- RectEdgeCode = new bool*[geometry->GetnElem()];
- RectEdgeNode = new long*[geometry->GetnElem()];
- RectElemIndex = new long*[geometry->GetnElem()];
- RectElemCode = new bool*[geometry->GetnElem()];
- RectElemNode = new long*[geometry->GetnElem()];
-
-
- for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
- TriangleEdgeIndex[iElem] = new long [3];
- TriangleEdgeCode[iElem] = new bool [3];
- TriangleEdgeNode[iElem] = new long [3];
-
- RectEdgeIndex[iElem] = new long [4];
- RectEdgeCode[iElem] = new bool [4];
- RectEdgeNode[iElem] = new long [4];
- RectElemIndex[iElem] = new long [1];
- RectElemCode[iElem] = new bool [1];
- RectElemNode[iElem] = new long [1];
- }
-
- for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
-
- if (geometry->elem[iElem]->GetVTK_Type() == TRIANGLE) {
- ip_0 = geometry->elem[iElem]->GetNode(0);
- ip_1 = geometry->elem[iElem]->GetNode(1);
- ip_2 = geometry->elem[iElem]->GetNode(2);
-
- TriangleEdgeIndex[iElem][0] = geometry->FindEdge(ip_0, ip_1); TriangleEdgeCode[iElem][0] = false; TriangleEdgeNode[iElem][0] = -1;
- TriangleEdgeIndex[iElem][1] = geometry->FindEdge(ip_1, ip_2); TriangleEdgeCode[iElem][1] = false; TriangleEdgeNode[iElem][1] = -1;
- TriangleEdgeIndex[iElem][2] = geometry->FindEdge(ip_2, ip_0); TriangleEdgeCode[iElem][2] = false; TriangleEdgeNode[iElem][2] = -1;
- }
- if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) {
- ip_0 = geometry->elem[iElem]->GetNode(0);
- ip_1 = geometry->elem[iElem]->GetNode(1);
- ip_2 = geometry->elem[iElem]->GetNode(2);
- ip_3 = geometry->elem[iElem]->GetNode(3);
-
- RectEdgeIndex[iElem][0] = geometry->FindEdge(ip_0, ip_1); RectEdgeCode[iElem][0] = false; RectEdgeNode[iElem][0] = -1;
- RectEdgeIndex[iElem][1] = geometry->FindEdge(ip_1, ip_2); RectEdgeCode[iElem][1] = false; RectEdgeNode[iElem][1] = -1;
- RectEdgeIndex[iElem][2] = geometry->FindEdge(ip_2, ip_3); RectEdgeCode[iElem][2] = false; RectEdgeNode[iElem][2] = -1;
- RectEdgeIndex[iElem][3] = geometry->FindEdge(ip_3, ip_0); RectEdgeCode[iElem][3] = false; RectEdgeNode[iElem][3] = -1;
-
- RectElemIndex[iElem][0] = iElem; RectElemCode[iElem][0] = false; RectElemNode[iElem][0] = -1;
- }
-
- }
-
- /*--- Initial edges that are going to be divided ---*/
-
- bool *DivEdge = new bool[geometry->GetnEdge()];
- bool *DivElem = new bool[geometry->GetnElem()];
-
-
- for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) DivEdge[iEdge] = false;
-
- for (iElem = 0; iElem < geometry->GetnElem(); iElem++)
- DivElem[iElem] = geometry->elem[iElem]->GetDivide();
-
- /*--- Set the edge division in the reactangles and in the edge list. ---*/
-
- for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
- if (DivElem[iElem] == true) {
- if (geometry->elem[iElem]->GetVTK_Type() == TRIANGLE) {
- for (int iIndex = 0; iIndex < 3; iIndex++) {
- DivEdge[TriangleEdgeIndex[iElem][iIndex]] = true;
- TriangleEdgeCode[iElem][iIndex] = true;
- }
- }
- if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) {
- for (int iIndex = 0; iIndex < 4; iIndex++) {
- DivEdge[RectEdgeIndex[iElem][iIndex]] = true;
- RectEdgeCode[iElem][iIndex] = true;
- }
- }
- }
- }
-
- for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++)
- if (config->GetMarker_All_KindBC(iMarker) == NEARFIELD_BOUNDARY)
- for (unsigned long iBoundElem = 0; iBoundElem < geometry->GetnElem_Bound(iMarker); iBoundElem++) {
-
- ip_0 = geometry->bound[iMarker][iBoundElem]->GetNode(0);
- ip_1 = geometry->bound[iMarker][iBoundElem]->GetNode(1);
-
- long edge = geometry->FindEdge(ip_0, ip_1);
-
- if (DivEdge[edge]) {
-
- unsigned long iv_1 = geometry->node[ip_1]->GetVertex(iMarker);
- unsigned long ip_1_Nearfield = geometry->vertex[iMarker][iv_1]->GetDonorPoint();
- unsigned long iv_0 = geometry->node[ip_0]->GetVertex(iMarker);
- unsigned long ip_0_Nearfield = geometry->vertex[iMarker][iv_0]->GetDonorPoint();
-
- long edge_Nearfield = geometry->FindEdge(ip_0_Nearfield, ip_1_Nearfield);
-
- DivEdge[edge_Nearfield] = true;
-
- }
-
- }
-
- /*--- We must verify that all the elements have the right edges marked ---*/
- for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
- if (geometry->elem[iElem]->GetVTK_Type() == TRIANGLE) {
- for (int iIndex = 0; iIndex < 3; iIndex++) {
- if (DivEdge[TriangleEdgeIndex[iElem][iIndex]] == true) {
- TriangleEdgeCode[iElem][iIndex] = true;
- }
- }
- }
- if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) {
- for (int iIndex = 0; iIndex < 4; iIndex++) {
- if (DivEdge[RectEdgeIndex[iElem][iIndex]] == true) {
- RectEdgeCode[iElem][iIndex] = true;
- }
- }
- }
- }
-
- /*--- Only those elements that verify certain rules will be marked for hexa adaptation...
- the others will need a new point in the middle and RectExts ---*/
-
- for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
- if (geometry->elem[iElem]->GetVTK_Type() == TRIANGLE) {
- TriangleAdaptCode[iElem] = CheckTriangleCode(TriangleEdgeCode[iElem]);
- }
- if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) {
- RectAdaptCode[iElem] = CheckRectCode(RectEdgeCode[iElem]);
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[6]; Division[0][4] = nodes[8]; Division[0][5] = nodes[4];
- /*--- Set the RectAdaptCode ---*/
+ Division[1][1] = nodes[8]; Division[1][2] = nodes[6]; Division[1][3] = nodes[2]; Division[1][4] = nodes[3]; Division[1][5] = nodes[4];
- if (RectAdaptCode[iElem] == 1) {
- RectElemCode[iElem][0] = true;
- }
- }
- }
+ }
- /*--- Create the new nodes on the edges, on the faces, and in the element. ---*/
+ if (code == 12) {
+ // number of nodes at each new element
+ Division[0][0] = 6; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
+ *nPart = 4;
- long *NodeAtEdges = new long[geometry->GetnEdge()];
- long *NodeAtElem = new long[geometry->GetnElem()];
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[5]; Division[0][3] = nodes[7]; Division[0][4] = nodes[3]; Division[0][5] = nodes[4];
- for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) NodeAtEdges[iEdge] = -1;
- for (iElem = 0; iElem < geometry->GetnElem(); iElem++) NodeAtElem[iElem] = -1;
+ Division[1][1] = nodes[5]; Division[1][2] = nodes[1]; Division[1][3] = nodes[6]; Division[1][4] = nodes[4];
- nPoint_new = geometry->GetnPoint();
+ Division[2][1] = nodes[5]; Division[2][2] = nodes[6]; Division[2][3] = nodes[7]; Division[2][4] = nodes[4];
- su2double **NewNodeCoord;
- NewNodeCoord = new su2double *[4*geometry->GetnPoint()];
- for (iPoint = 0; iPoint < 4*geometry->GetnPoint(); iPoint++)
- NewNodeCoord[iPoint] = new su2double[geometry->GetnDim()];
+ Division[3][1] = nodes[6]; Division[3][2] = nodes[2]; Division[3][3] = nodes[7]; Division[3][4] = nodes[4];
- if (Restart_Flow) {
- ConsVar_Adapt = new su2double *[4*geometry->GetnPoint()];
- for (iPoint = 0; iPoint < 4*geometry->GetnPoint(); iPoint++)
- ConsVar_Adapt[iPoint] = new su2double[nVar];
- }
-
- if (Restart_Adjoint) {
- AdjVar_Adapt = new su2double *[4*geometry->GetnPoint()];
- for (iPoint = 0; iPoint < 4*geometry->GetnPoint(); iPoint++)
- AdjVar_Adapt[iPoint] = new su2double[nVar];
- }
-
- /*--- Set the value of the variables ---*/
-
- for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++) {
- for (iVar = 0; iVar < nVar; iVar ++) {
- if (Restart_Flow) ConsVar_Adapt[iPoint][iVar] = ConsVar_Sol[iPoint][iVar];
- if (Restart_Adjoint) AdjVar_Adapt[iPoint][iVar] = AdjVar_Sol[iPoint][iVar];
- }
- }
+ }
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- if (geometry->elem[iElem]->GetVTK_Type() == TRIANGLE) {
+ if (code == 13) {
+ // number of nodes at each new element
+ Division[0][0] = 6; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
+ *nPart = 4;
- ip_0 = geometry->elem[iElem]->GetNode(0);
- ip_1 = geometry->elem[iElem]->GetNode(1);
- ip_2 = geometry->elem[iElem]->GetNode(2);
+ // nodes that compose each element
+ Division[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[6]; Division[0][4] = nodes[8]; Division[0][5] = nodes[4];
- for (int iIndex = 0; iIndex < 3; iIndex++) {
+ Division[1][1] = nodes[6]; Division[1][2] = nodes[2]; Division[1][3] = nodes[7]; Division[1][4] = nodes[4];
- if (TriangleEdgeCode[iElem][iIndex] == true) {
- if (NodeAtEdges[TriangleEdgeIndex[iElem][iIndex]] != -1)
- TriangleEdgeNode[iElem][iIndex] = NodeAtEdges[TriangleEdgeIndex[iElem][iIndex]];
+ Division[2][1] = nodes[8]; Division[2][2] = nodes[6]; Division[2][3] = nodes[7]; Division[2][4] = nodes[4];
- if (NodeAtEdges[TriangleEdgeIndex[iElem][iIndex]] == -1) {
-
- NodeAtEdges[TriangleEdgeIndex[iElem][iIndex]] = nPoint_new;
- TriangleEdgeNode[iElem][iIndex] = nPoint_new;
-
- /*--- Compute the coordinates of the new node ---*/
+ Division[3][1] = nodes[8]; Division[3][2] = nodes[7]; Division[3][3] = nodes[3]; Division[3][4] = nodes[4];
- if (iIndex == 0) {no_0 = ip_0; no_1 = ip_1;}
- if (iIndex == 1) {no_0 = ip_1; no_1 = ip_2;}
- if (iIndex == 2) {no_0 = ip_2; no_1 = ip_0;}
- for (iDim = 0; iDim < geometry->GetnDim(); iDim++)
- NewNodeCoord[nPoint_new][iDim] = 0.5*(geometry->node[no_0]->GetCoord(iDim)+geometry->node[no_1]->GetCoord(iDim));
-
- for (iVar = 0; iVar < nVar; iVar ++) {
- if (Restart_Flow) ConsVar_Adapt[nPoint_new][iVar] = 0.5 * (ConsVar_Adapt[no_0][iVar]+ConsVar_Adapt[no_1][iVar]);
- if (Restart_Adjoint) AdjVar_Adapt[nPoint_new][iVar] = 0.5 * (AdjVar_Adapt[no_0][iVar]+AdjVar_Adapt[no_1][iVar]);
- }
-
- nPoint_new++;
- }
- }
- }
- }
- if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) {
-
- ip_0 = geometry->elem[iElem]->GetNode(0);
- ip_1 = geometry->elem[iElem]->GetNode(1);
- ip_2 = geometry->elem[iElem]->GetNode(2);
- ip_3 = geometry->elem[iElem]->GetNode(3);
+ }
- for (int iIndex = 0; iIndex < 4; iIndex++) {
+ if (code == 14) {
+ // number of nodes at each new element
+ Division[0][0] = 6; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
+ *nPart = 4;
- if (RectEdgeCode[iElem][iIndex] == true) {
- if (NodeAtEdges[RectEdgeIndex[iElem][iIndex]] != -1)
- RectEdgeNode[iElem][iIndex] = NodeAtEdges[RectEdgeIndex[iElem][iIndex]];
+ // nodes that compose each element
+ Division[0][1] = nodes[5]; Division[0][2] = nodes[1]; Division[0][3] = nodes[2]; Division[0][4] = nodes[7]; Division[0][5] = nodes[4];
- if (NodeAtEdges[RectEdgeIndex[iElem][iIndex]] == -1) {
+ Division[1][1] = nodes[0]; Division[1][2] = nodes[5]; Division[1][3] = nodes[8]; Division[1][4] = nodes[4];
- NodeAtEdges[RectEdgeIndex[iElem][iIndex]] = nPoint_new;
- RectEdgeNode[iElem][iIndex] = nPoint_new;
+ Division[2][1] = nodes[8]; Division[2][2] = nodes[5]; Division[2][3] = nodes[7]; Division[2][4] = nodes[4];
- /*--- Compute the coordinates of the new node ---*/
+ Division[3][1] = nodes[8]; Division[3][2] = nodes[7]; Division[3][3] = nodes[3]; Division[3][4] = nodes[4];
- if (iIndex == 0) {no_0 = ip_0; no_1 = ip_1;}
- if (iIndex == 1) {no_0 = ip_1; no_1 = ip_2;}
- if (iIndex == 2) {no_0 = ip_2; no_1 = ip_3;}
- if (iIndex == 3) {no_0 = ip_3; no_1 = ip_0;}
- for (iDim = 0; iDim < geometry->GetnDim(); iDim++)
- NewNodeCoord[nPoint_new][iDim] = 0.5*(geometry->node[no_0]->GetCoord(iDim)+geometry->node[no_1]->GetCoord(iDim));
+ }
- for (iVar = 0; iVar < nVar; iVar ++) {
- if (Restart_Flow) ConsVar_Adapt[nPoint_new][iVar] = 0.5 * (ConsVar_Adapt[no_0][iVar]+ConsVar_Adapt[no_1][iVar]);
- if (Restart_Adjoint) AdjVar_Adapt[nPoint_new][iVar] = 0.5 * (AdjVar_Adapt[no_0][iVar]+AdjVar_Adapt[no_1][iVar]);
- }
+ if (code == 15) {
+ // number of nodes at each new element
+ Division[0][0] = 6; Division[1][0] = 5; Division[2][0] = 5; Division[3][0] = 5;
+ *nPart = 4;
- nPoint_new++;
- }
- }
- }
+ // nodes that compose each element
+ Division[0][1] = nodes[8]; Division[0][2] = nodes[6]; Division[0][3] = nodes[2]; Division[0][4] = nodes[3]; Division[0][5] = nodes[4];
- for (int iIndex = 0; iIndex < 1; iIndex++) {
+ Division[1][1] = nodes[0]; Division[1][2] = nodes[5]; Division[1][3] = nodes[8]; Division[1][4] = nodes[4];
- if (RectElemCode[iElem][iIndex] == true) {
+ Division[2][1] = nodes[5]; Division[2][2] = nodes[1]; Division[2][3] = nodes[6]; Division[2][4] = nodes[4];
- if (NodeAtElem[RectElemIndex[iElem][iIndex]] != -1)
- RectElemNode[iElem][iIndex] = NodeAtElem[RectElemIndex[iElem][iIndex]];
+ Division[3][1] = nodes[5]; Division[3][2] = nodes[6]; Division[3][3] = nodes[8]; Division[3][4] = nodes[4];
- if (NodeAtElem[RectElemIndex[iElem][iIndex]] == -1) {
- NodeAtElem[RectElemIndex[iElem][iIndex]] = nPoint_new;
- RectElemNode[iElem][iIndex] = nPoint_new;
+ }
- /*--- Compute the coordinates of the new node ---*/
+ if (code == 16) {
+ // number of nodes at each new element
+ Division[0][0] = 6; Division[1][0] = 6; Division[2][0] = 6; Division[3][0] = 6;
+ *nPart = 4;
- if (iIndex == 0) {no_0 = ip_0; no_1 = ip_1; no_2 = ip_2; no_3 = ip_3;}
- for (iDim = 0; iDim < geometry->GetnDim(); iDim++)
- NewNodeCoord[nPoint_new][iDim] = 0.25*(geometry->node[no_0]->GetCoord(iDim) +
- geometry->node[no_1]->GetCoord(iDim) +
- geometry->node[no_2]->GetCoord(iDim) +
- geometry->node[no_3]->GetCoord(iDim));
+ // nodes that compose each element
+ Division[0][1] = nodes[9]; Division[0][2] = nodes[8]; Division[0][3] = nodes[0]; Division[0][4] = nodes[5]; Division[0][5] = nodes[4];
- for (iVar = 0; iVar < nVar; iVar ++) {
- if (Restart_Flow) ConsVar_Adapt[nPoint_new][iVar] = 0.25 * (ConsVar_Adapt[no_0][iVar]+ConsVar_Adapt[no_1][iVar]+ConsVar_Adapt[no_2][iVar]+ConsVar_Adapt[no_3][iVar]);
- if (Restart_Adjoint) AdjVar_Adapt[nPoint_new][iVar] = 0.25 * (AdjVar_Adapt[no_0][iVar]+AdjVar_Adapt[no_1][iVar]+AdjVar_Adapt[no_2][iVar]+AdjVar_Adapt[no_3][iVar]);
- }
+ Division[1][1] = nodes[9]; Division[1][2] = nodes[5]; Division[1][3] = nodes[1]; Division[1][4] = nodes[6]; Division[1][5] = nodes[4];
- nPoint_new++;
- }
- }
- }
- }
+ Division[2][1] = nodes[9]; Division[2][2] = nodes[6]; Division[2][3] = nodes[2]; Division[2][4] = nodes[7]; Division[2][5] = nodes[4];
- }
+ Division[3][1] = nodes[9]; Division[3][2] = nodes[7]; Division[3][3] = nodes[3]; Division[3][4] = nodes[8]; Division[3][5] = nodes[4];
+ }
- /*--- if Quadrilateral adapt code equals 0, then a semidivision is applied ---*/
- long nSemiDivided = 0;
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) {
- if (RectAdaptCode[iElem] == 0)
- nSemiDivided++;
- }
- }
+}
- /*--- If semidivision, then divide add a new point, divide the quadrilateral into triangles,
- and find the right combination, it also create the new node (hexa). ---*/
- long nRectExt = nSemiDivided;
-
- long *RectExtAdaptCode;
- long **RectExtNode;
- long **RectRectExtIndex;
- long *RectExtRectIndex;
-
- long **RectExtEdgeIndex;
- bool **RectExtEdgeCode;
- long **RectExtEdgeNode;
-
- RectExtAdaptCode = new long [nRectExt];
- RectExtNode = new long *[nRectExt];
- RectRectExtIndex = new long *[geometry->GetnElem()];
- RectExtRectIndex = new long [nRectExt];
- RectExtEdgeIndex = new long *[nRectExt];
- RectExtEdgeCode = new bool *[nRectExt];
- RectExtEdgeNode = new long *[nRectExt];
-
- for (long iRectExt = 0; iRectExt < nRectExt; iRectExt++) {
- RectExtNode[iRectExt] = new long [4];
- RectExtEdgeIndex[iRectExt] = new long [4];
- RectExtEdgeCode[iRectExt] = new bool [4];
- RectExtEdgeNode[iRectExt] = new long [4];
- }
-
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) {
- RectRectExtIndex[iElem] = new long [1];
- }
- }
-
- nRectExt = 0;
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) {
- if (RectAdaptCode[iElem] == 0) {
-
- /*--- Write the edge combination on the base. ---*/
-
- ip_0 = geometry->elem[iElem]->GetNode(0);
- ip_1 = geometry->elem[iElem]->GetNode(1);
- ip_2 = geometry->elem[iElem]->GetNode(2);
- ip_3 = geometry->elem[iElem]->GetNode(3);
-
- /*--- Create the 1st RectExtid. ---*/
-
- RectRectExtIndex[iElem][0] = nRectExt; RectExtRectIndex[nRectExt] = iElem;
-
- RectExtNode[nRectExt][0] = ip_0; RectExtNode[nRectExt][1] = ip_1;
- RectExtNode[nRectExt][2] = ip_2; RectExtNode[nRectExt][3] = ip_3;
-
- RectExtEdgeIndex[nRectExt][0] = RectEdgeIndex[iElem][0]; RectExtEdgeIndex[nRectExt][1] = RectEdgeIndex[iElem][1];
- RectExtEdgeIndex[nRectExt][2] = RectEdgeIndex[iElem][2]; RectExtEdgeIndex[nRectExt][3] = RectEdgeIndex[iElem][3];
-
- RectExtEdgeNode[nRectExt][0] = RectEdgeNode[iElem][0]; RectExtEdgeNode[nRectExt][1] = RectEdgeNode[iElem][1];
- RectExtEdgeNode[nRectExt][2] = RectEdgeNode[iElem][2]; RectExtEdgeNode[nRectExt][3] = RectEdgeNode[iElem][3];
-
-
- for (int iIndex = 0; iIndex < 4; iIndex++)
- if (DivEdge[RectExtEdgeIndex[nRectExt][iIndex]] == true) RectExtEdgeCode[nRectExt][iIndex] = true;
- nRectExt++;
-
- }
- }
- }
-
- /*--- Check the kind of RectExt partitioning that should be applied ---*/
-
- for (int iRectExt = 0; iRectExt < nRectExt; iRectExt ++) {
- RectExtAdaptCode[iRectExt] = CheckRectExtCode(RectExtEdgeCode[iRectExt]);
- if (RectExtAdaptCode[iRectExt] == 0) cout << "There is a problem with one RectExt" << endl;
- }
-
- /*--- Create new structure ---*/
-
- nElem_new = geometry->GetnElem();
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- if (geometry->elem[iElem]->GetVTK_Type() == TRIANGLE) {
- if (TriangleAdaptCode[iElem] == 1) nElem_new = nElem_new + 3;
- if (TriangleAdaptCode[iElem] == 2) nElem_new = nElem_new + 1;
- if (TriangleAdaptCode[iElem] == 3) nElem_new = nElem_new + 1;
- if (TriangleAdaptCode[iElem] == 4) nElem_new = nElem_new + 1;
- if (TriangleAdaptCode[iElem] == 5) nElem_new = nElem_new + 1;
- if (TriangleAdaptCode[iElem] == 6) nElem_new = nElem_new + 1;
- if (TriangleAdaptCode[iElem] == 7) nElem_new = nElem_new + 1;
- }
- if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) {
- if (RectAdaptCode[iElem] == 1) nElem_new = nElem_new + 3;
- if (RectAdaptCode[iElem] == 2) nElem_new = nElem_new + 1;
- if (RectAdaptCode[iElem] == 3) nElem_new = nElem_new + 1;
- if (RectAdaptCode[iElem] == 0) {
- long iRectExt = RectRectExtIndex[iElem][0];
- if (RectExtAdaptCode[iRectExt] == 2) nElem_new = nElem_new + 2;
- if (RectExtAdaptCode[iRectExt] == 3) nElem_new = nElem_new + 2;
- if (RectExtAdaptCode[iRectExt] == 4) nElem_new = nElem_new + 2;
- if (RectExtAdaptCode[iRectExt] == 5) nElem_new = nElem_new + 2;
- if (RectExtAdaptCode[iRectExt] == 6) nElem_new = nElem_new + 3;
- if (RectExtAdaptCode[iRectExt] == 7) nElem_new = nElem_new + 3;
- if (RectExtAdaptCode[iRectExt] == 8) nElem_new = nElem_new + 3;
- if (RectExtAdaptCode[iRectExt] == 9) nElem_new = nElem_new + 3;
- if (RectExtAdaptCode[iRectExt] == 12) nElem_new = nElem_new + 3;
- if (RectExtAdaptCode[iRectExt] == 13) nElem_new = nElem_new + 3;
- if (RectExtAdaptCode[iRectExt] == 14) nElem_new = nElem_new + 3;
- if (RectExtAdaptCode[iRectExt] == 15) nElem_new = nElem_new + 3;
- }
- }
- }
-
- /*--- New points ---*/
-
- geo_adapt->node = new CPoint*[nPoint_new];
-
- for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++)
- geo_adapt->node[iPoint] = new CPoint(geometry->node[iPoint]->GetCoord(0), geometry->node[iPoint]->GetCoord(1), iPoint, config);
-
- for (iPoint = geometry->GetnPoint(); iPoint < nPoint_new; iPoint++)
- geo_adapt->node[iPoint] = new CPoint(NewNodeCoord[iPoint][0], NewNodeCoord[iPoint][1], iPoint, config);
-
- /*--- New elements ---*/
-
- geo_adapt->elem = new CPrimalGrid*[nElem_new];
-
- unsigned long iElemNew = 0;
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- if (geometry->elem[iElem]->GetVTK_Type() == TRIANGLE) {
- if (TriangleAdaptCode[iElem] == -1) {
- geo_adapt->elem[iElemNew] = new CTriangle(geometry->elem[iElem]->GetNode(0),
- geometry->elem[iElem]->GetNode(1),
- geometry->elem[iElem]->GetNode(2), 2);
- iElemNew++;
- }
- }
- if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) {
- if (RectAdaptCode[iElem] == -1) {
- geo_adapt->elem[iElemNew] = new CQuadrilateral(geometry->elem[iElem]->GetNode(0),
- geometry->elem[iElem]->GetNode(1),
- geometry->elem[iElem]->GetNode(2),
- geometry->elem[iElem]->GetNode(3), 2);
- iElemNew++;
- }
- }
- }
-
- long nodes[27]; long **Division; long nPart;
-
- Division = new long*[100];
- for (long iVar = 0; iVar < 100; iVar++)
- Division[iVar] = new long[100];
-
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- if (geometry->elem[iElem]->GetVTK_Type() == TRIANGLE) {
-
- /*--- Triangle elements... ---*/
-
- if (TriangleAdaptCode[iElem] > 0) {
-
- /*--- First the corners ---*/
-
- nodes[0] = geometry->elem[iElem]->GetNode(0);
- nodes[1] = geometry->elem[iElem]->GetNode(1);
- nodes[2] = geometry->elem[iElem]->GetNode(2);
-
- /*--- Next the points that correspond to the broken edges. ---*/
-
- nodes[3] = TriangleEdgeNode[iElem][0];
- nodes[4] = TriangleEdgeNode[iElem][1];
- nodes[5] = TriangleEdgeNode[iElem][2];
-
- TriangleDivision(TriangleAdaptCode[iElem], nodes, NULL, Division, &nPart);
- for (long iPart = 0; iPart < nPart; iPart++) {
-
- /*--- Triangle case ---*/
-
- if (Division[iPart][0] == 4) {
- geo_adapt->elem[iElemNew] = new CTriangle(Division[iPart][1],
- Division[iPart][2],
- Division[iPart][3], 2);
- iElemNew++;
- }
-
- /*--- Quadrilateral case ---*/
-
- if (Division[iPart][0] == 5) {
- geo_adapt->elem[iElemNew] = new CQuadrilateral(Division[iPart][1],
- Division[iPart][2],
- Division[iPart][3],
- Division[iPart][4], 2);
- iElemNew++;
- }
- }
- }
- }
- if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) {
-
- /*--- Rect elements... ---*/
-
- if (RectAdaptCode[iElem] > 0) {
-
- /*--- First the corners ---*/
-
- nodes[0] = geometry->elem[iElem]->GetNode(0); nodes[1] = geometry->elem[iElem]->GetNode(1);
- nodes[2] = geometry->elem[iElem]->GetNode(2); nodes[3] = geometry->elem[iElem]->GetNode(3);
-
- /*--- Next the points that correspond to the broken edges. ---*/
+void CGridAdaptation::SetHomothetic_Adaptation2D(CGeometry *geometry, CPhysicalGeometry *geo_adapt,
+ CConfig *config) {
- nodes[4] = RectEdgeNode[iElem][0]; nodes[5] = RectEdgeNode[iElem][1];
- nodes[6] = RectEdgeNode[iElem][2]; nodes[7] = RectEdgeNode[iElem][3];
+ unsigned long iPoint, iElem, iEdge, ip_0, ip_1, ip_2, ip_3, iVertex;
+ unsigned short iDim, iMarker, iVar;
+ long no_0 = 0, no_1 = 0, no_2 = 0, no_3 = 0;
+ unsigned short nMarker_Max = config->GetnMarker_Max();
- /*--- Next the points that correspond to the element. ---*/
+ long *TriangleAdaptCode;
+ long **TriangleEdgeIndex; bool **TriangleEdgeCode; long **TriangleEdgeNode;
+
+ long *RectAdaptCode;
+ long **RectEdgeIndex; bool **RectEdgeCode; long **RectEdgeNode;
+ long **RectElemIndex; bool **RectElemCode; long **RectElemNode;
+
+ bool Restart_Flow = false;
+ bool Restart_Adjoint = false;
+
+ if ((config->GetKind_Adaptation() == FULL_FLOW) ||
+ (config->GetKind_Adaptation() == GRAD_FLOW) ||
+ (config->GetKind_Adaptation() == FULL_ADJOINT) ||
+ (config->GetKind_Adaptation() == GRAD_ADJOINT) ||
+ (config->GetKind_Adaptation() == GRAD_FLOW_ADJ) ||
+ (config->GetKind_Adaptation() == REMAINING) ||
+ (config->GetKind_Adaptation() == COMPUTABLE)) Restart_Flow = true;
+
+ if ((config->GetKind_Adaptation() == FULL_ADJOINT) ||
+ (config->GetKind_Adaptation() == GRAD_ADJOINT) ||
+ (config->GetKind_Adaptation() == GRAD_FLOW_ADJ) ||
+ (config->GetKind_Adaptation() == REMAINING) ||
+ (config->GetKind_Adaptation() == COMPUTABLE)) Restart_Adjoint = true;
+
+ TriangleAdaptCode = new long[geometry->GetnElem()];
+ TriangleEdgeIndex = new long*[geometry->GetnElem()];
+ TriangleEdgeCode = new bool*[geometry->GetnElem()];
+ TriangleEdgeNode = new long*[geometry->GetnElem()];
+
+ RectAdaptCode = new long[geometry->GetnElem()];
+ RectEdgeIndex = new long*[geometry->GetnElem()];
+ RectEdgeCode = new bool*[geometry->GetnElem()];
+ RectEdgeNode = new long*[geometry->GetnElem()];
+ RectElemIndex = new long*[geometry->GetnElem()];
+ RectElemCode = new bool*[geometry->GetnElem()];
+ RectElemNode = new long*[geometry->GetnElem()];
+
+
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
+ TriangleEdgeIndex[iElem] = new long [3];
+ TriangleEdgeCode[iElem] = new bool [3];
+ TriangleEdgeNode[iElem] = new long [3];
+
+ RectEdgeIndex[iElem] = new long [4];
+ RectEdgeCode[iElem] = new bool [4];
+ RectEdgeNode[iElem] = new long [4];
+ RectElemIndex[iElem] = new long [1];
+ RectElemCode[iElem] = new bool [1];
+ RectElemNode[iElem] = new long [1];
+ }
- nodes[8] = RectElemNode[iElem][0];
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
- RectDivision(RectAdaptCode[iElem], nodes, Division, &nPart);
- for (long iPart = 0; iPart < nPart; iPart++) {
- geo_adapt->elem[iElemNew] = new CQuadrilateral(Division[iPart][1],
- Division[iPart][2],
- Division[iPart][3],
- Division[iPart][4], 2);
- iElemNew++;
- }
- }
-
- /*--- RectExt elements... ---*/
-
- if (RectAdaptCode[iElem] == 0) {
- long iRectExt = RectRectExtIndex[iElem][0];
-
- /*--- First the corners ---*/
-
- nodes[0] = RectExtNode[iRectExt][0];
- nodes[1] = RectExtNode[iRectExt][1];
- nodes[2] = RectExtNode[iRectExt][2];
- nodes[3] = RectExtNode[iRectExt][3];
+ if (geometry->elem[iElem]->GetVTK_Type() == TRIANGLE) {
+ ip_0 = geometry->elem[iElem]->GetNode(0);
+ ip_1 = geometry->elem[iElem]->GetNode(1);
+ ip_2 = geometry->elem[iElem]->GetNode(2);
- /*--- Next the points that correspond to the broken edges. ---*/
+ TriangleEdgeIndex[iElem][0] = geometry->FindEdge(ip_0, ip_1); TriangleEdgeCode[iElem][0] = false; TriangleEdgeNode[iElem][0] = -1;
+ TriangleEdgeIndex[iElem][1] = geometry->FindEdge(ip_1, ip_2); TriangleEdgeCode[iElem][1] = false; TriangleEdgeNode[iElem][1] = -1;
+ TriangleEdgeIndex[iElem][2] = geometry->FindEdge(ip_2, ip_0); TriangleEdgeCode[iElem][2] = false; TriangleEdgeNode[iElem][2] = -1;
+ }
+ if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) {
+ ip_0 = geometry->elem[iElem]->GetNode(0);
+ ip_1 = geometry->elem[iElem]->GetNode(1);
+ ip_2 = geometry->elem[iElem]->GetNode(2);
+ ip_3 = geometry->elem[iElem]->GetNode(3);
+
+ RectEdgeIndex[iElem][0] = geometry->FindEdge(ip_0, ip_1); RectEdgeCode[iElem][0] = false; RectEdgeNode[iElem][0] = -1;
+ RectEdgeIndex[iElem][1] = geometry->FindEdge(ip_1, ip_2); RectEdgeCode[iElem][1] = false; RectEdgeNode[iElem][1] = -1;
+ RectEdgeIndex[iElem][2] = geometry->FindEdge(ip_2, ip_3); RectEdgeCode[iElem][2] = false; RectEdgeNode[iElem][2] = -1;
+ RectEdgeIndex[iElem][3] = geometry->FindEdge(ip_3, ip_0); RectEdgeCode[iElem][3] = false; RectEdgeNode[iElem][3] = -1;
+
+ RectElemIndex[iElem][0] = iElem; RectElemCode[iElem][0] = false; RectElemNode[iElem][0] = -1;
+ }
- nodes[4] = RectExtEdgeNode[iRectExt][0];
- nodes[5] = RectExtEdgeNode[iRectExt][1];
- nodes[6] = RectExtEdgeNode[iRectExt][2];
- nodes[7] = RectExtEdgeNode[iRectExt][3];
+ }
- RectExtDivision(RectExtAdaptCode[iRectExt], nodes, Division, &nPart);
- for (long iPart = 0; iPart < nPart; iPart++) {
+ /*--- Initial edges that are going to be divided ---*/
- /*--- Triangle case ---*/
+ bool *DivEdge = new bool[geometry->GetnEdge()];
+ bool *DivElem = new bool[geometry->GetnElem()];
- if (Division[iPart][0] == 4) {
- geo_adapt->elem[iElemNew] = new CTriangle(Division[iPart][1],
- Division[iPart][2],
- Division[iPart][3], 2);
- iElemNew++;
- }
- /*--- Quadrilateral case ---*/
+ for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) DivEdge[iEdge] = false;
- if (Division[iPart][0] == 5) {
- geo_adapt->elem[iElemNew] = new CQuadrilateral(Division[iPart][1],
- Division[iPart][2],
- Division[iPart][3],
- Division[iPart][4], 2);
- iElemNew++;
- }
- }
- }
- }
- }
-
- geo_adapt->SetnElem(nElem_new);
- geo_adapt->SetnPoint(nPoint_new);
- geo_adapt->SetnPointDomain(nPoint_new);
- geo_adapt->SetnDim(nDim);
-
- /*--- Create boundary structure ---*/
-
- geo_adapt->SetnMarker(geometry->GetnMarker());
- geo_adapt->nElem_Bound = new unsigned long [geometry->GetnMarker()];
- geo_adapt->Tag_to_Marker = new string [nMarker_Max];
- geo_adapt->bound = new CPrimalGrid**[geometry->GetnMarker()];
- for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) {
- long nNewBCcv = 0;
- for (iVertex = 0; iVertex < geometry->GetnElem_Bound(iMarker); iVertex++) {
- ip_0 = geometry->bound[iMarker][iVertex]->GetNode(0);
- ip_1 = geometry->bound[iMarker][iVertex]->GetNode(1);
- if (DivEdge[geometry->FindEdge(ip_0, ip_1)]) nNewBCcv = nNewBCcv + 2;
- else nNewBCcv = nNewBCcv + 1;
- }
- geo_adapt->bound[iMarker] = new CPrimalGrid* [nNewBCcv];
- geo_adapt->SetnElem_Bound(iMarker, nNewBCcv);
- geo_adapt->SetMarker_Tag(iMarker, geometry->GetMarker_Tag(iMarker));
- }
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem++)
+ DivElem[iElem] = geometry->elem[iElem]->GetDivide();
- for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) {
- long nNewBCcv = 0;
- for (iVertex = 0; iVertex < geometry->GetnElem_Bound(iMarker); iVertex++) {
+ /*--- Set the edge division in the reactangles and in the edge list. ---*/
- ip_0 = geometry->bound[iMarker][iVertex]->GetNode(0); geo_adapt->node[ip_0]->SetBoundary(geometry->GetnMarker());
- ip_1 = geometry->bound[iMarker][iVertex]->GetNode(1); geo_adapt->node[ip_1]->SetBoundary(geometry->GetnMarker());
- long ip_01 = NodeAtEdges[geometry->FindEdge(ip_0, ip_1)];
-
- if (ip_01 != -1) {
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
+ if (DivElem[iElem] == true) {
+ if (geometry->elem[iElem]->GetVTK_Type() == TRIANGLE) {
+ for (int iIndex = 0; iIndex < 3; iIndex++) {
+ DivEdge[TriangleEdgeIndex[iElem][iIndex]] = true;
+ TriangleEdgeCode[iElem][iIndex] = true;
+ }
+ }
+ if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) {
+ for (int iIndex = 0; iIndex < 4; iIndex++) {
+ DivEdge[RectEdgeIndex[iElem][iIndex]] = true;
+ RectEdgeCode[iElem][iIndex] = true;
+ }
+ }
+ }
+ }
+ for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++)
+ if (config->GetMarker_All_KindBC(iMarker) == NEARFIELD_BOUNDARY)
+ for (unsigned long iBoundElem = 0; iBoundElem < geometry->GetnElem_Bound(iMarker); iBoundElem++) {
-// if ((config->GetMarker_All_KindBC(iMarker) == HEAT_FLUX) ||
-// (config->GetMarker_All_KindBC(iMarker) == ISOTHERMAL) ||
-// (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) {
-//
-// /*--- Recompute the coordinates using the NACA 4Digits analytical definition ---*/
-//
-// su2double Ya = 0.0 / 100.0; /*--- Maximum camber as a fraction of the chord
-// (100 m is the first of the four digits) ---*/
-// su2double Xa = 0.0 / 10.0; /*--- Location of maximum camber as a fraction of
-// the chord (10 p is the second digit in the NACA xxxx description) ---*/
-// su2double t = 12.0 / 100.0; /*--- Maximum thickness as a fraction of the
-// chord (so 100 t gives the last two digits in
-// the NACA 4-digit denomination) ---*/
-//
-// su2double *Coord = geo_adapt->node[ip_01]->GetCoord();
-// su2double *Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
-//
-// su2double Ycurv = 0.0;
-// if (Coord[0] < Xa) Ycurv = (2.0*Xa*Coord[0]-pow(Coord[0],2.0))*(Ya/pow(Xa,2.0));
-// else Ycurv = ((1.0-2.0*Xa)+2.0*Xa*Coord[0]-pow(Coord[0],2.0))*(Ya/pow((1.0-Xa), 2.0));
-//
-// su2double Yesp = 0.0;
-// Yesp = t*(1.4845*sqrt(Coord[0])-0.6300*Coord[0]-1.7580*pow(Coord[0],2.0)+
-// 1.4215*pow(Coord[0],3.0)-0.518*pow(Coord[0],4.0));
-//
-// if (Normal[1] > 0) Coord[1] = (Ycurv + Yesp);
-// if (Normal[1] < 0) Coord[1] = (Ycurv - Yesp);
-//
-// }
+ ip_0 = geometry->bound[iMarker][iBoundElem]->GetNode(0);
+ ip_1 = geometry->bound[iMarker][iBoundElem]->GetNode(1);
- geo_adapt->node[ip_01]->SetBoundary(geometry->GetnMarker());
- geo_adapt->bound[iMarker][nNewBCcv] = new CLine(ip_0, ip_01, 2);
- nNewBCcv++;
- geo_adapt->bound[iMarker][nNewBCcv] = new CLine(ip_01, ip_1, 2);
- nNewBCcv++;
- }
- else {
- geo_adapt->bound[iMarker][nNewBCcv] = new CLine(ip_0, ip_1, 2);
- nNewBCcv++;
- }
- }
- }
-
- delete [] DivEdge;
- delete [] DivElem;
- delete [] NodeAtEdges;
- delete [] NodeAtElem;
+ long edge = geometry->FindEdge(ip_0, ip_1);
-}
+ if (DivEdge[edge]) {
-void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalGeometry *geo_adapt,
- CConfig *config) {
+ unsigned long iv_1 = geometry->nodes->GetVertex(ip_1, iMarker);
+ unsigned long ip_1_Nearfield = geometry->vertex[iMarker][iv_1]->GetDonorPoint();
+ unsigned long iv_0 = geometry->nodes->GetVertex(ip_0, iMarker);
+ unsigned long ip_0_Nearfield = geometry->vertex[iMarker][iv_0]->GetDonorPoint();
- unsigned long iPoint, iElem, iEdge, ip_0, ip_1, ip_2, ip_3, ip_4, ip_5, ip_6, ip_7, iVertex;
- unsigned short iDim, iMarker, iVar;
- long no_0 = 0, no_1 = 0, no_2 = 0, no_3 = 0, no_4 = 0, no_5 = 0, no_6 = 0, no_7 = 0;
- unsigned short counter;
- unsigned short nMarker_Max = config->GetnMarker_Max();
+ long edge_Nearfield = geometry->FindEdge(ip_0_Nearfield, ip_1_Nearfield);
- long *TetraAdaptCode;
- long **TetraEdgeIndex; bool **TetraEdgeCode; long **TetraEdgeNode;
-
- long *HexaAdaptCode;
- long **HexaEdgeIndex; bool **HexaEdgeCode; long **HexaEdgeNode;
- long **HexaFaceIndex; bool **HexaFaceCode; long **HexaFaceNode;
- long **HexaElemIndex; bool **HexaElemCode; long **HexaElemNode;
-
- bool Restart_Flow = false;
- bool Restart_Adjoint = false;
-
- if ((config->GetKind_Adaptation() == FULL_FLOW) ||
- (config->GetKind_Adaptation() == GRAD_FLOW) ||
- (config->GetKind_Adaptation() == FULL_ADJOINT) ||
- (config->GetKind_Adaptation() == GRAD_ADJOINT) ||
- (config->GetKind_Adaptation() == GRAD_FLOW_ADJ) ||
- (config->GetKind_Adaptation() == REMAINING) ||
- (config->GetKind_Adaptation() == COMPUTABLE)) Restart_Flow = true;
-
- if ((config->GetKind_Adaptation() == FULL_ADJOINT) ||
- (config->GetKind_Adaptation() == GRAD_ADJOINT) ||
- (config->GetKind_Adaptation() == GRAD_FLOW_ADJ) ||
- (config->GetKind_Adaptation() == REMAINING) ||
- (config->GetKind_Adaptation() == COMPUTABLE)) Restart_Adjoint = true;
-
- TetraAdaptCode = new long[geometry->GetnElem()];
- TetraEdgeIndex = new long*[geometry->GetnElem()];
- TetraEdgeCode = new bool*[geometry->GetnElem()];
- TetraEdgeNode = new long*[geometry->GetnElem()];
-
- HexaAdaptCode = new long[geometry->GetnElem()];
- HexaEdgeIndex = new long*[geometry->GetnElem()];
- HexaEdgeCode = new bool*[geometry->GetnElem()];
- HexaEdgeNode = new long*[geometry->GetnElem()];
- HexaFaceIndex = new long*[geometry->GetnElem()];
- HexaFaceCode = new bool*[geometry->GetnElem()];
- HexaFaceNode = new long*[geometry->GetnElem()];
- HexaElemIndex = new long*[geometry->GetnElem()];
- HexaElemCode = new bool*[geometry->GetnElem()];
- HexaElemNode = new long*[geometry->GetnElem()];
-
- for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
- TetraEdgeIndex[iElem] = new long [6];
- TetraEdgeCode[iElem] = new bool [6];
- TetraEdgeNode[iElem] = new long [6];
-
- HexaEdgeIndex[iElem] = new long [12];
- HexaEdgeCode[iElem] = new bool [12];
- HexaEdgeNode[iElem] = new long [12];
- HexaFaceIndex[iElem] = new long [6];
- HexaFaceCode[iElem] = new bool [6];
- HexaFaceNode[iElem] = new long [6];
- HexaElemIndex[iElem] = new long [1];
- HexaElemCode[iElem] = new bool [1];
- HexaElemNode[iElem] = new long [1];
- }
-
- for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
-
- if (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON) {
- ip_0 = geometry->elem[iElem]->GetNode(0);
- ip_1 = geometry->elem[iElem]->GetNode(1);
- ip_2 = geometry->elem[iElem]->GetNode(2);
- ip_3 = geometry->elem[iElem]->GetNode(3);
-
- TetraEdgeIndex[iElem][0] = geometry->FindEdge(ip_0, ip_1); TetraEdgeCode[iElem][0] = false; TetraEdgeNode[iElem][0] = -1;
- TetraEdgeIndex[iElem][1] = geometry->FindEdge(ip_0, ip_2); TetraEdgeCode[iElem][1] = false; TetraEdgeNode[iElem][1] = -1;
- TetraEdgeIndex[iElem][2] = geometry->FindEdge(ip_0, ip_3); TetraEdgeCode[iElem][2] = false; TetraEdgeNode[iElem][2] = -1;
- TetraEdgeIndex[iElem][3] = geometry->FindEdge(ip_1, ip_2); TetraEdgeCode[iElem][3] = false; TetraEdgeNode[iElem][3] = -1;
- TetraEdgeIndex[iElem][4] = geometry->FindEdge(ip_1, ip_3); TetraEdgeCode[iElem][4] = false; TetraEdgeNode[iElem][4] = -1;
- TetraEdgeIndex[iElem][5] = geometry->FindEdge(ip_2, ip_3); TetraEdgeCode[iElem][5] = false; TetraEdgeNode[iElem][5] = -1;
-
- }
- if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) {
- ip_0 = geometry->elem[iElem]->GetNode(0);
- ip_1 = geometry->elem[iElem]->GetNode(1);
- ip_2 = geometry->elem[iElem]->GetNode(2);
- ip_3 = geometry->elem[iElem]->GetNode(3);
- ip_4 = geometry->elem[iElem]->GetNode(4);
- ip_5 = geometry->elem[iElem]->GetNode(5);
- ip_6 = geometry->elem[iElem]->GetNode(6);
- ip_7 = geometry->elem[iElem]->GetNode(7);
-
- HexaEdgeIndex[iElem][0] = geometry->FindEdge(ip_0, ip_1); HexaEdgeCode[iElem][0] = false; HexaEdgeNode[iElem][0] = -1;
- HexaEdgeIndex[iElem][1] = geometry->FindEdge(ip_1, ip_2); HexaEdgeCode[iElem][1] = false; HexaEdgeNode[iElem][1] = -1;
- HexaEdgeIndex[iElem][2] = geometry->FindEdge(ip_2, ip_3); HexaEdgeCode[iElem][2] = false; HexaEdgeNode[iElem][2] = -1;
- HexaEdgeIndex[iElem][3] = geometry->FindEdge(ip_3, ip_0); HexaEdgeCode[iElem][3] = false; HexaEdgeNode[iElem][3] = -1;
- HexaEdgeIndex[iElem][4] = geometry->FindEdge(ip_4, ip_5); HexaEdgeCode[iElem][4] = false; HexaEdgeNode[iElem][4] = -1;
- HexaEdgeIndex[iElem][5] = geometry->FindEdge(ip_5, ip_6); HexaEdgeCode[iElem][5] = false; HexaEdgeNode[iElem][5] = -1;
- HexaEdgeIndex[iElem][6] = geometry->FindEdge(ip_6, ip_7); HexaEdgeCode[iElem][6] = false; HexaEdgeNode[iElem][6] = -1;
- HexaEdgeIndex[iElem][7] = geometry->FindEdge(ip_7, ip_4); HexaEdgeCode[iElem][7] = false; HexaEdgeNode[iElem][7] = -1;
- HexaEdgeIndex[iElem][8] = geometry->FindEdge(ip_0, ip_4); HexaEdgeCode[iElem][8] = false; HexaEdgeNode[iElem][8] = -1;
- HexaEdgeIndex[iElem][9] = geometry->FindEdge(ip_1, ip_5); HexaEdgeCode[iElem][9] = false; HexaEdgeNode[iElem][9] = -1;
- HexaEdgeIndex[iElem][10] = geometry->FindEdge(ip_2, ip_6); HexaEdgeCode[iElem][10] = false; HexaEdgeNode[iElem][10] = -1;
- HexaEdgeIndex[iElem][11] = geometry->FindEdge(ip_3, ip_7); HexaEdgeCode[iElem][11] = false; HexaEdgeNode[iElem][11] = -1;
-
-// HexaFaceIndex[iElem][0] = geometry->FindFace(iElem, ip_0, ip_1, ip_2, ip_3); HexaFaceCode[iElem][0] = false; HexaFaceNode[iElem][0] = -1;
-// HexaFaceIndex[iElem][1] = geometry->FindFace(iElem, ip_4, ip_5, ip_6, ip_7); HexaFaceCode[iElem][1] = false; HexaFaceNode[iElem][1] = -1;
-// HexaFaceIndex[iElem][2] = geometry->FindFace(iElem, ip_1, ip_2, ip_6, ip_5); HexaFaceCode[iElem][2] = false; HexaFaceNode[iElem][2] = -1;
-// HexaFaceIndex[iElem][3] = geometry->FindFace(iElem, ip_3, ip_2, ip_6, ip_7); HexaFaceCode[iElem][3] = false; HexaFaceNode[iElem][3] = -1;
-// HexaFaceIndex[iElem][4] = geometry->FindFace(iElem, ip_0, ip_3, ip_7, ip_4); HexaFaceCode[iElem][4] = false; HexaFaceNode[iElem][4] = -1;
-// HexaFaceIndex[iElem][5] = geometry->FindFace(iElem, ip_0, ip_1, ip_5, ip_4); HexaFaceCode[iElem][5] = false; HexaFaceNode[iElem][5] = -1;
-
- HexaElemIndex[iElem][0] = iElem; HexaElemCode[iElem][0] = false; HexaElemNode[iElem][0] = -1;
-
- }
-
- }
-
- /*--- Remove pyramids and prisms in the adaptation process ---*/
- unsigned short iFace, iNode, ElemIndex;
- long jElem;
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- if ((geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) ||
- (geometry->elem[iElem]->GetVTK_Type() == PYRAMID) ||
- (geometry->elem[iElem]->GetVTK_Type() == PRISM)) {
- geometry->elem[iElem]->SetDivide(false);
- for (iFace = 0; iFace < geometry->elem[iElem]->GetnFaces(); iFace++)
- for (iNode = 0; iNode < geometry->elem[iElem]->GetnNodesFace(iFace); iNode++) {
- iPoint = geometry->elem[iElem]->GetNode(geometry->elem[iElem]->GetFaces(iFace, iNode));
- for (ElemIndex = 0; ElemIndex < geometry->node[iPoint]->GetnElem(); ElemIndex++) {
- jElem = geometry->node[iPoint]->GetElem(ElemIndex);
- if (jElem != -1) geometry->elem[jElem]->SetDivide(false);
- }
- }
- }
- }
-
- /*--- Do not addapt the boundaries ---*/
- if (!config->GetAdaptBoundary()) {
- for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) {
- for (iVertex = 0; iVertex < geometry->GetnElem_Bound(iMarker); iVertex++) {
- for (iNode = 0; iNode < geometry->bound[iMarker][iVertex]->GetnNodes(); iNode++) {
- iPoint = geometry->bound[iMarker][iVertex]->GetNode(iNode);
- for (ElemIndex = 0; ElemIndex < geometry->node[iPoint]->GetnElem(); ElemIndex++) {
- jElem = geometry->node[iPoint]->GetElem(ElemIndex);
- if (jElem != -1) geometry->elem[jElem]->SetDivide(false);
- }
- }
- }
- }
- }
-
- /*--- Initial edges that are going to be divided ---*/
- bool *DivEdge = new bool[geometry->GetnEdge()];
- bool *DivElem = new bool[geometry->GetnElem()];
- for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) DivEdge[iEdge] = false;
-
- for (iElem = 0; iElem < geometry->GetnElem(); iElem++)
- DivElem[iElem] = geometry->elem[iElem]->GetDivide();
-
- /*--- Set the edge division in the reactangles and in the edge list ---*/
- for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
- if (DivElem[iElem] == true) {
- if (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON) {
- for (long iIndex = 0; iIndex < 6; iIndex++) {
- DivEdge[TetraEdgeIndex[iElem][iIndex]] = true;
- TetraEdgeCode[iElem][iIndex] = true;
- }
- }
- if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) {
- for (long iIndex = 0; iIndex < 12; iIndex++) {
- DivEdge[HexaEdgeIndex[iElem][iIndex]] = true;
- HexaEdgeCode[iElem][iIndex] = true;
- }
- }
- }
- }
-
- /*--- Only with tets, check if an element have more than 4 divided edges, the element should be completelly divided ---*/
- bool new_elem;
- do { new_elem = false;
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- if (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON) {
-
- ip_0 = geometry->elem[iElem]->GetNode(0);
- ip_1 = geometry->elem[iElem]->GetNode(1);
- ip_2 = geometry->elem[iElem]->GetNode(2);
- ip_3 = geometry->elem[iElem]->GetNode(3);
-
- counter = 0;
- if (DivEdge[TetraEdgeIndex[iElem][0]]) counter++;
- if (DivEdge[TetraEdgeIndex[iElem][1]]) counter++;
- if (DivEdge[TetraEdgeIndex[iElem][2]]) counter++;
- if (DivEdge[TetraEdgeIndex[iElem][3]]) counter++;
- if (DivEdge[TetraEdgeIndex[iElem][4]]) counter++;
- if (DivEdge[TetraEdgeIndex[iElem][5]]) counter++;
-
- if ((counter > 3) && (!DivElem[iElem])) {
- DivEdge[geometry->FindEdge(ip_0, ip_1)] = true;
- DivEdge[geometry->FindEdge(ip_0, ip_2)] = true;
- DivEdge[geometry->FindEdge(ip_0, ip_3)] = true;
- DivEdge[geometry->FindEdge(ip_1, ip_2)] = true;
- DivEdge[geometry->FindEdge(ip_1, ip_3)] = true;
- DivEdge[geometry->FindEdge(ip_2, ip_3)] = true;
- DivElem[iElem] = true;
- new_elem = true;
- }
- }
- }
- } while (new_elem);
-
- /*--- We must verify that all the elements have the right edges marked,
- with tets 4 and 5 edges are not allowed ---*/
- for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
- if (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON) {
- for (long iIndex = 0; iIndex < 6; iIndex++) {
- if (DivEdge[TetraEdgeIndex[iElem][iIndex]] == true) {
- TetraEdgeCode[iElem][iIndex] = true;
- }
- }
- }
- if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) {
- for (long iIndex = 0; iIndex < 12; iIndex++) {
- if (DivEdge[HexaEdgeIndex[iElem][iIndex]] == true) {
- HexaEdgeCode[iElem][iIndex] = true;
- }
- }
- }
- }
-
- // Only those elements that verify certain rules will be marked for hexa adaptation...
- // the others will need a new point in the middle and Pyrams
- for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
-
- if (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON) {
- TetraAdaptCode[iElem] = CheckTetraCode(TetraEdgeCode[iElem]);
-// if (TetraAdaptCode[iElem] != -1) cout << TetraAdaptCode[iElem] <<" "<< iElem << endl;
- }
-
- if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) {
-
- HexaAdaptCode[iElem] = CheckHexaCode(HexaEdgeCode[iElem]);
-// if (HexaAdaptCode[iElem] != -1) cout << HexaAdaptCode[iElem] <<" "<< iElem << endl;
-
- // Set the HexaFaceCode, and HexaElemCode
- if (HexaAdaptCode[iElem] == 1) {
- HexaFaceCode[iElem][0] = true; HexaFaceCode[iElem][1] = true; HexaFaceCode[iElem][2] = true;
- HexaFaceCode[iElem][3] = true; HexaFaceCode[iElem][4] = true; HexaFaceCode[iElem][5] = true;
- HexaElemCode[iElem][0] = true;
- }
- if (HexaAdaptCode[iElem] == 2) {
- HexaFaceCode[iElem][3] = true; HexaFaceCode[iElem][5] = true;
- }
- if (HexaAdaptCode[iElem] == 3) {
- HexaFaceCode[iElem][2] = true; HexaFaceCode[iElem][4] = true;
- }
- if (HexaAdaptCode[iElem] == 4) {
- HexaFaceCode[iElem][0] = true; HexaFaceCode[iElem][1] = true;
- }
- }
- }
-
- // Create the new nodes on the edges, on the faces, and in the element.
- long *NodeAtEdges = new long[geometry->GetnEdge()];
-// long *NodeAtElem = new long[geometry->GetnFace()];
- long *NodeAtElem = new long[geometry->GetnElem()];
-
- for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) NodeAtEdges[iEdge] = -1;
-// for (iFace = 0; iFace < geometry->GetnFace(); iFace++) NodeAtFaces[iEdge] = -1;
- for (iElem = 0; iElem < geometry->GetnElem(); iElem++) NodeAtElem[iElem] = -1;
-
- nPoint_new = geometry->GetnPoint();
-
- su2double **NewNodeCoord;
- NewNodeCoord = new su2double *[10*geometry->GetnPoint()];
- for (iPoint = 0; iPoint < 10*geometry->GetnPoint(); iPoint++)
- NewNodeCoord[iPoint] = new su2double[geometry->GetnDim()];
-
- if (Restart_Flow) {
- ConsVar_Adapt = new su2double *[10*geometry->GetnPoint()];
- for (iPoint = 0; iPoint < 10*geometry->GetnPoint(); iPoint++)
- ConsVar_Adapt[iPoint] = new su2double[nVar];
- }
-
- if (Restart_Adjoint) {
- AdjVar_Adapt = new su2double *[10*geometry->GetnPoint()];
- for (iPoint = 0; iPoint < 10*geometry->GetnPoint(); iPoint++)
- AdjVar_Adapt[iPoint] = new su2double[nVar];
- }
-
- // Set the value of the variables
- for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++) {
- for (iVar = 0; iVar < nVar; iVar ++) {
- if (Restart_Flow) ConsVar_Adapt[iPoint][iVar] = ConsVar_Sol[iPoint][iVar];
- if (Restart_Adjoint) AdjVar_Adapt[iPoint][iVar] = AdjVar_Sol[iPoint][iVar];
- }
- }
-
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
-
- if (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON) {
-
- ip_0 = geometry->elem[iElem]->GetNode(0);
- ip_1 = geometry->elem[iElem]->GetNode(1);
- ip_2 = geometry->elem[iElem]->GetNode(2);
- ip_3 = geometry->elem[iElem]->GetNode(3);
-
- for (long iIndex = 0; iIndex < 6; iIndex++) {
-
- if (TetraEdgeCode[iElem][iIndex] == true) {
- if (NodeAtEdges[TetraEdgeIndex[iElem][iIndex]] != -1)
- TetraEdgeNode[iElem][iIndex] = NodeAtEdges[TetraEdgeIndex[iElem][iIndex]];
-
- if (NodeAtEdges[TetraEdgeIndex[iElem][iIndex]] == -1) {
-
- NodeAtEdges[TetraEdgeIndex[iElem][iIndex]] = nPoint_new;
- TetraEdgeNode[iElem][iIndex] = nPoint_new;
-
- // Compute the coordinates of the new node
- if (iIndex == 0) {no_0 = ip_0; no_1 = ip_1;}
- if (iIndex == 1) {no_0 = ip_0; no_1 = ip_2;}
- if (iIndex == 2) {no_0 = ip_0; no_1 = ip_3;}
- if (iIndex == 3) {no_0 = ip_1; no_1 = ip_2;}
- if (iIndex == 4) {no_0 = ip_1; no_1 = ip_3;}
- if (iIndex == 5) {no_0 = ip_2; no_1 = ip_3;}
-
- for (iDim = 0; iDim < geometry->GetnDim(); iDim++)
- NewNodeCoord[nPoint_new][iDim] = 0.5*(geometry->node[no_0]->GetCoord(iDim)+geometry->node[no_1]->GetCoord(iDim));
-
- for (iVar = 0; iVar < nVar; iVar ++) {
- if (Restart_Flow) ConsVar_Adapt[nPoint_new][iVar] = 0.5 * (ConsVar_Adapt[no_0][iVar]+ConsVar_Adapt[no_1][iVar]);
- if (Restart_Adjoint) AdjVar_Adapt[nPoint_new][iVar] = 0.5 * (AdjVar_Adapt[no_0][iVar]+AdjVar_Adapt[no_1][iVar]);
- }
-
- nPoint_new++;
- }
- }
- }
- }
-
- if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) {
-
- ip_0 = geometry->elem[iElem]->GetNode(0);
- ip_1 = geometry->elem[iElem]->GetNode(1);
- ip_2 = geometry->elem[iElem]->GetNode(2);
- ip_3 = geometry->elem[iElem]->GetNode(3);
- ip_4 = geometry->elem[iElem]->GetNode(4);
- ip_5 = geometry->elem[iElem]->GetNode(5);
- ip_6 = geometry->elem[iElem]->GetNode(6);
- ip_7 = geometry->elem[iElem]->GetNode(7);
-
- for (long iIndex = 0; iIndex < 12; iIndex++) {
-
- if (HexaEdgeCode[iElem][iIndex] == true) {
- if (NodeAtEdges[HexaEdgeIndex[iElem][iIndex]] != -1)
- HexaEdgeNode[iElem][iIndex] = NodeAtEdges[HexaEdgeIndex[iElem][iIndex]];
-
- if (NodeAtEdges[HexaEdgeIndex[iElem][iIndex]] == -1) {
-
- NodeAtEdges[HexaEdgeIndex[iElem][iIndex]] = nPoint_new;
- HexaEdgeNode[iElem][iIndex] = nPoint_new;
-
- // Compute the coordinates of the new node
- if (iIndex == 0) {no_0 = ip_0; no_1 = ip_1;}
- if (iIndex == 1) {no_0 = ip_1; no_1 = ip_2;}
- if (iIndex == 2) {no_0 = ip_2; no_1 = ip_3;}
- if (iIndex == 3) {no_0 = ip_3; no_1 = ip_0;}
- if (iIndex == 4) {no_0 = ip_4; no_1 = ip_5;}
- if (iIndex == 5) {no_0 = ip_5; no_1 = ip_6;}
- if (iIndex == 6) {no_0 = ip_6; no_1 = ip_7;}
- if (iIndex == 7) {no_0 = ip_7; no_1 = ip_4;}
- if (iIndex == 8) {no_0 = ip_0; no_1 = ip_4;}
- if (iIndex == 9) {no_0 = ip_1; no_1 = ip_5;}
- if (iIndex == 10) {no_0 = ip_2; no_1 = ip_6;}
- if (iIndex == 11) {no_0 = ip_3; no_1 = ip_7;}
-
- for (iDim = 0; iDim < geometry->GetnDim(); iDim++)
- NewNodeCoord[nPoint_new][iDim] = 0.5*(geometry->node[no_0]->GetCoord(iDim)+geometry->node[no_1]->GetCoord(iDim));
-
- for (iVar = 0; iVar < nVar; iVar ++) {
- if (Restart_Flow) ConsVar_Adapt[nPoint_new][iVar] = 0.5 * (ConsVar_Adapt[no_0][iVar]+ConsVar_Adapt[no_1][iVar]);
- if (Restart_Adjoint) AdjVar_Adapt[nPoint_new][iVar] = 0.5 * (AdjVar_Adapt[no_0][iVar]+AdjVar_Adapt[no_1][iVar]);
- }
-
- nPoint_new++;
- }
- }
- }
-
-/* for (long iIndex = 0; iIndex < 6; iIndex++) {
- if (HexaFaceCode[iElem][iIndex] == true) {
-
- if (NodeAtFaces[HexaFaceIndex[iElem][iIndex]] != -1)
- HexaFaceNode[iElem][iIndex] = NodeAtFaces[HexaFaceIndex[iElem][iIndex]];
-
- if (NodeAtFaces[HexaFaceIndex[iElem][iIndex]] == -1) {
- NodeAtFaces[HexaFaceIndex[iElem][iIndex]] = nPoint_new;
- HexaFaceNode[iElem][iIndex] = nPoint_new;
- // Compute the coordinates of the new node
- if (iIndex == 0) {no_0 = ip_0; no_1 = ip_1; no_2 = ip_2; no_3 = ip_3;}
- if (iIndex == 1) {no_0 = ip_4; no_1 = ip_5; no_2 = ip_6; no_3 = ip_7;}
- if (iIndex == 2) {no_0 = ip_1; no_1 = ip_2; no_2 = ip_6; no_3 = ip_5;}
- if (iIndex == 3) {no_0 = ip_3; no_1 = ip_2; no_2 = ip_6; no_3 = ip_7;}
- if (iIndex == 4) {no_0 = ip_0; no_1 = ip_3; no_2 = ip_7; no_3 = ip_4;}
- if (iIndex == 5) {no_0 = ip_0; no_1 = ip_1; no_2 = ip_5; no_3 = ip_4;}
-
- for (iDim = 0; iDim < geometry->GetnDim(); iDim++)
- NewNodeCoord[nPoint_new][iDim] = 0.25*(x_no[no_0][iDim]+x_no[no_1][iDim]+x_no[no_2][iDim]+x_no[no_3][iDim]);
-
- for (iVar = 0; iVar < nVar; iVar ++) {
- if (Restart_Flow) ConsVar_Adapt[nPoint_new][iVar] = 0.25 * (ConsVar_Adapt[no_0][iVar]+ConsVar_Adapt[no_1][iVar]+ConsVar_Adapt[no_2][iVar]+ConsVar_Adapt[no_3][iVar]);
- if (Restart_Adjoint) AdjVar_Adapt[nPoint_new][iVar] = 0.25 * (AdjVar_Adapt[no_0][iVar]+AdjVar_Adapt[no_1][iVar]+AdjVar_Adapt[no_2][iVar]+AdjVar_Adapt[no_3][iVar]);
- if (Restart_Linear) LinVar_Adapt[nPoint_new][iVar] = 0.25 * (LinVar_Adapt[no_0][iVar]+LinVar_Adapt[no_1][iVar]+LinVar_Adapt[no_2][iVar]+LinVar_Adapt[no_3][iVar]);
- }
-
- nPoint_new++;
-
- }
- }
-
- } */
-
- for (long iIndex = 0; iIndex < 1; iIndex++) {
-
- if (HexaElemCode[iElem][iIndex] == true) {
-
- if (NodeAtElem[HexaElemIndex[iElem][iIndex]] != -1)
- HexaElemNode[iElem][iIndex] = NodeAtElem[HexaElemIndex[iElem][iIndex]];
-
- if (NodeAtElem[HexaElemIndex[iElem][iIndex]] == -1) {
- NodeAtElem[HexaElemIndex[iElem][iIndex]] = nPoint_new;
- HexaElemNode[iElem][iIndex] = nPoint_new;
-
- // Compute the coordinates of the new node
- if (iIndex == 0) {no_0 = ip_0; no_1 = ip_1; no_2 = ip_2; no_3 = ip_3; no_4 = ip_4; no_5 = ip_5; no_6 = ip_6; no_7 = ip_7;}
- for (iDim = 0; iDim < geometry->GetnDim(); iDim++)
- NewNodeCoord[nPoint_new][iDim] = 0.125*(geometry->node[no_0]->GetCoord(iDim) +
- geometry->node[no_1]->GetCoord(iDim) +
- geometry->node[no_2]->GetCoord(iDim) +
- geometry->node[no_3]->GetCoord(iDim) +
- geometry->node[no_4]->GetCoord(iDim) +
- geometry->node[no_5]->GetCoord(iDim) +
- geometry->node[no_6]->GetCoord(iDim) +
- geometry->node[no_7]->GetCoord(iDim));
-
- for (iVar = 0; iVar < nVar; iVar ++) {
- if (Restart_Flow) ConsVar_Adapt[nPoint_new][iVar] = 0.125 * (ConsVar_Adapt[no_0][iVar]+ConsVar_Adapt[no_1][iVar]+ConsVar_Adapt[no_2][iVar]+ConsVar_Adapt[no_3][iVar]+
- ConsVar_Adapt[no_4][iVar]+ConsVar_Adapt[no_5][iVar]+ConsVar_Adapt[no_6][iVar]+ConsVar_Adapt[no_7][iVar]);
- if (Restart_Adjoint) AdjVar_Adapt[nPoint_new][iVar] = 0.125 * (AdjVar_Adapt[no_0][iVar]+AdjVar_Adapt[no_1][iVar]+AdjVar_Adapt[no_2][iVar]+AdjVar_Adapt[no_3][iVar]+
- AdjVar_Adapt[no_4][iVar]+AdjVar_Adapt[no_5][iVar]+AdjVar_Adapt[no_6][iVar]+AdjVar_Adapt[no_7][iVar]);
- }
-
- nPoint_new++;
- }
- }
- }
- }
-
- }
-
-
- // if Hexa adapt code equals 0, then a semidivision is applied
- long nSemiDivided = 0;
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) {
- if (HexaAdaptCode[iElem] == 0)
- nSemiDivided++;
- }
- }
-
- // If semidivision, then divide add a new point (hexa), divide the hexahedron into Tetras,
- // and find the right combination, it also create the new node (hexa).
- long nPyram = nSemiDivided*6;
-
- long *PyramAdaptCode;
- long **PyramNode;
- long **HexaPyramIndex;
- long *PyramHexaIndex;
-
- long **PyramEdgeIndex;
- bool **PyramEdgeCode;
- long **PyramEdgeNode;
-
- long **PyramFaceNode;
-
- long **PyramElemNode;
-
- PyramAdaptCode = new long [nPyram];
- PyramNode = new long *[nPyram];
- HexaPyramIndex = new long *[geometry->GetnElem()];
- PyramHexaIndex = new long [nPyram];
- PyramEdgeIndex = new long *[nPyram];
- PyramEdgeCode = new bool *[nPyram];
- PyramEdgeNode = new long *[nPyram];
- PyramFaceNode = new long *[nPyram];
- PyramElemNode = new long *[nPyram];
-
- for (long iPyram = 0; iPyram < nPyram; iPyram++) {
- PyramNode[iPyram] = new long [4];
- PyramEdgeIndex[iPyram] = new long [4];
- PyramEdgeCode[iPyram] = new bool [4];
- PyramEdgeNode[iPyram] = new long [4];
- PyramFaceNode[iPyram] = new long [1];
- PyramElemNode[iPyram] = new long [1];
- }
+ DivEdge[edge_Nearfield] = true;
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) {
- HexaPyramIndex[iElem] = new long [6];
- }
- }
+ }
- nPyram = 0;
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) {
- if (HexaAdaptCode[iElem] == 0) {
+ }
- // Write the edge combination on the base.
- ip_0 = geometry->elem[iElem]->GetNode(0);
- ip_1 = geometry->elem[iElem]->GetNode(1);
- ip_2 = geometry->elem[iElem]->GetNode(2);
- ip_3 = geometry->elem[iElem]->GetNode(3);
- ip_4 = geometry->elem[iElem]->GetNode(4);
- ip_5 = geometry->elem[iElem]->GetNode(5);
- ip_6 = geometry->elem[iElem]->GetNode(6);
- ip_7 = geometry->elem[iElem]->GetNode(7);
+ /*--- We must verify that all the elements have the right edges marked ---*/
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
+ if (geometry->elem[iElem]->GetVTK_Type() == TRIANGLE) {
+ for (int iIndex = 0; iIndex < 3; iIndex++) {
+ if (DivEdge[TriangleEdgeIndex[iElem][iIndex]] == true) {
+ TriangleEdgeCode[iElem][iIndex] = true;
+ }
+ }
+ }
+ if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) {
+ for (int iIndex = 0; iIndex < 4; iIndex++) {
+ if (DivEdge[RectEdgeIndex[iElem][iIndex]] == true) {
+ RectEdgeCode[iElem][iIndex] = true;
+ }
+ }
+ }
+ }
- // Create the 1st pyramid.
- HexaPyramIndex[iElem][0] = nPyram; PyramHexaIndex[nPyram] = iElem; PyramElemNode[nPyram][0] = nPoint_new;
+ /*--- Only those elements that verify certain rules will be marked for hexa adaptation...
+ the others will need a new point in the middle and RectExts ---*/
- PyramNode[nPyram][0] = ip_0; PyramNode[nPyram][1] = ip_1;
- PyramNode[nPyram][2] = ip_2; PyramNode[nPyram][3] = ip_3;
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
+ if (geometry->elem[iElem]->GetVTK_Type() == TRIANGLE) {
+ TriangleAdaptCode[iElem] = CheckTriangleCode(TriangleEdgeCode[iElem]);
+ }
+ if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) {
+ RectAdaptCode[iElem] = CheckRectCode(RectEdgeCode[iElem]);
- PyramEdgeIndex[nPyram][0] = HexaEdgeIndex[iElem][0]; PyramEdgeIndex[nPyram][1] = HexaEdgeIndex[iElem][1];
- PyramEdgeIndex[nPyram][2] = HexaEdgeIndex[iElem][2]; PyramEdgeIndex[nPyram][3] = HexaEdgeIndex[iElem][3];
+ /*--- Set the RectAdaptCode ---*/
- PyramEdgeNode[nPyram][0] = HexaEdgeNode[iElem][0]; PyramEdgeNode[nPyram][1] = HexaEdgeNode[iElem][1];
- PyramEdgeNode[nPyram][2] = HexaEdgeNode[iElem][2]; PyramEdgeNode[nPyram][3] = HexaEdgeNode[iElem][3];
+ if (RectAdaptCode[iElem] == 1) {
+ RectElemCode[iElem][0] = true;
+ }
+ }
+ }
+ /*--- Create the new nodes on the edges, on the faces, and in the element. ---*/
- for (long iIndex = 0; iIndex < 4; iIndex++)
- if (DivEdge[PyramEdgeIndex[nPyram][iIndex]] == true) PyramEdgeCode[nPyram][iIndex] = true;
- nPyram++;
+ long *NodeAtEdges = new long[geometry->GetnEdge()];
+ long *NodeAtElem = new long[geometry->GetnElem()];
- // Create the 2nd pyramid.
- HexaPyramIndex[iElem][1] = nPyram; PyramHexaIndex[nPyram] = iElem; PyramElemNode[nPyram][0] = nPoint_new;
+ for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) NodeAtEdges[iEdge] = -1;
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem++) NodeAtElem[iElem] = -1;
- PyramNode[nPyram][0] = ip_4; PyramNode[nPyram][1] = ip_7;
- PyramNode[nPyram][2] = ip_6; PyramNode[nPyram][3] = ip_5;
+ nPoint_new = geometry->GetnPoint();
- PyramEdgeIndex[nPyram][0] = HexaEdgeIndex[iElem][7]; PyramEdgeIndex[nPyram][1] = HexaEdgeIndex[iElem][6];
- PyramEdgeIndex[nPyram][2] = HexaEdgeIndex[iElem][5]; PyramEdgeIndex[nPyram][3] = HexaEdgeIndex[iElem][4];
-
- PyramEdgeNode[nPyram][0] = HexaEdgeNode[iElem][7]; PyramEdgeNode[nPyram][1] = HexaEdgeNode[iElem][6];
- PyramEdgeNode[nPyram][2] = HexaEdgeNode[iElem][5]; PyramEdgeNode[nPyram][3] = HexaEdgeNode[iElem][4];
-
- for (long iIndex = 0; iIndex < 4; iIndex++)
- if (DivEdge[PyramEdgeIndex[nPyram][iIndex]] == true) PyramEdgeCode[nPyram][iIndex] = true;
- nPyram++;
-
- // Create the 3th pyramid.
- HexaPyramIndex[iElem][2] = nPyram; PyramHexaIndex[nPyram] = iElem; PyramElemNode[nPyram][0] = nPoint_new;
-
- PyramNode[nPyram][0] = ip_0; PyramNode[nPyram][1] = ip_4;
- PyramNode[nPyram][2] = ip_5; PyramNode[nPyram][3] = ip_1;
-
- PyramEdgeIndex[nPyram][0] = HexaEdgeIndex[iElem][8]; PyramEdgeIndex[nPyram][1] = HexaEdgeIndex[iElem][4];
- PyramEdgeIndex[nPyram][2] = HexaEdgeIndex[iElem][9]; PyramEdgeIndex[nPyram][3] = HexaEdgeIndex[iElem][0];
-
- PyramEdgeNode[nPyram][0] = HexaEdgeNode[iElem][8]; PyramEdgeNode[nPyram][1] = HexaEdgeNode[iElem][4];
- PyramEdgeNode[nPyram][2] = HexaEdgeNode[iElem][9]; PyramEdgeNode[nPyram][3] = HexaEdgeNode[iElem][0];
-
- for (long iIndex = 0; iIndex < 4; iIndex++)
- if (DivEdge[PyramEdgeIndex[nPyram][iIndex]] == true) PyramEdgeCode[nPyram][iIndex] = true;
- nPyram++;
-
- // Create the 4th pyramid.
- HexaPyramIndex[iElem][3] = nPyram; PyramHexaIndex[nPyram] = iElem; PyramElemNode[nPyram][0] = nPoint_new;
-
- PyramNode[nPyram][0] = ip_3; PyramNode[nPyram][1] = ip_2;
- PyramNode[nPyram][2] = ip_6; PyramNode[nPyram][3] = ip_7;
-
- PyramEdgeIndex[nPyram][0] = HexaEdgeIndex[iElem][2]; PyramEdgeIndex[nPyram][1] = HexaEdgeIndex[iElem][10];
- PyramEdgeIndex[nPyram][2] = HexaEdgeIndex[iElem][6]; PyramEdgeIndex[nPyram][3] = HexaEdgeIndex[iElem][11];
-
- PyramEdgeNode[nPyram][0] = HexaEdgeNode[iElem][2]; PyramEdgeNode[nPyram][1] = HexaEdgeNode[iElem][10];
- PyramEdgeNode[nPyram][2] = HexaEdgeNode[iElem][6]; PyramEdgeNode[nPyram][3] = HexaEdgeNode[iElem][11];
-
- for (long iIndex = 0; iIndex < 4; iIndex++)
- if (DivEdge[PyramEdgeIndex[nPyram][iIndex]] == true) PyramEdgeCode[nPyram][iIndex] = true;
- nPyram++;
-
- // Create the 5th pyramid.
- HexaPyramIndex[iElem][4] = nPyram; PyramHexaIndex[nPyram] = iElem; PyramElemNode[nPyram][0] = nPoint_new;
-
- PyramNode[nPyram][0] = ip_1; PyramNode[nPyram][1] = ip_5;
- PyramNode[nPyram][2] = ip_6; PyramNode[nPyram][3] = ip_2;
-
- PyramEdgeIndex[nPyram][0] = HexaEdgeIndex[iElem][9]; PyramEdgeIndex[nPyram][1] = HexaEdgeIndex[iElem][5];
- PyramEdgeIndex[nPyram][2] = HexaEdgeIndex[iElem][10]; PyramEdgeIndex[nPyram][3] = HexaEdgeIndex[iElem][1];
-
- PyramEdgeNode[nPyram][0] = HexaEdgeNode[iElem][9]; PyramEdgeNode[nPyram][1] = HexaEdgeNode[iElem][5];
- PyramEdgeNode[nPyram][2] = HexaEdgeNode[iElem][10]; PyramEdgeNode[nPyram][3] = HexaEdgeNode[iElem][1];
-
- for (long iIndex = 0; iIndex < 4; iIndex++)
- if (DivEdge[PyramEdgeIndex[nPyram][iIndex]] == true) PyramEdgeCode[nPyram][iIndex] = true;
- nPyram++;
-
- // Create the 6th pyramid.
- HexaPyramIndex[iElem][5] = nPyram; PyramHexaIndex[nPyram] = iElem; PyramElemNode[nPyram][0] = nPoint_new;
-
- PyramNode[nPyram][0] = ip_0; PyramNode[nPyram][1] = ip_3;
- PyramNode[nPyram][2] = ip_7; PyramNode[nPyram][3] = ip_4;
-
- PyramEdgeIndex[nPyram][0] = HexaEdgeIndex[iElem][3]; PyramEdgeIndex[nPyram][1] = HexaEdgeIndex[iElem][11];
- PyramEdgeIndex[nPyram][2] = HexaEdgeIndex[iElem][7]; PyramEdgeIndex[nPyram][3] = HexaEdgeIndex[iElem][8];
-
- PyramEdgeNode[nPyram][0] = HexaEdgeNode[iElem][3]; PyramEdgeNode[nPyram][1] = HexaEdgeNode[iElem][11];
- PyramEdgeNode[nPyram][2] = HexaEdgeNode[iElem][7]; PyramEdgeNode[nPyram][3] = HexaEdgeNode[iElem][8];
-
- for (long iIndex = 0; iIndex < 4; iIndex++)
- if (DivEdge[PyramEdgeIndex[nPyram][iIndex]] == true) PyramEdgeCode[nPyram][iIndex] = true;
- nPyram++;
-
- nPoint_new++;
-
-
- }
- }
- }
-
- // Check the kind of Pyram partitioning that should be applied
- for (long iPyram = 0; iPyram < nPyram; iPyram ++) {
- PyramAdaptCode[iPyram] = CheckPyramCode(PyramEdgeCode[iPyram]);
- if (PyramAdaptCode[iPyram] == 0) cout << "There is a problem with one Pyram" << endl;
- }
-
- // Create new structure
- nElem_new = geometry->GetnElem();
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- if (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON) {
- if (TetraAdaptCode[iElem] == 1) nElem_new = nElem_new + 7;
- if (TetraAdaptCode[iElem] == 2) nElem_new = nElem_new + 3;
- if (TetraAdaptCode[iElem] == 3) nElem_new = nElem_new + 3;
- if (TetraAdaptCode[iElem] == 4) nElem_new = nElem_new + 3;
- if (TetraAdaptCode[iElem] == 5) nElem_new = nElem_new + 3;
- if (TetraAdaptCode[iElem] == 6) nElem_new = nElem_new + 7;
- }
- if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) {
- if (HexaAdaptCode[iElem] == 1) nElem_new = nElem_new + 7;
- if (HexaAdaptCode[iElem] == 2) nElem_new = nElem_new + 3;
- if (HexaAdaptCode[iElem] == 3) nElem_new = nElem_new + 3;
- if (HexaAdaptCode[iElem] == 4) nElem_new = nElem_new + 3;
- if (HexaAdaptCode[iElem] == 5) nElem_new = nElem_new + 1;
- if (HexaAdaptCode[iElem] == 6) nElem_new = nElem_new + 1;
- if (HexaAdaptCode[iElem] == 7) nElem_new = nElem_new + 1;
- if (HexaAdaptCode[iElem] == 0) {
- long iPyram;
- for (long iIndex = 0; iIndex < 6; iIndex++) {
- iPyram = HexaPyramIndex[iElem][0];
- if (PyramAdaptCode[iPyram] == 1) nElem_new = nElem_new + 0;
- if (PyramAdaptCode[iPyram] == 2) nElem_new = nElem_new + 2;
- if (PyramAdaptCode[iPyram] == 3) nElem_new = nElem_new + 2;
- if (PyramAdaptCode[iPyram] == 4) nElem_new = nElem_new + 2;
- if (PyramAdaptCode[iPyram] == 5) nElem_new = nElem_new + 2;
- if (PyramAdaptCode[iPyram] == 6) nElem_new = nElem_new + 3;
- if (PyramAdaptCode[iPyram] == 7) nElem_new = nElem_new + 3;
- if (PyramAdaptCode[iPyram] == 8) nElem_new = nElem_new + 3;
- if (PyramAdaptCode[iPyram] == 9) nElem_new = nElem_new + 3;
- if (PyramAdaptCode[iPyram] == 10) nElem_new = nElem_new + 1;
- if (PyramAdaptCode[iPyram] == 11) nElem_new = nElem_new + 1;
- if (PyramAdaptCode[iPyram] == 12) nElem_new = nElem_new + 3;
- if (PyramAdaptCode[iPyram] == 13) nElem_new = nElem_new + 3;
- if (PyramAdaptCode[iPyram] == 14) nElem_new = nElem_new + 3;
- if (PyramAdaptCode[iPyram] == 15) nElem_new = nElem_new + 3;
- if (PyramAdaptCode[iPyram] == 16) nElem_new = nElem_new + 3;
- }
- }
- }
- }
-
- // New points
- geo_adapt->node = new CPoint*[nPoint_new];
-
- for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++)
- geo_adapt->node[iPoint] = new CPoint(geometry->node[iPoint]->GetCoord(0), geometry->node[iPoint]->GetCoord(1), geometry->node[iPoint]->GetCoord(2), iPoint, config);
-
- for (iPoint = geometry->GetnPoint(); iPoint < nPoint_new; iPoint++)
- geo_adapt->node[iPoint] = new CPoint(NewNodeCoord[iPoint][0], NewNodeCoord[iPoint][1], NewNodeCoord[iPoint][2], iPoint, config);
-
- // New elements
- geo_adapt->elem = new CPrimalGrid*[nElem_new];
-
- unsigned long iElemNew = 0;
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- if (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON) {
- if (TetraAdaptCode[iElem] == -1) {
- geo_adapt->elem[iElemNew] = new CTetrahedron(geometry->elem[iElem]->GetNode(0),
- geometry->elem[iElem]->GetNode(1),
- geometry->elem[iElem]->GetNode(2),
- geometry->elem[iElem]->GetNode(3));
- iElemNew++;
- }
- }
- if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) {
- if (HexaAdaptCode[iElem] == -1) {
- geo_adapt->elem[iElemNew] = new CHexahedron(geometry->elem[iElem]->GetNode(0),
- geometry->elem[iElem]->GetNode(1),
- geometry->elem[iElem]->GetNode(2),
- geometry->elem[iElem]->GetNode(3),
- geometry->elem[iElem]->GetNode(4),
- geometry->elem[iElem]->GetNode(5),
- geometry->elem[iElem]->GetNode(6),
- geometry->elem[iElem]->GetNode(7));
- iElemNew++;
- }
- }
- if (geometry->elem[iElem]->GetVTK_Type() == PYRAMID) {
- geo_adapt->elem[iElemNew] = new CPyramid(geometry->elem[iElem]->GetNode(0),
- geometry->elem[iElem]->GetNode(1),
- geometry->elem[iElem]->GetNode(2),
- geometry->elem[iElem]->GetNode(3),
- geometry->elem[iElem]->GetNode(4));
- iElemNew++;
- }
- if (geometry->elem[iElem]->GetVTK_Type() == PRISM) {
- geo_adapt->elem[iElemNew] = new CPrism(geometry->elem[iElem]->GetNode(0),
- geometry->elem[iElem]->GetNode(1),
- geometry->elem[iElem]->GetNode(2),
- geometry->elem[iElem]->GetNode(3),
- geometry->elem[iElem]->GetNode(4),
- geometry->elem[iElem]->GetNode(5));
- iElemNew++;
- }
- }
-
- long nodes[27]; long **Division; long nPart;
-
- Division = new long*[100];
- for (long iVar = 0; iVar < 100; iVar++)
- Division[iVar] = new long[100];
-
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- if (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON) {
-
- // Tetra elements...
- if (TetraAdaptCode[iElem] > 0) {
-
- // First the corners
- nodes[0] = geometry->elem[iElem]->GetNode(0);
- nodes[1] = geometry->elem[iElem]->GetNode(1);
- nodes[2] = geometry->elem[iElem]->GetNode(2);
- nodes[3] = geometry->elem[iElem]->GetNode(3);
-
- // Next the points that correspond to the broken edges.
- nodes[4] = TetraEdgeNode[iElem][0];
- nodes[5] = TetraEdgeNode[iElem][1];
- nodes[6] = TetraEdgeNode[iElem][2];
- nodes[7] = TetraEdgeNode[iElem][3];
- nodes[8] = TetraEdgeNode[iElem][4];
- nodes[9] = TetraEdgeNode[iElem][5];
-
- ip_0 = geometry->elem[iElem]->GetNode(0);
- ip_1 = geometry->elem[iElem]->GetNode(1);
- ip_2 = geometry->elem[iElem]->GetNode(2);
- ip_3 = geometry->elem[iElem]->GetNode(3);
-
- long edges[6] = {-1, -1, -1, -1, -1 , -1};
- if (DivEdge[geometry->FindEdge(ip_0, ip_1)]) {edges[0] = geometry->FindEdge(ip_0, ip_1);}
- if (DivEdge[geometry->FindEdge(ip_0, ip_2)]) {edges[1] = geometry->FindEdge(ip_0, ip_2);}
- if (DivEdge[geometry->FindEdge(ip_0, ip_3)]) {edges[2] = geometry->FindEdge(ip_0, ip_3);}
- if (DivEdge[geometry->FindEdge(ip_1, ip_2)]) {edges[3] = geometry->FindEdge(ip_1, ip_2);}
- if (DivEdge[geometry->FindEdge(ip_1, ip_3)]) {edges[4] = geometry->FindEdge(ip_1, ip_3);}
- if (DivEdge[geometry->FindEdge(ip_2, ip_3)]) {edges[5] = geometry->FindEdge(ip_2, ip_3);}
-
-
- TetraDivision(TetraAdaptCode[iElem], nodes, edges, Division, &nPart);
-
- for (long iPart = 0; iPart < nPart; iPart++) {
-
- // Tetra case
- geo_adapt->elem[iElemNew] = new CTetrahedron(Division[iPart][1],
- Division[iPart][2],
- Division[iPart][3],
- Division[iPart][4]);
- iElemNew++;
- }
- }
- }
-
- if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) {
- // Hexa elements...
- if (HexaAdaptCode[iElem] > 0) {
-
- // First the corners
- nodes[0] = geometry->elem[iElem]->GetNode(0); nodes[1] = geometry->elem[iElem]->GetNode(1);
- nodes[2] = geometry->elem[iElem]->GetNode(2); nodes[3] = geometry->elem[iElem]->GetNode(3);
- nodes[4] = geometry->elem[iElem]->GetNode(4); nodes[5] = geometry->elem[iElem]->GetNode(5);
- nodes[6] = geometry->elem[iElem]->GetNode(6); nodes[7] = geometry->elem[iElem]->GetNode(7);
-
- // Next the points that correspond to the broken edges.
- nodes[8] = HexaEdgeNode[iElem][0]; nodes[9] = HexaEdgeNode[iElem][1];
- nodes[10] = HexaEdgeNode[iElem][2]; nodes[11] = HexaEdgeNode[iElem][3];
- nodes[12] = HexaEdgeNode[iElem][4]; nodes[13] = HexaEdgeNode[iElem][5];
- nodes[14] = HexaEdgeNode[iElem][6]; nodes[15] = HexaEdgeNode[iElem][7];
- nodes[16] = HexaEdgeNode[iElem][8]; nodes[17] = HexaEdgeNode[iElem][9];
- nodes[18] = HexaEdgeNode[iElem][10]; nodes[19] = HexaEdgeNode[iElem][11];
-
- // Next the points that correspond to the faces.
- nodes[20] = HexaFaceNode[iElem][0];
- nodes[21] = HexaFaceNode[iElem][1];
- nodes[22] = HexaFaceNode[iElem][2];
- nodes[23] = HexaFaceNode[iElem][3];
- nodes[24] = HexaFaceNode[iElem][4];
- nodes[25] = HexaFaceNode[iElem][5];
-
- // Next the points that correspond to the element.
- nodes[8] = HexaElemNode[iElem][0];
-
- HexaDivision(HexaAdaptCode[iElem], nodes, Division, &nPart);
- for (long iPart = 0; iPart < nPart; iPart++) {
- geo_adapt->elem[iElemNew] = new CHexahedron(Division[iPart][1],
- Division[iPart][2],
- Division[iPart][3],
- Division[iPart][4],
- Division[iPart][5],
- Division[iPart][6],
- Division[iPart][7],
- Division[iPart][8]);
- iElemNew++;
- }
- }
-
- // Pyram elements...
- if (HexaAdaptCode[iElem] == 0) {
- long iPyram = HexaPyramIndex[iElem][0];
-
- // First the corners
- nodes[0] = PyramNode[iPyram][0];
- nodes[1] = PyramNode[iPyram][1];
- nodes[2] = PyramNode[iPyram][2];
- nodes[3] = PyramNode[iPyram][3];
- nodes[4] = PyramElemNode[iPyram][0];
-
- // Next the points that correspond to the broken edges.
- nodes[5] = PyramEdgeNode[iPyram][0];
- nodes[6] = PyramEdgeNode[iPyram][1];
- nodes[7] = PyramEdgeNode[iPyram][2];
- nodes[8] = PyramEdgeNode[iPyram][3];
-
- // Next the points that correspond to the base face.
- nodes[9] = PyramFaceNode[iPyram][0];
-
- PyramDivision(PyramAdaptCode[iPyram], nodes, Division, &nPart);
- for (long iPart = 0; iPart < nPart; iPart++) {
-
- // Tetra case
- if (Division[iPart][0] == 5) {
- geo_adapt->elem[iElemNew] = new CTetrahedron(Division[iPart][1],
- Division[iPart][2],
- Division[iPart][3],
- Division[iPart][4]);
- iElemNew++;
- }
-
- // Pyram case
- if (Division[iPart][0] == 6) {
- geo_adapt->elem[iElemNew] = new CPyramid(Division[iPart][1],
- Division[iPart][2],
- Division[iPart][3],
- Division[iPart][4],
- Division[iPart][5]);
- iElemNew++;
- }
- }
- }
- }
- }
-
- geo_adapt->SetnElem(iElemNew);
- geo_adapt->SetnPoint(nPoint_new);
- geo_adapt->SetnPointDomain(nPoint_new);
- geo_adapt->SetnDim(nDim);
-
- // Create boundary structure
- geo_adapt->SetnMarker(geometry->GetnMarker());
- geo_adapt->nElem_Bound = new unsigned long [geometry->GetnMarker()];
- geo_adapt->Tag_to_Marker = new string [nMarker_Max];
- geo_adapt->bound = new CPrimalGrid**[geometry->GetnMarker()];
-
- // Conservative estimation of the number of boundary elements.
- for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) {
- long nNewBCcv = 0;
- for (iVertex = 0; iVertex < geometry->GetnElem_Bound(iMarker); iVertex++) {
- nNewBCcv = nNewBCcv + 4;
- }
- geo_adapt->bound[iMarker] = new CPrimalGrid* [nNewBCcv];
- geo_adapt->SetMarker_Tag(iMarker, geometry->GetMarker_Tag(iMarker));
- }
-
-
- for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) {
- long nNewBCcv = 0;
- for (iVertex = 0; iVertex < geometry->GetnElem_Bound(iMarker); iVertex++) {
-
- bool TriangleEdgeCode[3] = { false, false, false };
- long TriangleAdaptCode, nodes[6];
- long nNodesBound = geometry->bound[iMarker][iVertex]->GetnNodes();
-
- ip_0 = geometry->bound[iMarker][iVertex]->GetNode(0); geo_adapt->node[ip_0]->SetBoundary(geometry->GetnMarker());
- ip_1 = geometry->bound[iMarker][iVertex]->GetNode(1); geo_adapt->node[ip_1]->SetBoundary(geometry->GetnMarker());
- ip_2 = geometry->bound[iMarker][iVertex]->GetNode(2); geo_adapt->node[ip_2]->SetBoundary(geometry->GetnMarker());
- if (nNodesBound == 4) {
- ip_3 = geometry->bound[iMarker][iVertex]->GetNode(3); geo_adapt->node[ip_3]->SetBoundary(geometry->GetnMarker());
- geo_adapt->bound[iMarker][nNewBCcv] = new CQuadrilateral(ip_0, ip_1, ip_2, ip_3, 3);
- nNewBCcv++;
- }
- else {
- // First the corners
- nodes[0] = geometry->bound[iMarker][iVertex]->GetNode(0);
- nodes[1] = geometry->bound[iMarker][iVertex]->GetNode(1);
- nodes[2] = geometry->bound[iMarker][iVertex]->GetNode(2);
- if (nNodesBound == 4) nodes[3] = geometry->bound[iMarker][iVertex]->GetNode(3);
-
- // Next the points that correspond to the broken edges.
- nodes[3] = NodeAtEdges[geometry->FindEdge(ip_0, ip_1)]; if (nodes[3] != -1) geo_adapt->node[nodes[3]]->SetBoundary(geometry->GetnMarker());
- nodes[4] = NodeAtEdges[geometry->FindEdge(ip_1, ip_2)]; if (nodes[4] != -1) geo_adapt->node[nodes[4]]->SetBoundary(geometry->GetnMarker());
- nodes[5] = NodeAtEdges[geometry->FindEdge(ip_0, ip_2)]; if (nodes[5] != -1) geo_adapt->node[nodes[5]]->SetBoundary(geometry->GetnMarker());
-
- long edges[3] = {-1, -1, -1};
- if (DivEdge[geometry->FindEdge(ip_0, ip_1)]) { edges[0] = geometry->FindEdge(ip_0, ip_1); TriangleEdgeCode[0] = true;}
- if (DivEdge[geometry->FindEdge(ip_1, ip_2)]) { edges[1] = geometry->FindEdge(ip_1, ip_2); TriangleEdgeCode[1] = true;}
- if (DivEdge[geometry->FindEdge(ip_2, ip_0)]) { edges[2] = geometry->FindEdge(ip_2, ip_0); TriangleEdgeCode[2] = true;}
-
- TriangleAdaptCode = CheckTriangleCode(TriangleEdgeCode);
- TriangleDivision(TriangleAdaptCode, nodes, edges, Division, &nPart);
-
- for (long iPart = 0; iPart < nPart; iPart++) {
- geo_adapt->bound[iMarker][nNewBCcv] = new CTriangle(Division[iPart][1], Division[iPart][2], Division[iPart][3], 3);
- nNewBCcv++;
- }
- }
- }
- geo_adapt->SetnElem_Bound(iMarker, nNewBCcv);
- }
-
- delete [] DivEdge;
- delete [] DivElem;
- delete [] NodeAtEdges;
- delete [] NodeAtElem;
-}
+ su2double **NewNodeCoord;
+ NewNodeCoord = new su2double *[4*geometry->GetnPoint()];
+ for (iPoint = 0; iPoint < 4*geometry->GetnPoint(); iPoint++)
+ NewNodeCoord[iPoint] = new su2double[geometry->GetnDim()];
-void CGridAdaptation::SetIndicator_Flow(CGeometry *geometry, CConfig *config, unsigned short strength) {
- unsigned long Point = 0, Point_0 = 0, Point_1 = 0, iEdge, iVertex, iPoint, iElem, max_elem_new;
- unsigned short iDim, iMarker;
- su2double Dual_Area, norm, Solution_Vertex, Solution_0, Solution_1, Solution_Average,
- DualArea, Partial_Res, Grad_Val;
- su2double scale_area = config->GetDualVol_Power();
+ if (Restart_Flow) {
+ ConsVar_Adapt = new su2double *[4*geometry->GetnPoint()];
+ for (iPoint = 0; iPoint < 4*geometry->GetnPoint(); iPoint++)
+ ConsVar_Adapt[iPoint] = new su2double[nVar];
+ }
- /*--- Initialization ---*/
- nElem_new = 0;
- max_elem_new = SU2_TYPE::Int(0.01*config->GetNew_Elem_Adapt()*su2double(geometry->GetnElem()));
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- geometry->elem[iElem]->SetDivide(false);
+ if (Restart_Adjoint) {
+ AdjVar_Adapt = new su2double *[4*geometry->GetnPoint()];
+ for (iPoint = 0; iPoint < 4*geometry->GetnPoint(); iPoint++)
+ AdjVar_Adapt[iPoint] = new su2double[nVar];
}
- /*--- Compute the gradient of the first variable ---*/
- for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
- for (iDim = 0; iDim < nDim; iDim++)
- Gradient[iPoint][iDim] = 0.0;
+ /*--- Set the value of the variables ---*/
- for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
- Point_0 = geometry->edges->GetNode(iEdge,0); Solution_0 = ConsVar_Sol[Point_0][0];
- Point_1 = geometry->edges->GetNode(iEdge,1); Solution_1 = ConsVar_Sol[Point_1][0];
- const auto Normal = geometry->edges->GetNormal(iEdge);
- Solution_Average = 0.5 * ( Solution_0 + Solution_1);
- for (iDim = 0; iDim < nDim; iDim++) {
- Partial_Res = Solution_Average*Normal[iDim];
- Gradient[Point_0][iDim] = Gradient[Point_0][iDim] + Partial_Res;
- Gradient[Point_1][iDim] = Gradient[Point_1][iDim] - Partial_Res;
+ for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++) {
+ for (iVar = 0; iVar < nVar; iVar ++) {
+ if (Restart_Flow) ConsVar_Adapt[iPoint][iVar] = ConsVar_Sol[iPoint][iVar];
+ if (Restart_Adjoint) AdjVar_Adapt[iPoint][iVar] = AdjVar_Sol[iPoint][iVar];
}
}
- for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++)
- if ((config->GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) &&
- (config->GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) {
- for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) {
- Point = geometry->vertex[iMarker][iVertex]->GetNode();
- Solution_Vertex = ConsVar_Sol[Point][0];
- const auto Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
- for (iDim = 0; iDim < nDim; iDim++) {
- Partial_Res = Solution_Vertex*Normal[iDim];
- Gradient[Point][iDim] = Gradient[Point][iDim] - Partial_Res;
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ if (geometry->elem[iElem]->GetVTK_Type() == TRIANGLE) {
+
+ ip_0 = geometry->elem[iElem]->GetNode(0);
+ ip_1 = geometry->elem[iElem]->GetNode(1);
+ ip_2 = geometry->elem[iElem]->GetNode(2);
+
+ for (int iIndex = 0; iIndex < 3; iIndex++) {
+
+ if (TriangleEdgeCode[iElem][iIndex] == true) {
+ if (NodeAtEdges[TriangleEdgeIndex[iElem][iIndex]] != -1)
+ TriangleEdgeNode[iElem][iIndex] = NodeAtEdges[TriangleEdgeIndex[iElem][iIndex]];
+
+ if (NodeAtEdges[TriangleEdgeIndex[iElem][iIndex]] == -1) {
+
+ NodeAtEdges[TriangleEdgeIndex[iElem][iIndex]] = nPoint_new;
+ TriangleEdgeNode[iElem][iIndex] = nPoint_new;
+
+ /*--- Compute the coordinates of the new node ---*/
+
+ if (iIndex == 0) {no_0 = ip_0; no_1 = ip_1;}
+ if (iIndex == 1) {no_0 = ip_1; no_1 = ip_2;}
+ if (iIndex == 2) {no_0 = ip_2; no_1 = ip_0;}
+ for (iDim = 0; iDim < geometry->GetnDim(); iDim++)
+ NewNodeCoord[nPoint_new][iDim] = 0.5*(geometry->nodes->GetCoord(no_0,iDim)+geometry->nodes->GetCoord(no_1,iDim));
+
+ for (iVar = 0; iVar < nVar; iVar ++) {
+ if (Restart_Flow) ConsVar_Adapt[nPoint_new][iVar] = 0.5 * (ConsVar_Adapt[no_0][iVar]+ConsVar_Adapt[no_1][iVar]);
+ if (Restart_Adjoint) AdjVar_Adapt[nPoint_new][iVar] = 0.5 * (AdjVar_Adapt[no_0][iVar]+AdjVar_Adapt[no_1][iVar]);
+ }
+
+ nPoint_new++;
+ }
}
}
}
+ if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) {
- for (iPoint = 0; iPointGetnPoint(); iPoint++)
- for (iDim = 0; iDim < nDim; iDim++) {
- DualArea = geometry->node[iPoint]->GetVolume();
- Grad_Val = Gradient[iPoint][iDim]/DualArea;
- Gradient[iPoint][iDim] = Grad_Val;
- }
+ ip_0 = geometry->elem[iElem]->GetNode(0);
+ ip_1 = geometry->elem[iElem]->GetNode(1);
+ ip_2 = geometry->elem[iElem]->GetNode(2);
+ ip_3 = geometry->elem[iElem]->GetNode(3);
- /*--- Compute the the adaptation index at each point ---*/
- for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++) {
- Dual_Area = geometry->node[iPoint]->GetVolume();
- norm = 0.0;
- for (iDim = 0; iDim < nDim; iDim++)
- norm += Gradient[iPoint][iDim]*Gradient[iPoint][iDim];
- norm = sqrt(norm);
- Index[iPoint] = pow(Dual_Area, scale_area)*norm;
- }
+ for (int iIndex = 0; iIndex < 4; iIndex++) {
- SetSensorElem(geometry, config, max_elem_new);
+ if (RectEdgeCode[iElem][iIndex] == true) {
+ if (NodeAtEdges[RectEdgeIndex[iElem][iIndex]] != -1)
+ RectEdgeNode[iElem][iIndex] = NodeAtEdges[RectEdgeIndex[iElem][iIndex]];
-}
+ if (NodeAtEdges[RectEdgeIndex[iElem][iIndex]] == -1) {
+ NodeAtEdges[RectEdgeIndex[iElem][iIndex]] = nPoint_new;
+ RectEdgeNode[iElem][iIndex] = nPoint_new;
-void CGridAdaptation::SetIndicator_Adj(CGeometry *geometry, CConfig *config, unsigned short strength) {
- su2double Dual_Area;
- unsigned long Point = 0, Point_0 = 0, Point_1 = 0, iEdge, iVertex, iPoint, iElem, max_elem_new;
- unsigned short iDim, iMarker;
- su2double norm, Solution_Vertex, Solution_0, Solution_1, Solution_Average,
- DualArea, Partial_Res, Grad_Val;
- su2double scale_area = config->GetDualVol_Power();
+ /*--- Compute the coordinates of the new node ---*/
- // Initialization
- nElem_new = 0;
- max_elem_new = SU2_TYPE::Int(0.01*config->GetNew_Elem_Adapt()*su2double(geometry->GetnElem()));
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- geometry->elem[iElem]->SetDivide(false);
- }
+ if (iIndex == 0) {no_0 = ip_0; no_1 = ip_1;}
+ if (iIndex == 1) {no_0 = ip_1; no_1 = ip_2;}
+ if (iIndex == 2) {no_0 = ip_2; no_1 = ip_3;}
+ if (iIndex == 3) {no_0 = ip_3; no_1 = ip_0;}
+ for (iDim = 0; iDim < geometry->GetnDim(); iDim++)
+ NewNodeCoord[nPoint_new][iDim] = 0.5*(geometry->nodes->GetCoord(no_0,iDim)+geometry->nodes->GetCoord(no_1,iDim));
- // Compute the gradient of the density.
- for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
- for (iDim = 0; iDim < nDim; iDim++)
- Gradient[iPoint][iDim] = 0.0;
+ for (iVar = 0; iVar < nVar; iVar ++) {
+ if (Restart_Flow) ConsVar_Adapt[nPoint_new][iVar] = 0.5 * (ConsVar_Adapt[no_0][iVar]+ConsVar_Adapt[no_1][iVar]);
+ if (Restart_Adjoint) AdjVar_Adapt[nPoint_new][iVar] = 0.5 * (AdjVar_Adapt[no_0][iVar]+AdjVar_Adapt[no_1][iVar]);
+ }
+
+ nPoint_new++;
+ }
+ }
+ }
+
+ for (int iIndex = 0; iIndex < 1; iIndex++) {
+
+ if (RectElemCode[iElem][iIndex] == true) {
+
+ if (NodeAtElem[RectElemIndex[iElem][iIndex]] != -1)
+ RectElemNode[iElem][iIndex] = NodeAtElem[RectElemIndex[iElem][iIndex]];
+
+ if (NodeAtElem[RectElemIndex[iElem][iIndex]] == -1) {
+ NodeAtElem[RectElemIndex[iElem][iIndex]] = nPoint_new;
+ RectElemNode[iElem][iIndex] = nPoint_new;
+
+ /*--- Compute the coordinates of the new node ---*/
+
+ if (iIndex == 0) {no_0 = ip_0; no_1 = ip_1; no_2 = ip_2; no_3 = ip_3;}
+ for (iDim = 0; iDim < geometry->GetnDim(); iDim++)
+ NewNodeCoord[nPoint_new][iDim] = 0.25*(geometry->nodes->GetCoord(no_0, iDim) +
+ geometry->nodes->GetCoord(no_1, iDim) +
+ geometry->nodes->GetCoord(no_2, iDim) +
+ geometry->nodes->GetCoord(no_3, iDim));
+
+ for (iVar = 0; iVar < nVar; iVar ++) {
+ if (Restart_Flow) ConsVar_Adapt[nPoint_new][iVar] = 0.25 * (ConsVar_Adapt[no_0][iVar]+ConsVar_Adapt[no_1][iVar]+ConsVar_Adapt[no_2][iVar]+ConsVar_Adapt[no_3][iVar]);
+ if (Restart_Adjoint) AdjVar_Adapt[nPoint_new][iVar] = 0.25 * (AdjVar_Adapt[no_0][iVar]+AdjVar_Adapt[no_1][iVar]+AdjVar_Adapt[no_2][iVar]+AdjVar_Adapt[no_3][iVar]);
+ }
+
+ nPoint_new++;
+ }
+ }
+ }
+ }
+
+ }
+
+
+ /*--- if Quadrilateral adapt code equals 0, then a semidivision is applied ---*/
+ long nSemiDivided = 0;
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) {
+ if (RectAdaptCode[iElem] == 0)
+ nSemiDivided++;
+ }
+ }
+
+ /*--- If semidivision, then divide add a new point, divide the quadrilateral into triangles,
+ and find the right combination, it also create the new node (hexa). ---*/
+ long nRectExt = nSemiDivided;
+
+ long *RectExtAdaptCode;
+ long **RectExtNode;
+ long **RectRectExtIndex;
+ long *RectExtRectIndex;
+
+ long **RectExtEdgeIndex;
+ bool **RectExtEdgeCode;
+ long **RectExtEdgeNode;
+
+ RectExtAdaptCode = new long [nRectExt];
+ RectExtNode = new long *[nRectExt];
+ RectRectExtIndex = new long *[geometry->GetnElem()];
+ RectExtRectIndex = new long [nRectExt];
+ RectExtEdgeIndex = new long *[nRectExt];
+ RectExtEdgeCode = new bool *[nRectExt];
+ RectExtEdgeNode = new long *[nRectExt];
+
+ for (long iRectExt = 0; iRectExt < nRectExt; iRectExt++) {
+ RectExtNode[iRectExt] = new long [4];
+ RectExtEdgeIndex[iRectExt] = new long [4];
+ RectExtEdgeCode[iRectExt] = new bool [4];
+ RectExtEdgeNode[iRectExt] = new long [4];
+ }
+
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) {
+ RectRectExtIndex[iElem] = new long [1];
+ }
+ }
+
+ nRectExt = 0;
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) {
+ if (RectAdaptCode[iElem] == 0) {
+
+ /*--- Write the edge combination on the base. ---*/
+
+ ip_0 = geometry->elem[iElem]->GetNode(0);
+ ip_1 = geometry->elem[iElem]->GetNode(1);
+ ip_2 = geometry->elem[iElem]->GetNode(2);
+ ip_3 = geometry->elem[iElem]->GetNode(3);
+
+ /*--- Create the 1st RectExtid. ---*/
+
+ RectRectExtIndex[iElem][0] = nRectExt; RectExtRectIndex[nRectExt] = iElem;
+
+ RectExtNode[nRectExt][0] = ip_0; RectExtNode[nRectExt][1] = ip_1;
+ RectExtNode[nRectExt][2] = ip_2; RectExtNode[nRectExt][3] = ip_3;
+
+ RectExtEdgeIndex[nRectExt][0] = RectEdgeIndex[iElem][0]; RectExtEdgeIndex[nRectExt][1] = RectEdgeIndex[iElem][1];
+ RectExtEdgeIndex[nRectExt][2] = RectEdgeIndex[iElem][2]; RectExtEdgeIndex[nRectExt][3] = RectEdgeIndex[iElem][3];
+
+ RectExtEdgeNode[nRectExt][0] = RectEdgeNode[iElem][0]; RectExtEdgeNode[nRectExt][1] = RectEdgeNode[iElem][1];
+ RectExtEdgeNode[nRectExt][2] = RectEdgeNode[iElem][2]; RectExtEdgeNode[nRectExt][3] = RectEdgeNode[iElem][3];
+
+
+ for (int iIndex = 0; iIndex < 4; iIndex++)
+ if (DivEdge[RectExtEdgeIndex[nRectExt][iIndex]] == true) RectExtEdgeCode[nRectExt][iIndex] = true;
+ nRectExt++;
+
+ }
+ }
+ }
+
+ /*--- Check the kind of RectExt partitioning that should be applied ---*/
+
+ for (int iRectExt = 0; iRectExt < nRectExt; iRectExt ++) {
+ RectExtAdaptCode[iRectExt] = CheckRectExtCode(RectExtEdgeCode[iRectExt]);
+ if (RectExtAdaptCode[iRectExt] == 0) cout << "There is a problem with one RectExt" << endl;
+ }
+
+ /*--- Create new structure ---*/
+
+ nElem_new = geometry->GetnElem();
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ if (geometry->elem[iElem]->GetVTK_Type() == TRIANGLE) {
+ if (TriangleAdaptCode[iElem] == 1) nElem_new = nElem_new + 3;
+ if (TriangleAdaptCode[iElem] == 2) nElem_new = nElem_new + 1;
+ if (TriangleAdaptCode[iElem] == 3) nElem_new = nElem_new + 1;
+ if (TriangleAdaptCode[iElem] == 4) nElem_new = nElem_new + 1;
+ if (TriangleAdaptCode[iElem] == 5) nElem_new = nElem_new + 1;
+ if (TriangleAdaptCode[iElem] == 6) nElem_new = nElem_new + 1;
+ if (TriangleAdaptCode[iElem] == 7) nElem_new = nElem_new + 1;
+ }
+ if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) {
+ if (RectAdaptCode[iElem] == 1) nElem_new = nElem_new + 3;
+ if (RectAdaptCode[iElem] == 2) nElem_new = nElem_new + 1;
+ if (RectAdaptCode[iElem] == 3) nElem_new = nElem_new + 1;
+ if (RectAdaptCode[iElem] == 0) {
+ long iRectExt = RectRectExtIndex[iElem][0];
+ if (RectExtAdaptCode[iRectExt] == 2) nElem_new = nElem_new + 2;
+ if (RectExtAdaptCode[iRectExt] == 3) nElem_new = nElem_new + 2;
+ if (RectExtAdaptCode[iRectExt] == 4) nElem_new = nElem_new + 2;
+ if (RectExtAdaptCode[iRectExt] == 5) nElem_new = nElem_new + 2;
+ if (RectExtAdaptCode[iRectExt] == 6) nElem_new = nElem_new + 3;
+ if (RectExtAdaptCode[iRectExt] == 7) nElem_new = nElem_new + 3;
+ if (RectExtAdaptCode[iRectExt] == 8) nElem_new = nElem_new + 3;
+ if (RectExtAdaptCode[iRectExt] == 9) nElem_new = nElem_new + 3;
+ if (RectExtAdaptCode[iRectExt] == 12) nElem_new = nElem_new + 3;
+ if (RectExtAdaptCode[iRectExt] == 13) nElem_new = nElem_new + 3;
+ if (RectExtAdaptCode[iRectExt] == 14) nElem_new = nElem_new + 3;
+ if (RectExtAdaptCode[iRectExt] == 15) nElem_new = nElem_new + 3;
+ }
+ }
+ }
+
+ /*--- New points ---*/
+
+ geo_adapt->nodes = new CPoint(nPoint_new, nDim, MESH_0, config);
+
+ for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++) {
+ geo_adapt->nodes->SetCoord(iPoint, geometry->nodes->GetCoord(iPoint));
+ geo_adapt->nodes->SetGlobalIndex(iPoint, iPoint);
+ }
+
+ for (iPoint = geometry->GetnPoint(); iPoint < nPoint_new; iPoint++) {
+ geo_adapt->nodes->SetCoord(iPoint, NewNodeCoord[iPoint]);
+ geo_adapt->nodes->SetGlobalIndex(iPoint, iPoint);
+ }
+
+ /*--- New elements ---*/
+
+ geo_adapt->elem = new CPrimalGrid*[nElem_new];
+
+ unsigned long iElemNew = 0;
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ if (geometry->elem[iElem]->GetVTK_Type() == TRIANGLE) {
+ if (TriangleAdaptCode[iElem] == -1) {
+ geo_adapt->elem[iElemNew] = new CTriangle(geometry->elem[iElem]->GetNode(0),
+ geometry->elem[iElem]->GetNode(1),
+ geometry->elem[iElem]->GetNode(2), 2);
+ iElemNew++;
+ }
+ }
+ if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) {
+ if (RectAdaptCode[iElem] == -1) {
+ geo_adapt->elem[iElemNew] = new CQuadrilateral(geometry->elem[iElem]->GetNode(0),
+ geometry->elem[iElem]->GetNode(1),
+ geometry->elem[iElem]->GetNode(2),
+ geometry->elem[iElem]->GetNode(3), 2);
+ iElemNew++;
+ }
+ }
+ }
+
+ long nodes[27]; long **Division; long nPart;
+
+ Division = new long*[100];
+ for (long iVar = 0; iVar < 100; iVar++)
+ Division[iVar] = new long[100];
+
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ if (geometry->elem[iElem]->GetVTK_Type() == TRIANGLE) {
+
+ /*--- Triangle elements... ---*/
+
+ if (TriangleAdaptCode[iElem] > 0) {
+
+ /*--- First the corners ---*/
+
+ nodes[0] = geometry->elem[iElem]->GetNode(0);
+ nodes[1] = geometry->elem[iElem]->GetNode(1);
+ nodes[2] = geometry->elem[iElem]->GetNode(2);
+
+ /*--- Next the points that correspond to the broken edges. ---*/
+
+ nodes[3] = TriangleEdgeNode[iElem][0];
+ nodes[4] = TriangleEdgeNode[iElem][1];
+ nodes[5] = TriangleEdgeNode[iElem][2];
+
+ TriangleDivision(TriangleAdaptCode[iElem], nodes, NULL, Division, &nPart);
+ for (long iPart = 0; iPart < nPart; iPart++) {
+
+ /*--- Triangle case ---*/
+
+ if (Division[iPart][0] == 4) {
+ geo_adapt->elem[iElemNew] = new CTriangle(Division[iPart][1],
+ Division[iPart][2],
+ Division[iPart][3], 2);
+ iElemNew++;
+ }
+
+ /*--- Quadrilateral case ---*/
+
+ if (Division[iPart][0] == 5) {
+ geo_adapt->elem[iElemNew] = new CQuadrilateral(Division[iPart][1],
+ Division[iPart][2],
+ Division[iPart][3],
+ Division[iPart][4], 2);
+ iElemNew++;
+ }
+ }
+ }
+ }
+ if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) {
+
+ /*--- Rect elements... ---*/
+
+ if (RectAdaptCode[iElem] > 0) {
+
+ /*--- First the corners ---*/
+
+ nodes[0] = geometry->elem[iElem]->GetNode(0); nodes[1] = geometry->elem[iElem]->GetNode(1);
+ nodes[2] = geometry->elem[iElem]->GetNode(2); nodes[3] = geometry->elem[iElem]->GetNode(3);
+
+ /*--- Next the points that correspond to the broken edges. ---*/
+
+ nodes[4] = RectEdgeNode[iElem][0]; nodes[5] = RectEdgeNode[iElem][1];
+ nodes[6] = RectEdgeNode[iElem][2]; nodes[7] = RectEdgeNode[iElem][3];
+
+ /*--- Next the points that correspond to the element. ---*/
+
+ nodes[8] = RectElemNode[iElem][0];
+
+ RectDivision(RectAdaptCode[iElem], nodes, Division, &nPart);
+ for (long iPart = 0; iPart < nPart; iPart++) {
+ geo_adapt->elem[iElemNew] = new CQuadrilateral(Division[iPart][1],
+ Division[iPart][2],
+ Division[iPart][3],
+ Division[iPart][4], 2);
+ iElemNew++;
+ }
+ }
+
+ /*--- RectExt elements... ---*/
+
+ if (RectAdaptCode[iElem] == 0) {
+ long iRectExt = RectRectExtIndex[iElem][0];
+
+ /*--- First the corners ---*/
+
+ nodes[0] = RectExtNode[iRectExt][0];
+ nodes[1] = RectExtNode[iRectExt][1];
+ nodes[2] = RectExtNode[iRectExt][2];
+ nodes[3] = RectExtNode[iRectExt][3];
+
+ /*--- Next the points that correspond to the broken edges. ---*/
+
+ nodes[4] = RectExtEdgeNode[iRectExt][0];
+ nodes[5] = RectExtEdgeNode[iRectExt][1];
+ nodes[6] = RectExtEdgeNode[iRectExt][2];
+ nodes[7] = RectExtEdgeNode[iRectExt][3];
+
+ RectExtDivision(RectExtAdaptCode[iRectExt], nodes, Division, &nPart);
+ for (long iPart = 0; iPart < nPart; iPart++) {
+
+ /*--- Triangle case ---*/
+
+ if (Division[iPart][0] == 4) {
+ geo_adapt->elem[iElemNew] = new CTriangle(Division[iPart][1],
+ Division[iPart][2],
+ Division[iPart][3], 2);
+ iElemNew++;
+ }
+
+ /*--- Quadrilateral case ---*/
+
+ if (Division[iPart][0] == 5) {
+ geo_adapt->elem[iElemNew] = new CQuadrilateral(Division[iPart][1],
+ Division[iPart][2],
+ Division[iPart][3],
+ Division[iPart][4], 2);
+ iElemNew++;
+ }
+ }
+ }
+ }
+ }
+
+ geo_adapt->SetnElem(nElem_new);
+ geo_adapt->SetnPoint(nPoint_new);
+ geo_adapt->SetnPointDomain(nPoint_new);
+ geo_adapt->SetnDim(nDim);
+
+ /*--- Create boundary structure ---*/
+
+ geo_adapt->SetnMarker(geometry->GetnMarker());
+ geo_adapt->nElem_Bound = new unsigned long [geometry->GetnMarker()];
+ geo_adapt->Tag_to_Marker = new string [nMarker_Max];
+ geo_adapt->bound = new CPrimalGrid**[geometry->GetnMarker()];
+ for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) {
+ long nNewBCcv = 0;
+ for (iVertex = 0; iVertex < geometry->GetnElem_Bound(iMarker); iVertex++) {
+ ip_0 = geometry->bound[iMarker][iVertex]->GetNode(0);
+ ip_1 = geometry->bound[iMarker][iVertex]->GetNode(1);
+ if (DivEdge[geometry->FindEdge(ip_0, ip_1)]) nNewBCcv = nNewBCcv + 2;
+ else nNewBCcv = nNewBCcv + 1;
+ }
+ geo_adapt->bound[iMarker] = new CPrimalGrid* [nNewBCcv];
+ geo_adapt->SetnElem_Bound(iMarker, nNewBCcv);
+ geo_adapt->SetMarker_Tag(iMarker, geometry->GetMarker_Tag(iMarker));
+ }
+
+ for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) {
+ long nNewBCcv = 0;
+ for (iVertex = 0; iVertex < geometry->GetnElem_Bound(iMarker); iVertex++) {
+
+ ip_0 = geometry->bound[iMarker][iVertex]->GetNode(0); geo_adapt->nodes->SetBoundary(ip_0, geometry->GetnMarker());
+ ip_1 = geometry->bound[iMarker][iVertex]->GetNode(1); geo_adapt->nodes->SetBoundary(ip_1, geometry->GetnMarker());
+ long ip_01 = NodeAtEdges[geometry->FindEdge(ip_0, ip_1)];
+
+ if (ip_01 != -1) {
+
+
+// if ((config->GetMarker_All_KindBC(iMarker) == HEAT_FLUX) ||
+// (config->GetMarker_All_KindBC(iMarker) == ISOTHERMAL) ||
+// (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) {
+//
+// /*--- Recompute the coordinates using the NACA 4Digits analytical definition ---*/
+//
+// su2double Ya = 0.0 / 100.0; /*--- Maximum camber as a fraction of the chord
+// (100 m is the first of the four digits) ---*/
+// su2double Xa = 0.0 / 10.0; /*--- Location of maximum camber as a fraction of
+// the chord (10 p is the second digit in the NACA xxxx description) ---*/
+// su2double t = 12.0 / 100.0; /*--- Maximum thickness as a fraction of the
+// chord (so 100 t gives the last two digits in
+// the NACA 4-digit denomination) ---*/
+//
+// su2double *Coord = geo_adapt->nodes->GetCoord(ip_01);
+// su2double *Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
+//
+// su2double Ycurv = 0.0;
+// if (Coord[0] < Xa) Ycurv = (2.0*Xa*Coord[0]-pow(Coord[0],2.0))*(Ya/pow(Xa,2.0));
+// else Ycurv = ((1.0-2.0*Xa)+2.0*Xa*Coord[0]-pow(Coord[0],2.0))*(Ya/pow((1.0-Xa), 2.0));
+//
+// su2double Yesp = 0.0;
+// Yesp = t*(1.4845*sqrt(Coord[0])-0.6300*Coord[0]-1.7580*pow(Coord[0],2.0)+
+// 1.4215*pow(Coord[0],3.0)-0.518*pow(Coord[0],4.0));
+//
+// if (Normal[1] > 0) Coord[1] = (Ycurv + Yesp);
+// if (Normal[1] < 0) Coord[1] = (Ycurv - Yesp);
+//
+// }
+
+ geo_adapt->nodes->SetBoundary(ip_01, geometry->GetnMarker());
+ geo_adapt->bound[iMarker][nNewBCcv] = new CLine(ip_0, ip_01, 2);
+ nNewBCcv++;
+ geo_adapt->bound[iMarker][nNewBCcv] = new CLine(ip_01, ip_1, 2);
+ nNewBCcv++;
+ }
+ else {
+ geo_adapt->bound[iMarker][nNewBCcv] = new CLine(ip_0, ip_1, 2);
+ nNewBCcv++;
+ }
+ }
+ }
+
+ delete [] DivEdge;
+ delete [] DivElem;
+ delete [] NodeAtEdges;
+ delete [] NodeAtElem;
+
+}
+
+void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalGeometry *geo_adapt,
+ CConfig *config) {
+
+ unsigned long iPoint, iElem, iEdge, ip_0, ip_1, ip_2, ip_3, ip_4, ip_5, ip_6, ip_7, iVertex;
+ unsigned short iDim, iMarker, iVar;
+ long no_0 = 0, no_1 = 0, no_2 = 0, no_3 = 0, no_4 = 0, no_5 = 0, no_6 = 0, no_7 = 0;
+ unsigned short counter;
+ unsigned short nMarker_Max = config->GetnMarker_Max();
+
+ long *TetraAdaptCode;
+ long **TetraEdgeIndex; bool **TetraEdgeCode; long **TetraEdgeNode;
+
+ long *HexaAdaptCode;
+ long **HexaEdgeIndex; bool **HexaEdgeCode; long **HexaEdgeNode;
+ long **HexaFaceIndex; bool **HexaFaceCode; long **HexaFaceNode;
+ long **HexaElemIndex; bool **HexaElemCode; long **HexaElemNode;
+
+ bool Restart_Flow = false;
+ bool Restart_Adjoint = false;
+
+ if ((config->GetKind_Adaptation() == FULL_FLOW) ||
+ (config->GetKind_Adaptation() == GRAD_FLOW) ||
+ (config->GetKind_Adaptation() == FULL_ADJOINT) ||
+ (config->GetKind_Adaptation() == GRAD_ADJOINT) ||
+ (config->GetKind_Adaptation() == GRAD_FLOW_ADJ) ||
+ (config->GetKind_Adaptation() == REMAINING) ||
+ (config->GetKind_Adaptation() == COMPUTABLE)) Restart_Flow = true;
+
+ if ((config->GetKind_Adaptation() == FULL_ADJOINT) ||
+ (config->GetKind_Adaptation() == GRAD_ADJOINT) ||
+ (config->GetKind_Adaptation() == GRAD_FLOW_ADJ) ||
+ (config->GetKind_Adaptation() == REMAINING) ||
+ (config->GetKind_Adaptation() == COMPUTABLE)) Restart_Adjoint = true;
+
+ TetraAdaptCode = new long[geometry->GetnElem()];
+ TetraEdgeIndex = new long*[geometry->GetnElem()];
+ TetraEdgeCode = new bool*[geometry->GetnElem()];
+ TetraEdgeNode = new long*[geometry->GetnElem()];
+
+ HexaAdaptCode = new long[geometry->GetnElem()];
+ HexaEdgeIndex = new long*[geometry->GetnElem()];
+ HexaEdgeCode = new bool*[geometry->GetnElem()];
+ HexaEdgeNode = new long*[geometry->GetnElem()];
+ HexaFaceIndex = new long*[geometry->GetnElem()];
+ HexaFaceCode = new bool*[geometry->GetnElem()];
+ HexaFaceNode = new long*[geometry->GetnElem()];
+ HexaElemIndex = new long*[geometry->GetnElem()];
+ HexaElemCode = new bool*[geometry->GetnElem()];
+ HexaElemNode = new long*[geometry->GetnElem()];
+
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
+ TetraEdgeIndex[iElem] = new long [6];
+ TetraEdgeCode[iElem] = new bool [6];
+ TetraEdgeNode[iElem] = new long [6];
+
+ HexaEdgeIndex[iElem] = new long [12];
+ HexaEdgeCode[iElem] = new bool [12];
+ HexaEdgeNode[iElem] = new long [12];
+ HexaFaceIndex[iElem] = new long [6];
+ HexaFaceCode[iElem] = new bool [6];
+ HexaFaceNode[iElem] = new long [6];
+ HexaElemIndex[iElem] = new long [1];
+ HexaElemCode[iElem] = new bool [1];
+ HexaElemNode[iElem] = new long [1];
+ }
+
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
+
+ if (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON) {
+ ip_0 = geometry->elem[iElem]->GetNode(0);
+ ip_1 = geometry->elem[iElem]->GetNode(1);
+ ip_2 = geometry->elem[iElem]->GetNode(2);
+ ip_3 = geometry->elem[iElem]->GetNode(3);
+
+ TetraEdgeIndex[iElem][0] = geometry->FindEdge(ip_0, ip_1); TetraEdgeCode[iElem][0] = false; TetraEdgeNode[iElem][0] = -1;
+ TetraEdgeIndex[iElem][1] = geometry->FindEdge(ip_0, ip_2); TetraEdgeCode[iElem][1] = false; TetraEdgeNode[iElem][1] = -1;
+ TetraEdgeIndex[iElem][2] = geometry->FindEdge(ip_0, ip_3); TetraEdgeCode[iElem][2] = false; TetraEdgeNode[iElem][2] = -1;
+ TetraEdgeIndex[iElem][3] = geometry->FindEdge(ip_1, ip_2); TetraEdgeCode[iElem][3] = false; TetraEdgeNode[iElem][3] = -1;
+ TetraEdgeIndex[iElem][4] = geometry->FindEdge(ip_1, ip_3); TetraEdgeCode[iElem][4] = false; TetraEdgeNode[iElem][4] = -1;
+ TetraEdgeIndex[iElem][5] = geometry->FindEdge(ip_2, ip_3); TetraEdgeCode[iElem][5] = false; TetraEdgeNode[iElem][5] = -1;
+
+ }
+ if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) {
+ ip_0 = geometry->elem[iElem]->GetNode(0);
+ ip_1 = geometry->elem[iElem]->GetNode(1);
+ ip_2 = geometry->elem[iElem]->GetNode(2);
+ ip_3 = geometry->elem[iElem]->GetNode(3);
+ ip_4 = geometry->elem[iElem]->GetNode(4);
+ ip_5 = geometry->elem[iElem]->GetNode(5);
+ ip_6 = geometry->elem[iElem]->GetNode(6);
+ ip_7 = geometry->elem[iElem]->GetNode(7);
+
+ HexaEdgeIndex[iElem][0] = geometry->FindEdge(ip_0, ip_1); HexaEdgeCode[iElem][0] = false; HexaEdgeNode[iElem][0] = -1;
+ HexaEdgeIndex[iElem][1] = geometry->FindEdge(ip_1, ip_2); HexaEdgeCode[iElem][1] = false; HexaEdgeNode[iElem][1] = -1;
+ HexaEdgeIndex[iElem][2] = geometry->FindEdge(ip_2, ip_3); HexaEdgeCode[iElem][2] = false; HexaEdgeNode[iElem][2] = -1;
+ HexaEdgeIndex[iElem][3] = geometry->FindEdge(ip_3, ip_0); HexaEdgeCode[iElem][3] = false; HexaEdgeNode[iElem][3] = -1;
+ HexaEdgeIndex[iElem][4] = geometry->FindEdge(ip_4, ip_5); HexaEdgeCode[iElem][4] = false; HexaEdgeNode[iElem][4] = -1;
+ HexaEdgeIndex[iElem][5] = geometry->FindEdge(ip_5, ip_6); HexaEdgeCode[iElem][5] = false; HexaEdgeNode[iElem][5] = -1;
+ HexaEdgeIndex[iElem][6] = geometry->FindEdge(ip_6, ip_7); HexaEdgeCode[iElem][6] = false; HexaEdgeNode[iElem][6] = -1;
+ HexaEdgeIndex[iElem][7] = geometry->FindEdge(ip_7, ip_4); HexaEdgeCode[iElem][7] = false; HexaEdgeNode[iElem][7] = -1;
+ HexaEdgeIndex[iElem][8] = geometry->FindEdge(ip_0, ip_4); HexaEdgeCode[iElem][8] = false; HexaEdgeNode[iElem][8] = -1;
+ HexaEdgeIndex[iElem][9] = geometry->FindEdge(ip_1, ip_5); HexaEdgeCode[iElem][9] = false; HexaEdgeNode[iElem][9] = -1;
+ HexaEdgeIndex[iElem][10] = geometry->FindEdge(ip_2, ip_6); HexaEdgeCode[iElem][10] = false; HexaEdgeNode[iElem][10] = -1;
+ HexaEdgeIndex[iElem][11] = geometry->FindEdge(ip_3, ip_7); HexaEdgeCode[iElem][11] = false; HexaEdgeNode[iElem][11] = -1;
+
+// HexaFaceIndex[iElem][0] = geometry->FindFace(iElem, ip_0, ip_1, ip_2, ip_3); HexaFaceCode[iElem][0] = false; HexaFaceNode[iElem][0] = -1;
+// HexaFaceIndex[iElem][1] = geometry->FindFace(iElem, ip_4, ip_5, ip_6, ip_7); HexaFaceCode[iElem][1] = false; HexaFaceNode[iElem][1] = -1;
+// HexaFaceIndex[iElem][2] = geometry->FindFace(iElem, ip_1, ip_2, ip_6, ip_5); HexaFaceCode[iElem][2] = false; HexaFaceNode[iElem][2] = -1;
+// HexaFaceIndex[iElem][3] = geometry->FindFace(iElem, ip_3, ip_2, ip_6, ip_7); HexaFaceCode[iElem][3] = false; HexaFaceNode[iElem][3] = -1;
+// HexaFaceIndex[iElem][4] = geometry->FindFace(iElem, ip_0, ip_3, ip_7, ip_4); HexaFaceCode[iElem][4] = false; HexaFaceNode[iElem][4] = -1;
+// HexaFaceIndex[iElem][5] = geometry->FindFace(iElem, ip_0, ip_1, ip_5, ip_4); HexaFaceCode[iElem][5] = false; HexaFaceNode[iElem][5] = -1;
+
+ HexaElemIndex[iElem][0] = iElem; HexaElemCode[iElem][0] = false; HexaElemNode[iElem][0] = -1;
+
+ }
+
+ }
+
+ /*--- Remove pyramids and prisms in the adaptation process ---*/
+ unsigned short iFace, iNode, ElemIndex;
+ long jElem;
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ if ((geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) ||
+ (geometry->elem[iElem]->GetVTK_Type() == PYRAMID) ||
+ (geometry->elem[iElem]->GetVTK_Type() == PRISM)) {
+ geometry->elem[iElem]->SetDivide(false);
+ for (iFace = 0; iFace < geometry->elem[iElem]->GetnFaces(); iFace++)
+ for (iNode = 0; iNode < geometry->elem[iElem]->GetnNodesFace(iFace); iNode++) {
+ iPoint = geometry->elem[iElem]->GetNode(geometry->elem[iElem]->GetFaces(iFace, iNode));
+ for (ElemIndex = 0; ElemIndex < geometry->nodes->GetnElem(iPoint); ElemIndex++) {
+ jElem = geometry->nodes->GetElem(iPoint, ElemIndex);
+ if (jElem != -1) geometry->elem[jElem]->SetDivide(false);
+ }
+ }
+ }
+ }
+
+ /*--- Do not addapt the boundaries ---*/
+ if (!config->GetAdaptBoundary()) {
+ for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) {
+ for (iVertex = 0; iVertex < geometry->GetnElem_Bound(iMarker); iVertex++) {
+ for (iNode = 0; iNode < geometry->bound[iMarker][iVertex]->GetnNodes(); iNode++) {
+ iPoint = geometry->bound[iMarker][iVertex]->GetNode(iNode);
+ for (ElemIndex = 0; ElemIndex < geometry->nodes->GetnElem(iPoint); ElemIndex++) {
+ jElem = geometry->nodes->GetElem(iPoint, ElemIndex);
+ if (jElem != -1) geometry->elem[jElem]->SetDivide(false);
+ }
+ }
+ }
+ }
+ }
+
+ /*--- Initial edges that are going to be divided ---*/
+ bool *DivEdge = new bool[geometry->GetnEdge()];
+ bool *DivElem = new bool[geometry->GetnElem()];
+ for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) DivEdge[iEdge] = false;
+
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem++)
+ DivElem[iElem] = geometry->elem[iElem]->GetDivide();
+
+ /*--- Set the edge division in the reactangles and in the edge list ---*/
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
+ if (DivElem[iElem] == true) {
+ if (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON) {
+ for (long iIndex = 0; iIndex < 6; iIndex++) {
+ DivEdge[TetraEdgeIndex[iElem][iIndex]] = true;
+ TetraEdgeCode[iElem][iIndex] = true;
+ }
+ }
+ if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) {
+ for (long iIndex = 0; iIndex < 12; iIndex++) {
+ DivEdge[HexaEdgeIndex[iElem][iIndex]] = true;
+ HexaEdgeCode[iElem][iIndex] = true;
+ }
+ }
+ }
+ }
+
+ /*--- Only with tets, check if an element have more than 4 divided edges, the element should be completelly divided ---*/
+ bool new_elem;
+ do { new_elem = false;
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ if (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON) {
+
+ ip_0 = geometry->elem[iElem]->GetNode(0);
+ ip_1 = geometry->elem[iElem]->GetNode(1);
+ ip_2 = geometry->elem[iElem]->GetNode(2);
+ ip_3 = geometry->elem[iElem]->GetNode(3);
+
+ counter = 0;
+ if (DivEdge[TetraEdgeIndex[iElem][0]]) counter++;
+ if (DivEdge[TetraEdgeIndex[iElem][1]]) counter++;
+ if (DivEdge[TetraEdgeIndex[iElem][2]]) counter++;
+ if (DivEdge[TetraEdgeIndex[iElem][3]]) counter++;
+ if (DivEdge[TetraEdgeIndex[iElem][4]]) counter++;
+ if (DivEdge[TetraEdgeIndex[iElem][5]]) counter++;
+
+ if ((counter > 3) && (!DivElem[iElem])) {
+ DivEdge[geometry->FindEdge(ip_0, ip_1)] = true;
+ DivEdge[geometry->FindEdge(ip_0, ip_2)] = true;
+ DivEdge[geometry->FindEdge(ip_0, ip_3)] = true;
+ DivEdge[geometry->FindEdge(ip_1, ip_2)] = true;
+ DivEdge[geometry->FindEdge(ip_1, ip_3)] = true;
+ DivEdge[geometry->FindEdge(ip_2, ip_3)] = true;
+ DivElem[iElem] = true;
+ new_elem = true;
+ }
+ }
+ }
+ } while (new_elem);
+
+ /*--- We must verify that all the elements have the right edges marked,
+ with tets 4 and 5 edges are not allowed ---*/
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
+ if (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON) {
+ for (long iIndex = 0; iIndex < 6; iIndex++) {
+ if (DivEdge[TetraEdgeIndex[iElem][iIndex]] == true) {
+ TetraEdgeCode[iElem][iIndex] = true;
+ }
+ }
+ }
+ if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) {
+ for (long iIndex = 0; iIndex < 12; iIndex++) {
+ if (DivEdge[HexaEdgeIndex[iElem][iIndex]] == true) {
+ HexaEdgeCode[iElem][iIndex] = true;
+ }
+ }
+ }
+ }
+
+ // Only those elements that verify certain rules will be marked for hexa adaptation...
+ // the others will need a new point in the middle and Pyrams
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
+
+ if (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON) {
+ TetraAdaptCode[iElem] = CheckTetraCode(TetraEdgeCode[iElem]);
+// if (TetraAdaptCode[iElem] != -1) cout << TetraAdaptCode[iElem] <<" "<< iElem << endl;
+ }
+
+ if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) {
+
+ HexaAdaptCode[iElem] = CheckHexaCode(HexaEdgeCode[iElem]);
+// if (HexaAdaptCode[iElem] != -1) cout << HexaAdaptCode[iElem] <<" "<< iElem << endl;
+
+ // Set the HexaFaceCode, and HexaElemCode
+ if (HexaAdaptCode[iElem] == 1) {
+ HexaFaceCode[iElem][0] = true; HexaFaceCode[iElem][1] = true; HexaFaceCode[iElem][2] = true;
+ HexaFaceCode[iElem][3] = true; HexaFaceCode[iElem][4] = true; HexaFaceCode[iElem][5] = true;
+ HexaElemCode[iElem][0] = true;
+ }
+ if (HexaAdaptCode[iElem] == 2) {
+ HexaFaceCode[iElem][3] = true; HexaFaceCode[iElem][5] = true;
+ }
+ if (HexaAdaptCode[iElem] == 3) {
+ HexaFaceCode[iElem][2] = true; HexaFaceCode[iElem][4] = true;
+ }
+ if (HexaAdaptCode[iElem] == 4) {
+ HexaFaceCode[iElem][0] = true; HexaFaceCode[iElem][1] = true;
+ }
+ }
+ }
+
+ // Create the new nodes on the edges, on the faces, and in the element.
+ long *NodeAtEdges = new long[geometry->GetnEdge()];
+// long *NodeAtElem = new long[geometry->GetnFace()];
+ long *NodeAtElem = new long[geometry->GetnElem()];
+
+ for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) NodeAtEdges[iEdge] = -1;
+// for (iFace = 0; iFace < geometry->GetnFace(); iFace++) NodeAtFaces[iEdge] = -1;
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem++) NodeAtElem[iElem] = -1;
+
+ nPoint_new = geometry->GetnPoint();
+
+ su2double **NewNodeCoord;
+ NewNodeCoord = new su2double *[10*geometry->GetnPoint()];
+ for (iPoint = 0; iPoint < 10*geometry->GetnPoint(); iPoint++)
+ NewNodeCoord[iPoint] = new su2double[geometry->GetnDim()];
+
+ if (Restart_Flow) {
+ ConsVar_Adapt = new su2double *[10*geometry->GetnPoint()];
+ for (iPoint = 0; iPoint < 10*geometry->GetnPoint(); iPoint++)
+ ConsVar_Adapt[iPoint] = new su2double[nVar];
+ }
+
+ if (Restart_Adjoint) {
+ AdjVar_Adapt = new su2double *[10*geometry->GetnPoint()];
+ for (iPoint = 0; iPoint < 10*geometry->GetnPoint(); iPoint++)
+ AdjVar_Adapt[iPoint] = new su2double[nVar];
+ }
+
+ // Set the value of the variables
+ for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++) {
+ for (iVar = 0; iVar < nVar; iVar ++) {
+ if (Restart_Flow) ConsVar_Adapt[iPoint][iVar] = ConsVar_Sol[iPoint][iVar];
+ if (Restart_Adjoint) AdjVar_Adapt[iPoint][iVar] = AdjVar_Sol[iPoint][iVar];
+ }
+ }
+
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+
+ if (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON) {
+
+ ip_0 = geometry->elem[iElem]->GetNode(0);
+ ip_1 = geometry->elem[iElem]->GetNode(1);
+ ip_2 = geometry->elem[iElem]->GetNode(2);
+ ip_3 = geometry->elem[iElem]->GetNode(3);
+
+ for (long iIndex = 0; iIndex < 6; iIndex++) {
+
+ if (TetraEdgeCode[iElem][iIndex] == true) {
+ if (NodeAtEdges[TetraEdgeIndex[iElem][iIndex]] != -1)
+ TetraEdgeNode[iElem][iIndex] = NodeAtEdges[TetraEdgeIndex[iElem][iIndex]];
+
+ if (NodeAtEdges[TetraEdgeIndex[iElem][iIndex]] == -1) {
+
+ NodeAtEdges[TetraEdgeIndex[iElem][iIndex]] = nPoint_new;
+ TetraEdgeNode[iElem][iIndex] = nPoint_new;
+
+ // Compute the coordinates of the new node
+ if (iIndex == 0) {no_0 = ip_0; no_1 = ip_1;}
+ if (iIndex == 1) {no_0 = ip_0; no_1 = ip_2;}
+ if (iIndex == 2) {no_0 = ip_0; no_1 = ip_3;}
+ if (iIndex == 3) {no_0 = ip_1; no_1 = ip_2;}
+ if (iIndex == 4) {no_0 = ip_1; no_1 = ip_3;}
+ if (iIndex == 5) {no_0 = ip_2; no_1 = ip_3;}
+
+ for (iDim = 0; iDim < geometry->GetnDim(); iDim++)
+ NewNodeCoord[nPoint_new][iDim] = 0.5*(geometry->nodes->GetCoord(no_0,iDim)+geometry->nodes->GetCoord(no_1,iDim));
+
+ for (iVar = 0; iVar < nVar; iVar ++) {
+ if (Restart_Flow) ConsVar_Adapt[nPoint_new][iVar] = 0.5 * (ConsVar_Adapt[no_0][iVar]+ConsVar_Adapt[no_1][iVar]);
+ if (Restart_Adjoint) AdjVar_Adapt[nPoint_new][iVar] = 0.5 * (AdjVar_Adapt[no_0][iVar]+AdjVar_Adapt[no_1][iVar]);
+ }
+
+ nPoint_new++;
+ }
+ }
+ }
+ }
+
+ if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) {
+
+ ip_0 = geometry->elem[iElem]->GetNode(0);
+ ip_1 = geometry->elem[iElem]->GetNode(1);
+ ip_2 = geometry->elem[iElem]->GetNode(2);
+ ip_3 = geometry->elem[iElem]->GetNode(3);
+ ip_4 = geometry->elem[iElem]->GetNode(4);
+ ip_5 = geometry->elem[iElem]->GetNode(5);
+ ip_6 = geometry->elem[iElem]->GetNode(6);
+ ip_7 = geometry->elem[iElem]->GetNode(7);
+
+ for (long iIndex = 0; iIndex < 12; iIndex++) {
+
+ if (HexaEdgeCode[iElem][iIndex] == true) {
+ if (NodeAtEdges[HexaEdgeIndex[iElem][iIndex]] != -1)
+ HexaEdgeNode[iElem][iIndex] = NodeAtEdges[HexaEdgeIndex[iElem][iIndex]];
+
+ if (NodeAtEdges[HexaEdgeIndex[iElem][iIndex]] == -1) {
+
+ NodeAtEdges[HexaEdgeIndex[iElem][iIndex]] = nPoint_new;
+ HexaEdgeNode[iElem][iIndex] = nPoint_new;
+
+ // Compute the coordinates of the new node
+ if (iIndex == 0) {no_0 = ip_0; no_1 = ip_1;}
+ if (iIndex == 1) {no_0 = ip_1; no_1 = ip_2;}
+ if (iIndex == 2) {no_0 = ip_2; no_1 = ip_3;}
+ if (iIndex == 3) {no_0 = ip_3; no_1 = ip_0;}
+ if (iIndex == 4) {no_0 = ip_4; no_1 = ip_5;}
+ if (iIndex == 5) {no_0 = ip_5; no_1 = ip_6;}
+ if (iIndex == 6) {no_0 = ip_6; no_1 = ip_7;}
+ if (iIndex == 7) {no_0 = ip_7; no_1 = ip_4;}
+ if (iIndex == 8) {no_0 = ip_0; no_1 = ip_4;}
+ if (iIndex == 9) {no_0 = ip_1; no_1 = ip_5;}
+ if (iIndex == 10) {no_0 = ip_2; no_1 = ip_6;}
+ if (iIndex == 11) {no_0 = ip_3; no_1 = ip_7;}
+
+ for (iDim = 0; iDim < geometry->GetnDim(); iDim++)
+ NewNodeCoord[nPoint_new][iDim] = 0.5*(geometry->nodes->GetCoord(no_0,iDim)+geometry->nodes->GetCoord(no_1,iDim));
+
+ for (iVar = 0; iVar < nVar; iVar ++) {
+ if (Restart_Flow) ConsVar_Adapt[nPoint_new][iVar] = 0.5 * (ConsVar_Adapt[no_0][iVar]+ConsVar_Adapt[no_1][iVar]);
+ if (Restart_Adjoint) AdjVar_Adapt[nPoint_new][iVar] = 0.5 * (AdjVar_Adapt[no_0][iVar]+AdjVar_Adapt[no_1][iVar]);
+ }
+
+ nPoint_new++;
+ }
+ }
+ }
+
+/* for (long iIndex = 0; iIndex < 6; iIndex++) {
+ if (HexaFaceCode[iElem][iIndex] == true) {
+
+ if (NodeAtFaces[HexaFaceIndex[iElem][iIndex]] != -1)
+ HexaFaceNode[iElem][iIndex] = NodeAtFaces[HexaFaceIndex[iElem][iIndex]];
+
+ if (NodeAtFaces[HexaFaceIndex[iElem][iIndex]] == -1) {
+ NodeAtFaces[HexaFaceIndex[iElem][iIndex]] = nPoint_new;
+ HexaFaceNode[iElem][iIndex] = nPoint_new;
+ // Compute the coordinates of the new node
+ if (iIndex == 0) {no_0 = ip_0; no_1 = ip_1; no_2 = ip_2; no_3 = ip_3;}
+ if (iIndex == 1) {no_0 = ip_4; no_1 = ip_5; no_2 = ip_6; no_3 = ip_7;}
+ if (iIndex == 2) {no_0 = ip_1; no_1 = ip_2; no_2 = ip_6; no_3 = ip_5;}
+ if (iIndex == 3) {no_0 = ip_3; no_1 = ip_2; no_2 = ip_6; no_3 = ip_7;}
+ if (iIndex == 4) {no_0 = ip_0; no_1 = ip_3; no_2 = ip_7; no_3 = ip_4;}
+ if (iIndex == 5) {no_0 = ip_0; no_1 = ip_1; no_2 = ip_5; no_3 = ip_4;}
+
+ for (iDim = 0; iDim < geometry->GetnDim(); iDim++)
+ NewNodeCoord[nPoint_new][iDim] = 0.25*(x_no[no_0][iDim]+x_no[no_1][iDim]+x_no[no_2][iDim]+x_no[no_3][iDim]);
+
+ for (iVar = 0; iVar < nVar; iVar ++) {
+ if (Restart_Flow) ConsVar_Adapt[nPoint_new][iVar] = 0.25 * (ConsVar_Adapt[no_0][iVar]+ConsVar_Adapt[no_1][iVar]+ConsVar_Adapt[no_2][iVar]+ConsVar_Adapt[no_3][iVar]);
+ if (Restart_Adjoint) AdjVar_Adapt[nPoint_new][iVar] = 0.25 * (AdjVar_Adapt[no_0][iVar]+AdjVar_Adapt[no_1][iVar]+AdjVar_Adapt[no_2][iVar]+AdjVar_Adapt[no_3][iVar]);
+ if (Restart_Linear) LinVar_Adapt[nPoint_new][iVar] = 0.25 * (LinVar_Adapt[no_0][iVar]+LinVar_Adapt[no_1][iVar]+LinVar_Adapt[no_2][iVar]+LinVar_Adapt[no_3][iVar]);
+ }
+
+ nPoint_new++;
+
+ }
+ }
+
+ } */
+
+ for (long iIndex = 0; iIndex < 1; iIndex++) {
+
+ if (HexaElemCode[iElem][iIndex] == true) {
+
+ if (NodeAtElem[HexaElemIndex[iElem][iIndex]] != -1)
+ HexaElemNode[iElem][iIndex] = NodeAtElem[HexaElemIndex[iElem][iIndex]];
+
+ if (NodeAtElem[HexaElemIndex[iElem][iIndex]] == -1) {
+ NodeAtElem[HexaElemIndex[iElem][iIndex]] = nPoint_new;
+ HexaElemNode[iElem][iIndex] = nPoint_new;
+
+ // Compute the coordinates of the new node
+ if (iIndex == 0) {no_0 = ip_0; no_1 = ip_1; no_2 = ip_2; no_3 = ip_3; no_4 = ip_4; no_5 = ip_5; no_6 = ip_6; no_7 = ip_7;}
+ for (iDim = 0; iDim < geometry->GetnDim(); iDim++)
+ NewNodeCoord[nPoint_new][iDim] = 0.125*(geometry->nodes->GetCoord(no_0, iDim) +
+ geometry->nodes->GetCoord(no_1, iDim) +
+ geometry->nodes->GetCoord(no_2, iDim) +
+ geometry->nodes->GetCoord(no_3, iDim) +
+ geometry->nodes->GetCoord(no_4, iDim) +
+ geometry->nodes->GetCoord(no_5, iDim) +
+ geometry->nodes->GetCoord(no_6, iDim) +
+ geometry->nodes->GetCoord(no_7, iDim));
+
+ for (iVar = 0; iVar < nVar; iVar ++) {
+ if (Restart_Flow) ConsVar_Adapt[nPoint_new][iVar] = 0.125 * (ConsVar_Adapt[no_0][iVar]+ConsVar_Adapt[no_1][iVar]+ConsVar_Adapt[no_2][iVar]+ConsVar_Adapt[no_3][iVar]+
+ ConsVar_Adapt[no_4][iVar]+ConsVar_Adapt[no_5][iVar]+ConsVar_Adapt[no_6][iVar]+ConsVar_Adapt[no_7][iVar]);
+ if (Restart_Adjoint) AdjVar_Adapt[nPoint_new][iVar] = 0.125 * (AdjVar_Adapt[no_0][iVar]+AdjVar_Adapt[no_1][iVar]+AdjVar_Adapt[no_2][iVar]+AdjVar_Adapt[no_3][iVar]+
+ AdjVar_Adapt[no_4][iVar]+AdjVar_Adapt[no_5][iVar]+AdjVar_Adapt[no_6][iVar]+AdjVar_Adapt[no_7][iVar]);
+ }
+
+ nPoint_new++;
+ }
+ }
+ }
+ }
+
+ }
+
+
+ // if Hexa adapt code equals 0, then a semidivision is applied
+ long nSemiDivided = 0;
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) {
+ if (HexaAdaptCode[iElem] == 0)
+ nSemiDivided++;
+ }
+ }
+
+ // If semidivision, then divide add a new point (hexa), divide the hexahedron into Tetras,
+ // and find the right combination, it also create the new node (hexa).
+ long nPyram = nSemiDivided*6;
+
+ long *PyramAdaptCode;
+ long **PyramNode;
+ long **HexaPyramIndex;
+ long *PyramHexaIndex;
+
+ long **PyramEdgeIndex;
+ bool **PyramEdgeCode;
+ long **PyramEdgeNode;
+
+ long **PyramFaceNode;
+
+ long **PyramElemNode;
+
+ PyramAdaptCode = new long [nPyram];
+ PyramNode = new long *[nPyram];
+ HexaPyramIndex = new long *[geometry->GetnElem()];
+ PyramHexaIndex = new long [nPyram];
+ PyramEdgeIndex = new long *[nPyram];
+ PyramEdgeCode = new bool *[nPyram];
+ PyramEdgeNode = new long *[nPyram];
+ PyramFaceNode = new long *[nPyram];
+ PyramElemNode = new long *[nPyram];
+
+ for (long iPyram = 0; iPyram < nPyram; iPyram++) {
+ PyramNode[iPyram] = new long [4];
+ PyramEdgeIndex[iPyram] = new long [4];
+ PyramEdgeCode[iPyram] = new bool [4];
+ PyramEdgeNode[iPyram] = new long [4];
+ PyramFaceNode[iPyram] = new long [1];
+ PyramElemNode[iPyram] = new long [1];
+ }
+
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) {
+ HexaPyramIndex[iElem] = new long [6];
+ }
+ }
+
+ nPyram = 0;
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) {
+ if (HexaAdaptCode[iElem] == 0) {
+
+ // Write the edge combination on the base.
+ ip_0 = geometry->elem[iElem]->GetNode(0);
+ ip_1 = geometry->elem[iElem]->GetNode(1);
+ ip_2 = geometry->elem[iElem]->GetNode(2);
+ ip_3 = geometry->elem[iElem]->GetNode(3);
+ ip_4 = geometry->elem[iElem]->GetNode(4);
+ ip_5 = geometry->elem[iElem]->GetNode(5);
+ ip_6 = geometry->elem[iElem]->GetNode(6);
+ ip_7 = geometry->elem[iElem]->GetNode(7);
+
+ // Create the 1st pyramid.
+ HexaPyramIndex[iElem][0] = nPyram; PyramHexaIndex[nPyram] = iElem; PyramElemNode[nPyram][0] = nPoint_new;
+
+ PyramNode[nPyram][0] = ip_0; PyramNode[nPyram][1] = ip_1;
+ PyramNode[nPyram][2] = ip_2; PyramNode[nPyram][3] = ip_3;
+
+ PyramEdgeIndex[nPyram][0] = HexaEdgeIndex[iElem][0]; PyramEdgeIndex[nPyram][1] = HexaEdgeIndex[iElem][1];
+ PyramEdgeIndex[nPyram][2] = HexaEdgeIndex[iElem][2]; PyramEdgeIndex[nPyram][3] = HexaEdgeIndex[iElem][3];
+
+ PyramEdgeNode[nPyram][0] = HexaEdgeNode[iElem][0]; PyramEdgeNode[nPyram][1] = HexaEdgeNode[iElem][1];
+ PyramEdgeNode[nPyram][2] = HexaEdgeNode[iElem][2]; PyramEdgeNode[nPyram][3] = HexaEdgeNode[iElem][3];
+
+
+ for (long iIndex = 0; iIndex < 4; iIndex++)
+ if (DivEdge[PyramEdgeIndex[nPyram][iIndex]] == true) PyramEdgeCode[nPyram][iIndex] = true;
+ nPyram++;
+
+ // Create the 2nd pyramid.
+ HexaPyramIndex[iElem][1] = nPyram; PyramHexaIndex[nPyram] = iElem; PyramElemNode[nPyram][0] = nPoint_new;
+
+ PyramNode[nPyram][0] = ip_4; PyramNode[nPyram][1] = ip_7;
+ PyramNode[nPyram][2] = ip_6; PyramNode[nPyram][3] = ip_5;
+
+ PyramEdgeIndex[nPyram][0] = HexaEdgeIndex[iElem][7]; PyramEdgeIndex[nPyram][1] = HexaEdgeIndex[iElem][6];
+ PyramEdgeIndex[nPyram][2] = HexaEdgeIndex[iElem][5]; PyramEdgeIndex[nPyram][3] = HexaEdgeIndex[iElem][4];
+
+ PyramEdgeNode[nPyram][0] = HexaEdgeNode[iElem][7]; PyramEdgeNode[nPyram][1] = HexaEdgeNode[iElem][6];
+ PyramEdgeNode[nPyram][2] = HexaEdgeNode[iElem][5]; PyramEdgeNode[nPyram][3] = HexaEdgeNode[iElem][4];
+
+ for (long iIndex = 0; iIndex < 4; iIndex++)
+ if (DivEdge[PyramEdgeIndex[nPyram][iIndex]] == true) PyramEdgeCode[nPyram][iIndex] = true;
+ nPyram++;
+
+ // Create the 3th pyramid.
+ HexaPyramIndex[iElem][2] = nPyram; PyramHexaIndex[nPyram] = iElem; PyramElemNode[nPyram][0] = nPoint_new;
+
+ PyramNode[nPyram][0] = ip_0; PyramNode[nPyram][1] = ip_4;
+ PyramNode[nPyram][2] = ip_5; PyramNode[nPyram][3] = ip_1;
+
+ PyramEdgeIndex[nPyram][0] = HexaEdgeIndex[iElem][8]; PyramEdgeIndex[nPyram][1] = HexaEdgeIndex[iElem][4];
+ PyramEdgeIndex[nPyram][2] = HexaEdgeIndex[iElem][9]; PyramEdgeIndex[nPyram][3] = HexaEdgeIndex[iElem][0];
+
+ PyramEdgeNode[nPyram][0] = HexaEdgeNode[iElem][8]; PyramEdgeNode[nPyram][1] = HexaEdgeNode[iElem][4];
+ PyramEdgeNode[nPyram][2] = HexaEdgeNode[iElem][9]; PyramEdgeNode[nPyram][3] = HexaEdgeNode[iElem][0];
+
+ for (long iIndex = 0; iIndex < 4; iIndex++)
+ if (DivEdge[PyramEdgeIndex[nPyram][iIndex]] == true) PyramEdgeCode[nPyram][iIndex] = true;
+ nPyram++;
+
+ // Create the 4th pyramid.
+ HexaPyramIndex[iElem][3] = nPyram; PyramHexaIndex[nPyram] = iElem; PyramElemNode[nPyram][0] = nPoint_new;
+
+ PyramNode[nPyram][0] = ip_3; PyramNode[nPyram][1] = ip_2;
+ PyramNode[nPyram][2] = ip_6; PyramNode[nPyram][3] = ip_7;
+
+ PyramEdgeIndex[nPyram][0] = HexaEdgeIndex[iElem][2]; PyramEdgeIndex[nPyram][1] = HexaEdgeIndex[iElem][10];
+ PyramEdgeIndex[nPyram][2] = HexaEdgeIndex[iElem][6]; PyramEdgeIndex[nPyram][3] = HexaEdgeIndex[iElem][11];
+
+ PyramEdgeNode[nPyram][0] = HexaEdgeNode[iElem][2]; PyramEdgeNode[nPyram][1] = HexaEdgeNode[iElem][10];
+ PyramEdgeNode[nPyram][2] = HexaEdgeNode[iElem][6]; PyramEdgeNode[nPyram][3] = HexaEdgeNode[iElem][11];
+
+ for (long iIndex = 0; iIndex < 4; iIndex++)
+ if (DivEdge[PyramEdgeIndex[nPyram][iIndex]] == true) PyramEdgeCode[nPyram][iIndex] = true;
+ nPyram++;
+
+ // Create the 5th pyramid.
+ HexaPyramIndex[iElem][4] = nPyram; PyramHexaIndex[nPyram] = iElem; PyramElemNode[nPyram][0] = nPoint_new;
+
+ PyramNode[nPyram][0] = ip_1; PyramNode[nPyram][1] = ip_5;
+ PyramNode[nPyram][2] = ip_6; PyramNode[nPyram][3] = ip_2;
+
+ PyramEdgeIndex[nPyram][0] = HexaEdgeIndex[iElem][9]; PyramEdgeIndex[nPyram][1] = HexaEdgeIndex[iElem][5];
+ PyramEdgeIndex[nPyram][2] = HexaEdgeIndex[iElem][10]; PyramEdgeIndex[nPyram][3] = HexaEdgeIndex[iElem][1];
+
+ PyramEdgeNode[nPyram][0] = HexaEdgeNode[iElem][9]; PyramEdgeNode[nPyram][1] = HexaEdgeNode[iElem][5];
+ PyramEdgeNode[nPyram][2] = HexaEdgeNode[iElem][10]; PyramEdgeNode[nPyram][3] = HexaEdgeNode[iElem][1];
+
+ for (long iIndex = 0; iIndex < 4; iIndex++)
+ if (DivEdge[PyramEdgeIndex[nPyram][iIndex]] == true) PyramEdgeCode[nPyram][iIndex] = true;
+ nPyram++;
+
+ // Create the 6th pyramid.
+ HexaPyramIndex[iElem][5] = nPyram; PyramHexaIndex[nPyram] = iElem; PyramElemNode[nPyram][0] = nPoint_new;
+
+ PyramNode[nPyram][0] = ip_0; PyramNode[nPyram][1] = ip_3;
+ PyramNode[nPyram][2] = ip_7; PyramNode[nPyram][3] = ip_4;
+
+ PyramEdgeIndex[nPyram][0] = HexaEdgeIndex[iElem][3]; PyramEdgeIndex[nPyram][1] = HexaEdgeIndex[iElem][11];
+ PyramEdgeIndex[nPyram][2] = HexaEdgeIndex[iElem][7]; PyramEdgeIndex[nPyram][3] = HexaEdgeIndex[iElem][8];
+
+ PyramEdgeNode[nPyram][0] = HexaEdgeNode[iElem][3]; PyramEdgeNode[nPyram][1] = HexaEdgeNode[iElem][11];
+ PyramEdgeNode[nPyram][2] = HexaEdgeNode[iElem][7]; PyramEdgeNode[nPyram][3] = HexaEdgeNode[iElem][8];
+
+ for (long iIndex = 0; iIndex < 4; iIndex++)
+ if (DivEdge[PyramEdgeIndex[nPyram][iIndex]] == true) PyramEdgeCode[nPyram][iIndex] = true;
+ nPyram++;
+
+ nPoint_new++;
+
+
+ }
+ }
+ }
+
+ // Check the kind of Pyram partitioning that should be applied
+ for (long iPyram = 0; iPyram < nPyram; iPyram ++) {
+ PyramAdaptCode[iPyram] = CheckPyramCode(PyramEdgeCode[iPyram]);
+ if (PyramAdaptCode[iPyram] == 0) cout << "There is a problem with one Pyram" << endl;
+ }
+
+ // Create new structure
+ nElem_new = geometry->GetnElem();
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ if (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON) {
+ if (TetraAdaptCode[iElem] == 1) nElem_new = nElem_new + 7;
+ if (TetraAdaptCode[iElem] == 2) nElem_new = nElem_new + 3;
+ if (TetraAdaptCode[iElem] == 3) nElem_new = nElem_new + 3;
+ if (TetraAdaptCode[iElem] == 4) nElem_new = nElem_new + 3;
+ if (TetraAdaptCode[iElem] == 5) nElem_new = nElem_new + 3;
+ if (TetraAdaptCode[iElem] == 6) nElem_new = nElem_new + 7;
+ }
+ if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) {
+ if (HexaAdaptCode[iElem] == 1) nElem_new = nElem_new + 7;
+ if (HexaAdaptCode[iElem] == 2) nElem_new = nElem_new + 3;
+ if (HexaAdaptCode[iElem] == 3) nElem_new = nElem_new + 3;
+ if (HexaAdaptCode[iElem] == 4) nElem_new = nElem_new + 3;
+ if (HexaAdaptCode[iElem] == 5) nElem_new = nElem_new + 1;
+ if (HexaAdaptCode[iElem] == 6) nElem_new = nElem_new + 1;
+ if (HexaAdaptCode[iElem] == 7) nElem_new = nElem_new + 1;
+ if (HexaAdaptCode[iElem] == 0) {
+ long iPyram;
+ for (long iIndex = 0; iIndex < 6; iIndex++) {
+ iPyram = HexaPyramIndex[iElem][0];
+ if (PyramAdaptCode[iPyram] == 1) nElem_new = nElem_new + 0;
+ if (PyramAdaptCode[iPyram] == 2) nElem_new = nElem_new + 2;
+ if (PyramAdaptCode[iPyram] == 3) nElem_new = nElem_new + 2;
+ if (PyramAdaptCode[iPyram] == 4) nElem_new = nElem_new + 2;
+ if (PyramAdaptCode[iPyram] == 5) nElem_new = nElem_new + 2;
+ if (PyramAdaptCode[iPyram] == 6) nElem_new = nElem_new + 3;
+ if (PyramAdaptCode[iPyram] == 7) nElem_new = nElem_new + 3;
+ if (PyramAdaptCode[iPyram] == 8) nElem_new = nElem_new + 3;
+ if (PyramAdaptCode[iPyram] == 9) nElem_new = nElem_new + 3;
+ if (PyramAdaptCode[iPyram] == 10) nElem_new = nElem_new + 1;
+ if (PyramAdaptCode[iPyram] == 11) nElem_new = nElem_new + 1;
+ if (PyramAdaptCode[iPyram] == 12) nElem_new = nElem_new + 3;
+ if (PyramAdaptCode[iPyram] == 13) nElem_new = nElem_new + 3;
+ if (PyramAdaptCode[iPyram] == 14) nElem_new = nElem_new + 3;
+ if (PyramAdaptCode[iPyram] == 15) nElem_new = nElem_new + 3;
+ if (PyramAdaptCode[iPyram] == 16) nElem_new = nElem_new + 3;
+ }
+ }
+ }
+ }
+
+ // New points
+ geo_adapt->nodes = new CPoint(nPoint_new, nDim, MESH_0, config);
+
+ for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++) {
+ geo_adapt->nodes->SetCoord(iPoint, geometry->nodes->GetCoord(iPoint));
+ geo_adapt->nodes->SetGlobalIndex(iPoint, iPoint);
+ }
+
+ for (iPoint = geometry->GetnPoint(); iPoint < nPoint_new; iPoint++) {
+ geo_adapt->nodes->SetCoord(iPoint, NewNodeCoord[iPoint]);
+ geo_adapt->nodes->SetGlobalIndex(iPoint, iPoint);
+ }
+
+ // New elements
+ geo_adapt->elem = new CPrimalGrid*[nElem_new];
+
+ unsigned long iElemNew = 0;
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ if (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON) {
+ if (TetraAdaptCode[iElem] == -1) {
+ geo_adapt->elem[iElemNew] = new CTetrahedron(geometry->elem[iElem]->GetNode(0),
+ geometry->elem[iElem]->GetNode(1),
+ geometry->elem[iElem]->GetNode(2),
+ geometry->elem[iElem]->GetNode(3));
+ iElemNew++;
+ }
+ }
+ if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) {
+ if (HexaAdaptCode[iElem] == -1) {
+ geo_adapt->elem[iElemNew] = new CHexahedron(geometry->elem[iElem]->GetNode(0),
+ geometry->elem[iElem]->GetNode(1),
+ geometry->elem[iElem]->GetNode(2),
+ geometry->elem[iElem]->GetNode(3),
+ geometry->elem[iElem]->GetNode(4),
+ geometry->elem[iElem]->GetNode(5),
+ geometry->elem[iElem]->GetNode(6),
+ geometry->elem[iElem]->GetNode(7));
+ iElemNew++;
+ }
+ }
+ if (geometry->elem[iElem]->GetVTK_Type() == PYRAMID) {
+ geo_adapt->elem[iElemNew] = new CPyramid(geometry->elem[iElem]->GetNode(0),
+ geometry->elem[iElem]->GetNode(1),
+ geometry->elem[iElem]->GetNode(2),
+ geometry->elem[iElem]->GetNode(3),
+ geometry->elem[iElem]->GetNode(4));
+ iElemNew++;
+ }
+ if (geometry->elem[iElem]->GetVTK_Type() == PRISM) {
+ geo_adapt->elem[iElemNew] = new CPrism(geometry->elem[iElem]->GetNode(0),
+ geometry->elem[iElem]->GetNode(1),
+ geometry->elem[iElem]->GetNode(2),
+ geometry->elem[iElem]->GetNode(3),
+ geometry->elem[iElem]->GetNode(4),
+ geometry->elem[iElem]->GetNode(5));
+ iElemNew++;
+ }
+ }
+
+ long nodes[27]; long **Division; long nPart;
+
+ Division = new long*[100];
+ for (long iVar = 0; iVar < 100; iVar++)
+ Division[iVar] = new long[100];
+
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ if (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON) {
+
+ // Tetra elements...
+ if (TetraAdaptCode[iElem] > 0) {
+
+ // First the corners
+ nodes[0] = geometry->elem[iElem]->GetNode(0);
+ nodes[1] = geometry->elem[iElem]->GetNode(1);
+ nodes[2] = geometry->elem[iElem]->GetNode(2);
+ nodes[3] = geometry->elem[iElem]->GetNode(3);
+
+ // Next the points that correspond to the broken edges.
+ nodes[4] = TetraEdgeNode[iElem][0];
+ nodes[5] = TetraEdgeNode[iElem][1];
+ nodes[6] = TetraEdgeNode[iElem][2];
+ nodes[7] = TetraEdgeNode[iElem][3];
+ nodes[8] = TetraEdgeNode[iElem][4];
+ nodes[9] = TetraEdgeNode[iElem][5];
+
+ ip_0 = geometry->elem[iElem]->GetNode(0);
+ ip_1 = geometry->elem[iElem]->GetNode(1);
+ ip_2 = geometry->elem[iElem]->GetNode(2);
+ ip_3 = geometry->elem[iElem]->GetNode(3);
+
+ long edges[6] = {-1, -1, -1, -1, -1 , -1};
+ if (DivEdge[geometry->FindEdge(ip_0, ip_1)]) {edges[0] = geometry->FindEdge(ip_0, ip_1);}
+ if (DivEdge[geometry->FindEdge(ip_0, ip_2)]) {edges[1] = geometry->FindEdge(ip_0, ip_2);}
+ if (DivEdge[geometry->FindEdge(ip_0, ip_3)]) {edges[2] = geometry->FindEdge(ip_0, ip_3);}
+ if (DivEdge[geometry->FindEdge(ip_1, ip_2)]) {edges[3] = geometry->FindEdge(ip_1, ip_2);}
+ if (DivEdge[geometry->FindEdge(ip_1, ip_3)]) {edges[4] = geometry->FindEdge(ip_1, ip_3);}
+ if (DivEdge[geometry->FindEdge(ip_2, ip_3)]) {edges[5] = geometry->FindEdge(ip_2, ip_3);}
+
+
+ TetraDivision(TetraAdaptCode[iElem], nodes, edges, Division, &nPart);
+
+ for (long iPart = 0; iPart < nPart; iPart++) {
+
+ // Tetra case
+ geo_adapt->elem[iElemNew] = new CTetrahedron(Division[iPart][1],
+ Division[iPart][2],
+ Division[iPart][3],
+ Division[iPart][4]);
+ iElemNew++;
+ }
+ }
+ }
+
+ if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) {
+ // Hexa elements...
+ if (HexaAdaptCode[iElem] > 0) {
+
+ // First the corners
+ nodes[0] = geometry->elem[iElem]->GetNode(0); nodes[1] = geometry->elem[iElem]->GetNode(1);
+ nodes[2] = geometry->elem[iElem]->GetNode(2); nodes[3] = geometry->elem[iElem]->GetNode(3);
+ nodes[4] = geometry->elem[iElem]->GetNode(4); nodes[5] = geometry->elem[iElem]->GetNode(5);
+ nodes[6] = geometry->elem[iElem]->GetNode(6); nodes[7] = geometry->elem[iElem]->GetNode(7);
+
+ // Next the points that correspond to the broken edges.
+ nodes[8] = HexaEdgeNode[iElem][0]; nodes[9] = HexaEdgeNode[iElem][1];
+ nodes[10] = HexaEdgeNode[iElem][2]; nodes[11] = HexaEdgeNode[iElem][3];
+ nodes[12] = HexaEdgeNode[iElem][4]; nodes[13] = HexaEdgeNode[iElem][5];
+ nodes[14] = HexaEdgeNode[iElem][6]; nodes[15] = HexaEdgeNode[iElem][7];
+ nodes[16] = HexaEdgeNode[iElem][8]; nodes[17] = HexaEdgeNode[iElem][9];
+ nodes[18] = HexaEdgeNode[iElem][10]; nodes[19] = HexaEdgeNode[iElem][11];
+
+ // Next the points that correspond to the faces.
+ nodes[20] = HexaFaceNode[iElem][0];
+ nodes[21] = HexaFaceNode[iElem][1];
+ nodes[22] = HexaFaceNode[iElem][2];
+ nodes[23] = HexaFaceNode[iElem][3];
+ nodes[24] = HexaFaceNode[iElem][4];
+ nodes[25] = HexaFaceNode[iElem][5];
+
+ // Next the points that correspond to the element.
+ nodes[8] = HexaElemNode[iElem][0];
+
+ HexaDivision(HexaAdaptCode[iElem], nodes, Division, &nPart);
+ for (long iPart = 0; iPart < nPart; iPart++) {
+ geo_adapt->elem[iElemNew] = new CHexahedron(Division[iPart][1],
+ Division[iPart][2],
+ Division[iPart][3],
+ Division[iPart][4],
+ Division[iPart][5],
+ Division[iPart][6],
+ Division[iPart][7],
+ Division[iPart][8]);
+ iElemNew++;
+ }
+ }
+
+ // Pyram elements...
+ if (HexaAdaptCode[iElem] == 0) {
+ long iPyram = HexaPyramIndex[iElem][0];
+
+ // First the corners
+ nodes[0] = PyramNode[iPyram][0];
+ nodes[1] = PyramNode[iPyram][1];
+ nodes[2] = PyramNode[iPyram][2];
+ nodes[3] = PyramNode[iPyram][3];
+ nodes[4] = PyramElemNode[iPyram][0];
+
+ // Next the points that correspond to the broken edges.
+ nodes[5] = PyramEdgeNode[iPyram][0];
+ nodes[6] = PyramEdgeNode[iPyram][1];
+ nodes[7] = PyramEdgeNode[iPyram][2];
+ nodes[8] = PyramEdgeNode[iPyram][3];
+
+ // Next the points that correspond to the base face.
+ nodes[9] = PyramFaceNode[iPyram][0];
+
+ PyramDivision(PyramAdaptCode[iPyram], nodes, Division, &nPart);
+ for (long iPart = 0; iPart < nPart; iPart++) {
+
+ // Tetra case
+ if (Division[iPart][0] == 5) {
+ geo_adapt->elem[iElemNew] = new CTetrahedron(Division[iPart][1],
+ Division[iPart][2],
+ Division[iPart][3],
+ Division[iPart][4]);
+ iElemNew++;
+ }
+
+ // Pyram case
+ if (Division[iPart][0] == 6) {
+ geo_adapt->elem[iElemNew] = new CPyramid(Division[iPart][1],
+ Division[iPart][2],
+ Division[iPart][3],
+ Division[iPart][4],
+ Division[iPart][5]);
+ iElemNew++;
+ }
+ }
+ }
+ }
+ }
+
+ geo_adapt->SetnElem(iElemNew);
+ geo_adapt->SetnPoint(nPoint_new);
+ geo_adapt->SetnPointDomain(nPoint_new);
+ geo_adapt->SetnDim(nDim);
+
+ // Create boundary structure
+ geo_adapt->SetnMarker(geometry->GetnMarker());
+ geo_adapt->nElem_Bound = new unsigned long [geometry->GetnMarker()];
+ geo_adapt->Tag_to_Marker = new string [nMarker_Max];
+ geo_adapt->bound = new CPrimalGrid**[geometry->GetnMarker()];
+
+ // Conservative estimation of the number of boundary elements.
+ for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) {
+ long nNewBCcv = 0;
+ for (iVertex = 0; iVertex < geometry->GetnElem_Bound(iMarker); iVertex++) {
+ nNewBCcv = nNewBCcv + 4;
+ }
+ geo_adapt->bound[iMarker] = new CPrimalGrid* [nNewBCcv];
+ geo_adapt->SetMarker_Tag(iMarker, geometry->GetMarker_Tag(iMarker));
+ }
+
+
+ for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) {
+ long nNewBCcv = 0;
+ for (iVertex = 0; iVertex < geometry->GetnElem_Bound(iMarker); iVertex++) {
+
+ bool TriangleEdgeCode[3] = { false, false, false };
+ long TriangleAdaptCode, nodes[6];
+ long nNodesBound = geometry->bound[iMarker][iVertex]->GetnNodes();
+
+ ip_0 = geometry->bound[iMarker][iVertex]->GetNode(0); geo_adapt->nodes->SetBoundary(ip_0, geometry->GetnMarker());
+ ip_1 = geometry->bound[iMarker][iVertex]->GetNode(1); geo_adapt->nodes->SetBoundary(ip_1, geometry->GetnMarker());
+ ip_2 = geometry->bound[iMarker][iVertex]->GetNode(2); geo_adapt->nodes->SetBoundary(ip_2, geometry->GetnMarker());
+ if (nNodesBound == 4) {
+ ip_3 = geometry->bound[iMarker][iVertex]->GetNode(3); geo_adapt->nodes->SetBoundary(ip_3, geometry->GetnMarker());
+ geo_adapt->bound[iMarker][nNewBCcv] = new CQuadrilateral(ip_0, ip_1, ip_2, ip_3, 3);
+ nNewBCcv++;
+ }
+ else {
+ // First the corners
+ nodes[0] = geometry->bound[iMarker][iVertex]->GetNode(0);
+ nodes[1] = geometry->bound[iMarker][iVertex]->GetNode(1);
+ nodes[2] = geometry->bound[iMarker][iVertex]->GetNode(2);
+ if (nNodesBound == 4) nodes[3] = geometry->bound[iMarker][iVertex]->GetNode(3);
+
+ // Next the points that correspond to the broken edges.
+ nodes[3] = NodeAtEdges[geometry->FindEdge(ip_0, ip_1)]; if (nodes[3] != -1) geo_adapt->nodes->SetBoundary(nodes[3], geometry->GetnMarker());
+ nodes[4] = NodeAtEdges[geometry->FindEdge(ip_1, ip_2)]; if (nodes[4] != -1) geo_adapt->nodes->SetBoundary(nodes[4], geometry->GetnMarker());
+ nodes[5] = NodeAtEdges[geometry->FindEdge(ip_0, ip_2)]; if (nodes[5] != -1) geo_adapt->nodes->SetBoundary(nodes[5], geometry->GetnMarker());
+
+ long edges[3] = {-1, -1, -1};
+ if (DivEdge[geometry->FindEdge(ip_0, ip_1)]) { edges[0] = geometry->FindEdge(ip_0, ip_1); TriangleEdgeCode[0] = true;}
+ if (DivEdge[geometry->FindEdge(ip_1, ip_2)]) { edges[1] = geometry->FindEdge(ip_1, ip_2); TriangleEdgeCode[1] = true;}
+ if (DivEdge[geometry->FindEdge(ip_2, ip_0)]) { edges[2] = geometry->FindEdge(ip_2, ip_0); TriangleEdgeCode[2] = true;}
+
+ TriangleAdaptCode = CheckTriangleCode(TriangleEdgeCode);
+ TriangleDivision(TriangleAdaptCode, nodes, edges, Division, &nPart);
+
+ for (long iPart = 0; iPart < nPart; iPart++) {
+ geo_adapt->bound[iMarker][nNewBCcv] = new CTriangle(Division[iPart][1], Division[iPart][2], Division[iPart][3], 3);
+ nNewBCcv++;
+ }
+ }
+ }
+ geo_adapt->SetnElem_Bound(iMarker, nNewBCcv);
+ }
+
+ delete [] DivEdge;
+ delete [] DivElem;
+ delete [] NodeAtEdges;
+ delete [] NodeAtElem;
+}
+
+void CGridAdaptation::SetIndicator_Flow(CGeometry *geometry, CConfig *config, unsigned short strength) {
+ unsigned long Point = 0, Point_0 = 0, Point_1 = 0, iEdge, iVertex, iPoint, iElem, max_elem_new;
+ unsigned short iDim, iMarker;
+ su2double Dual_Area, norm, Solution_Vertex, Solution_0, Solution_1, Solution_Average,
+ DualArea, Partial_Res, Grad_Val;
+ su2double scale_area = config->GetDualVol_Power();
+
+ /*--- Initialization ---*/
+ nElem_new = 0;
+ max_elem_new = SU2_TYPE::Int(0.01*config->GetNew_Elem_Adapt()*su2double(geometry->GetnElem()));
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ geometry->elem[iElem]->SetDivide(false);
+ }
+
+ /*--- Compute the gradient of the first variable ---*/
+ for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
+ for (iDim = 0; iDim < nDim; iDim++)
+ Gradient[iPoint][iDim] = 0.0;
+
+ for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
+ Point_0 = geometry->edges->GetNode(iEdge,0); Solution_0 = ConsVar_Sol[Point_0][0];
+ Point_1 = geometry->edges->GetNode(iEdge,1); Solution_1 = ConsVar_Sol[Point_1][0];
+ const auto Normal = geometry->edges->GetNormal(iEdge);
+ Solution_Average = 0.5 * ( Solution_0 + Solution_1);
+ for (iDim = 0; iDim < nDim; iDim++) {
+ Partial_Res = Solution_Average*Normal[iDim];
+ Gradient[Point_0][iDim] = Gradient[Point_0][iDim] + Partial_Res;
+ Gradient[Point_1][iDim] = Gradient[Point_1][iDim] - Partial_Res;
+ }
+ }
+
+ for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++)
+ if ((config->GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) &&
+ (config->GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) {
+ for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) {
+ Point = geometry->vertex[iMarker][iVertex]->GetNode();
+ Solution_Vertex = ConsVar_Sol[Point][0];
+ const auto Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
+ for (iDim = 0; iDim < nDim; iDim++) {
+ Partial_Res = Solution_Vertex*Normal[iDim];
+ Gradient[Point][iDim] = Gradient[Point][iDim] - Partial_Res;
+ }
+ }
+ }
+
+ for (iPoint = 0; iPointGetnPoint(); iPoint++)
+ for (iDim = 0; iDim < nDim; iDim++) {
+ DualArea = geometry->nodes->GetVolume(iPoint);
+ Grad_Val = Gradient[iPoint][iDim]/DualArea;
+ Gradient[iPoint][iDim] = Grad_Val;
+ }
+
+ /*--- Compute the the adaptation index at each point ---*/
+ for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++) {
+ Dual_Area = geometry->nodes->GetVolume(iPoint);
+ norm = 0.0;
+ for (iDim = 0; iDim < nDim; iDim++)
+ norm += Gradient[iPoint][iDim]*Gradient[iPoint][iDim];
+ norm = sqrt(norm);
+ Index[iPoint] = pow(Dual_Area, scale_area)*norm;
+ }
+
+ SetSensorElem(geometry, config, max_elem_new);
+
+}
+
+
+void CGridAdaptation::SetIndicator_Adj(CGeometry *geometry, CConfig *config, unsigned short strength) {
+ su2double Dual_Area;
+ unsigned long Point = 0, Point_0 = 0, Point_1 = 0, iEdge, iVertex, iPoint, iElem, max_elem_new;
+ unsigned short iDim, iMarker;
+ su2double norm, Solution_Vertex, Solution_0, Solution_1, Solution_Average,
+ DualArea, Partial_Res, Grad_Val;
+ su2double scale_area = config->GetDualVol_Power();
+
+ // Initialization
+ nElem_new = 0;
+ max_elem_new = SU2_TYPE::Int(0.01*config->GetNew_Elem_Adapt()*su2double(geometry->GetnElem()));
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ geometry->elem[iElem]->SetDivide(false);
+ }
+
+ // Compute the gradient of the density.
+ for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
+ for (iDim = 0; iDim < nDim; iDim++)
+ Gradient[iPoint][iDim] = 0.0;
for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
Point_0 = geometry->edges->GetNode(iEdge,0); Solution_0 = AdjVar_Sol[Point_0][0];
@@ -3292,7 +3300,7 @@ void CGridAdaptation::SetIndicator_Adj(CGeometry *geometry, CConfig *config, uns
for (iPoint = 0; iPointGetnPoint(); iPoint++)
for (iDim = 0; iDim < nDim; iDim++) {
- DualArea = geometry->node[iPoint]->GetVolume();
+ DualArea = geometry->nodes->GetVolume(iPoint);
Grad_Val = Gradient[iPoint][iDim]/DualArea;
Gradient[iPoint][iDim] = Grad_Val;
}
@@ -3300,7 +3308,7 @@ void CGridAdaptation::SetIndicator_Adj(CGeometry *geometry, CConfig *config, uns
// Compute the the adaptation index at each point.
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++) {
- Dual_Area = geometry->node[iPoint]->GetVolume();
+ Dual_Area = geometry->nodes->GetVolume(iPoint);
norm = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
norm += Gradient[iPoint][iDim]*Gradient[iPoint][iDim];
@@ -3363,14 +3371,14 @@ void CGridAdaptation::SetIndicator_FlowAdj(CGeometry *geometry, CConfig *config)
for (iPoint = 0; iPointGetnPoint(); iPoint++)
for (iDim = 0; iDim < nDim; iDim++) {
- DualArea = geometry->node[iPoint]->GetVolume();
+ DualArea = geometry->nodes->GetVolume(iPoint);
Gradient_Flow[iPoint][iDim] = Gradient_Flow[iPoint][iDim]/DualArea;
Gradient_Adj[iPoint][iDim] = Gradient_Adj[iPoint][iDim]/DualArea;
}
// Compute the the adaptation index at each point.
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++) {
- Dual_Area=geometry->node[iPoint]->GetVolume();
+ Dual_Area=geometry->nodes->GetVolume(iPoint);
norm = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
norm += Gradient_Flow[iPoint][iDim]*Gradient_Flow[iPoint][iDim];
@@ -3383,7 +3391,7 @@ void CGridAdaptation::SetIndicator_FlowAdj(CGeometry *geometry, CConfig *config)
// Compute the the adaptation index at each point.
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++) {
- Dual_Area=geometry->node[iPoint]->GetVolume();
+ Dual_Area=geometry->nodes->GetVolume(iPoint);
norm = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
norm += Gradient_Adj[iPoint][iDim]*Gradient_Adj[iPoint][iDim];
@@ -3396,117 +3404,117 @@ void CGridAdaptation::SetIndicator_FlowAdj(CGeometry *geometry, CConfig *config)
}
void CGridAdaptation::SetIndicator_Robust(CGeometry *geometry, CConfig *config) {
- unsigned long iPoint, iElem, max_elem_new_flow, max_elem_new_adj;
- unsigned short iVar;
- su2double Dual_Area;
- su2double scale_area = config->GetDualVol_Power();
+ unsigned long iPoint, iElem, max_elem_new_flow, max_elem_new_adj;
+ unsigned short iVar;
+ su2double Dual_Area;
+ su2double scale_area = config->GetDualVol_Power();
- // Inicializa la malla para la adaptacion
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- geometry->elem[iElem]->SetDivide (false);
- }
+ // Inicializa la malla para la adaptacion
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ geometry->elem[iElem]->SetDivide (false);
+ }
- for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++) {
- Dual_Area = geometry->node[iPoint]->GetVolume();
- Index[iPoint] = 0.0;
- for (iVar = 0; iVar < nVar; iVar++)
- Index[iPoint] += ConsVar_Res[iPoint][iVar]*ConsVar_Res[iPoint][iVar];
+ for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++) {
+ Dual_Area = geometry->nodes->GetVolume(iPoint);
+ Index[iPoint] = 0.0;
+ for (iVar = 0; iVar < nVar; iVar++)
+ Index[iPoint] += ConsVar_Res[iPoint][iVar]*ConsVar_Res[iPoint][iVar];
- Index[iPoint] = pow(Dual_Area, scale_area)*sqrt(Index[iPoint]);
- }
+ Index[iPoint] = pow(Dual_Area, scale_area)*sqrt(Index[iPoint]);
+ }
- max_elem_new_flow = SU2_TYPE::Int(0.5*0.01*config->GetNew_Elem_Adapt()*su2double(geometry->GetnElem()));
- SetSensorElem(geometry, config, max_elem_new_flow);
+ max_elem_new_flow = SU2_TYPE::Int(0.5*0.01*config->GetNew_Elem_Adapt()*su2double(geometry->GetnElem()));
+ SetSensorElem(geometry, config, max_elem_new_flow);
- for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++) {
- Dual_Area = geometry->node[iPoint]->GetVolume();
- Index[iPoint] = 0.0;
- for (iVar = 0; iVar < nVar; iVar++)
- Index[iPoint] += AdjVar_Res[iPoint][iVar]*AdjVar_Res[iPoint][iVar];
+ for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++) {
+ Dual_Area = geometry->nodes->GetVolume(iPoint);
+ Index[iPoint] = 0.0;
+ for (iVar = 0; iVar < nVar; iVar++)
+ Index[iPoint] += AdjVar_Res[iPoint][iVar]*AdjVar_Res[iPoint][iVar];
- Index[iPoint] = pow(Dual_Area, scale_area)*sqrt(Index[iPoint]);
- }
+ Index[iPoint] = pow(Dual_Area, scale_area)*sqrt(Index[iPoint]);
+ }
- max_elem_new_adj = SU2_TYPE::Int(0.5*0.01*config->GetNew_Elem_Adapt()*su2double(geometry->GetnElem()));
- SetSensorElem(geometry, config, max_elem_new_adj);
+ max_elem_new_adj = SU2_TYPE::Int(0.5*0.01*config->GetNew_Elem_Adapt()*su2double(geometry->GetnElem()));
+ SetSensorElem(geometry, config, max_elem_new_adj);
}
void CGridAdaptation::SetIndicator_Computable(CGeometry *geometry, CConfig *config) {
- unsigned long iPoint, iElem, max_elem_new;
- unsigned short iVar;
- su2double Dual_Area;
- su2double scale_area = config->GetDualVol_Power();
+ unsigned long iPoint, iElem, max_elem_new;
+ unsigned short iVar;
+ su2double Dual_Area;
+ su2double scale_area = config->GetDualVol_Power();
- max_elem_new = SU2_TYPE::Int(0.01*config->GetNew_Elem_Adapt()*su2double(geometry->GetnElem()));
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- geometry->elem[iElem]->SetDivide (false);
- }
+ max_elem_new = SU2_TYPE::Int(0.01*config->GetNew_Elem_Adapt()*su2double(geometry->GetnElem()));
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ geometry->elem[iElem]->SetDivide (false);
+ }
- for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++) {
- Dual_Area = geometry->node[iPoint]->GetVolume();
- Index[iPoint] = 0.0;
- for (iVar = 0; iVar < nVar; iVar++)
- Index[iPoint] += ConsVar_Res[iPoint][iVar]*AdjVar_Sol[iPoint][iVar]*ConsVar_Res[iPoint][iVar]*AdjVar_Sol[iPoint][iVar];
+ for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++) {
+ Dual_Area = geometry->nodes->GetVolume(iPoint);
+ Index[iPoint] = 0.0;
+ for (iVar = 0; iVar < nVar; iVar++)
+ Index[iPoint] += ConsVar_Res[iPoint][iVar]*AdjVar_Sol[iPoint][iVar]*ConsVar_Res[iPoint][iVar]*AdjVar_Sol[iPoint][iVar];
- Index[iPoint] = pow(Dual_Area, scale_area)*sqrt(Index[iPoint]);
- }
+ Index[iPoint] = pow(Dual_Area, scale_area)*sqrt(Index[iPoint]);
+ }
- SetSensorElem(geometry, config, max_elem_new);
+ SetSensorElem(geometry, config, max_elem_new);
}
void CGridAdaptation::SetIndicator_Computable_Robust(CGeometry *geometry, CConfig *config) {
- unsigned long iPoint, iElem, max_elem_new;
- unsigned short iVar;
- su2double Dual_Area ;
- su2double scale_area = config->GetDualVol_Power();
+ unsigned long iPoint, iElem, max_elem_new;
+ unsigned short iVar;
+ su2double Dual_Area ;
+ su2double scale_area = config->GetDualVol_Power();
- /*--- Initializate the numerical grid for the adaptation ---*/
- max_elem_new = SU2_TYPE::Int(0.01*config->GetNew_Elem_Adapt()*su2double(geometry->GetnElem()));
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- geometry->elem[iElem]->SetDivide (false);
- }
+ /*--- Initializate the numerical grid for the adaptation ---*/
+ max_elem_new = SU2_TYPE::Int(0.01*config->GetNew_Elem_Adapt()*su2double(geometry->GetnElem()));
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ geometry->elem[iElem]->SetDivide (false);
+ }
- for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++) {
- Dual_Area = geometry->node[iPoint]->GetVolume();
- Index[iPoint] = 0.0;
- for (iVar = 0; iVar < nVar; iVar++)
- Index[iPoint] += LinVar_Res[iPoint][iVar]*AdjVar_Sol[iPoint][iVar]*LinVar_Res[iPoint][iVar]*AdjVar_Sol[iPoint][iVar];
+ for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++) {
+ Dual_Area = geometry->nodes->GetVolume(iPoint);
+ Index[iPoint] = 0.0;
+ for (iVar = 0; iVar < nVar; iVar++)
+ Index[iPoint] += LinVar_Res[iPoint][iVar]*AdjVar_Sol[iPoint][iVar]*LinVar_Res[iPoint][iVar]*AdjVar_Sol[iPoint][iVar];
- Index[iPoint] = pow(Dual_Area, scale_area)*sqrt(Index[iPoint]);
- }
+ Index[iPoint] = pow(Dual_Area, scale_area)*sqrt(Index[iPoint]);
+ }
- SetSensorElem(geometry, config, max_elem_new);
+ SetSensorElem(geometry, config, max_elem_new);
}
void CGridAdaptation::SetRestart_FlowSolution(CConfig *config, CPhysicalGeometry *geo_adapt, string mesh_flowfilename) {
- unsigned long iPoint;
- unsigned short iVar, iDim;
+ unsigned long iPoint;
+ unsigned short iVar, iDim;
- char *cstr = new char [mesh_flowfilename.size()+1];
- strcpy (cstr, mesh_flowfilename.c_str());
+ char *cstr = new char [mesh_flowfilename.size()+1];
+ strcpy (cstr, mesh_flowfilename.c_str());
- ofstream restart_flowfile;
- restart_flowfile.open(cstr, ios::out);
- restart_flowfile.precision(15);
+ ofstream restart_flowfile;
+ restart_flowfile.open(cstr, ios::out);
+ restart_flowfile.precision(15);
restart_flowfile << "Restart file generated with SU2_MSH" << endl;
- for (iPoint = 0; iPoint < nPoint_new; iPoint++) {
- restart_flowfile << iPoint <<"\t";
+ for (iPoint = 0; iPoint < nPoint_new; iPoint++) {
+ restart_flowfile << iPoint <<"\t";
for (iDim = 0; iDim < nDim; iDim++)
- restart_flowfile << scientific << geo_adapt->node[iPoint]->GetCoord(iDim) <<"\t";
- for (iVar = 0; iVar < nVar; iVar++)
- restart_flowfile << scientific << ConsVar_Adapt[iPoint][iVar] <<"\t";
+ restart_flowfile << scientific << geo_adapt->nodes->GetCoord(iPoint, iDim) <<"\t";
+ for (iVar = 0; iVar < nVar; iVar++)
+ restart_flowfile << scientific << ConsVar_Adapt[iPoint][iVar] <<"\t";
- restart_flowfile << endl;
- }
- restart_flowfile.close();
+ restart_flowfile << endl;
+ }
+ restart_flowfile.close();
}
@@ -3515,12 +3523,12 @@ void CGridAdaptation::SetRestart_AdjSolution(CConfig *config, CPhysicalGeometry
char cstr[MAX_STRING_SIZE], buffer[50];
unsigned short iDim, iVar;
unsigned long iPoint;
- string copy;
+ string copy;
- copy.assign(mesh_adjfilename);
+ copy.assign(mesh_adjfilename);
unsigned short lastindex = copy.find_last_of(".");
copy = copy.substr(0, lastindex);
- strcpy (cstr, copy.c_str());
+ strcpy (cstr, copy.c_str());
if (config->GetnObj() > 1) {
SPRINTF (buffer, "_combo.dat");
}
@@ -3546,112 +3554,112 @@ void CGridAdaptation::SetRestart_AdjSolution(CConfig *config, CPhysicalGeometry
if (config->GetKind_ObjFunc() == CUSTOM_OBJFUNC) SPRINTF (buffer, "_custom.dat");
}
- strcat(cstr, buffer);
+ strcat(cstr, buffer);
- ofstream restart_adjfile;
- restart_adjfile.open(cstr, ios::out);
- restart_adjfile.precision(15);
+ ofstream restart_adjfile;
+ restart_adjfile.open(cstr, ios::out);
+ restart_adjfile.precision(15);
restart_adjfile << "Restart file generated with SU2_MSH" << endl;
- for (iPoint = 0; iPoint < nPoint_new; iPoint++) {
- restart_adjfile << iPoint <<"\t";
+ for (iPoint = 0; iPoint < nPoint_new; iPoint++) {
+ restart_adjfile << iPoint <<"\t";
for (iDim = 0; iDim < nDim; iDim++)
- restart_adjfile << scientific << geo_adapt->node[iPoint]->GetCoord(iDim) <<"\t";
- for (iVar = 0; iVar < nVar; iVar++)
- restart_adjfile << scientific << AdjVar_Adapt[iPoint][iVar]<<"\t";
- restart_adjfile << endl;
+ restart_adjfile << scientific << geo_adapt->nodes->GetCoord(iPoint, iDim) <<"\t";
+ for (iVar = 0; iVar < nVar; iVar++)
+ restart_adjfile << scientific << AdjVar_Adapt[iPoint][iVar]<<"\t";
+ restart_adjfile << endl;
- }
- restart_adjfile.close();
+ }
+ restart_adjfile.close();
}
void CGridAdaptation::SetRestart_LinSolution(CConfig *config, CPhysicalGeometry *geo_adapt, string mesh_linfilename) {
- unsigned long iPoint;
- unsigned short iVar, iDim;
+ unsigned long iPoint;
+ unsigned short iVar, iDim;
- char *cstr_ = new char [mesh_linfilename.size()+1];
- strcpy (cstr_, mesh_linfilename.c_str());
+ char *cstr_ = new char [mesh_linfilename.size()+1];
+ strcpy (cstr_, mesh_linfilename.c_str());
- ofstream restart_linfile;
- restart_linfile.open(cstr_, ios::out);
- restart_linfile.precision(15);
+ ofstream restart_linfile;
+ restart_linfile.open(cstr_, ios::out);
+ restart_linfile.precision(15);
restart_linfile << "Restart file generated with SU2_MSH" << endl;
- for (iPoint = 0; iPoint < nPoint_new; iPoint++) {
- restart_linfile << iPoint <<"\t";
+ for (iPoint = 0; iPoint < nPoint_new; iPoint++) {
+ restart_linfile << iPoint <<"\t";
for (iDim = 0; iDim < nDim; iDim++)
- restart_linfile << scientific << geo_adapt->node[iPoint]->GetCoord(iDim) <<"\t";
- for (iVar = 0; iVar < nVar; iVar++)
- restart_linfile << scientific << LinVar_Adapt[iPoint][iVar]<<"\t";
- restart_linfile << endl;
+ restart_linfile << scientific << geo_adapt->nodes->GetCoord(iPoint, iDim) <<"\t";
+ for (iVar = 0; iVar < nVar; iVar++)
+ restart_linfile << scientific << LinVar_Adapt[iPoint][iVar]<<"\t";
+ restart_linfile << endl;
- }
- restart_linfile.close();
+ }
+ restart_linfile.close();
}
void CGridAdaptation::SetSensorElem(CGeometry *geometry, CConfig *config, unsigned long max_elem) {
- su2double Max_Sensor, threshold;
- su2double *Sensor = new su2double[geometry->GetnElem()];
- unsigned long ip_0, ip_1, ip_2, ip_3, iElem, nElem_real;
-
- if (max_elem > geometry->GetnElem()) {
- cout << "WARNING: Attempted to adapt " << max_elem << " cells," << endl;
- cout << " which is greater than the total number of cells, ";
- cout << geometry->GetnElem() << "." << endl;
- cout << " Did you set the option NEW_ELEMS in the *.cfg file?" << endl;
- }
-
- /*--- Compute the the adaptation index at each element ---*/
- Max_Sensor = 0.0;
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- ip_0 = geometry->elem[iElem]->GetNode(0);
- ip_1 = geometry->elem[iElem]->GetNode(1);
- ip_2 = geometry->elem[iElem]->GetNode(2);
- Sensor[iElem] = (Index[ip_0]+Index[ip_1]+Index[ip_2])/3.0;
- if ((geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) ||
- (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON)) {
- ip_3 = geometry->elem[iElem]->GetNode(2);
- Sensor[iElem] = (Index[ip_0]+Index[ip_1]+Index[ip_2]+Index[ip_3])/4.0;
- }
- Max_Sensor = max(Max_Sensor, Sensor[iElem]);
- }
-
- /*--- Adimensionalization of the adaptation sensor ---*/
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
- Sensor[iElem] = Sensor[iElem]/Max_Sensor;
- }
-
- /*--- Selection of the elements to be adapted ---*/
- threshold = 0.999;
- nElem_real = 0;
- while (nElem_real <= max_elem && threshold >= 0) {
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++)
- if ( Sensor[iElem] >= threshold && !geometry->elem[iElem]->GetDivide() ) {
- if (geometry->elem[iElem]->GetVTK_Type() == TRIANGLE) nElem_real = nElem_real + 3;
- if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) nElem_real = nElem_real + 3;
- if (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON) nElem_real = nElem_real + 7;
- geometry->elem[iElem]->SetDivide(true);
- if (nElem_real >= max_elem) break;
- }
- threshold = threshold - 0.001;
- }
-
- if (threshold < 0) {
- cout << "WARNING: Tried to find " << max_elem;
- cout << " cells suitable for adaptation, but only found ";
- cout << nElem_real << endl;
- cout << "The following cell types are currently adaptable: " << endl;
- cout << " + triangles" << endl;
- cout << " + quadrilaterals" << endl;
- cout << " + tetrahedrons" << endl;
- cout << "Your grid may have too high a percentage of other types." << endl;
- }
-
- cout << "Number of elements to adapt: " << nElem_real << endl;
- delete [] Sensor;
+ su2double Max_Sensor, threshold;
+ su2double *Sensor = new su2double[geometry->GetnElem()];
+ unsigned long ip_0, ip_1, ip_2, ip_3, iElem, nElem_real;
+
+ if (max_elem > geometry->GetnElem()) {
+ cout << "WARNING: Attempted to adapt " << max_elem << " cells," << endl;
+ cout << " which is greater than the total number of cells, ";
+ cout << geometry->GetnElem() << "." << endl;
+ cout << " Did you set the option NEW_ELEMS in the *.cfg file?" << endl;
+ }
+
+ /*--- Compute the the adaptation index at each element ---*/
+ Max_Sensor = 0.0;
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ ip_0 = geometry->elem[iElem]->GetNode(0);
+ ip_1 = geometry->elem[iElem]->GetNode(1);
+ ip_2 = geometry->elem[iElem]->GetNode(2);
+ Sensor[iElem] = (Index[ip_0]+Index[ip_1]+Index[ip_2])/3.0;
+ if ((geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) ||
+ (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON)) {
+ ip_3 = geometry->elem[iElem]->GetNode(2);
+ Sensor[iElem] = (Index[ip_0]+Index[ip_1]+Index[ip_2]+Index[ip_3])/4.0;
+ }
+ Max_Sensor = max(Max_Sensor, Sensor[iElem]);
+ }
+
+ /*--- Adimensionalization of the adaptation sensor ---*/
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+ Sensor[iElem] = Sensor[iElem]/Max_Sensor;
+ }
+
+ /*--- Selection of the elements to be adapted ---*/
+ threshold = 0.999;
+ nElem_real = 0;
+ while (nElem_real <= max_elem && threshold >= 0) {
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++)
+ if ( Sensor[iElem] >= threshold && !geometry->elem[iElem]->GetDivide() ) {
+ if (geometry->elem[iElem]->GetVTK_Type() == TRIANGLE) nElem_real = nElem_real + 3;
+ if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) nElem_real = nElem_real + 3;
+ if (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON) nElem_real = nElem_real + 7;
+ geometry->elem[iElem]->SetDivide(true);
+ if (nElem_real >= max_elem) break;
+ }
+ threshold = threshold - 0.001;
+ }
+
+ if (threshold < 0) {
+ cout << "WARNING: Tried to find " << max_elem;
+ cout << " cells suitable for adaptation, but only found ";
+ cout << nElem_real << endl;
+ cout << "The following cell types are currently adaptable: " << endl;
+ cout << " + triangles" << endl;
+ cout << " + quadrilaterals" << endl;
+ cout << " + tetrahedrons" << endl;
+ cout << "Your grid may have too high a percentage of other types." << endl;
+ }
+
+ cout << "Number of elements to adapt: " << nElem_real << endl;
+ delete [] Sensor;
}
diff --git a/Common/src/grid_movement_structure.cpp b/Common/src/grid_movement_structure.cpp
index f5bce092e91b..e4dd9e4568d3 100644
--- a/Common/src/grid_movement_structure.cpp
+++ b/Common/src/grid_movement_structure.cpp
@@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
- * The SU2 Project is maintained by the SU2 Foundation
+ * The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md)
@@ -45,10 +45,10 @@ CVolumetricMovement::CVolumetricMovement(void) : CGridMovement() {
}
CVolumetricMovement::CVolumetricMovement(CGeometry *geometry, CConfig *config) : CGridMovement() {
-
+
size = SU2_MPI::GetSize();
rank = SU2_MPI::GetRank();
-
+
/*--- Initialize the number of spatial dimensions, length of the state
vector (same as spatial dimensions for grid deformation), and grid nodes. ---*/
@@ -70,20 +70,20 @@ CVolumetricMovement::CVolumetricMovement(CGeometry *geometry, CConfig *config) :
CVolumetricMovement::~CVolumetricMovement(void) { }
void CVolumetricMovement::UpdateGridCoord(CGeometry *geometry, CConfig *config) {
-
+
unsigned short iDim;
unsigned long iPoint, total_index;
su2double new_coord;
-
+
/*--- Update the grid coordinates using the solution of the linear system
after grid deformation (LinSysSol contains the x, y, z displacements). ---*/
-
+
for (iPoint = 0; iPoint < nPoint; iPoint++)
for (iDim = 0; iDim < nDim; iDim++) {
total_index = iPoint*nDim + iDim;
- new_coord = geometry->node[iPoint]->GetCoord(iDim)+LinSysSol[total_index];
+ new_coord = geometry->nodes->GetCoord(iPoint, iDim)+LinSysSol[total_index];
if (fabs(new_coord) < EPS*EPS) new_coord = 0.0;
- geometry->node[iPoint]->SetCoord(iDim, new_coord);
+ geometry->nodes->SetCoord(iPoint, iDim, new_coord);
}
/*--- LinSysSol contains the non-transformed displacements in the periodic halo cells.
@@ -92,28 +92,28 @@ void CVolumetricMovement::UpdateGridCoord(CGeometry *geometry, CConfig *config)
geometry->InitiateComms(geometry, config, COORDINATES);
geometry->CompleteComms(geometry, config, COORDINATES);
-
+
}
void CVolumetricMovement::UpdateDualGrid(CGeometry *geometry, CConfig *config) {
-
+
/*--- After moving all nodes, update the dual mesh. Recompute the edges and
dual mesh control volumes in the domain and on the boundaries. ---*/
-
+
geometry->SetCoord_CG();
geometry->SetControlVolume(config, UPDATE);
geometry->SetBoundControlVolume(config, UPDATE);
geometry->SetMaxLength(config);
-
+
}
void CVolumetricMovement::UpdateMultiGrid(CGeometry **geometry, CConfig *config) {
-
+
unsigned short iMGfine, iMGlevel, nMGlevel = config->GetnMGLevels();
-
+
/*--- Update the multigrid structure after moving the finest grid,
including computing the grid velocities on the coarser levels. ---*/
-
+
for (iMGlevel = 1; iMGlevel <= nMGlevel; iMGlevel++) {
iMGfine = iMGlevel-1;
geometry[iMGlevel]->SetControlVolume(config, geometry[iMGfine], UPDATE);
@@ -122,72 +122,72 @@ void CVolumetricMovement::UpdateMultiGrid(CGeometry **geometry, CConfig *config)
if (config->GetGrid_Movement())
geometry[iMGlevel]->SetRestricted_GridVelocity(geometry[iMGfine], config);
}
-
+
}
void CVolumetricMovement::SetVolume_Deformation(CGeometry *geometry, CConfig *config, bool UpdateGeo, bool Derivative) {
-
+
unsigned long IterLinSol = 0, Smoothing_Iter, iNonlinear_Iter, MaxIter = 0, RestartIter = 50, Tot_Iter = 0, Nonlinear_Iter = 0;
su2double MinVolume, MaxVolume, NumError, Residual = 0.0, Residual_Init = 0.0;
bool Screen_Output;
/*--- Retrieve number or iterations, tol, output, etc. from config ---*/
-
+
Smoothing_Iter = config->GetDeform_Linear_Solver_Iter();
Screen_Output = config->GetDeform_Output();
NumError = config->GetDeform_Linear_Solver_Error();
Nonlinear_Iter = config->GetGridDef_Nonlinear_Iter();
-
+
/*--- Disable the screen output if we're running SU2_CFD ---*/
-
+
if (config->GetKind_SU2() == SU2_CFD && !Derivative) Screen_Output = false;
/*--- Set the number of nonlinear iterations to 1 if Derivative computation is enabled ---*/
if (Derivative) Nonlinear_Iter = 1;
-
+
/*--- Loop over the total number of grid deformation iterations. The surface
deformation can be divided into increments to help with stability. In
particular, the linear elasticity equations hold only for small deformations. ---*/
-
+
for (iNonlinear_Iter = 0; iNonlinear_Iter < Nonlinear_Iter; iNonlinear_Iter++) {
-
+
/*--- Initialize vector and sparse matrix ---*/
-
+
LinSysSol.SetValZero();
LinSysRes.SetValZero();
StiffMatrix.SetValZero();
-
+
/*--- Compute the stiffness matrix entries for all nodes/elements in the
mesh. FEA uses a finite element method discretization of the linear
elasticity equations (transfers element stiffnesses to point-to-point). ---*/
-
+
MinVolume = SetFEAMethodContributions_Elem(geometry, config);
-
- /*--- Set the boundary and volume displacements (as prescribed by the
- design variable perturbations controlling the surface shape)
+
+ /*--- Set the boundary and volume displacements (as prescribed by the
+ design variable perturbations controlling the surface shape)
as a Dirichlet BC. ---*/
-
+
SetBoundaryDisplacements(geometry, config);
/*--- Fix the location of any points in the domain, if requested. ---*/
-
+
SetDomainDisplacements(geometry, config);
/*--- Set the boundary derivatives (overrides the actual displacements) ---*/
if (Derivative) { SetBoundaryDerivatives(geometry, config); }
-
+
CMatrixVectorProduct* mat_vec = NULL;
CPreconditioner* precond = NULL;
/*--- Communicate any prescribed boundary displacements via MPI,
so that all nodes have the same solution and r.h.s. entries
across all partitions. ---*/
-
+
StiffMatrix.InitiateComms(LinSysSol, geometry, config, SOLUTION_MATRIX);
StiffMatrix.CompleteComms(LinSysSol, geometry, config, SOLUTION_MATRIX);
-
+
StiffMatrix.InitiateComms(LinSysRes, geometry, config, SOLUTION_MATRIX);
StiffMatrix.CompleteComms(LinSysRes, geometry, config, SOLUTION_MATRIX);
@@ -236,12 +236,12 @@ void CVolumetricMovement::SetVolume_Deformation(CGeometry *geometry, CConfig *co
}
}
-
+
if (LinSysRes.norm() != 0.0){
switch (config->GetKind_Deform_Linear_Solver()) {
-
+
/*--- Solve the linear system (GMRES with restart) ---*/
-
+
case RESTARTED_FGMRES:
Tot_Iter = 0; MaxIter = RestartIter;
@@ -302,23 +302,23 @@ void CVolumetricMovement::SetVolume_Deformation(CGeometry *geometry, CConfig *co
}
}
-
+
/*--- Deallocate memory needed by the Krylov linear solver ---*/
-
+
delete mat_vec;
delete precond;
-
+
/*--- Update the grid coordinates and cell volumes using the solution
of the linear system (usol contains the x, y, z displacements). ---*/
if (!Derivative) { UpdateGridCoord(geometry, config); }
else { UpdateGridCoord_Derivatives(geometry, config); }
if (UpdateGeo) { UpdateDualGrid(geometry, config); }
-
+
/*--- Check for failed deformation (negative volumes). ---*/
-
+
ComputeDeforming_Element_Volume(geometry, MinVolume, MaxVolume, Screen_Output);
-
+
/*--- Set number of iterations in the mesh update. ---*/
Set_nIterMesh(Tot_Iter);
@@ -328,69 +328,69 @@ void CVolumetricMovement::SetVolume_Deformation(CGeometry *geometry, CConfig *co
if (nDim == 2) cout << "Min. area: " << MinVolume << ". Error: " << Residual << "." << endl;
else cout << "Min. volume: " << MinVolume << ". Error: " << Residual << "." << endl;
}
-
+
}
-
+
}
void CVolumetricMovement::ComputeDeforming_Element_Volume(CGeometry *geometry, su2double &MinVolume, su2double &MaxVolume, bool Screen_Output) {
-
+
unsigned long iElem, ElemCounter = 0, PointCorners[8];
su2double Volume = 0.0, CoordCorners[8][3];
unsigned short nNodes = 0, iNodes, iDim;
bool RightVol = true;
-
+
if (rank == MASTER_NODE && Screen_Output)
cout << "Computing volumes of the grid elements." << endl;
-
+
MaxVolume = -1E22; MinVolume = 1E22;
-
+
/*--- Load up each triangle and tetrahedron to check for negative volumes. ---*/
-
+
for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
-
+
if (geometry->elem[iElem]->GetVTK_Type() == TRIANGLE) nNodes = 3;
if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) nNodes = 4;
if (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON) nNodes = 4;
if (geometry->elem[iElem]->GetVTK_Type() == PYRAMID) nNodes = 5;
if (geometry->elem[iElem]->GetVTK_Type() == PRISM) nNodes = 6;
if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) nNodes = 8;
-
+
for (iNodes = 0; iNodes < nNodes; iNodes++) {
PointCorners[iNodes] = geometry->elem[iElem]->GetNode(iNodes);
for (iDim = 0; iDim < nDim; iDim++) {
- CoordCorners[iNodes][iDim] = geometry->node[PointCorners[iNodes]]->GetCoord(iDim);
+ CoordCorners[iNodes][iDim] = geometry->nodes->GetCoord(PointCorners[iNodes], iDim);
}
}
-
+
/*--- 2D elements ---*/
-
+
if (nDim == 2) {
if (nNodes == 3) Volume = GetTriangle_Area(CoordCorners);
if (nNodes == 4) Volume = GetQuadrilateral_Area(CoordCorners);
}
-
+
/*--- 3D Elementes ---*/
-
+
if (nDim == 3) {
if (nNodes == 4) Volume = GetTetra_Volume(CoordCorners);
if (nNodes == 5) Volume = GetPyram_Volume(CoordCorners);
if (nNodes == 6) Volume = GetPrism_Volume(CoordCorners);
if (nNodes == 8) Volume = GetHexa_Volume(CoordCorners);
}
-
+
RightVol = true;
if (Volume < 0.0) RightVol = false;
-
+
MaxVolume = max(MaxVolume, Volume);
MinVolume = min(MinVolume, Volume);
geometry->elem[iElem]->SetVolume(Volume);
-
+
if (!RightVol) ElemCounter++;
-
+
}
-
+
#ifdef HAVE_MPI
unsigned long ElemCounter_Local = ElemCounter; ElemCounter = 0;
su2double MaxVolume_Local = MaxVolume; MaxVolume = 0.0;
@@ -399,23 +399,23 @@ void CVolumetricMovement::ComputeDeforming_Element_Volume(CGeometry *geometry, s
SU2_MPI::Allreduce(&MaxVolume_Local, &MaxVolume, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
SU2_MPI::Allreduce(&MinVolume_Local, &MinVolume, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD);
#endif
-
+
/*--- Volume from 0 to 1 ---*/
-
+
for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
Volume = geometry->elem[iElem]->GetVolume()/MaxVolume;
geometry->elem[iElem]->SetVolume(Volume);
}
-
+
if ((ElemCounter != 0) && (rank == MASTER_NODE) && (Screen_Output))
cout <<"There are " << ElemCounter << " elements with negative volume.\n" << endl;
-
+
}
-
-
+
+
void CVolumetricMovement::ComputeSolid_Wall_Distance(CGeometry *geometry, CConfig *config, su2double &MinDistance, su2double &MaxDistance) {
-
+
unsigned long nVertex_SolidWall, ii, jj, iVertex, iPoint, pointID;
unsigned short iMarker, iDim;
su2double dist, MaxDistance_Local, MinDistance_Local;
@@ -424,9 +424,9 @@ void CVolumetricMovement::ComputeSolid_Wall_Distance(CGeometry *geometry, CConfi
/*--- Initialize min and max distance ---*/
MaxDistance = -1E22; MinDistance = 1E22;
-
+
/*--- Compute the total number of nodes on no-slip boundaries ---*/
-
+
nVertex_SolidWall = 0;
for(iMarker=0; iMarkerGetnMarker_All(); ++iMarker) {
if( (config->GetMarker_All_KindBC(iMarker) == EULER_WALL ||
@@ -436,16 +436,16 @@ void CVolumetricMovement::ComputeSolid_Wall_Distance(CGeometry *geometry, CConfi
nVertex_SolidWall += geometry->GetnVertex(iMarker);
}
}
-
+
/*--- Allocate the vectors to hold boundary node coordinates
and its local ID. ---*/
-
+
vector Coord_bound(nDim*nVertex_SolidWall);
vector PointIDs(nVertex_SolidWall);
-
+
/*--- Retrieve and store the coordinates of the no-slip boundary nodes
and their local point IDs. ---*/
-
+
ii = 0; jj = 0;
for (iMarker=0; iMarkerGetnMarker_All(); ++iMarker) {
if ( (config->GetMarker_All_KindBC(iMarker) == EULER_WALL ||
@@ -456,50 +456,50 @@ void CVolumetricMovement::ComputeSolid_Wall_Distance(CGeometry *geometry, CConfi
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
PointIDs[jj++] = iPoint;
for (iDim=0; iDimnode[iPoint]->GetCoord(iDim);
+ Coord_bound[ii++] = geometry->nodes->GetCoord(iPoint, iDim);
}
}
}
-
+
/*--- Build the ADT of the boundary nodes. ---*/
-
+
CADTPointsOnlyClass WallADT(nDim, nVertex_SolidWall, Coord_bound.data(),
PointIDs.data(), true);
-
+
/*--- Loop over all interior mesh nodes and compute the distances to each
of the no-slip boundary nodes. Store the minimum distance to the wall
for each interior mesh node. ---*/
-
+
if( WallADT.IsEmpty() ) {
-
+
/*--- No solid wall boundary nodes in the entire mesh.
Set the wall distance to zero for all nodes. ---*/
-
+
for (iPoint=0; iPointGetnPoint(); ++iPoint)
- geometry->node[iPoint]->SetWall_Distance(0.0);
+ geometry->nodes->SetWall_Distance(iPoint, 0.0);
}
else {
-
+
/*--- Solid wall boundary nodes are present. Compute the wall
distance for all nodes. ---*/
-
+
for(iPoint=0; iPointGetnPoint(); ++iPoint) {
-
- WallADT.DetermineNearestNode(geometry->node[iPoint]->GetCoord(), dist,
+
+ WallADT.DetermineNearestNode(geometry->nodes->GetCoord(iPoint), dist,
pointID, rankID);
- geometry->node[iPoint]->SetWall_Distance(dist);
-
+ geometry->nodes->SetWall_Distance(iPoint, dist);
+
MaxDistance = max(MaxDistance, dist);
-
+
/*--- To discard points on the surface we use > EPS ---*/
-
+
if (sqrt(dist) > EPS) MinDistance = min(MinDistance, dist);
-
+
}
-
+
MaxDistance_Local = MaxDistance; MaxDistance = 0.0;
MinDistance_Local = MinDistance; MinDistance = 0.0;
-
+
#ifdef HAVE_MPI
SU2_MPI::Allreduce(&MaxDistance_Local, &MaxDistance, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
SU2_MPI::Allreduce(&MinDistance_Local, &MinDistance, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD);
@@ -507,34 +507,34 @@ void CVolumetricMovement::ComputeSolid_Wall_Distance(CGeometry *geometry, CConfi
MaxDistance = MaxDistance_Local;
MinDistance = MinDistance_Local;
#endif
-
+
}
-
+
}
su2double CVolumetricMovement::SetFEAMethodContributions_Elem(CGeometry *geometry, CConfig *config) {
-
+
unsigned short iVar, iDim, nNodes = 0, iNodes, StiffMatrix_nElem = 0;
unsigned long iElem, PointCorners[8];
su2double **StiffMatrix_Elem = NULL, CoordCorners[8][3];
su2double MinVolume = 0.0, MaxVolume = 0.0, MinDistance = 0.0, MaxDistance = 0.0, ElemVolume = 0.0, ElemDistance = 0.0;
-
+
bool Screen_Output = config->GetDeform_Output();
-
+
/*--- Allocate maximum size (quadrilateral and hexahedron) ---*/
-
+
if (nDim == 2) StiffMatrix_nElem = 8;
else StiffMatrix_nElem = 24;
-
+
StiffMatrix_Elem = new su2double* [StiffMatrix_nElem];
for (iVar = 0; iVar < StiffMatrix_nElem; iVar++)
StiffMatrix_Elem[iVar] = new su2double [StiffMatrix_nElem];
-
+
/*--- Compute min volume in the entire mesh. ---*/
-
+
ComputeDeforming_Element_Volume(geometry, MinVolume, MaxVolume, Screen_Output);
if (rank == MASTER_NODE && Screen_Output) cout <<"Min. volume: "<< MinVolume <<", max. volume: "<< MaxVolume <<"." << endl;
-
+
/*--- Compute the distance to the nearest surface if needed
as part of the stiffness calculation.. ---*/
@@ -543,73 +543,73 @@ su2double CVolumetricMovement::SetFEAMethodContributions_Elem(CGeometry *geometr
ComputeSolid_Wall_Distance(geometry, config, MinDistance, MaxDistance);
if (rank == MASTER_NODE && Screen_Output) cout <<"Min. distance: "<< MinDistance <<", max. distance: "<< MaxDistance <<"." << endl;
}
-
+
/*--- Compute contributions from each element by forming the stiffness matrix (FEA) ---*/
-
+
for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
-
+
if (geometry->elem[iElem]->GetVTK_Type() == TRIANGLE) nNodes = 3;
if (geometry->elem[iElem]->GetVTK_Type() == QUADRILATERAL) nNodes = 4;
if (geometry->elem[iElem]->GetVTK_Type() == TETRAHEDRON) nNodes = 4;
if (geometry->elem[iElem]->GetVTK_Type() == PYRAMID) nNodes = 5;
if (geometry->elem[iElem]->GetVTK_Type() == PRISM) nNodes = 6;
if (geometry->elem[iElem]->GetVTK_Type() == HEXAHEDRON) nNodes = 8;
-
+
for (iNodes = 0; iNodes < nNodes; iNodes++) {
PointCorners[iNodes] = geometry->elem[iElem]->GetNode(iNodes);
for (iDim = 0; iDim < nDim; iDim++) {
- CoordCorners[iNodes][iDim] = geometry->node[PointCorners[iNodes]]->GetCoord(iDim);
+ CoordCorners[iNodes][iDim] = geometry->nodes->GetCoord(PointCorners[iNodes], iDim);
}
}
-
+
/*--- Extract Element volume and distance to compute the stiffness ---*/
-
+
ElemVolume = geometry->elem[iElem]->GetVolume();
-
+
if ((config->GetDeform_Stiffness_Type() == SOLID_WALL_DISTANCE)) {
ElemDistance = 0.0;
for (iNodes = 0; iNodes < nNodes; iNodes++)
- ElemDistance += geometry->node[PointCorners[iNodes]]->GetWall_Distance();
+ ElemDistance += geometry->nodes->GetWall_Distance(PointCorners[iNodes]);
ElemDistance = ElemDistance/(su2double)nNodes;
}
-
+
if (nDim == 2) SetFEA_StiffMatrix2D(geometry, config, StiffMatrix_Elem, PointCorners, CoordCorners, nNodes, ElemVolume, ElemDistance);
if (nDim == 3) SetFEA_StiffMatrix3D(geometry, config, StiffMatrix_Elem, PointCorners, CoordCorners, nNodes, ElemVolume, ElemDistance);
-
+
AddFEA_StiffMatrix(geometry, StiffMatrix_Elem, PointCorners, nNodes);
-
+
}
-
+
/*--- Deallocate memory and exit ---*/
-
+
for (iVar = 0; iVar < StiffMatrix_nElem; iVar++)
delete [] StiffMatrix_Elem[iVar];
delete [] StiffMatrix_Elem;
-
+
return MinVolume;
}
su2double CVolumetricMovement::ShapeFunc_Triangle(su2double Xi, su2double Eta, su2double CoordCorners[8][3], su2double DShapeFunction[8][4]) {
-
+
int i, j, k;
su2double c0, c1, xsj;
su2double xs[3][3], ad[3][3];
-
+
/*--- Shape functions ---*/
-
+
DShapeFunction[0][3] = Xi;
DShapeFunction[1][3] = Eta;
DShapeFunction[2][3] = 1-Xi-Eta;
-
+
/*--- dN/d xi, dN/d eta ---*/
-
+
DShapeFunction[0][0] = 1.0; DShapeFunction[0][1] = 0.0;
DShapeFunction[1][0] = 0.0; DShapeFunction[1][1] = 1.0;
DShapeFunction[2][0] = -1.0; DShapeFunction[2][1] = -1.0;
-
+
/*--- Jacobian transformation ---*/
-
+
for (i = 0; i < 2; i++) {
for (j = 0; j < 2; j++) {
xs[i][j] = 0.0;
@@ -618,61 +618,61 @@ su2double CVolumetricMovement::ShapeFunc_Triangle(su2double Xi, su2double Eta, s
}
}
}
-
+
/*--- Adjoint to Jacobian ---*/
-
+
ad[0][0] = xs[1][1];
ad[0][1] = -xs[0][1];
ad[1][0] = -xs[1][0];
ad[1][1] = xs[0][0];
-
+
/*--- Determinant of Jacobian ---*/
-
+
xsj = ad[0][0]*ad[1][1]-ad[0][1]*ad[1][0];
-
+
/*--- Jacobian inverse ---*/
-
+
for (i = 0; i < 2; i++) {
for (j = 0; j < 2; j++) {
xs[i][j] = ad[i][j]/xsj;
}
}
-
+
/*--- Derivatives with repect to global coordinates ---*/
-
+
for (k = 0; k < 3; k++) {
c0 = xs[0][0]*DShapeFunction[k][0]+xs[0][1]*DShapeFunction[k][1]; // dN/dx
c1 = xs[1][0]*DShapeFunction[k][0]+xs[1][1]*DShapeFunction[k][1]; // dN/dy
DShapeFunction[k][0] = c0; // store dN/dx instead of dN/d xi
DShapeFunction[k][1] = c1; // store dN/dy instead of dN/d eta
}
-
+
return xsj;
-
+
}
su2double CVolumetricMovement::ShapeFunc_Quadrilateral(su2double Xi, su2double Eta, su2double CoordCorners[8][3], su2double DShapeFunction[8][4]) {
-
+
int i, j, k;
su2double c0, c1, xsj;
su2double xs[3][3], ad[3][3];
-
+
/*--- Shape functions ---*/
-
+
DShapeFunction[0][3] = 0.25*(1.0-Xi)*(1.0-Eta);
DShapeFunction[1][3] = 0.25*(1.0+Xi)*(1.0-Eta);
DShapeFunction[2][3] = 0.25*(1.0+Xi)*(1.0+Eta);
DShapeFunction[3][3] = 0.25*(1.0-Xi)*(1.0+Eta);
-
+
/*--- dN/d xi, dN/d eta ---*/
-
+
DShapeFunction[0][0] = -0.25*(1.0-Eta); DShapeFunction[0][1] = -0.25*(1.0-Xi);
DShapeFunction[1][0] = 0.25*(1.0-Eta); DShapeFunction[1][1] = -0.25*(1.0+Xi);
DShapeFunction[2][0] = 0.25*(1.0+Eta); DShapeFunction[2][1] = 0.25*(1.0+Xi);
DShapeFunction[3][0] = -0.25*(1.0+Eta); DShapeFunction[3][1] = 0.25*(1.0-Xi);
-
+
/*--- Jacobian transformation ---*/
-
+
for (i = 0; i < 2; i++) {
for (j = 0; j < 2; j++) {
xs[i][j] = 0.0;
@@ -681,61 +681,61 @@ su2double CVolumetricMovement::ShapeFunc_Quadrilateral(su2double Xi, su2double E
}
}
}
-
+
/*--- Adjoint to Jacobian ---*/
-
+
ad[0][0] = xs[1][1];
ad[0][1] = -xs[0][1];
ad[1][0] = -xs[1][0];
ad[1][1] = xs[0][0];
-
+
/*--- Determinant of Jacobian ---*/
-
+
xsj = ad[0][0]*ad[1][1]-ad[0][1]*ad[1][0];
-
+
/*--- Jacobian inverse ---*/
-
+
for (i = 0; i < 2; i++) {
for (j = 0; j < 2; j++) {
xs[i][j] = ad[i][j]/xsj;
}
}
-
+
/*--- Derivatives with repect to global coordinates ---*/
-
+
for (k = 0; k < 4; k++) {
c0 = xs[0][0]*DShapeFunction[k][0]+xs[0][1]*DShapeFunction[k][1]; // dN/dx
c1 = xs[1][0]*DShapeFunction[k][0]+xs[1][1]*DShapeFunction[k][1]; // dN/dy
DShapeFunction[k][0] = c0; // store dN/dx instead of dN/d xi
DShapeFunction[k][1] = c1; // store dN/dy instead of dN/d eta
}
-
+
return xsj;
-
+
}
su2double CVolumetricMovement::ShapeFunc_Tetra(su2double Xi, su2double Eta, su2double Zeta, su2double CoordCorners[8][3], su2double DShapeFunction[8][4]) {
-
+
int i, j, k;
su2double c0, c1, c2, xsj;
su2double xs[3][3], ad[3][3];
-
+
/*--- Shape functions ---*/
-
+
DShapeFunction[0][3] = Xi;
DShapeFunction[1][3] = Zeta;
DShapeFunction[2][3] = 1.0 - Xi - Eta - Zeta;
DShapeFunction[3][3] = Eta;
-
+
/*--- dN/d xi, dN/d eta, dN/d zeta ---*/
-
+
DShapeFunction[0][0] = 1.0; DShapeFunction[0][1] = 0.0; DShapeFunction[0][2] = 0.0;
DShapeFunction[1][0] = 0.0; DShapeFunction[1][1] = 0.0; DShapeFunction[1][2] = 1.0;
DShapeFunction[2][0] = -1.0; DShapeFunction[2][1] = -1.0; DShapeFunction[2][2] = -1.0;
DShapeFunction[3][0] = 0.0; DShapeFunction[3][1] = 1.0; DShapeFunction[3][2] = 0.0;
-
+
/*--- Jacobian transformation ---*/
-
+
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
xs[i][j] = 0.0;
@@ -744,9 +744,9 @@ su2double CVolumetricMovement::ShapeFunc_Tetra(su2double Xi, su2double Eta, su2d
}
}
}
-
+
/*--- Adjoint to Jacobian ---*/
-
+
ad[0][0] = xs[1][1]*xs[2][2]-xs[1][2]*xs[2][1];
ad[0][1] = xs[0][2]*xs[2][1]-xs[0][1]*xs[2][2];
ad[0][2] = xs[0][1]*xs[1][2]-xs[0][2]*xs[1][1];
@@ -756,21 +756,21 @@ su2double CVolumetricMovement::ShapeFunc_Tetra(su2double Xi, su2double Eta, su2d
ad[2][0] = xs[1][0]*xs[2][1]-xs[1][1]*xs[2][0];
ad[2][1] = xs[0][1]*xs[2][0]-xs[0][0]*xs[2][1];
ad[2][2] = xs[0][0]*xs[1][1]-xs[0][1]*xs[1][0];
-
+
/*--- Determinant of Jacobian ---*/
-
+
xsj = xs[0][0]*ad[0][0]+xs[0][1]*ad[1][0]+xs[0][2]*ad[2][0];
-
+
/*--- Jacobian inverse ---*/
-
+
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
xs[i][j] = ad[i][j]/xsj;
}
}
-
+
/*--- Derivatives with repect to global coordinates ---*/
-
+
for (k = 0; k < 4; k++) {
c0 = xs[0][0]*DShapeFunction[k][0]+xs[0][1]*DShapeFunction[k][1]+xs[0][2]*DShapeFunction[k][2]; // dN/dx
c1 = xs[1][0]*DShapeFunction[k][0]+xs[1][1]*DShapeFunction[k][1]+xs[1][2]*DShapeFunction[k][2]; // dN/dy
@@ -779,51 +779,51 @@ su2double CVolumetricMovement::ShapeFunc_Tetra(su2double Xi, su2double Eta, su2d
DShapeFunction[k][1] = c1; // store dN/dy instead of dN/d eta
DShapeFunction[k][2] = c2; // store dN/dz instead of dN/d zeta
}
-
+
return xsj;
-
+
}
su2double CVolumetricMovement::ShapeFunc_Pyram(su2double Xi, su2double Eta, su2double Zeta, su2double CoordCorners[8][3], su2double DShapeFunction[8][4]) {
-
+
int i, j, k;
su2double c0, c1, c2, xsj;
su2double xs[3][3], ad[3][3];
-
+
/*--- Shape functions ---*/
-
+
DShapeFunction[0][3] = 0.25*(-Xi+Eta+Zeta-1.0)*(-Xi-Eta+Zeta-1.0)/(1.0-Zeta);
DShapeFunction[1][3] = 0.25*(-Xi-Eta+Zeta-1.0)*( Xi-Eta+Zeta-1.0)/(1.0-Zeta);
DShapeFunction[2][3] = 0.25*( Xi+Eta+Zeta-1.0)*( Xi-Eta+Zeta-1.0)/(1.0-Zeta);
DShapeFunction[3][3] = 0.25*( Xi+Eta+Zeta-1.0)*(-Xi+Eta+Zeta-1.0)/(1.0-Zeta);
DShapeFunction[4][3] = Zeta;
-
+
/*--- dN/d xi ---*/
-
+
DShapeFunction[0][0] = 0.5*(Zeta-Xi-1.0)/(Zeta-1.0);
DShapeFunction[1][0] = 0.5*Xi/(Zeta-1.0);
DShapeFunction[2][0] = 0.5*(1.0-Zeta-Xi)/(Zeta-1.0);
DShapeFunction[3][0] = DShapeFunction[1][0];
DShapeFunction[4][0] = 0.0;
-
+
/*--- dN/d eta ---*/
-
+
DShapeFunction[0][1] = 0.5*Eta/(Zeta-1.0);
DShapeFunction[1][1] = 0.5*(Zeta-Eta-1.0)/(Zeta-1.0);
DShapeFunction[2][1] = DShapeFunction[0][1];
DShapeFunction[3][1] = 0.5*(1.0-Zeta-Eta)/(Zeta-1.0);
DShapeFunction[4][1] = 0.0;
-
+
/*--- dN/d zeta ---*/
-
+
DShapeFunction[0][2] = 0.25*(-1.0 + 2.0*Zeta - Zeta*Zeta - Eta*Eta + Xi*Xi)/((1.0-Zeta)*(1.0-Zeta));
DShapeFunction[1][2] = 0.25*(-1.0 + 2.0*Zeta - Zeta*Zeta + Eta*Eta - Xi*Xi)/((1.0-Zeta)*(1.0-Zeta));
DShapeFunction[2][2] = DShapeFunction[0][2];
DShapeFunction[3][2] = DShapeFunction[1][2];
DShapeFunction[4][2] = 1.0;
-
+
/*--- Jacobian transformation ---*/
-
+
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
xs[i][j] = 0.0;
@@ -832,9 +832,9 @@ su2double CVolumetricMovement::ShapeFunc_Pyram(su2double Xi, su2double Eta, su2d
}
}
}
-
+
/*--- Adjoint to Jacobian ---*/
-
+
ad[0][0] = xs[1][1]*xs[2][2]-xs[1][2]*xs[2][1];
ad[0][1] = xs[0][2]*xs[2][1]-xs[0][1]*xs[2][2];
ad[0][2] = xs[0][1]*xs[1][2]-xs[0][2]*xs[1][1];
@@ -844,21 +844,21 @@ su2double CVolumetricMovement::ShapeFunc_Pyram(su2double Xi, su2double Eta, su2d
ad[2][0] = xs[1][0]*xs[2][1]-xs[1][1]*xs[2][0];
ad[2][1] = xs[0][1]*xs[2][0]-xs[0][0]*xs[2][1];
ad[2][2] = xs[0][0]*xs[1][1]-xs[0][1]*xs[1][0];
-
+
/*--- Determinant of Jacobian ---*/
-
+
xsj = xs[0][0]*ad[0][0]+xs[0][1]*ad[1][0]+xs[0][2]*ad[2][0];
-
+
/*--- Jacobian inverse ---*/
-
+
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
xs[i][j] = ad[i][j]/xsj;
}
}
-
+
/*--- Derivatives with repect to global coordinates ---*/
-
+
for (k = 0; k < 5; k++) {
c0 = xs[0][0]*DShapeFunction[k][0]+xs[0][1]*DShapeFunction[k][1]+xs[0][2]*DShapeFunction[k][2]; // dN/dx
c1 = xs[1][0]*DShapeFunction[k][0]+xs[1][1]*DShapeFunction[k][1]+xs[1][2]*DShapeFunction[k][2]; // dN/dy
@@ -867,37 +867,37 @@ su2double CVolumetricMovement::ShapeFunc_Pyram(su2double Xi, su2double Eta, su2d
DShapeFunction[k][1] = c1; // store dN/dy instead of dN/d eta
DShapeFunction[k][2] = c2; // store dN/dz instead of dN/d zeta
}
-
+
return xsj;
-
+
}
su2double CVolumetricMovement::ShapeFunc_Prism(su2double Xi, su2double Eta, su2double Zeta, su2double CoordCorners[8][3], su2double DShapeFunction[8][4]) {
-
+
int i, j, k;
su2double c0, c1, c2, xsj;
su2double xs[3][3], ad[3][3];
-
+
/*--- Shape functions ---*/
-
+
DShapeFunction[0][3] = 0.5*Eta*(1.0-Xi);
DShapeFunction[1][3] = 0.5*Zeta*(1.0-Xi);
DShapeFunction[2][3] = 0.5*(1.0-Eta-Zeta)*(1.0-Xi);
DShapeFunction[3][3] = 0.5*Eta*(Xi+1.0);
DShapeFunction[4][3] = 0.5*Zeta*(Xi+1.0);
DShapeFunction[5][3] = 0.5*(1.0-Eta-Zeta)*(Xi+1.0);
-
+
/*--- dN/d Xi, dN/d Eta, dN/d Zeta ---*/
-
+
DShapeFunction[0][0] = -0.5*Eta; DShapeFunction[0][1] = 0.5*(1.0-Xi); DShapeFunction[0][2] = 0.0;
DShapeFunction[1][0] = -0.5*Zeta; DShapeFunction[1][1] = 0.0; DShapeFunction[1][2] = 0.5*(1.0-Xi);
DShapeFunction[2][0] = -0.5*(1.0-Eta-Zeta); DShapeFunction[2][1] = -0.5*(1.0-Xi); DShapeFunction[2][2] = -0.5*(1.0-Xi);
DShapeFunction[3][0] = 0.5*Eta; DShapeFunction[3][1] = 0.5*(Xi+1.0); DShapeFunction[3][2] = 0.0;
DShapeFunction[4][0] = 0.5*Zeta; DShapeFunction[4][1] = 0.0; DShapeFunction[4][2] = 0.5*(Xi+1.0);
DShapeFunction[5][0] = 0.5*(1.0-Eta-Zeta); DShapeFunction[5][1] = -0.5*(Xi+1.0); DShapeFunction[5][2] = -0.5*(Xi+1.0);
-
+
/*--- Jacobian transformation ---*/
-
+
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
xs[i][j] = 0.0;
@@ -906,9 +906,9 @@ su2double CVolumetricMovement::ShapeFunc_Prism(su2double Xi, su2double Eta, su2d
}
}
}
-
+
/*--- Adjoint to Jacobian ---*/
-
+
ad[0][0] = xs[1][1]*xs[2][2]-xs[1][2]*xs[2][1];
ad[0][1] = xs[0][2]*xs[2][1]-xs[0][1]*xs[2][2];
ad[0][2] = xs[0][1]*xs[1][2]-xs[0][2]*xs[1][1];
@@ -918,21 +918,21 @@ su2double CVolumetricMovement::ShapeFunc_Prism(su2double Xi, su2double Eta, su2d
ad[2][0] = xs[1][0]*xs[2][1]-xs[1][1]*xs[2][0];
ad[2][1] = xs[0][1]*xs[2][0]-xs[0][0]*xs[2][1];
ad[2][2] = xs[0][0]*xs[1][1]-xs[0][1]*xs[1][0];
-
+
/*--- Determinant of Jacobian ---*/
-
+
xsj = xs[0][0]*ad[0][0]+xs[0][1]*ad[1][0]+xs[0][2]*ad[2][0];
-
+
/*--- Jacobian inverse ---*/
-
+
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
xs[i][j] = ad[i][j]/xsj;
}
}
-
+
/*--- Derivatives with repect to global coordinates ---*/
-
+
for (k = 0; k < 6; k++) {
c0 = xs[0][0]*DShapeFunction[k][0]+xs[0][1]*DShapeFunction[k][1]+xs[0][2]*DShapeFunction[k][2]; // dN/dx
c1 = xs[1][0]*DShapeFunction[k][0]+xs[1][1]*DShapeFunction[k][1]+xs[1][2]*DShapeFunction[k][2]; // dN/dy
@@ -941,20 +941,20 @@ su2double CVolumetricMovement::ShapeFunc_Prism(su2double Xi, su2double Eta, su2d
DShapeFunction[k][1] = c1; // store dN/dy instead of dN/d eta
DShapeFunction[k][2] = c2; // store dN/dz instead of dN/d zeta
}
-
+
return xsj;
-
+
}
su2double CVolumetricMovement::ShapeFunc_Hexa(su2double Xi, su2double Eta, su2double Zeta, su2double CoordCorners[8][3], su2double DShapeFunction[8][4]) {
-
+
int i, j, k;
su2double c0, c1, c2, xsj;
su2double xs[3][3], ad[3][3];
-
-
+
+
/*--- Shape functions ---*/
-
+
DShapeFunction[0][3] = 0.125*(1.0-Xi)*(1.0-Eta)*(1.0-Zeta);
DShapeFunction[1][3] = 0.125*(1.0+Xi)*(1.0-Eta)*(1.0-Zeta);
DShapeFunction[2][3] = 0.125*(1.0+Xi)*(1.0+Eta)*(1.0-Zeta);
@@ -963,9 +963,9 @@ su2double CVolumetricMovement::ShapeFunc_Hexa(su2double Xi, su2double Eta, su2do
DShapeFunction[5][3] = 0.125*(1.0+Xi)*(1.0-Eta)*(1.0+Zeta);
DShapeFunction[6][3] = 0.125*(1.0+Xi)*(1.0+Eta)*(1.0+Zeta);
DShapeFunction[7][3] = 0.125*(1.0-Xi)*(1.0+Eta)*(1.0+Zeta);
-
+
/*--- dN/d xi ---*/
-
+
DShapeFunction[0][0] = -0.125*(1.0-Eta)*(1.0-Zeta);
DShapeFunction[1][0] = 0.125*(1.0-Eta)*(1.0-Zeta);
DShapeFunction[2][0] = 0.125*(1.0+Eta)*(1.0-Zeta);
@@ -974,9 +974,9 @@ su2double CVolumetricMovement::ShapeFunc_Hexa(su2double Xi, su2double Eta, su2do
DShapeFunction[5][0] = 0.125*(1.0-Eta)*(1.0+Zeta);
DShapeFunction[6][0] = 0.125*(1.0+Eta)*(1.0+Zeta);
DShapeFunction[7][0] = -0.125*(1.0+Eta)*(1.0+Zeta);
-
+
/*--- dN/d eta ---*/
-
+
DShapeFunction[0][1] = -0.125*(1.0-Xi)*(1.0-Zeta);
DShapeFunction[1][1] = -0.125*(1.0+Xi)*(1.0-Zeta);
DShapeFunction[2][1] = 0.125*(1.0+Xi)*(1.0-Zeta);
@@ -985,9 +985,9 @@ su2double CVolumetricMovement::ShapeFunc_Hexa(su2double Xi, su2double Eta, su2do
DShapeFunction[5][1] = -0.125*(1.0+Xi)*(1.0+Zeta);
DShapeFunction[6][1] = 0.125*(1.0+Xi)*(1.0+Zeta);
DShapeFunction[7][1] = 0.125*(1.0-Xi)*(1.0+Zeta);
-
+
/*--- dN/d zeta ---*/
-
+
DShapeFunction[0][2] = -0.125*(1.0-Xi)*(1.0-Eta);
DShapeFunction[1][2] = -0.125*(1.0+Xi)*(1.0-Eta);
DShapeFunction[2][2] = -0.125*(1.0+Xi)*(1.0+Eta);
@@ -996,9 +996,9 @@ su2double CVolumetricMovement::ShapeFunc_Hexa(su2double Xi, su2double Eta, su2do
DShapeFunction[5][2] = 0.125*(1.0+Xi)*(1.0-Eta);
DShapeFunction[6][2] = 0.125*(1.0+Xi)*(1.0+Eta);
DShapeFunction[7][2] = 0.125*(1.0-Xi)*(1.0+Eta);
-
+
/*--- Jacobian transformation ---*/
-
+
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
xs[i][j] = 0.0;
@@ -1007,9 +1007,9 @@ su2double CVolumetricMovement::ShapeFunc_Hexa(su2double Xi, su2double Eta, su2do
}
}
}
-
+
/*--- Adjoint to Jacobian ---*/
-
+
ad[0][0] = xs[1][1]*xs[2][2]-xs[1][2]*xs[2][1];
ad[0][1] = xs[0][2]*xs[2][1]-xs[0][1]*xs[2][2];
ad[0][2] = xs[0][1]*xs[1][2]-xs[0][2]*xs[1][1];
@@ -1019,20 +1019,20 @@ su2double CVolumetricMovement::ShapeFunc_Hexa(su2double Xi, su2double Eta, su2do
ad[2][0] = xs[1][0]*xs[2][1]-xs[1][1]*xs[2][0];
ad[2][1] = xs[0][1]*xs[2][0]-xs[0][0]*xs[2][1];
ad[2][2] = xs[0][0]*xs[1][1]-xs[0][1]*xs[1][0];
-
+
/*--- Determinant of Jacobian ---*/
-
+
xsj = xs[0][0]*ad[0][0]+xs[0][1]*ad[1][0]+xs[0][2]*ad[2][0];
-
+
/*--- Jacobian inverse ---*/
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
xs[i][j] = ad[i][j]/xsj;
}
}
-
+
/*--- Derivatives with repect to global coordinates ---*/
-
+
for (k = 0; k < 8; k++) {
c0 = xs[0][0]*DShapeFunction[k][0]+xs[0][1]*DShapeFunction[k][1]+xs[0][2]*DShapeFunction[k][2]; // dN/dx
c1 = xs[1][0]*DShapeFunction[k][0]+xs[1][1]*DShapeFunction[k][1]+xs[1][2]*DShapeFunction[k][2]; // dN/dy
@@ -1041,294 +1041,294 @@ su2double CVolumetricMovement::ShapeFunc_Hexa(su2double Xi, su2double Eta, su2do
DShapeFunction[k][1] = c1; // store dN/dy instead of dN/d eta
DShapeFunction[k][2] = c2; // store dN/dz instead of dN/d zeta
}
-
+
return xsj;
-
+
}
su2double CVolumetricMovement::GetTriangle_Area(su2double CoordCorners[8][3]) {
-
+
unsigned short iDim;
su2double a[3] = {0.0,0.0,0.0}, b[3] = {0.0,0.0,0.0};
su2double *Coord_0, *Coord_1, *Coord_2, Area;
-
+
Coord_0 = CoordCorners[0];
Coord_1 = CoordCorners[1];
Coord_2 = CoordCorners[2];
-
+
for (iDim = 0; iDim < nDim; iDim++) {
a[iDim] = Coord_0[iDim]-Coord_2[iDim];
b[iDim] = Coord_1[iDim]-Coord_2[iDim];
}
-
+
Area = 0.5*fabs(a[0]*b[1]-a[1]*b[0]);
-
+
return Area;
-
+
}
su2double CVolumetricMovement::GetQuadrilateral_Area(su2double CoordCorners[8][3]) {
-
+
unsigned short iDim;
su2double a[3] = {0.0,0.0,0.0}, b[3] = {0.0,0.0,0.0};
su2double *Coord_0, *Coord_1, *Coord_2, Area;
-
+
Coord_0 = CoordCorners[0];
Coord_1 = CoordCorners[1];
Coord_2 = CoordCorners[2];
-
+
for (iDim = 0; iDim < nDim; iDim++) {
a[iDim] = Coord_0[iDim]-Coord_2[iDim];
b[iDim] = Coord_1[iDim]-Coord_2[iDim];
}
-
+
Area = 0.5*fabs(a[0]*b[1]-a[1]*b[0]);
-
+
Coord_0 = CoordCorners[0];
Coord_1 = CoordCorners[2];
Coord_2 = CoordCorners[3];
-
+
for (iDim = 0; iDim < nDim; iDim++) {
a[iDim] = Coord_0[iDim]-Coord_2[iDim];
b[iDim] = Coord_1[iDim]-Coord_2[iDim];
}
-
+
Area += 0.5*fabs(a[0]*b[1]-a[1]*b[0]);
-
+
return Area;
-
+
}
su2double CVolumetricMovement::GetTetra_Volume(su2double CoordCorners[8][3]) {
-
+
unsigned short iDim;
su2double *Coord_0, *Coord_1, *Coord_2, *Coord_3;
su2double r1[3] = {0.0,0.0,0.0}, r2[3] = {0.0,0.0,0.0}, r3[3] = {0.0,0.0,0.0}, CrossProduct[3] = {0.0,0.0,0.0}, Volume;
-
+
Coord_0 = CoordCorners[0];
Coord_1 = CoordCorners[1];
Coord_2 = CoordCorners[2];
Coord_3 = CoordCorners[3];
-
+
for (iDim = 0; iDim < nDim; iDim++) {
r1[iDim] = Coord_1[iDim] - Coord_0[iDim];
r2[iDim] = Coord_2[iDim] - Coord_0[iDim];
r3[iDim] = Coord_3[iDim] - Coord_0[iDim];
}
-
+
CrossProduct[0] = (r1[1]*r2[2] - r1[2]*r2[1])*r3[0];
CrossProduct[1] = (r1[2]*r2[0] - r1[0]*r2[2])*r3[1];
CrossProduct[2] = (r1[0]*r2[1] - r1[1]*r2[0])*r3[2];
-
+
Volume = fabs(CrossProduct[0] + CrossProduct[1] + CrossProduct[2])/6.0;
-
+
return Volume;
-
+
}
su2double CVolumetricMovement::GetPyram_Volume(su2double CoordCorners[8][3]) {
-
+
unsigned short iDim;
su2double *Coord_0, *Coord_1, *Coord_2, *Coord_3;
su2double r1[3] = {0.0,0.0,0.0}, r2[3] = {0.0,0.0,0.0}, r3[3] = {0.0,0.0,0.0}, CrossProduct[3] = {0.0,0.0,0.0}, Volume;
-
+
Coord_0 = CoordCorners[0];
Coord_1 = CoordCorners[1];
Coord_2 = CoordCorners[2];
Coord_3 = CoordCorners[4];
-
+
for (iDim = 0; iDim < nDim; iDim++) {
r1[iDim] = Coord_1[iDim] - Coord_0[iDim];
r2[iDim] = Coord_2[iDim] - Coord_0[iDim];
r3[iDim] = Coord_3[iDim] - Coord_0[iDim];
}
-
+
CrossProduct[0] = (r1[1]*r2[2] - r1[2]*r2[1])*r3[0];
CrossProduct[1] = (r1[2]*r2[0] - r1[0]*r2[2])*r3[1];
CrossProduct[2] = (r1[0]*r2[1] - r1[1]*r2[0])*r3[2];
-
+
Volume = fabs(CrossProduct[0] + CrossProduct[1] + CrossProduct[2])/6.0;
-
+
Coord_0 = CoordCorners[0];
Coord_1 = CoordCorners[2];
Coord_2 = CoordCorners[3];
Coord_3 = CoordCorners[4];
-
+
for (iDim = 0; iDim < nDim; iDim++) {
r1[iDim] = Coord_1[iDim] - Coord_0[iDim];
r2[iDim] = Coord_2[iDim] - Coord_0[iDim];
r3[iDim] = Coord_3[iDim] - Coord_0[iDim];
}
-
+
CrossProduct[0] = (r1[1]*r2[2] - r1[2]*r2[1])*r3[0];
CrossProduct[1] = (r1[2]*r2[0] - r1[0]*r2[2])*r3[1];
CrossProduct[2] = (r1[0]*r2[1] - r1[1]*r2[0])*r3[2];
-
+
Volume += fabs(CrossProduct[0] + CrossProduct[1] + CrossProduct[2])/6.0;
-
+
return Volume;
}
su2double CVolumetricMovement::GetPrism_Volume(su2double CoordCorners[8][3]) {
-
+
unsigned short iDim;
su2double *Coord_0, *Coord_1, *Coord_2, *Coord_3;
su2double r1[3] = {0.0,0.0,0.0}, r2[3] = {0.0,0.0,0.0}, r3[3] = {0.0,0.0,0.0}, CrossProduct[3] = {0.0,0.0,0.0}, Volume;
-
+
Coord_0 = CoordCorners[0];
Coord_1 = CoordCorners[2];
Coord_2 = CoordCorners[1];
Coord_3 = CoordCorners[5];
-
+
for (iDim = 0; iDim < nDim; iDim++) {
r1[iDim] = Coord_1[iDim] - Coord_0[iDim];
r2[iDim] = Coord_2[iDim] - Coord_0[iDim];
r3[iDim] = Coord_3[iDim] - Coord_0[iDim];
}
-
+
CrossProduct[0] = (r1[1]*r2[2] - r1[2]*r2[1])*r3[0];
CrossProduct[1] = (r1[2]*r2[0] - r1[0]*r2[2])*r3[1];
CrossProduct[2] = (r1[0]*r2[1] - r1[1]*r2[0])*r3[2];
-
+
Volume = fabs(CrossProduct[0] + CrossProduct[1] + CrossProduct[2])/6.0;
-
+
Coord_0 = CoordCorners[0];
Coord_1 = CoordCorners[5];
Coord_2 = CoordCorners[1];
Coord_3 = CoordCorners[4];
-
+
for (iDim = 0; iDim < nDim; iDim++) {
r1[iDim] = Coord_1[iDim] - Coord_0[iDim];
r2[iDim] = Coord_2[iDim] - Coord_0[iDim];
r3[iDim] = Coord_3[iDim] - Coord_0[iDim];
}
-
+
CrossProduct[0] = (r1[1]*r2[2] - r1[2]*r2[1])*r3[0];
CrossProduct[1] = (r1[2]*r2[0] - r1[0]*r2[2])*r3[1];
CrossProduct[2] = (r1[0]*r2[1] - r1[1]*r2[0])*r3[2];
-
+
Volume += fabs(CrossProduct[0] + CrossProduct[1] + CrossProduct[2])/6.0;
-
+
Coord_0 = CoordCorners[0];
Coord_1 = CoordCorners[5];
Coord_2 = CoordCorners[4];
Coord_3 = CoordCorners[3];
-
+
for (iDim = 0; iDim < nDim; iDim++) {
r1[iDim] = Coord_1[iDim] - Coord_0[iDim];
r2[iDim] = Coord_2[iDim] - Coord_0[iDim];
r3[iDim] = Coord_3[iDim] - Coord_0[iDim];
}
-
+
CrossProduct[0] = (r1[1]*r2[2] - r1[2]*r2[1])*r3[0];
CrossProduct[1] = (r1[2]*r2[0] - r1[0]*r2[2])*r3[1];
CrossProduct[2] = (r1[0]*r2[1] - r1[1]*r2[0])*r3[2];
-
+
Volume += fabs(CrossProduct[0] + CrossProduct[1] + CrossProduct[2])/6.0;
-
+
return Volume;
}
su2double CVolumetricMovement::GetHexa_Volume(su2double CoordCorners[8][3]) {
-
+
unsigned short iDim;
su2double *Coord_0, *Coord_1, *Coord_2, *Coord_3;
su2double r1[3] = {0.0,0.0,0.0}, r2[3] = {0.0,0.0,0.0}, r3[3] = {0.0,0.0,0.0}, CrossProduct[3] = {0.0,0.0,0.0}, Volume;
-
+
Coord_0 = CoordCorners[0];
Coord_1 = CoordCorners[1];
Coord_2 = CoordCorners[2];
Coord_3 = CoordCorners[5];
-
+
for (iDim = 0; iDim < nDim; iDim++) {
r1[iDim] = Coord_1[iDim] - Coord_0[iDim];
r2[iDim] = Coord_2[iDim] - Coord_0[iDim];
r3[iDim] = Coord_3[iDim] - Coord_0[iDim];
}
-
+
CrossProduct[0] = (r1[1]*r2[2] - r1[2]*r2[1])*r3[0];
CrossProduct[1] = (r1[2]*r2[0] - r1[0]*r2[2])*r3[1];
CrossProduct[2] = (r1[0]*r2[1] - r1[1]*r2[0])*r3[2];
-
+
Volume = fabs(CrossProduct[0] + CrossProduct[1] + CrossProduct[2])/6.0;
-
+
Coord_0 = CoordCorners[0];
Coord_1 = CoordCorners[2];
Coord_2 = CoordCorners[7];
Coord_3 = CoordCorners[5];
-
+
for (iDim = 0; iDim < nDim; iDim++) {
r1[iDim] = Coord_1[iDim] - Coord_0[iDim];
r2[iDim] = Coord_2[iDim] - Coord_0[iDim];
r3[iDim] = Coord_3[iDim] - Coord_0[iDim];
}
-
+
CrossProduct[0] = (r1[1]*r2[2] - r1[2]*r2[1])*r3[0];
CrossProduct[1] = (r1[2]*r2[0] - r1[0]*r2[2])*r3[1];
CrossProduct[2] = (r1[0]*r2[1] - r1[1]*r2[0])*r3[2];
-
+
Volume += fabs(CrossProduct[0] + CrossProduct[1] + CrossProduct[2])/6.0;
-
+
Coord_0 = CoordCorners[0];
Coord_1 = CoordCorners[2];
Coord_2 = CoordCorners[3];
Coord_3 = CoordCorners[7];
-
+
for (iDim = 0; iDim < nDim; iDim++) {
r1[iDim] = Coord_1[iDim] - Coord_0[iDim];
r2[iDim] = Coord_2[iDim] - Coord_0[iDim];
r3[iDim] = Coord_3[iDim] - Coord_0[iDim];
}
-
+
CrossProduct[0] = (r1[1]*r2[2] - r1[2]*r2[1])*r3[0];
CrossProduct[1] = (r1[2]*r2[0] - r1[0]*r2[2])*r3[1];
CrossProduct[2] = (r1[0]*r2[1] - r1[1]*r2[0])*r3[2];
-
+
Volume += fabs(CrossProduct[0] + CrossProduct[1] + CrossProduct[2])/6.0;
-
+
Coord_0 = CoordCorners[0];
Coord_1 = CoordCorners[5];
Coord_2 = CoordCorners[7];
Coord_3 = CoordCorners[4];
-
+
for (iDim = 0; iDim < nDim; iDim++) {
r1[iDim] = Coord_1[iDim] - Coord_0[iDim];
r2[iDim] = Coord_2[iDim] - Coord_0[iDim];
r3[iDim] = Coord_3[iDim] - Coord_0[iDim];
}
-
+
CrossProduct[0] = (r1[1]*r2[2] - r1[2]*r2[1])*r3[0];
CrossProduct[1] = (r1[2]*r2[0] - r1[0]*r2[2])*r3[1];
CrossProduct[2] = (r1[0]*r2[1] - r1[1]*r2[0])*r3[2];
-
+
Volume += fabs(CrossProduct[0] + CrossProduct[1] + CrossProduct[2])/6.0;
-
+
Coord_0 = CoordCorners[2];
Coord_1 = CoordCorners[7];
Coord_2 = CoordCorners[5];
Coord_3 = CoordCorners[6];
-
+
for (iDim = 0; iDim < nDim; iDim++) {
r1[iDim] = Coord_1[iDim] - Coord_0[iDim];
r2[iDim] = Coord_2[iDim] - Coord_0[iDim];
r3[iDim] = Coord_3[iDim] - Coord_0[iDim];
}
-
+
CrossProduct[0] = (r1[1]*r2[2] - r1[2]*r2[1])*r3[0];
CrossProduct[1] = (r1[2]*r2[0] - r1[0]*r2[2])*r3[1];
CrossProduct[2] = (r1[0]*r2[1] - r1[1]*r2[0])*r3[2];
-
+
Volume += fabs(CrossProduct[0] + CrossProduct[1] + CrossProduct[2])/6.0;
-
+
return Volume;
}
void CVolumetricMovement::SetFEA_StiffMatrix2D(CGeometry *geometry, CConfig *config, su2double **StiffMatrix_Elem, unsigned long PointCorners[8], su2double CoordCorners[8][3],
unsigned short nNodes, su2double ElemVolume, su2double ElemDistance) {
-
+
su2double B_Matrix[3][8], D_Matrix[3][3], Aux_Matrix[8][3];
su2double Xi = 0.0, Eta = 0.0, Det = 0.0, E = 1/EPS, Lambda = 0.0, Mu = 0.0, Nu = 0.0;
unsigned short iNode, iVar, jVar, kVar, iGauss, nGauss = 0;
@@ -1336,25 +1336,25 @@ void CVolumetricMovement::SetFEA_StiffMatrix2D(CGeometry *geometry, CConfig *con
{0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.0}};
su2double Location[4][3], Weight[4];
unsigned short nVar = geometry->GetnDim();
-
+
for (iVar = 0; iVar < nNodes*nVar; iVar++) {
for (jVar = 0; jVar < nNodes*nVar; jVar++) {
StiffMatrix_Elem[iVar][jVar] = 0.0;
}
}
-
+
/*--- Integration formulae from "Shape functions and points of
integration of the Résumé" by Josselin DELMAS (2013) ---*/
-
+
/*--- Triangle. Nodes of numerical integration at 1 point (order 1). ---*/
-
+
if (nNodes == 3) {
nGauss = 1;
Location[0][0] = 0.333333333333333; Location[0][1] = 0.333333333333333; Weight[0] = 0.5;
}
-
+
/*--- Quadrilateral. Nodes of numerical integration at 4 points (order 2). ---*/
-
+
if (nNodes == 4) {
nGauss = 4;
Location[0][0] = -0.577350269189626; Location[0][1] = -0.577350269189626; Weight[0] = 1.0;
@@ -1362,49 +1362,49 @@ void CVolumetricMovement::SetFEA_StiffMatrix2D(CGeometry *geometry, CConfig *con
Location[2][0] = 0.577350269189626; Location[2][1] = 0.577350269189626; Weight[2] = 1.0;
Location[3][0] = -0.577350269189626; Location[3][1] = 0.577350269189626; Weight[3] = 1.0;
}
-
+
for (iGauss = 0; iGauss < nGauss; iGauss++) {
-
+
Xi = Location[iGauss][0]; Eta = Location[iGauss][1];
-
+
if (nNodes == 3) Det = ShapeFunc_Triangle(Xi, Eta, CoordCorners, DShapeFunction);
if (nNodes == 4) Det = ShapeFunc_Quadrilateral(Xi, Eta, CoordCorners, DShapeFunction);
-
+
/*--- Compute the B Matrix ---*/
-
+
for (iVar = 0; iVar < 3; iVar++)
for (jVar = 0; jVar < nNodes*nVar; jVar++)
B_Matrix[iVar][jVar] = 0.0;
-
+
for (iNode = 0; iNode < nNodes; iNode++) {
B_Matrix[0][0+iNode*nVar] = DShapeFunction[iNode][0];
B_Matrix[1][1+iNode*nVar] = DShapeFunction[iNode][1];
-
+
B_Matrix[2][0+iNode*nVar] = DShapeFunction[iNode][1];
B_Matrix[2][1+iNode*nVar] = DShapeFunction[iNode][0];
}
-
+
/*--- Impose a type of stiffness for each element ---*/
-
+
switch (config->GetDeform_Stiffness_Type()) {
case INVERSE_VOLUME: E = 1.0 / ElemVolume; break;
case SOLID_WALL_DISTANCE: E = 1.0 / ElemDistance; break;
case CONSTANT_STIFFNESS: E = 1.0 / EPS; break;
}
-
+
Nu = config->GetDeform_Coeff();
Mu = E / (2.0*(1.0 + Nu));
Lambda = Nu*E/((1.0+Nu)*(1.0-2.0*Nu));
-
+
/*--- Compute the D Matrix (for plane strain and 3-D)---*/
-
+
D_Matrix[0][0] = Lambda + 2.0*Mu; D_Matrix[0][1] = Lambda; D_Matrix[0][2] = 0.0;
D_Matrix[1][0] = Lambda; D_Matrix[1][1] = Lambda + 2.0*Mu; D_Matrix[1][2] = 0.0;
D_Matrix[2][0] = 0.0; D_Matrix[2][1] = 0.0; D_Matrix[2][2] = Mu;
-
-
+
+
/*--- Compute the BT.D Matrix ---*/
-
+
for (iVar = 0; iVar < nNodes*nVar; iVar++) {
for (jVar = 0; jVar < 3; jVar++) {
Aux_Matrix[iVar][jVar] = 0.0;
@@ -1412,10 +1412,10 @@ void CVolumetricMovement::SetFEA_StiffMatrix2D(CGeometry *geometry, CConfig *con
Aux_Matrix[iVar][jVar] += B_Matrix[kVar][iVar]*D_Matrix[kVar][jVar];
}
}
-
+
/*--- Compute the BT.D.B Matrix (stiffness matrix), and add to the original
matrix using Gauss integration ---*/
-
+
for (iVar = 0; iVar < nNodes*nVar; iVar++) {
for (jVar = 0; jVar < nNodes*nVar; jVar++) {
for (kVar = 0; kVar < 3; kVar++) {
@@ -1423,14 +1423,14 @@ void CVolumetricMovement::SetFEA_StiffMatrix2D(CGeometry *geometry, CConfig *con
}
}
}
-
+
}
-
+
}
void CVolumetricMovement::SetFEA_StiffMatrix3D(CGeometry *geometry, CConfig *config, su2double **StiffMatrix_Elem, unsigned long PointCorners[8], su2double CoordCorners[8][3],
unsigned short nNodes, su2double ElemVolume, su2double ElemDistance) {
-
+
su2double B_Matrix[6][24], D_Matrix[6][6] = {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}}, Aux_Matrix[24][6];
su2double Xi = 0.0, Eta = 0.0, Zeta = 0.0, Det = 0.0, Mu = 0.0, E = 0.0, Lambda = 0.0, Nu = 0.0;
@@ -1439,25 +1439,25 @@ void CVolumetricMovement::SetFEA_StiffMatrix3D(CGeometry *geometry, CConfig *con
{0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.0}};
su2double Location[8][3], Weight[8];
unsigned short nVar = geometry->GetnDim();
-
+
for (iVar = 0; iVar < nNodes*nVar; iVar++) {
for (jVar = 0; jVar < nNodes*nVar; jVar++) {
StiffMatrix_Elem[iVar][jVar] = 0.0;
}
}
-
+
/*--- Integration formulae from "Shape functions and points of
integration of the Résumé" by Josselin Delmas (2013) ---*/
-
+
/*--- Tetrahedrons. Nodes of numerical integration at 1 point (order 1). ---*/
-
+
if (nNodes == 4) {
nGauss = 1;
Location[0][0] = 0.25; Location[0][1] = 0.25; Location[0][2] = 0.25; Weight[0] = 0.166666666666666;
}
-
+
/*--- Pyramids. Nodes numerical integration at 5 points. ---*/
-
+
if (nNodes == 5) {
nGauss = 5;
Location[0][0] = 0.5; Location[0][1] = 0.0; Location[0][2] = 0.1531754163448146; Weight[0] = 0.133333333333333;
@@ -1466,9 +1466,9 @@ void CVolumetricMovement::SetFEA_StiffMatrix3D(CGeometry *geometry, CConfig *con
Location[3][0] = 0.0; Location[3][1] = -0.5; Location[3][2] = 0.1531754163448146; Weight[3] = 0.133333333333333;
Location[4][0] = 0.0; Location[4][1] = 0.0; Location[4][2] = 0.6372983346207416; Weight[4] = 0.133333333333333;
}
-
+
/*--- Prism. Nodes of numerical integration at 6 points (order 3 in Xi, order 2 in Eta and Mu ). ---*/
-
+
if (nNodes == 6) {
nGauss = 6;
Location[0][0] = -0.577350269189626; Location[0][1] = 0.166666666666667; Location[0][2] = 0.166666666666667; Weight[0] = 0.166666666666667;
@@ -1478,9 +1478,9 @@ void CVolumetricMovement::SetFEA_StiffMatrix3D(CGeometry *geometry, CConfig *con
Location[4][0] = 0.577350269189626; Location[4][1] = 0.666666666666667; Location[4][2] = 0.166666666666667; Weight[4] = 0.166666666666667;
Location[5][0] = 0.577350269189626; Location[5][1] = 0.166666666666667; Location[5][2] = 0.666666666666667; Weight[5] = 0.166666666666667;
}
-
+
/*--- Hexahedrons. Nodes of numerical integration at 6 points (order 3). ---*/
-
+
if (nNodes == 8) {
nGauss = 8;
Location[0][0] = -0.577350269189626; Location[0][1] = -0.577350269189626; Location[0][2] = -0.577350269189626; Weight[0] = 1.0;
@@ -1492,61 +1492,61 @@ void CVolumetricMovement::SetFEA_StiffMatrix3D(CGeometry *geometry, CConfig *con
Location[6][0] = 0.577350269189626; Location[6][1] = 0.577350269189626; Location[6][2] = -0.577350269189626; Weight[6] = 1.0;
Location[7][0] = 0.577350269189626; Location[7][1] = 0.577350269189626; Location[7][2] = 0.577350269189626; Weight[7] = 1.0;
}
-
+
for (iGauss = 0; iGauss < nGauss; iGauss++) {
-
+
Xi = Location[iGauss][0]; Eta = Location[iGauss][1]; Zeta = Location[iGauss][2];
-
+
if (nNodes == 4) Det = ShapeFunc_Tetra(Xi, Eta, Zeta, CoordCorners, DShapeFunction);
if (nNodes == 5) Det = ShapeFunc_Pyram(Xi, Eta, Zeta, CoordCorners, DShapeFunction);
if (nNodes == 6) Det = ShapeFunc_Prism(Xi, Eta, Zeta, CoordCorners, DShapeFunction);
if (nNodes == 8) Det = ShapeFunc_Hexa(Xi, Eta, Zeta, CoordCorners, DShapeFunction);
-
+
/*--- Compute the B Matrix ---*/
-
+
for (iVar = 0; iVar < 6; iVar++)
for (jVar = 0; jVar < nNodes*nVar; jVar++)
B_Matrix[iVar][jVar] = 0.0;
-
+
for (iNode = 0; iNode < nNodes; iNode++) {
B_Matrix[0][0+iNode*nVar] = DShapeFunction[iNode][0];
B_Matrix[1][1+iNode*nVar] = DShapeFunction[iNode][1];
B_Matrix[2][2+iNode*nVar] = DShapeFunction[iNode][2];
-
+
B_Matrix[3][0+iNode*nVar] = DShapeFunction[iNode][1];
B_Matrix[3][1+iNode*nVar] = DShapeFunction[iNode][0];
-
+
B_Matrix[4][1+iNode*nVar] = DShapeFunction[iNode][2];
B_Matrix[4][2+iNode*nVar] = DShapeFunction[iNode][1];
-
+
B_Matrix[5][0+iNode*nVar] = DShapeFunction[iNode][2];
B_Matrix[5][2+iNode*nVar] = DShapeFunction[iNode][0];
}
-
+
/*--- Impose a type of stiffness for each element ---*/
-
+
switch (config->GetDeform_Stiffness_Type()) {
case INVERSE_VOLUME: E = 1.0 / ElemVolume; break;
case SOLID_WALL_DISTANCE: E = 1.0 / ElemDistance; break;
case CONSTANT_STIFFNESS: E = 1.0 / EPS; break;
}
-
+
Nu = config->GetDeform_Coeff();
Mu = E / (2.0*(1.0 + Nu));
Lambda = Nu*E/((1.0+Nu)*(1.0-2.0*Nu));
-
+
/*--- Compute the D Matrix (for plane strain and 3-D)---*/
-
+
D_Matrix[0][0] = Lambda + 2.0*Mu; D_Matrix[0][1] = Lambda; D_Matrix[0][2] = Lambda;
D_Matrix[1][0] = Lambda; D_Matrix[1][1] = Lambda + 2.0*Mu; D_Matrix[1][2] = Lambda;
D_Matrix[2][0] = Lambda; D_Matrix[2][1] = Lambda; D_Matrix[2][2] = Lambda + 2.0*Mu;
D_Matrix[3][3] = Mu;
D_Matrix[4][4] = Mu;
D_Matrix[5][5] = Mu;
-
-
+
+
/*--- Compute the BT.D Matrix ---*/
-
+
for (iVar = 0; iVar < nNodes*nVar; iVar++) {
for (jVar = 0; jVar < 6; jVar++) {
Aux_Matrix[iVar][jVar] = 0.0;
@@ -1554,10 +1554,10 @@ void CVolumetricMovement::SetFEA_StiffMatrix3D(CGeometry *geometry, CConfig *con
Aux_Matrix[iVar][jVar] += B_Matrix[kVar][iVar]*D_Matrix[kVar][jVar];
}
}
-
+
/*--- Compute the BT.D.B Matrix (stiffness matrix), and add to the original
matrix using Gauss integration ---*/
-
+
for (iVar = 0; iVar < nNodes*nVar; iVar++) {
for (jVar = 0; jVar < nNodes*nVar; jVar++) {
for (kVar = 0; kVar < 6; kVar++) {
@@ -1565,32 +1565,32 @@ void CVolumetricMovement::SetFEA_StiffMatrix3D(CGeometry *geometry, CConfig *con
}
}
}
-
+
}
-
+
}
void CVolumetricMovement::AddFEA_StiffMatrix(CGeometry *geometry, su2double **StiffMatrix_Elem, unsigned long PointCorners[8], unsigned short nNodes) {
-
+
unsigned short iVar, jVar, iDim, jDim;
-
+
unsigned short nVar = geometry->GetnDim();
su2double **StiffMatrix_Node;
StiffMatrix_Node = new su2double* [nVar];
for (iVar = 0; iVar < nVar; iVar++)
StiffMatrix_Node[iVar] = new su2double [nVar];
-
+
for (iVar = 0; iVar < nVar; iVar++)
for (jVar = 0; jVar < nVar; jVar++)
StiffMatrix_Node[iVar][jVar] = 0.0;
-
+
/*--- Transform the stiffness matrix for the hexahedral element into the
contributions for the individual nodes relative to each other. ---*/
-
+
for (iVar = 0; iVar < nNodes; iVar++) {
for (jVar = 0; jVar < nNodes; jVar++) {
-
+
for (iDim = 0; iDim < nVar; iDim++) {
for (jDim = 0; jDim < nVar; jDim++) {
StiffMatrix_Node[iDim][jDim] = StiffMatrix_Elem[(iVar*nVar)+iDim][(jVar*nVar)+jDim];
@@ -1598,39 +1598,39 @@ void CVolumetricMovement::AddFEA_StiffMatrix(CGeometry *geometry, su2double **St
}
StiffMatrix.AddBlock(PointCorners[iVar], PointCorners[jVar], StiffMatrix_Node);
-
+
}
}
-
+
/*--- Deallocate memory and exit ---*/
-
+
for (iVar = 0; iVar < nVar; iVar++)
delete [] StiffMatrix_Node[iVar];
delete [] StiffMatrix_Node;
-
+
}
void CVolumetricMovement::SetBoundaryDisplacements(CGeometry *geometry, CConfig *config) {
-
+
unsigned short iDim, nDim = geometry->GetnDim(), iMarker, axis = 0;
unsigned long iPoint, total_index, iVertex;
su2double *VarCoord, MeanCoord[3] = {0.0,0.0,0.0}, VarIncrement = 1.0;
-
+
/*--- Get the SU2 module. SU2_CFD will use this routine for dynamically
deforming meshes (MARKER_MOVING), while SU2_DEF will use it for deforming
meshes after imposing design variable surface deformations (DV_MARKER). ---*/
-
+
unsigned short Kind_SU2 = config->GetKind_SU2();
-
+
/*--- If requested (no by default) impose the surface deflections in
increments and solve the grid deformation equations iteratively with
successive small deformations. ---*/
-
+
VarIncrement = 1.0/((su2double)config->GetGridDef_Nonlinear_Iter());
-
+
/*--- As initialization, set to zero displacements of all the surfaces except the symmetry
plane, internal and periodic bc the receive boundaries and periodic boundaries. ---*/
-
+
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (((config->GetMarker_All_KindBC(iMarker) != SYMMETRY_PLANE) &&
(config->GetMarker_All_KindBC(iMarker) != SEND_RECEIVE) &&
@@ -1650,7 +1650,7 @@ void CVolumetricMovement::SetBoundaryDisplacements(CGeometry *geometry, CConfig
/*--- Set the known displacements, note that some points of the moving surfaces
could be on on the symmetry plane, we should specify DeleteValsRowi again (just in case) ---*/
-
+
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (((config->GetMarker_All_Moving(iMarker) == YES) && (Kind_SU2 == SU2_CFD)) ||
((config->GetMarker_All_DV(iMarker) == YES) && (Kind_SU2 == SU2_DEF)) ||
@@ -1668,23 +1668,23 @@ void CVolumetricMovement::SetBoundaryDisplacements(CGeometry *geometry, CConfig
}
}
}
-
+
/*--- Set to zero displacements of the normal component for the symmetry plane condition ---*/
-
+
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) ) {
-
+
su2double *Coord_0 = NULL;
for (iDim = 0; iDim < nDim; iDim++) MeanCoord[iDim] = 0.0;
-
+
/*--- Store the coord of the first point to help identify the axis. ---*/
-
+
iPoint = geometry->vertex[iMarker][0]->GetNode();
- Coord_0 = geometry->node[iPoint]->GetCoord();
-
+ Coord_0 = geometry->nodes->GetCoord(iPoint);
+
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- VarCoord = geometry->node[iPoint]->GetCoord();
+ VarCoord = geometry->nodes->GetCoord(iPoint);
for (iDim = 0; iDim < nDim; iDim++)
MeanCoord[iDim] += (VarCoord[iDim]-Coord_0[iDim])*(VarCoord[iDim]-Coord_0[iDim]);
}
@@ -1698,7 +1698,7 @@ void CVolumetricMovement::SetBoundaryDisplacements(CGeometry *geometry, CConfig
if ((MeanCoord[0] <= MeanCoord[1]) ) axis = 0;
if ((MeanCoord[1] <= MeanCoord[0]) ) axis = 1;
}
-
+
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
total_index = iPoint*nDim + axis;
@@ -1708,9 +1708,9 @@ void CVolumetricMovement::SetBoundaryDisplacements(CGeometry *geometry, CConfig
}
}
}
-
+
/*--- Don't move the nearfield plane ---*/
-
+
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (config->GetMarker_All_KindBC(iMarker) == NEARFIELD_BOUNDARY) {
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
@@ -1726,7 +1726,7 @@ void CVolumetricMovement::SetBoundaryDisplacements(CGeometry *geometry, CConfig
}
/*--- Move the FSI interfaces ---*/
-
+
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if ((config->GetMarker_All_ZoneInterface(iMarker) == YES) && (Kind_SU2 == SU2_CFD)) {
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
@@ -1791,10 +1791,10 @@ void CVolumetricMovement::UpdateGridCoord_Derivatives(CGeometry *geometry, CConf
new_coord[0] = 0.0; new_coord[1] = 0.0; new_coord[2] = 0.0;
for (iDim = 0; iDim < nDim; iDim++) {
total_index = iPoint*nDim + iDim;
- new_coord[iDim] = geometry->node[iPoint]->GetCoord(iDim);
+ new_coord[iDim] = geometry->nodes->GetCoord(iPoint, iDim);
SU2_TYPE::SetDerivative(new_coord[iDim], SU2_TYPE::GetValue(LinSysSol[total_index]));
}
- geometry->node[iPoint]->SetCoord(new_coord);
+ geometry->nodes->SetCoord(iPoint, new_coord);
}
} else if (Kind_SU2 == SU2_DOT) {
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
@@ -1805,7 +1805,7 @@ void CVolumetricMovement::UpdateGridCoord_Derivatives(CGeometry *geometry, CConf
(config->GetMarker_All_DV(iMarker) == YES)) {
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
for (iDim = 0; iDim < nDim; iDim++) {
total_index = iPoint*nDim + iDim;
geometry->SetSensitivity(iPoint,iDim, LinSysSol[total_index]);
@@ -1815,40 +1815,40 @@ void CVolumetricMovement::UpdateGridCoord_Derivatives(CGeometry *geometry, CConf
}
}
}
-
+
delete [] new_coord;
}
void CVolumetricMovement::SetDomainDisplacements(CGeometry *geometry, CConfig *config) {
-
+
unsigned short iDim, nDim = geometry->GetnDim();
unsigned long iPoint, total_index;
su2double *Coord, *MinCoordValues, *MaxCoordValues, *Hold_GridFixed_Coord;
-
+
if (config->GetHold_GridFixed()) {
-
+
MinCoordValues = new su2double [nDim];
MaxCoordValues = new su2double [nDim];
-
+
for (iDim = 0; iDim < nDim; iDim++) {
MinCoordValues[iDim] = 0.0;
MaxCoordValues[iDim] = 0.0;
}
-
+
Hold_GridFixed_Coord = config->GetHold_GridFixed_Coord();
-
+
MinCoordValues[0] = Hold_GridFixed_Coord[0];
MinCoordValues[1] = Hold_GridFixed_Coord[1];
MinCoordValues[2] = Hold_GridFixed_Coord[2];
MaxCoordValues[0] = Hold_GridFixed_Coord[3];
MaxCoordValues[1] = Hold_GridFixed_Coord[4];
MaxCoordValues[2] = Hold_GridFixed_Coord[5];
-
+
/*--- Set to zero displacements of all the points that are not going to be moved
except the surfaces ---*/
-
+
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) {
- Coord = geometry->node[iPoint]->GetCoord();
+ Coord = geometry->nodes->GetCoord(iPoint);
for (iDim = 0; iDim < nDim; iDim++) {
if ((Coord[iDim] < MinCoordValues[iDim]) || (Coord[iDim] > MaxCoordValues[iDim])) {
total_index = iPoint*nDim + iDim;
@@ -1858,18 +1858,18 @@ void CVolumetricMovement::SetDomainDisplacements(CGeometry *geometry, CConfig *c
}
}
}
-
+
delete [] MinCoordValues;
delete [] MaxCoordValues;
-
+
}
-
- /*--- Don't move the volume grid outside the limits based
+
+ /*--- Don't move the volume grid outside the limits based
on the distance to the solid surface ---*/
-
+
if (config->GetDeform_Limit() < 1E6) {
for (iPoint = 0; iPoint < nPoint; iPoint++) {
- if (geometry->node[iPoint]->GetWall_Distance() >= config->GetDeform_Limit()) {
+ if (geometry->nodes->GetWall_Distance(iPoint) >= config->GetDeform_Limit()) {
for (iDim = 0; iDim < nDim; iDim++) {
total_index = iPoint*nDim + iDim;
LinSysRes[total_index] = 0.0;
@@ -1879,14 +1879,14 @@ void CVolumetricMovement::SetDomainDisplacements(CGeometry *geometry, CConfig *c
}
}
}
-
+
}
void CVolumetricMovement::Rigid_Rotation(CGeometry *geometry, CConfig *config,
unsigned short iZone, unsigned long iter) {
-
+
/*--- Local variables ---*/
- unsigned short iDim, nDim;
+ unsigned short iDim, nDim;
unsigned long iPoint;
su2double r[3] = {0.0,0.0,0.0}, rotCoord[3] = {0.0,0.0,0.0}, *Coord;
su2double Center[3] = {0.0,0.0,0.0}, Omega[3] = {0.0,0.0,0.0}, Lref;
@@ -1913,9 +1913,9 @@ void CVolumetricMovement::Rigid_Rotation(CGeometry *geometry, CConfig *config,
/*--- No rotation at all for the first direct solution ---*/
if (iter == 0) dt = 0;
}
-
+
/*--- Center of rotation & angular velocity vector from config ---*/
-
+
for (iDim = 0; iDim < 3; iDim++){
Center[iDim] = config->GetMotion_Origin(iDim);
Omega[iDim] = config->GetRotation_Rate(iDim)/config->GetOmega_Ref();
@@ -1928,7 +1928,7 @@ void CVolumetricMovement::Rigid_Rotation(CGeometry *geometry, CConfig *config,
period /= config->GetTime_Ref();
dt = period * (su2double)iter/(su2double)(config->GetnTimeInstances());
}
-
+
/*--- Compute delta change in the angle about the x, y, & z axes. ---*/
dtheta = Omega[0]*dt;
@@ -1939,112 +1939,112 @@ void CVolumetricMovement::Rigid_Rotation(CGeometry *geometry, CConfig *config,
cout << " Angular velocity: (" << Omega[0] << ", " << Omega[1];
cout << ", " << Omega[2] << ") rad/s." << endl;
}
-
+
/*--- Store angles separately for clarity. Compute sines/cosines. ---*/
-
+
cosTheta = cos(dtheta); cosPhi = cos(dphi); cosPsi = cos(dpsi);
sinTheta = sin(dtheta); sinPhi = sin(dphi); sinPsi = sin(dpsi);
-
+
/*--- Compute the rotation matrix. Note that the implicit
ordering is rotation about the x-axis, y-axis, then z-axis. ---*/
-
+
rotMatrix[0][0] = cosPhi*cosPsi;
rotMatrix[1][0] = cosPhi*sinPsi;
rotMatrix[2][0] = -sinPhi;
-
+
rotMatrix[0][1] = sinTheta*sinPhi*cosPsi - cosTheta*sinPsi;
rotMatrix[1][1] = sinTheta*sinPhi*sinPsi + cosTheta*cosPsi;
rotMatrix[2][1] = sinTheta*cosPhi;
-
+
rotMatrix[0][2] = cosTheta*sinPhi*cosPsi + sinTheta*sinPsi;
rotMatrix[1][2] = cosTheta*sinPhi*sinPsi - sinTheta*cosPsi;
rotMatrix[2][2] = cosTheta*cosPhi;
-
+
/*--- Loop over and rotate each node in the volume mesh ---*/
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) {
-
+
/*--- Coordinates of the current point ---*/
- Coord = geometry->node[iPoint]->GetCoord();
- GridVel = geometry->node[iPoint]->GetGridVel();
-
+ Coord = geometry->nodes->GetCoord(iPoint);
+ GridVel = geometry->nodes->GetGridVel(iPoint);
+
/*--- Calculate non-dim. position from rotation center ---*/
r[0] = (Coord[0]-Center[0])/Lref;
r[1] = (Coord[1]-Center[1])/Lref;
if (nDim == 3) r[2] = (Coord[2]-Center[2])/Lref;
-
+
/*--- Compute transformed point coordinates ---*/
- rotCoord[0] = rotMatrix[0][0]*r[0]
- + rotMatrix[0][1]*r[1]
+ rotCoord[0] = rotMatrix[0][0]*r[0]
+ + rotMatrix[0][1]*r[1]
+ rotMatrix[0][2]*r[2];
-
- rotCoord[1] = rotMatrix[1][0]*r[0]
- + rotMatrix[1][1]*r[1]
+
+ rotCoord[1] = rotMatrix[1][0]*r[0]
+ + rotMatrix[1][1]*r[1]
+ rotMatrix[1][2]*r[2];
-
- rotCoord[2] = rotMatrix[2][0]*r[0]
- + rotMatrix[2][1]*r[1]
+
+ rotCoord[2] = rotMatrix[2][0]*r[0]
+ + rotMatrix[2][1]*r[1]
+ rotMatrix[2][2]*r[2];
-
+
/*--- Cross Product of angular velocity and distance from center.
Note that we have assumed the grid velocities have been set to
an initial value in the plunging routine. ---*/
-
+
newGridVel[0] = GridVel[0] + Omega[1]*rotCoord[2] - Omega[2]*rotCoord[1];
newGridVel[1] = GridVel[1] + Omega[2]*rotCoord[0] - Omega[0]*rotCoord[2];
if (nDim == 3) newGridVel[2] = GridVel[2] + Omega[0]*rotCoord[1] - Omega[1]*rotCoord[0];
-
- /*--- Store new node location & grid velocity. Add center.
+
+ /*--- Store new node location & grid velocity. Add center.
Do not store the grid velocity if this is an adjoint calculation.---*/
-
+
for (iDim = 0; iDim < nDim; iDim++) {
- geometry->node[iPoint]->SetCoord(iDim, rotCoord[iDim] + Center[iDim]);
- if (!adjoint) geometry->node[iPoint]->SetGridVel(iDim, newGridVel[iDim]);
-
+ geometry->nodes->SetCoord(iPoint, iDim, rotCoord[iDim] + Center[iDim]);
+ if (!adjoint) geometry->nodes->SetGridVel(iPoint, iDim, newGridVel[iDim]);
+
}
}
-
+
/*--- Set the moment computation center to the new location after
incrementing the position with the rotation. ---*/
-
+
for (unsigned short jMarker=0; jMarkerGetnMarker_Monitoring(); jMarker++) {
-
+
Center_Moment[0] = config->GetRefOriginMoment_X(jMarker);
Center_Moment[1] = config->GetRefOriginMoment_Y(jMarker);
Center_Moment[2] = config->GetRefOriginMoment_Z(jMarker);
-
+
/*--- Calculate non-dim. position from rotation center ---*/
-
+
for (iDim = 0; iDim < nDim; iDim++)
r[iDim] = (Center_Moment[iDim]-Center[iDim])/Lref;
if (nDim == 2) r[nDim] = 0.0;
-
+
/*--- Compute transformed point coordinates ---*/
-
+
rotCoord[0] = rotMatrix[0][0]*r[0]
+ rotMatrix[0][1]*r[1]
+ rotMatrix[0][2]*r[2];
-
+
rotCoord[1] = rotMatrix[1][0]*r[0]
+ rotMatrix[1][1]*r[1]
+ rotMatrix[1][2]*r[2];
-
+
rotCoord[2] = rotMatrix[2][0]*r[0]
+ rotMatrix[2][1]*r[1]
+ rotMatrix[2][2]*r[2];
-
+
config->SetRefOriginMoment_X(jMarker, Center[0]+rotCoord[0]);
config->SetRefOriginMoment_Y(jMarker, Center[1]+rotCoord[1]);
config->SetRefOriginMoment_Z(jMarker, Center[2]+rotCoord[2]);
}
-
+
/*--- After moving all nodes, update geometry class ---*/
-
+
UpdateDualGrid(geometry, config);
}
void CVolumetricMovement::Rigid_Pitching(CGeometry *geometry, CConfig *config, unsigned short iZone, unsigned long iter) {
-
+
/*--- Local variables ---*/
su2double r[3] = {0.0,0.0,0.0}, rotCoord[3] = {0.0,0.0,0.0}, *Coord, Center[3] = {0.0,0.0,0.0},
Omega[3] = {0.0,0.0,0.0}, Ampl[3] = {0.0,0.0,0.0}, Phase[3] = {0.0,0.0,0.0};
@@ -2059,13 +2059,13 @@ void CVolumetricMovement::Rigid_Pitching(CGeometry *geometry, CConfig *config, u
unsigned long iPoint;
bool harmonic_balance = (config->GetTime_Marching() == HARMONIC_BALANCE);
bool adjoint = (config->GetContinuous_Adjoint() || config->GetDiscrete_Adjoint());
-
+
/*--- Retrieve values from the config file ---*/
- deltaT = config->GetDelta_UnstTimeND();
+ deltaT = config->GetDelta_UnstTimeND();
Lref = config->GetLength_Ref();
- /*--- Pitching origin, frequency, and amplitude from config. ---*/
-
+ /*--- Pitching origin, frequency, and amplitude from config. ---*/
+
for (iDim = 0; iDim < 3; iDim++){
Center[iDim] = config->GetMotion_Origin(iDim);
Omega[iDim] = config->GetPitching_Omega(iDim)/config->GetOmega_Ref();
@@ -2074,7 +2074,7 @@ void CVolumetricMovement::Rigid_Pitching(CGeometry *geometry, CConfig *config, u
}
- if (harmonic_balance) {
+ if (harmonic_balance) {
/*--- period of oscillation & compute time interval using nTimeInstances ---*/
su2double period = config->GetHarmonicBalance_Period();
period /= config->GetTime_Ref();
@@ -2084,7 +2084,7 @@ void CVolumetricMovement::Rigid_Pitching(CGeometry *geometry, CConfig *config, u
/*--- Compute delta time based on physical time step ---*/
if (adjoint) {
/*--- For the unsteady adjoint, we integrate backwards through
- physical time, so perform mesh motion in reverse. ---*/
+ physical time, so perform mesh motion in reverse. ---*/
unsigned long nFlowIter = config->GetnTime_Iter();
unsigned long directIter = nFlowIter - iter - 1;
time_new = static_cast(directIter)*deltaT;
@@ -2101,15 +2101,15 @@ void CVolumetricMovement::Rigid_Pitching(CGeometry *geometry, CConfig *config, u
if (iter != 0) time_old = (static_cast(iter)-1.0)*deltaT;
}
}
-
+
/*--- Compute delta change in the angle about the x, y, & z axes. ---*/
-
+
dtheta = -Ampl[0]*(sin(Omega[0]*time_new + Phase[0]) - sin(Omega[0]*time_old + Phase[0]));
dphi = -Ampl[1]*(sin(Omega[1]*time_new + Phase[1]) - sin(Omega[1]*time_old + Phase[1]));
dpsi = -Ampl[2]*(sin(Omega[2]*time_new + Phase[2]) - sin(Omega[2]*time_old + Phase[2]));
-
+
/*--- Angular velocity at the new time ---*/
-
+
alphaDot[0] = -Omega[0]*Ampl[0]*cos(Omega[0]*time_new);
alphaDot[1] = -Omega[1]*Ampl[1]*cos(Omega[1]*time_new);
alphaDot[2] = -Omega[2]*Ampl[2]*cos(Omega[2]*time_new);
@@ -2124,79 +2124,79 @@ void CVolumetricMovement::Rigid_Pitching(CGeometry *geometry, CConfig *config, u
cout << Phase[1]/DEG2RAD <<", "<< Phase[2]/DEG2RAD;
cout << ") degrees."<< endl;
}
-
+
/*--- Store angles separately for clarity. Compute sines/cosines. ---*/
-
+
cosTheta = cos(dtheta); cosPhi = cos(dphi); cosPsi = cos(dpsi);
sinTheta = sin(dtheta); sinPhi = sin(dphi); sinPsi = sin(dpsi);
-
+
/*--- Compute the rotation matrix. Note that the implicit
ordering is rotation about the x-axis, y-axis, then z-axis. ---*/
-
+
rotMatrix[0][0] = cosPhi*cosPsi;
rotMatrix[1][0] = cosPhi*sinPsi;
rotMatrix[2][0] = -sinPhi;
-
+
rotMatrix[0][1] = sinTheta*sinPhi*cosPsi - cosTheta*sinPsi;
rotMatrix[1][1] = sinTheta*sinPhi*sinPsi + cosTheta*cosPsi;
rotMatrix[2][1] = sinTheta*cosPhi;
-
+
rotMatrix[0][2] = cosTheta*sinPhi*cosPsi + sinTheta*sinPsi;
rotMatrix[1][2] = cosTheta*sinPhi*sinPsi - sinTheta*cosPsi;
rotMatrix[2][2] = cosTheta*cosPhi;
-
+
/*--- Loop over and rotate each node in the volume mesh ---*/
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) {
-
+
/*--- Coordinates of the current point ---*/
- Coord = geometry->node[iPoint]->GetCoord();
- GridVel = geometry->node[iPoint]->GetGridVel();
-
+ Coord = geometry->nodes->GetCoord(iPoint);
+ GridVel = geometry->nodes->GetGridVel(iPoint);
+
/*--- Calculate non-dim. position from rotation center ---*/
for (iDim = 0; iDim < nDim; iDim++)
r[iDim] = (Coord[iDim]-Center[iDim])/Lref;
if (nDim == 2) r[nDim] = 0.0;
-
+
/*--- Compute transformed point coordinates ---*/
- rotCoord[0] = rotMatrix[0][0]*r[0]
- + rotMatrix[0][1]*r[1]
+ rotCoord[0] = rotMatrix[0][0]*r[0]
+ + rotMatrix[0][1]*r[1]
+ rotMatrix[0][2]*r[2];
-
- rotCoord[1] = rotMatrix[1][0]*r[0]
- + rotMatrix[1][1]*r[1]
+
+ rotCoord[1] = rotMatrix[1][0]*r[0]
+ + rotMatrix[1][1]*r[1]
+ rotMatrix[1][2]*r[2];
-
- rotCoord[2] = rotMatrix[2][0]*r[0]
- + rotMatrix[2][1]*r[1]
+
+ rotCoord[2] = rotMatrix[2][0]*r[0]
+ + rotMatrix[2][1]*r[1]
+ rotMatrix[2][2]*r[2];
-
+
/*--- Cross Product of angular velocity and distance from center.
- Note that we have assumed the grid velocities have been set to
+ Note that we have assumed the grid velocities have been set to
an initial value in the plunging routine. ---*/
-
+
newGridVel[0] = GridVel[0] + alphaDot[1]*rotCoord[2] - alphaDot[2]*rotCoord[1];
newGridVel[1] = GridVel[1] + alphaDot[2]*rotCoord[0] - alphaDot[0]*rotCoord[2];
if (nDim == 3) newGridVel[2] = GridVel[2] + alphaDot[0]*rotCoord[1] - alphaDot[1]*rotCoord[0];
-
+
/*--- Store new node location & grid velocity. Add center location.
Do not store the grid velocity if this is an adjoint calculation.---*/
-
+
for (iDim = 0; iDim < nDim; iDim++) {
- geometry->node[iPoint]->SetCoord(iDim, rotCoord[iDim]+Center[iDim]);
- if (!adjoint) geometry->node[iPoint]->SetGridVel(iDim, newGridVel[iDim]);
+ geometry->nodes->SetCoord(iPoint, iDim, rotCoord[iDim]+Center[iDim]);
+ if (!adjoint) geometry->nodes->SetGridVel(iPoint, iDim, newGridVel[iDim]);
}
}
-
+
/*--- For pitching we don't update the motion origin and moment reference origin. ---*/
/*--- After moving all nodes, update geometry class ---*/
-
+
UpdateDualGrid(geometry, config);
-
+
}
void CVolumetricMovement::Rigid_Plunging(CGeometry *geometry, CConfig *config, unsigned short iZone, unsigned long iter) {
-
+
/*--- Local variables ---*/
su2double deltaX[3], newCoord[3] = {0.0, 0.0, 0.0}, Center[3], *Coord, Omega[3], Ampl[3], Lref;
su2double *GridVel, newGridVel[3] = {0.0, 0.0, 0.0}, xDot[3];
@@ -2205,26 +2205,26 @@ void CVolumetricMovement::Rigid_Plunging(CGeometry *geometry, CConfig *config, u
unsigned long iPoint;
bool harmonic_balance = (config->GetTime_Marching() == HARMONIC_BALANCE);
bool adjoint = (config->GetContinuous_Adjoint() || config->GetDiscrete_Adjoint());
-
+
/*--- Retrieve values from the config file ---*/
deltaT = config->GetDelta_UnstTimeND();
Lref = config->GetLength_Ref();
-
+
for (iDim = 0; iDim < 3; iDim++){
Center[iDim] = config->GetMotion_Origin(iDim);
Omega[iDim] = config->GetPlunging_Omega(iDim)/config->GetOmega_Ref();
Ampl[iDim] = config->GetPlunging_Ampl(iDim)/Lref;
}
-
+
/*--- Plunging frequency and amplitude from config. ---*/
-
+
if (harmonic_balance) {
/*--- period of oscillation & time interval using nTimeInstances ---*/
su2double period = config->GetHarmonicBalance_Period();
period /= config->GetTime_Ref();
deltaT = period/(su2double)(config->GetnTimeInstances());
}
-
+
/*--- Compute delta time based on physical time step ---*/
if (adjoint) {
/*--- For the unsteady adjoint, we integrate backwards through
@@ -2245,72 +2245,72 @@ void CVolumetricMovement::Rigid_Plunging(CGeometry *geometry, CConfig *config, u
if (iter != 0) time_old = (static_cast(iter)-1.0)*deltaT;
}
}
-
+
/*--- Compute delta change in the position in the x, y, & z directions. ---*/
deltaX[0] = -Ampl[0]*(sin(Omega[0]*time_new) - sin(Omega[0]*time_old));
deltaX[1] = -Ampl[1]*(sin(Omega[1]*time_new) - sin(Omega[1]*time_old));
deltaX[2] = -Ampl[2]*(sin(Omega[2]*time_new) - sin(Omega[2]*time_old));
-
+
/*--- Compute grid velocity due to plunge in the x, y, & z directions. ---*/
xDot[0] = -Ampl[0]*Omega[0]*(cos(Omega[0]*time_new));
xDot[1] = -Ampl[1]*Omega[1]*(cos(Omega[1]*time_new));
xDot[2] = -Ampl[2]*Omega[2]*(cos(Omega[2]*time_new));
-
+
if (rank == MASTER_NODE && iter == 0) {
cout << " Plunging frequency: (" << Omega[0] << ", " << Omega[1];
cout << ", " << Omega[2] << ") rad/s." << endl;
cout << " Plunging amplitude: (" << Ampl[0] << ", ";
cout << Ampl[1] << ", " << Ampl[2] << ") m."<< endl;
}
-
+
/*--- Loop over and move each node in the volume mesh ---*/
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) {
-
+
/*--- Coordinates of the current point ---*/
- Coord = geometry->node[iPoint]->GetCoord();
- GridVel = geometry->node[iPoint]->GetGridVel();
-
+ Coord = geometry->nodes->GetCoord(iPoint);
+ GridVel = geometry->nodes->GetGridVel(iPoint);
+
/*--- Increment the node position using the delta values. ---*/
for (iDim = 0; iDim < nDim; iDim++)
newCoord[iDim] = Coord[iDim] + deltaX[iDim];
-
+
/*--- Cross Product of angular velocity and distance from center.
Note that we have assumed the grid velocities have been set to
an initial value in the plunging routine. ---*/
-
+
newGridVel[0] = GridVel[0] + xDot[0];
newGridVel[1] = GridVel[1] + xDot[1];
if (nDim == 3) newGridVel[2] = GridVel[2] + xDot[2];
-
+
/*--- Store new node location & grid velocity. Do not store the grid
velocity if this is an adjoint calculation. ---*/
-
+
for (iDim = 0; iDim < nDim; iDim++) {
- geometry->node[iPoint]->SetCoord(iDim, newCoord[iDim]);
- if (!adjoint) geometry->node[iPoint]->SetGridVel(iDim, newGridVel[iDim]);
+ geometry->nodes->SetCoord(iPoint, iDim, newCoord[iDim]);
+ if (!adjoint) geometry->nodes->SetGridVel(iPoint, iDim, newGridVel[iDim]);
}
}
-
+
/*--- Set the mesh motion center to the new location after
incrementing the position with the rigid translation. This
new location will be used for subsequent pitching/rotation.---*/
-
+
for (iDim = 0; iDim < 3; iDim++){
Center[iDim] = config->GetMotion_Origin(iDim) + deltaX[iDim];
- }
+ }
config->SetMotion_Origin(Center);
-
+
/*--- As the body origin may have moved, print it to the console ---*/
-
+
// if (rank == MASTER_NODE) {
// cout << " Body origin: (" << Center[0]+deltaX[0];
// cout << ", " << Center[1]+deltaX[1] << ", " << Center[2]+deltaX[2];
// cout << ")." << endl;
// }
-
+
/*--- Set the moment computation center to the new location after
incrementing the position with the plunging. ---*/
-
+
for (unsigned short jMarker=0; jMarkerGetnMarker_Monitoring(); jMarker++) {
Center[0] = config->GetRefOriginMoment_X(jMarker) + deltaX[0];
Center[1] = config->GetRefOriginMoment_Y(jMarker) + deltaX[1];
@@ -2319,15 +2319,15 @@ void CVolumetricMovement::Rigid_Plunging(CGeometry *geometry, CConfig *config, u
config->SetRefOriginMoment_Y(jMarker, Center[1]);
config->SetRefOriginMoment_Z(jMarker, Center[2]);
}
-
+
/*--- After moving all nodes, update geometry class ---*/
-
+
UpdateDualGrid(geometry, config);
-
+
}
void CVolumetricMovement::Rigid_Translation(CGeometry *geometry, CConfig *config, unsigned short iZone, unsigned long iter) {
-
+
/*--- Local variables ---*/
su2double deltaX[3], newCoord[3], Center[3], *Coord;
su2double xDot[3];
@@ -2336,24 +2336,24 @@ void CVolumetricMovement::Rigid_Translation(CGeometry *geometry, CConfig *config
unsigned long iPoint;
bool harmonic_balance = (config->GetTime_Marching() == HARMONIC_BALANCE);
bool adjoint = (config->GetContinuous_Adjoint() || config->GetDiscrete_Adjoint());
-
+
/*--- Retrieve values from the config file ---*/
deltaT = config->GetDelta_UnstTimeND();
-
+
/*--- Get motion center and translation rates from config ---*/
-
+
for (iDim = 0; iDim < 3; iDim++){
Center[iDim] = config->GetMotion_Origin(iDim);
xDot[iDim] = config->GetTranslation_Rate(iDim);
}
-
+
if (harmonic_balance) {
/*--- period of oscillation & time interval using nTimeInstances ---*/
su2double period = config->GetHarmonicBalance_Period();
period /= config->GetTime_Ref();
deltaT = period/(su2double)(config->GetnTimeInstances());
}
-
+
/*--- Compute delta time based on physical time step ---*/
if (adjoint) {
/*--- For the unsteady adjoint, we integrate backwards through
@@ -2374,7 +2374,7 @@ void CVolumetricMovement::Rigid_Translation(CGeometry *geometry, CConfig *config
if (iter != 0) time_old = (static_cast(iter)-1.0)*deltaT;
}
}
-
+
/*--- Compute delta change in the position in the x, y, & z directions. ---*/
deltaX[0] = xDot[0]*(time_new-time_old);
deltaX[1] = xDot[1]*(time_new-time_old);
@@ -2389,39 +2389,39 @@ void CVolumetricMovement::Rigid_Translation(CGeometry *geometry, CConfig *config
else cout << ") ft/s." << endl;
}
}
-
+
/*--- Loop over and move each node in the volume mesh ---*/
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) {
-
+
/*--- Coordinates of the current point ---*/
- Coord = geometry->node[iPoint]->GetCoord();
-
+ Coord = geometry->nodes->GetCoord(iPoint);
+
/*--- Increment the node position using the delta values. ---*/
for (iDim = 0; iDim < nDim; iDim++)
newCoord[iDim] = Coord[iDim] + deltaX[iDim];
-
+
/*--- Store new node location & grid velocity. Do not store the grid
velocity if this is an adjoint calculation. ---*/
-
+
for (iDim = 0; iDim < nDim; iDim++) {
- geometry->node[iPoint]->SetCoord(iDim, newCoord[iDim]);
- if (!adjoint) geometry->node[iPoint]->SetGridVel(iDim,xDot[iDim]);
+ geometry->nodes->SetCoord(iPoint, iDim, newCoord[iDim]);
+ if (!adjoint) geometry->nodes->SetGridVel(iPoint, iDim,xDot[iDim]);
}
}
-
+
/*--- Set the mesh motion center to the new location after
incrementing the position with the rigid translation. This
new location will be used for subsequent pitching/rotation.---*/
-
+
for (iDim = 0; iDim < 3; iDim++){
Center[iDim] = config->GetMotion_Origin(iDim) + deltaX[iDim];
- }
+ }
config->SetMotion_Origin(Center);
-
+
/*--- Set the moment computation center to the new location after
incrementing the position with the translation. ---*/
-
+
for (unsigned short jMarker=0; jMarkerGetnMarker_Monitoring(); jMarker++) {
Center[0] = config->GetRefOriginMoment_X(jMarker) + deltaX[0];
Center[1] = config->GetRefOriginMoment_Y(jMarker) + deltaX[1];
@@ -2430,11 +2430,11 @@ void CVolumetricMovement::Rigid_Translation(CGeometry *geometry, CConfig *config
config->SetRefOriginMoment_Y(jMarker, Center[1]);
config->SetRefOriginMoment_Z(jMarker, Center[2]);
}
-
+
/*--- After moving all nodes, update geometry class ---*/
-
+
UpdateDualGrid(geometry, config);
-
+
}
void CVolumetricMovement::SetVolume_Scaling(CGeometry *geometry, CConfig *config, bool UpdateGeo) {
@@ -2443,34 +2443,34 @@ void CVolumetricMovement::SetVolume_Scaling(CGeometry *geometry, CConfig *config
unsigned long iPoint;
su2double newCoord[3] = {0.0,0.0,0.0}, *Coord;
- /*--- The scaling factor is the only input to this option. Currently,
+ /*--- The scaling factor is the only input to this option. Currently,
the mesh must be scaled the same amount in all three directions. ---*/
-
+
su2double Scale = config->GetDV_Value(0)*config->GetOpt_RelaxFactor();
-
+
if (rank == MASTER_NODE) {
cout << "Scaling the mesh by a constant factor of " << Scale << "." << endl;
}
-
+
/*--- Loop over and move each node in the volume mesh ---*/
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) {
-
+
/*--- Coordinates of the current point ---*/
- Coord = geometry->node[iPoint]->GetCoord();
-
+ Coord = geometry->nodes->GetCoord(iPoint);
+
/*--- Scale the node position by the specified factor. ---*/
for (iDim = 0; iDim < nDim; iDim++)
newCoord[iDim] = Scale*Coord[iDim];
-
+
/*--- Store the new node location. ---*/
for (iDim = 0; iDim < nDim; iDim++) {
- geometry->node[iPoint]->SetCoord(iDim, newCoord[iDim]);
+ geometry->nodes->SetCoord(iPoint, iDim, newCoord[iDim]);
}
}
/*--- After moving all nodes, update geometry class ---*/
if (UpdateGeo) UpdateDualGrid(geometry, config);
-
+
}
void CVolumetricMovement::SetVolume_Translation(CGeometry *geometry, CConfig *config, bool UpdateGeo) {
@@ -2479,11 +2479,11 @@ void CVolumetricMovement::SetVolume_Translation(CGeometry *geometry, CConfig *co
unsigned long iPoint;
su2double *Coord, deltaX[3] = {0.0,0.0,0.0}, newCoord[3] = {0.0,0.0,0.0};
su2double Scale = config->GetOpt_RelaxFactor();
-
+
/*--- Get the unit vector and magnitude of displacement. Note that we
assume this is the first DV entry since it is for mesh translation.
Create the displacement vector from the magnitude and direction. ---*/
-
+
su2double Ampl = config->GetDV_Value(0)*Scale;
su2double length = 0.0;
for (iDim = 0; iDim < nDim; iDim++) {
@@ -2497,30 +2497,30 @@ void CVolumetricMovement::SetVolume_Translation(CGeometry *geometry, CConfig *co
cout << "Translational displacement: (" << deltaX[0] << ", ";
cout << deltaX[1] << ", " << deltaX[2] << ")." << endl;
}
-
+
/*--- Loop over and move each node in the volume mesh ---*/
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) {
-
+
/*--- Coordinates of the current point ---*/
- Coord = geometry->node[iPoint]->GetCoord();
-
+ Coord = geometry->nodes->GetCoord(iPoint);
+
/*--- Increment the node position using the delta values. ---*/
for (iDim = 0; iDim < nDim; iDim++)
newCoord[iDim] = Coord[iDim] + deltaX[iDim];
-
+
/*--- Store new node location. ---*/
for (iDim = 0; iDim < nDim; iDim++) {
- geometry->node[iPoint]->SetCoord(iDim, newCoord[iDim]);
+ geometry->nodes->SetCoord(iPoint, iDim, newCoord[iDim]);
}
}
-
+
/*--- After moving all nodes, update geometry class ---*/
if (UpdateGeo) UpdateDualGrid(geometry, config);
-
+
}
void CVolumetricMovement::SetVolume_Rotation(CGeometry *geometry, CConfig *config, bool UpdateGeo) {
-
+
unsigned short iDim;
unsigned long iPoint;
su2double x, y, z;
@@ -2532,17 +2532,17 @@ void CVolumetricMovement::SetVolume_Rotation(CGeometry *geometry, CConfig *confi
su2double b = config->GetParamDV(0, 1);
su2double c = 0.0;
if (geometry->GetnDim() == 3) c = config->GetParamDV(0,2);
-
+
/*--- xyz-coordinate of the line's direction vector. ---*/
su2double u = config->GetParamDV(0, 3)-config->GetParamDV(0, 0);
su2double v = config->GetParamDV(0, 4)-config->GetParamDV(0, 1);
su2double w = 1.0;
if (geometry->GetnDim() == 3)
w = config->GetParamDV(0, 5)-config->GetParamDV(0, 2);
-
+
/*--- The angle of rotation. ---*/
su2double theta = config->GetDV_Value(0)*Scale*PI_NUMBER/180.0;
-
+
/*--- Print to the console. ---*/
if (rank == MASTER_NODE) {
cout << "Rotation axis vector: (" << u << ", ";
@@ -2550,58 +2550,58 @@ void CVolumetricMovement::SetVolume_Rotation(CGeometry *geometry, CConfig *confi
cout << "Angle of rotation: " << config->GetDV_Value(0)*Scale;
cout << " degrees." << endl;
}
-
+
/*--- Intermediate values used in computations. ---*/
su2double u2=u*u; su2double v2=v*v; su2double w2=w*w;
su2double cosT = cos(theta); su2double sinT = sin(theta);
su2double l2 = u2 + v2 + w2; su2double l = sqrt(l2);
-
+
/*--- Loop over and move each node in the volume mesh ---*/
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) {
-
+
/*--- Coordinates of the current point ---*/
- Coord = geometry->node[iPoint]->GetCoord();
-
+ Coord = geometry->nodes->GetCoord(iPoint);
+
/*--- Displacement for this point due to the rotation. ---*/
x = Coord[0]; y = Coord[1]; z = 0.0;
if (geometry->GetnDim() == 3) z = Coord[2];
-
+
deltaX[0] = a*(v2 + w2) + u*(-b*v - c*w + u*x + v*y + w*z)
+ (-a*(v2 + w2) + u*(b*v + c*w - v*y - w*z) + (v2 + w2)*x)*cosT
+ l*(-c*v + b*w - w*y + v*z)*sinT;
deltaX[0] = deltaX[0]/l2 - x;
-
+
deltaX[1] = b*(u2 + w2) + v*(-a*u - c*w + u*x + v*y + w*z)
+ (-b*(u2 + w2) + v*(a*u + c*w - u*x - w*z) + (u2 + w2)*y)*cosT
+ l*(c*u - a*w + w*x - u*z)*sinT;
deltaX[1] = deltaX[1]/l2 - y;
-
+
deltaX[2] = c*(u2 + v2) + w*(-a*u - b*v + u*x + v*y + w*z)
+ (-c*(u2 + v2) + w*(a*u + b*v - u*x - v*y) + (u2 + v2)*z)*cosT
+ l*(-b*u + a*v - v*x + u*y)*sinT;
if (geometry->GetnDim() == 3) deltaX[2] = deltaX[2]/l2 - z;
else deltaX[2] = 0.0;
-
+
/*--- Increment the node position using the delta values. ---*/
for (iDim = 0; iDim < nDim; iDim++)
newCoord[iDim] = Coord[iDim] + deltaX[iDim];
-
+
/*--- Store new node location. ---*/
for (iDim = 0; iDim < nDim; iDim++) {
- geometry->node[iPoint]->SetCoord(iDim, newCoord[iDim]);
+ geometry->nodes->SetCoord(iPoint, iDim, newCoord[iDim]);
}
}
-
+
/*--- After moving all nodes, update geometry class ---*/
if (UpdateGeo) UpdateDualGrid(geometry, config);
-
+
}
CSurfaceMovement::CSurfaceMovement(void) : CGridMovement() {
-
+
size = SU2_MPI::GetSize();
rank = SU2_MPI::GetRank();
-
+
nFFDBox = 0;
nLevel = 0;
FFDBoxDefinition = false;
@@ -2610,13 +2610,13 @@ CSurfaceMovement::CSurfaceMovement(void) : CGridMovement() {
CSurfaceMovement::~CSurfaceMovement(void) {}
void CSurfaceMovement::SetSurface_Deformation(CGeometry *geometry, CConfig *config) {
-
+
unsigned short iFFDBox, iDV, iLevel, iChild, iParent, jFFDBox, iMarker;
unsigned short Degree_Unitary [] = {1,1,1}, BSpline_Unitary [] = {2,2,2};
su2double MaxDiff, Current_Scale, Ratio, New_Scale;
string FFDBoxTag;
bool allmoving;
-
+
bool cylindrical = (config->GetFFD_CoordSystem() == CYLINDRICAL);
bool spherical = (config->GetFFD_CoordSystem() == SPHERICAL);
bool polar = (config->GetFFD_CoordSystem() == POLAR);
@@ -2624,23 +2624,23 @@ void CSurfaceMovement::SetSurface_Deformation(CGeometry *geometry, CConfig *conf
su2double BoundLimit = config->GetOpt_LineSearch_Bound();
/*--- Setting the Free Form Deformation ---*/
-
+
if (config->GetDesign_Variable(0) == FFD_SETTING) {
-
+
/*--- Definition of the FFD deformation class ---*/
-
+
FFDBox = new CFreeFormDefBox*[MAX_NUMBER_FFD];
-
+
/*--- Read the FFD information from the config file ---*/
-
+
ReadFFDInfo(geometry, config, FFDBox);
-
+
/*--- If there is a FFDBox in the input file ---*/
-
+
if (nFFDBox != 0) {
-
+
/*--- if polar coordinates, trnasform the corner to polar ---*/
-
+
if (cylindrical) {
for (iFFDBox = 0; iFFDBox < GetnFFDBox(); iFFDBox++) {
FFDBox[iFFDBox]->SetCart2Cyl_CornerPoints(config);
@@ -2651,43 +2651,43 @@ void CSurfaceMovement::SetSurface_Deformation(CGeometry *geometry, CConfig *conf
FFDBox[iFFDBox]->SetCart2Sphe_CornerPoints(config);
}
}
-
+
/*--- If the FFDBox was not defined in the input file ---*/
-
+
if ((rank == MASTER_NODE) && (GetnFFDBox() != 0)) {
if (cartesian) cout << endl <<"----------------- FFD technique (cartesian -> parametric) ---------------" << endl;
else if (cylindrical) cout << endl <<"----------------- FFD technique (cylinder -> parametric) ---------------" << endl;
else if (spherical) cout << endl <<"----------------- FFD technique (spherical -> parametric) ---------------" << endl;
else if (polar) cout << endl <<"----------------- FFD technique (polar -> parametric) ---------------" << endl;
}
-
+
/*--- Create a unitary FFDBox as baseline for other FFDBoxes shapes ---*/
-
+
CFreeFormDefBox FFDBox_unitary(Degree_Unitary, BSpline_Unitary, BEZIER);
FFDBox_unitary.SetUnitCornerPoints();
/*--- Compute the control points of the unitary box, in this case the degree is 1 and the order is 2 ---*/
-
+
FFDBox_unitary.SetControlPoints_Parallelepiped();
-
+
for (iFFDBox = 0; iFFDBox < GetnFFDBox(); iFFDBox++) {
-
+
/*--- Compute the support control points for the final FFD using the unitary box ---*/
-
+
FFDBox_unitary.SetSupportCP(FFDBox[iFFDBox]);
-
+
/*--- Compute control points in the support box ---*/
-
+
FFDBox_unitary.SetSupportCPChange(FFDBox[iFFDBox]);
-
+
/*--- Compute the parametric coordinates, it also find the points in
the FFDBox using the parametrics coordinates ---*/
-
+
SetParametricCoord(geometry, config, FFDBox[iFFDBox], iFFDBox);
-
-
+
+
/*--- If polar coordinates, transform the corners and control points to cartesians ---*/
-
+
if (cylindrical) {
FFDBox[iFFDBox]->SetCyl2Cart_CornerPoints(config);
FFDBox[iFFDBox]->SetCyl2Cart_ControlPoints(config);
@@ -2698,7 +2698,7 @@ void CSurfaceMovement::SetSurface_Deformation(CGeometry *geometry, CConfig *conf
}
}
/*--- Output original FFD FFDBox ---*/
-
+
if (rank == MASTER_NODE) {
for (unsigned short iFile = 0; iFile < config->GetnVolumeOutputFiles(); iFile++){
unsigned short *FileFormat = config->GetVolumeOutputFiles();
@@ -2719,18 +2719,18 @@ void CSurfaceMovement::SetSurface_Deformation(CGeometry *geometry, CConfig *conf
FFDBox[iFFDBox]->SetCGNS(geometry, iFFDBox, true);
}
}
- }
+ }
}
}
-
+
else {
SU2_MPI::Error("There are not FFD boxes in the mesh file!!", CURRENT_FUNCTION);
}
-
+
}
-
+
/*--- Free Form deformation based ---*/
-
+
if ((config->GetDesign_Variable(0) == FFD_CONTROL_POINT_2D) ||
(config->GetDesign_Variable(0) == FFD_CAMBER_2D) ||
(config->GetDesign_Variable(0) == FFD_THICKNESS_2D) ||
@@ -2744,49 +2744,49 @@ void CSurfaceMovement::SetSurface_Deformation(CGeometry *geometry, CConfig *conf
(config->GetDesign_Variable(0) == FFD_CAMBER) ||
(config->GetDesign_Variable(0) == FFD_THICKNESS) ||
(config->GetDesign_Variable(0) == FFD_ANGLE_OF_ATTACK)) {
-
+
/*--- Definition of the FFD deformation class ---*/
-
+
FFDBox = new CFreeFormDefBox*[MAX_NUMBER_FFD];
-
+
/*--- Read the FFD information from the grid file ---*/
-
+
ReadFFDInfo(geometry, config, FFDBox, config->GetMesh_FileName());
-
+
/*--- If there is a FFDBox in the input file ---*/
-
+
if (nFFDBox != 0) {
-
+
/*--- If the FFDBox was not defined in the input file ---*/
-
+
if (!GetFFDBoxDefinition()) {
SU2_MPI::Error(string("There is not FFD box definition in the mesh file,\n") +
string("run DV_KIND=FFD_SETTING first !!"), CURRENT_FUNCTION);
}
-
+
/* --- Check if the FFD boxes referenced in the design variable definition can be found --- */
-
+
for (iDV = 0; iDV < config->GetnDV(); iDV++) {
if (!CheckFFDBoxDefinition(config, iDV)) {
SU2_MPI::Error(string("There is no FFD box with tag \"") + config->GetFFDTag(iDV) + string("\" defined in the mesh file.\n") +
string("Check the definition of the design variables and/or the FFD settings !!"), CURRENT_FUNCTION);
}
}
-
+
/*--- Check that the user has specified a non-zero number of surfaces to move with DV_MARKER. ---*/
-
+
if (config->GetnMarker_DV() == 0) {
SU2_MPI::Error(string("No markers are specified in DV_MARKER, so no deformation will occur.\n") +
string("List markers to be deformed in DV_MARKER."), CURRENT_FUNCTION);
}
-
+
/*--- Output original FFD FFDBox ---*/
-
+
if ((rank == MASTER_NODE) && (config->GetKind_SU2() != SU2_DOT)) {
-
+
for (unsigned short iFile = 0; iFile < config->GetnVolumeOutputFiles(); iFile++){
unsigned short *FileFormat = config->GetVolumeOutputFiles();
-
+
if (FileFormat[iFile] == PARAVIEW || FileFormat[iFile] == PARAVIEW_BINARY) {
cout << "Writing a Paraview file of the FFD boxes." << endl;
for (iFFDBox = 0; iFFDBox < GetnFFDBox(); iFFDBox++) {
@@ -2806,9 +2806,9 @@ void CSurfaceMovement::SetSurface_Deformation(CGeometry *geometry, CConfig *conf
}
}
}
-
+
/*--- If polar FFD, change the coordinates system ---*/
-
+
if (cylindrical) {
for (iFFDBox = 0; iFFDBox < GetnFFDBox(); iFFDBox++) {
FFDBox[iFFDBox]->SetCart2Cyl_CornerPoints(config);
@@ -2821,51 +2821,51 @@ void CSurfaceMovement::SetSurface_Deformation(CGeometry *geometry, CConfig *conf
FFDBox[iFFDBox]->SetCart2Sphe_ControlPoints(config);
}
}
-
+
/*--- Apply the deformation to the orifinal FFD box ---*/
-
+
if ((rank == MASTER_NODE) && (GetnFFDBox() != 0))
cout << endl <<"----------------- FFD technique (parametric -> cartesian) ---------------" << endl;
-
+
/*--- Loop over all the FFD boxes levels ---*/
-
+
for (iLevel = 0; iLevel < GetnLevel(); iLevel++) {
-
+
/*--- Loop over all FFD FFDBoxes ---*/
-
+
for (iFFDBox = 0; iFFDBox < GetnFFDBox(); iFFDBox++) {
-
+
/*--- Check the level of the FFD box ---*/
-
+
if (FFDBox[iFFDBox]->GetLevel() == iLevel) {
-
+
/*--- Check the dimension of the FFD compared with the design variables ---*/
-
+
if (rank == MASTER_NODE) cout << "Checking FFD box dimension." << endl;
CheckFFDDimension(geometry, config, FFDBox[iFFDBox], iFFDBox);
-
+
/*--- Compute intersections of the FFD box with the surface to eliminate design
variables and satisfy surface continuity ---*/
-
+
if (rank == MASTER_NODE) cout << "Checking FFD box intersections with the solid surfaces." << endl;
CheckFFDIntersections(geometry, config, FFDBox[iFFDBox], iFFDBox);
-
+
/*--- Compute the parametric coordinates of the child box
control points (using the parent FFDBox) ---*/
-
+
for (iChild = 0; iChild < FFDBox[iFFDBox]->GetnChildFFDBox(); iChild++) {
FFDBoxTag = FFDBox[iFFDBox]->GetChildFFDBoxTag(iChild);
for (jFFDBox = 0; jFFDBox < GetnFFDBox(); jFFDBox++)
if (FFDBoxTag == FFDBox[jFFDBox]->GetTag()) break;
SetParametricCoordCP(geometry, config, FFDBox[iFFDBox], FFDBox[jFFDBox]);
}
-
+
/*--- Update the parametric coordinates if it is a child FFDBox ---*/
-
+
if (iLevel > 0) UpdateParametricCoord(geometry, config, FFDBox[iFFDBox], iFFDBox);
-
+
/*--- Apply the design variables to the control point position ---*/
-
+
for (iDV = 0; iDV < config->GetnDV(); iDV++) {
switch ( config->GetDesign_Variable(iDV) ) {
case FFD_CONTROL_POINT_2D : SetFFDCPChange_2D(geometry, config, FFDBox[iFFDBox], FFDBox, iDV, false); break;
@@ -2883,22 +2883,22 @@ void CSurfaceMovement::SetSurface_Deformation(CGeometry *geometry, CConfig *conf
case FFD_ANGLE_OF_ATTACK : SetFFDAngleOfAttack(geometry, config, FFDBox[iFFDBox], FFDBox, iDV, false); break;
}
}
-
+
/*--- Recompute cartesian coordinates using the new control point location ---*/
-
+
MaxDiff = SetCartesianCoord(geometry, config, FFDBox[iFFDBox], iFFDBox, false);
-
+
if ((MaxDiff > BoundLimit) && (config->GetKind_SU2() == SU2_DEF)) {
-
+
if (rank == MASTER_NODE) cout << "Out-of-bounds, re-adjusting scale factor to safisfy line search limit." << endl;
-
+
Current_Scale = config->GetOpt_RelaxFactor();
Ratio = (BoundLimit/MaxDiff);
New_Scale = Current_Scale *(Ratio-1.0);
config->SetOpt_RelaxFactor(New_Scale);
-
+
/*--- Apply the design variables to the control point position ---*/
-
+
for (iDV = 0; iDV < config->GetnDV(); iDV++) {
switch ( config->GetDesign_Variable(iDV) ) {
case FFD_CONTROL_POINT_2D : SetFFDCPChange_2D(geometry, config, FFDBox[iFFDBox], FFDBox, iDV, false); break;
@@ -2916,25 +2916,25 @@ void CSurfaceMovement::SetSurface_Deformation(CGeometry *geometry, CConfig *conf
case FFD_ANGLE_OF_ATTACK : SetFFDAngleOfAttack(geometry, config, FFDBox[iFFDBox], FFDBox, iDV, false); break;
}
}
-
+
/*--- Recompute cartesian coordinates using the new control point location ---*/
-
+
MaxDiff = SetCartesianCoord(geometry, config, FFDBox[iFFDBox], iFFDBox, false);
-
+
}
-
+
/*--- Reparametrization of the parent FFD box ---*/
-
+
for (iParent = 0; iParent < FFDBox[iFFDBox]->GetnParentFFDBox(); iParent++) {
FFDBoxTag = FFDBox[iFFDBox]->GetParentFFDBoxTag(iParent);
for (jFFDBox = 0; jFFDBox < GetnFFDBox(); jFFDBox++)
if (FFDBoxTag == FFDBox[jFFDBox]->GetTag()) break;
UpdateParametricCoord(geometry, config, FFDBox[jFFDBox], jFFDBox);
}
-
+
/*--- Compute the new location of the control points of the child boxes
(using the parent FFDBox) ---*/
-
+
for (iChild = 0; iChild < FFDBox[iFFDBox]->GetnChildFFDBox(); iChild++) {
FFDBoxTag = FFDBox[iFFDBox]->GetChildFFDBoxTag(iChild);
for (jFFDBox = 0; jFFDBox < GetnFFDBox(); jFFDBox++)
@@ -2943,9 +2943,9 @@ void CSurfaceMovement::SetSurface_Deformation(CGeometry *geometry, CConfig *conf
}
}
}
-
+
/*--- If polar, compute the cartesians coordinates ---*/
-
+
if (cylindrical) {
for (iFFDBox = 0; iFFDBox < GetnFFDBox(); iFFDBox++) {
FFDBox[iFFDBox]->SetCyl2Cart_CornerPoints(config);
@@ -2958,14 +2958,14 @@ void CSurfaceMovement::SetSurface_Deformation(CGeometry *geometry, CConfig *conf
FFDBox[iFFDBox]->SetSphe2Cart_ControlPoints(config);
}
}
-
+
/*--- Output the deformed FFD Boxes ---*/
-
+
if ((rank == MASTER_NODE) && (config->GetKind_SU2() != SU2_DOT)) {
-
+
for (unsigned short iFile = 0; iFile < config->GetnVolumeOutputFiles(); iFile++){
unsigned short *FileFormat = config->GetVolumeOutputFiles();
-
+
if (FileFormat[iFile] == PARAVIEW || FileFormat[iFile] == PARAVIEW_BINARY) {
cout << "Writing a Paraview file of the FFD boxes." << endl;
for (iFFDBox = 0; iFFDBox < GetnFFDBox(); iFFDBox++) {
@@ -2987,29 +2987,29 @@ void CSurfaceMovement::SetSurface_Deformation(CGeometry *geometry, CConfig *conf
}
}
}
-
+
else {
SU2_MPI::Error("There are no FFD Boxes in the mesh file!!", CURRENT_FUNCTION);
}
-
+
}
-
+
/*--- External surface file based ---*/
-
+
else if (config->GetDesign_Variable(0) == SURFACE_FILE) {
-
+
/*--- Check whether a surface file exists for input ---*/
ofstream Surface_File;
string filename = config->GetDV_Filename();
Surface_File.open(filename.c_str(), ios::in);
-
+
/*--- A surface file does not exist, so write a new one for the
markers that are specified as part of the motion. ---*/
if (Surface_File.fail()) {
-
+
if (rank == MASTER_NODE && size == SINGLE_NODE) {
cout << "No surface positions file found. Writing a template file: " << filename << "." << endl;
-
+
Surface_File.open(filename.c_str(), ios::out);
Surface_File.precision(15);
unsigned long iMarker, jPoint, GlobalIndex, iVertex; su2double *Coords;
@@ -3017,8 +3017,8 @@ void CSurfaceMovement::SetSurface_Deformation(CGeometry *geometry, CConfig *conf
if (config->GetMarker_All_DV(iMarker) == YES) {
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
jPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- GlobalIndex = geometry->node[jPoint]->GetGlobalIndex();
- Coords = geometry->node[jPoint]->GetCoord();
+ GlobalIndex = geometry->nodes->GetGlobalIndex(jPoint);
+ Coords = geometry->nodes->GetCoord(jPoint);
Surface_File << GlobalIndex << "\t" << Coords[0] << "\t" << Coords[1];
if (geometry->GetnDim() == 2) Surface_File << endl;
else Surface_File << "\t" << Coords[2] << endl;
@@ -3026,31 +3026,31 @@ void CSurfaceMovement::SetSurface_Deformation(CGeometry *geometry, CConfig *conf
}
}
Surface_File.close();
-
+
} else {
SU2_MPI::Error("No surface positions file found and template writing not yet supported in parallel.\n To generate a template surface positions file, run SU2_DEF again in serial.", CURRENT_FUNCTION);
}
}
-
+
else {
/*--- A surface file exists, so read in the coordinates ---*/
Surface_File.close();
if (rank == MASTER_NODE) cout << "Updating the surface coordinates from the input file." << endl;
SetExternal_Deformation(geometry, config, ZONE_0, 0);
}
-
+
}
-
+
else if ((config->GetDesign_Variable(0) == ROTATION) ||
(config->GetDesign_Variable(0) == TRANSLATION) ||
(config->GetDesign_Variable(0) == SCALE) ||
(config->GetDesign_Variable(0) == HICKS_HENNE) ||
(config->GetDesign_Variable(0) == SURFACE_BUMP) ||
(config->GetDesign_Variable(0) == ANGLE_OF_ATTACK)) {
-
+
/*--- Apply rotation, displacement and stretching design variables (this
should be done before the bump function design variables) ---*/
-
+
for (iDV = 0; iDV < config->GetnDV(); iDV++) {
switch ( config->GetDesign_Variable(iDV) ) {
case SCALE : SetScale(geometry, config, iDV, false); break;
@@ -3058,15 +3058,15 @@ void CSurfaceMovement::SetSurface_Deformation(CGeometry *geometry, CConfig *conf
case ROTATION : SetRotation(geometry, config, iDV, false); break;
}
}
-
+
/*--- Apply the design variables to the control point position ---*/
-
+
for (iDV = 0; iDV < config->GetnDV(); iDV++) {
switch ( config->GetDesign_Variable(iDV) ) {
case HICKS_HENNE : SetHicksHenne(geometry, config, iDV, false); break;
}
}
-
+
/*--- Apply the design variables to the control point position ---*/
for (iDV = 0; iDV < config->GetnDV(); iDV++) {
@@ -3076,54 +3076,54 @@ void CSurfaceMovement::SetSurface_Deformation(CGeometry *geometry, CConfig *conf
}
/*--- Apply the angle of attack design variable ---*/
-
+
for (iDV = 0; iDV < config->GetnDV(); iDV++) {
switch ( config->GetDesign_Variable(iDV) ) {
case ANGLE_OF_ATTACK : SetAngleOfAttack(geometry, config, iDV, false); break;
}
}
-
+
}
-
+
/*--- NACA_4Digits design variable ---*/
-
+
else if (config->GetDesign_Variable(0) == NACA_4DIGITS) { SetNACA_4Digits(geometry, config); }
-
+
/*--- Parabolic airfoil design variable ---*/
-
+
else if (config->GetDesign_Variable(0) == PARABOLIC) { SetParabolic(geometry, config); }
-
+
/*--- Airfoil from file design variable ---*/
-
+
else if (config->GetDesign_Variable(0) == AIRFOIL) { SetAirfoil(geometry, config); }
-
+
/*--- FFD setting ---*/
-
+
else if (config->GetDesign_Variable(0) == FFD_SETTING) {
if (rank == MASTER_NODE)
cout << "No surface deformation (setting FFD)." << endl;
}
-
+
/*--- Scale, Translate, and Rotate will be done with rigid mesh transforms. ---*/
-
+
else if ((config->GetDesign_Variable(0) == ROTATION) ||
(config->GetDesign_Variable(0) == TRANSLATION) ||
(config->GetDesign_Variable(0) == SCALE)) {
-
+
/*--- If all markers are deforming, use volume method.
If only some are deforming, use surface method ---*/
-
+
/*--- iDV was uninitialized, so hard-coding to one. Check intended
behavior (might want to loop over all iDV in case we have trans & rotate. ---*/
iDV = 0;
allmoving = true;
-
+
/*--- Loop over markers ---*/
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (config->GetMarker_All_DV(iMarker) == NO)
allmoving = false;
}
-
+
if (!allmoving) {
/*---Only some markers are moving, use the surface method ---*/
if (config->GetDesign_Variable(0) == ROTATION)
@@ -3138,14 +3138,14 @@ void CSurfaceMovement::SetSurface_Deformation(CGeometry *geometry, CConfig *conf
cout << "No surface deformation (scaling, rotation, or translation)." << endl;
}
}
-
+
/*--- Design variable not implement ---*/
-
+
else {
if (rank == MASTER_NODE)
cout << "Design Variable not implemented yet" << endl;
}
-
+
}
@@ -3180,7 +3180,7 @@ void CSurfaceMovement::SetSurface_Derivative(CGeometry *geometry, CConfig *confi
}
void CSurfaceMovement::CopyBoundary(CGeometry *geometry, CConfig *config) {
-
+
unsigned short iMarker;
unsigned long iVertex, iPoint;
su2double *Coord;
@@ -3188,15 +3188,15 @@ void CSurfaceMovement::CopyBoundary(CGeometry *geometry, CConfig *config) {
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- Coord = geometry->node[iPoint]->GetCoord();
+ Coord = geometry->nodes->GetCoord(iPoint);
geometry->vertex[iMarker][iVertex]->SetCoord(Coord);
}
}
-
+
}
void CSurfaceMovement::SetParametricCoord(CGeometry *geometry, CConfig *config, CFreeFormDefBox *FFDBox, unsigned short iFFDBox) {
-
+
unsigned short iMarker, iDim, iOrder, jOrder, kOrder, lOrder, mOrder, nOrder;
unsigned long iVertex, iPoint, TotalVertex = 0;
su2double *CartCoordNew, *ParamCoord, CartCoord[3], ParamCoordGuess[3], MaxDiff, my_MaxDiff = 0.0, Diff, *Coord;
@@ -3207,30 +3207,30 @@ void CSurfaceMovement::SetParametricCoord(CGeometry *geometry, CConfig *config,
bool cylindrical = (config->GetFFD_CoordSystem() == CYLINDRICAL);
bool spherical = (config->GetFFD_CoordSystem() == SPHERICAL);
bool polar = (config->GetFFD_CoordSystem() == POLAR);
-
+
/*--- Change order and control points reduce the
complexity of the point inversion (this only works with boxes,
in case of Bezier curves, and we maintain an internal copy)---*/
-
+
if (BoxFFD && (config->GetFFD_Blending() == BEZIER)) {
-
+
for (iOrder = 0; iOrder < 2; iOrder++) {
for (jOrder = 0; jOrder < 2; jOrder++) {
for (kOrder = 0; kOrder < 2; kOrder++) {
-
+
lOrder = 0; mOrder = 0; nOrder = 0;
if (iOrder == 1) {lOrder = FFDBox->GetlOrder()-1;}
if (jOrder == 1) {mOrder = FFDBox->GetmOrder()-1;}
if (kOrder == 1) {nOrder = FFDBox->GetnOrder()-1;}
-
+
Coord = FFDBox->GetCoordControlPoints(lOrder, mOrder, nOrder);
-
+
FFDBox->SetCoordControlPoints(Coord, iOrder, jOrder, kOrder);
-
+
}
}
}
-
+
FFDBox->SetlOrder(2); FFDBox->SetmOrder(2); FFDBox->SetnOrder(2);
FFDBox->SetnControlPoints();
FFDBox->BlendingFunction[0]->SetOrder(2, 2);
@@ -3238,117 +3238,117 @@ void CSurfaceMovement::SetParametricCoord(CGeometry *geometry, CConfig *config,
FFDBox->BlendingFunction[2]->SetOrder(2, 2);
}
/*--- Point inversion algorithm with a basic box ---*/
-
+
ParamCoordGuess[0] = 0.5; ParamCoordGuess[1] = 0.5; ParamCoordGuess[2] = 0.5;
CartCoord[0] = 0.0; CartCoord[1] = 0.0; CartCoord[2] = 0.0;
-
+
/*--- Count the number of vertices ---*/
-
+
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++)
if (config->GetMarker_All_DV(iMarker) == YES)
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++)
TotalVertex++;
-
+
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
-
+
if (config->GetMarker_All_DV(iMarker) == YES) {
-
+
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
-
+
/*--- Get the cartesian coordinates ---*/
-
+
for (iDim = 0; iDim < nDim; iDim++)
CartCoord[iDim] = geometry->vertex[iMarker][iVertex]->GetCoord(iDim);
-
+
/*--- Transform the cartesian into polar ---*/
-
+
if (cylindrical) {
X_0 = config->GetFFD_Axis(0); Y_0 = config->GetFFD_Axis(1); Z_0 = config->GetFFD_Axis(2);
-
+
Xbar = CartCoord[0] - X_0; Ybar = CartCoord[1] - Y_0; Zbar = CartCoord[2] - Z_0;
-
+
CartCoord[0] = sqrt(Ybar*Ybar + Zbar*Zbar);
CartCoord[1] = atan2(Zbar, Ybar); if (CartCoord[1] > PI_NUMBER/2.0) CartCoord[1] -= 2.0*PI_NUMBER;
CartCoord[2] = Xbar;
}
else if (spherical || polar) {
X_0 = config->GetFFD_Axis(0); Y_0 = config->GetFFD_Axis(1); Z_0 = config->GetFFD_Axis(2);
-
+
Xbar = CartCoord[0] - X_0; Ybar = CartCoord[1] - Y_0; Zbar = CartCoord[2] - Z_0;
-
+
CartCoord[0] = sqrt(Xbar*Xbar + Ybar*Ybar + Zbar*Zbar);
CartCoord[1] = atan2(Zbar, Ybar); if (CartCoord[1] > PI_NUMBER/2.0) CartCoord[1] -= 2.0*PI_NUMBER;
CartCoord[2] = acos(Xbar/CartCoord[0]);
}
-
+
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
-
+
/*--- If the point is inside the FFD, compute the value of the parametric coordinate ---*/
-
+
if (FFDBox->GetPointFFD(geometry, config, iPoint)) {
-
+
/*--- Find the parametric coordinate ---*/
-
+
ParamCoord = FFDBox->GetParametricCoord_Iterative(iPoint, CartCoord, ParamCoordGuess, config);
-
+
/*--- Compute the cartesian coordinates using the parametric coordinates
to check that everything is correct ---*/
-
+
CartCoordNew = FFDBox->EvalCartesianCoord(ParamCoord);
-
+
/*--- Compute max difference between original value and the recomputed value ---*/
-
+
Diff = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
Diff += (CartCoordNew[iDim]-CartCoord[iDim])*(CartCoordNew[iDim]-CartCoord[iDim]);
Diff = sqrt(Diff);
my_MaxDiff = max(my_MaxDiff, Diff);
-
+
/*--- If the parametric coordinates are in (0,1) the point belongs to the FFDBox, using the input tolerance ---*/
-
+
if (((ParamCoord[0] >= - config->GetFFD_Tol()) && (ParamCoord[0] <= 1.0 + config->GetFFD_Tol())) &&
((ParamCoord[1] >= - config->GetFFD_Tol()) && (ParamCoord[1] <= 1.0 + config->GetFFD_Tol())) &&
((ParamCoord[2] >= - config->GetFFD_Tol()) && (ParamCoord[2] <= 1.0 + config->GetFFD_Tol()))) {
-
-
+
+
/*--- Rectification of the initial tolerance (we have detected situations
where 0.0 and 1.0 doesn't work properly ---*/
-
+
su2double lower_limit = config->GetFFD_Tol();
su2double upper_limit = 1.0-config->GetFFD_Tol();
-
+
if (ParamCoord[0] < lower_limit) ParamCoord[0] = lower_limit;
if (ParamCoord[1] < lower_limit) ParamCoord[1] = lower_limit;
if (ParamCoord[2] < lower_limit) ParamCoord[2] = lower_limit;
if (ParamCoord[0] > upper_limit) ParamCoord[0] = upper_limit;
if (ParamCoord[1] > upper_limit) ParamCoord[1] = upper_limit;
if (ParamCoord[2] > upper_limit) ParamCoord[2] = upper_limit;
-
+
/*--- Set the value of the parametric coordinate ---*/
-
+
FFDBox->Set_MarkerIndex(iMarker);
FFDBox->Set_VertexIndex(iVertex);
FFDBox->Set_PointIndex(iPoint);
FFDBox->Set_ParametricCoord(ParamCoord);
FFDBox->Set_CartesianCoord(CartCoord);
-
+
ParamCoordGuess[0] = ParamCoord[0]; ParamCoordGuess[1] = ParamCoord[1]; ParamCoordGuess[2] = ParamCoord[2];
-
+
if (Diff >= config->GetFFD_Tol()) {
cout << "Please check this point: Local (" << ParamCoord[0] <<" "<< ParamCoord[1] <<" "<< ParamCoord[2] <<") <-> Global ("
<< CartCoord[0] <<" "<< CartCoord[1] <<" "<< CartCoord[2] <<") <-> Error "<< Diff <<" vs "<< config->GetFFD_Tol() <<"." << endl;
}
-
+
}
else {
-
+
if (Diff >= config->GetFFD_Tol()) {
cout << "Please check this point: Local (" << ParamCoord[0] <<" "<< ParamCoord[1] <<" "<< ParamCoord[2] <<") <-> Global ("
<< CartCoord[0] <<" "<< CartCoord[1] <<" "<< CartCoord[2] <<") <-> Error "<< Diff <<" vs "<< config->GetFFD_Tol() <<"." << endl;
}
-
+
}
-
+
}
}
}
@@ -3359,15 +3359,15 @@ void CSurfaceMovement::SetParametricCoord(CGeometry *geometry, CConfig *config,
#else
MaxDiff = my_MaxDiff;
#endif
-
+
if (rank == MASTER_NODE)
cout << "Compute parametric coord | FFD box: " << FFDBox->GetTag() << ". Max Diff: " << MaxDiff <<"."<< endl;
-
-
- /*--- After the point inversion, copy the original
+
+
+ /*--- After the point inversion, copy the original
information back (this only works with boxes,
and we maintain an internal copy) ---*/
-
+
if (BoxFFD) {
FFDBox->SetOriginalControlPoints();
if (config->GetFFD_Blending() == BEZIER){
@@ -3381,7 +3381,7 @@ void CSurfaceMovement::SetParametricCoord(CGeometry *geometry, CConfig *config,
void CSurfaceMovement::SetParametricCoordCP(CGeometry *geometry, CConfig *config, CFreeFormDefBox *FFDBoxParent, CFreeFormDefBox *FFDBoxChild) {
unsigned short iOrder, jOrder, kOrder;
su2double *CartCoord, *ParamCoord, ParamCoordGuess[3];
-
+
for (iOrder = 0; iOrder < FFDBoxChild->GetlOrder(); iOrder++)
for (jOrder = 0; jOrder < FFDBoxChild->GetmOrder(); jOrder++)
for (kOrder = 0; kOrder < FFDBoxChild->GetnOrder(); kOrder++) {
@@ -3399,12 +3399,12 @@ void CSurfaceMovement::SetParametricCoordCP(CGeometry *geometry, CConfig *config
void CSurfaceMovement::GetCartesianCoordCP(CGeometry *geometry, CConfig *config, CFreeFormDefBox *FFDBoxParent, CFreeFormDefBox *FFDBoxChild) {
unsigned short iOrder, jOrder, kOrder, iDim;
su2double *CartCoord, *ParamCoord;
-
+
for (iOrder = 0; iOrder < FFDBoxChild->GetlOrder(); iOrder++)
for (jOrder = 0; jOrder < FFDBoxChild->GetmOrder(); jOrder++)
for (kOrder = 0; kOrder < FFDBoxChild->GetnOrder(); kOrder++) {
ParamCoord = FFDBoxChild->GetParCoordControlPoints(iOrder, jOrder, kOrder);
-
+
/*--- Clip the value of the parametric coordinates (just in case) ---*/
for (iDim = 0; iDim < 3; iDim++) {
if (ParamCoord[iDim] >= 1.0) ParamCoord[iDim] = 1.0;
@@ -3414,24 +3414,24 @@ void CSurfaceMovement::GetCartesianCoordCP(CGeometry *geometry, CConfig *config,
CartCoord = FFDBoxParent->EvalCartesianCoord(ParamCoord);
FFDBoxChild->SetCoordControlPoints(CartCoord, iOrder, jOrder, kOrder);
FFDBoxChild->SetCoordControlPoints_Copy(CartCoord, iOrder, jOrder, kOrder);
-
+
}
-
+
if (rank == MASTER_NODE)
cout << "Update cartesian coord (CP) | FFD parent box: " << FFDBoxParent->GetTag() << ". FFD child box: " << FFDBoxChild->GetTag() <<"."<< endl;
}
void CSurfaceMovement::CheckFFDDimension(CGeometry *geometry, CConfig *config, CFreeFormDefBox *FFDBox, unsigned short iFFDBox) {
-
+
unsigned short iIndex, jIndex, kIndex, lDegree, mDegree, nDegree, iDV;
bool OutOffLimits;
bool polar = (config->GetFFD_CoordSystem() == POLAR);
-
+
lDegree = FFDBox->GetlOrder()-1;
mDegree = FFDBox->GetmOrder()-1;
nDegree = FFDBox->GetnOrder()-1;
-
+
OutOffLimits = false;
for (iDV = 0; iDV < config->GetnDV(); iDV++) {
if (config->GetFFDTag(iDV)== FFDBox->GetTag()){
@@ -3470,7 +3470,7 @@ void CSurfaceMovement::CheckFFDDimension(CGeometry *geometry, CConfig *config, C
}
}
}
-
+
if (rank == MASTER_NODE) {
if (OutOffLimits) {
char buf1[100], buf2[100];
@@ -3479,17 +3479,17 @@ void CSurfaceMovement::CheckFFDDimension(CGeometry *geometry, CConfig *config, C
SU2_MPI::Error(string(buf1) + string(buf2), CURRENT_FUNCTION);
}
}
-
+
/*--- This barrier is important to guaranty that we will stop the software in a clean way ---*/
-
+
#ifdef HAVE_MPI
SU2_MPI::Barrier(MPI_COMM_WORLD);
#endif
-
+
}
void CSurfaceMovement::CheckFFDIntersections(CGeometry *geometry, CConfig *config, CFreeFormDefBox *FFDBox, unsigned short iFFDBox) {
-
+
su2double Coord_0[] = {0,0,0}, Coord_1[] = {0,0,0};
unsigned short index, iMarker, iNode, jNode, lDegree, mDegree, nDegree, iDim;
unsigned long iElem, iPoint, jPoint;
@@ -3504,159 +3504,159 @@ void CSurfaceMovement::CheckFFDIntersections(CGeometry *geometry, CConfig *confi
bool spherical = (config->GetFFD_CoordSystem() == SPHERICAL);
bool polar = (config->GetFFD_CoordSystem() == POLAR);
bool cartesian = (config->GetFFD_CoordSystem() == CARTESIAN);
-
+
lDegree = FFDBox->GetlOrder()-1;
mDegree = FFDBox->GetmOrder()-1;
nDegree = FFDBox->GetnOrder()-1;
-
+
if (config->GetFFD_Continuity() != USER_INPUT) {
-
+
/*--- Check intersection with plane i=0 ---*/
-
+
su2double *IPlane_Coord_0_A = FFDBox->GetCoordControlPoints(0, 0, 0);
su2double *IPlane_Coord_1_A = FFDBox->GetCoordControlPoints(0, 0, nDegree);
su2double *IPlane_Coord_2_A = FFDBox->GetCoordControlPoints(0, mDegree, 0);
-
+
su2double *IPlane_Coord_0_A_ = FFDBox->GetCoordControlPoints(0, mDegree, nDegree);
su2double *IPlane_Coord_1_A_ = FFDBox->GetCoordControlPoints(0, mDegree, 0);
su2double *IPlane_Coord_2_A_ = FFDBox->GetCoordControlPoints(0, 0, nDegree);
-
+
/*--- Check intersection with plane i=lDegree ---*/
-
+
su2double *IPlane_Coord_0_B = FFDBox->GetCoordControlPoints(lDegree, 0, 0);
su2double *IPlane_Coord_1_B = FFDBox->GetCoordControlPoints(lDegree, 0, nDegree);
su2double *IPlane_Coord_2_B = FFDBox->GetCoordControlPoints(lDegree, mDegree, 0);
-
+
su2double *IPlane_Coord_0_B_ = FFDBox->GetCoordControlPoints(lDegree, mDegree, nDegree);
su2double *IPlane_Coord_1_B_ = FFDBox->GetCoordControlPoints(lDegree, mDegree, 0);
su2double *IPlane_Coord_2_B_ = FFDBox->GetCoordControlPoints(lDegree, 0, nDegree);
-
+
/*--- Check intersection with plane j=0 ---*/
-
+
su2double *JPlane_Coord_0_A = FFDBox->GetCoordControlPoints(0, 0, 0);
su2double *JPlane_Coord_1_A = FFDBox->GetCoordControlPoints(0, 0, nDegree);
su2double *JPlane_Coord_2_A = FFDBox->GetCoordControlPoints(lDegree, 0, 0);
-
+
su2double *JPlane_Coord_0_A_ = FFDBox->GetCoordControlPoints(lDegree, 0, nDegree);
su2double *JPlane_Coord_1_A_ = FFDBox->GetCoordControlPoints(lDegree, 0, 0);
su2double *JPlane_Coord_2_A_ = FFDBox->GetCoordControlPoints(0, 0, nDegree);
-
+
/*--- Check intersection with plane j=mDegree ---*/
-
+
su2double *JPlane_Coord_0_B = FFDBox->GetCoordControlPoints(0, mDegree, 0);
su2double *JPlane_Coord_1_B = FFDBox->GetCoordControlPoints(0, mDegree, nDegree);
su2double *JPlane_Coord_2_B = FFDBox->GetCoordControlPoints(lDegree, mDegree, 0);
-
+
su2double *JPlane_Coord_0_B_ = FFDBox->GetCoordControlPoints(lDegree, mDegree, nDegree);
su2double *JPlane_Coord_1_B_ = FFDBox->GetCoordControlPoints(lDegree, mDegree, 0);
su2double *JPlane_Coord_2_B_ = FFDBox->GetCoordControlPoints(0, mDegree, nDegree);
-
+
/*--- Check intersection with plane k=0 ---*/
-
+
su2double *KPlane_Coord_0_A = FFDBox->GetCoordControlPoints(0, 0, 0);
su2double *KPlane_Coord_1_A = FFDBox->GetCoordControlPoints(0, mDegree, 0);
su2double *KPlane_Coord_2_A = FFDBox->GetCoordControlPoints(lDegree, 0, 0);
-
+
su2double *KPlane_Coord_0_A_ = FFDBox->GetCoordControlPoints(lDegree, mDegree, 0);
su2double *KPlane_Coord_1_A_ = FFDBox->GetCoordControlPoints(lDegree, 0, 0);
su2double *KPlane_Coord_2_A_ = FFDBox->GetCoordControlPoints(0, mDegree, 0);
-
+
/*--- Check intersection with plane k=nDegree ---*/
-
+
su2double *KPlane_Coord_0_B = FFDBox->GetCoordControlPoints(0, 0, nDegree);
su2double *KPlane_Coord_1_B = FFDBox->GetCoordControlPoints(0, mDegree, nDegree);
su2double *KPlane_Coord_2_B = FFDBox->GetCoordControlPoints(lDegree, 0, nDegree);
-
+
su2double *KPlane_Coord_0_B_ = FFDBox->GetCoordControlPoints(lDegree, mDegree, nDegree);
su2double *KPlane_Coord_1_B_ = FFDBox->GetCoordControlPoints(lDegree, 0, nDegree);
su2double *KPlane_Coord_2_B_ = FFDBox->GetCoordControlPoints(0, mDegree, nDegree);
-
+
/*--- Loop over all the grid triangles ---*/
-
+
IPlane_Intersect_A = false; IPlane_Intersect_B = false;
JPlane_Intersect_A = false; JPlane_Intersect_B = false;
KPlane_Intersect_A = false; KPlane_Intersect_B = false;
-
+
/*--- Only the markers in the moving list ---*/
-
+
for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) {
-
+
if (((config->GetMarker_All_Moving(iMarker) == YES) && (Kind_SU2 == SU2_CFD)) ||
((config->GetMarker_All_DV(iMarker) == YES) && (Kind_SU2 == SU2_DEF)) ||
((config->GetMarker_All_DV(iMarker) == YES) && (Kind_SU2 == SU2_GEO)) ||
((config->GetMarker_All_DV(iMarker) == YES) && (Kind_SU2 == SU2_DOT)) ||
((config->GetMarker_All_DV(iMarker) == YES) && (config->GetDirectDiff() == D_DESIGN))) {
-
+
for (iElem = 0; iElem < geometry->GetnElem_Bound(iMarker); iElem++) {
-
+
for (iNode = 0; iNode < geometry->bound[iMarker][iElem]->GetnNodes(); iNode++) {
iPoint = geometry->bound[iMarker][iElem]->GetNode(iNode);
-
+
for (jNode = 0; jNode < geometry->bound[iMarker][iElem]->GetnNodes(); jNode++) {
jPoint = geometry->bound[iMarker][iElem]->GetNode(jNode);
-
+
if (jPoint > iPoint) {
-
+
for (iDim = 0; iDim < geometry->GetnDim(); iDim++) {
- Coord_0[iDim] = geometry->node[iPoint]->GetCoord()[iDim];
- Coord_1[iDim] = geometry->node[jPoint]->GetCoord()[iDim];
+ Coord_0[iDim] = geometry->nodes->GetCoord(iPoint,iDim);
+ Coord_1[iDim] = geometry->nodes->GetCoord(jPoint,iDim);
}
-
+
/*--- Write the coordinates in the right parametric system ---*/
-
+
if (cylindrical) {
-
+
X_0 = config->GetFFD_Axis(0); Y_0 = config->GetFFD_Axis(1); Z_0 = config->GetFFD_Axis(2);
-
+
Xbar = Coord_0[0] - X_0; Ybar = Coord_0[1] - Y_0; Zbar = Coord_0[2] - Z_0;
-
+
Coord_0[0] = sqrt(Ybar*Ybar + Zbar*Zbar);
Coord_0[1] = atan2(Zbar, Ybar); if (Coord_0[1] > PI_NUMBER/2.0) Coord_0[1] -= 2.0*PI_NUMBER;
Coord_0[2] = Xbar;
-
+
Xbar = Coord_1[0] - X_0; Ybar = Coord_1[1] - Y_0; Zbar = Coord_1[2] - Z_0;
-
+
Coord_1[0] = sqrt(Ybar*Ybar + Zbar*Zbar);
Coord_1[1] = atan2(Zbar, Ybar); if (Coord_1[1] > PI_NUMBER/2.0) Coord_1[1] -= 2.0*PI_NUMBER;
Coord_1[2] = Xbar;
-
+
}
-
+
else if (spherical || polar) {
-
+
X_0 = config->GetFFD_Axis(0); Y_0 = config->GetFFD_Axis(1); Z_0 = config->GetFFD_Axis(2);
-
+
Xbar = Coord_0[0] - X_0; Ybar = Coord_0[1] - Y_0; Zbar = Coord_0[2] - Z_0;
-
+
Coord_0[0] = sqrt(Xbar*Xbar + Ybar*Ybar + Zbar*Zbar);
Coord_0[1] = atan2(Zbar, Ybar); if (Coord_0[1] > PI_NUMBER/2.0) Coord_0[1] -= 2.0*PI_NUMBER;
Coord_0[2] = acos (Xbar/Coord_0[0]);
-
+
Xbar = Coord_1[0] - X_0; Ybar = Coord_1[1] - Y_0; Zbar = Coord_1[2] - Z_0;
-
+
Coord_1[0] = sqrt(Xbar*Xbar + Ybar*Ybar + Zbar*Zbar);
Coord_1[1] = atan2(Zbar, Ybar); if (Coord_1[1] > PI_NUMBER/2.0) Coord_1[1] -= 2.0*PI_NUMBER;
Coord_1[2] = acos(Xbar/Coord_1[0]);
-
+
}
-
+
if (geometry->GetnDim() == 3) {
-
+
if (!IPlane_Intersect_A) {
if (geometry->SegmentIntersectsTriangle(Coord_0, Coord_1, IPlane_Coord_0_A, IPlane_Coord_1_A, IPlane_Coord_2_A)) { IPlane_Intersect_A = true; }
if (geometry->SegmentIntersectsTriangle(Coord_0, Coord_1, IPlane_Coord_0_A_, IPlane_Coord_1_A_, IPlane_Coord_2_A_)) { IPlane_Intersect_A = true; }
}
-
+
if (!IPlane_Intersect_B) {
if (geometry->SegmentIntersectsTriangle(Coord_0, Coord_1, IPlane_Coord_0_B, IPlane_Coord_1_B, IPlane_Coord_2_B)) { IPlane_Intersect_B = true; }
if (geometry->SegmentIntersectsTriangle(Coord_0, Coord_1, IPlane_Coord_0_B_, IPlane_Coord_1_B_, IPlane_Coord_2_B_)) { IPlane_Intersect_B = true; }
}
-
+
if ((!JPlane_Intersect_A) && (!FFD_Symmetry_Plane)) {
if (geometry->SegmentIntersectsTriangle(Coord_0, Coord_1, JPlane_Coord_0_A, JPlane_Coord_1_A, JPlane_Coord_2_A)) { JPlane_Intersect_A = true; }
if (geometry->SegmentIntersectsTriangle(Coord_0, Coord_1, JPlane_Coord_0_A_, JPlane_Coord_1_A_, JPlane_Coord_2_A_)) { JPlane_Intersect_A = true; }
}
-
+
if (cartesian) {
if ((!JPlane_Intersect_B) && (!FFD_Symmetry_Plane)) {
if (geometry->SegmentIntersectsTriangle(Coord_0, Coord_1, JPlane_Coord_0_B, JPlane_Coord_1_B, JPlane_Coord_2_B)) { JPlane_Intersect_B = true; }
@@ -3669,19 +3669,19 @@ void CSurfaceMovement::CheckFFDIntersections(CGeometry *geometry, CConfig *confi
if (geometry->SegmentIntersectsTriangle(Coord_0, Coord_1, JPlane_Coord_0_B_, JPlane_Coord_1_B_, JPlane_Coord_2_B_)) { JPlane_Intersect_B = true; }
}
}
-
+
if (!KPlane_Intersect_A) {
if (geometry->SegmentIntersectsTriangle(Coord_0, Coord_1, KPlane_Coord_0_A, KPlane_Coord_1_A, KPlane_Coord_2_A)) { KPlane_Intersect_A = true; }
if (geometry->SegmentIntersectsTriangle(Coord_0, Coord_1, KPlane_Coord_0_A_, KPlane_Coord_1_A_, KPlane_Coord_2_A_)) { KPlane_Intersect_A = true; }
}
-
+
if (!KPlane_Intersect_B) {
if (geometry->SegmentIntersectsTriangle(Coord_0, Coord_1, KPlane_Coord_0_B, KPlane_Coord_1_B, KPlane_Coord_2_B)) { KPlane_Intersect_B = true; }
if (geometry->SegmentIntersectsTriangle(Coord_0, Coord_1, KPlane_Coord_0_B_, KPlane_Coord_1_B_, KPlane_Coord_2_B_)) { KPlane_Intersect_B = true; }
}
-
+
} else {
-
+
if (!IPlane_Intersect_A) {
if (geometry->SegmentIntersectsLine(Coord_0, Coord_1, IPlane_Coord_0_A, IPlane_Coord_2_A)) { IPlane_Intersect_A = true;}
}
@@ -3701,48 +3701,48 @@ void CSurfaceMovement::CheckFFDIntersections(CGeometry *geometry, CConfig *confi
}
}
}
-
+
/*--- Comunicate the planes that interesect the surface ---*/
-
+
unsigned short MyCode[6] = {0,0,0,0,0,0}, Code[6] = {0,0,0,0,0,0};
-
+
if (IPlane_Intersect_A) MyCode[0] = 1;
if (IPlane_Intersect_B) MyCode[1] = 1;
if (JPlane_Intersect_A) MyCode[2] = 1;
if (JPlane_Intersect_B) MyCode[3] = 1;
if (KPlane_Intersect_A) MyCode[4] = 1;
if (KPlane_Intersect_B) MyCode[5] = 1;
-
+
#ifdef HAVE_MPI
-
+
/*--- Add SU2_MPI::Allreduce information using all the nodes ---*/
-
+
SU2_MPI::Allreduce(&MyCode, &Code, 6, MPI_UNSIGNED_SHORT, MPI_SUM, MPI_COMM_WORLD);
-
+
#else
-
+
Code[0] = MyCode[0]; Code[1] = MyCode[1]; Code[2] = MyCode[2];
Code[3] = MyCode[3]; Code[4] = MyCode[4]; Code[5] = MyCode[5];
-
+
#endif
-
+
if (Code[0] != 0) IPlane_Intersect_A = true; else IPlane_Intersect_A = false;
if (Code[1] != 0) IPlane_Intersect_B = true; else IPlane_Intersect_B = false;
if (Code[2] != 0) JPlane_Intersect_A = true; else JPlane_Intersect_A = false;
if (Code[3] != 0) JPlane_Intersect_B = true; else JPlane_Intersect_B = false;
if (Code[4] != 0) KPlane_Intersect_A = true; else KPlane_Intersect_A = false;
if (Code[5] != 0) KPlane_Intersect_B = true; else KPlane_Intersect_B = false;
-
+
/*--- Screen output ---*/
-
+
if (rank == MASTER_NODE) {
-
+
if (IPlane_Intersect_A || IPlane_Intersect_B ||
JPlane_Intersect_A || JPlane_Intersect_B ||
KPlane_Intersect_A || KPlane_Intersect_B ) {
-
+
cout << "The FFD planes ";
-
+
if (cartesian) {
if (IPlane_Intersect_A) cout << "i=0, ";
if (IPlane_Intersect_B) cout << "i="<< lDegree << ", ";
@@ -3773,22 +3773,22 @@ void CSurfaceMovement::CheckFFDIntersections(CGeometry *geometry, CConfig *confi
if (KPlane_Intersect_A) cout << "theta=0, ";
if (KPlane_Intersect_B) cout << "theta="<< nDegree << ", ";
}
-
+
cout << "intersect solid surfaces." << endl;
}
-
+
}
-
+
}
-
+
/*--- Fix the FFD planes based on the intersections with solid surfaces,
and the continuity level, check that we have enough degree for the continuity
that we are looking for ---*/
-
+
if (config->GetFFD_Continuity() == USER_INPUT) {
if (rank == MASTER_NODE)
cout << "SU2 is fixing user's input planes." << endl;
-
+
for (index = 0; index < config->GetnFFD_Fix_IDir(); index++)
if ((config->GetFFD_Fix_IDir(index) <= lDegree) && (config->GetFFD_Fix_IDir(index) >= 0))
FFDBox->Set_Fix_IPlane(config->GetFFD_Fix_IDir(index));
@@ -3798,48 +3798,48 @@ void CSurfaceMovement::CheckFFDIntersections(CGeometry *geometry, CConfig *confi
for (index = 0; index < config->GetnFFD_Fix_KDir(); index++)
if ((config->GetFFD_Fix_KDir(index) <= nDegree) && (config->GetFFD_Fix_KDir(index) >= 0))
FFDBox->Set_Fix_KPlane(config->GetFFD_Fix_KDir(index));
-
+
}
-
+
if (config->GetFFD_Continuity() == DERIVATIVE_NONE) {
if (rank == MASTER_NODE)
cout << "SU2 is fixing the planes to maintain a continuous surface." << endl;
-
+
if (IPlane_Intersect_A) { FFDBox->Set_Fix_IPlane(0); }
if (IPlane_Intersect_B) { FFDBox->Set_Fix_IPlane(lDegree); }
if (JPlane_Intersect_A) { FFDBox->Set_Fix_JPlane(0); }
if (JPlane_Intersect_B) { FFDBox->Set_Fix_JPlane(mDegree); }
if (KPlane_Intersect_A) { FFDBox->Set_Fix_KPlane(0); }
if (KPlane_Intersect_B) { FFDBox->Set_Fix_KPlane(nDegree); }
-
+
}
-
+
if (config->GetFFD_Continuity() == DERIVATIVE_1ST) {
if (rank == MASTER_NODE)
cout << "SU2 is fixing the planes to maintain a continuous 1st order derivative." << endl;
-
+
if (IPlane_Intersect_A) { FFDBox->Set_Fix_IPlane(0); FFDBox->Set_Fix_IPlane(1); }
if (IPlane_Intersect_B) { FFDBox->Set_Fix_IPlane(lDegree); FFDBox->Set_Fix_IPlane(lDegree-1); }
if (JPlane_Intersect_A) { FFDBox->Set_Fix_JPlane(0); FFDBox->Set_Fix_JPlane(1); }
if (JPlane_Intersect_B) { FFDBox->Set_Fix_JPlane(mDegree); FFDBox->Set_Fix_JPlane(mDegree-1); }
if (KPlane_Intersect_A) { FFDBox->Set_Fix_KPlane(0); FFDBox->Set_Fix_KPlane(1); }
if (KPlane_Intersect_B) { FFDBox->Set_Fix_KPlane(nDegree); FFDBox->Set_Fix_KPlane(nDegree-1); }
-
+
}
-
+
if (config->GetFFD_Continuity() == DERIVATIVE_2ND) {
if (rank == MASTER_NODE)
cout << "SU2 is fixing the planes to maintain a continuous 2nd order derivative." << endl;
-
+
if ((IPlane_Intersect_A) && (lDegree > 1)) { FFDBox->Set_Fix_IPlane(0); FFDBox->Set_Fix_IPlane(1); FFDBox->Set_Fix_IPlane(2); }
if ((IPlane_Intersect_B) && (lDegree > 1)) { FFDBox->Set_Fix_IPlane(lDegree); FFDBox->Set_Fix_IPlane(lDegree-1); FFDBox->Set_Fix_IPlane(lDegree-2); }
if ((JPlane_Intersect_A) && (mDegree > 1)) { FFDBox->Set_Fix_JPlane(0); FFDBox->Set_Fix_JPlane(1); FFDBox->Set_Fix_JPlane(2); }
if ((JPlane_Intersect_B) && (mDegree > 1)) { FFDBox->Set_Fix_JPlane(mDegree); FFDBox->Set_Fix_JPlane(mDegree-1); FFDBox->Set_Fix_JPlane(mDegree-2); }
if ((KPlane_Intersect_A) && (nDegree > 1)) { FFDBox->Set_Fix_KPlane(0); FFDBox->Set_Fix_KPlane(1);FFDBox->Set_Fix_KPlane(2); }
if ((KPlane_Intersect_B) && (nDegree > 1)) { FFDBox->Set_Fix_KPlane(nDegree); FFDBox->Set_Fix_KPlane(nDegree-1); FFDBox->Set_Fix_KPlane(nDegree-2); }
-
+
}
-
+
}
void CSurfaceMovement::UpdateParametricCoord(CGeometry *geometry, CConfig *config, CFreeFormDefBox *FFDBox, unsigned short iFFDBox) {
@@ -3848,87 +3848,87 @@ void CSurfaceMovement::UpdateParametricCoord(CGeometry *geometry, CConfig *confi
su2double CartCoord[3] = {0.0,0.0,0.0}, *CartCoordNew, *CartCoordOld;
su2double *ParamCoord, *var_coord, ParamCoordGuess[3] = {0.0,0.0,0.0};
su2double MaxDiff, my_MaxDiff = 0.0, Diff;
-
+
/*--- Recompute the parametric coordinates ---*/
-
+
for (iSurfacePoints = 0; iSurfacePoints < FFDBox->GetnSurfacePoint(); iSurfacePoints++) {
-
+
/*--- Get the marker of the surface point ---*/
-
+
iMarker = FFDBox->Get_MarkerIndex(iSurfacePoints);
-
+
if (config->GetMarker_All_DV(iMarker) == YES) {
-
+
/*--- Get the vertex of the surface point ---*/
-
+
iVertex = FFDBox->Get_VertexIndex(iSurfacePoints);
iPoint = FFDBox->Get_PointIndex(iSurfacePoints);
-
- /*--- Get the parametric and cartesians coordinates of the
+
+ /*--- Get the parametric and cartesians coordinates of the
surface point (they don't mach) ---*/
-
+
ParamCoord = FFDBox->Get_ParametricCoord(iSurfacePoints);
-
- /*--- Compute and set the cartesian coord using the variation computed
+
+ /*--- Compute and set the cartesian coord using the variation computed
with the previous deformation ---*/
-
+
var_coord = geometry->vertex[iMarker][iVertex]->GetVarCoord();
- CartCoordOld = geometry->node[iPoint]->GetCoord();
+ CartCoordOld = geometry->nodes->GetCoord(iPoint);
for (iDim = 0; iDim < 3; iDim++)
CartCoord[iDim] = CartCoordOld[iDim] + var_coord[iDim];
FFDBox->Set_CartesianCoord(CartCoord, iSurfacePoints);
/*--- Find the parametric coordinate using as ParamCoordGuess the previous value ---*/
-
+
ParamCoordGuess[0] = ParamCoord[0]; ParamCoordGuess[1] = ParamCoord[1]; ParamCoordGuess[2] = ParamCoord[2];
ParamCoord = FFDBox->GetParametricCoord_Iterative(iPoint, CartCoord, ParamCoordGuess, config);
-
+
/*--- Set the new value of the parametric coordinates ---*/
-
+
FFDBox->Set_ParametricCoord(ParamCoord, iSurfacePoints);
-
- /*--- Compute the cartesian coordinates using the parametric coordinates
+
+ /*--- Compute the cartesian coordinates using the parametric coordinates
to check that everything is correct ---*/
-
+
CartCoordNew = FFDBox->EvalCartesianCoord(ParamCoord);
-
+
/*--- Compute max difference between original value and the recomputed value ---*/
-
+
Diff = 0.0;
for (iDim = 0; iDim < geometry->GetnDim(); iDim++)
Diff += (CartCoordNew[iDim]-CartCoord[iDim])*(CartCoordNew[iDim]-CartCoord[iDim]);
Diff = sqrt(Diff);
my_MaxDiff = max(my_MaxDiff, Diff);
-
+
}
}
-
+
#ifdef HAVE_MPI
SU2_MPI::Allreduce(&my_MaxDiff, &MaxDiff, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
#else
MaxDiff = my_MaxDiff;
#endif
-
- if (rank == MASTER_NODE)
+
+ if (rank == MASTER_NODE)
cout << "Update parametric coord | FFD box: " << FFDBox->GetTag() << ". Max Diff: " << MaxDiff <<"."<< endl;
-
+
}
su2double CSurfaceMovement::SetCartesianCoord(CGeometry *geometry, CConfig *config, CFreeFormDefBox *FFDBox, unsigned short iFFDBox, bool ResetDef) {
-
+
su2double *CartCoordNew, Diff, my_MaxDiff = 0.0, MaxDiff,
*ParamCoord, VarCoord[3] = {0.0, 0.0, 0.0}, CartCoordOld[3] = {0.0, 0.0, 0.0};
unsigned short iMarker, iDim;
unsigned long iVertex, iPoint, iSurfacePoints;
-
+
bool cylindrical = (config->GetFFD_CoordSystem() == CYLINDRICAL);
bool spherical = (config->GetFFD_CoordSystem() == SPHERICAL);
bool polar = (config->GetFFD_CoordSystem() == POLAR);
unsigned short nDim = geometry->GetnDim();
-
+
/*--- Set to zero all the porints in VarCoord, this is important when we are dealing with different boxes
because a loop over GetnSurfacePoint is no sufficient ---*/
-
+
if (ResetDef) {
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
@@ -3936,72 +3936,72 @@ su2double CSurfaceMovement::SetCartesianCoord(CGeometry *geometry, CConfig *conf
}
}
}
-
+
/*--- Recompute the cartesians coordinates ---*/
-
+
for (iSurfacePoints = 0; iSurfacePoints < FFDBox->GetnSurfacePoint(); iSurfacePoints++) {
-
+
/*--- Get the marker of the surface point ---*/
-
+
iMarker = FFDBox->Get_MarkerIndex(iSurfacePoints);
-
+
if (config->GetMarker_All_DV(iMarker) == YES) {
-
+
/*--- Get the vertex of the surface point ---*/
-
+
iVertex = FFDBox->Get_VertexIndex(iSurfacePoints);
iPoint = FFDBox->Get_PointIndex(iSurfacePoints);
-
+
/*--- Set to zero the variation of the coordinates ---*/
-
+
geometry->vertex[iMarker][iVertex]->SetVarCoord(VarCoord);
-
+
/*--- Get the parametric coordinate of the surface point ---*/
-
+
ParamCoord = FFDBox->Get_ParametricCoord(iSurfacePoints);
-
+
/*--- Compute the new cartesian coordinate, and set the value in
the FFDBox structure ---*/
-
+
CartCoordNew = FFDBox->EvalCartesianCoord(ParamCoord);
-
+
/*--- If polar coordinates, compute the cartesians from the polar value ---*/
-
+
if (cylindrical) {
-
+
su2double X_0, Y_0, Z_0, Xbar, Ybar, Zbar;
X_0 = config->GetFFD_Axis(0); Y_0 = config->GetFFD_Axis(1); Z_0 = config->GetFFD_Axis(2);
-
+
Xbar = CartCoordNew[2];
Ybar = CartCoordNew[0] * cos(CartCoordNew[1]);
Zbar = CartCoordNew[0] * sin(CartCoordNew[1]);
-
+
CartCoordNew[0] = Xbar + X_0; CartCoordNew[1] = Ybar + Y_0; CartCoordNew[2] = Zbar + Z_0;
-
+
}
else if (spherical || polar) {
-
+
su2double X_0, Y_0, Z_0, Xbar, Ybar, Zbar;
X_0 = config->GetFFD_Axis(0); Y_0 = config->GetFFD_Axis(1); Z_0 = config->GetFFD_Axis(2);
-
+
Xbar = CartCoordNew[0] * cos(CartCoordNew[2]);
Ybar = CartCoordNew[0] * cos(CartCoordNew[1]) * sin(CartCoordNew[2]);
Zbar = CartCoordNew[0] * sin(CartCoordNew[1]) * sin(CartCoordNew[2]);
-
+
CartCoordNew[0] = Xbar + X_0; CartCoordNew[1] = Ybar + Y_0; CartCoordNew[2] = Zbar + Z_0;
-
+
}
-
+
FFDBox->Set_CartesianCoord(CartCoordNew, iSurfacePoints);
-
+
/*--- Get the original cartesian coordinates of the surface point ---*/
-
+
for (iDim = 0; iDim < nDim; iDim++) {
- CartCoordOld[iDim] = geometry->node[iPoint]->GetCoord(iDim);
+ CartCoordOld[iDim] = geometry->nodes->GetCoord(iPoint, iDim);
}
-
+
/*--- Set the value of the variation of the coordinates ---*/
-
+
Diff = 0.0;
for (iDim = 0; iDim < nDim; iDim++) {
VarCoord[iDim] = CartCoordNew[iDim] - CartCoordOld[iDim];
@@ -4010,25 +4010,25 @@ su2double CSurfaceMovement::SetCartesianCoord(CGeometry *geometry, CConfig *conf
Diff += (VarCoord[iDim]*VarCoord[iDim]);
}
Diff = sqrt(Diff);
-
+
my_MaxDiff = max(my_MaxDiff, Diff);
-
+
/*--- Set the variation of the coordinates ---*/
-
+
geometry->vertex[iMarker][iVertex]->SetVarCoord(VarCoord);
-
+
}
}
-
+
#ifdef HAVE_MPI
SU2_MPI::Allreduce(&my_MaxDiff, &MaxDiff, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
#else
MaxDiff = my_MaxDiff;
#endif
-
+
if (rank == MASTER_NODE)
cout << "Update cartesian coord | FFD box: " << FFDBox->GetTag() << ". Max Diff: " << MaxDiff <<"."<< endl;
-
+
return MaxDiff;
}
@@ -4036,7 +4036,7 @@ su2double CSurfaceMovement::SetCartesianCoord(CGeometry *geometry, CConfig *conf
bool CSurfaceMovement::SetFFDCPChange_2D(CGeometry *geometry, CConfig *config, CFreeFormDefBox *FFDBox, CFreeFormDefBox **ResetFFDBox,
unsigned short iDV, bool ResetDef) {
-
+
su2double movement[3] = {0.0,0.0,0.0}, Ampl;
unsigned short index[3], i, j, iFFDBox, iPlane;
string design_FFDBox;
@@ -4045,25 +4045,25 @@ bool CSurfaceMovement::SetFFDCPChange_2D(CGeometry *geometry, CConfig *config, C
/*--- Set control points to its original value (even if the
design variable is not in this box) ---*/
-
+
if (ResetDef == true) {
for (iFFDBox = 0; iFFDBox < nFFDBox; iFFDBox++)
ResetFFDBox[iFFDBox]->SetOriginalControlPoints();
}
-
+
design_FFDBox = config->GetFFDTag(iDV);
-
+
if (design_FFDBox.compare(FFDBox->GetTag()) == 0) {
-
+
/*--- Compute deformation ---*/
-
+
/*--- If we have only design value, than this value is the amplitude,
* otherwise we have a general movement. ---*/
-
+
if (config->GetnDV_Value(iDV) == 1) {
-
+
Ampl = config->GetDV_Value(iDV)*Scale;
-
+
if (polar){
movement[0] = config->GetParamDV(iDV, 3)*Ampl;
movement[1] = 0.0;
@@ -4074,7 +4074,7 @@ bool CSurfaceMovement::SetFFDCPChange_2D(CGeometry *geometry, CConfig *config, C
movement[1] = config->GetParamDV(iDV, 4)*Ampl;
movement[2] = 0.0;
}
-
+
} else {
if (polar){
movement[0] = config->GetDV_Value(iDV, 0);
@@ -4086,9 +4086,9 @@ bool CSurfaceMovement::SetFFDCPChange_2D(CGeometry *geometry, CConfig *config, C
movement[1] = config->GetDV_Value(iDV, 1);
movement[2] = 0.0;
}
-
+
}
-
+
if (polar){
index[0] = SU2_TYPE::Int(config->GetParamDV(iDV, 1));
index[1] = 0;
@@ -4099,21 +4099,21 @@ bool CSurfaceMovement::SetFFDCPChange_2D(CGeometry *geometry, CConfig *config, C
index[1] = SU2_TYPE::Int(config->GetParamDV(iDV, 2));
index[2] = 0;
}
-
+
/*--- Check that it is possible to move the control point ---*/
-
+
for (iPlane = 0 ; iPlane < FFDBox->Get_nFix_IPlane(); iPlane++) {
if (index[0] == FFDBox->Get_Fix_IPlane(iPlane)) return false;
}
-
+
for (iPlane = 0 ; iPlane < FFDBox->Get_nFix_JPlane(); iPlane++) {
if (index[1] == FFDBox->Get_Fix_JPlane(iPlane)) return false;
}
-
+
for (iPlane = 0 ; iPlane < FFDBox->Get_nFix_KPlane(); iPlane++) {
if (index[2] == FFDBox->Get_Fix_KPlane(iPlane)) return false;
}
-
+
if ((SU2_TYPE::Int(config->GetParamDV(iDV, 1)) == -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 2)) != -1)) {
for (i = 0; i < FFDBox->GetlOrder(); i++) {
@@ -4121,7 +4121,7 @@ bool CSurfaceMovement::SetFFDCPChange_2D(CGeometry *geometry, CConfig *config, C
FFDBox->SetControlPoints(index, movement);
}
}
-
+
if ((SU2_TYPE::Int(config->GetParamDV(iDV, 1)) != -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 2)) == -1)) {
for (j = 0; j < FFDBox->GetmOrder(); j++) {
@@ -4129,7 +4129,7 @@ bool CSurfaceMovement::SetFFDCPChange_2D(CGeometry *geometry, CConfig *config, C
FFDBox->SetControlPoints(index, movement);
}
}
-
+
if ((SU2_TYPE::Int(config->GetParamDV(iDV, 1)) == -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 2)) == -1)) {
for (i = 0; i < FFDBox->GetlOrder(); i++) {
@@ -4142,12 +4142,12 @@ bool CSurfaceMovement::SetFFDCPChange_2D(CGeometry *geometry, CConfig *config, C
}
if ((SU2_TYPE::Int(config->GetParamDV(iDV, 1)) != -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 2)) != -1)) {
-
+
FFDBox->SetControlPoints(index, movement);
}
-
+
/*--- Upper surface ---*/
-
+
if (polar) index[1] = 1;
else index[2] = 1;
@@ -4158,7 +4158,7 @@ bool CSurfaceMovement::SetFFDCPChange_2D(CGeometry *geometry, CConfig *config, C
FFDBox->SetControlPoints(index, movement);
}
}
-
+
if ((SU2_TYPE::Int(config->GetParamDV(iDV, 1)) != -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 2)) == -1)) {
for (j = 0; j < FFDBox->GetmOrder(); j++) {
@@ -4166,7 +4166,7 @@ bool CSurfaceMovement::SetFFDCPChange_2D(CGeometry *geometry, CConfig *config, C
FFDBox->SetControlPoints(index, movement);
}
}
-
+
if ((SU2_TYPE::Int(config->GetParamDV(iDV, 1)) == -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 2)) == -1)) {
for (i = 0; i < FFDBox->GetlOrder(); i++) {
@@ -4179,127 +4179,127 @@ bool CSurfaceMovement::SetFFDCPChange_2D(CGeometry *geometry, CConfig *config, C
}
if ((SU2_TYPE::Int(config->GetParamDV(iDV, 1)) != -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 2)) != -1)) {
-
+
FFDBox->SetControlPoints(index, movement);
}
}
else {
return false;
}
-
+
return true;
-
+
}
bool CSurfaceMovement::SetFFDCPChange(CGeometry *geometry, CConfig *config, CFreeFormDefBox *FFDBox, CFreeFormDefBox **ResetFFDBox,
unsigned short iDV, bool ResetDef) {
-
+
su2double movement[3] = {0.0,0.0,0.0}, Ampl;
unsigned short index[3], i, j, k, iPlane, iFFDBox;
bool CheckIndex;
string design_FFDBox;
su2double Scale = config->GetOpt_RelaxFactor();
-
+
/*--- Set control points to its original value (even if the
design variable is not in this box) ---*/
-
+
if (ResetDef == true) {
FFDBox->SetOriginalControlPoints();
for (iFFDBox = 0; iFFDBox < nFFDBox; iFFDBox++)
ResetFFDBox[iFFDBox]->SetOriginalControlPoints();
}
-
+
design_FFDBox = config->GetFFDTag(iDV);
-
+
if (design_FFDBox.compare(FFDBox->GetTag()) == 0) {
-
+
/*--- Compute deformation ---*/
-
+
/*--- If we have only design value, than this value is the amplitude,
* otherwise we have a general movement. ---*/
-
+
if (config->GetnDV_Value(iDV) == 1) {
-
+
Ampl = config->GetDV_Value(iDV)*Scale;
-
+
movement[0] = config->GetParamDV(iDV, 4)*Ampl;
movement[1] = config->GetParamDV(iDV, 5)*Ampl;
movement[2] = config->GetParamDV(iDV, 6)*Ampl;
-
+
} else {
-
+
movement[0] = config->GetDV_Value(iDV, 0);
movement[1] = config->GetDV_Value(iDV, 1);
movement[2] = config->GetDV_Value(iDV, 2);
-
+
}
-
+
index[0] = SU2_TYPE::Int(config->GetParamDV(iDV, 1));
index[1] = SU2_TYPE::Int(config->GetParamDV(iDV, 2));
index[2] = SU2_TYPE::Int(config->GetParamDV(iDV, 3));
-
+
/*--- Check that it is possible to move the control point ---*/
-
+
for (iPlane = 0 ; iPlane < FFDBox->Get_nFix_IPlane(); iPlane++) {
if (index[0] == FFDBox->Get_Fix_IPlane(iPlane)) return false;
}
-
+
for (iPlane = 0 ; iPlane < FFDBox->Get_nFix_JPlane(); iPlane++) {
if (index[1] == FFDBox->Get_Fix_JPlane(iPlane)) return false;
}
-
+
for (iPlane = 0 ; iPlane < FFDBox->Get_nFix_KPlane(); iPlane++) {
if (index[2] == FFDBox->Get_Fix_KPlane(iPlane)) return false;
}
-
+
if ((SU2_TYPE::Int(config->GetParamDV(iDV, 1)) == -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 2)) != -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 3)) != -1)) {
for (i = 0; i < FFDBox->GetlOrder(); i++) {
index[0] = i;
-
+
CheckIndex = true;
for (iPlane = 0 ; iPlane < FFDBox->Get_nFix_IPlane(); iPlane++) {
if (index[0] == FFDBox->Get_Fix_IPlane(iPlane)) CheckIndex = false;
}
-
+
if (CheckIndex) FFDBox->SetControlPoints(index, movement);
-
+
}
}
-
+
if ((SU2_TYPE::Int(config->GetParamDV(iDV, 1)) != -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 2)) == -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 3)) != -1)) {
for (j = 0; j < FFDBox->GetmOrder(); j++) {
index[1] = j;
-
+
CheckIndex = true;
for (iPlane = 0 ; iPlane < FFDBox->Get_nFix_JPlane(); iPlane++) {
if (index[1] == FFDBox->Get_Fix_JPlane(iPlane)) CheckIndex = false;
}
-
+
if (CheckIndex) FFDBox->SetControlPoints(index, movement);
-
+
}
}
-
+
if ((SU2_TYPE::Int(config->GetParamDV(iDV, 1)) != -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 2)) != -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 3)) == -1)) {
for (k = 0; k < FFDBox->GetnOrder(); k++) {
index[2] = k;
-
+
CheckIndex = true;
for (iPlane = 0 ; iPlane < FFDBox->Get_nFix_KPlane(); iPlane++) {
if (index[2] == FFDBox->Get_Fix_KPlane(iPlane)) CheckIndex = false;
}
-
+
if (CheckIndex) FFDBox->SetControlPoints(index, movement);
-
+
}
}
-
+
if ((SU2_TYPE::Int(config->GetParamDV(iDV, 1)) == -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 2)) == -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 3)) != -1)) {
@@ -4311,7 +4311,7 @@ bool CSurfaceMovement::SetFFDCPChange(CGeometry *geometry, CConfig *config, CFre
}
}
}
-
+
if ((SU2_TYPE::Int(config->GetParamDV(iDV, 1)) != -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 2)) == -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 3)) == -1)) {
@@ -4323,7 +4323,7 @@ bool CSurfaceMovement::SetFFDCPChange(CGeometry *geometry, CConfig *config, CFre
}
}
}
-
+
if ((SU2_TYPE::Int(config->GetParamDV(iDV, 1)) == -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 2)) != -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 3)) == -1)) {
@@ -4335,61 +4335,61 @@ bool CSurfaceMovement::SetFFDCPChange(CGeometry *geometry, CConfig *config, CFre
}
}
}
-
+
if ((SU2_TYPE::Int(config->GetParamDV(iDV, 1)) != -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 2)) != -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 3)) != -1)) {
FFDBox->SetControlPoints(index, movement);
}
-
+
}
else {
return false;
}
-
+
return true;
-
+
}
bool CSurfaceMovement::SetFFDGull(CGeometry *geometry, CConfig *config, CFreeFormDefBox *FFDBox, CFreeFormDefBox **ResetFFDBox,
unsigned short iDV, bool ResetDef) {
-
+
su2double movement[3] = {0.0,0.0,0.0}, Ampl;
unsigned short index[3], i, k, iPlane, iFFDBox;
string design_FFDBox;
su2double Scale = config->GetOpt_RelaxFactor();
-
+
/*--- Set control points to its original value (even if the
design variable is not in this box) ---*/
-
+
if (ResetDef == true) {
FFDBox->SetOriginalControlPoints();
for (iFFDBox = 0; iFFDBox < nFFDBox; iFFDBox++)
ResetFFDBox[iFFDBox]->SetOriginalControlPoints();
}
-
+
design_FFDBox = config->GetFFDTag(iDV);
-
+
if (design_FFDBox.compare(FFDBox->GetTag()) == 0) {
-
+
/*--- Compute deformation ---*/
-
+
Ampl = config->GetDV_Value(iDV)*Scale;
-
+
movement[0] = 0.0;
movement[1] = 0.0;
movement[2] = Ampl;
-
+
/*--- Change the control points ---*/
-
+
index[1] = SU2_TYPE::Int(config->GetParamDV(iDV, 1));
-
+
/*--- Check that it is possible to move the control point ---*/
-
+
for (iPlane = 0 ; iPlane < FFDBox->Get_nFix_JPlane(); iPlane++) {
if (index[1] == FFDBox->Get_Fix_JPlane(iPlane)) return false;
}
-
+
for (i = 0; i < FFDBox->GetlOrder(); i++) {
index[0] = i;
for (k = 0; k < FFDBox->GetnOrder(); k++) {
@@ -4397,72 +4397,72 @@ bool CSurfaceMovement::SetFFDGull(CGeometry *geometry, CConfig *config, CFreeFor
FFDBox->SetControlPoints(index, movement);
}
}
-
+
}
else {
return false;
}
-
+
return true;
-
+
}
bool CSurfaceMovement::SetFFDNacelle(CGeometry *geometry, CConfig *config, CFreeFormDefBox *FFDBox, CFreeFormDefBox **ResetFFDBox,
unsigned short iDV, bool ResetDef) {
-
+
su2double movement[3] = {0.0,0.0,0.0}, Ampl;
unsigned short index[3], i, j, k, iPlane, iFFDBox, Theta, ThetaMax;
string design_FFDBox;
bool SameCP = false;
su2double Scale = config->GetOpt_RelaxFactor();
-
+
/*--- Set control points to its original value (even if the
design variable is not in this box) ---*/
-
+
if (ResetDef == true) {
FFDBox->SetOriginalControlPoints();
for (iFFDBox = 0; iFFDBox < nFFDBox; iFFDBox++)
ResetFFDBox[iFFDBox]->SetOriginalControlPoints();
}
-
+
design_FFDBox = config->GetFFDTag(iDV);
-
+
if (design_FFDBox.compare(FFDBox->GetTag()) == 0) {
-
+
/*--- Compute deformation ---*/
-
+
Ampl = config->GetDV_Value(iDV)*Scale;
-
+
movement[0] = config->GetParamDV(iDV, 4)*Ampl;
movement[1] = 0.0;
movement[2] = config->GetParamDV(iDV, 5)*Ampl;
-
+
index[0] = SU2_TYPE::Int(config->GetParamDV(iDV, 1));
index[1] = SU2_TYPE::Int(config->GetParamDV(iDV, 2));
index[2] = SU2_TYPE::Int(config->GetParamDV(iDV, 3));
if (index[1] == SU2_TYPE::Int(FFDBox->GetmOrder()) - index[1] -1) SameCP = true;
-
+
ThetaMax = 2;
if (SameCP) ThetaMax = 1;
-
+
for (Theta = 0; Theta < ThetaMax; Theta++) {
-
+
if (Theta == 1) index[1] = SU2_TYPE::Int(FFDBox->GetmOrder()) - index[1] -1;
-
+
/*--- Check that it is possible to move the control point ---*/
-
+
for (iPlane = 0 ; iPlane < FFDBox->Get_nFix_IPlane(); iPlane++) {
if (index[0] == FFDBox->Get_Fix_IPlane(iPlane)) return false;
}
-
+
for (iPlane = 0 ; iPlane < FFDBox->Get_nFix_JPlane(); iPlane++) {
if (index[1] == FFDBox->Get_Fix_JPlane(iPlane)) return false;
}
-
+
for (iPlane = 0 ; iPlane < FFDBox->Get_nFix_KPlane(); iPlane++) {
if (index[2] == FFDBox->Get_Fix_KPlane(iPlane)) return false;
}
-
+
if ((SU2_TYPE::Int(config->GetParamDV(iDV, 1)) == -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 2)) != -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 3)) != -1)) {
@@ -4471,7 +4471,7 @@ bool CSurfaceMovement::SetFFDNacelle(CGeometry *geometry, CConfig *config, CFree
FFDBox->SetControlPoints(index, movement);
}
}
-
+
if ((SU2_TYPE::Int(config->GetParamDV(iDV, 1)) != -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 2)) == -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 3)) != -1)) {
@@ -4480,7 +4480,7 @@ bool CSurfaceMovement::SetFFDNacelle(CGeometry *geometry, CConfig *config, CFree
FFDBox->SetControlPoints(index, movement);
}
}
-
+
if ((SU2_TYPE::Int(config->GetParamDV(iDV, 1)) != -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 2)) != -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 3)) == -1)) {
@@ -4489,7 +4489,7 @@ bool CSurfaceMovement::SetFFDNacelle(CGeometry *geometry, CConfig *config, CFree
FFDBox->SetControlPoints(index, movement);
}
}
-
+
if ((SU2_TYPE::Int(config->GetParamDV(iDV, 1)) == -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 2)) == -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 3)) != -1)) {
@@ -4501,7 +4501,7 @@ bool CSurfaceMovement::SetFFDNacelle(CGeometry *geometry, CConfig *config, CFree
}
}
}
-
+
if ((SU2_TYPE::Int(config->GetParamDV(iDV, 1)) != -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 2)) == -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 3)) == -1)) {
@@ -4513,7 +4513,7 @@ bool CSurfaceMovement::SetFFDNacelle(CGeometry *geometry, CConfig *config, CFree
}
}
}
-
+
if ((SU2_TYPE::Int(config->GetParamDV(iDV, 1)) == -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 2)) != -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 3)) == -1)) {
@@ -4525,382 +4525,382 @@ bool CSurfaceMovement::SetFFDNacelle(CGeometry *geometry, CConfig *config, CFree
}
}
}
-
+
if ((SU2_TYPE::Int(config->GetParamDV(iDV, 1)) != -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 2)) != -1) &&
(SU2_TYPE::Int(config->GetParamDV(iDV, 3)) != -1)) {
FFDBox->SetControlPoints(index, movement);
}
}
-
+
}
else {
return false;
}
-
+
return true;
-
+
}
bool CSurfaceMovement::SetFFDCamber_2D(CGeometry *geometry, CConfig *config, CFreeFormDefBox *FFDBox, CFreeFormDefBox **ResetFFDBox,
unsigned short iDV, bool ResetDef) {
-
+
su2double Ampl, movement[3] = {0.0,0.0,0.0};
unsigned short index[3], kIndex, iFFDBox;
string design_FFDBox;
su2double Scale = config->GetOpt_RelaxFactor();
-
+
/*--- Set control points to its original value (even if the
design variable is not in this box) ---*/
-
+
if (ResetDef == true) {
for (iFFDBox = 0; iFFDBox < nFFDBox; iFFDBox++)
ResetFFDBox[iFFDBox]->SetOriginalControlPoints();
}
-
+
design_FFDBox = config->GetFFDTag(iDV);
-
+
if (design_FFDBox.compare(FFDBox->GetTag()) == 0) {
-
+
for (kIndex = 0; kIndex < 2; kIndex++) {
-
+
Ampl = config->GetDV_Value(iDV)*Scale;
-
+
movement[0] = 0.0;
if (kIndex == 0) movement[1] = Ampl;
else movement[1] = Ampl;
movement[2] = 0.0;
-
+
index[0] = SU2_TYPE::Int(config->GetParamDV(iDV, 1)); index[1] = kIndex; index[2] = 0;
FFDBox->SetControlPoints(index, movement);
-
+
index[2] = 1;
FFDBox->SetControlPoints(index, movement);
-
+
}
-
+
}
else {
return false;
}
-
+
return true;
-
+
}
bool CSurfaceMovement::SetFFDThickness_2D(CGeometry *geometry, CConfig *config, CFreeFormDefBox *FFDBox, CFreeFormDefBox **ResetFFDBox,
unsigned short iDV, bool ResetDef) {
-
+
su2double Ampl, movement[3]= {0.0,0.0,0.0};
unsigned short index[3], kIndex, iFFDBox;
string design_FFDBox;
su2double Scale = config->GetOpt_RelaxFactor();
-
+
/*--- Set control points to its original value (even if the
design variable is not in this box) ---*/
-
+
if (ResetDef == true) {
for (iFFDBox = 0; iFFDBox < nFFDBox; iFFDBox++)
ResetFFDBox[iFFDBox]->SetOriginalControlPoints();
}
-
+
design_FFDBox = config->GetFFDTag(iDV);
-
+
if (design_FFDBox.compare(FFDBox->GetTag()) == 0) {
-
+
for (kIndex = 0; kIndex < 2; kIndex++) {
-
+
Ampl = config->GetDV_Value(iDV)*Scale;
-
+
movement[0] = 0.0;
if (kIndex == 0) movement[1] = -Ampl;
else movement[1] = Ampl;
movement[2] = 0.0;
-
+
index[0] = SU2_TYPE::Int(config->GetParamDV(iDV, 1)); index[1] = kIndex; index[2] = 0;
FFDBox->SetControlPoints(index, movement);
-
+
index[2] = 1;
FFDBox->SetControlPoints(index, movement);
-
+
}
-
+
}
else {
return false;
}
-
+
return true;
-
+
}
bool CSurfaceMovement::SetFFDTwist_2D(CGeometry *geometry, CConfig *config, CFreeFormDefBox *FFDBox, CFreeFormDefBox **ResetFFDBox,
unsigned short iDV, bool ResetDef) {
-
+
return true;
-
+
}
bool CSurfaceMovement::SetFFDCamber(CGeometry *geometry, CConfig *config, CFreeFormDefBox *FFDBox, CFreeFormDefBox **ResetFFDBox,
unsigned short iDV, bool ResetDef) {
-
+
su2double Ampl, movement[3] = {0.0,0.0,0.0};
unsigned short index[3], kIndex, iPlane, iFFDBox;
string design_FFDBox;
su2double Scale = config->GetOpt_RelaxFactor();
-
+
/*--- Set control points to its original value (even if the
design variable is not in this box) ---*/
-
+
if (ResetDef == true) {
for (iFFDBox = 0; iFFDBox < nFFDBox; iFFDBox++)
ResetFFDBox[iFFDBox]->SetOriginalControlPoints();
}
-
+
design_FFDBox = config->GetFFDTag(iDV);
-
+
if (design_FFDBox.compare(FFDBox->GetTag()) == 0) {
-
+
/*--- Check that it is possible to move the control point ---*/
-
+
for (kIndex = 0; kIndex < 2; kIndex++) {
-
+
index[0] = SU2_TYPE::Int(config->GetParamDV(iDV, 1));
index[1] = SU2_TYPE::Int(config->GetParamDV(iDV, 2));
index[2] = kIndex;
-
+
for (iPlane = 0 ; iPlane < FFDBox->Get_nFix_IPlane(); iPlane++) {
if (index[0] == FFDBox->Get_Fix_IPlane(iPlane)) return false;
}
-
+
for (iPlane = 0 ; iPlane < FFDBox->Get_nFix_JPlane(); iPlane++) {
if (index[1] == FFDBox->Get_Fix_JPlane(iPlane)) return false;
}
-
+
for (iPlane = 0 ; iPlane < FFDBox->Get_nFix_KPlane(); iPlane++) {
if (index[2] == FFDBox->Get_Fix_KPlane(iPlane)) return false;
}
-
+
}
-
+
for (kIndex = 0; kIndex < 2; kIndex++) {
-
+
Ampl = config->GetDV_Value(iDV)*Scale;
-
+
index[0] = SU2_TYPE::Int(config->GetParamDV(iDV, 1));
- index[1] = SU2_TYPE::Int(config->GetParamDV(iDV, 2));
+ index[1] = SU2_TYPE::Int(config->GetParamDV(iDV, 2));
index[2] = kIndex;
-
- movement[0] = 0.0; movement[1] = 0.0;
+
+ movement[0] = 0.0; movement[1] = 0.0;
if (kIndex == 0) movement[2] = Ampl;
else movement[2] = Ampl;
-
+
FFDBox->SetControlPoints(index, movement);
-
+
}
-
+
}
else {
return false;
}
-
+
return true;
-
+
}
void CSurfaceMovement::SetFFDAngleOfAttack(CGeometry *geometry, CConfig *config, CFreeFormDefBox *FFDBox, CFreeFormDefBox **ResetFFDBox,
unsigned short iDV, bool ResetDef) {
-
+
su2double Scale = config->GetOpt_RelaxFactor();
su2double Ampl = config->GetDV_Value(iDV)*Scale;
-
+
config->SetAoA_Offset(Ampl);
-
+
}
bool CSurfaceMovement::SetFFDThickness(CGeometry *geometry, CConfig *config, CFreeFormDefBox *FFDBox, CFreeFormDefBox **ResetFFDBox,
unsigned short iDV, bool ResetDef) {
-
+
su2double Ampl, movement[3] = {0.0,0.0,0.0};
unsigned short index[3], kIndex, iPlane, iFFDBox;
string design_FFDBox;
su2double Scale = config->GetOpt_RelaxFactor();
-
+
/*--- Set control points to its original value (even if the
design variable is not in this box) ---*/
-
+
if (ResetDef == true) {
for (iFFDBox = 0; iFFDBox < nFFDBox; iFFDBox++)
ResetFFDBox[iFFDBox]->SetOriginalControlPoints();
}
-
+
design_FFDBox = config->GetFFDTag(iDV);
-
+
if (design_FFDBox.compare(FFDBox->GetTag()) == 0) {
-
+
/*--- Check that it is possible to move the control point ---*/
-
+
for (kIndex = 0; kIndex < 2; kIndex++) {
-
+
index[0] = SU2_TYPE::Int(config->GetParamDV(iDV, 1));
index[1] = SU2_TYPE::Int(config->GetParamDV(iDV, 2));
index[2] = kIndex;
-
+
for (iPlane = 0 ; iPlane < FFDBox->Get_nFix_IPlane(); iPlane++) {
if (index[0] == FFDBox->Get_Fix_IPlane(iPlane)) return false;
}
-
+
for (iPlane = 0 ; iPlane < FFDBox->Get_nFix_JPlane(); iPlane++) {
if (index[1] == FFDBox->Get_Fix_JPlane(iPlane)) return false;
}
-
+
for (iPlane = 0 ; iPlane < FFDBox->Get_nFix_KPlane(); iPlane++) {
if (index[2] == FFDBox->Get_Fix_KPlane(iPlane)) return false;
}
-
+
}
-
-
+
+
for (kIndex = 0; kIndex < 2; kIndex++) {
-
+
Ampl = config->GetDV_Value(iDV)*Scale;
-
+
index[0] = SU2_TYPE::Int(config->GetParamDV(iDV, 1));
index[1] = SU2_TYPE::Int(config->GetParamDV(iDV, 2));
index[2] = kIndex;
-
+
movement[0] = 0.0; movement[1] = 0.0;
if (kIndex == 0) movement[2] = -Ampl;
else movement[2] = Ampl;
-
+
FFDBox->SetControlPoints(index, movement);
-
+
}
-
+
}
else {
return false;
}
-
+
return true;
-
+
}
bool CSurfaceMovement::SetFFDTwist(CGeometry *geometry, CConfig *config, CFreeFormDefBox *FFDBox, CFreeFormDefBox **ResetFFDBox,
unsigned short iDV, bool ResetDef) {
-
+
unsigned short iOrder, jOrder, kOrder;
su2double x, y, z, movement[3], Segment_P0[3], Segment_P1[3], Plane_P0[3], Plane_Normal[3],
Variable_P0, Variable_P1, Intersection[3], Variable_Interp;
unsigned short index[3], iPlane, iFFDBox;
string design_FFDBox;
su2double Scale = config->GetOpt_RelaxFactor();
-
+
/*--- Set control points to its original value (even if the
design variable is not in this box) ---*/
-
+
if (ResetDef == true) {
for (iFFDBox = 0; iFFDBox < nFFDBox; iFFDBox++)
ResetFFDBox[iFFDBox]->SetOriginalControlPoints();
}
-
+
design_FFDBox = config->GetFFDTag(iDV);
-
+
if (design_FFDBox.compare(FFDBox->GetTag()) == 0) {
-
+
/*--- Check that it is possible to move the control point ---*/
-
+
jOrder = SU2_TYPE::Int(config->GetParamDV(iDV, 1));
for (iPlane = 0 ; iPlane < FFDBox->Get_nFix_JPlane(); iPlane++) {
if (jOrder == FFDBox->Get_Fix_JPlane(iPlane)) return false;
}
-
+
/*--- Line plane intersection to find the origin of rotation ---*/
-
+
Segment_P0[0] = config->GetParamDV(iDV, 2);
Segment_P0[1] = config->GetParamDV(iDV, 3);
Segment_P0[2] = config->GetParamDV(iDV, 4);
-
+
Segment_P1[0] = config->GetParamDV(iDV, 5);
Segment_P1[1] = config->GetParamDV(iDV, 6);
Segment_P1[2] = config->GetParamDV(iDV, 7);
-
+
iOrder = 0;
jOrder = SU2_TYPE::Int(config->GetParamDV(iDV, 1));
kOrder = 0;
su2double *coord = FFDBox->GetCoordControlPoints(iOrder, jOrder, kOrder);
Plane_P0[0] = coord[0]; Plane_P0[1] = coord[1]; Plane_P0[2] = coord[2];
Plane_Normal[0] = 0.0; Plane_Normal[1] = 1.0; Plane_Normal[2] = 0.0;
-
+
Variable_P0 = 0.0; Variable_P1 = 0.0;
-
+
Intersection[0] = 0.0; Intersection[1] = 0.0; Intersection[2] = 0.0;
-
+
bool result = geometry->SegmentIntersectsPlane(Segment_P0, Segment_P1, Variable_P0, Variable_P1,
Plane_P0, Plane_Normal, Intersection, Variable_Interp);
-
+
if (result) {
-
+
/*--- xyz-coordinates of a point on the line of rotation. ---*/
-
+
su2double a = Intersection[0];
su2double b = Intersection[1];
su2double c = Intersection[2];
-
+
/*--- xyz-coordinate of the line's direction vector. ---*/
-
+
su2double u = Plane_Normal[0];
su2double v = Plane_Normal[1];
su2double w = Plane_Normal[2];
-
+
/*--- The angle of rotation is computed based on a characteristic length of the wing,
otherwise it is difficult to compare with other length based design variables. ---*/
-
+
su2double RefLength = config->GetRefLength();
su2double theta = atan(config->GetDV_Value(iDV)*Scale/RefLength);
-
+
/*--- An intermediate value used in computations. ---*/
-
+
su2double u2=u*u; su2double v2=v*v; su2double w2=w*w;
su2double l2 = u2 + v2 + w2; su2double l = sqrt(l2);
su2double cosT; su2double sinT;
-
+
/*--- Change the value of the control point if move is true ---*/
-
+
jOrder = SU2_TYPE::Int(config->GetParamDV(iDV, 1));
for (iOrder = 0; iOrder < FFDBox->GetlOrder(); iOrder++)
for (kOrder = 0; kOrder < FFDBox->GetnOrder(); kOrder++) {
index[0] = iOrder; index[1] = jOrder; index[2] = kOrder;
su2double *coord = FFDBox->GetCoordControlPoints(iOrder, jOrder, kOrder);
x = coord[0]; y = coord[1]; z = coord[2];
-
+
cosT = cos(theta);
sinT = sin(theta);
-
+
movement[0] = a*(v2 + w2) + u*(-b*v - c*w + u*x + v*y + w*z)
+ (-a*(v2 + w2) + u*(b*v + c*w - v*y - w*z) + (v2 + w2)*x)*cosT
+ l*(-c*v + b*w - w*y + v*z)*sinT;
movement[0] = movement[0]/l2 - x;
-
+
movement[1] = b*(u2 + w2) + v*(-a*u - c*w + u*x + v*y + w*z)
+ (-b*(u2 + w2) + v*(a*u + c*w - u*x - w*z) + (u2 + w2)*y)*cosT
+ l*(c*u - a*w + w*x - u*z)*sinT;
movement[1] = movement[1]/l2 - y;
-
+
movement[2] = c*(u2 + v2) + w*(-a*u - b*v + u*x + v*y + w*z)
+ (-c*(u2 + v2) + w*(a*u + b*v - u*x - v*y) + (u2 + v2)*z)*cosT
+ l*(-b*u + a*v - v*x + u*y)*sinT;
movement[2] = movement[2]/l2 - z;
-
+
/*--- Check that it is possible to move the control point ---*/
-
+
for (iPlane = 0 ; iPlane < FFDBox->Get_nFix_IPlane(); iPlane++) {
if (iOrder == FFDBox->Get_Fix_IPlane(iPlane)) {
movement[0] = 0.0; movement[1] = 0.0; movement[2] = 0.0;
}
}
-
+
for (iPlane = 0 ; iPlane < FFDBox->Get_nFix_KPlane(); iPlane++) {
if (kOrder == FFDBox->Get_Fix_KPlane(iPlane)) {
movement[0] = 0.0; movement[1] = 0.0; movement[2] = 0.0;
@@ -4908,65 +4908,65 @@ bool CSurfaceMovement::SetFFDTwist(CGeometry *geometry, CConfig *config, CFreeFo
}
FFDBox->SetControlPoints(index, movement);
-
+
}
-
+
}
-
+
}
else {
return false;
}
-
+
return true;
-
+
}
bool CSurfaceMovement::SetFFDRotation(CGeometry *geometry, CConfig *config, CFreeFormDefBox *FFDBox, CFreeFormDefBox **ResetFFDBox,
unsigned short iDV, bool ResetDef) {
-
+
unsigned short iOrder, jOrder, kOrder;
su2double movement[3] = {0.0,0.0,0.0}, x, y, z;
unsigned short index[3], iFFDBox;
string design_FFDBox;
su2double Scale = config->GetOpt_RelaxFactor();
-
+
/*--- Set control points to its original value (even if the
design variable is not in this box) ---*/
-
+
if (ResetDef == true) {
for (iFFDBox = 0; iFFDBox < nFFDBox; iFFDBox++)
ResetFFDBox[iFFDBox]->SetOriginalControlPoints();
}
-
+
design_FFDBox = config->GetFFDTag(iDV);
-
+
if (design_FFDBox.compare(FFDBox->GetTag()) == 0) {
-
+
/*--- xyz-coordinates of a point on the line of rotation. ---*/
-
+
su2double a = config->GetParamDV(iDV, 1);
su2double b = config->GetParamDV(iDV, 2);
su2double c = config->GetParamDV(iDV, 3);
-
+
/*--- xyz-coordinate of the line's direction vector. ---*/
-
+
su2double u = config->GetParamDV(iDV, 4)-config->GetParamDV(iDV, 1);
su2double v = config->GetParamDV(iDV, 5)-config->GetParamDV(iDV, 2);
su2double w = config->GetParamDV(iDV, 6)-config->GetParamDV(iDV, 3);
-
+
/*--- The angle of rotation. ---*/
-
+
su2double theta = config->GetDV_Value(iDV)*Scale*PI_NUMBER/180.0;
-
+
/*--- An intermediate value used in computations. ---*/
-
+
su2double u2=u*u; su2double v2=v*v; su2double w2=w*w;
su2double cosT = cos(theta); su2double sinT = sin(theta);
su2double l2 = u2 + v2 + w2; su2double l = sqrt(l2);
-
+
/*--- Change the value of the control point if move is true ---*/
-
+
for (iOrder = 0; iOrder < FFDBox->GetlOrder(); iOrder++)
for (jOrder = 0; jOrder < FFDBox->GetmOrder(); jOrder++)
for (kOrder = 0; kOrder < FFDBox->GetnOrder(); kOrder++) {
@@ -4977,74 +4977,74 @@ bool CSurfaceMovement::SetFFDRotation(CGeometry *geometry, CConfig *config, CFre
+ (-a*(v2 + w2) + u*(b*v + c*w - v*y - w*z) + (v2 + w2)*x)*cosT
+ l*(-c*v + b*w - w*y + v*z)*sinT;
movement[0] = movement[0]/l2 - x;
-
+
movement[1] = b*(u2 + w2) + v*(-a*u - c*w + u*x + v*y + w*z)
+ (-b*(u2 + w2) + v*(a*u + c*w - u*x - w*z) + (u2 + w2)*y)*cosT
+ l*(c*u - a*w + w*x - u*z)*sinT;
movement[1] = movement[1]/l2 - y;
-
+
movement[2] = c*(u2 + v2) + w*(-a*u - b*v + u*x + v*y + w*z)
+ (-c*(u2 + v2) + w*(a*u + b*v - u*x - v*y) + (u2 + v2)*z)*cosT
+ l*(-b*u + a*v - v*x + u*y)*sinT;
movement[2] = movement[2]/l2 - z;
-
+
FFDBox->SetControlPoints(index, movement);
-
+
}
}
else {
return false;
}
-
+
return true;
-
+
}
bool CSurfaceMovement::SetFFDControl_Surface(CGeometry *geometry, CConfig *config, CFreeFormDefBox *FFDBox, CFreeFormDefBox **ResetFFDBox,
unsigned short iDV, bool ResetDef) {
-
+
unsigned short iOrder, jOrder, kOrder;
su2double movement[3] = {0.0,0.0,0.0}, x, y, z;
unsigned short index[3], iFFDBox;
string design_FFDBox;
su2double Scale = config->GetOpt_RelaxFactor();
-
+
/*--- Set control points to its original value (even if the
design variable is not in this box) ---*/
-
+
if (ResetDef == true) {
for (iFFDBox = 0; iFFDBox < nFFDBox; iFFDBox++)
ResetFFDBox[iFFDBox]->SetOriginalControlPoints();
}
-
+
design_FFDBox = config->GetFFDTag(iDV);
-
+
if (design_FFDBox.compare(FFDBox->GetTag()) == 0) {
-
+
/*--- xyz-coordinates of a point on the line of rotation. ---*/
-
+
su2double a = config->GetParamDV(iDV, 1);
su2double b = config->GetParamDV(iDV, 2);
su2double c = config->GetParamDV(iDV, 3);
-
+
/*--- xyz-coordinate of the line's direction vector. ---*/
-
+
su2double u = config->GetParamDV(iDV, 4)-config->GetParamDV(iDV, 1);
su2double v = config->GetParamDV(iDV, 5)-config->GetParamDV(iDV, 2);
su2double w = config->GetParamDV(iDV, 6)-config->GetParamDV(iDV, 3);
-
+
/*--- The angle of rotation. ---*/
-
+
su2double theta = -config->GetDV_Value(iDV)*Scale*PI_NUMBER/180.0;
-
+
/*--- An intermediate value used in computations. ---*/
-
+
su2double u2=u*u; su2double v2=v*v; su2double w2=w*w;
su2double cosT = cos(theta); su2double sinT = sin(theta);
su2double l2 = u2 + v2 + w2; su2double l = sqrt(l2);
-
+
/*--- Change the value of the control point if move is true ---*/
-
+
for (iOrder = 0; iOrder < FFDBox->GetlOrder()-2; iOrder++)
for (jOrder = 2; jOrder < FFDBox->GetmOrder()-2; jOrder++)
for (kOrder = 0; kOrder < FFDBox->GetnOrder(); kOrder++) {
@@ -5055,35 +5055,35 @@ bool CSurfaceMovement::SetFFDControl_Surface(CGeometry *geometry, CConfig *confi
+ (-a*(v2 + w2) + u*(b*v + c*w - v*y - w*z) + (v2 + w2)*x)*cosT
+ l*(-c*v + b*w - w*y + v*z)*sinT;
movement[0] = movement[0]/l2 - x;
-
+
movement[1] = b*(u2 + w2) + v*(-a*u - c*w + u*x + v*y + w*z)
+ (-b*(u2 + w2) + v*(a*u + c*w - u*x - w*z) + (u2 + w2)*y)*cosT
+ l*(c*u - a*w + w*x - u*z)*sinT;
movement[1] = movement[1]/l2 - y;
-
+
movement[2] = c*(u2 + v2) + w*(-a*u - b*v + u*x + v*y + w*z)
+ (-c*(u2 + v2) + w*(a*u + b*v - u*x - v*y) + (u2 + v2)*z)*cosT
+ l*(-b*u + a*v - v*x + u*y)*sinT;
movement[2] = movement[2]/l2 - z;
-
+
FFDBox->SetControlPoints(index, movement);
-
+
}
}
else {
return false;
}
-
+
return true;
-
+
}
void CSurfaceMovement::SetAngleOfAttack(CGeometry *boundary, CConfig *config, unsigned short iDV, bool ResetDef) {
-
+
su2double Scale = config->GetOpt_RelaxFactor();
su2double Ampl = config->GetDV_Value(iDV)*Scale;
config->SetAoA_Offset(Ampl);
-
+
}
void CSurfaceMovement::SetHicksHenne(CGeometry *boundary, CConfig *config, unsigned short iDV, bool ResetDef) {
@@ -5092,12 +5092,12 @@ void CSurfaceMovement::SetHicksHenne(CGeometry *boundary, CConfig *config, unsig
su2double VarCoord[3] = {0.0,0.0,0.0}, VarCoord_[3] = {0.0,0.0,0.0}, *Coord_, *Normal_, ek, fk,
Coord[3] = {0.0,0.0,0.0}, Normal[3] = {0.0,0.0,0.0},
TPCoord[2] = {0.0, 0.0}, LPCoord[2] = {0.0, 0.0}, Distance, Chord, AoA, ValCos, ValSin;
-
+
bool upper = true;
su2double Scale = config->GetOpt_RelaxFactor();
/*--- Reset airfoil deformation if first deformation or if it required by the solver ---*/
-
+
if ((iDV == 0) || (ResetDef == true)) {
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++)
for (iVertex = 0; iVertex < boundary->nVertex[iMarker]; iVertex++) {
@@ -5105,9 +5105,9 @@ void CSurfaceMovement::SetHicksHenne(CGeometry *boundary, CConfig *config, unsig
boundary->vertex[iMarker][iVertex]->SetVarCoord(VarCoord);
}
}
-
+
/*--- Compute the angle of attack to apply the deformation ---*/
-
+
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (config->GetMarker_All_DV(iMarker) == YES) {
Coord_ = boundary->vertex[iMarker][0]->GetCoord();
@@ -5118,15 +5118,15 @@ void CSurfaceMovement::SetHicksHenne(CGeometry *boundary, CConfig *config, unsig
}
}
}
-
+
#ifdef HAVE_MPI
int iProcessor, nProcessor = size;
su2double *Buffer_Send_Coord, *Buffer_Receive_Coord;
-
+
Buffer_Receive_Coord = new su2double [nProcessor*2];
Buffer_Send_Coord = new su2double [2];
-
+
Buffer_Send_Coord[0] = TPCoord[0]; Buffer_Send_Coord[1] = TPCoord[1];
SU2_MPI::Allgather(Buffer_Send_Coord, 2, MPI_DOUBLE, Buffer_Receive_Coord, 2, MPI_DOUBLE, MPI_COMM_WORLD);
@@ -5137,9 +5137,9 @@ void CSurfaceMovement::SetHicksHenne(CGeometry *boundary, CConfig *config, unsig
Coord[1] = Buffer_Receive_Coord[iProcessor*2 + 1];
if (Coord[0] > TPCoord[0]) { TPCoord[0] = Coord[0]; TPCoord[1] = Coord[1]; }
}
-
+
delete[] Buffer_Send_Coord; delete[] Buffer_Receive_Coord;
-
+
#endif
@@ -5153,16 +5153,16 @@ void CSurfaceMovement::SetHicksHenne(CGeometry *boundary, CConfig *config, unsig
}
}
}
-
+
#ifdef HAVE_MPI
-
+
Buffer_Receive_Coord = new su2double [nProcessor*2];
Buffer_Send_Coord = new su2double [2];
-
+
Buffer_Send_Coord[0] = LPCoord[0]; Buffer_Send_Coord[1] = LPCoord[1];
SU2_MPI::Allgather(Buffer_Send_Coord, 2, MPI_DOUBLE, Buffer_Receive_Coord, 2, MPI_DOUBLE, MPI_COMM_WORLD);
-
+
Chord = 0.0;
for (iProcessor = 0; iProcessor < nProcessor; iProcessor++) {
Coord[0] = Buffer_Receive_Coord[iProcessor*2 + 0];
@@ -5170,41 +5170,41 @@ void CSurfaceMovement::SetHicksHenne(CGeometry *boundary, CConfig *config, unsig
Distance = sqrt(pow(Coord[0] - TPCoord[0], 2.0) + pow(Coord[1] - TPCoord[1], 2.0));
if (Chord < Distance) { Chord = Distance; LPCoord[0] = Coord[0]; LPCoord[1] = Coord[1]; }
}
-
+
delete[] Buffer_Send_Coord; delete[] Buffer_Receive_Coord;
-
+
#endif
-
+
AoA = atan((LPCoord[1] - TPCoord[1]) / (TPCoord[0] - LPCoord[0]))*180/PI_NUMBER;
-
+
/*--- WARNING: AoA currently overwritten to zero. ---*/
AoA = 0.0;
/*--- Perform multiple airfoil deformation ---*/
-
+
su2double Ampl = config->GetDV_Value(iDV)*Scale;
su2double xk = config->GetParamDV(iDV, 1);
const su2double t2 = 3.0;
-
+
if (config->GetParamDV(iDV, 0) == NO) { upper = false; }
if (config->GetParamDV(iDV, 0) == YES) { upper = true; }
-
+
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
for (iVertex = 0; iVertex < boundary->nVertex[iMarker]; iVertex++) {
VarCoord[0] = 0.0; VarCoord[1] = 0.0; VarCoord[2] = 0.0;
-
+
if (config->GetMarker_All_DV(iMarker) == YES) {
-
+
Coord_ = boundary->vertex[iMarker][iVertex]->GetCoord();
Normal_ = boundary->vertex[iMarker][iVertex]->GetNormal();
-
+
/*--- The Hicks Henne bump functions should be applied to a basic airfoil without AoA,
and unitary chord, a tranformation is required ---*/
-
+
ValCos = cos(AoA*PI_NUMBER/180.0);
ValSin = sin(AoA*PI_NUMBER/180.0);
-
+
Coord[0] = Coord_[0]*ValCos - Coord_[1]*ValSin;
Coord[0] = max(0.0, Coord[0]); // Coord x should be always positive
Coord[1] = Coord_[1]*ValCos + Coord_[0]*ValSin;
@@ -5224,20 +5224,20 @@ void CSurfaceMovement::SetHicksHenne(CGeometry *boundary, CConfig *config, unsig
if ((!upper) && (Normal[1] < 0)) { VarCoord[1] = -Ampl*fk; }
}
-
+
/*--- Apply the transformation to the coordinate variation ---*/
-
+
ValCos = cos(-AoA*PI_NUMBER/180.0);
ValSin = sin(-AoA*PI_NUMBER/180.0);
-
+
VarCoord_[0] = VarCoord[0]*ValCos - VarCoord[1]*ValSin;
VarCoord_[1] = VarCoord[1]*ValCos + VarCoord[0]*ValSin;
boundary->vertex[iMarker][iVertex]->AddVarCoord(VarCoord_);
-
+
}
}
-
+
}
void CSurfaceMovement::SetSurface_Bump(CGeometry *boundary, CConfig *config, unsigned short iDV, bool ResetDef) {
@@ -5298,7 +5298,7 @@ void CSurfaceMovement::SetCST(CGeometry *boundary, CConfig *config, unsigned sho
su2double VarCoord[3] = {0.0,0.0,0.0}, VarCoord_[3] = {0.0,0.0,0.0}, *Coord_, *Normal_, fk,
Coord[3] = {0.0,0.0,0.0}, Normal[3] = {0.0,0.0,0.0},
TPCoord[2] = {0.0, 0.0}, LPCoord[2] = {0.0, 0.0}, Distance, Chord, AoA, ValCos, ValSin;
-
+
bool upper = true;
su2double Scale = config->GetOpt_RelaxFactor();
@@ -5311,9 +5311,9 @@ void CSurfaceMovement::SetCST(CGeometry *boundary, CConfig *config, unsigned sho
boundary->vertex[iMarker][iVertex]->SetVarCoord(VarCoord);
}
}
-
+
/*--- Compute the angle of attack to apply the deformation ---*/
-
+
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (config->GetMarker_All_DV(iMarker) == YES) {
Coord_ = boundary->vertex[iMarker][0]->GetCoord();
@@ -5324,15 +5324,15 @@ void CSurfaceMovement::SetCST(CGeometry *boundary, CConfig *config, unsigned sho
}
}
}
-
+
#ifdef HAVE_MPI
int iProcessor, nProcessor = size;
su2double *Buffer_Send_Coord, *Buffer_Receive_Coord;
-
+
Buffer_Receive_Coord = new su2double [nProcessor*2];
Buffer_Send_Coord = new su2double [2];
-
+
Buffer_Send_Coord[0] = TPCoord[0]; Buffer_Send_Coord[1] = TPCoord[1];
SU2_MPI::Allgather(Buffer_Send_Coord, 2, MPI_DOUBLE, Buffer_Receive_Coord, 2, MPI_DOUBLE, MPI_COMM_WORLD);
@@ -5343,9 +5343,9 @@ void CSurfaceMovement::SetCST(CGeometry *boundary, CConfig *config, unsigned sho
Coord[1] = Buffer_Receive_Coord[iProcessor*2 + 1];
if (Coord[0] > TPCoord[0]) { TPCoord[0] = Coord[0]; TPCoord[1] = Coord[1]; }
}
-
+
delete[] Buffer_Send_Coord; delete[] Buffer_Receive_Coord;
-
+
#endif
@@ -5359,16 +5359,16 @@ void CSurfaceMovement::SetCST(CGeometry *boundary, CConfig *config, unsigned sho
}
}
}
-
+
#ifdef HAVE_MPI
-
+
Buffer_Receive_Coord = new su2double [nProcessor*2];
Buffer_Send_Coord = new su2double [2];
-
+
Buffer_Send_Coord[0] = LPCoord[0]; Buffer_Send_Coord[1] = LPCoord[1];
SU2_MPI::Allgather(Buffer_Send_Coord, 2, MPI_DOUBLE, Buffer_Receive_Coord, 2, MPI_DOUBLE, MPI_COMM_WORLD);
-
+
Chord = 0.0;
for (iProcessor = 0; iProcessor < nProcessor; iProcessor++) {
Coord[0] = Buffer_Receive_Coord[iProcessor*2 + 0];
@@ -5376,18 +5376,18 @@ void CSurfaceMovement::SetCST(CGeometry *boundary, CConfig *config, unsigned sho
Distance = sqrt(pow(Coord[0] - TPCoord[0], 2.0) + pow(Coord[1] - TPCoord[1], 2.0));
if (Chord < Distance) { Chord = Distance; LPCoord[0] = Coord[0]; LPCoord[1] = Coord[1]; }
}
-
+
delete[] Buffer_Send_Coord; delete[] Buffer_Receive_Coord;
-
+
#endif
-
+
AoA = atan((LPCoord[1] - TPCoord[1]) / (TPCoord[0] - LPCoord[0]))*180/PI_NUMBER;
-
+
/*--- WARNING: AoA currently overwritten to zero. ---*/
AoA = 0.0;
/*--- Perform multiple airfoil deformation ---*/
-
+
su2double Ampl = config->GetDV_Value(iDV)*Scale;
su2double KulfanNum = config->GetParamDV(iDV, 1) - 1.0;
su2double maxKulfanNum = config->GetParamDV(iDV, 2) - 1.0;
@@ -5400,35 +5400,35 @@ void CSurfaceMovement::SetCST(CGeometry *boundary, CConfig *config, unsigned sho
if (config->GetParamDV(iDV, 0) == NO) { upper = false;}
if (config->GetParamDV(iDV, 0) == YES) { upper = true;}
-
+
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
for (iVertex = 0; iVertex < boundary->nVertex[iMarker]; iVertex++) {
VarCoord[0] = 0.0; VarCoord[1] = 0.0; VarCoord[2] = 0.0;
-
+
if (config->GetMarker_All_DV(iMarker) == YES) {
-
+
Coord_ = boundary->vertex[iMarker][iVertex]->GetCoord();
Normal_ = boundary->vertex[iMarker][iVertex]->GetNormal();
-
+
/*--- The CST functions should be applied to a basic airfoil without AoA,
and unitary chord, a tranformation is required ---*/
ValCos = cos(AoA*PI_NUMBER/180.0);
ValSin = sin(AoA*PI_NUMBER/180.0);
-
+
Coord[0] = Coord_[0]*ValCos - Coord_[1]*ValSin;
Coord[0] = max(0.0, Coord[0]); // Coord x should be always positive
Coord[1] = Coord_[1]*ValCos + Coord_[0]*ValSin;
-
+
Normal[0] = Normal_[0]*ValCos - Normal_[1]*ValSin;
Normal[1] = Normal_[1]*ValCos + Normal_[0]*ValSin;
-
+
/*--- CST computation ---*/
su2double fact_n = 1;
su2double fact_cst = 1;
su2double fact_cst_n = 1;
-
+
for (int i = 1; i <= maxKulfanNum; i++) {
fact_n = fact_n * i;
}
@@ -5437,13 +5437,13 @@ void CSurfaceMovement::SetCST(CGeometry *boundary, CConfig *config, unsigned sho
}
for (int i = 1; i <= maxKulfanNum - KulfanNum; i++) {
fact_cst_n = fact_cst_n * i;
- }
-
- // CST method only for 2D NACA type airfoils
- su2double N1, N2;
+ }
+
+ // CST method only for 2D NACA type airfoils
+ su2double N1, N2;
N1 = 0.5;
N2 = 1.0;
-
+
/*--- Upper and lower surface change in coordinates based on CST equations by Kulfan et. al (www.brendakulfan.com/docs/CST3.pdf) ---*/
fk = pow(Coord[0],N1)*pow((1-Coord[0]), N2) * fact_n/(fact_cst*(fact_cst_n)) * pow(Coord[0], KulfanNum) * pow((1-Coord[0]), (maxKulfanNum-(KulfanNum)));
@@ -5451,9 +5451,9 @@ void CSurfaceMovement::SetCST(CGeometry *boundary, CConfig *config, unsigned sho
if ((!upper) && (Normal[1] < 0)) { VarCoord[1] = Ampl*fk; }
-
+
}
-
+
/*--- Apply the transformation to the coordinate variation ---*/
ValCos = cos(-AoA*PI_NUMBER/180.0);
@@ -5473,9 +5473,9 @@ void CSurfaceMovement::SetRotation(CGeometry *boundary, CConfig *config, unsigne
su2double VarCoord[3] = {0.0,0.0,0.0}, *Coord;
su2double movement[3] = {0.0,0.0,0.0}, x, y, z;
su2double Scale = config->GetOpt_RelaxFactor();
-
+
/*--- Reset airfoil deformation if first deformation or if it required by the solver ---*/
-
+
if ((iDV == 0) || (ResetDef == true)) {
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++)
for (iVertex = 0; iVertex < boundary->nVertex[iMarker]; iVertex++) {
@@ -5483,58 +5483,58 @@ void CSurfaceMovement::SetRotation(CGeometry *boundary, CConfig *config, unsigne
boundary->vertex[iMarker][iVertex]->SetVarCoord(VarCoord);
}
}
-
+
/*--- xyz-coordinates of a point on the line of rotation. */
-
+
su2double a = config->GetParamDV(iDV, 0);
su2double b = config->GetParamDV(iDV, 1);
su2double c = 0.0;
if (boundary->GetnDim() == 3) c = config->GetParamDV(0,2);
-
+
/*--- xyz-coordinate of the line's direction vector. ---*/
-
+
su2double u = config->GetParamDV(iDV, 3)-config->GetParamDV(iDV, 0);
su2double v = config->GetParamDV(iDV, 4)-config->GetParamDV(iDV, 1);
su2double w = 1.0;
if (boundary->GetnDim() == 3) w = config->GetParamDV(iDV, 5)-config->GetParamDV(iDV, 2);
-
+
/*--- The angle of rotation. ---*/
-
+
su2double theta = config->GetDV_Value(iDV)*Scale*PI_NUMBER/180.0;
-
+
/*--- An intermediate value used in computations. ---*/
-
+
su2double u2=u*u; su2double v2=v*v; su2double w2=w*w;
su2double cosT = cos(theta); su2double sinT = sin(theta);
su2double l2 = u2 + v2 + w2; su2double l = sqrt(l2);
-
+
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++)
for (iVertex = 0; iVertex < boundary->nVertex[iMarker]; iVertex++) {
VarCoord[0] = 0.0; VarCoord[1] = 0.0; VarCoord[2] = 0.0;
if (config->GetMarker_All_DV(iMarker) == YES) {
Coord = boundary->vertex[iMarker][iVertex]->GetCoord();
x = Coord[0]; y = Coord[1]; z = Coord[2];
-
+
movement[0] = a*(v2 + w2) + u*(-b*v - c*w + u*x + v*y + w*z)
+ (-a*(v2 + w2) + u*(b*v + c*w - v*y - w*z) + (v2 + w2)*x)*cosT
+ l*(-c*v + b*w - w*y + v*z)*sinT;
movement[0] = movement[0]/l2 - x;
-
+
movement[1] = b*(u2 + w2) + v*(-a*u - c*w + u*x + v*y + w*z)
+ (-b*(u2 + w2) + v*(a*u + c*w - u*x - w*z) + (u2 + w2)*y)*cosT
+ l*(c*u - a*w + w*x - u*z)*sinT;
movement[1] = movement[1]/l2 - y;
-
+
movement[2] = c*(u2 + v2) + w*(-a*u - b*v + u*x + v*y + w*z)
+ (-c*(u2 + v2) + w*(a*u + b*v - u*x - v*y) + (u2 + v2)*z)*cosT
+ l*(-b*u + a*v - v*x + u*y)*sinT;
if (boundary->GetnDim() == 3) movement[2] = movement[2]/l2 - z;
else movement[2] = 0.0;
-
+
VarCoord[0] = movement[0];
VarCoord[1] = movement[1];
if (boundary->GetnDim() == 3) VarCoord[2] = movement[2];
-
+
}
boundary->vertex[iMarker][iVertex]->AddVarCoord(VarCoord);
}
@@ -5546,9 +5546,9 @@ void CSurfaceMovement::SetTranslation(CGeometry *boundary, CConfig *config, unsi
su2double VarCoord[3] = {0.0,0.0,0.0};
su2double Scale = config->GetOpt_RelaxFactor();
su2double Ampl = config->GetDV_Value(iDV)*Scale;
-
+
/*--- Reset airfoil deformation if first deformation or if it required by the solver ---*/
-
+
if ((iDV == 0) || (ResetDef == true)) {
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++)
for (iVertex = 0; iVertex < boundary->nVertex[iMarker]; iVertex++) {
@@ -5556,12 +5556,12 @@ void CSurfaceMovement::SetTranslation(CGeometry *boundary, CConfig *config, unsi
boundary->vertex[iMarker][iVertex]->SetVarCoord(VarCoord);
}
}
-
+
su2double xDispl = config->GetParamDV(iDV, 0);
su2double yDispl = config->GetParamDV(iDV, 1);
su2double zDispl = 0;
if (boundary->GetnDim() == 3) zDispl = config->GetParamDV(iDV, 2);
-
+
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++)
for (iVertex = 0; iVertex < boundary->nVertex[iMarker]; iVertex++) {
VarCoord[0] = 0.0; VarCoord[1] = 0.0; VarCoord[2] = 0.0;
@@ -5572,7 +5572,7 @@ void CSurfaceMovement::SetTranslation(CGeometry *boundary, CConfig *config, unsi
}
boundary->vertex[iMarker][iVertex]->AddVarCoord(VarCoord);
}
-
+
}
void CSurfaceMovement::SetScale(CGeometry *boundary, CConfig *config, unsigned short iDV, bool ResetDef) {
@@ -5581,9 +5581,9 @@ void CSurfaceMovement::SetScale(CGeometry *boundary, CConfig *config, unsigned s
su2double VarCoord[3] = {0.0,0.0,0.0}, x, y, z, *Coord;
su2double Scale = config->GetOpt_RelaxFactor();
su2double Ampl = config->GetDV_Value(iDV)*Scale;
-
+
/*--- Reset airfoil deformation if first deformation or if it required by the solver ---*/
-
+
if ((iDV == 0) || (ResetDef == true)) {
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++)
for (iVertex = 0; iVertex < boundary->nVertex[iMarker]; iVertex++) {
@@ -5591,7 +5591,7 @@ void CSurfaceMovement::SetScale(CGeometry *boundary, CConfig *config, unsigned s
boundary->vertex[iMarker][iVertex]->SetVarCoord(VarCoord);
}
}
-
+
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++)
for (iVertex = 0; iVertex < boundary->nVertex[iMarker]; iVertex++) {
VarCoord[0] = 0.0; VarCoord[1] = 0.0; VarCoord[2] = 0.0;
@@ -5604,12 +5604,12 @@ void CSurfaceMovement::SetScale(CGeometry *boundary, CConfig *config, unsigned s
}
boundary->vertex[iMarker][iVertex]->AddVarCoord(VarCoord);
}
-
+
}
void CSurfaceMovement::Moving_Walls(CGeometry *geometry, CConfig *config,
unsigned short iZone, unsigned long iter) {
-
+
/*--- Local variables ---*/
unsigned short iMarker, jMarker, iDim, nDim = geometry->GetnDim();
unsigned long iPoint, iVertex;
@@ -5618,27 +5618,27 @@ void CSurfaceMovement::Moving_Walls(CGeometry *geometry, CConfig *config,
su2double Omega_Ref = config->GetOmega_Ref();
su2double Vel_Ref = config->GetVelocity_Ref();
string Marker_Tag;
-
+
/*--- Store grid velocity for each node on the moving surface(s).
Sum and store the x, y, & z velocities due to translation and rotation. ---*/
-
+
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (config->GetMarker_All_Moving(iMarker) == YES) {
-
+
/*--- Identify iMarker from the list of those under MARKER_MOVING ---*/
-
+
Marker_Tag = config->GetMarker_All_TagBound(iMarker);
jMarker = config->GetMarker_Moving(Marker_Tag);
-
+
/*--- Get prescribed wall speed from config for this marker ---*/
-
+
for (iDim = 0; iDim < 3; iDim++){
Center[iDim] = config->GetMarkerMotion_Origin(jMarker, iDim);
Omega[iDim] = config->GetMarkerRotationRate(jMarker, iDim)/Omega_Ref;
xDot[iDim] = config->GetMarkerTranslationRate(jMarker, iDim)/Vel_Ref;
}
-
-
+
+
if (rank == MASTER_NODE && iter == 0) {
cout << " Storing grid velocity for marker: ";
cout << Marker_Tag << "." << endl;
@@ -5650,39 +5650,39 @@ void CSurfaceMovement::Moving_Walls(CGeometry *geometry, CConfig *config,
cout << ", " << Omega[2] << ") rad/s about origin: (" << Center[0];
cout << ", " << Center[1] << ", " << Center[2] << ")." << endl;
}
-
+
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
-
+
/*--- Get the index and coordinates of the current point ---*/
-
+
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- Coord = geometry->node[iPoint]->GetCoord();
-
+ Coord = geometry->nodes->GetCoord(iPoint);
+
/*--- Calculate non-dim. position from rotation center ---*/
for (iDim = 0; iDim < nDim; iDim++)
r[iDim] = (Coord[iDim]-Center[iDim])/L_Ref;
if (nDim == 2) r[nDim] = 0.0;
-
+
/*--- Cross Product of angular velocity and distance from center to
get the rotational velocity. Note that we are adding on the velocity
due to pure translation as well. ---*/
-
+
GridVel[0] = xDot[0] + Omega[1]*r[2] - Omega[2]*r[1];
GridVel[1] = xDot[1] + Omega[2]*r[0] - Omega[0]*r[2];
GridVel[2] = xDot[2] + Omega[0]*r[1] - Omega[1]*r[0];
-
+
/*--- Store the moving wall velocity for this node ---*/
-
+
for (iDim = 0; iDim < nDim; iDim++)
- geometry->node[iPoint]->SetGridVel(iDim, GridVel[iDim]);
-
+ geometry->nodes->SetGridVel(iPoint, iDim, GridVel[iDim]);
+
}
}
}
}
void CSurfaceMovement::AeroelasticDeform(CGeometry *geometry, CConfig *config, unsigned long TimeIter, unsigned short iMarker, unsigned short iMarker_Monitoring, vector& displacements) {
-
+
/* The sign conventions of these are those of the Typical Section Wing Model, below the signs are corrected */
su2double dh = -displacements[0]; // relative plunge
su2double dalpha = -displacements[1]; // relative pitch
@@ -5695,14 +5695,14 @@ void CSurfaceMovement::AeroelasticDeform(CGeometry *geometry, CConfig *config, u
su2double x_new, y_new;
su2double VarCoord[3];
string Monitoring_Tag = config->GetMarker_Monitoring_TagBound(iMarker_Monitoring);
-
+
/*--- Calculate the plunge displacement for the Typical Section Wing Model taking into account rotation ---*/
if (config->GetKind_GridMovement() == AEROELASTIC_RIGID_MOTION) {
su2double Omega, dt, psi;
dt = config->GetDelta_UnstTimeND();
Omega = (config->GetRotation_Rate(3)/config->GetOmega_Ref());
psi = Omega*(dt*TimeIter);
-
+
/*--- Correct for the airfoil starting position (This is hardcoded in here) ---*/
if (Monitoring_Tag == "Airfoil1") {
psi = psi + 0.0;
@@ -5715,40 +5715,40 @@ void CSurfaceMovement::AeroelasticDeform(CGeometry *geometry, CConfig *config, u
}
else
cout << "WARNING: There is a marker that we are monitoring that doesn't match the values hardcoded above!" << endl;
-
+
dh_x = -dh*sin(psi);
dh_y = dh*cos(psi);
-
+
} else {
dh_x = 0;
dh_y = dh;
}
-
+
/*--- Pitching origin from config. ---*/
-
+
Center[0] = config->GetRefOriginMoment_X(iMarker_Monitoring);
Center[1] = config->GetRefOriginMoment_Y(iMarker_Monitoring);
-
+
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
/*--- Coordinates of the current point ---*/
- Coord = geometry->node[iPoint]->GetCoord();
-
+ Coord = geometry->nodes->GetCoord(iPoint);
+
/*--- Calculate non-dim. position from rotation center ---*/
su2double r[2] = {0,0};
for (iDim = 0; iDim < geometry->GetnDim(); iDim++)
r[iDim] = (Coord[iDim]-Center[iDim])/Lref;
-
+
/*--- Compute delta of transformed point coordinates ---*/
// The deltas are needed for the FEA grid deformation Method.
// rotation contribution - previous position + plunging contribution
x_new = cos(dalpha)*r[0] - sin(dalpha)*r[1] -r[0] + dh_x;
y_new = sin(dalpha)*r[0] + cos(dalpha)*r[1] -r[1] + dh_y;
-
+
VarCoord[0] = x_new;
VarCoord[1] = y_new;
VarCoord[2] = 0.0;
-
+
/*--- Store new delta node locations for the surface ---*/
geometry->vertex[iMarker][iVertex]->SetVarCoord(VarCoord);
}
@@ -5756,12 +5756,12 @@ void CSurfaceMovement::AeroelasticDeform(CGeometry *geometry, CConfig *config, u
config->SetRefOriginMoment_X(iMarker_Monitoring, Center[0]+dh_x);
config->SetRefOriginMoment_Y(iMarker_Monitoring, Center[1]+dh_y);
-
+
}
void CSurfaceMovement::SetBoundary_Flutter3D(CGeometry *geometry, CConfig *config,
CFreeFormDefBox **FFDBox, unsigned long iter, unsigned short iZone) {
-
+
su2double omega, deltaT;
su2double alpha, alpha_new, alpha_old;
su2double time_new, time_old;
@@ -5769,60 +5769,60 @@ void CSurfaceMovement::SetBoundary_Flutter3D(CGeometry *geometry, CConfig *confi
su2double DEG2RAD = PI_NUMBER/180.0;
bool adjoint = (config->GetContinuous_Adjoint() || config->GetDiscrete_Adjoint());
unsigned short iDim = 0;
-
+
/*--- Retrieve values from the config file ---*/
-
+
deltaT = config->GetDelta_UnstTimeND();
-
+
/*--- Pitching origin, frequency, and amplitude from config. ---*/
-
+
for (iDim = 0; iDim < 3; iDim++){
Omega[iDim] = config->GetPitching_Omega(iDim)/config->GetOmega_Ref();
Ampl[iDim] = config->GetPitching_Ampl(iDim)*DEG2RAD;
}
-
+
/*--- Compute delta time based on physical time step ---*/
-
+
if (adjoint) {
-
+
/*--- For the unsteady adjoint, we integrate backwards through
physical time, so perform mesh motion in reverse. ---*/
-
+
unsigned long nFlowIter = config->GetnTime_Iter();
unsigned long directIter = nFlowIter - iter - 1;
time_new = static_cast(directIter)*deltaT;
time_old = time_new;
if (iter != 0) time_old = (static_cast(directIter)+1.0)*deltaT;
} else {
-
+
/*--- Forward time for the direct problem ---*/
-
+
time_new = static_cast(iter)*deltaT;
time_old = time_new;
if (iter != 0) time_old = (static_cast(iter)-1.0)*deltaT;
}
-
+
/*--- Update the pitching angle at this time step. Flip sign for
nose-up positive convention. ---*/
-
+
omega = Omega[2];
alpha_new = Ampl[2]*sin(omega*time_new);
alpha_old = Ampl[2]*sin(omega*time_old);
alpha = (1E-10 + (alpha_new - alpha_old))*(-PI_NUMBER/180.0);
-
+
if (rank == MASTER_NODE)
cout << "New dihedral angle (alpha): " << alpha_new/DEG2RAD << " degrees." << endl;
-
+
unsigned short iOrder, jOrder, kOrder;
short iFFDBox;
su2double movement[3] = {0.0,0.0,0.0};
bool *move = new bool [nFFDBox];
unsigned short *index = new unsigned short[3];
-
- move[0] = true; move[1] = true; move[2] = true;
+
+ move[0] = true; move[1] = true; move[2] = true;
/*--- Change the value of the control point if move is true ---*/
-
+
for (iFFDBox = 0; iFFDBox < nFFDBox; iFFDBox++)
if (move[iFFDBox])
for (iOrder = 0; iOrder < FFDBox[iFFDBox]->GetlOrder(); iOrder++)
@@ -5833,22 +5833,22 @@ void CSurfaceMovement::SetBoundary_Flutter3D(CGeometry *geometry, CConfig *confi
movement[0] = 0.0; movement[1] = 0.0; movement[2] = coord[1]*tan(alpha);
FFDBox[iFFDBox]->SetControlPoints(index, movement);
}
-
+
/*--- Recompute cartesian coordinates using the new control points position ---*/
-
+
for (iFFDBox = 0; iFFDBox < nFFDBox; iFFDBox++)
SetCartesianCoord(geometry, config, FFDBox[iFFDBox], iFFDBox, false);
-
+
delete [] index;
delete [] move;
-
+
}
void CSurfaceMovement::SetExternal_Deformation(CGeometry *geometry, CConfig *config, unsigned short iZone, unsigned long iter) {
-
+
/*--- Local variables ---*/
-
- unsigned short iDim, nDim;
+
+ unsigned short iDim, nDim;
unsigned long iPoint = 0, flowIter = 0;
unsigned long jPoint, GlobalIndex;
su2double VarCoord[3], *Coord_Old = NULL, *Coord_New = NULL, Center[3] = {0.0,0.0,0.0};
@@ -5862,14 +5862,14 @@ void CSurfaceMovement::SetExternal_Deformation(CGeometry *geometry, CConfig *con
ifstream surface_positions;
bool unsteady = config->GetTime_Marching();
bool adjoint = (config->GetContinuous_Adjoint() || config->GetDiscrete_Adjoint());
-
+
/*--- Load stuff from config ---*/
-
+
nDim = geometry->GetnDim();
DV_Filename = config->GetDV_Filename();
-
+
/*--- Set the extension for the correct unsteady mesh motion file ---*/
-
+
if (unsteady) {
if (adjoint) {
/*--- For the unsteady adjoint, we integrate backwards through
@@ -5898,23 +5898,23 @@ void CSurfaceMovement::SetExternal_Deformation(CGeometry *geometry, CConfig *con
UnstExt = string(buffer);
DV_Filename.append(UnstExt);
}
-
+
if (rank == MASTER_NODE)
cout << "Reading in the arbitrary mesh motion from direct iteration " << flowIter << "." << endl;
}
-
+
/*--- Open the motion file ---*/
surface_positions.open(DV_Filename.data(), ios::in);
-
+
/*--- Throw error if there is no file ---*/
-
+
if (surface_positions.fail()) {
SU2_MPI::Error(string("There is no surface positions file ") + DV_Filename, CURRENT_FUNCTION);
}
-
- /*--- Read in and store the new mesh node locations ---*/
-
+
+ /*--- Read in and store the new mesh node locations ---*/
+
while (getline(surface_positions, text_line)) {
istringstream point_line(text_line);
if (nDim == 2) point_line >> iPoint >> NewCoord[0] >> NewCoord[1];
@@ -5924,7 +5924,7 @@ void CSurfaceMovement::SetExternal_Deformation(CGeometry *geometry, CConfig *con
(config->GetMarker_All_Moving(iMarker) == YES && config->GetKind_SU2() == SU2_CFD)) {
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
jPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- GlobalIndex = geometry->node[jPoint]->GetGlobalIndex();
+ GlobalIndex = geometry->nodes->GetGlobalIndex(jPoint);
if (GlobalIndex == iPoint) {
geometry->vertex[iMarker][iVertex]->SetVarCoord(NewCoord);
break;
@@ -5933,33 +5933,33 @@ void CSurfaceMovement::SetExternal_Deformation(CGeometry *geometry, CConfig *con
}
}
}
-
+
/*--- Close the surface positions file ---*/
-
+
surface_positions.close();
-
+
/*--- If rotating as well, prepare the rotation matrix ---*/
-
+
if (config->GetKind_GridMovement() == EXTERNAL_ROTATION) {
-
+
/*--- Variables needed only for rotation ---*/
-
+
su2double Omega[3], dt;
su2double dtheta, dphi, dpsi, cosTheta, sinTheta;
su2double cosPhi, sinPhi, cosPsi, sinPsi;
-
+
/*--- Center of rotation & angular velocity vector from config ---*/
Center[0] = config->GetMotion_Origin(0);
Center[1] = config->GetMotion_Origin(1);
Center[2] = config->GetMotion_Origin(2);
-
+
/*--- Angular velocity vector from config ---*/
-
+
dt = static_cast(iter)*config->GetDelta_UnstTimeND();
Omega[0] = config->GetRotation_Rate(0);
Omega[1] = config->GetRotation_Rate(1);
Omega[2] = config->GetRotation_Rate(2);
-
+
/*--- For the unsteady adjoint, use reverse time ---*/
if (adjoint) {
/*--- Set the first adjoint mesh position to the final direct one ---*/
@@ -5970,82 +5970,82 @@ void CSurfaceMovement::SetExternal_Deformation(CGeometry *geometry, CConfig *con
/*--- No rotation at all for the first direct solution ---*/
if (iter == 0) dt = 0;
}
-
+
/*--- Compute delta change in the angle about the x, y, & z axes. ---*/
-
- dtheta = Omega[0]*dt;
- dphi = Omega[1]*dt;
+
+ dtheta = Omega[0]*dt;
+ dphi = Omega[1]*dt;
dpsi = Omega[2]*dt;
-
+
/*--- Store angles separately for clarity. Compute sines/cosines. ---*/
-
+
cosTheta = cos(dtheta); cosPhi = cos(dphi); cosPsi = cos(dpsi);
sinTheta = sin(dtheta); sinPhi = sin(dphi); sinPsi = sin(dpsi);
-
+
/*--- Compute the rotation matrix. Note that the implicit
ordering is rotation about the x-axis, y-axis, then z-axis. ---*/
-
+
rotMatrix[0][0] = cosPhi*cosPsi;
rotMatrix[1][0] = cosPhi*sinPsi;
rotMatrix[2][0] = -sinPhi;
-
+
rotMatrix[0][1] = sinTheta*sinPhi*cosPsi - cosTheta*sinPsi;
rotMatrix[1][1] = sinTheta*sinPhi*sinPsi + cosTheta*cosPsi;
rotMatrix[2][1] = sinTheta*cosPhi;
-
+
rotMatrix[0][2] = cosTheta*sinPhi*cosPsi + sinTheta*sinPsi;
rotMatrix[1][2] = cosTheta*sinPhi*sinPsi - sinTheta*cosPsi;
rotMatrix[2][2] = cosTheta*cosPhi;
-
+
}
-
+
/*--- Loop through to find only moving surface markers ---*/
-
+
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if ((config->GetMarker_All_DV(iMarker) == YES && config->GetKind_SU2() == SU2_DEF) ||
(config->GetMarker_All_Moving(iMarker) == YES && config->GetKind_SU2() == SU2_CFD)) {
-
+
/*--- Loop over all surface points for this marker ---*/
-
+
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
-
+
/*--- Get current and new coordinates from file ---*/
-
- Coord_Old = geometry->node[iPoint]->GetCoord();
+
+ Coord_Old = geometry->nodes->GetCoord(iPoint);
Coord_New = geometry->vertex[iMarker][iVertex]->GetVarCoord();
-
+
/*--- If we're also rotating, multiply each point by the
rotation matrix. It is assumed that the coordinates in
Coord_Old have already been rotated using SetRigid_Rotation(). ---*/
-
+
if (config->GetKind_GridMovement() == EXTERNAL_ROTATION) {
-
+
/*--- Calculate non-dim. position from rotation center ---*/
-
+
for (iDim = 0; iDim < nDim; iDim++)
r[iDim] = (Coord_New[iDim]-Center[iDim])/Lref;
if (nDim == 2) r[nDim] = 0.0;
-
+
/*--- Compute transformed point coordinates ---*/
-
- rotCoord[0] = rotMatrix[0][0]*r[0]
- + rotMatrix[0][1]*r[1]
+
+ rotCoord[0] = rotMatrix[0][0]*r[0]
+ + rotMatrix[0][1]*r[1]
+ rotMatrix[0][2]*r[2] + Center[0];
-
- rotCoord[1] = rotMatrix[1][0]*r[0]
- + rotMatrix[1][1]*r[1]
+
+ rotCoord[1] = rotMatrix[1][0]*r[0]
+ + rotMatrix[1][1]*r[1]
+ rotMatrix[1][2]*r[2] + Center[1];
-
- rotCoord[2] = rotMatrix[2][0]*r[0]
- + rotMatrix[2][1]*r[1]
+
+ rotCoord[2] = rotMatrix[2][0]*r[0]
+ + rotMatrix[2][1]*r[1]
+ rotMatrix[2][2]*r[2] + Center[2];
-
+
/*--- Copy rotated coords back to original array for consistency ---*/
for (iDim = 0; iDim < nDim; iDim++)
Coord_New[iDim] = rotCoord[iDim];
}
-
+
/*--- Calculate delta change in the x, y, & z directions ---*/
for (iDim = 0; iDim < nDim; iDim++)
VarCoord[iDim] = (Coord_New[iDim]-Coord_Old[iDim])/Lref;
@@ -6053,9 +6053,9 @@ void CSurfaceMovement::SetExternal_Deformation(CGeometry *geometry, CConfig *con
/*--- Set position changes to be applied by the spring analogy ---*/
geometry->vertex[iMarker][iVertex]->SetVarCoord(VarCoord);
-
+
}
- }
+ }
}
}
@@ -6066,27 +6066,27 @@ void CSurfaceMovement::SetNACA_4Digits(CGeometry *boundary, CConfig *config) {
if (config->GetnDV() != 1) { cout << "This kind of design variable is not prepared for multiple deformations."; cin.get(); }
- su2double Ya = config->GetParamDV(0,0) / 100.0; /*--- Maximum camber as a fraction of the chord
+ su2double Ya = config->GetParamDV(0,0) / 100.0; /*--- Maximum camber as a fraction of the chord
(100 m is the first of the four digits) ---*/
- su2double Xa = config->GetParamDV(0,1) / 10.0; /*--- Location of maximum camber as a fraction of
+ su2double Xa = config->GetParamDV(0,1) / 10.0; /*--- Location of maximum camber as a fraction of
the chord (10 p is the second digit in the NACA xxxx description) ---*/
su2double t = config->GetParamDV(0,2) / 100.0; /*--- Maximum thickness as a fraction of the
- chord (so 100 t gives the last two digits in
+ chord (so 100 t gives the last two digits in
the NACA 4-digit denomination) ---*/
-
+
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++)
for (iVertex = 0; iVertex < boundary->nVertex[iMarker]; iVertex++) {
VarCoord[0] = 0.0; VarCoord[1] = 0.0; VarCoord[2] = 0.0;
if (config->GetMarker_All_DV(iMarker) == YES) {
Coord = boundary->vertex[iMarker][iVertex]->GetCoord();
Normal = boundary->vertex[iMarker][iVertex]->GetNormal();
-
+
if (Coord[0] < Xa) Ycurv = (2.0*Xa*Coord[0]-pow(Coord[0],2.0))*(Ya/pow(Xa,2.0));
else Ycurv = ((1.0-2.0*Xa)+2.0*Xa*Coord[0]-pow(Coord[0],2.0))*(Ya/pow((1.0-Xa), 2.0));
-
+
Yesp = t*(1.4845*sqrt(Coord[0])-0.6300*Coord[0]-1.7580*pow(Coord[0],2.0)+
1.4215*pow(Coord[0],3.0)-0.518*pow(Coord[0],4.0));
-
+
if (Normal[1] > 0) VarCoord[1] = (Ycurv + Yesp) - Coord[1];
if (Normal[1] < 0) VarCoord[1] = (Ycurv - Yesp) - Coord[1];
@@ -6099,19 +6099,19 @@ void CSurfaceMovement::SetParabolic(CGeometry *boundary, CConfig *config) {
unsigned long iVertex;
unsigned short iMarker;
su2double VarCoord[3], *Coord, *Normal;
-
+
if (config->GetnDV() != 1) { cout << "This kind of design variable is not prepared for multiple deformations."; cin.get(); }
-
+
su2double c = config->GetParamDV(0,0); /*--- Center of the parabola ---*/
su2double t = config->GetParamDV(0,1) / 100.0; /*--- Thickness of the parabola ---*/
-
+
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++)
for (iVertex = 0; iVertex < boundary->nVertex[iMarker]; iVertex++) {
VarCoord[0] = 0.0; VarCoord[1] = 0.0; VarCoord[2] = 0.0;
if (config->GetMarker_All_DV(iMarker) == YES) {
Coord = boundary->vertex[iMarker][iVertex]->GetCoord();
Normal = boundary->vertex[iMarker][iVertex]->GetNormal();
-
+
if (Normal[1] > 0) {
VarCoord[1] = t*(Coord[0]*Coord[0]-Coord[0])/(2.0*(c*c-c)) - Coord[1];
}
@@ -6138,7 +6138,7 @@ void CSurfaceMovement::SetAirfoil(CGeometry *boundary, CConfig *config) {
int ierr = 0;
unsigned short nDim = boundary->GetnDim();
-
+
VarCoord = new su2double[nDim];
for (iDim = 0; iDim < nDim; iDim++)
VarCoord[iDim] = 0.0;
@@ -6146,18 +6146,18 @@ void CSurfaceMovement::SetAirfoil(CGeometry *boundary, CConfig *config) {
/*--- Get the SU2 module. SU2_CFD will use this routine for dynamically
deforming meshes (MARKER_MOVING), while SU2_DEF will use it for deforming
meshes after imposing design variable surface deformations (DV_MARKER). ---*/
-
+
unsigned short Kind_SU2 = config->GetKind_SU2();
-
+
/*--- Read the coordinates. Two main formats:
- Selig are in an x, y format starting from trailing edge, along the upper surface to the leading
edge and back around the lower surface to trailing edge.
- Lednicer are upper surface points leading edge to trailing edge and then lower surface leading
edge to trailing edge.
---*/
-
+
/*--- Open the restart file, throw an error if this fails. ---*/
-
+
cout << "Enter the name of file with the airfoil information: ";
ierr = scanf("%255s", AirfoilFile);
if (ierr == 0) { SU2_MPI::Error("No input read!!", CURRENT_FUNCTION); }
@@ -6182,46 +6182,46 @@ void CSurfaceMovement::SetAirfoil(CGeometry *boundary, CConfig *config) {
if (ierr == 0) { SU2_MPI::Error("No input read!!", CURRENT_FUNCTION); }
/*--- The first line is the header ---*/
-
+
getline (airfoil_file, text_line);
cout << "File info: " << text_line << endl;
-
+
if (strcmp (AirfoilFormat,"Selig") == 0) {
while (getline (airfoil_file, text_line)) {
istringstream point_line(text_line);
-
+
/*--- Read the x & y coordinates from this line of the file (anticlockwise) ---*/
-
+
point_line >> Airfoil_Coord[0] >> Airfoil_Coord[1];
-
+
/*--- Close the arifoil ---*/
-
+
if (strcmp (AirfoilClose,"Yes") == 0)
factor = -atan(coeff*(Airfoil_Coord[0]-1.0))*2.0/PI_NUMBER;
else factor = 1.0;
-
+
/*--- Store the coordinates in vectors ---*/
-
+
Xcoord.push_back(Airfoil_Coord[0]);
Ycoord.push_back(Airfoil_Coord[1]*factor*AirfoilScale);
}
-
+
}
if (strcmp (AirfoilFormat,"Lednicer") == 0) {
-
+
/*--- The second line is the number of points ---*/
getline(airfoil_file, text_line);
istringstream point_line(text_line);
point_line >> Upper >> Lower;
-
+
nUpper = SU2_TYPE::Int(Upper);
nLower = SU2_TYPE::Int(Lower);
-
+
Xcoord.resize(nUpper+nLower-1);
Ycoord.resize(nUpper+nLower-1);
-
+
/*--- White line ---*/
getline (airfoil_file, text_line);
@@ -6231,55 +6231,55 @@ void CSurfaceMovement::SetAirfoil(CGeometry *boundary, CConfig *config) {
istringstream point_line(text_line);
point_line >> Airfoil_Coord[0] >> Airfoil_Coord[1];
Xcoord[nUpper-iUpper-1] = Airfoil_Coord[0];
-
+
if (strcmp (AirfoilClose,"Yes") == 0)
factor = -atan(coeff*(Airfoil_Coord[0]-1.0))*2.0/PI_NUMBER;
else factor = 1.0;
-
+
Ycoord[nUpper-iUpper-1] = Airfoil_Coord[1]*AirfoilScale*factor;
}
-
+
getline (airfoil_file, text_line);
for (iLower = 0; iLower < nLower; iLower++) {
getline (airfoil_file, text_line);
istringstream point_line(text_line);
point_line >> Airfoil_Coord[0] >> Airfoil_Coord[1];
-
+
if (strcmp (AirfoilClose,"Yes") == 0)
factor = -atan(coeff*(Airfoil_Coord[0]-1.0))*2.0/PI_NUMBER;
else factor = 1.0;
-
+
Xcoord[nUpper+iLower-1] = Airfoil_Coord[0];
Ycoord[nUpper+iLower-1] = Airfoil_Coord[1]*AirfoilScale*factor;
}
-
+
}
-
+
/*--- Check the coordinate (1,0) at the beginning and end of the file ---*/
-
+
if (Xcoord[0] == 1.0) AddBegin = false;
if (Xcoord[Xcoord.size()-1] == 1.0) AddEnd = false;
-
+
if (AddBegin) { Xcoord.insert(Xcoord.begin(), 1.0); Ycoord.insert(Ycoord.begin(), 0.0);}
if (AddEnd) { Xcoord.push_back(1.0); Ycoord.push_back(0.0);}
-
+
/*--- Change the orientation (depend on the input file, and the mesh file) ---*/
-
+
if (strcmp (MeshOrientation,"clockwise") == 0) {
for (iVar = 0; iVar < Xcoord.size(); iVar++) {
Xcoord_Aux.push_back(Xcoord[iVar]);
Ycoord_Aux.push_back(Ycoord[iVar]);
}
-
+
for (iVar = 0; iVar < Xcoord.size(); iVar++) {
Xcoord[iVar] = Xcoord_Aux[Xcoord.size()-iVar-1];
Ycoord[iVar] = Ycoord_Aux[Xcoord.size()-iVar-1];
}
}
-
+
/*--- Compute the total arch length ---*/
-
+
Arch = 0.0; Svalue.push_back(Arch);
for (iVar = 0; iVar < Xcoord.size()-1; iVar++) {
@@ -6291,31 +6291,31 @@ void CSurfaceMovement::SetAirfoil(CGeometry *boundary, CConfig *config) {
x_i = Xcoord[Xcoord.size()-1]; x_ip1 = Xcoord[0];
y_i = Ycoord[Xcoord.size()-1]; y_ip1 = Ycoord[0];
Arch += sqrt((x_ip1-x_i)*(x_ip1-x_i)+(y_ip1-y_i)*(y_ip1-y_i));
-
+
/*--- Non dimensionalization ---*/
-
+
for (iVar = 0; iVar < Svalue.size(); iVar++) { Svalue[iVar] /= Arch; }
/*--- Close the restart file ---*/
-
+
airfoil_file.close();
-
+
/*--- Create a spline for X and Y coordiantes using the arch length ---*/
-
+
n_Airfoil = Svalue.size();
yp1 = (Xcoord[1]-Xcoord[0])/(Svalue[1]-Svalue[0]);
ypn = (Xcoord[n_Airfoil-1]-Xcoord[n_Airfoil-2])/(Svalue[n_Airfoil-1]-Svalue[n_Airfoil-2]);
-
+
Xcoord2.resize(n_Airfoil+1);
boundary->SetSpline(Svalue, Xcoord, n_Airfoil, yp1, ypn, Xcoord2);
-
+
n_Airfoil = Svalue.size();
yp1 = (Ycoord[1]-Ycoord[0])/(Svalue[1]-Svalue[0]);
ypn = (Ycoord[n_Airfoil-1]-Ycoord[n_Airfoil-2])/(Svalue[n_Airfoil-1]-Svalue[n_Airfoil-2]);
-
+
Ycoord2.resize(n_Airfoil+1);
boundary->SetSpline(Svalue, Ycoord, n_Airfoil, yp1, ypn, Ycoord2);
-
+
TotalArch = 0.0;
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (((config->GetMarker_All_Moving(iMarker) == YES) && (Kind_SU2 == SU2_CFD)) ||
@@ -6323,10 +6323,10 @@ void CSurfaceMovement::SetAirfoil(CGeometry *boundary, CConfig *config) {
for (iVertex = 0; iVertex < boundary->nVertex[iMarker]-1; iVertex++) {
Coord_i = boundary->vertex[iMarker][iVertex]->GetCoord();
Coord_ip1 = boundary->vertex[iMarker][iVertex+1]->GetCoord();
-
+
x_i = Coord_i[0]; x_ip1 = Coord_ip1[0];
y_i = Coord_i[1]; y_ip1 = Coord_ip1[1];
-
+
TotalArch += sqrt((x_ip1-x_i)*(x_ip1-x_i)+(y_ip1-y_i)*(y_ip1-y_i));
}
Coord_i = boundary->vertex[iMarker][boundary->nVertex[iMarker]-1]->GetCoord();
@@ -6336,8 +6336,8 @@ void CSurfaceMovement::SetAirfoil(CGeometry *boundary, CConfig *config) {
TotalArch += sqrt((x_ip1-x_i)*(x_ip1-x_i)+(y_ip1-y_i)*(y_ip1-y_i));
}
}
-
-
+
+
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
Arch = 0.0;
for (iVertex = 0; iVertex < boundary->nVertex[iMarker]; iVertex++) {
@@ -6345,7 +6345,7 @@ void CSurfaceMovement::SetAirfoil(CGeometry *boundary, CConfig *config) {
if (((config->GetMarker_All_Moving(iMarker) == YES) && (Kind_SU2 == SU2_CFD)) ||
((config->GetMarker_All_DV(iMarker) == YES) && (Kind_SU2 == SU2_DEF))) {
Coord = boundary->vertex[iMarker][iVertex]->GetCoord();
-
+
if (iVertex == 0) Arch = 0.0;
else {
Coord_i = boundary->vertex[iMarker][iVertex-1]->GetCoord();
@@ -6354,27 +6354,27 @@ void CSurfaceMovement::SetAirfoil(CGeometry *boundary, CConfig *config) {
y_i = Coord_i[1]; y_ip1 = Coord_ip1[1];
Arch += sqrt((x_ip1-x_i)*(x_ip1-x_i)+(y_ip1-y_i)*(y_ip1-y_i))/TotalArch;
}
-
+
NewXCoord = boundary->GetSpline(Svalue, Xcoord, Xcoord2, n_Airfoil, Arch);
NewYCoord = boundary->GetSpline(Svalue, Ycoord, Ycoord2, n_Airfoil, Arch);
-
+
/*--- Store the delta change in the x & y coordinates ---*/
-
+
VarCoord[0] = NewXCoord - Coord[0];
VarCoord[1] = NewYCoord - Coord[1];
}
boundary->vertex[iMarker][iVertex]->SetVarCoord(VarCoord);
-
+
}
}
delete [] VarCoord;
-
+
}
void CSurfaceMovement::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};
@@ -6392,16 +6392,16 @@ void CSurfaceMovement::ReadFFDInfo(CGeometry *geometry, CConfig *config, CFreeFo
char *cstr = new char [val_mesh_filename.size()+1];
strcpy (cstr, val_mesh_filename.c_str());
-
+
mesh_file.open(cstr, ios::in);
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());
@@ -6409,9 +6409,9 @@ void CSurfaceMovement::ReadFFDInfo(CGeometry *geometry, CConfig *config, CFreeFo
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());
@@ -6421,7 +6421,7 @@ void CSurfaceMovement::ReadFFDInfo(CGeometry *geometry, CConfig *config, CFreeFo
}
/*--- Read the boundaries ---*/
-
+
position = text_line.find ("NMARK=",0);
if (position != string::npos) {
text_line.erase (0,6); nMarker = atoi(text_line.c_str());
@@ -6434,35 +6434,35 @@ void CSurfaceMovement::ReadFFDInfo(CGeometry *geometry, CConfig *config, CFreeFo
}
}
}
-
+
/*--- 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 );
@@ -6472,22 +6472,22 @@ void CSurfaceMovement::ReadFFDInfo(CGeometry *geometry, CConfig *config, CFreeFo
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);
@@ -6512,7 +6512,7 @@ void CSurfaceMovement::ReadFFDInfo(CGeometry *geometry, CConfig *config, CFreeFo
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;
@@ -6563,16 +6563,16 @@ void CSurfaceMovement::ReadFFDInfo(CGeometry *geometry, CConfig *config, CFreeFo
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 );
@@ -6582,23 +6582,23 @@ void CSurfaceMovement::ReadFFDInfo(CGeometry *geometry, CConfig *config, CFreeFo
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 );
@@ -6608,13 +6608,13 @@ void CSurfaceMovement::ReadFFDInfo(CGeometry *geometry, CConfig *config, CFreeFo
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] <<". ";
@@ -6623,8 +6623,8 @@ void CSurfaceMovement::ReadFFDInfo(CGeometry *geometry, CConfig *config, CFreeFo
/*--- Read the coordinates of the corner points ---*/
-
-
+
+
if (nDim == 2) {
if (polar) {
@@ -6707,47 +6707,47 @@ void CSurfaceMovement::ReadFFDInfo(CGeometry *geometry, CConfig *config, CFreeFo
}
/*--- 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] <<". ";
-
+
/*--- Method to identify if there is a FFDBox definition ---*/
-
+
if (nControlPoints[iFFDBox] != 0) FFDBoxDefinition = true;
/*--- 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 >> 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
+ /*--- 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->node[jPoint]->GetGlobalIndex()) {
+ if (iPoint == geometry->nodes->GetGlobalIndex(jPoint)) {
for (iDim = 0; iDim < nDim; iDim++) {
- coord[iDim] = geometry->node[jPoint]->GetCoord()[iDim];
+ coord[iDim] = geometry->nodes->GetCoord(jPoint,iDim);
}
FFDBox[iFFDBox]->Set_MarkerIndex(iMarker);
FFDBox[iFFDBox]->Set_VertexIndex(iVertex);
@@ -6759,11 +6759,11 @@ void CSurfaceMovement::ReadFFDInfo(CGeometry *geometry, CConfig *config, CFreeFo
}
}
-
+
}
-
+
nSurfacePoints[iFFDBox] = my_nSurfPoints;
-
+
#ifdef HAVE_MPI
nSurfPoints = 0;
SU2_MPI::Allreduce(&my_nSurfPoints, &nSurfPoints, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD);
@@ -6772,16 +6772,16 @@ void CSurfaceMovement::ReadFFDInfo(CGeometry *geometry, CConfig *config, CFreeFo
nSurfPoints = my_nSurfPoints;
if (rank == MASTER_NODE) cout << "Surface points: " << nSurfPoints <<"."<< endl;
#endif
-
+
}
-
+
delete [] nCornerPoints;
delete [] nControlPoints;
- delete [] nSurfacePoints;
+ 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;
}
@@ -6789,7 +6789,7 @@ void CSurfaceMovement::ReadFFDInfo(CGeometry *geometry, CConfig *config, CFreeFo
}
void CSurfaceMovement::ReadFFDInfo(CGeometry *geometry, CConfig *config, CFreeFormDefBox **FFDBox) {
-
+
string text_line, iTag;
ifstream mesh_file;
su2double coord[3];
@@ -6803,36 +6803,36 @@ void CSurfaceMovement::ReadFFDInfo(CGeometry *geometry, CConfig *config, CFreeFo
for (iDim = 0; iDim < 3; iDim++){
SplineOrder[iDim] = SU2_TYPE::Short(config->GetFFD_BSplineOrder()[iDim]);
}
-
-
+
+
/*--- Read the FFDBox information from the config file ---*/
-
+
nFFDBox = config->GetnFFDBox();
-
+
if (rank == MASTER_NODE) cout << nFFDBox << " Free Form Deformation boxes." << endl;
-
+
nCornerPoints = new unsigned short[nFFDBox];
-
+
nLevel = 1; // Nested FFD is not active
-
+
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 ---*/
-
+
string TagFFDBox = config->GetTagFFDBox(iFFDBox);
-
+
if (rank == MASTER_NODE) cout << "FFD box tag: " << TagFFDBox <<". ";
-
+
/*--- Read the level of the FFD box ---*/
-
+
LevelFFDBox = 0; // Nested FFD is not active
-
+
if (rank == MASTER_NODE) cout << "FFD box level: " << LevelFFDBox <<". ";
-
+
/*--- Read the degree of the FFD box ---*/
-
+
if (nDim == 2) {
if (polar) {
degree[0] = config->GetDegreeFFDBox(iFFDBox, 0);
@@ -6858,7 +6858,7 @@ void CSurfaceMovement::ReadFFDInfo(CGeometry *geometry, CConfig *config, CFreeFo
}
else cout << "Degrees: " << degree[0] << ", " << degree[1] << ", " << degree[2] << "." << endl;
}
-
+
if (rank == MASTER_NODE){
if (config->GetFFD_Blending() == BSPLINE_UNIFORM){
cout << "FFD Blending using B-Splines. ";
@@ -6875,33 +6875,33 @@ void CSurfaceMovement::ReadFFDInfo(CGeometry *geometry, CConfig *config, CFreeFo
FFDBox[iFFDBox]->SetTag(TagFFDBox); FFDBox[iFFDBox]->SetLevel(LevelFFDBox);
/*--- Read the number of parents boxes ---*/
-
+
nParentFFDBox = 0; // Nested FFD is not active
if (rank == MASTER_NODE) cout << "Number of parent boxes: " << nParentFFDBox <<". ";
-
+
for (iParentFFDBox = 0; iParentFFDBox < nParentFFDBox; iParentFFDBox++) {
string ParentFFDBox = "NONE"; // Nested FFD is not active
FFDBox[iFFDBox]->SetParentFFDBox(ParentFFDBox);
}
-
+
/*--- Read the number of children boxes ---*/
-
+
nChildFFDBox = 0; // Nested FFD is not active
if (rank == MASTER_NODE) cout << "Number of child boxes: " << nChildFFDBox <<"." << endl;
-
+
for (iChildFFDBox = 0; iChildFFDBox < nChildFFDBox; iChildFFDBox++) {
string ChildFFDBox = "NONE"; // Nested FFD is not active
FFDBox[iFFDBox]->SetChildFFDBox(ChildFFDBox);
}
-
+
/*--- Read the number of the corner points ---*/
-
+
nCornerPoints[iFFDBox] = 8;
-
+
/*--- Read the coordinates of the corner points ---*/
-
+
for (iCornerPoints = 0; iCornerPoints < nCornerPoints[iFFDBox]; iCornerPoints++) {
-
+
if (nDim == 2) {
if (polar) {
@@ -6967,178 +6967,178 @@ void CSurfaceMovement::ReadFFDInfo(CGeometry *geometry, CConfig *config, CFreeFo
coord[1] = config->GetCoordFFDBox(iFFDBox, iCornerPoints*3+1);
coord[2] = config->GetCoordFFDBox(iFFDBox, iCornerPoints*3+2);
}
-
+
FFDBox[iFFDBox]->SetCoordCornerPoints(coord, iCornerPoints);
-
+
}
-
+
/*--- Method to identify if there is a FFDBox definition ---*/
-
+
FFDBoxDefinition = false;
-
+
}
-
+
delete [] nCornerPoints;
-
+
if (nFFDBox == 0) {
SU2_MPI::Error("There is no FFD box definition. Check the config file.", CURRENT_FUNCTION);
}
-
+
}
void CSurfaceMovement::MergeFFDInfo(CGeometry *geometry, CConfig *config) {
-
+
/*--- Local variables needed on all processors ---*/
-
+
unsigned long iPoint;
unsigned short iFFDBox;
-
+
#ifndef HAVE_MPI
-
+
/*--- In serial, the single process has access to all geometry, so simply
load the coordinates into the data structure. ---*/
-
+
/*--- Total number of points in each FFD box. ---*/
-
+
for (iFFDBox = 0 ; iFFDBox < nFFDBox; iFFDBox++) {
-
+
/*--- Loop over the mesh to collect the coords of the local points. ---*/
-
+
for (iPoint = 0; iPoint < FFDBox[iFFDBox]->GetnSurfacePoint(); iPoint++) {
-
+
/*--- Retrieve the current parametric coordinates at this node. ---*/
-
+
GlobalCoordX[iFFDBox].push_back(FFDBox[iFFDBox]->Get_ParametricCoord(iPoint)[0]);
GlobalCoordY[iFFDBox].push_back(FFDBox[iFFDBox]->Get_ParametricCoord(iPoint)[1]);
GlobalCoordZ[iFFDBox].push_back(FFDBox[iFFDBox]->Get_ParametricCoord(iPoint)[2]);
GlobalPoint[iFFDBox].push_back(FFDBox[iFFDBox]->Get_PointIndex(iPoint));
-
+
/*--- Marker of the boundary in the local domain. ---*/
-
+
unsigned short MarkerIndex = FFDBox[iFFDBox]->Get_MarkerIndex(iPoint);
string TagBound = config->GetMarker_All_TagBound(MarkerIndex);
-
+
/*--- Find the Marker of the boundary in the config file. ---*/
-
+
unsigned short MarkerIndex_CfgFile = config->GetMarker_CfgFile_TagBound(TagBound);
string TagBound_CfgFile = config->GetMarker_CfgFile_TagBound(MarkerIndex_CfgFile);
-
+
/*--- Set the value of the tag at this node. ---*/
-
+
GlobalTag[iFFDBox].push_back(TagBound_CfgFile);
-
+
}
-
+
}
-
+
#else
-
+
/*--- MPI preprocessing ---*/
-
+
int iProcessor, nProcessor = size;
-
+
/*--- Local variables needed for merging the geometry with MPI. ---*/
-
+
unsigned long jPoint, iPointLocal;
unsigned long Buffer_Send_nPoint[1], *Buffer_Recv_nPoint = NULL;
unsigned long nLocalPoint = 0, MaxLocalPoint = 0;
unsigned long nBuffer_Scalar = 0;
-
+
if (rank == MASTER_NODE) Buffer_Recv_nPoint = new unsigned long[nProcessor];
-
+
for (iFFDBox = 0 ; iFFDBox < nFFDBox; iFFDBox++) {
-
+
nLocalPoint = 0;
for (iPoint = 0; iPoint < FFDBox[iFFDBox]->GetnSurfacePoint(); iPoint++) {
-
+
iPointLocal = FFDBox[iFFDBox]->Get_PointIndex(iPoint);
-
+
if (iPointLocal < geometry->GetnPointDomain()) {
nLocalPoint++;
}
-
+
}
Buffer_Send_nPoint[0] = nLocalPoint;
/*--- Communicate the total number of nodes on this domain. ---*/
-
+
SU2_MPI::Gather(&Buffer_Send_nPoint, 1, MPI_UNSIGNED_LONG,
Buffer_Recv_nPoint, 1, MPI_UNSIGNED_LONG, MASTER_NODE, MPI_COMM_WORLD);
SU2_MPI::Allreduce(&nLocalPoint, &MaxLocalPoint, 1, MPI_UNSIGNED_LONG, MPI_MAX, MPI_COMM_WORLD);
-
+
nBuffer_Scalar = MaxLocalPoint;
/*--- Send and Recv buffers. ---*/
-
+
su2double *Buffer_Send_X = new su2double[MaxLocalPoint];
su2double *Buffer_Recv_X = NULL;
-
+
su2double *Buffer_Send_Y = new su2double[MaxLocalPoint];
su2double *Buffer_Recv_Y = NULL;
-
+
su2double *Buffer_Send_Z = new su2double[MaxLocalPoint];
su2double *Buffer_Recv_Z = NULL;
-
+
unsigned long *Buffer_Send_Point = new unsigned long[MaxLocalPoint];
unsigned long *Buffer_Recv_Point = NULL;
-
+
unsigned short *Buffer_Send_MarkerIndex_CfgFile = new unsigned short[MaxLocalPoint];
unsigned short *Buffer_Recv_MarkerIndex_CfgFile = NULL;
-
+
/*--- Prepare the receive buffers in the master node only. ---*/
-
+
if (rank == MASTER_NODE) {
-
+
Buffer_Recv_X = new su2double[nProcessor*MaxLocalPoint];
Buffer_Recv_Y = new su2double[nProcessor*MaxLocalPoint];
Buffer_Recv_Z = new su2double[nProcessor*MaxLocalPoint];
Buffer_Recv_Point = new unsigned long[nProcessor*MaxLocalPoint];
Buffer_Recv_MarkerIndex_CfgFile = new unsigned short[nProcessor*MaxLocalPoint];
-
+
}
-
+
/*--- Main communication routine. Loop over each coordinate and perform
the MPI comm. Temporary 1-D buffers are used to send the coordinates at
all nodes on each partition to the master node. These are then unpacked
by the master and sorted by global index in one large n-dim. array. ---*/
-
+
/*--- Loop over this partition to collect the coords of the local points. ---*/
-
+
jPoint = 0;
for (iPoint = 0; iPoint < FFDBox[iFFDBox]->GetnSurfacePoint(); iPoint++) {
-
+
iPointLocal = FFDBox[iFFDBox]->Get_PointIndex(iPoint);
-
+
if (iPointLocal < geometry->GetnPointDomain()) {
-
+
/*--- Load local coords into the temporary send buffer. ---*/
-
+
Buffer_Send_X[jPoint] = FFDBox[iFFDBox]->Get_ParametricCoord(iPoint)[0];
Buffer_Send_Y[jPoint] = FFDBox[iFFDBox]->Get_ParametricCoord(iPoint)[1];
Buffer_Send_Z[jPoint] = FFDBox[iFFDBox]->Get_ParametricCoord(iPoint)[2];
-
+
/*--- Store the global index for this local node. ---*/
-
- Buffer_Send_Point[jPoint] = geometry->node[FFDBox[iFFDBox]->Get_PointIndex(iPoint)]->GetGlobalIndex();
-
+
+ Buffer_Send_Point[jPoint] = geometry->nodes->GetGlobalIndex(FFDBox[iFFDBox]->Get_PointIndex(iPoint));
+
/*--- Marker of the boundary in the local domain. ---*/
-
+
unsigned short MarkerIndex = FFDBox[iFFDBox]->Get_MarkerIndex(iPoint);
string TagBound = config->GetMarker_All_TagBound(MarkerIndex);
-
+
/*--- Find the Marker of the boundary in the config file.---*/
-
+
unsigned short MarkerIndex_CfgFile = config->GetMarker_CfgFile_TagBound(TagBound);
Buffer_Send_MarkerIndex_CfgFile[jPoint] = MarkerIndex_CfgFile;
-
+
jPoint++;
-
+
}
-
+
}
-
+
/*--- Gather the coordinate data on the master node using MPI. ---*/
-
+
SU2_MPI::Gather(Buffer_Send_X, nBuffer_Scalar, MPI_DOUBLE, Buffer_Recv_X, nBuffer_Scalar, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD);
SU2_MPI::Gather(Buffer_Send_Y, nBuffer_Scalar, MPI_DOUBLE, Buffer_Recv_Y, nBuffer_Scalar, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD);
SU2_MPI::Gather(Buffer_Send_Z, nBuffer_Scalar, MPI_DOUBLE, Buffer_Recv_Z, nBuffer_Scalar, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD);
@@ -7146,42 +7146,42 @@ void CSurfaceMovement::MergeFFDInfo(CGeometry *geometry, CConfig *config) {
SU2_MPI::Gather(Buffer_Send_MarkerIndex_CfgFile, nBuffer_Scalar, MPI_UNSIGNED_SHORT, Buffer_Recv_MarkerIndex_CfgFile, nBuffer_Scalar, MPI_UNSIGNED_SHORT, MASTER_NODE, MPI_COMM_WORLD);
/*--- The master node unpacks and sorts this variable by global index ---*/
-
+
if (rank == MASTER_NODE) {
-
+
jPoint = 0;
-
+
for (iProcessor = 0; iProcessor < nProcessor; iProcessor++) {
for (iPoint = 0; iPoint < Buffer_Recv_nPoint[iProcessor]; iPoint++) {
-
+
/*--- Get global index, then loop over each variable and store ---*/
-
+
GlobalCoordX[iFFDBox].push_back(Buffer_Recv_X[jPoint]);
GlobalCoordY[iFFDBox].push_back(Buffer_Recv_Y[jPoint]);
GlobalCoordZ[iFFDBox].push_back(Buffer_Recv_Z[jPoint]);
GlobalPoint[iFFDBox].push_back(Buffer_Recv_Point[jPoint]);
-
+
string TagBound_CfgFile = config->GetMarker_CfgFile_TagBound(Buffer_Recv_MarkerIndex_CfgFile[jPoint]);
GlobalTag[iFFDBox].push_back(TagBound_CfgFile);
jPoint++;
-
+
}
-
+
/*--- Adjust jPoint to index of next proc's data in the buffers. ---*/
-
+
jPoint = (iProcessor+1)*nBuffer_Scalar;
-
+
}
}
-
+
/*--- Immediately release the temporary data buffers. ---*/
-
+
delete [] Buffer_Send_X;
delete [] Buffer_Send_Y;
delete [] Buffer_Send_Z;
delete [] Buffer_Send_Point;
delete [] Buffer_Send_MarkerIndex_CfgFile;
-
+
if (rank == MASTER_NODE) {
delete [] Buffer_Recv_X;
delete [] Buffer_Recv_Y;
@@ -7189,20 +7189,20 @@ void CSurfaceMovement::MergeFFDInfo(CGeometry *geometry, CConfig *config) {
delete [] Buffer_Recv_Point;
delete [] Buffer_Recv_MarkerIndex_CfgFile;
}
-
+
}
if (rank == MASTER_NODE) {
delete [] Buffer_Recv_nPoint;
}
-
+
#endif
-
+
}
void CSurfaceMovement::WriteFFDInfo(CSurfaceMovement** surface_movement, CGeometry **geometry, CConfig **config) {
-
-
+
+
unsigned short iOrder, jOrder, kOrder, iFFDBox, iCornerPoints, iParentFFDBox, iChildFFDBox, iZone;
unsigned long iSurfacePoints;
char cstr[MAX_STRING_SIZE], mesh_file[MAX_STRING_SIZE];
@@ -7210,15 +7210,15 @@ void CSurfaceMovement::WriteFFDInfo(CSurfaceMovement** surface_movement, CGeomet
ofstream output_file;
su2double *coord;
string text_line;
-
+
bool polar = (config[ZONE_0]->GetFFD_CoordSystem() == POLAR);
unsigned short nDim = geometry[ZONE_0]->GetnDim();
-
+
for (iZone = 0; iZone < config[ZONE_0]->GetnZone(); iZone++){
/*--- Merge the parallel FFD info ---*/
-
+
surface_movement[iZone]->MergeFFDInfo(geometry[iZone], config[iZone]);
if (iZone > 0){
@@ -7248,36 +7248,36 @@ void CSurfaceMovement::WriteFFDInfo(CSurfaceMovement** surface_movement, CGeomet
-
+
/*--- Attach to the mesh file the FFD information (all information is in ZONE_0) ---*/
-
+
if (rank == MASTER_NODE) {
-
+
/*--- Read the name of the output file ---*/
-
+
str = config[ZONE_0]->GetMesh_Out_FileName();
-
+
unsigned short lastindex = str.find_last_of(".");
str = str.substr(0, lastindex);
-
+
str += ".su2";
-
+
strcpy (mesh_file, str.c_str());
strcpy (cstr, mesh_file);
-
+
output_file.precision(15);
output_file.open(cstr, ios::out | ios::app);
-
+
if (nFFDBox != 0) {
output_file << "FFD_NBOX= " << nFFDBox << endl;
output_file << "FFD_NLEVEL= " << nLevel << endl;
}
-
+
for (iFFDBox = 0 ; iFFDBox < nFFDBox; iFFDBox++) {
-
+
output_file << "FFD_TAG= " << FFDBox[iFFDBox]->GetTag() << endl;
output_file << "FFD_LEVEL= " << FFDBox[iFFDBox]->GetLevel() << endl;
-
+
output_file << "FFD_DEGREE_I= " << FFDBox[iFFDBox]->GetlOrder()-1 << endl;
if (polar) output_file << "FFD_DEGREE_J= " << FFDBox[iFFDBox]->GetnOrder()-1 << endl;
else output_file << "FFD_DEGREE_J= " << FFDBox[iFFDBox]->GetmOrder()-1 << endl;
@@ -7299,7 +7299,7 @@ void CSurfaceMovement::WriteFFDInfo(CSurfaceMovement** surface_movement, CGeomet
output_file << "FFD_CHILDREN= " << FFDBox[iFFDBox]->GetnChildFFDBox() << endl;
for (iChildFFDBox = 0; iChildFFDBox < FFDBox[iFFDBox]->GetnChildFFDBox(); iChildFFDBox++)
output_file << FFDBox[iFFDBox]->GetChildFFDBoxTag(iChildFFDBox) << endl;
-
+
if (nDim == 2) {
output_file << "FFD_CORNER_POINTS= " << FFDBox[iFFDBox]->GetnCornerPoints()/SU2_TYPE::Int(2) << endl;
if (polar) {
@@ -7329,9 +7329,9 @@ void CSurfaceMovement::WriteFFDInfo(CSurfaceMovement** surface_movement, CGeomet
output_file << coord[0] << "\t" << coord[1] << "\t" << coord[2] << endl;
}
}
-
+
/*--- Writing control points ---*/
-
+
if (FFDBox[iFFDBox]->GetnControlPoints() == 0) {
output_file << "FFD_CONTROL_POINTS= 0" << endl;
}
@@ -7344,27 +7344,27 @@ void CSurfaceMovement::WriteFFDInfo(CSurfaceMovement** surface_movement, CGeomet
output_file << iOrder << "\t" << jOrder << "\t" << kOrder << "\t" << coord[0] << "\t" << coord[1] << "\t" << coord[2] << endl;
}
}
-
+
/*--- Writing surface points ---*/
-
+
if (FFDBox[iFFDBox]->GetnControlPoints() == 0) {
output_file << "FFD_SURFACE_POINTS= 0" << endl;
}
else {
output_file << "FFD_SURFACE_POINTS= " << GlobalTag[iFFDBox].size() << endl;
-
+
for (iSurfacePoints = 0; iSurfacePoints < GlobalTag[iFFDBox].size(); iSurfacePoints++) {
output_file << scientific << GlobalTag[iFFDBox][iSurfacePoints] << "\t" << GlobalPoint[iFFDBox][iSurfacePoints]
<< "\t" << GlobalCoordX[iFFDBox][iSurfacePoints] << "\t" << GlobalCoordY[iFFDBox][iSurfacePoints]
<< "\t" << GlobalCoordZ[iFFDBox][iSurfacePoints] << endl;
}
-
+
}
-
+
}
-
+
output_file.close();
-
+
}
}
@@ -7372,20 +7372,20 @@ void CSurfaceMovement::WriteFFDInfo(CSurfaceMovement** surface_movement, CGeomet
CFreeFormDefBox::CFreeFormDefBox(void) : CGridMovement() { }
CFreeFormDefBox::CFreeFormDefBox(unsigned short Degree[], unsigned short BSplineOrder[], unsigned short kind_blending) : CGridMovement() {
-
+
unsigned short iCornerPoints, iOrder, jOrder, kOrder, iDim;
-
+
/*--- FFD is always 3D (even in 2D problems) ---*/
-
+
nDim = 3;
nCornerPoints = 8;
-
+
/*--- Allocate Corners points ---*/
-
+
Coord_Corner_Points = new su2double* [nCornerPoints];
for (iCornerPoints = 0; iCornerPoints < nCornerPoints; iCornerPoints++)
Coord_Corner_Points[iCornerPoints] = new su2double [nDim];
-
+
ParamCoord = new su2double[nDim]; ParamCoord_ = new su2double[nDim];
cart_coord = new su2double[nDim]; cart_coord_ = new su2double[nDim];
Gradient = new su2double[nDim];
@@ -7394,12 +7394,12 @@ CFreeFormDefBox::CFreeFormDefBox(unsigned short Degree[], unsigned short BSpline
mDegree = Degree[1]; mOrder = mDegree+1;
nDegree = Degree[2]; nOrder = nDegree+1;
nControlPoints = lOrder*mOrder*nOrder;
-
+
lDegree_Copy = Degree[0]; lOrder_Copy = lDegree+1;
mDegree_Copy = Degree[1]; mOrder_Copy = mDegree+1;
nDegree_Copy = Degree[2]; nOrder_Copy = nDegree+1;
nControlPoints_Copy = lOrder_Copy*mOrder_Copy*nOrder_Copy;
-
+
Coord_Control_Points = new su2double*** [lOrder];
ParCoord_Control_Points = new su2double*** [lOrder];
Coord_Control_Points_Copy = new su2double*** [lOrder];
@@ -7441,9 +7441,9 @@ CFreeFormDefBox::CFreeFormDefBox(unsigned short Degree[], unsigned short BSpline
CFreeFormDefBox::~CFreeFormDefBox(void) {
unsigned short iOrder, jOrder, kOrder, iCornerPoints, iDim;
-
- for (iOrder = 0; iOrder < lOrder; iOrder++)
- for (jOrder = 0; jOrder < mOrder; jOrder++)
+
+ for (iOrder = 0; iOrder < lOrder; iOrder++)
+ for (jOrder = 0; jOrder < mOrder; jOrder++)
for (kOrder = 0; kOrder < nOrder; kOrder++) {
delete [] Coord_Control_Points[iOrder][jOrder][kOrder];
delete [] ParCoord_Control_Points[iOrder][jOrder][kOrder];
@@ -7456,7 +7456,7 @@ CFreeFormDefBox::~CFreeFormDefBox(void) {
delete [] ParamCoord;
delete [] cart_coord;
delete [] Gradient;
-
+
for (iCornerPoints = 0; iCornerPoints < nCornerPoints; iCornerPoints++)
delete [] Coord_Corner_Points[iCornerPoints];
delete [] Coord_Corner_Points;
@@ -7468,12 +7468,12 @@ CFreeFormDefBox::~CFreeFormDefBox(void) {
}
void CFreeFormDefBox::SetUnitCornerPoints(void) {
-
+
unsigned short iDim;
su2double *coord = new su2double [nDim];
-
+
for (iDim = 0; iDim < nDim; iDim++) coord[iDim] = 0.0;
-
+
coord [0] = 0.0; coord [1] = 0.0; coord [2] = 0.0; this->SetCoordCornerPoints(coord, 0);
coord [0] = 1.0; coord [1] = 0.0; coord [2] = 0.0; this->SetCoordCornerPoints(coord, 1);
coord [0] = 1.0; coord [1] = 1.0; coord [2] = 0.0; this->SetCoordCornerPoints(coord, 2);
@@ -7482,14 +7482,14 @@ void CFreeFormDefBox::SetUnitCornerPoints(void) {
coord [0] = 1.0; coord [1] = 0.0; coord [2] = 1.0; this->SetCoordCornerPoints(coord, 5);
coord [0] = 1.0; coord [1] = 1.0; coord [2] = 1.0; this->SetCoordCornerPoints(coord, 6);
coord [0] = 0.0; coord [1] = 1.0; coord [2] = 1.0; this->SetCoordCornerPoints(coord, 7);
-
+
delete [] coord;
-
+
}
void CFreeFormDefBox::SetControlPoints_Parallelepiped (void) {
unsigned short iDim, iDegree, jDegree, kDegree;
-
+
/*--- Set base control points according to the notation of Vtk for hexahedrons ---*/
for (iDim = 0; iDim < nDim; iDim++) {
Coord_Control_Points [0] [0] [0] [iDim] = Coord_Corner_Points[0][iDim];
@@ -7501,16 +7501,16 @@ void CFreeFormDefBox::SetControlPoints_Parallelepiped (void) {
Coord_Control_Points [lOrder-1] [mOrder-1] [nOrder-1] [iDim] = Coord_Corner_Points[6][iDim];
Coord_Control_Points [0] [mOrder-1] [nOrder-1] [iDim] = Coord_Corner_Points[7][iDim];
}
-
+
/*--- Fill the rest of the cubic matrix of control points with uniform spacing (parallelepiped) ---*/
for (iDegree = 0; iDegree <= lDegree; iDegree++)
for (jDegree = 0; jDegree <= mDegree; jDegree++)
for (kDegree = 0; kDegree <= nDegree; kDegree++) {
- Coord_Control_Points[iDegree][jDegree][kDegree][0] = Coord_Corner_Points[0][0]
+ Coord_Control_Points[iDegree][jDegree][kDegree][0] = Coord_Corner_Points[0][0]
+ su2double(iDegree)/su2double(lDegree)*(Coord_Corner_Points[1][0]-Coord_Corner_Points[0][0]);
- Coord_Control_Points[iDegree][jDegree][kDegree][1] = Coord_Corner_Points[0][1]
- + su2double(jDegree)/su2double(mDegree)*(Coord_Corner_Points[3][1]-Coord_Corner_Points[0][1]);
- Coord_Control_Points[iDegree][jDegree][kDegree][2] = Coord_Corner_Points[0][2]
+ Coord_Control_Points[iDegree][jDegree][kDegree][1] = Coord_Corner_Points[0][1]
+ + su2double(jDegree)/su2double(mDegree)*(Coord_Corner_Points[3][1]-Coord_Corner_Points[0][1]);
+ Coord_Control_Points[iDegree][jDegree][kDegree][2] = Coord_Corner_Points[0][2]
+ su2double(kDegree)/su2double(nDegree)*(Coord_Corner_Points[4][2]-Coord_Corner_Points[0][2]);
}
}
@@ -7520,7 +7520,7 @@ void CFreeFormDefBox::SetSupportCP(CFreeFormDefBox *FFDBox) {
unsigned short lOrder = FFDBox->GetlOrder();
unsigned short mOrder = FFDBox->GetmOrder();
unsigned short nOrder = FFDBox->GetnOrder();
-
+
Coord_SupportCP = new su2double*** [lOrder];
for (iOrder = 0; iOrder < lOrder; iOrder++) {
Coord_SupportCP[iOrder] = new su2double** [mOrder];
@@ -7530,7 +7530,7 @@ void CFreeFormDefBox::SetSupportCP(CFreeFormDefBox *FFDBox) {
Coord_SupportCP[iOrder][jOrder][kOrder] = new su2double [nDim];
}
}
-
+
/*--- Set base support control points according to the notation of Vtk for hexahedrons ---*/
for (iDim = 0; iDim < nDim; iDim++) {
Coord_SupportCP [0] [0] [0] [iDim] = Coord_Corner_Points[0][iDim];
@@ -7542,16 +7542,16 @@ void CFreeFormDefBox::SetSupportCP(CFreeFormDefBox *FFDBox) {
Coord_SupportCP [lOrder-1] [mOrder-1] [nOrder-1] [iDim] = Coord_Corner_Points[6][iDim];
Coord_SupportCP [0] [mOrder-1] [nOrder-1] [iDim] = Coord_Corner_Points[7][iDim];
}
-
+
/*--- Fill the rest of the cubic matrix of support control points with uniform spacing ---*/
for (iOrder = 0; iOrder < lOrder; iOrder++)
for (jOrder = 0; jOrder < mOrder; jOrder++)
for (kOrder = 0; kOrder < nOrder; kOrder++) {
- Coord_SupportCP[iOrder][jOrder][kOrder][0] = Coord_Corner_Points[0][0]
+ Coord_SupportCP[iOrder][jOrder][kOrder][0] = Coord_Corner_Points[0][0]
+ su2double(iOrder)/su2double(lOrder-1)*(Coord_Corner_Points[1][0]-Coord_Corner_Points[0][0]);
- Coord_SupportCP[iOrder][jOrder][kOrder][1] = Coord_Corner_Points[0][1]
- + su2double(jOrder)/su2double(mOrder-1)*(Coord_Corner_Points[3][1]-Coord_Corner_Points[0][1]);
- Coord_SupportCP[iOrder][jOrder][kOrder][2] = Coord_Corner_Points[0][2]
+ Coord_SupportCP[iOrder][jOrder][kOrder][1] = Coord_Corner_Points[0][1]
+ + su2double(jOrder)/su2double(mOrder-1)*(Coord_Corner_Points[3][1]-Coord_Corner_Points[0][1]);
+ Coord_SupportCP[iOrder][jOrder][kOrder][2] = Coord_Corner_Points[0][2]
+ su2double(kOrder)/su2double(nOrder-1)*(Coord_Corner_Points[4][2]-Coord_Corner_Points[0][2]);
}
}
@@ -7572,14 +7572,14 @@ void CFreeFormDefBox::SetSupportCPChange(CFreeFormDefBox *FFDBox) {
ParamCoord_SupportCP[iOrder][jOrder][kOrder] = new su2double [nDim];
}
}
-
+
for (iOrder = 0; iOrder < lOrder; iOrder++)
for (jOrder = 0; jOrder < mOrder; jOrder++)
for (kOrder = 0; kOrder < nOrder; kOrder++)
for (iDim = 0; iDim < nDim; iDim++)
- ParamCoord_SupportCP[iOrder][jOrder][kOrder][iDim] =
+ ParamCoord_SupportCP[iOrder][jOrder][kOrder][iDim] =
Coord_SupportCP[iOrder][jOrder][kOrder][iDim];
-
+
for (iDim = 0; iDim < nDim; iDim++) {
Coord_Control_Points[0][0][0][iDim] = FFDBox->GetCoordCornerPoints(iDim, 0);
Coord_Control_Points[1][0][0][iDim] = FFDBox->GetCoordCornerPoints(iDim, 1);
@@ -7590,7 +7590,7 @@ void CFreeFormDefBox::SetSupportCPChange(CFreeFormDefBox *FFDBox) {
Coord_Control_Points[1][1][1][iDim] = FFDBox->GetCoordCornerPoints(iDim, 6);
Coord_Control_Points[0][1][1][iDim] = FFDBox->GetCoordCornerPoints(iDim, 7);
}
-
+
for (iOrder = 0; iOrder < FFDBox->GetlOrder(); iOrder++) {
for (jOrder = 0; jOrder < FFDBox->GetmOrder(); jOrder++) {
for (kOrder = 0; kOrder < FFDBox->GetnOrder(); kOrder++) {
@@ -7605,238 +7605,238 @@ void CFreeFormDefBox::SetSupportCPChange(CFreeFormDefBox *FFDBox) {
}
void CFreeFormDefBox::SetCart2Cyl_ControlPoints(CConfig *config) {
-
+
unsigned short iDegree, jDegree, kDegree;
su2double CartCoord[3];
su2double X_0, Y_0, Z_0, Xbar, Ybar, Zbar;
-
+
X_0 = config->GetFFD_Axis(0); Y_0 = config->GetFFD_Axis(1); Z_0 = config->GetFFD_Axis(2);
-
+
for (kDegree = 0; kDegree <= nDegree; kDegree++) {
for (jDegree = 0; jDegree <= mDegree; jDegree++) {
for (iDegree = 0; iDegree <= lDegree; iDegree++) {
-
+
CartCoord[0] = Coord_Control_Points[iDegree][jDegree][kDegree][0];
CartCoord[1] = Coord_Control_Points[iDegree][jDegree][kDegree][1];
CartCoord[2] = Coord_Control_Points[iDegree][jDegree][kDegree][2];
-
+
Xbar = CartCoord[0] - X_0; Ybar = CartCoord[1] - Y_0; Zbar = CartCoord[2] - Z_0;
-
+
Coord_Control_Points[iDegree][jDegree][kDegree][0] = sqrt(Ybar*Ybar + Zbar*Zbar);
Coord_Control_Points[iDegree][jDegree][kDegree][1] = atan2 ( Zbar, Ybar);
if (Coord_Control_Points[iDegree][jDegree][kDegree][1] > PI_NUMBER/2.0) Coord_Control_Points[iDegree][jDegree][kDegree][1] -= 2.0*PI_NUMBER;
Coord_Control_Points[iDegree][jDegree][kDegree][2] = Xbar;
-
+
CartCoord[0] = Coord_Control_Points_Copy[iDegree][jDegree][kDegree][0];
CartCoord[1] = Coord_Control_Points_Copy[iDegree][jDegree][kDegree][1];
CartCoord[2] = Coord_Control_Points_Copy[iDegree][jDegree][kDegree][2];
-
+
Xbar = CartCoord[0] - X_0; Ybar = CartCoord[1] - Y_0; Zbar = CartCoord[2] - Z_0;
-
+
Coord_Control_Points_Copy[iDegree][jDegree][kDegree][0] = sqrt(Ybar*Ybar + Zbar*Zbar);
Coord_Control_Points_Copy[iDegree][jDegree][kDegree][1] = atan2 (Zbar, Ybar);
if (Coord_Control_Points_Copy[iDegree][jDegree][kDegree][1] > PI_NUMBER/2.0) Coord_Control_Points_Copy[iDegree][jDegree][kDegree][1] -= 2.0*PI_NUMBER;
Coord_Control_Points_Copy[iDegree][jDegree][kDegree][2] = Xbar;
-
+
}
}
}
-
+
}
void CFreeFormDefBox::SetCyl2Cart_ControlPoints(CConfig *config) {
-
+
unsigned short iDegree, jDegree, kDegree;
su2double PolarCoord[3];
-
+
su2double X_0, Y_0, Z_0, Xbar, Ybar, Zbar;
X_0 = config->GetFFD_Axis(0); Y_0 = config->GetFFD_Axis(1); Z_0 = config->GetFFD_Axis(2);
-
+
for (kDegree = 0; kDegree <= nDegree; kDegree++) {
for (jDegree = 0; jDegree <= mDegree; jDegree++) {
for (iDegree = 0; iDegree <= lDegree; iDegree++) {
-
-
+
+
PolarCoord[0] = Coord_Control_Points[iDegree][jDegree][kDegree][0];
PolarCoord[1] = Coord_Control_Points[iDegree][jDegree][kDegree][1];
PolarCoord[2] = Coord_Control_Points[iDegree][jDegree][kDegree][2];
-
-
+
+
Xbar = PolarCoord[2];
Ybar = PolarCoord[0] * cos(PolarCoord[1]);
Zbar = PolarCoord[0] * sin(PolarCoord[1]);
-
+
PolarCoord[0] = Xbar +X_0; PolarCoord[1] = Ybar +Y_0; PolarCoord[2] = Zbar +Z_0;
-
+
Coord_Control_Points[iDegree][jDegree][kDegree][0] = PolarCoord[0];
Coord_Control_Points[iDegree][jDegree][kDegree][1] = PolarCoord[1];
Coord_Control_Points[iDegree][jDegree][kDegree][2] = PolarCoord[2];
-
+
}
}
}
-
+
}
void CFreeFormDefBox::SetCart2Cyl_CornerPoints(CConfig *config) {
-
+
unsigned short iCornerPoint;
su2double *CartCoord;
su2double X_0, Y_0, Z_0, Xbar, Ybar, Zbar;
-
+
X_0 = config->GetFFD_Axis(0); Y_0 = config->GetFFD_Axis(1); Z_0 = config->GetFFD_Axis(2);
-
+
for (iCornerPoint = 0; iCornerPoint < 8; iCornerPoint++) {
-
+
CartCoord = GetCoordCornerPoints(iCornerPoint);
Xbar = CartCoord[0] - X_0; Ybar = CartCoord[1] - Y_0; Zbar = CartCoord[2] - Z_0;
-
+
CartCoord[0] = sqrt(Ybar*Ybar + Zbar*Zbar);
CartCoord[1] = atan2 ( Zbar, Ybar); if (CartCoord[1] > PI_NUMBER/2.0) CartCoord[1] -= 2.0*PI_NUMBER;
CartCoord[2] = Xbar;
-
+
}
-
+
}
void CFreeFormDefBox::SetCyl2Cart_CornerPoints(CConfig *config) {
-
+
unsigned short iCornerPoint;
su2double *PolarCoord;
su2double X_0, Y_0, Z_0, Xbar, Ybar, Zbar;
-
+
X_0 = config->GetFFD_Axis(0); Y_0 = config->GetFFD_Axis(1); Z_0 = config->GetFFD_Axis(2);
-
+
for (iCornerPoint = 0; iCornerPoint < 8; iCornerPoint++) {
-
+
PolarCoord = GetCoordCornerPoints(iCornerPoint);
-
+
Xbar = PolarCoord[2];
Ybar = PolarCoord[0] * cos(PolarCoord[1]);
Zbar = PolarCoord[0] * sin(PolarCoord[1]);
-
+
PolarCoord[0] = Xbar + X_0; PolarCoord[1] = Ybar + Y_0; PolarCoord[2] = Zbar + Z_0;
-
+
}
-
+
}
void CFreeFormDefBox::SetCart2Sphe_ControlPoints(CConfig *config) {
-
+
unsigned short iDegree, jDegree, kDegree;
su2double CartCoord[3];
su2double X_0, Y_0, Z_0, Xbar, Ybar, Zbar;
-
+
X_0 = config->GetFFD_Axis(0); Y_0 = config->GetFFD_Axis(1); Z_0 = config->GetFFD_Axis(2);
-
+
for (kDegree = 0; kDegree <= nDegree; kDegree++) {
for (jDegree = 0; jDegree <= mDegree; jDegree++) {
for (iDegree = 0; iDegree <= lDegree; iDegree++) {
-
+
CartCoord[0] = Coord_Control_Points[iDegree][jDegree][kDegree][0];
CartCoord[1] = Coord_Control_Points[iDegree][jDegree][kDegree][1];
CartCoord[2] = Coord_Control_Points[iDegree][jDegree][kDegree][2];
-
+
Xbar = CartCoord[0] - X_0; Ybar = CartCoord[1] - Y_0; Zbar = CartCoord[2] - Z_0;
-
+
Coord_Control_Points[iDegree][jDegree][kDegree][0] = sqrt(Xbar*Xbar + Ybar*Ybar + Zbar*Zbar);
Coord_Control_Points[iDegree][jDegree][kDegree][1] = atan2 ( Zbar, Ybar);
if (Coord_Control_Points[iDegree][jDegree][kDegree][1] > PI_NUMBER/2.0) Coord_Control_Points[iDegree][jDegree][kDegree][1] -= 2.0*PI_NUMBER;
Coord_Control_Points[iDegree][jDegree][kDegree][2] = acos(Xbar/Coord_Control_Points[iDegree][jDegree][kDegree][0] );
-
+
CartCoord[0] = Coord_Control_Points_Copy[iDegree][jDegree][kDegree][0];
CartCoord[1] = Coord_Control_Points_Copy[iDegree][jDegree][kDegree][1];
CartCoord[2] = Coord_Control_Points_Copy[iDegree][jDegree][kDegree][2];
-
+
Xbar = CartCoord[0] - X_0; Ybar = CartCoord[1] - Y_0; Zbar = CartCoord[2] - Z_0;
-
+
Coord_Control_Points_Copy[iDegree][jDegree][kDegree][0] = sqrt(Xbar*Xbar + Ybar*Ybar + Zbar*Zbar);
Coord_Control_Points_Copy[iDegree][jDegree][kDegree][1] = atan2 ( Zbar, Ybar);
if (Coord_Control_Points_Copy[iDegree][jDegree][kDegree][1] > PI_NUMBER/2.0)
Coord_Control_Points_Copy[iDegree][jDegree][kDegree][1] -= 2.0*PI_NUMBER;
Coord_Control_Points_Copy[iDegree][jDegree][kDegree][2] = acos(Xbar/Coord_Control_Points_Copy[iDegree][jDegree][kDegree][0]);
-
+
}
}
}
-
+
}
void CFreeFormDefBox::SetSphe2Cart_ControlPoints(CConfig *config) {
-
+
unsigned short iDegree, jDegree, kDegree;
su2double PolarCoord[3];
-
+
su2double X_0, Y_0, Z_0, Xbar, Ybar, Zbar;
X_0 = config->GetFFD_Axis(0); Y_0 = config->GetFFD_Axis(1); Z_0 = config->GetFFD_Axis(2);
-
+
for (kDegree = 0; kDegree <= nDegree; kDegree++) {
for (jDegree = 0; jDegree <= mDegree; jDegree++) {
for (iDegree = 0; iDegree <= lDegree; iDegree++) {
-
+
PolarCoord[0] = Coord_Control_Points[iDegree][jDegree][kDegree][0];
PolarCoord[1] = Coord_Control_Points[iDegree][jDegree][kDegree][1];
PolarCoord[2] = Coord_Control_Points[iDegree][jDegree][kDegree][2];
-
+
Xbar = PolarCoord[0] * cos(PolarCoord[2]);
Ybar = PolarCoord[0] * cos(PolarCoord[1]) * sin(PolarCoord[2]);
Zbar = PolarCoord[0] * sin(PolarCoord[1]) * sin(PolarCoord[2]);
-
+
PolarCoord[0] = Xbar + X_0; PolarCoord[1] = Ybar + Y_0; PolarCoord[2] = Zbar + Z_0;
-
+
Coord_Control_Points[iDegree][jDegree][kDegree][0] = PolarCoord[0];
Coord_Control_Points[iDegree][jDegree][kDegree][1] = PolarCoord[1];
Coord_Control_Points[iDegree][jDegree][kDegree][2] = PolarCoord[2];
-
+
}
}
}
-
+
}
void CFreeFormDefBox::SetCart2Sphe_CornerPoints(CConfig *config) {
-
+
unsigned short iCornerPoint;
su2double *CartCoord;
su2double X_0, Y_0, Z_0, Xbar, Ybar, Zbar;
-
+
X_0 = config->GetFFD_Axis(0); Y_0 = config->GetFFD_Axis(1); Z_0 = config->GetFFD_Axis(2);
-
+
for (iCornerPoint = 0; iCornerPoint < 8; iCornerPoint++) {
-
+
CartCoord = GetCoordCornerPoints(iCornerPoint);
Xbar = CartCoord[0] - X_0; Ybar = CartCoord[1] - Y_0; Zbar = CartCoord[2] - Z_0;
-
+
CartCoord[0] = sqrt(Xbar*Xbar + Ybar*Ybar + Zbar*Zbar);
CartCoord[1] = atan2(Zbar, Ybar); if (CartCoord[1] > PI_NUMBER/2.0) CartCoord[1] -= 2.0*PI_NUMBER;
CartCoord[2] = acos(Xbar/CartCoord[0]);
-
+
}
-
+
}
void CFreeFormDefBox::SetSphe2Cart_CornerPoints(CConfig *config) {
-
+
unsigned short iCornerPoint;
su2double *PolarCoord;
su2double X_0, Y_0, Z_0, Xbar, Ybar, Zbar;
-
+
X_0 = config->GetFFD_Axis(0); Y_0 = config->GetFFD_Axis(1); Z_0 = config->GetFFD_Axis(2);
-
+
for (iCornerPoint = 0; iCornerPoint < 8; iCornerPoint++) {
-
+
PolarCoord = GetCoordCornerPoints(iCornerPoint);
-
+
Xbar = PolarCoord[0] * cos(PolarCoord[2]);
Ybar = PolarCoord[0] * cos(PolarCoord[1]) * sin(PolarCoord[2]);
Zbar = PolarCoord[0] * sin(PolarCoord[1]) * sin(PolarCoord[2]);
-
+
PolarCoord[0] = Xbar + X_0; PolarCoord[1] = Ybar + Y_0; PolarCoord[2] = Zbar + Z_0;
-
+
}
-
+
}
@@ -7864,7 +7864,7 @@ void CFreeFormDefBox::SetCGNS(CGeometry *geometry, unsigned short iFFDBox, bool
if ((original) && (iFFDBox == 0)) new_file = true;
else new_file = false;
-
+
if (new_file) {
cgns_err = cg_open(FFDBox_filename, CG_MODE_WRITE, &FFDBox_cgns_file);
if (cgns_err) cg_error_print();
@@ -7889,7 +7889,7 @@ void CFreeFormDefBox::SetCGNS(CGeometry *geometry, unsigned short iFFDBox, bool
}
cgns_err = cg_family_write(FFDBox_cgns_file, cgns_base, Tag.c_str(), &cgns_family);
if (cgns_err) cg_error_print();
-
+
cgsize_t dims[9];
dims[0] = lDegree+1;
dims[1] = mDegree+1;
@@ -7905,7 +7905,7 @@ void CFreeFormDefBox::SetCGNS(CGeometry *geometry, unsigned short iFFDBox, bool
passivedouble *buffer = new passivedouble[pointlen];
SPRINTF (zonename, "SU2_Zone_%d", SU2_TYPE::Int(iFFDBox));
-
+
cgns_err = cg_zone_write(FFDBox_cgns_file, cgns_base, zonename, dims, CGNS_ENUMV(Structured), &cgns_zone);
if (cgns_err) cg_error_print();
cgns_err = cg_goto(FFDBox_cgns_file, cgns_base, zonename, 0, NULL);
@@ -7940,29 +7940,29 @@ void CFreeFormDefBox::SetCGNS(CGeometry *geometry, unsigned short iFFDBox, bool
cgns_err = cg_close(FFDBox_cgns_file);
if (cgns_err) cg_error_print();
#else // Not built with CGNS support
- cout << "CGNS file requested for FFD but SU2 was built without CGNS support. No file written" << "\n";
+ cout << "CGNS file requested for FFD but SU2 was built without CGNS support. No file written" << "\n";
#endif
}
void CFreeFormDefBox::SetTecplot(CGeometry *geometry, unsigned short iFFDBox, bool original) {
-
+
ofstream FFDBox_file;
char FFDBox_filename[MAX_STRING_SIZE];
bool new_file;
unsigned short iDim, iDegree, jDegree, kDegree;
-
+
/*--- FFD output is always 3D (even in 2D problems),
this is important for debuging ---*/
nDim = 3;
-
+
SPRINTF (FFDBox_filename, "ffd_boxes.dat");
-
+
if ((original) && (iFFDBox == 0)) new_file = true;
else new_file = false;
-
+
if (new_file) {
FFDBox_file.open(FFDBox_filename, ios::out);
FFDBox_file << "TITLE = \"Visualization of the FFD boxes generated by SU2_DEF.\"" << endl;
@@ -7978,7 +7978,7 @@ void CFreeFormDefBox::SetTecplot(CGeometry *geometry, unsigned short iFFDBox, bo
else FFDBox_file << ", I="<GetnDim();
-
+
if (original) new_file = true;
else new_file = false;
if (new_file) SPRINTF (FFDBox_filename, "ffd_boxes_%d.vtk", SU2_TYPE::Int(iFFDBox));
else SPRINTF (FFDBox_filename, "ffd_boxes_def_%d.vtk", SU2_TYPE::Int(iFFDBox));
-
+
FFDBox_file.open(FFDBox_filename, ios::out);
FFDBox_file << "# vtk DataFile Version 3.0" << endl;
FFDBox_file << "vtk output" << endl;
FFDBox_file << "ASCII" << endl;
FFDBox_file << "DATASET STRUCTURED_GRID" << endl;
-
+
if (nDim == 2) FFDBox_file << "DIMENSIONS "<GetBasis(jDegree, ParamCoord[1])
* BlendingFunction[2]->GetBasis(kDegree, ParamCoord[2]);
}
-
+
return cart_coord;
}
su2double *CFreeFormDefBox::GetFFDGradient(su2double *val_coord, su2double *xyz) {
-
+
unsigned short iDim, jDim, lmn[3];
-
+
/*--- Set the Degree of the spline ---*/
-
+
lmn[0] = lDegree; lmn[1] = mDegree; lmn[2] = nDegree;
-
+
for (iDim = 0; iDim < nDim; iDim++) Gradient[iDim] = 0.0;
-
+
for (iDim = 0; iDim < nDim; iDim++)
for (jDim = 0; jDim < nDim; jDim++)
Gradient[jDim] += GetDerivative2(val_coord, iDim, xyz, lmn) *
GetDerivative3(val_coord, iDim, jDim, lmn);
-
+
return Gradient;
-
+
}
void CFreeFormDefBox::GetFFDHessian(su2double *uvw, su2double *xyz, su2double **val_Hessian) {
-
+
unsigned short iDim, jDim, lmn[3];
-
+
/*--- Set the Degree of the spline ---*/
-
+
lmn[0] = lDegree; lmn[1] = mDegree; lmn[2] = nDegree;
-
+
for (iDim = 0; iDim < nDim; iDim++)
for (jDim = 0; jDim < nDim; jDim++)
val_Hessian[iDim][jDim] = 0.0;
-
+
/*--- Note that being all the functions linear combinations of polynomials, they are C^\infty,
and the Hessian will be symmetric; no need to compute the under-diagonal part, for example ---*/
-
+
for (iDim = 0; iDim < nDim; iDim++) {
val_Hessian[0][0] += 2.0 * GetDerivative3(uvw, iDim,0, lmn) * GetDerivative3(uvw, iDim,0, lmn) +
GetDerivative2(uvw, iDim,xyz, lmn) * GetDerivative5(uvw, iDim,0,0, lmn);
-
+
val_Hessian[1][1] += 2.0 * GetDerivative3(uvw, iDim,1, lmn) * GetDerivative3(uvw, iDim,1, lmn) +
GetDerivative2(uvw, iDim,xyz, lmn) * GetDerivative5(uvw, iDim,1,1, lmn);
-
+
val_Hessian[2][2] += 2.0 * GetDerivative3(uvw, iDim,2, lmn) * GetDerivative3(uvw, iDim,2, lmn) +
GetDerivative2(uvw, iDim,xyz, lmn) * GetDerivative5(uvw, iDim,2,2, lmn);
-
+
val_Hessian[0][1] += 2.0 * GetDerivative3(uvw, iDim,0, lmn) * GetDerivative3(uvw, iDim,1, lmn) +
GetDerivative2(uvw, iDim,xyz, lmn) * GetDerivative5(uvw, iDim,0,1, lmn);
-
+
val_Hessian[0][2] += 2.0 * GetDerivative3(uvw, iDim,0, lmn) * GetDerivative3(uvw, iDim,2, lmn) +
GetDerivative2(uvw, iDim,xyz, lmn) * GetDerivative5(uvw, iDim,0,2, lmn);
-
+
val_Hessian[1][2] += 2.0 * GetDerivative3(uvw, iDim,1, lmn) * GetDerivative3(uvw, iDim,2, lmn) +
GetDerivative2(uvw, iDim,xyz, lmn) * GetDerivative5(uvw, iDim,1,2, lmn);
}
-
+
val_Hessian[1][0] = val_Hessian[0][1];
val_Hessian[2][0] = val_Hessian[0][2];
val_Hessian[2][1] = val_Hessian[1][2];
-
+
}
su2double *CFreeFormDefBox::GetParametricCoord_Iterative(unsigned long iPoint, su2double *xyz, su2double *ParamCoordGuess, CConfig *config) {
-
+
su2double *IndepTerm, SOR_Factor = 1.0, MinNormError, NormError, Determinant, AdjHessian[3][3], Temp[3] = {0.0,0.0,0.0};
unsigned short iDim, jDim, RandonCounter;
unsigned long iter;
-
+
su2double tol = config->GetFFD_Tol()*1E-3;
unsigned short it_max = config->GetnFFD_Iter();
unsigned short Random_Trials = 500;
/*--- Allocate the Hessian ---*/
-
+
Hessian = new su2double* [nDim];
IndepTerm = new su2double [nDim];
for (iDim = 0; iDim < nDim; iDim++) {
@@ -8193,23 +8193,23 @@ su2double *CFreeFormDefBox::GetParametricCoord_Iterative(unsigned long iPoint, s
ParamCoord[iDim] = ParamCoordGuess[iDim];
IndepTerm [iDim] = 0.0;
}
-
+
RandonCounter = 0; MinNormError = 1E6;
-
+
/*--- External iteration ---*/
for (iter = 0; iter < (unsigned long)it_max*Random_Trials; iter++) {
-
+
/*--- The independent term of the solution of our system is -Gradient(sol_old) ---*/
Gradient = GetFFDGradient(ParamCoord, xyz);
-
+
for (iDim = 0; iDim < nDim; iDim++) IndepTerm[iDim] = - Gradient[iDim];
/*--- Hessian = The Matrix of our system, getHessian(sol_old,xyz,...) ---*/
-
+
GetFFDHessian(ParamCoord, xyz, Hessian);
-
+
/*--- Adjoint to Hessian ---*/
AdjHessian[0][0] = Hessian[1][1]*Hessian[2][2]-Hessian[1][2]*Hessian[2][1];
@@ -8221,13 +8221,13 @@ su2double *CFreeFormDefBox::GetParametricCoord_Iterative(unsigned long iPoint, s
AdjHessian[2][0] = Hessian[1][0]*Hessian[2][1]-Hessian[1][1]*Hessian[2][0];
AdjHessian[2][1] = Hessian[0][1]*Hessian[2][0]-Hessian[0][0]*Hessian[2][1];
AdjHessian[2][2] = Hessian[0][0]*Hessian[1][1]-Hessian[0][1]*Hessian[1][0];
-
+
/*--- Determinant of Hessian ---*/
-
+
Determinant = Hessian[0][0]*AdjHessian[0][0]+Hessian[0][1]*AdjHessian[1][0]+Hessian[0][2]*AdjHessian[2][0];
-
+
/*--- Hessian inverse ---*/
-
+
if (Determinant != 0) {
for (iDim = 0; iDim < nDim; iDim++) {
Temp[iDim] = 0.0;
@@ -8239,30 +8239,30 @@ su2double *CFreeFormDefBox::GetParametricCoord_Iterative(unsigned long iPoint, s
IndepTerm[iDim] = Temp[iDim];
}
}
-
+
/*--- Update with Successive over-relaxation ---*/
-
+
for (iDim = 0; iDim < nDim; iDim++) {
ParamCoord[iDim] = (1.0-SOR_Factor)*ParamCoord[iDim] + SOR_Factor*(ParamCoord[iDim] + IndepTerm[iDim]);
}
/*--- If the gradient is small, we have converged ---*/
-
+
if ((fabs(IndepTerm[0]) < tol) && (fabs(IndepTerm[1]) < tol) && (fabs(IndepTerm[2]) < tol)) break;
/*--- Compute the norm of the error ---*/
-
+
NormError = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
NormError += IndepTerm[iDim]*IndepTerm[iDim];
NormError = sqrt(NormError);
MinNormError = min(NormError, MinNormError);
-
+
/*--- If we have no convergence with Random_Trials iterations probably we are in a local minima. ---*/
-
+
if (((iter % it_max) == 0) && (iter != 0)) {
-
+
RandonCounter++;
if (RandonCounter == Random_Trials) {
cout << endl << "Unknown point: "<< iPoint <<" (" << xyz[0] <<", "<< xyz[1] <<", "<< xyz[2] <<"). Min Error: "<< MinNormError <<". Iter: "<< iter <<"."<< endl;
@@ -8301,11 +8301,11 @@ su2double *CFreeFormDefBox::GetParametricCoord_Iterative(unsigned long iPoint, s
if (iter == (unsigned long)it_max*Random_Trials) {
cout << "Unknown point: (" << xyz[0] <<", "<< xyz[1] <<", "<< xyz[2] <<"). Increase the value of FFD_ITERATIONS." << endl;
}
-
+
/*--- Real Solution is now ParamCoord; Return it ---*/
return ParamCoord;
-
+
}
bool CFreeFormDefBox::GetPointFFD(CGeometry *geometry, CConfig *config, unsigned long iPoint) {
@@ -8325,40 +8325,40 @@ bool CFreeFormDefBox::GetPointFFD(CGeometry *geometry, CConfig *config, unsigned
{0, 5, 7, 4, 0, 5, 7},
{2, 7, 5, 6, 2, 7, 5}};
unsigned short nDim = geometry->GetnDim();
-
+
for (iDim = 0; iDim < nDim; iDim++)
- Coord[iDim] = geometry->node[iPoint]->GetCoord(iDim);
-
+ Coord[iDim] = geometry->nodes->GetCoord(iPoint, iDim);
+
if (cylindrical) {
-
+
X_0 = config->GetFFD_Axis(0); Y_0 = config->GetFFD_Axis(1); Z_0 = config->GetFFD_Axis(2);
-
+
Xbar = Coord[0] - X_0; Ybar = Coord[1] - Y_0; Zbar = Coord[2] - Z_0;
-
+
Coord[0] = sqrt(Ybar*Ybar + Zbar*Zbar);
Coord[1] = atan2(Zbar, Ybar); if (Coord[1] > PI_NUMBER/2.0) Coord[1] -= 2.0*PI_NUMBER;
Coord[2] = Xbar;
-
+
}
-
+
else if (spherical || polar) {
-
+
X_0 = config->GetFFD_Axis(0); Y_0 = config->GetFFD_Axis(1); Z_0 = config->GetFFD_Axis(2);
-
+
Xbar = Coord[0] - X_0; Ybar = Coord[1] - Y_0; Zbar = Coord[2] - Z_0;
-
+
Coord[0] = sqrt(Xbar*Xbar + Ybar*Ybar + Zbar*Zbar);
Coord[1] = atan2(Zbar, Ybar); if (Coord[1] > PI_NUMBER/2.0) Coord[1] -= 2.0*PI_NUMBER;
Coord[2] = acos(Xbar/Coord[0]);
-
+
}
-
+
/*--- 1st tetrahedron {V0, V1, V2, V5}
2nd tetrahedron {V0, V2, V7, V5}
3th tetrahedron {V0, V2, V3, V7}
4th tetrahedron {V0, V5, V7, V4}
5th tetrahedron {V2, V7, V5, V6} ---*/
-
+
for (iVar = 0; iVar < 5; iVar++) {
Inside = true;
for (jVar = 0; jVar < 4; jVar++) {
@@ -8366,18 +8366,18 @@ bool CFreeFormDefBox::GetPointFFD(CGeometry *geometry, CConfig *config, unsigned
Coord_Corner_Points[Index[iVar][jVar+1]],
Coord_Corner_Points[Index[iVar][jVar+2]],
Coord_Corner_Points[Index[iVar][jVar+3]]);
-
+
su2double Distance_Vertex = geometry->Point2Plane_Distance(Coord_Corner_Points[Index[iVar][jVar]],
Coord_Corner_Points[Index[iVar][jVar+1]],
Coord_Corner_Points[Index[iVar][jVar+2]],
Coord_Corner_Points[Index[iVar][jVar+3]]);
- if (Distance_Point*Distance_Vertex < 0.0) Inside = false;
+ if (Distance_Point*Distance_Vertex < 0.0) Inside = false;
}
if (Inside) break;
}
-
+
return Inside;
-
+
}
void CFreeFormDefBox::SetDeformationZone(CGeometry *geometry, CConfig *config, unsigned short iFFDBox) {
@@ -8385,99 +8385,95 @@ void CFreeFormDefBox::SetDeformationZone(CGeometry *geometry, CConfig *config, u
unsigned short iMarker, iVar, jVar;
unsigned long iVertex, iPoint;
bool Inside = false;
-
+
unsigned short Index[5][7] = {
{0, 1, 2, 5, 0, 1, 2},
{0, 2, 7, 5, 0, 2, 7},
{0, 2, 3, 7, 0, 2, 3},
{0, 5, 7, 4, 0, 5, 7},
{2, 7, 5, 6, 2, 7, 5}};
-
- for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++)
- if (config->GetMarker_All_DV(iMarker) == YES)
- for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
+
+ for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
+ if (config->GetMarker_All_DV(iMarker) == YES) {
+ for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- geometry->node[iPoint]->SetMove(false);
-
- Coord = geometry->node[iPoint]->GetCoord();
-
+
+ Coord = geometry->nodes->GetCoord(iPoint);
+
/*--- 1st tetrahedron {V0, V1, V2, V5}
2nd tetrahedron {V0, V2, V7, V5}
3th tetrahedron {V0, V2, V3, V7}
4th tetrahedron {V0, V5, V7, V4}
5th tetrahedron {V2, V7, V5, V6} ---*/
-
+
for (iVar = 0; iVar < 5; iVar++) {
Inside = true;
for (jVar = 0; jVar < 4; jVar++) {
- su2double Distance_Point = geometry->Point2Plane_Distance(Coord,
- Coord_Corner_Points[Index[iVar][jVar+1]],
- Coord_Corner_Points[Index[iVar][jVar+2]],
- Coord_Corner_Points[Index[iVar][jVar+3]]);
- su2double Distance_Vertex = geometry->Point2Plane_Distance(Coord_Corner_Points[Index[iVar][jVar]],
- Coord_Corner_Points[Index[iVar][jVar+1]],
- Coord_Corner_Points[Index[iVar][jVar+2]],
+ su2double Distance_Point = geometry->Point2Plane_Distance(Coord,
+ Coord_Corner_Points[Index[iVar][jVar+1]],
+ Coord_Corner_Points[Index[iVar][jVar+2]],
+ Coord_Corner_Points[Index[iVar][jVar+3]]);
+ su2double Distance_Vertex = geometry->Point2Plane_Distance(Coord_Corner_Points[Index[iVar][jVar]],
+ Coord_Corner_Points[Index[iVar][jVar+1]],
+ Coord_Corner_Points[Index[iVar][jVar+2]],
Coord_Corner_Points[Index[iVar][jVar+3]]);
- if (Distance_Point*Distance_Vertex < 0.0) Inside = false;
+ if (Distance_Point*Distance_Vertex < 0.0) Inside = false;
}
if (Inside) break;
}
-
- if (Inside) {
- geometry->node[iPoint]->SetMove(true);
- }
-
}
+ }
+ }
}
su2double CFreeFormDefBox::GetDerivative1(su2double *uvw, unsigned short val_diff, unsigned short *ijk, unsigned short *lmn) {
-
+
unsigned short iDim;
su2double value = 0.0;
-
+
value = BlendingFunction[val_diff]->GetDerivative(ijk[val_diff], uvw[val_diff], 1);
for (iDim = 0; iDim < nDim; iDim++)
if (iDim != val_diff)
value *= BlendingFunction[iDim]->GetBasis(ijk[iDim], uvw[iDim]);
-
+
return value;
-
+
}
su2double CFreeFormDefBox::GetDerivative2 (su2double *uvw, unsigned short dim, su2double *xyz, unsigned short *lmn) {
-
+
unsigned short iDegree, jDegree, kDegree;
su2double value = 0.0;
-
+
for (iDegree = 0; iDegree <= lmn[0]; iDegree++)
for (jDegree = 0; jDegree <= lmn[1]; jDegree++)
for (kDegree = 0; kDegree <= lmn[2]; kDegree++) {
- value += Coord_Control_Points[iDegree][jDegree][kDegree][dim]
+ value += Coord_Control_Points[iDegree][jDegree][kDegree][dim]
* BlendingFunction[0]->GetBasis(iDegree, uvw[0])
* BlendingFunction[1]->GetBasis(jDegree, uvw[1])
* BlendingFunction[2]->GetBasis(kDegree, uvw[2]);
}
-
+
return 2.0*(value - xyz[dim]);
}
su2double CFreeFormDefBox::GetDerivative3(su2double *uvw, unsigned short dim, unsigned short diff_this, unsigned short *lmn) {
-
+
unsigned short iDegree, jDegree, kDegree, iDim;
su2double value = 0;
-
+
unsigned short *ijk = new unsigned short[nDim];
-
+
for (iDim = 0; iDim < nDim; iDim++) ijk[iDim] = 0;
for (iDegree = 0; iDegree <= lmn[0]; iDegree++)
for (jDegree = 0; jDegree <= lmn[1]; jDegree++)
for (kDegree = 0; kDegree <= lmn[2]; kDegree++) {
ijk[0] = iDegree; ijk[1] = jDegree; ijk[2] = kDegree;
- value += Coord_Control_Points[iDegree][jDegree][kDegree][dim] *
+ value += Coord_Control_Points[iDegree][jDegree][kDegree][dim] *
GetDerivative1(uvw, diff_this, ijk, lmn);
}
-
+
delete [] ijk;
return value;
@@ -8487,7 +8483,7 @@ su2double CFreeFormDefBox::GetDerivative4(su2double *uvw, unsigned short val_dif
unsigned short *ijk, unsigned short *lmn) {
unsigned short iDim;
su2double value = 0.0;
-
+
if (val_diff == val_diff2) {
value = BlendingFunction[val_diff]->GetDerivative(ijk[val_diff], uvw[val_diff], 2);
for (iDim = 0; iDim < nDim; iDim++)
@@ -8501,20 +8497,20 @@ su2double CFreeFormDefBox::GetDerivative4(su2double *uvw, unsigned short val_dif
if ((iDim != val_diff) && (iDim != val_diff2))
value *= BlendingFunction[iDim]->GetBasis(ijk[iDim], uvw[iDim]);
}
-
+
return value;
}
-su2double CFreeFormDefBox::GetDerivative5(su2double *uvw, unsigned short dim, unsigned short diff_this, unsigned short diff_this_also,
+su2double CFreeFormDefBox::GetDerivative5(su2double *uvw, unsigned short dim, unsigned short diff_this, unsigned short diff_this_also,
unsigned short *lmn) {
-
+
unsigned short iDegree, jDegree, kDegree, iDim;
su2double value = 0.0;
-
+
unsigned short *ijk = new unsigned short[nDim];
-
+
for (iDim = 0; iDim < nDim; iDim++) ijk[iDim] = 0;
-
+
for (iDegree = 0; iDegree <= lmn[0]; iDegree++)
for (jDegree = 0; jDegree <= lmn[1]; jDegree++)
for (kDegree = 0; kDegree <= lmn[2]; kDegree++) {
@@ -8522,9 +8518,9 @@ su2double CFreeFormDefBox::GetDerivative5(su2double *uvw, unsigned short dim, un
value += Coord_Control_Points[iDegree][jDegree][kDegree][dim] *
GetDerivative4(uvw, diff_this, diff_this_also, ijk, lmn);
}
-
+
delete [] ijk;
-
+
return value;
}
diff --git a/Common/src/interface_interpolation/CInterpolator.cpp b/Common/src/interface_interpolation/CInterpolator.cpp
index 118ea1287d6d..1d8a84b3c467 100644
--- a/Common/src/interface_interpolation/CInterpolator.cpp
+++ b/Common/src/interface_interpolation/CInterpolator.cpp
@@ -68,7 +68,7 @@ void CInterpolator::Determine_ArraySize(int markDonor, int markTarget,
auto nLocalVertex_Donor = 0ul;
for (auto iVertex = 0ul; iVertex < nVertexDonor; iVertex++) {
auto iPointDonor = donor_geometry->vertex[markDonor][iVertex]->GetNode();
- nLocalVertex_Donor += donor_geometry->node[iPointDonor]->GetDomain();
+ nLocalVertex_Donor += donor_geometry->nodes->GetDomain(iPointDonor);
}
Buffer_Send_nVertex_Donor[0] = nLocalVertex_Donor;
@@ -94,10 +94,10 @@ void CInterpolator::Collect_VertexInfo(int markDonor, int markTarget,
for (iVertex = 0; iVertex < nVertexDonor; iVertex++) {
auto iPointDonor = donor_geometry->vertex[markDonor][iVertex]->GetNode();
- if (donor_geometry->node[iPointDonor]->GetDomain()) {
- Buffer_Send_GlobalPoint[iLocalVertexDonor] = donor_geometry->node[iPointDonor]->GetGlobalIndex();
+ if (donor_geometry->nodes->GetDomain(iPointDonor)) {
+ Buffer_Send_GlobalPoint[iLocalVertexDonor] = donor_geometry->nodes->GetGlobalIndex(iPointDonor);
for (iDim = 0; iDim < nDim; iDim++)
- Buffer_Send_Coord[iLocalVertexDonor*nDim+iDim] = donor_geometry->node[iPointDonor]->GetCoord(iDim);
+ Buffer_Send_Coord[iLocalVertexDonor*nDim+iDim] = donor_geometry->nodes->GetCoord(iPointDonor, iDim);
iLocalVertexDonor++;
}
}
@@ -138,7 +138,7 @@ unsigned long CInterpolator::Collect_ElementInfo(int markDonor, unsigned short n
for (auto iNode = 0u; iNode < nNode; ++iNode) {
auto iPoint = donor_geometry->bound[markDonor][iElem]->GetNode(iNode);
- auto iPointGlobal = donor_geometry->node[iPoint]->GetGlobalIndex();
+ auto iPointGlobal = donor_geometry->nodes->GetGlobalIndex(iPoint);
bufferSendIdx(iElem, iNode) = iPointGlobal;
}
}
@@ -210,24 +210,24 @@ void CInterpolator::ReconstructBoundary(unsigned long val_zone, int val_marker){
iPoint = geom->vertex[val_marker][iVertex]->GetNode();
- if (geom->node[iPoint]->GetDomain()) {
- Buffer_Send_GlobalPoint[nLocalVertex] = geom->node[iPoint]->GetGlobalIndex();
+ if (geom->nodes->GetDomain(iPoint)) {
+ Buffer_Send_GlobalPoint[nLocalVertex] = geom->nodes->GetGlobalIndex(iPoint);
for (iDim = 0; iDim < nDim; iDim++)
- Buffer_Send_Coord[nLocalVertex*nDim+iDim] = geom->node[iPoint]->GetCoord(iDim);
+ Buffer_Send_Coord[nLocalVertex*nDim+iDim] = geom->nodes->GetCoord(iPoint, iDim);
nNodes = 0;
- nEdges = geom->node[iPoint]->GetnPoint();
+ nEdges = geom->nodes->GetnPoint(iPoint);
for (jEdge = 0; jEdge < nEdges; jEdge++){
- EdgeIndex = geom->node[iPoint]->GetEdge(jEdge);
+ EdgeIndex = geom->nodes->GetEdge(iPoint, jEdge);
if( iPoint == geom->edges->GetNode(EdgeIndex,0) )
dPoint = geom->edges->GetNode(EdgeIndex,1);
else
dPoint = geom->edges->GetNode(EdgeIndex,0);
- if ( geom->node[dPoint]->GetVertex(val_marker) != -1 )
+ if ( geom->nodes->GetVertex(dPoint, val_marker) != -1 )
nNodes++;
}
@@ -240,15 +240,15 @@ void CInterpolator::ReconstructBoundary(unsigned long val_zone, int val_marker){
nNodes = 0;
for (jEdge = 0; jEdge < nEdges; jEdge++){
- EdgeIndex = geom->node[iPoint]->GetEdge(jEdge);
+ EdgeIndex = geom->nodes->GetEdge(iPoint, jEdge);
if( iPoint == geom->edges->GetNode(EdgeIndex,0) )
dPoint = geom->edges->GetNode(EdgeIndex,1);
else
dPoint = geom->edges->GetNode(EdgeIndex,0);
- if ( geom->node[dPoint]->GetVertex(val_marker) != -1 ){
- Aux_Send_Map[nLocalVertex][nNodes] = geom->node[dPoint]->GetGlobalIndex();
+ if ( geom->nodes->GetVertex(dPoint, val_marker) != -1 ){
+ Aux_Send_Map[nLocalVertex][nNodes] = geom->nodes->GetGlobalIndex(dPoint);
nNodes++;
}
}
diff --git a/Common/src/interface_interpolation/CIsoparametric.cpp b/Common/src/interface_interpolation/CIsoparametric.cpp
index aa67767997ca..dab9eb349b87 100644
--- a/Common/src/interface_interpolation/CIsoparametric.cpp
+++ b/Common/src/interface_interpolation/CIsoparametric.cpp
@@ -176,11 +176,11 @@ void CIsoparametric::SetTransferCoeff(const CConfig* const* config) {
auto target_vertex = target_geometry->vertex[markTarget][iVertexTarget];
const auto iPoint = target_vertex->GetNode();
- if (!target_geometry->node[iPoint]->GetDomain()) continue;
+ if (!target_geometry->nodes->GetDomain(iPoint)) continue;
totalCount += 1;
/*--- Coordinates of the target point. ---*/
- const su2double* coord_i = target_geometry->node[iPoint]->GetCoord();
+ const su2double* coord_i = target_geometry->nodes->GetCoord(iPoint);
/*--- Find the closest donor vertex. ---*/
su2double minDist = 1e9;
diff --git a/Common/src/interface_interpolation/CMirror.cpp b/Common/src/interface_interpolation/CMirror.cpp
index f236ba5c6b5c..58d9058510a6 100644
--- a/Common/src/interface_interpolation/CMirror.cpp
+++ b/Common/src/interface_interpolation/CMirror.cpp
@@ -80,7 +80,7 @@ void CMirror::SetTransferCoeff(const CConfig* const* config) {
auto donor_vertex = donor_geometry->vertex[markDonor][iVertex];
- if (donor_geometry->node[donor_vertex->GetNode()]->GetDomain()) {
+ if (donor_geometry->nodes->GetDomain(donor_vertex->GetNode())) {
nNodeDonorLocal += donor_vertex->GetnDonorPoints();
nVertexDonorLocal++;
}
@@ -104,10 +104,10 @@ void CMirror::SetTransferCoeff(const CConfig* const* config) {
auto donor_vertex = donor_geometry->vertex[markDonor][iVertex];
const auto iPoint = donor_vertex->GetNode();
- if (!donor_geometry->node[iPoint]->GetDomain()) continue;
+ if (!donor_geometry->nodes->GetDomain(iPoint)) continue;
const auto nDonor = donor_vertex->GetnDonorPoints();
- const auto donorGlobalIndex = donor_geometry->node[iPoint]->GetGlobalIndex();
+ const auto donorGlobalIndex = donor_geometry->nodes->GetGlobalIndex(iPoint);
for (auto i = 0u; i < nDonor; ++i) {
sendGlobalIndex[iDonor] = donorGlobalIndex;
@@ -191,10 +191,10 @@ void CMirror::SetTransferCoeff(const CConfig* const* config) {
auto target_vertex = target_geometry->vertex[markTarget][iVertex];
const auto iPoint = target_vertex->GetNode();
- if (!target_geometry->node[iPoint]->GetDomain()) continue;
+ if (!target_geometry->nodes->GetDomain(iPoint)) continue;
/*--- Any point of the donor geometry, that has this target point as a donor, becomes a donor. ---*/
- const long targetGlobalIndex = target_geometry->node[iPoint]->GetGlobalIndex();
+ const long targetGlobalIndex = target_geometry->nodes->GetGlobalIndex(iPoint);
/*--- Count donors and safe the binary search results (this is why we sorted the matrix). ---*/
auto nDonor = 0ul;
diff --git a/Common/src/interface_interpolation/CNearestNeighbor.cpp b/Common/src/interface_interpolation/CNearestNeighbor.cpp
index 7673c93bccd8..ab0f73ca0988 100644
--- a/Common/src/interface_interpolation/CNearestNeighbor.cpp
+++ b/Common/src/interface_interpolation/CNearestNeighbor.cpp
@@ -116,10 +116,10 @@ void CNearestNeighbor::SetTransferCoeff(const CConfig* const* config) {
auto target_vertex = target_geometry->vertex[markTarget][iVertexTarget];
const auto Point_Target = target_vertex->GetNode();
- if (!target_geometry->node[Point_Target]->GetDomain()) continue;
+ if (!target_geometry->nodes->GetDomain(Point_Target)) continue;
/*--- Coordinates of the target point. ---*/
- const su2double* Coord_i = target_geometry->node[Point_Target]->GetCoord();
+ const su2double* Coord_i = target_geometry->nodes->GetCoord(Point_Target);
/*--- Compute all distances. ---*/
for (int iProcessor = 0, iDonor = 0; iProcessor < nProcessor; ++iProcessor) {
diff --git a/Common/src/interface_interpolation/CRadialBasisFunction.cpp b/Common/src/interface_interpolation/CRadialBasisFunction.cpp
index 6c8f357e1be4..d7694c7d1435 100644
--- a/Common/src/interface_interpolation/CRadialBasisFunction.cpp
+++ b/Common/src/interface_interpolation/CRadialBasisFunction.cpp
@@ -284,9 +284,9 @@ void CRadialBasisFunction::SetTransferCoeff(const CConfig* const* config) {
auto targetVertex = target_geometry->vertex[markTarget][iVertexTarget];
auto pointTarget = targetVertex->GetNode();
- if (target_geometry->node[pointTarget]->GetDomain()) {
+ if (target_geometry->nodes->GetDomain(pointTarget)) {
targetVertices.push_back(targetVertex);
- targetCoord.push_back(target_geometry->node[pointTarget]->GetCoord());
+ targetCoord.push_back(target_geometry->nodes->GetCoord(pointTarget));
}
}
nVertexTarget = targetVertices.size();
diff --git a/Common/src/interface_interpolation/CSlidingMesh.cpp b/Common/src/interface_interpolation/CSlidingMesh.cpp
index c18ad0bb9cae..a56daac0939e 100644
--- a/Common/src/interface_interpolation/CSlidingMesh.cpp
+++ b/Common/src/interface_interpolation/CSlidingMesh.cpp
@@ -191,9 +191,9 @@ void CSlidingMesh::SetTransferCoeff(const CConfig* const* config) {
target_iPoint = target_geometry->vertex[markTarget][iVertex]->GetNode();
- if (target_geometry->node[target_iPoint]->GetDomain()){
+ if (target_geometry->nodes->GetDomain(target_iPoint)){
- Coord_i = target_geometry->node[target_iPoint]->GetCoord();
+ Coord_i = target_geometry->nodes->GetCoord(target_iPoint);
/*--- Brute force to find the closest donor_node ---*/
@@ -222,7 +222,7 @@ void CSlidingMesh::SetTransferCoeff(const CConfig* const* config) {
/*--- Contruct information regarding the target cell ---*/
- long dPoint = target_geometry->node[target_iPoint]->GetGlobalIndex();
+ long dPoint = target_geometry->nodes->GetGlobalIndex(target_iPoint);
for (jVertexTarget = 0; jVertexTarget < nGlobalVertex_Target; jVertexTarget++)
if( dPoint == Target_GlobalPoint[jVertexTarget] )
break;
@@ -239,9 +239,9 @@ void CSlidingMesh::SetTransferCoeff(const CConfig* const* config) {
dTMP = 0;
for(iDim = 0; iDim < nDim; iDim++){
target_iMidEdge_point[iDim] = ( TargetPoint_Coord[ nDim * target_segment[0] + iDim ] +
- target_geometry->node[ target_iPoint ]->GetCoord(iDim) ) / 2;
+ target_geometry->nodes->GetCoord( target_iPoint , iDim) ) / 2;
target_jMidEdge_point[iDim] = ( TargetPoint_Coord[ nDim * target_segment[1] + iDim ] +
- target_geometry->node[ target_iPoint ]->GetCoord(iDim) ) / 2;
+ target_geometry->nodes->GetCoord( target_iPoint , iDim) ) / 2;
Direction[iDim] = target_jMidEdge_point[iDim] - target_iMidEdge_point[iDim];
dTMP += Direction[iDim] * Direction[iDim];
@@ -442,9 +442,9 @@ void CSlidingMesh::SetTransferCoeff(const CConfig* const* config) {
target_iPoint = target_geometry->vertex[markTarget][iVertex]->GetNode();
- if (!target_geometry->node[target_iPoint]->GetDomain()) continue;
+ if (!target_geometry->nodes->GetDomain(target_iPoint)) continue;
- Coord_i = target_geometry->node[target_iPoint]->GetCoord();
+ Coord_i = target_geometry->nodes->GetCoord(target_iPoint);
target_geometry->vertex[markTarget][iVertex]->GetNormal(Normal);
@@ -458,9 +458,9 @@ void CSlidingMesh::SetTransferCoeff(const CConfig* const* config) {
Normal[iDim] /= Area;
for (iDim = 0; iDim < nDim; iDim++)
- Coord_i[iDim] = target_geometry->node[target_iPoint]->GetCoord(iDim);
+ Coord_i[iDim] = target_geometry->nodes->GetCoord(target_iPoint, iDim);
- long dPoint = target_geometry->node[target_iPoint]->GetGlobalIndex();
+ long dPoint = target_geometry->nodes->GetGlobalIndex(target_iPoint);
for (target_iPoint = 0; target_iPoint < nGlobalVertex_Target; target_iPoint++){
if( dPoint == Target_GlobalPoint[target_iPoint] )
break;
diff --git a/Common/src/linear_algebra/CSysMatrix.cpp b/Common/src/linear_algebra/CSysMatrix.cpp
index 07b241b7e04c..3d0f661a2012 100644
--- a/Common/src/linear_algebra/CSysMatrix.cpp
+++ b/Common/src/linear_algebra/CSysMatrix.cpp
@@ -1046,15 +1046,15 @@ unsigned long CSysMatrix::BuildLineletPreconditioner(CGeometry *geom
iPoint = LineletPoint[iLinelet][index_Point];
max_weight = 0.0;
- for (iNode = 0; iNode < geometry->node[iPoint]->GetnPoint(); iNode++) {
- jPoint = geometry->node[iPoint]->GetPoint(iNode);
- if ((check_Point[jPoint]) && geometry->node[jPoint]->GetDomain()) {
+ for (iNode = 0; iNode < geometry->nodes->GetnPoint(iPoint); iNode++) {
+ jPoint = geometry->nodes->GetPoint(iPoint, iNode);
+ if ((check_Point[jPoint]) && geometry->nodes->GetDomain(jPoint)) {
iEdge = geometry->FindEdge(iPoint, jPoint);
normal = geometry->edges->GetNormal(iEdge);
if (geometry->GetnDim() == 3) area = sqrt(normal[0]*normal[0]+normal[1]*normal[1]+normal[2]*normal[2]);
else area = sqrt(normal[0]*normal[0]+normal[1]*normal[1]);
- volume_iPoint = geometry->node[iPoint]->GetVolume();
- volume_jPoint = geometry->node[jPoint]->GetVolume();
+ volume_iPoint = geometry->nodes->GetVolume(iPoint);
+ volume_jPoint = geometry->nodes->GetVolume(jPoint);
weight = 0.5*area*((1.0/volume_iPoint)+(1.0/volume_jPoint));
max_weight = max(max_weight, weight);
}
@@ -1064,17 +1064,17 @@ unsigned long CSysMatrix::BuildLineletPreconditioner(CGeometry *geom
add_point = false;
counter = 0;
- next_Point = geometry->node[iPoint]->GetPoint(0);
- for (iNode = 0; iNode < geometry->node[iPoint]->GetnPoint(); iNode++) {
- jPoint = geometry->node[iPoint]->GetPoint(iNode);
+ next_Point = geometry->nodes->GetPoint(iPoint, 0);
+ for (iNode = 0; iNode < geometry->nodes->GetnPoint(iPoint); iNode++) {
+ jPoint = geometry->nodes->GetPoint(iPoint, iNode);
iEdge = geometry->FindEdge(iPoint, jPoint);
normal = geometry->edges->GetNormal(iEdge);
if (geometry->GetnDim() == 3) area = sqrt(normal[0]*normal[0]+normal[1]*normal[1]+normal[2]*normal[2]);
else area = sqrt(normal[0]*normal[0]+normal[1]*normal[1]);
- volume_iPoint = geometry->node[iPoint]->GetVolume();
- volume_jPoint = geometry->node[jPoint]->GetVolume();
+ volume_iPoint = geometry->nodes->GetVolume(iPoint);
+ volume_jPoint = geometry->nodes->GetVolume(jPoint);
weight = 0.5*area*((1.0/volume_iPoint)+(1.0/volume_jPoint));
- if (((check_Point[jPoint]) && (weight/max_weight > alpha) && (geometry->node[jPoint]->GetDomain())) &&
+ if (((check_Point[jPoint]) && (weight/max_weight > alpha) && (geometry->nodes->GetDomain(jPoint))) &&
((index_Point == 0) || ((index_Point > 0) && (jPoint != LineletPoint[iLinelet][index_Point-1])))) {
add_point = true;
next_Point = jPoint;
diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp
index c639b62b190a..fc5751f1fd67 100644
--- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp
+++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp
@@ -74,11 +74,11 @@ void computeGradientsGreenGauss(CSolver* solver,
SU2_OMP_FOR_DYN(chunkSize)
for (size_t iPoint = 0; iPoint < nPointDomain; ++iPoint)
{
- auto node = geometry.node[iPoint];
+ auto nodes = geometry.nodes;
AD::StartPreacc();
- AD::SetPreaccIn(node->GetVolume());
- AD::SetPreaccIn(node->GetPeriodicVolume());
+ AD::SetPreaccIn(nodes->GetVolume(iPoint));
+ AD::SetPreaccIn(nodes->GetPeriodicVolume(iPoint));
for (size_t iVar = varBegin; iVar < varEnd; ++iVar)
AD::SetPreaccIn(field(iPoint,iVar));
@@ -91,14 +91,14 @@ void computeGradientsGreenGauss(CSolver* solver,
/*--- Handle averaging and division by volume in one constant. ---*/
- su2double halfOnVol = 0.5 / (node->GetVolume()+node->GetPeriodicVolume());
+ su2double halfOnVol = 0.5 / (nodes->GetVolume(iPoint)+nodes->GetPeriodicVolume(iPoint));
/*--- Add a contribution due to each neighbor. ---*/
- for (size_t iNeigh = 0; iNeigh < node->GetnPoint(); ++iNeigh)
+ for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh)
{
- size_t iEdge = node->GetEdge(iNeigh);
- size_t jPoint = node->GetPoint(iNeigh);
+ size_t iEdge = nodes->GetEdge(iPoint,iNeigh);
+ size_t jPoint = nodes->GetPoint(iPoint,iNeigh);
/*--- Determine if edge points inwards or outwards of iPoint.
* If inwards we need to flip the area vector. ---*/
@@ -142,13 +142,13 @@ void computeGradientsGreenGauss(CSolver* solver,
for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex)
{
size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode();
- auto node = geometry.node[iPoint];
+ auto nodes = geometry.nodes;
/*--- Halo points do not need to be considered. ---*/
- if (!node->GetDomain()) continue;
+ if (!nodes->GetDomain(iPoint)) continue;
- su2double volume = node->GetVolume() + node->GetPeriodicVolume();
+ su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint);
const su2double* area = geometry.vertex[iMarker][iVertex]->GetNormal();
diff --git a/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp b/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp
index 3d86a6fead72..f5ab0e279b06 100644
--- a/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp
+++ b/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp
@@ -75,8 +75,8 @@ void computeGradientsLeastSquares(CSolver* solver,
SU2_OMP_FOR_DYN(chunkSize)
for (size_t iPoint = 0; iPoint < nPointDomain; ++iPoint)
{
- auto node = geometry.node[iPoint];
- const su2double* coord_i = node->GetCoord();
+ auto nodes = geometry.nodes;
+ const su2double* coord_i = nodes->GetCoord(iPoint);
AD::StartPreacc();
AD::SetPreaccIn(coord_i, nDim);
@@ -95,11 +95,11 @@ void computeGradientsLeastSquares(CSolver* solver,
Rmatrix(iPoint, iDim, jDim) = 0.0;
- for (size_t iNeigh = 0; iNeigh < node->GetnPoint(); ++iNeigh)
+ for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh)
{
- size_t jPoint = node->GetPoint(iNeigh);
+ size_t jPoint = nodes->GetPoint(iPoint,iNeigh);
- const su2double* coord_j = geometry.node[jPoint]->GetCoord();
+ const su2double* coord_j = geometry.nodes->GetCoord(jPoint);
AD::SetPreaccIn(coord_j, nDim);
/*--- Distance vector from iPoint to jPoint ---*/
diff --git a/SU2_CFD/include/limiters/CLimiterDetails.hpp b/SU2_CFD/include/limiters/CLimiterDetails.hpp
index 07cb1768720a..3adad44b3e36 100644
--- a/SU2_CFD/include/limiters/CLimiterDetails.hpp
+++ b/SU2_CFD/include/limiters/CLimiterDetails.hpp
@@ -272,8 +272,8 @@ struct CLimiterDetails
*/
inline su2double geometricFactor(size_t iPoint, CGeometry& geometry) const
{
- AD::SetPreaccIn(geometry.node[iPoint]->GetSharpEdge_Distance());
- su2double dist = geometry.node[iPoint]->GetSharpEdge_Distance()/(sharpCoeff*eps1)-1.0;
+ AD::SetPreaccIn(geometry.nodes->GetSharpEdge_Distance(iPoint));
+ su2double dist = geometry.nodes->GetSharpEdge_Distance(iPoint)/(sharpCoeff*eps1)-1.0;
return LimiterHelpers::raisedSine(dist);
}
@@ -313,8 +313,8 @@ struct CLimiterDetails
*/
inline su2double geometricFactor(size_t iPoint, CGeometry& geometry) const
{
- AD::SetPreaccIn(geometry.node[iPoint]->GetWall_Distance());
- su2double dist = geometry.node[iPoint]->GetWall_Distance()/(sharpCoeff*eps1)-1.0;
+ AD::SetPreaccIn(geometry.nodes->GetWall_Distance(iPoint));
+ su2double dist = geometry.nodes->GetWall_Distance(iPoint)/(sharpCoeff*eps1)-1.0;
return LimiterHelpers::raisedSine(dist);
}
diff --git a/SU2_CFD/include/limiters/computeLimiters_impl.hpp b/SU2_CFD/include/limiters/computeLimiters_impl.hpp
index a98e21c2ef3b..77df3484e5bd 100644
--- a/SU2_CFD/include/limiters/computeLimiters_impl.hpp
+++ b/SU2_CFD/include/limiters/computeLimiters_impl.hpp
@@ -136,8 +136,8 @@ void computeLimiters_impl(CSolver* solver,
SU2_OMP_FOR_DYN(chunkSize)
for (size_t iPoint = 0; iPoint < nPointDomain; ++iPoint)
{
- auto node = geometry.node[iPoint];
- const su2double* coord_i = node->GetCoord();
+ auto nodes = geometry.nodes;
+ const su2double* coord_i = nodes->GetCoord(iPoint);
AD::StartPreacc();
AD::SetPreaccIn(coord_i, nDim);
@@ -170,11 +170,11 @@ void computeLimiters_impl(CSolver* solver,
/*--- Compute max/min projection and values over direct neighbors. ---*/
- for(size_t iNeigh = 0; iNeigh < node->GetnPoint(); ++iNeigh)
+ for(size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh)
{
- size_t jPoint = node->GetPoint(iNeigh);
+ size_t jPoint = nodes->GetPoint(iPoint,iNeigh);
- const su2double* coord_j = geometry.node[jPoint]->GetCoord();
+ const su2double* coord_j = geometry.nodes->GetCoord(jPoint);
AD::SetPreaccIn(coord_j, nDim);
/*--- Distance vector from iPoint to face (middle of the edge). ---*/
diff --git a/SU2_CFD/include/solvers/CFEASolver.hpp b/SU2_CFD/include/solvers/CFEASolver.hpp
index 06aa91c62cf4..4ff23ae3e4d0 100644
--- a/SU2_CFD/include/solvers/CFEASolver.hpp
+++ b/SU2_CFD/include/solvers/CFEASolver.hpp
@@ -267,7 +267,7 @@ class CFEASolver : public CSolver {
inline virtual su2double Get_ValCoord(const CGeometry *geometry,
unsigned long indexNode,
unsigned short iDim) const {
- return geometry->node[indexNode]->GetCoord(iDim);
+ return geometry->nodes->GetCoord(indexNode, iDim);
}
/*!
diff --git a/SU2_CFD/include/variables/CAdjEulerVariable.hpp b/SU2_CFD/include/variables/CAdjEulerVariable.hpp
index 3c42c42a709d..916485e30765 100644
--- a/SU2_CFD/include/variables/CAdjEulerVariable.hpp
+++ b/SU2_CFD/include/variables/CAdjEulerVariable.hpp
@@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
- * The SU2 Project is maintained by the SU2 Foundation
+ * The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md)
@@ -43,8 +43,8 @@ class CAdjEulerVariable : public CVariable {
MatrixType IntBoundary_Jump; /*!< \brief Interior boundary jump vector. */
MatrixType HB_Source; /*!< \brief Harmonic balance source term. */
- VectorOfMatrix& Gradient_Reconstruction; /*!< \brief Reference to the gradient of the primitive variables for MUSCL reconstruction for the convective term */
- VectorOfMatrix Gradient_Aux; /*!< \brief Auxiliary structure to store a second gradient for reconstruction, if required. */
+ CVectorOfMatrix& Gradient_Reconstruction; /*!< \brief Reference to the gradient of the primitive variables for MUSCL reconstruction for the convective term */
+ CVectorOfMatrix Gradient_Aux; /*!< \brief Auxiliary structure to store a second gradient for reconstruction, if required. */
public:
/*!
@@ -171,6 +171,6 @@ class CAdjEulerVariable : public CVariable {
* \brief Get the reconstruction gradient for variables at all points.
* \return Reference to reconstruction gradient.
*/
- inline VectorOfMatrix& GetGradient_Reconstruction(void) final { return Gradient_Reconstruction; }
+ inline CVectorOfMatrix& GetGradient_Reconstruction(void) final { return Gradient_Reconstruction; }
};
diff --git a/SU2_CFD/include/variables/CAdjTurbVariable.hpp b/SU2_CFD/include/variables/CAdjTurbVariable.hpp
index a2a4735d83f1..010dcd28957b 100644
--- a/SU2_CFD/include/variables/CAdjTurbVariable.hpp
+++ b/SU2_CFD/include/variables/CAdjTurbVariable.hpp
@@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
- * The SU2 Project is maintained by the SU2 Foundation
+ * The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md)
@@ -39,8 +39,8 @@ class CAdjTurbVariable final : public CVariable {
protected:
// ToDo: These variables were not being allocated... is this class used?
MatrixType dmuT_dUTvar; /*!< \brief Sensitivity of eddy viscosity to mean flow and turbulence vars. */
- VectorOfMatrix dRTstar_dUTvar; /*!< \brief Sensitivity of modified turbulence residual (no boundary flux) to mean flow and turbulence vars. */
- VectorOfMatrix dFT_dUTvar; /*!< \brief Sensitivity of boundary flux to mean flow and turbulence vars. */
+ CVectorOfMatrix dRTstar_dUTvar; /*!< \brief Sensitivity of modified turbulence residual (no boundary flux) to mean flow and turbulence vars. */
+ CVectorOfMatrix dFT_dUTvar; /*!< \brief Sensitivity of boundary flux to mean flow and turbulence vars. */
MatrixType EddyViscSens; /*!< \brief Eddy Viscosity Sensitivity. */
public:
diff --git a/SU2_CFD/include/variables/CEulerVariable.hpp b/SU2_CFD/include/variables/CEulerVariable.hpp
index 21544f72238d..7ef989113442 100644
--- a/SU2_CFD/include/variables/CEulerVariable.hpp
+++ b/SU2_CFD/include/variables/CEulerVariable.hpp
@@ -44,9 +44,9 @@ class CEulerVariable : public CVariable {
/*--- Primitive variable definition ---*/
MatrixType Primitive; /*!< \brief Primitive variables (T, vx, vy, vz, P, rho, h, c) in compressible flows. */
- VectorOfMatrix Gradient_Primitive; /*!< \brief Gradient of the primitive variables (T, vx, vy, vz, P, rho). */
- VectorOfMatrix& Gradient_Reconstruction; /*!< \brief Reference to the gradient of the primitive variables for MUSCL reconstruction for the convective term */
- VectorOfMatrix Gradient_Aux; /*!< \brief Auxiliary structure to store a second gradient for reconstruction, if required. */
+ CVectorOfMatrix Gradient_Primitive; /*!< \brief Gradient of the primitive variables (T, vx, vy, vz, P, rho). */
+ CVectorOfMatrix& Gradient_Reconstruction; /*!< \brief Reference to the gradient of the primitive variables for MUSCL reconstruction for the convective term */
+ CVectorOfMatrix Gradient_Aux; /*!< \brief Auxiliary structure to store a second gradient for reconstruction, if required. */
MatrixType Limiter_Primitive; /*!< \brief Limiter of the primitive variables (T, vx, vy, vz, P, rho). */
/*--- Secondary variable definition ---*/
@@ -150,13 +150,13 @@ class CEulerVariable : public CVariable {
* \brief Get the primitive variable gradients for all points.
* \return Reference to primitive variable gradient.
*/
- inline VectorOfMatrix& GetGradient_Primitive(void) { return Gradient_Primitive; }
+ inline CVectorOfMatrix& GetGradient_Primitive(void) { return Gradient_Primitive; }
/*!
* \brief Get the reconstruction gradient for primitive variable at all points.
* \return Reference to variable reconstruction gradient.
*/
- inline VectorOfMatrix& GetGradient_Reconstruction(void) final { return Gradient_Reconstruction; }
+ inline CVectorOfMatrix& GetGradient_Reconstruction(void) final { return Gradient_Reconstruction; }
/*!
* \brief Get the value of the primitive variables gradient.
diff --git a/SU2_CFD/include/variables/CHeatVariable.hpp b/SU2_CFD/include/variables/CHeatVariable.hpp
index ebb89dff971f..774f726ff86a 100644
--- a/SU2_CFD/include/variables/CHeatVariable.hpp
+++ b/SU2_CFD/include/variables/CHeatVariable.hpp
@@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
- * The SU2 Project is maintained by the SU2 Foundation
+ * The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md)
@@ -39,8 +39,8 @@ class CHeatVariable final : public CVariable {
protected:
MatrixType Solution_Direct; /*!< \brief Direct solution container for use in the adjoint Heat solver. */
- VectorOfMatrix& Gradient_Reconstruction; /*!< \brief Reference to the gradient of the primitive variables for MUSCL reconstruction for the convective term */
- VectorOfMatrix Gradient_Aux; /*!< \brief Auxiliary structure to store a second gradient for reconstruction, if required. */
+ CVectorOfMatrix& Gradient_Reconstruction; /*!< \brief Reference to the gradient of the primitive variables for MUSCL reconstruction for the convective term */
+ CVectorOfMatrix Gradient_Aux; /*!< \brief Auxiliary structure to store a second gradient for reconstruction, if required. */
public:
/*!
@@ -68,7 +68,7 @@ class CHeatVariable final : public CVariable {
inline su2double GetGradient_Reconstruction(unsigned long iPoint, unsigned long iVar, unsigned long iDim) const final {
return Gradient_Reconstruction(iPoint,iVar,iDim);
}
-
+
/*!
* \brief Get the value of the reconstruction variables gradient at a node.
* \param[in] iPoint - Index of the current node.
@@ -79,18 +79,18 @@ class CHeatVariable final : public CVariable {
inline void SetGradient_Reconstruction(unsigned long iPoint, unsigned long iVar, unsigned long iDim, su2double value) final {
Gradient_Reconstruction(iPoint,iVar,iDim) = value;
}
-
+
/*!
* \brief Get the array of the reconstruction variables gradient at a node.
* \param[in] iPoint - Index of the current node.
* \return Array of the reconstruction variables gradient at a node.
*/
inline su2double **GetGradient_Reconstruction(unsigned long iPoint) final { return Gradient_Reconstruction[iPoint]; }
-
+
/*!
* \brief Get the reconstruction gradient for primitive variable at all points.
* \return Reference to variable reconstruction gradient.
*/
- inline VectorOfMatrix& GetGradient_Reconstruction(void) final { return Gradient_Reconstruction; }
-
+ inline CVectorOfMatrix& GetGradient_Reconstruction(void) final { return Gradient_Reconstruction; }
+
};
diff --git a/SU2_CFD/include/variables/CIncEulerVariable.hpp b/SU2_CFD/include/variables/CIncEulerVariable.hpp
index b958f97108da..bfad841bb0ee 100644
--- a/SU2_CFD/include/variables/CIncEulerVariable.hpp
+++ b/SU2_CFD/include/variables/CIncEulerVariable.hpp
@@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
- * The SU2 Project is maintained by the SU2 Foundation
+ * The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md)
@@ -39,9 +39,9 @@ class CIncEulerVariable : public CVariable {
protected:
VectorType Velocity2; /*!< \brief Square of the velocity vector. */
MatrixType Primitive; /*!< \brief Primitive variables (P, vx, vy, vz, T, rho, beta, lamMu, EddyMu, Kt_eff, Cp, Cv) in incompressible flows. */
- VectorOfMatrix Gradient_Primitive; /*!< \brief Gradient of the primitive variables (P, vx, vy, vz, T, rho, beta). */
- VectorOfMatrix& Gradient_Reconstruction; /*!< \brief Reference to the gradient of the primitive variables for MUSCL reconstruction for the convective term */
- VectorOfMatrix Gradient_Aux; /*!< \brief Auxiliary structure to store a second gradient for reconstruction, if required. */
+ CVectorOfMatrix Gradient_Primitive; /*!< \brief Gradient of the primitive variables (P, vx, vy, vz, T, rho, beta). */
+ CVectorOfMatrix& Gradient_Reconstruction; /*!< \brief Reference to the gradient of the primitive variables for MUSCL reconstruction for the convective term */
+ CVectorOfMatrix Gradient_Aux; /*!< \brief Auxiliary structure to store a second gradient for reconstruction, if required. */
MatrixType Limiter_Primitive; /*!< \brief Limiter of the primitive variables (P, vx, vy, vz, T, rho, beta). */
VectorType Density_Old; /*!< \brief Old density for variable density turbulent flows (SST). */
@@ -68,13 +68,13 @@ class CIncEulerVariable : public CVariable {
* \brief Get the primitive variable gradients for all points.
* \return Reference to primitive variable gradient.
*/
- inline VectorOfMatrix& GetGradient_Primitive(void) { return Gradient_Primitive; }
+ inline CVectorOfMatrix& GetGradient_Primitive(void) { return Gradient_Primitive; }
/*!
* \brief Get the reconstruction gradient for primitive variable at all points.
* \return Reference to variable reconstruction gradient.
*/
- inline VectorOfMatrix& GetGradient_Reconstruction(void) final { return Gradient_Reconstruction; }
+ inline CVectorOfMatrix& GetGradient_Reconstruction(void) final { return Gradient_Reconstruction; }
/*!
* \brief Add value to the gradient of the primitive variables.
@@ -148,7 +148,7 @@ class CIncEulerVariable : public CVariable {
* \return Value of the primitive variables gradient.
*/
inline su2double *GetLimiter_Primitive(unsigned long iPoint) final { return Limiter_Primitive[iPoint]; }
-
+
/*!
* \brief Get the value of the reconstruction variables gradient at a node.
* \param[in] iPoint - Index of the current node.
@@ -159,7 +159,7 @@ class CIncEulerVariable : public CVariable {
inline su2double GetGradient_Reconstruction(unsigned long iPoint, unsigned long iVar, unsigned long iDim) const final {
return Gradient_Reconstruction(iPoint,iVar,iDim);
}
-
+
/*!
* \brief Get the value of the reconstruction variables gradient at a node.
* \param[in] iPoint - Index of the current node.
@@ -170,7 +170,7 @@ class CIncEulerVariable : public CVariable {
inline void SetGradient_Reconstruction(unsigned long iPoint, unsigned long iVar, unsigned long iDim, su2double value) final {
Gradient_Reconstruction(iPoint,iVar,iDim) = value;
}
-
+
/*!
* \brief Get the array of the reconstruction variables gradient at a node.
* \param[in] iPoint - Index of the current node.
diff --git a/SU2_CFD/include/variables/CTurbVariable.hpp b/SU2_CFD/include/variables/CTurbVariable.hpp
index 6df439bbd98f..ef4da433d76d 100644
--- a/SU2_CFD/include/variables/CTurbVariable.hpp
+++ b/SU2_CFD/include/variables/CTurbVariable.hpp
@@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
- * The SU2 Project is maintained by the SU2 Foundation
+ * The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md)
@@ -40,8 +40,8 @@ class CTurbVariable : public CVariable {
VectorType muT; /*!< \brief Eddy viscosity. */
MatrixType HB_Source; /*!< \brief Harmonic Balance source term. */
- VectorOfMatrix& Gradient_Reconstruction; /*!< \brief Reference to the gradient of the primitive variables for MUSCL reconstruction for the convective term */
- VectorOfMatrix Gradient_Aux; /*!< \brief Auxiliary structure to store a second gradient for reconstruction, if required. */
+ CVectorOfMatrix& Gradient_Reconstruction; /*!< \brief Reference to the gradient of the primitive variables for MUSCL reconstruction for the convective term */
+ CVectorOfMatrix Gradient_Aux; /*!< \brief Auxiliary structure to store a second gradient for reconstruction, if required. */
public:
/*!
@@ -82,7 +82,7 @@ class CTurbVariable : public CVariable {
inline su2double GetGradient_Reconstruction(unsigned long iPoint, unsigned long iVar, unsigned long iDim) const final {
return Gradient_Reconstruction(iPoint,iVar,iDim);
}
-
+
/*!
* \brief Get the value of the reconstruction variables gradient at a node.
* \param[in] iPoint - Index of the current node.
@@ -93,7 +93,7 @@ class CTurbVariable : public CVariable {
inline void SetGradient_Reconstruction(unsigned long iPoint, unsigned long iVar, unsigned long iDim, su2double value) final {
Gradient_Reconstruction(iPoint,iVar,iDim) = value;
}
-
+
/*!
* \brief Get the array of the reconstruction variables gradient at a node.
* \param[in] iPoint - Index of the current node.
@@ -105,7 +105,7 @@ class CTurbVariable : public CVariable {
* \brief Get the reconstruction gradient for primitive variable at all points.
* \return Reference to variable reconstruction gradient.
*/
- inline VectorOfMatrix& GetGradient_Reconstruction(void) final { return Gradient_Reconstruction; }
+ inline CVectorOfMatrix& GetGradient_Reconstruction(void) final { return Gradient_Reconstruction; }
};
diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp
index 50c721d5c8d8..17b236fa558a 100644
--- a/SU2_CFD/include/variables/CVariable.hpp
+++ b/SU2_CFD/include/variables/CVariable.hpp
@@ -52,30 +52,6 @@ class CVariable {
using VectorType = C2DContainer;
using MatrixType = C2DContainer;
- /*--- This contrived container is used to store matrices in a contiguous manner but still present the
- "su2double**" interface to the outside world, it will be replaced by something more efficient. ---*/
- struct VectorOfMatrix {
- su2activevector storage;
- su2matrix interface;
- unsigned long M, N;
-
- void resize(unsigned long length, unsigned long rows, unsigned long cols, su2double value) {
- M = rows;
- N = cols;
- storage.resize(length*rows*cols) = value;
- interface.resize(length,rows);
-
- for(unsigned long i=0; iconfig = val_config;
this->geometry = val_geometry;
dimension = geometry->GetnDim();
-
+
filename = val_filename;
markerType = val_kind_marker;
numberOfVars = val_number_vars;
-
+
/* Attempt to open the specified file. */
ifstream profile_file;
profile_file.open(filename.data(), ios::in);
-
+
/* If the file is not found, then we merge the information necessary
and write a template marker profile file. Otherwise, we read and
store the information in the marker profile file. */
-
+
if (profile_file.fail()) {
MergeProfileMarkers();
WriteMarkerProfileTemplate();
} else {
ReadMarkerProfile();
}
-
+
}
CMarkerProfileReaderFVM::~CMarkerProfileReaderFVM(void) { }
void CMarkerProfileReaderFVM::ReadMarkerProfile() {
-
+
/*--- Open the profile file (we have already error checked) ---*/
-
+
ifstream profile_file;
profile_file.open(filename.data(), ios::in);
-
+
/*--- Identify the markers and data set in the profile file ---*/
-
+
string text_line;
while (getline (profile_file, text_line)) {
-
+
string::size_type position = text_line.find ("NMARK=",0);
if (position != string::npos) {
text_line.erase (0,6); numberOfProfiles = atoi(text_line.c_str());
-
+
numberOfRowsInProfile.resize(numberOfProfiles);
numberOfColumnsInProfile.resize(numberOfProfiles);
-
+
for (unsigned short iMarker = 0 ; iMarker < numberOfProfiles; iMarker++) {
-
+
getline (profile_file, text_line);
text_line.erase (0,11);
for (unsigned short iChar = 0; iChar < 20; iChar++) {
@@ -94,212 +94,212 @@ void CMarkerProfileReaderFVM::ReadMarkerProfile() {
position = text_line.find( "\n", 0 ); if (position != string::npos) text_line.erase (position,1);
}
profileTags.push_back(text_line.c_str());
-
+
getline (profile_file, text_line);
text_line.erase (0,5); numberOfRowsInProfile[iMarker] = atoi(text_line.c_str());
-
+
getline (profile_file, text_line);
text_line.erase (0,5); numberOfColumnsInProfile[iMarker] = atoi(text_line.c_str());
-
+
/*--- Skip the data. This is read in the next loop. ---*/
-
+
for (unsigned long iRow = 0; iRow < numberOfRowsInProfile[iMarker]; iRow++) getline (profile_file, text_line);
-
+
}
} else {
SU2_MPI::Error("While opening profile file, no \"NMARK=\" specification was found", CURRENT_FUNCTION);
}
}
-
+
profile_file.close();
-
+
/*--- Compute array bounds and offsets. Allocate data structure. ---*/
-
+
profileData.resize(numberOfProfiles);
for (unsigned short iMarker = 0; iMarker < numberOfProfiles; iMarker++) {
profileData[iMarker].resize(numberOfRowsInProfile[iMarker]*numberOfColumnsInProfile[iMarker], 0.0);
}
-
+
/*--- Read all lines in the profile file and extract data. ---*/
-
+
profile_file.open(filename.data(), ios::in);
-
+
int counter = 0;
while (getline (profile_file, text_line)) {
-
+
string::size_type position = text_line.find ("NMARK=",0);
if (position != string::npos) {
-
+
for (unsigned short iMarker = 0; iMarker < numberOfProfiles; iMarker++) {
-
+
/*--- Skip the tag, nRow, and nCol lines. ---*/
-
+
getline (profile_file, text_line);
getline (profile_file, text_line);
getline (profile_file, text_line);
-
+
/*--- Now read the data for each row and store. ---*/
-
+
for (unsigned long iRow = 0; iRow < numberOfRowsInProfile[iMarker]; iRow++) {
-
+
getline (profile_file, text_line);
-
+
istringstream point_line(text_line);
-
+
/*--- Store the values (starting with node coordinates) --*/
-
+
for (unsigned short iVar = 0; iVar < numberOfColumnsInProfile[iMarker]; iVar++)
point_line >> profileData[iMarker][iRow*numberOfColumnsInProfile[iMarker] + iVar];
-
+
/*--- Increment our local row counter. ---*/
-
+
counter++;
-
+
}
}
}
}
-
+
profile_file.close();
-
+
}
void CMarkerProfileReaderFVM::MergeProfileMarkers() {
-
+
/*--- Local variables needed on all processors ---*/
-
+
unsigned long iPoint, jPoint, kPoint;
-
+
int iProcessor, nProcessor = size;
-
+
unsigned long iVertex, iMarker;
unsigned long Buffer_Send_nPoin[1], *Buffer_Recv_nPoin = NULL;
unsigned long nLocalPoint = 0, MaxLocalPoint = 0;
-
+
unsigned long index, iChar;
-
+
char str_buf[MAX_STRING_SIZE];
vector Marker_Tags;
vector::iterator it;
-
+
vector nRowCum_Counter;
-
+
if (rank == MASTER_NODE) Buffer_Recv_nPoin = new unsigned long[nProcessor];
-
+
/*--- Search all boundaries on the present rank to count the number
of nodes found on profile markers. ---*/
-
+
nLocalPoint = 0; numberOfProfiles = 0;
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (config->GetMarker_All_KindBC(iMarker) == markerType) {
numberOfProfiles++;
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
-
+
/*--- Only communicate owned nodes to avoid duplicates. ---*/
-
- if (geometry->node[iPoint]->GetDomain())
+
+ if (geometry->nodes->GetDomain(iPoint))
nLocalPoint++;
-
+
}
}
}
Buffer_Send_nPoin[0] = nLocalPoint;
-
+
/*--- Communicate the total number of nodes on this domain. ---*/
-
+
SU2_MPI::Gather(&Buffer_Send_nPoin, 1, MPI_UNSIGNED_LONG,
Buffer_Recv_nPoin, 1, MPI_UNSIGNED_LONG, MASTER_NODE, MPI_COMM_WORLD);
SU2_MPI::Allreduce(&nLocalPoint, &MaxLocalPoint, 1, MPI_UNSIGNED_LONG, MPI_MAX, MPI_COMM_WORLD);
-
+
/*--- Send and Recv buffers. ---*/
-
+
su2double *Buffer_Send_X = new su2double[MaxLocalPoint];
su2double *Buffer_Recv_X = NULL;
-
+
su2double *Buffer_Send_Y = new su2double[MaxLocalPoint];
su2double *Buffer_Recv_Y = NULL;
-
+
su2double *Buffer_Send_Z = NULL, *Buffer_Recv_Z = NULL;
if (dimension == 3) Buffer_Send_Z = new su2double[MaxLocalPoint];
-
+
char *Buffer_Send_Str = new char[MaxLocalPoint*MAX_STRING_SIZE];
char *Buffer_Recv_Str = NULL;
-
+
/*--- Prepare the receive buffers in the master node only. ---*/
-
+
if (rank == MASTER_NODE) {
-
+
Buffer_Recv_X = new su2double[nProcessor*MaxLocalPoint];
Buffer_Recv_Y = new su2double[nProcessor*MaxLocalPoint];
if (dimension == 3) Buffer_Recv_Z = new su2double[nProcessor*MaxLocalPoint];
Buffer_Recv_Str = new char[nProcessor*MaxLocalPoint*MAX_STRING_SIZE];
-
+
/*--- Sum total number of nodes to be written and allocate arrays ---*/
-
+
unsigned long nGlobal_InletPoint = 0;
for (iProcessor = 0; iProcessor < nProcessor; iProcessor++) {
nGlobal_InletPoint += Buffer_Recv_nPoin[iProcessor];
}
-
+
profileCoords.resize(numberOfProfiles);
for (iMarker = 0; iMarker < numberOfProfiles; iMarker++) {
profileCoords[iMarker].resize(dimension);
}
-
+
}
-
+
/*--- Main communication routine. Loop over each coordinate and perform
the MPI comm. Temporary 1-D buffers are used to send the coordinates at
all nodes on each partition to the master node. These are then unpacked
by the master and sorted by marker tag in one large n-dim. array. ---*/
-
+
su2double *Coords_Local; jPoint = 0;
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (config->GetMarker_All_KindBC(iMarker) == markerType) {
-
+
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
-
+
/*--- Only communicate owned nodes to avoid duplicates. ---*/
-
- if (geometry->node[iPoint]->GetDomain()) {
-
+
+ if (geometry->nodes->GetDomain(iPoint)) {
+
/*--- Retrieve local coordinates at this node. ---*/
-
- Coords_Local = geometry->node[iPoint]->GetCoord();
-
+
+ Coords_Local = geometry->nodes->GetCoord(iPoint);
+
/*--- Load local coords into the temporary send buffer. ---*/
-
+
Buffer_Send_X[jPoint] = Coords_Local[0];
Buffer_Send_Y[jPoint] = Coords_Local[1];
if (dimension == 3) Buffer_Send_Z[jPoint] = Coords_Local[2];
-
+
/*--- If US system, the output should be in inches ---*/
-
+
if (config->GetSystemMeasurements() == US) {
Buffer_Send_X[jPoint] *= 12.0;
Buffer_Send_Y[jPoint] *= 12.0;
if (dimension == 3) Buffer_Send_Z[jPoint] *= 12.0;
}
-
+
/*--- Store the marker tag for this particular node. ---*/
-
+
SPRINTF(&Buffer_Send_Str[jPoint*MAX_STRING_SIZE], "%s",
config->GetMarker_All_TagBound(iMarker).c_str());
-
+
/*--- Increment jPoint as the counter. We need this because iPoint
may include halo nodes that we skip over during this loop. ---*/
-
+
jPoint++;
-
+
}
}
}
}
-
+
/*--- Gather the coordinate data on the master node using MPI. ---*/
-
+
SU2_MPI::Gather(Buffer_Send_X, (int)MaxLocalPoint, MPI_DOUBLE,
Buffer_Recv_X, (int)MaxLocalPoint, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD);
SU2_MPI::Gather(Buffer_Send_Y, (int)MaxLocalPoint, MPI_DOUBLE,
@@ -310,16 +310,16 @@ void CMarkerProfileReaderFVM::MergeProfileMarkers() {
}
SU2_MPI::Gather(Buffer_Send_Str, (int)MaxLocalPoint*MAX_STRING_SIZE, MPI_CHAR,
Buffer_Recv_Str, (int)MaxLocalPoint*MAX_STRING_SIZE, MPI_CHAR, MASTER_NODE, MPI_COMM_WORLD);
-
+
/*--- The master node unpacks and sorts this variable by marker tag. ---*/
-
+
if (rank == MASTER_NODE) {
-
+
profileTags.clear();
-
+
/*--- First, parse the marker tags to count how many total profile markers
we have now on the master. ---*/
-
+
for (iProcessor = 0; iProcessor < nProcessor; iProcessor++) {
for (iPoint = 0; iPoint < Buffer_Recv_nPoin[iProcessor]; iPoint++) {
index = (iProcessor*MaxLocalPoint + iPoint)*MAX_STRING_SIZE;
@@ -330,20 +330,20 @@ void CMarkerProfileReaderFVM::MergeProfileMarkers() {
profileTags.push_back(str_buf);
}
}
-
+
/*--- Sort and remove the duplicate profile marker strings. ---*/
-
+
sort(profileTags.begin(), profileTags.end());
profileTags.erase(unique(profileTags.begin(),
profileTags.end()),
profileTags.end());
-
+
/*--- Store the unique number of markers for writing later. ---*/
-
+
numberOfProfiles = profileTags.size();
-
+
/*--- Count the number of rows (nodes) per marker. ---*/
-
+
numberOfRowsInProfile.resize(numberOfProfiles,0.0);
jPoint = 0;
for (iProcessor = 0; iProcessor < nProcessor; iProcessor++) {
@@ -358,40 +358,40 @@ void CMarkerProfileReaderFVM::MergeProfileMarkers() {
}
/*--- Load up the coordinates, sorted into chunks per marker. ---*/
-
+
jPoint = 0; kPoint = 0;
for (iProcessor = 0; iProcessor < nProcessor; iProcessor++) {
for (iPoint = 0; iPoint < Buffer_Recv_nPoin[iProcessor]; iPoint++) {
for (iMarker = 0; iMarker < numberOfProfiles; iMarker++) {
-
+
if (profileTags[iMarker] == Marker_Tags[kPoint]) {
-
+
/*--- Find our current index for this marker and store coords. ---*/
-
+
profileCoords[iMarker][0].push_back(Buffer_Recv_X[jPoint]);
profileCoords[iMarker][1].push_back(Buffer_Recv_Y[jPoint]);
if (dimension == 3)
profileCoords[iMarker][2].push_back(Buffer_Recv_Z[jPoint]);
-
+
}
}
-
+
/*--- Increment point counter for marker tags and data. ---*/
-
+
kPoint++;
jPoint++;
-
+
}
-
+
/*--- Adjust jPoint to index of next proc's data in the buffers. ---*/
-
+
jPoint = (iProcessor+1)*MaxLocalPoint;
-
+
}
}
-
+
/*--- Immediately release the temporary data buffers. ---*/
-
+
delete [] Buffer_Send_X;
delete [] Buffer_Send_Y;
if (Buffer_Send_Z != NULL) delete [] Buffer_Send_Z;
@@ -403,46 +403,46 @@ void CMarkerProfileReaderFVM::MergeProfileMarkers() {
delete [] Buffer_Recv_nPoin;
delete [] Buffer_Recv_Str;
}
-
+
}
void CMarkerProfileReaderFVM::WriteMarkerProfileTemplate() {
-
+
/*--- Count the number of columns that we have for this case.
Here, we have dimension entries for node coordinates and then the
total number of columns of data specified in the constructor. ---*/
-
+
const unsigned short nColumns = dimension + numberOfVars;
-
+
/*--- Write the profile file. Note that we have already merged
all of the information for the markers and coordinates previously
in the MergeProfileMarkers() routine and only the master writes. ---*/
-
+
if (rank == MASTER_NODE) {
-
+
ofstream node_file("profile_example.dat");
-
+
node_file << "NMARK= " << numberOfProfiles << endl;
-
+
for (unsigned short iMarker = 0; iMarker < numberOfProfiles; iMarker++) {
-
+
/*--- Access the default data for this marker. ---*/
-
+
string Marker_Tag = profileTags[iMarker];
-
+
/*--- Header information for this marker. ---*/
-
+
node_file << "MARKER_TAG= " << Marker_Tag << endl;
node_file << "NROW=" << numberOfRowsInProfile[iMarker] << endl;
node_file << "NCOL=" << nColumns << endl;
-
+
node_file << setprecision(15);
node_file << std::scientific;
-
+
/*--- Loop over the data structure and write the coords and vars. ---*/
-
+
for (unsigned long iPoint = 0; iPoint < numberOfRowsInProfile[iMarker]; iPoint++) {
-
+
for (unsigned short iDim = 0; iDim < dimension; iDim++) {
node_file << profileCoords[iMarker][iDim][iPoint] << "\t";
}
@@ -451,12 +451,12 @@ void CMarkerProfileReaderFVM::WriteMarkerProfileTemplate() {
}
node_file << endl;
}
-
+
}
node_file.close();
-
+
/*--- Print a message to inform the user about the template file. ---*/
-
+
stringstream err;
err << endl;
err << " Could not find the input file for the marker profile." << endl;
@@ -466,7 +466,7 @@ void CMarkerProfileReaderFVM::WriteMarkerProfileTemplate() {
err << " You can use this file as a guide for making your own profile" << endl;
err << " specification." << endl << endl;
SU2_MPI::Error(err.str(), CURRENT_FUNCTION);
-
+
}
-
+
}
diff --git a/SU2_CFD/src/definition_structure.cpp b/SU2_CFD/src/definition_structure.cpp
index fe6bc5ad69c1..2001d04405db 100644
--- a/SU2_CFD/src/definition_structure.cpp
+++ b/SU2_CFD/src/definition_structure.cpp
@@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
- * The SU2 Project is maintained by the SU2 Foundation
+ * The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md)
@@ -30,11 +30,11 @@
void Partition_Analysis(CGeometry *geometry, CConfig *config) {
-
+
/*--- This routine does a quick and dirty output of the total
vertices, ghost vertices, total elements, ghost elements, etc.,
so that we can analyze the partition quality. ---*/
-
+
unsigned short nMarker = config->GetnMarker_All();
unsigned short iMarker, iNodes, MarkerS, MarkerR;
unsigned long iElem, iPoint, nVertexS, nVertexR;
@@ -44,17 +44,17 @@ void Partition_Analysis(CGeometry *geometry, CConfig *config) {
int iRank;
int rank = MASTER_NODE;
int size = SINGLE_NODE;
-
+
#ifdef HAVE_MPI
SU2_MPI::Comm_rank(MPI_COMM_WORLD, &rank);
SU2_MPI::Comm_size(MPI_COMM_WORLD, &size);
#endif
-
+
nPointTotal = geometry->GetnPoint();
nPointGhost = geometry->GetnPoint() - geometry->GetnPointDomain();
nElemTotal = geometry->GetnElem();
nEdge = geometry->GetnEdge();
-
+
for (iMarker = 0; iMarker < nMarker; iMarker++) {
nElemBound += geometry->GetnElem_Bound(iMarker);
if ((config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) &&
@@ -67,54 +67,54 @@ void Partition_Analysis(CGeometry *geometry, CConfig *config) {
nRecvTotal += nVertexR;
}
}
-
+
bool *isHalo = new bool[geometry->GetnElem()];
for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
isHalo[iElem] = false;
for (iNodes = 0; iNodes < geometry->elem[iElem]->GetnNodes(); iNodes++) {
iPoint = geometry->elem[iElem]->GetNode(iNodes);
- if (!geometry->node[iPoint]->GetDomain()) isHalo[iElem] = true;
+ if (!geometry->nodes->GetDomain(iPoint)) isHalo[iElem] = true;
}
}
-
+
for (iElem = 0; iElem < geometry->GetnElem(); iElem++) {
if (isHalo[iElem]) nElemHalo++;
}
-
+
unsigned long *row_ptr = NULL, nnz;
unsigned short *nNeigh = NULL;
vector::iterator it;
vector vneighs;
-
+
/*--- Don't delete *row_ptr, *col_ind because they are
asigned to the Jacobian structure. ---*/
-
+
/*--- Compute the number of neighbors ---*/
-
+
nNeigh = new unsigned short [geometry->GetnPoint()];
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) {
// +1 -> to include diagonal element
- nNeigh[iPoint] = (geometry->node[iPoint]->GetnPoint()+1);
+ nNeigh[iPoint] = (geometry->nodes->GetnPoint(iPoint)+1);
}
-
+
/*--- Create row_ptr structure, using the number of neighbors ---*/
-
+
row_ptr = new unsigned long [geometry->GetnPoint()+1];
row_ptr[0] = 0;
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
row_ptr[iPoint+1] = row_ptr[iPoint] + nNeigh[iPoint];
nnz = row_ptr[geometry->GetnPoint()];
-
+
delete [] row_ptr;
delete [] nNeigh;
-
+
/*--- Now put this info into a CSV file for processing ---*/
-
+
char cstr[200];
ofstream Profile_File;
strcpy (cstr, "partitioning.csv");
Profile_File.precision(15);
-
+
if (rank == MASTER_NODE) {
/*--- Prepare and open the file ---*/
Profile_File.open(cstr, ios::out);
@@ -125,9 +125,9 @@ void Partition_Analysis(CGeometry *geometry, CConfig *config) {
#ifdef HAVE_MPI
SU2_MPI::Barrier(MPI_COMM_WORLD);
#endif
-
+
/*--- Loop through the map and write the results to the file ---*/
-
+
for (iRank = 0; iRank < size; iRank++) {
if (rank == iRank) {
Profile_File.open(cstr, ios::out | ios::app);
@@ -138,43 +138,43 @@ void Partition_Analysis(CGeometry *geometry, CConfig *config) {
SU2_MPI::Barrier(MPI_COMM_WORLD);
#endif
}
-
+
delete [] isHalo;
-
+
}
void Partition_Analysis_FEM(CGeometry *geometry, CConfig *config) {
-
+
/*--- This routine does a quick and dirty output of the total
vertices, ghost vertices, total elements, ghost elements, etc.,
so that we can analyze the partition quality. ---*/
-
+
unsigned long nNeighSend = 0, nNeighRecv = 0;
unsigned long nElemOwned = 0, nElemSendTotal = 0, nElemRecvTotal = 0;
unsigned long nDOFOwned = 0, nDOFSendTotal = 0, nDOFRecvTotal = 0;
-
+
int iRank;
int rank = MASTER_NODE;
int size = SINGLE_NODE;
-
+
#ifdef HAVE_MPI
SU2_MPI::Comm_rank(MPI_COMM_WORLD, &rank);
SU2_MPI::Comm_size(MPI_COMM_WORLD, &size);
#endif
-
+
/*--- Create an object of the class CMeshFEM_DG and retrieve the necessary
geometrical information for the FEM DG solver. ---*/
CMeshFEM_DG *DGGeometry = dynamic_cast(geometry);
-
+
unsigned long nVolElemOwned = DGGeometry->GetNVolElemOwned();
CVolumeElementFEM *volElem = DGGeometry->GetVolElem();
-
+
/*--- Determine the number of owned elements and DOFs. ---*/
nElemOwned = nVolElemOwned;
for(unsigned long l=0; l &ranksRecv = DGGeometry->GetRanksRecv();
const vector > &elementsSend = DGGeometry->GetEntitiesSend();
const vector > &elementsRecv = DGGeometry->GetEntitiesRecv();
-
+
nNeighSend = ranksSend.size();
nNeighRecv = ranksRecv.size();
/*--- Determine the total number of elements and DOFS to be send. ---*/
for(unsigned long i=0; iGetiZone(), iMGlevel;
unsigned short requestedMGlevels = config->GetnMGLevels();
- unsigned long iPoint;
- bool fea = false;
-
- /*--- Definition of the geometry class to store the primal grid in the
- partitioning process. ---*/
+ const bool fea = config->GetStructuralProblem();
- CGeometry *geometry_aux = NULL;
+ /*--- Definition of the geometry class to store the primal grid in the partitioning process.
+ * All ranks process the grid and call ParMETIS for partitioning ---*/
- /*--- All ranks process the grid and call ParMETIS for partitioning ---*/
-
- geometry_aux = new CPhysicalGeometry(config, iZone, nZone);
+ CGeometry *geometry_aux = new CPhysicalGeometry(config, iZone, nZone);
/*--- Set the dimension --- */
@@ -762,7 +757,6 @@ void CDriver::Geometrical_Preprocessing_FVM(CConfig *config, CGeometry **&geomet
/*--- Allocate the memory of the current domain, and divide the grid
between the ranks. ---*/
- geometry = NULL;
geometry = new CGeometry *[config->GetnMGLevels()+1];
/*--- Build the grid data structures using the ParMETIS coloring. ---*/
@@ -779,9 +773,6 @@ void CDriver::Geometrical_Preprocessing_FVM(CConfig *config, CGeometry **&geomet
/*--- Add the Send/Receive boundaries ---*/
geometry[MESH_0]->SetBoundaries(config);
- fea = ((config->GetKind_Solver() == FEM_ELASTICITY) ||
- (config->GetKind_Solver() == DISC_ADJ_FEM));
-
/*--- Compute elements surrounding points, points surrounding points ---*/
if (rank == MASTER_NODE) cout << "Setting point connectivity." << endl;
@@ -914,18 +905,14 @@ void CDriver::Geometrical_Preprocessing_FVM(CConfig *config, CGeometry **&geomet
if (config->GetTime_Marching() && config->GetGrid_Movement()) {
for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) {
- for (iPoint = 0; iPoint < geometry[iMGlevel]->GetnPoint(); iPoint++) {
- /*--- Update cell volume ---*/
+ /*--- Update cell volume ---*/
+ geometry[iMGlevel]->nodes->SetVolume_n();
+ geometry[iMGlevel]->nodes->SetVolume_nM1();
- geometry[iMGlevel]->node[iPoint]->SetVolume_n();
- geometry[iMGlevel]->node[iPoint]->SetVolume_nM1();
-
- /*--- Update point coordinates ---*/
- geometry[iMGlevel]->node[iPoint]->SetCoord_n();
- geometry[iMGlevel]->node[iPoint]->SetCoord_n1();
-
- }
+ /*--- Update point coordinates ---*/
+ geometry[iMGlevel]->nodes->SetCoord_n();
+ geometry[iMGlevel]->nodes->SetCoord_n1();
}
}
@@ -957,14 +944,10 @@ void CDriver::Geometrical_Preprocessing_FVM(CConfig *config, CGeometry **&geomet
void CDriver::Geometrical_Preprocessing_DGFEM(CConfig* config, CGeometry **&geometry) {
- /*--- Definition of the geometry class to store the primal grid in the
- partitioning process. ---*/
-
- CGeometry *geometry_aux = NULL;
-
+ /*--- Definition of the geometry class to store the primal grid in the partitioning process. ---*/
/*--- All ranks process the grid and call ParMETIS for partitioning ---*/
- geometry_aux = new CPhysicalGeometry(config, iZone, nZone);
+ CGeometry *geometry_aux = new CPhysicalGeometry(config, iZone, nZone);
/*--- Set the dimension --- */
@@ -973,8 +956,7 @@ void CDriver::Geometrical_Preprocessing_DGFEM(CConfig* config, CGeometry **&geom
/*--- For the FEM solver with time-accurate local time-stepping, use
a dummy solver class to retrieve the initial flow state. ---*/
- CSolver *solver_aux = NULL;
- solver_aux = new CFEM_DG_EulerSolver(config, nDim, MESH_0);
+ CSolver *solver_aux = new CFEM_DG_EulerSolver(config, nDim, MESH_0);
/*--- Color the initial grid and set the send-receive domains (ParMETIS) ---*/
@@ -983,7 +965,6 @@ void CDriver::Geometrical_Preprocessing_DGFEM(CConfig* config, CGeometry **&geom
/*--- Allocate the memory of the current domain, and divide the grid
between the ranks. ---*/
- geometry = NULL;
geometry = new CGeometry *[config->GetnMGLevels()+1];
geometry[MESH_0] = new CMeshFEM_DG(geometry_aux, config);
@@ -991,7 +972,7 @@ void CDriver::Geometrical_Preprocessing_DGFEM(CConfig* config, CGeometry **&geom
/*--- Deallocate the memory of geometry_aux and solver_aux ---*/
delete geometry_aux;
- if (solver_aux != NULL) delete solver_aux;
+ delete solver_aux;
/*--- Add the Send/Receive boundaries ---*/
geometry[MESH_0]->SetSendReceive(config);
diff --git a/SU2_CFD/src/integration/CIntegration.cpp b/SU2_CFD/src/integration/CIntegration.cpp
index fe2d8e360503..b51b48313588 100644
--- a/SU2_CFD/src/integration/CIntegration.cpp
+++ b/SU2_CFD/src/integration/CIntegration.cpp
@@ -214,36 +214,31 @@ void CIntegration::SetDualTime_Solver(CGeometry *geometry, CSolver *solver, CCon
SU2_OMP_PARALLEL
{
-
- unsigned long iPoint;
+ /*--- Store old solution, volumes and coordinates (in case there is grid movement). ---*/
solver->GetNodes()->Set_Solution_time_n1();
solver->GetNodes()->Set_Solution_time_n();
+ geometry->nodes->SetVolume_nM1();
+ geometry->nodes->SetVolume_n();
+
+ if (config->GetGrid_Movement()) {
+ geometry->nodes->SetCoord_n1();
+ geometry->nodes->SetCoord_n();
+ }
+
SU2_OMP_MASTER
solver->ResetCFLAdapt();
SU2_OMP_BARRIER
SU2_OMP_FOR_STAT(roundUpDiv(geometry->GetnPoint(), omp_get_num_threads()))
- for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) {
+ for (auto iPoint = 0ul; iPoint < geometry->GetnPoint(); iPoint++) {
/*--- Initialize the underrelaxation ---*/
-
solver->GetNodes()->SetUnderRelaxation(iPoint, 1.0);
/*--- Initialize the local CFL number ---*/
-
solver->GetNodes()->SetLocalCFL(iPoint, config->GetCFL(iMesh));
-
- geometry->node[iPoint]->SetVolume_nM1();
- geometry->node[iPoint]->SetVolume_n();
-
- /*--- Store old coordinates in case there is grid movement ---*/
-
- if (config->GetGrid_Movement()) {
- geometry->node[iPoint]->SetCoord_n1();
- geometry->node[iPoint]->SetCoord_n();
- }
}
/*--- Store old aeroelastic solutions ---*/
diff --git a/SU2_CFD/src/integration/CMultiGridIntegration.cpp b/SU2_CFD/src/integration/CMultiGridIntegration.cpp
index b5e6e5961a69..b3701e6f3f83 100644
--- a/SU2_CFD/src/integration/CMultiGridIntegration.cpp
+++ b/SU2_CFD/src/integration/CMultiGridIntegration.cpp
@@ -310,13 +310,13 @@ void CMultiGridIntegration::GetProlongated_Correction(unsigned short RunTime_EqS
SU2_OMP_FOR_STAT(roundUpDiv(geo_coarse->GetnPointDomain(), omp_get_num_threads()))
for (Point_Coarse = 0; Point_Coarse < geo_coarse->GetnPointDomain(); Point_Coarse++) {
- Area_Parent = geo_coarse->node[Point_Coarse]->GetVolume();
+ Area_Parent = geo_coarse->nodes->GetVolume(Point_Coarse);
for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 0.0;
- for (iChildren = 0; iChildren < geo_coarse->node[Point_Coarse]->GetnChildren_CV(); iChildren++) {
- Point_Fine = geo_coarse->node[Point_Coarse]->GetChildren_CV(iChildren);
- Area_Children = geo_fine->node[Point_Fine]->GetVolume();
+ for (iChildren = 0; iChildren < geo_coarse->nodes->GetnChildren_CV(Point_Coarse); iChildren++) {
+ Point_Fine = geo_coarse->nodes->GetChildren_CV(Point_Coarse, iChildren);
+ Area_Children = geo_fine->nodes->GetVolume(Point_Fine);
Solution_Fine = sol_fine->GetNodes()->GetSolution(Point_Fine);
for (iVar = 0; iVar < nVar; iVar++)
Solution[iVar] -= Solution_Fine[iVar]*Area_Children/Area_Parent;
@@ -368,8 +368,8 @@ void CMultiGridIntegration::GetProlongated_Correction(unsigned short RunTime_EqS
SU2_OMP_FOR_STAT(roundUpDiv(geo_coarse->GetnPointDomain(), omp_get_num_threads()))
for (Point_Coarse = 0; Point_Coarse < geo_coarse->GetnPointDomain(); Point_Coarse++) {
- for (iChildren = 0; iChildren < geo_coarse->node[Point_Coarse]->GetnChildren_CV(); iChildren++) {
- Point_Fine = geo_coarse->node[Point_Coarse]->GetChildren_CV(iChildren);
+ for (iChildren = 0; iChildren < geo_coarse->nodes->GetnChildren_CV(Point_Coarse); iChildren++) {
+ Point_Fine = geo_coarse->nodes->GetChildren_CV(Point_Coarse, iChildren);
sol_fine->LinSysRes.SetBlock(Point_Fine, sol_coarse->GetNodes()->GetSolution_Old(Point_Coarse));
}
}
@@ -405,8 +405,8 @@ void CMultiGridIntegration::SmoothProlongated_Correction(unsigned short RunTime_
solver->GetNodes()->SetResidualSumZero(iPoint);
- for (iNeigh = 0; iNeigh < geometry->node[iPoint]->GetnPoint(); ++iNeigh) {
- jPoint = geometry->node[iPoint]->GetPoint(iNeigh);
+ for (iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) {
+ jPoint = geometry->nodes->GetPoint(iPoint, iNeigh);
Residual_j = solver->LinSysRes.GetBlock(jPoint);
solver->GetNodes()->AddResidual_Sum(iPoint, Residual_j);
}
@@ -418,7 +418,7 @@ void CMultiGridIntegration::SmoothProlongated_Correction(unsigned short RunTime_
SU2_OMP_FOR_STAT(roundUpDiv(geometry->GetnPoint(), omp_get_num_threads()))
for (iPoint = 0; iPoint < geometry->GetnPoint(); ++iPoint) {
- su2double factor = 1.0/(1.0+val_smooth_coeff*su2double(geometry->node[iPoint]->GetnPoint()));
+ su2double factor = 1.0/(1.0+val_smooth_coeff*su2double(geometry->nodes->GetnPoint(iPoint)));
Residual_Sum = solver->GetNodes()->GetResidual_Sum(iPoint);
Residual_Old = solver->GetNodes()->GetResidual_Old(iPoint);
@@ -487,8 +487,8 @@ void CMultiGridIntegration::SetProlongated_Solution(unsigned short RunTime_EqSys
SU2_OMP_FOR_STAT(roundUpDiv(geo_coarse->GetnPointDomain(), omp_get_num_threads()))
for (Point_Coarse = 0; Point_Coarse < geo_coarse->GetnPointDomain(); Point_Coarse++) {
- for (iChildren = 0; iChildren < geo_coarse->node[Point_Coarse]->GetnChildren_CV(); iChildren++) {
- Point_Fine = geo_coarse->node[Point_Coarse]->GetChildren_CV(iChildren);
+ for (iChildren = 0; iChildren < geo_coarse->nodes->GetnChildren_CV(Point_Coarse); iChildren++) {
+ Point_Fine = geo_coarse->nodes->GetChildren_CV(Point_Coarse, iChildren);
sol_fine->GetNodes()->SetSolution(Point_Fine, sol_coarse->GetNodes()->GetSolution(Point_Coarse));
}
}
@@ -513,8 +513,8 @@ void CMultiGridIntegration::SetForcing_Term(CSolver *sol_fine, CSolver *sol_coar
for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] = 0.0;
- for (iChildren = 0; iChildren < geo_coarse->node[Point_Coarse]->GetnChildren_CV(); iChildren++) {
- Point_Fine = geo_coarse->node[Point_Coarse]->GetChildren_CV(iChildren);
+ for (iChildren = 0; iChildren < geo_coarse->nodes->GetnChildren_CV(Point_Coarse); iChildren++) {
+ Point_Fine = geo_coarse->nodes->GetChildren_CV(Point_Coarse, iChildren);
Residual_Fine = sol_fine->LinSysRes.GetBlock(Point_Fine);
for (iVar = 0; iVar < nVar; iVar++)
Residual[iVar] += factor*Residual_Fine[iVar];
@@ -572,14 +572,14 @@ void CMultiGridIntegration::SetRestricted_Solution(unsigned short RunTime_EqSyst
SU2_OMP_FOR_STAT(roundUpDiv(geo_coarse->GetnPointDomain(), omp_get_num_threads()))
for (Point_Coarse = 0; Point_Coarse < geo_coarse->GetnPointDomain(); Point_Coarse++) {
- Area_Parent = geo_coarse->node[Point_Coarse]->GetVolume();
+ Area_Parent = geo_coarse->nodes->GetVolume(Point_Coarse);
for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 0.0;
- for (iChildren = 0; iChildren < geo_coarse->node[Point_Coarse]->GetnChildren_CV(); iChildren++) {
+ for (iChildren = 0; iChildren < geo_coarse->nodes->GetnChildren_CV(Point_Coarse); iChildren++) {
- Point_Fine = geo_coarse->node[Point_Coarse]->GetChildren_CV(iChildren);
- Area_Children = geo_fine->node[Point_Fine]->GetVolume();
+ Point_Fine = geo_coarse->nodes->GetChildren_CV(Point_Coarse, iChildren);
+ Area_Children = geo_fine->nodes->GetVolume(Point_Fine);
Solution_Fine = sol_fine->GetNodes()->GetSolution(Point_Fine);
for (iVar = 0; iVar < nVar; iVar++) {
Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent;
@@ -609,7 +609,7 @@ void CMultiGridIntegration::SetRestricted_Solution(unsigned short RunTime_EqSyst
/*--- At moving walls, set the solution based on the new density and wall velocity ---*/
if (grid_movement) {
- Grid_Vel = geo_coarse->node[Point_Coarse]->GetGridVel();
+ Grid_Vel = geo_coarse->nodes->GetGridVel(Point_Coarse);
for (iDim = 0; iDim < nDim; iDim++)
Vector[iDim] = sol_coarse->GetNodes()->GetSolution(Point_Coarse,0)*Grid_Vel[iDim];
sol_coarse->GetNodes()->SetVelSolutionVector(Point_Coarse, Vector);
@@ -657,15 +657,15 @@ void CMultiGridIntegration::SetRestricted_Gradient(unsigned short RunTime_EqSyst
SU2_OMP_FOR_STAT(roundUpDiv(geo_coarse->GetnPoint(), omp_get_num_threads()))
for (Point_Coarse = 0; Point_Coarse < geo_coarse->GetnPoint(); Point_Coarse++) {
- Area_Parent = geo_coarse->node[Point_Coarse]->GetVolume();
+ Area_Parent = geo_coarse->nodes->GetVolume(Point_Coarse);
for (iVar = 0; iVar < nVar; iVar++)
for (iDim = 0; iDim < nDim; iDim++)
Gradient[iVar][iDim] = 0.0;
- for (iChildren = 0; iChildren < geo_coarse->node[Point_Coarse]->GetnChildren_CV(); iChildren++) {
- Point_Fine = geo_coarse->node[Point_Coarse]->GetChildren_CV(iChildren);
- Area_Children = geo_fine->node[Point_Fine]->GetVolume();
+ for (iChildren = 0; iChildren < geo_coarse->nodes->GetnChildren_CV(Point_Coarse); iChildren++) {
+ Point_Fine = geo_coarse->nodes->GetChildren_CV(Point_Coarse, iChildren);
+ Area_Children = geo_fine->nodes->GetVolume(Point_Fine);
Gradient_fine = sol_fine->GetNodes()->GetGradient(Point_Fine);
for (iVar = 0; iVar < nVar; iVar++)
diff --git a/SU2_CFD/src/integration/CSingleGridIntegration.cpp b/SU2_CFD/src/integration/CSingleGridIntegration.cpp
index 521727ea66e7..930e6f20dc79 100644
--- a/SU2_CFD/src/integration/CSingleGridIntegration.cpp
+++ b/SU2_CFD/src/integration/CSingleGridIntegration.cpp
@@ -125,14 +125,14 @@ void CSingleGridIntegration::SetRestricted_Solution(unsigned short RunTime_EqSys
SU2_OMP_FOR_STAT(roundUpDiv(geo_coarse->GetnPointDomain(), omp_get_num_threads()))
for (Point_Coarse = 0; Point_Coarse < geo_coarse->GetnPointDomain(); Point_Coarse++) {
- Area_Parent = geo_coarse->node[Point_Coarse]->GetVolume();
+ Area_Parent = geo_coarse->nodes->GetVolume(Point_Coarse);
for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 0.0;
- for (iChildren = 0; iChildren < geo_coarse->node[Point_Coarse]->GetnChildren_CV(); iChildren++) {
+ for (iChildren = 0; iChildren < geo_coarse->nodes->GetnChildren_CV(Point_Coarse); iChildren++) {
- Point_Fine = geo_coarse->node[Point_Coarse]->GetChildren_CV(iChildren);
- Area_Children = geo_fine->node[Point_Fine]->GetVolume();
+ Point_Fine = geo_coarse->nodes->GetChildren_CV(Point_Coarse, iChildren);
+ Area_Children = geo_fine->nodes->GetVolume(Point_Fine);
Solution_Fine = sol_fine->GetNodes()->GetSolution(Point_Fine);
for (iVar = 0; iVar < nVar; iVar++)
Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent;
@@ -167,13 +167,13 @@ void CSingleGridIntegration::SetRestricted_EddyVisc(unsigned short RunTime_EqSys
SU2_OMP_FOR_STAT(roundUpDiv(geo_coarse->GetnPointDomain(), omp_get_num_threads()))
for (Point_Coarse = 0; Point_Coarse < geo_coarse->GetnPointDomain(); Point_Coarse++) {
- Area_Parent = geo_coarse->node[Point_Coarse]->GetVolume();
+ Area_Parent = geo_coarse->nodes->GetVolume(Point_Coarse);
EddyVisc = 0.0;
- for (iChildren = 0; iChildren < geo_coarse->node[Point_Coarse]->GetnChildren_CV(); iChildren++) {
- Point_Fine = geo_coarse->node[Point_Coarse]->GetChildren_CV(iChildren);
- Area_Children = geo_fine->node[Point_Fine]->GetVolume();
+ for (iChildren = 0; iChildren < geo_coarse->nodes->GetnChildren_CV(Point_Coarse); iChildren++) {
+ Point_Fine = geo_coarse->nodes->GetChildren_CV(Point_Coarse, iChildren);
+ Area_Children = geo_fine->nodes->GetVolume(Point_Fine);
EddyVisc_Fine = sol_fine->GetNodes()->GetmuT(Point_Fine);
EddyVisc += EddyVisc_Fine*Area_Children/Area_Parent;
}
diff --git a/SU2_CFD/src/interfaces/CInterface.cpp b/SU2_CFD/src/interfaces/CInterface.cpp
index 12ab2514431e..896e0f1b5ae7 100644
--- a/SU2_CFD/src/interfaces/CInterface.cpp
+++ b/SU2_CFD/src/interfaces/CInterface.cpp
@@ -108,7 +108,7 @@ void CInterface::BroadcastData(CSolver *donor_solution, CSolver *target_solution
for (iVertex = 0; iVertex < nLocalVertexDonor; iVertex++) {
Point_Donor = donor_geometry->vertex[Marker_Donor][iVertex]->GetNode();
- if (donor_geometry->node[Point_Donor]->GetDomain())
+ if (donor_geometry->nodes->GetDomain(Point_Donor))
nLocalVertexDonorOwned++;
}
}
@@ -168,14 +168,14 @@ void CInterface::BroadcastData(CSolver *donor_solution, CSolver *target_solution
/*--- If this processor owns the node ---*/
- if (donor_geometry->node[Point_Donor]->GetDomain()) {
+ if (donor_geometry->nodes->GetDomain(Point_Donor)) {
GetDonor_Variable(donor_solution, donor_geometry, donor_config, Marker_Donor, iVertex, Point_Donor);
for (iVar = 0; iVar < nVar; iVar++)
Buffer_Send_DonorVariables[iVertex*nVar+iVar] = Donor_Variable[iVar];
- Point_Donor_Global = donor_geometry->node[Point_Donor]->GetGlobalIndex();
+ Point_Donor_Global = donor_geometry->nodes->GetGlobalIndex(Point_Donor);
Buffer_Send_DonorIndices[iVertex] = Point_Donor_Global;
}
@@ -235,7 +235,7 @@ void CInterface::BroadcastData(CSolver *donor_solution, CSolver *target_solution
Point_Target = target_geometry->vertex[Marker_Target][iVertex]->GetNode();
/*--- If this processor owns the node ---*/
- if (target_geometry->node[Point_Target]->GetDomain()) {
+ if (target_geometry->nodes->GetDomain(Point_Target)) {
TotalVertexDonor++;
nDonorPoints = target_geometry->vertex[Marker_Target][iVertex]->GetnDonorPoints();
diff --git a/SU2_CFD/src/interfaces/cht/CConjugateHeatInterface.cpp b/SU2_CFD/src/interfaces/cht/CConjugateHeatInterface.cpp
index 08b61dcc949e..48243f12c98c 100644
--- a/SU2_CFD/src/interfaces/cht/CConjugateHeatInterface.cpp
+++ b/SU2_CFD/src/interfaces/cht/CConjugateHeatInterface.cpp
@@ -65,11 +65,11 @@ void CConjugateHeatInterface::GetDonor_Variable(CSolver *donor_solution, CGeomet
bool heat_equation = ((donor_config->GetKind_Solver() == HEAT_EQUATION)
|| (donor_config->GetKind_Solver() == DISC_ADJ_HEAT));
- Coord = donor_geometry->node[Point_Donor]->GetCoord();
+ Coord = donor_geometry->nodes->GetCoord(Point_Donor);
Normal = donor_geometry->vertex[Marker_Donor][Vertex_Donor]->GetNormal();
PointNormal = donor_geometry->vertex[Marker_Donor][Vertex_Donor]->GetNormal_Neighbor();
- Coord_Normal = donor_geometry->node[PointNormal]->GetCoord();
+ Coord_Normal = donor_geometry->nodes->GetCoord(PointNormal);
Twall = 0.0; Tnormal = 0.0; dTdn = 0.0; dist2 = 0.0; Area = 0.0;
diff --git a/SU2_CFD/src/iteration_structure.cpp b/SU2_CFD/src/iteration_structure.cpp
index bb2db8363e97..fec51ef0d8a6 100644
--- a/SU2_CFD/src/iteration_structure.cpp
+++ b/SU2_CFD/src/iteration_structure.cpp
@@ -771,7 +771,7 @@ void CFluidIteration::SetWind_GustField(CConfig *config, CGeometry **geometry, C
/*--- Reset the Grid Velocity to zero if there is no grid movement ---*/
if (Kind_Grid_Movement == GUST) {
for (iDim = 0; iDim < nDim; iDim++)
- geometry[iMGlevel]->node[iPoint]->SetGridVel(iDim, 0.0);
+ geometry[iMGlevel]->nodes->SetGridVel(iPoint, iDim, 0.0);
}
/*--- initialize the gust and derivatives to zero everywhere ---*/
@@ -783,8 +783,8 @@ void CFluidIteration::SetWind_GustField(CConfig *config, CGeometry **geometry, C
if (Physical_t >= tbegin) {
- x = geometry[iMGlevel]->node[iPoint]->GetCoord()[0]; // x-location of the node.
- y = geometry[iMGlevel]->node[iPoint]->GetCoord()[1]; // y-location of the node.
+ x = geometry[iMGlevel]->nodes->GetCoord(iPoint)[0]; // x-location of the node.
+ y = geometry[iMGlevel]->nodes->GetCoord(iPoint)[1]; // y-location of the node.
// Gust coordinate
x_gust = (x - xbegin - Uinf*(Physical_t-tbegin))/L;
@@ -864,13 +864,13 @@ void CFluidIteration::SetWind_GustField(CConfig *config, CGeometry **geometry, C
solver[iMGlevel][FLOW_SOL]->GetNodes()->SetWindGust(iPoint, Gust);
solver[iMGlevel][FLOW_SOL]->GetNodes()->SetWindGustDer(iPoint, GustDer);
- GridVel = geometry[iMGlevel]->node[iPoint]->GetGridVel();
+ GridVel = geometry[iMGlevel]->nodes->GetGridVel(iPoint);
/*--- Store new grid velocity ---*/
for (iDim = 0; iDim < nDim; iDim++) {
NewGridVel[iDim] = GridVel[iDim] - Gust[iDim];
- geometry[iMGlevel]->node[iPoint]->SetGridVel(iDim, NewGridVel[iDim]);
+ geometry[iMGlevel]->nodes->SetGridVel(iPoint, iDim, NewGridVel[iDim]);
}
}
@@ -1782,10 +1782,8 @@ void CDiscAdjFluidIteration::Preprocess(COutput *output,
solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n1();
}
if (grid_IsMoving) {
- for(iPoint=0; iPointGetnPoint();iPoint++) {
- geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->SetCoord_n();
- geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->SetCoord_n1();
- }
+ geometry[val_iZone][val_iInst][iMesh]->nodes->SetCoord_n();
+ geometry[val_iZone][val_iInst][iMesh]->nodes->SetCoord_n1();
}
}
}
@@ -1805,9 +1803,7 @@ void CDiscAdjFluidIteration::Preprocess(COutput *output,
solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n();
}
if (grid_IsMoving) {
- for(iPoint=0; iPointGetnPoint();iPoint++) {
- geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->SetCoord_n();
- }
+ geometry[val_iZone][val_iInst][iMesh]->nodes->SetCoord_n();
}
}
}
@@ -1852,9 +1848,7 @@ void CDiscAdjFluidIteration::Preprocess(COutput *output,
solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->Set_OldSolution();
}
if (grid_IsMoving) {
- for(iPoint=0; iPointGetnPoint();iPoint++) {
- geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->SetCoord_Old();
- }
+ geometry[val_iZone][val_iInst][iMesh]->nodes->SetCoord_Old();
}
}
@@ -1865,7 +1859,7 @@ void CDiscAdjFluidIteration::Preprocess(COutput *output,
solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->SetSolution(iPoint, solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->GetSolution_time_n(iPoint));
if (grid_IsMoving) {
- geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->SetCoord(geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->GetCoord_n());
+ geometry[val_iZone][val_iInst][iMesh]->nodes->SetCoord(iPoint,geometry[val_iZone][val_iInst][iMesh]->nodes->GetCoord_n(iPoint));
}
if (turbulent) {
solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->SetSolution(iPoint, solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->GetSolution_time_n(iPoint));
@@ -1882,7 +1876,7 @@ void CDiscAdjFluidIteration::Preprocess(COutput *output,
solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->GetSolution_Old(iPoint));
if (grid_IsMoving) {
- geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->SetCoord_n(geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->GetCoord_Old());
+ geometry[val_iZone][val_iInst][iMesh]->nodes->SetCoord_n(iPoint, geometry[val_iZone][val_iInst][iMesh]->nodes->GetCoord_Old(iPoint));
}
if (turbulent) {
solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->GetSolution_Old(iPoint));
@@ -1900,7 +1894,7 @@ void CDiscAdjFluidIteration::Preprocess(COutput *output,
solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->GetSolution_time_n1(iPoint));
if (grid_IsMoving) {
- geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->SetCoord_n(geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->GetCoord_n1());
+ geometry[val_iZone][val_iInst][iMesh]->nodes->SetCoord_n(iPoint, geometry[val_iZone][val_iInst][iMesh]->nodes->GetCoord_n1(iPoint));
}
if (turbulent) {
solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->GetSolution_time_n1(iPoint));
@@ -1916,7 +1910,7 @@ void CDiscAdjFluidIteration::Preprocess(COutput *output,
solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n1(iPoint, solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->GetSolution_Old(iPoint));
if (grid_IsMoving) {
- geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->SetCoord_n1(geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->GetCoord_Old());
+ geometry[val_iZone][val_iInst][iMesh]->nodes->SetCoord_n1(iPoint, geometry[val_iZone][val_iInst][iMesh]->nodes->GetCoord_Old(iPoint));
}
if (turbulent) {
solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n1(iPoint, solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->GetSolution_Old(iPoint));
diff --git a/SU2_CFD/src/output/CAdjElasticityOutput.cpp b/SU2_CFD/src/output/CAdjElasticityOutput.cpp
index 7cb3e8a0aa07..c64aac0ae5f5 100644
--- a/SU2_CFD/src/output/CAdjElasticityOutput.cpp
+++ b/SU2_CFD/src/output/CAdjElasticityOutput.cpp
@@ -136,12 +136,12 @@ inline void CAdjElasticityOutput::LoadHistoryData(CConfig *config, CGeometry *ge
void CAdjElasticityOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){
CVariable* Node_Struc = solver[ADJFEA_SOL]->GetNodes();
- CPoint* Node_Geo = geometry->node[iPoint];
+ CPoint* Node_Geo = geometry->nodes;
- SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0));
- SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(1));
+ SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(iPoint, 0));
+ SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(iPoint, 1));
if (nDim == 3)
- SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(2));
+ SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(iPoint, 2));
SetVolumeOutputValue("ADJOINT-X", iPoint, Node_Struc->GetSolution(iPoint, 0));
SetVolumeOutputValue("ADJOINT-Y", iPoint, Node_Struc->GetSolution(iPoint, 1));
diff --git a/SU2_CFD/src/output/CAdjFlowCompOutput.cpp b/SU2_CFD/src/output/CAdjFlowCompOutput.cpp
index 7d3958d1bb33..262c15198470 100644
--- a/SU2_CFD/src/output/CAdjFlowCompOutput.cpp
+++ b/SU2_CFD/src/output/CAdjFlowCompOutput.cpp
@@ -359,7 +359,7 @@ void CAdjFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CS
CVariable* Node_AdjFlow = solver[ADJFLOW_SOL]->GetNodes();
CVariable* Node_AdjTurb = NULL;
- CPoint* Node_Geo = geometry->node[iPoint];
+ CPoint* Node_Geo = geometry->nodes;
if (config->GetKind_Turb_Model() != NONE &&
((!config->GetFrozen_Visc_Disc() && !cont_adj) ||
@@ -367,10 +367,10 @@ void CAdjFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CS
Node_AdjTurb = solver[ADJTURB_SOL]->GetNodes();
}
- SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0));
- SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(1));
+ SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(iPoint, 0));
+ SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(iPoint, 1));
if (nDim == 3)
- SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(2));
+ SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(iPoint, 2));
SetVolumeOutputValue("ADJ_DENSITY", iPoint, Node_AdjFlow->GetSolution(iPoint, 0));
SetVolumeOutputValue("ADJ_MOMENTUM-X", iPoint, Node_AdjFlow->GetSolution(iPoint, 1));
diff --git a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp
index 03ca678c971f..00386cc8d618 100644
--- a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp
+++ b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp
@@ -409,7 +409,7 @@ void CAdjFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSo
CVariable* Node_AdjHeat = NULL;
CVariable* Node_AdjTurb = NULL;
CVariable* Node_AdjRad = NULL;
- CPoint* Node_Geo = geometry->node[iPoint];
+ CPoint* Node_Geo = geometry->nodes;
if (config->GetKind_Turb_Model() != NONE && !config->GetFrozen_Visc_Disc()){
Node_AdjTurb = solver[ADJTURB_SOL]->GetNodes();
@@ -421,10 +421,10 @@ void CAdjFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSo
Node_AdjRad = solver[ADJRAD_SOL]->GetNodes();
}
- SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0));
- SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(1));
+ SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(iPoint, 0));
+ SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(iPoint, 1));
if (nDim == 3)
- SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(2));
+ SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(iPoint, 2));
SetVolumeOutputValue("ADJ_PRESSURE", iPoint, Node_AdjFlow->GetSolution(iPoint, 0));
SetVolumeOutputValue("ADJ_VELOCITY-X", iPoint, Node_AdjFlow->GetSolution(iPoint, 1));
diff --git a/SU2_CFD/src/output/CAdjHeatOutput.cpp b/SU2_CFD/src/output/CAdjHeatOutput.cpp
index a02fa1c66139..55b4bb51c913 100644
--- a/SU2_CFD/src/output/CAdjHeatOutput.cpp
+++ b/SU2_CFD/src/output/CAdjHeatOutput.cpp
@@ -161,13 +161,13 @@ void CAdjHeatOutput::SetVolumeOutputFields(CConfig *config){
void CAdjHeatOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){
CVariable* Node_AdjHeat = solver[ADJHEAT_SOL]->GetNodes();
- CPoint* Node_Geo = geometry->node[iPoint];
+ CPoint* Node_Geo = geometry->nodes;
- SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0));
- SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(1));
+ SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(iPoint, 0));
+ SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(iPoint, 1));
if (nDim == 3)
- SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(2));
+ SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(iPoint, 2));
SetVolumeOutputValue("ADJ_TEMPERATURE", iPoint, Node_AdjHeat->GetSolution(iPoint, 0));
diff --git a/SU2_CFD/src/output/CElasticityOutput.cpp b/SU2_CFD/src/output/CElasticityOutput.cpp
index c2148ee88cef..57be8fa13ea0 100644
--- a/SU2_CFD/src/output/CElasticityOutput.cpp
+++ b/SU2_CFD/src/output/CElasticityOutput.cpp
@@ -167,12 +167,12 @@ void CElasticityOutput::SetHistoryOutputFields(CConfig *config){
void CElasticityOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){
CVariable* Node_Struc = solver[FEA_SOL]->GetNodes();
- CPoint* Node_Geo = geometry->node[iPoint];
+ CPoint* Node_Geo = geometry->nodes;
- SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0));
- SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(1));
+ SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(iPoint, 0));
+ SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(iPoint, 1));
if (nDim == 3)
- SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(2));
+ SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(iPoint, 2));
SetVolumeOutputValue("DISPLACEMENT-X", iPoint, Node_Struc->GetSolution(iPoint, 0));
SetVolumeOutputValue("DISPLACEMENT-Y", iPoint, Node_Struc->GetSolution(iPoint, 1));
diff --git a/SU2_CFD/src/output/CFlowCompOutput.cpp b/SU2_CFD/src/output/CFlowCompOutput.cpp
index 25a969107b8e..e7a1fef2882e 100644
--- a/SU2_CFD/src/output/CFlowCompOutput.cpp
+++ b/SU2_CFD/src/output/CFlowCompOutput.cpp
@@ -426,12 +426,12 @@ void CFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolv
Node_Turb = solver[TURB_SOL]->GetNodes();
}
- CPoint* Node_Geo = geometry->node[iPoint];
+ CPoint* Node_Geo = geometry->nodes;
- SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0));
- SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(1));
+ SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(iPoint, 0));
+ SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(iPoint, 1));
if (nDim == 3)
- SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(2));
+ SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(iPoint, 2));
SetVolumeOutputValue("DENSITY", iPoint, Node_Flow->GetSolution(iPoint, 0));
SetVolumeOutputValue("MOMENTUM-X", iPoint, Node_Flow->GetSolution(iPoint, 1));
@@ -458,10 +458,10 @@ void CFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolv
}
if (config->GetGrid_Movement()){
- SetVolumeOutputValue("GRID_VELOCITY-X", iPoint, Node_Geo->GetGridVel()[0]);
- SetVolumeOutputValue("GRID_VELOCITY-Y", iPoint, Node_Geo->GetGridVel()[1]);
+ SetVolumeOutputValue("GRID_VELOCITY-X", iPoint, Node_Geo->GetGridVel(iPoint)[0]);
+ SetVolumeOutputValue("GRID_VELOCITY-Y", iPoint, Node_Geo->GetGridVel(iPoint)[1]);
if (nDim == 3)
- SetVolumeOutputValue("GRID_VELOCITY-Z", iPoint, Node_Geo->GetGridVel()[2]);
+ SetVolumeOutputValue("GRID_VELOCITY-Z", iPoint, Node_Geo->GetGridVel(iPoint)[2]);
}
SetVolumeOutputValue("PRESSURE", iPoint, Node_Flow->GetPressure(iPoint));
@@ -535,7 +535,7 @@ void CFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolv
if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES){
SetVolumeOutputValue("DES_LENGTHSCALE", iPoint, Node_Flow->GetDES_LengthScale(iPoint));
- SetVolumeOutputValue("WALL_DISTANCE", iPoint, Node_Geo->GetWall_Distance());
+ SetVolumeOutputValue("WALL_DISTANCE", iPoint, Node_Geo->GetWall_Distance(iPoint));
}
if (config->GetKind_RoeLowDiss() != NO_ROELOWDISS){
diff --git a/SU2_CFD/src/output/CFlowIncOutput.cpp b/SU2_CFD/src/output/CFlowIncOutput.cpp
index 1d3b06c0c524..7525417bba12 100644
--- a/SU2_CFD/src/output/CFlowIncOutput.cpp
+++ b/SU2_CFD/src/output/CFlowIncOutput.cpp
@@ -494,12 +494,12 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve
Node_Heat = solver[HEAT_SOL]->GetNodes();
}
- CPoint* Node_Geo = geometry->node[iPoint];
+ CPoint* Node_Geo = geometry->nodes;
- SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0));
- SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(1));
+ SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(iPoint, 0));
+ SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(iPoint, 1));
if (nDim == 3)
- SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(2));
+ SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(iPoint, 2));
SetVolumeOutputValue("PRESSURE", iPoint, Node_Flow->GetSolution(iPoint, 0));
SetVolumeOutputValue("VELOCITY-X", iPoint, Node_Flow->GetSolution(iPoint, 1));
@@ -532,10 +532,10 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve
}
if (config->GetGrid_Movement()){
- SetVolumeOutputValue("GRID_VELOCITY-X", iPoint, Node_Geo->GetGridVel()[0]);
- SetVolumeOutputValue("GRID_VELOCITY-Y", iPoint, Node_Geo->GetGridVel()[1]);
+ SetVolumeOutputValue("GRID_VELOCITY-X", iPoint, Node_Geo->GetGridVel(iPoint)[0]);
+ SetVolumeOutputValue("GRID_VELOCITY-Y", iPoint, Node_Geo->GetGridVel(iPoint)[1]);
if (nDim == 3)
- SetVolumeOutputValue("GRID_VELOCITY-Z", iPoint, Node_Geo->GetGridVel()[2]);
+ SetVolumeOutputValue("GRID_VELOCITY-Z", iPoint, Node_Geo->GetGridVel(iPoint)[2]);
}
su2double VelMag = 0.0;
@@ -606,7 +606,7 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve
if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES){
SetVolumeOutputValue("DES_LENGTHSCALE", iPoint, Node_Flow->GetDES_LengthScale(iPoint));
- SetVolumeOutputValue("WALL_DISTANCE", iPoint, Node_Geo->GetWall_Distance());
+ SetVolumeOutputValue("WALL_DISTANCE", iPoint, Node_Geo->GetWall_Distance(iPoint));
}
if (config->GetKind_RoeLowDiss() != NO_ROELOWDISS){
diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp
index 2d5781d7a965..6385d3239003 100644
--- a/SU2_CFD/src/output/CFlowOutput.cpp
+++ b/SU2_CFD/src/output/CFlowOutput.cpp
@@ -185,22 +185,22 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
geometry->vertex[iMarker][iVertex]->GetNormal(Vector);
if (axisymmetric) {
- if (geometry->node[iPoint]->GetCoord(1) != 0.0)
- AxiFactor = 2.0*PI_NUMBER*geometry->node[iPoint]->GetCoord(1);
+ if (geometry->nodes->GetCoord(iPoint, 1) != 0.0)
+ AxiFactor = 2.0*PI_NUMBER*geometry->nodes->GetCoord(iPoint, 1);
else {
/*--- Find the point "above" by finding the neighbor of iPoint that is also a vertex of iMarker. ---*/
AxiFactor = 0.0;
- for (unsigned short iNeigh = 0; iNeigh < geometry->node[iPoint]->GetnPoint(); ++iNeigh) {
- auto jPoint = geometry->node[iPoint]->GetPoint(iNeigh);
- if (geometry->node[jPoint]->GetVertex(iMarker) >= 0) {
+ for (unsigned short iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) {
+ auto jPoint = geometry->nodes->GetPoint(iPoint, iNeigh);
+ if (geometry->nodes->GetVertex(jPoint, iMarker) >= 0) {
/*--- Not multiplied by two since we need to half the y coordinate. ---*/
- AxiFactor = PI_NUMBER * geometry->node[jPoint]->GetCoord(1);
- break;
+ AxiFactor = PI_NUMBER * geometry->nodes->GetCoord(jPoint, 1);
+ break;
}
}
}
@@ -855,7 +855,7 @@ void CFlowOutput::Set_CpInverseDesign(CSolver *solver, CGeometry *geometry, CCon
/*--- The Pressure file uses the global numbering ---*/
- iPoint = geometry->node[geometry->vertex[iMarker][iVertex]->GetNode()]->GetGlobalIndex();
+ iPoint = geometry->nodes->GetGlobalIndex(geometry->vertex[iMarker][iVertex]->GetNode());
if (geometry->vertex[iMarker][iVertex]->GetNode() < geometry->GetnPointDomain()) {
Point2Vertex[iPoint][0] = iMarker;
diff --git a/SU2_CFD/src/output/CHeatOutput.cpp b/SU2_CFD/src/output/CHeatOutput.cpp
index 42bfc5361d06..228bef50b965 100644
--- a/SU2_CFD/src/output/CHeatOutput.cpp
+++ b/SU2_CFD/src/output/CHeatOutput.cpp
@@ -135,13 +135,13 @@ void CHeatOutput::SetVolumeOutputFields(CConfig *config){
void CHeatOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){
CVariable* Node_Heat = solver[HEAT_SOL]->GetNodes();
- CPoint* Node_Geo = geometry->node[iPoint];
+ CPoint* Node_Geo = geometry->nodes;
// Grid coordinates
- SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0));
- SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(1));
+ SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(iPoint, 0));
+ SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(iPoint, 1));
if (nDim == 3)
- SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(2));
+ SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(iPoint, 2));
// SOLUTION
SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Heat->GetSolution(iPoint, 0));
diff --git a/SU2_CFD/src/output/CMeshOutput.cpp b/SU2_CFD/src/output/CMeshOutput.cpp
index 0bb05a980d28..c41d7a4db82b 100644
--- a/SU2_CFD/src/output/CMeshOutput.cpp
+++ b/SU2_CFD/src/output/CMeshOutput.cpp
@@ -61,11 +61,11 @@ void CMeshOutput::SetVolumeOutputFields(CConfig *config){
void CMeshOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){
- CPoint* Node_Geo = geometry->node[iPoint];
+ CPoint* Node_Geo = geometry->nodes;
- SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0));
- SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(1));
+ SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(iPoint, 0));
+ SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(iPoint, 1));
if (nDim == 3)
- SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(2));
+ SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(iPoint, 2));
}
diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp
index 87aa45dfc421..214f5c0d6ca4 100644
--- a/SU2_CFD/src/output/COutput.cpp
+++ b/SU2_CFD/src/output/COutput.cpp
@@ -1611,7 +1611,7 @@ void COutput::LoadDataIntoSorter(CConfig* config, CGeometry* geometry, CSolver**
/*--- Load the surface data into the data sorter. --- */
- if(geometry->node[iPoint]->GetDomain()){
+ if(geometry->nodes->GetDomain(iPoint)){
buildFieldIndexCache = fieldIndexCache.empty();
diff --git a/SU2_CFD/src/output/filewriter/CFVMDataSorter.cpp b/SU2_CFD/src/output/filewriter/CFVMDataSorter.cpp
index 4ca355bef47e..eb2b80fd5767 100644
--- a/SU2_CFD/src/output/filewriter/CFVMDataSorter.cpp
+++ b/SU2_CFD/src/output/filewriter/CFVMDataSorter.cpp
@@ -45,9 +45,9 @@ CFVMDataSorter::CFVMDataSorter(CConfig *config, CGeometry *geometry, const vecto
/*--- Store the global IDs ---*/
- globalID.push_back(geometry->node[iPoint]->GetGlobalIndex());
+ globalID.push_back(geometry->nodes->GetGlobalIndex(iPoint));
- Local_Halo[iPoint] = !geometry->node[iPoint]->GetDomain();
+ Local_Halo[iPoint] = !geometry->nodes->GetDomain(iPoint);
}
@@ -200,7 +200,7 @@ void CFVMDataSorter::SortVolumetricConnectivity(CConfig *config,
/*--- Get the index of the current point. ---*/
iPoint = geometry->elem[ii]->GetNode(jj);
- Global_Index = geometry->node[iPoint]->GetGlobalIndex();
+ Global_Index = geometry->nodes->GetGlobalIndex(iPoint);
/*--- Search for the lowest global index in this element. We
send the element to the processor owning the range that includes
@@ -208,7 +208,7 @@ void CFVMDataSorter::SortVolumetricConnectivity(CConfig *config,
for (int kk = 0; kk < NODES_PER_ELEMENT; kk++) {
jPoint = geometry->elem[ii]->GetNode(kk);
- unsigned long newID = geometry->node[jPoint]->GetGlobalIndex();
+ unsigned long newID = geometry->nodes->GetGlobalIndex(jPoint);
if (newID < Global_Index) Global_Index = newID;
}
@@ -290,7 +290,7 @@ void CFVMDataSorter::SortVolumetricConnectivity(CConfig *config,
/*--- Get the index of the current point. ---*/
iPoint = geometry->elem[ii]->GetNode(jj);
- Global_Index = geometry->node[iPoint]->GetGlobalIndex();
+ Global_Index = geometry->nodes->GetGlobalIndex(iPoint);
/*--- Search for the lowest global index in this element. We
send the element to the processor owning the range that includes
@@ -298,7 +298,7 @@ void CFVMDataSorter::SortVolumetricConnectivity(CConfig *config,
for (int kk = 0; kk < NODES_PER_ELEMENT; kk++) {
jPoint = geometry->elem[ii]->GetNode(kk);
- unsigned long newID = geometry->node[jPoint]->GetGlobalIndex();
+ unsigned long newID = geometry->nodes->GetGlobalIndex(jPoint);
if (newID < Global_Index) Global_Index = newID;
}
@@ -325,7 +325,7 @@ void CFVMDataSorter::SortVolumetricConnectivity(CConfig *config,
for (int kk = 0; kk < NODES_PER_ELEMENT; kk++) {
iPoint = geometry->elem[ii]->GetNode(kk);
- connSend[nn] = geometry->node[iPoint]->GetGlobalIndex(); nn++;
+ connSend[nn] = geometry->nodes->GetGlobalIndex(iPoint); nn++;
/*--- Check if this is a halo node. If so, flag this element
as a halo cell. We will use this later to sort and remove
diff --git a/SU2_CFD/src/output/filewriter/CSurfaceFVMDataSorter.cpp b/SU2_CFD/src/output/filewriter/CSurfaceFVMDataSorter.cpp
index 478094d12227..662b33d9cdc8 100644
--- a/SU2_CFD/src/output/filewriter/CSurfaceFVMDataSorter.cpp
+++ b/SU2_CFD/src/output/filewriter/CSurfaceFVMDataSorter.cpp
@@ -1191,7 +1191,7 @@ void CSurfaceFVMDataSorter::SortSurfaceConnectivity(CConfig *config, CGeometry *
/*--- Get the index of the current point. ---*/
iPoint = geometry->bound[iMarker][ii]->GetNode(jj);
- Global_Index = geometry->node[iPoint]->GetGlobalIndex();
+ Global_Index = geometry->nodes->GetGlobalIndex(iPoint);
/*--- Search for the lowest global index in this element. We
send the element to the processor owning the range that includes
@@ -1199,7 +1199,7 @@ void CSurfaceFVMDataSorter::SortSurfaceConnectivity(CConfig *config, CGeometry *
for (int kk = 0; kk < NODES_PER_ELEMENT; kk++) {
jPoint = geometry->bound[iMarker][ii]->GetNode(kk);
- unsigned long newID = geometry->node[jPoint]->GetGlobalIndex();
+ unsigned long newID = geometry->nodes->GetGlobalIndex(jPoint);
if (newID < Global_Index) Global_Index = newID;
}
@@ -1286,7 +1286,7 @@ void CSurfaceFVMDataSorter::SortSurfaceConnectivity(CConfig *config, CGeometry *
/*--- Get the index of the current point. ---*/
iPoint = geometry->bound[iMarker][ii]->GetNode(jj);
- Global_Index = geometry->node[iPoint]->GetGlobalIndex();
+ Global_Index = geometry->nodes->GetGlobalIndex(iPoint);
/*--- Search for the lowest global index in this element. We
send the element to the processor owning the range that includes
@@ -1294,7 +1294,7 @@ void CSurfaceFVMDataSorter::SortSurfaceConnectivity(CConfig *config, CGeometry *
for (int kk = 0; kk < NODES_PER_ELEMENT; kk++) {
jPoint = geometry->bound[iMarker][ii]->GetNode(kk);
- unsigned long newID = geometry->node[jPoint]->GetGlobalIndex();
+ unsigned long newID = geometry->nodes->GetGlobalIndex(jPoint);
if (newID < Global_Index) Global_Index = newID;
}
@@ -1314,7 +1314,7 @@ void CSurfaceFVMDataSorter::SortSurfaceConnectivity(CConfig *config, CGeometry *
for (int kk = 0; kk < NODES_PER_ELEMENT; kk++) {
iPoint = geometry->bound[iMarker][ii]->GetNode(kk);
- connSend[nn] = geometry->node[iPoint]->GetGlobalIndex(); nn++;
+ connSend[nn] = geometry->nodes->GetGlobalIndex(iPoint); nn++;
/*--- Check if this is a halo node. If so, flag this element
as a halo cell. We will use this later to sort and remove
diff --git a/SU2_CFD/src/output/output_structure_legacy.cpp b/SU2_CFD/src/output/output_structure_legacy.cpp
index 93deffe8f574..04f5009a9daa 100644
--- a/SU2_CFD/src/output/output_structure_legacy.cpp
+++ b/SU2_CFD/src/output/output_structure_legacy.cpp
@@ -485,10 +485,10 @@ void COutputLegacy::SetSurfaceCSV_Flow(CConfig *config, CGeometry *geometry,
if (config->GetMarker_All_Plotting(iMarker) == YES) {
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- Global_Index = geometry->node[iPoint]->GetGlobalIndex();
- xCoord = geometry->node[iPoint]->GetCoord(0);
- yCoord = geometry->node[iPoint]->GetCoord(1);
- if (nDim == 3) zCoord = geometry->node[iPoint]->GetCoord(2);
+ Global_Index = geometry->nodes->GetGlobalIndex(iPoint);
+ xCoord = geometry->nodes->GetCoord(iPoint, 0);
+ yCoord = geometry->nodes->GetCoord(iPoint, 1);
+ if (nDim == 3) zCoord = geometry->nodes->GetCoord(iPoint, 2);
/*--- The output should be in inches ---*/
@@ -541,7 +541,7 @@ void COutputLegacy::SetSurfaceCSV_Flow(CConfig *config, CGeometry *geometry,
if (config->GetMarker_All_Plotting(iMarker) == YES)
for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) nLocalVertex_Surface++;
+ if (geometry->nodes->GetDomain(iPoint)) nLocalVertex_Surface++;
}
/*--- Communicate the number of local vertices on each partition
@@ -613,12 +613,12 @@ void COutputLegacy::SetSurfaceCSV_Flow(CConfig *config, CGeometry *geometry,
if (config->GetMarker_All_Plotting(iMarker) == YES)
for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
Buffer_Send_Press[nVertex_Surface] = FlowSolver->GetNodes()->GetPressure(iPoint);
Buffer_Send_CPress[nVertex_Surface] = FlowSolver->GetCPressure(iMarker, iVertex);
- Buffer_Send_Coord_x[nVertex_Surface] = geometry->node[iPoint]->GetCoord(0);
- Buffer_Send_Coord_y[nVertex_Surface] = geometry->node[iPoint]->GetCoord(1);
- if (nDim == 3) { Buffer_Send_Coord_z[nVertex_Surface] = geometry->node[iPoint]->GetCoord(2); }
+ Buffer_Send_Coord_x[nVertex_Surface] = geometry->nodes->GetCoord(iPoint, 0);
+ Buffer_Send_Coord_y[nVertex_Surface] = geometry->nodes->GetCoord(iPoint, 1);
+ if (nDim == 3) { Buffer_Send_Coord_z[nVertex_Surface] = geometry->nodes->GetCoord(iPoint, 2); }
/*--- If US system, the output should be in inches ---*/
@@ -628,7 +628,7 @@ void COutputLegacy::SetSurfaceCSV_Flow(CConfig *config, CGeometry *geometry,
if (nDim == 3) Buffer_Send_Coord_z[nVertex_Surface] *= 12.0;
}
- Buffer_Send_GlobalIndex[nVertex_Surface] = geometry->node[iPoint]->GetGlobalIndex();
+ Buffer_Send_GlobalIndex[nVertex_Surface] = geometry->nodes->GetGlobalIndex(iPoint);
if (solver == EULER || solver == FEM_EULER || solver == INC_EULER)
Buffer_Send_Mach[nVertex_Surface] = sqrt(FlowSolver->GetNodes()->GetVelocity2(iPoint)) / FlowSolver->GetNodes()->GetSoundSpeed(iPoint);
@@ -831,10 +831,10 @@ void COutputLegacy::SetSurfaceCSV_Adjoint(CConfig *config, CGeometry *geometry,
if (config->GetMarker_All_Plotting(iMarker) == YES)
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- Global_Index = geometry->node[iPoint]->GetGlobalIndex();
+ Global_Index = geometry->nodes->GetGlobalIndex(iPoint);
Solution = AdjSolver->GetNodes()->GetSolution(iPoint);
- xCoord = geometry->node[iPoint]->GetCoord(0);
- yCoord = geometry->node[iPoint]->GetCoord(1);
+ xCoord = geometry->nodes->GetCoord(iPoint, 0);
+ yCoord = geometry->nodes->GetCoord(iPoint, 1);
/*--- If US system, the output should be in inches ---*/
@@ -870,12 +870,12 @@ void COutputLegacy::SetSurfaceCSV_Adjoint(CConfig *config, CGeometry *geometry,
if (config->GetMarker_All_Plotting(iMarker) == YES)
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- Global_Index = geometry->node[iPoint]->GetGlobalIndex();
+ Global_Index = geometry->nodes->GetGlobalIndex(iPoint);
Solution = AdjSolver->GetNodes()->GetSolution(iPoint);
- xCoord = geometry->node[iPoint]->GetCoord(0);
- yCoord = geometry->node[iPoint]->GetCoord(1);
- zCoord = geometry->node[iPoint]->GetCoord(2);
+ xCoord = geometry->nodes->GetCoord(iPoint, 0);
+ yCoord = geometry->nodes->GetCoord(iPoint, 1);
+ zCoord = geometry->nodes->GetCoord(iPoint, 2);
/*--- If US system, the output should be in inches ---*/
@@ -917,7 +917,7 @@ void COutputLegacy::SetSurfaceCSV_Adjoint(CConfig *config, CGeometry *geometry,
if (config->GetMarker_All_Plotting(iMarker) == YES)
for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) nLocalVertex_Surface ++;
+ if (geometry->nodes->GetDomain(iPoint)) nLocalVertex_Surface ++;
}
if (rank == MASTER_NODE)
@@ -957,12 +957,12 @@ void COutputLegacy::SetSurfaceCSV_Adjoint(CConfig *config, CGeometry *geometry,
if (config->GetMarker_All_Plotting(iMarker) == YES)
for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
Solution = AdjSolver->GetNodes()->GetSolution(iPoint);
//Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
- Coord = geometry->node[iPoint]->GetCoord();
+ Coord = geometry->nodes->GetCoord(iPoint);
//d = AdjSolver->GetNodes()->GetForceProj_Vector(iPoint);
- Buffer_Send_GlobalPoint[nVertex_Surface] = geometry->node[iPoint]->GetGlobalIndex();
+ Buffer_Send_GlobalPoint[nVertex_Surface] = geometry->nodes->GetGlobalIndex(iPoint);
Buffer_Send_Coord_x[nVertex_Surface] = Coord[0];
Buffer_Send_Coord_y[nVertex_Surface] = Coord[1];
Buffer_Send_Sensitivity[nVertex_Surface] = AdjSolver->GetCSensitivity(iMarker, iVertex);
@@ -1282,7 +1282,7 @@ void COutputLegacy::MergeCoordinates(CConfig *config, CGeometry *geometry) {
/*--- First, create a structure to locate any periodic halo nodes ---*/
int *Local_Halo = new int[geometry->GetnPoint()];
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
- Local_Halo[iPoint] = !geometry->node[iPoint]->GetDomain();
+ Local_Halo[iPoint] = !geometry->nodes->GetDomain(iPoint);
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) {
@@ -1334,10 +1334,10 @@ void COutputLegacy::MergeCoordinates(CConfig *config, CGeometry *geometry) {
/*--- Retrieve the current coordinates at this node. ---*/
- unsigned long iGlobal_Index = geometry->node[iPoint]->GetGlobalIndex();
+ unsigned long iGlobal_Index = geometry->nodes->GetGlobalIndex(iPoint);
for (iDim = 0; iDim < nDim; iDim++) {
- Coords[iDim][iGlobal_Index] = geometry->node[iPoint]->GetCoord(iDim);
+ Coords[iDim][iGlobal_Index] = geometry->nodes->GetCoord(iPoint, iDim);
/*--- If US system, the output should be in inches ---*/
@@ -1372,7 +1372,7 @@ void COutputLegacy::MergeCoordinates(CConfig *config, CGeometry *geometry) {
int *Local_Halo = new int[geometry->GetnPoint()];
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
- Local_Halo[iPoint] = !geometry->node[iPoint]->GetDomain();
+ Local_Halo[iPoint] = !geometry->nodes->GetDomain(iPoint);
/*--- Search all send/recv boundaries on this partition for any periodic
nodes that were part of the original domain. We want to recover these
@@ -1476,7 +1476,7 @@ void COutputLegacy::MergeCoordinates(CConfig *config, CGeometry *geometry) {
if (!Local_Halo[iPoint] || Wrt_Halo) {
/*--- Retrieve local coordinates at this node. ---*/
- Coords_Local = geometry->node[iPoint]->GetCoord();
+ Coords_Local = geometry->nodes->GetCoord(iPoint);
/*--- Load local coords into the temporary send buffer. ---*/
Buffer_Send_X[jPoint] = Coords_Local[0];
@@ -1492,7 +1492,7 @@ void COutputLegacy::MergeCoordinates(CConfig *config, CGeometry *geometry) {
}
/*--- Store the global index for this local node. ---*/
- Buffer_Send_GlobalIndex[jPoint] = geometry->node[iPoint]->GetGlobalIndex();
+ Buffer_Send_GlobalIndex[jPoint] = geometry->nodes->GetGlobalIndex(iPoint);
/*--- Increment jPoint as the counter. We need this because iPoint
may include halo nodes that we skip over during this loop. ---*/
@@ -1657,7 +1657,7 @@ void COutputLegacy::MergeVolumetricConnectivity(CConfig *config, CGeometry *geom
if ((geometry->vertex[iMarker][iVertex]->GetRotation_Type() > 0) &&
(geometry->vertex[iMarker][iVertex]->GetRotation_Type() % 2 == 0) &&
(SendRecv < 0)) {
- Added_Periodic.push_back(geometry->node[iPoint]->GetGlobalIndex());
+ Added_Periodic.push_back(geometry->nodes->GetGlobalIndex(iPoint));
}
}
}
@@ -1715,7 +1715,7 @@ void COutputLegacy::MergeVolumetricConnectivity(CConfig *config, CGeometry *geom
int *Local_Halo = new int[geometry->GetnPoint()];
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
- Local_Halo[iPoint] = !geometry->node[iPoint]->GetDomain();
+ Local_Halo[iPoint] = !geometry->nodes->GetDomain(iPoint);
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) {
@@ -1724,7 +1724,7 @@ void COutputLegacy::MergeVolumetricConnectivity(CConfig *config, CGeometry *geom
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- iGlobal_Index = geometry->node[iPoint]->GetGlobalIndex();
+ iGlobal_Index = geometry->nodes->GetGlobalIndex(iPoint);
/*--- We need to keep one copy of overlapping halo cells. ---*/
notHalo = ((geometry->vertex[iMarker][iVertex]->GetRotation_Type() == 0) &&
@@ -1779,7 +1779,7 @@ void COutputLegacy::MergeVolumetricConnectivity(CConfig *config, CGeometry *geom
/*--- Store the global index values directly. ---*/
iPoint = geometry->elem[iElem]->GetNode(iNode);
- Buffer_Send_Elem[jNode] = geometry->node[iPoint]->GetGlobalIndex();
+ Buffer_Send_Elem[jNode] = geometry->nodes->GetGlobalIndex(iPoint);
/*--- Check if this is a halo node. If so, flag this element
as a halo cell. We will use this later to sort and remove
@@ -2027,7 +2027,7 @@ void COutputLegacy::MergeSurfaceConnectivity(CConfig *config, CGeometry *geometr
if ((geometry->vertex[iMarker][iVertex]->GetRotation_Type() > 0) &&
(geometry->vertex[iMarker][iVertex]->GetRotation_Type() % 2 == 0) &&
(SendRecv < 0)) {
- Added_Periodic.push_back(geometry->node[iPoint]->GetGlobalIndex());
+ Added_Periodic.push_back(geometry->nodes->GetGlobalIndex(iPoint));
}
}
}
@@ -2084,7 +2084,7 @@ void COutputLegacy::MergeSurfaceConnectivity(CConfig *config, CGeometry *geometr
int *Local_Halo = new int[geometry->GetnPoint()];
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
- Local_Halo[iPoint] = !geometry->node[iPoint]->GetDomain();
+ Local_Halo[iPoint] = !geometry->nodes->GetDomain(iPoint);
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) {
@@ -2093,7 +2093,7 @@ void COutputLegacy::MergeSurfaceConnectivity(CConfig *config, CGeometry *geometr
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- iGlobal_Index = geometry->node[iPoint]->GetGlobalIndex();
+ iGlobal_Index = geometry->nodes->GetGlobalIndex(iPoint);
/*--- We need to keep one copy of overlapping halo cells. ---*/
notHalo = ((geometry->vertex[iMarker][iVertex]->GetRotation_Type() == 0) &&
@@ -2143,7 +2143,7 @@ void COutputLegacy::MergeSurfaceConnectivity(CConfig *config, CGeometry *geometr
/*--- Store the global index values directly. ---*/
iPoint = geometry->bound[iMarker][iElem]->GetNode(iNode);
- Buffer_Send_Elem[jNode] = geometry->node[iPoint]->GetGlobalIndex();
+ Buffer_Send_Elem[jNode] = geometry->nodes->GetGlobalIndex(iPoint);
/*--- Check if this is a halo node. If so, flag this element
as a halo cell. We will use this later to sort and remove
@@ -2466,7 +2466,7 @@ void COutputLegacy::MergeSolution(CConfig *config, CGeometry *geometry, CSolver
Local_Halo = new int[geometry->GetnPoint()];
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
- Local_Halo[iPoint] = !geometry->node[iPoint]->GetDomain();
+ Local_Halo[iPoint] = !geometry->nodes->GetDomain(iPoint);
/*--- Search all send/recv boundaries on this partition for any periodic
nodes that were part of the original domain. We want to recover these
@@ -2623,7 +2623,7 @@ void COutputLegacy::MergeSolution(CConfig *config, CGeometry *geometry, CSolver
/*--- Only send/recv the volumes & global indices during the first loop ---*/
if (iVar == 0) {
- Buffer_Send_GlobalIndex[jPoint] = geometry->node[iPoint]->GetGlobalIndex();
+ Buffer_Send_GlobalIndex[jPoint] = geometry->nodes->GetGlobalIndex(iPoint);
}
jPoint++;
@@ -2719,7 +2719,7 @@ void COutputLegacy::MergeSolution(CConfig *config, CGeometry *geometry, CSolver
/*--- Load buffers with the three grid velocity components. ---*/
- Grid_Vel = geometry->node[iPoint]->GetGridVel();
+ Grid_Vel = geometry->nodes->GetGridVel(iPoint);
Buffer_Send_Var[jPoint] = Grid_Vel[0];
Buffer_Send_Res[jPoint] = Grid_Vel[1];
if (geometry->GetnDim() == 3) Buffer_Send_Vol[jPoint] = Grid_Vel[2];
@@ -3178,7 +3178,7 @@ void COutputLegacy::MergeSolution(CConfig *config, CGeometry *geometry, CSolver
/*--- Load buffers with the pressure and mach variables. ---*/
- Buffer_Send_Var[jPoint] = geometry->node[iPoint]->GetSharpEdge_Distance();
+ Buffer_Send_Var[jPoint] = geometry->nodes->GetSharpEdge_Distance(iPoint);
jPoint++;
}
}
@@ -3776,7 +3776,7 @@ void COutputLegacy::MergeBaselineSolution(CConfig *config, CGeometry *geometry,
/*--- First, create a structure to locate any periodic halo nodes ---*/
int *Local_Halo = new int[geometry->GetnPoint()];
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
- Local_Halo[iPoint] = !geometry->node[iPoint]->GetDomain();
+ Local_Halo[iPoint] = !geometry->nodes->GetDomain(iPoint);
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) {
@@ -3842,7 +3842,7 @@ void COutputLegacy::MergeBaselineSolution(CConfig *config, CGeometry *geometry,
int *Local_Halo = new int[geometry->GetnPoint()];
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
- Local_Halo[iPoint] = !geometry->node[iPoint]->GetDomain();
+ Local_Halo[iPoint] = !geometry->nodes->GetDomain(iPoint);
bool Wrt_Halo = config->GetWrt_Halo(), isPeriodic;
@@ -3930,7 +3930,7 @@ void COutputLegacy::MergeBaselineSolution(CConfig *config, CGeometry *geometry,
/*--- Only send/recv the volumes & global indices during the first loop ---*/
if (iVar == 0) {
- Buffer_Send_GlobalIndex[jPoint] = geometry->node[iPoint]->GetGlobalIndex();
+ Buffer_Send_GlobalIndex[jPoint] = geometry->nodes->GetGlobalIndex(iPoint);
}
jPoint++;
}
@@ -9154,7 +9154,7 @@ void COutputLegacy::SetCp_InverseDesign(CSolver *solver_container, CGeometry *ge
#ifndef HAVE_MPI
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
#else
- iPoint = geometry->node[geometry->vertex[iMarker][iVertex]->GetNode()]->GetGlobalIndex();
+ iPoint = geometry->nodes->GetGlobalIndex(geometry->vertex[iMarker][iVertex]->GetNode());
#endif
if (geometry->vertex[iMarker][iVertex]->GetNode() < geometry->GetnPointDomain()) {
@@ -9306,7 +9306,7 @@ void COutputLegacy::SetHeatFlux_InverseDesign(CSolver *solver_container, CGeomet
#ifndef HAVE_MPI
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
#else
- iPoint = geometry->node[geometry->vertex[iMarker][iVertex]->GetNode()]->GetGlobalIndex();
+ iPoint = geometry->nodes->GetGlobalIndex(geometry->vertex[iMarker][iVertex]->GetNode());
#endif
if (geometry->vertex[iMarker][iVertex]->GetNode() < geometry->GetnPointDomain()) {
@@ -9466,7 +9466,7 @@ void COutputLegacy::SpecialOutput_SonicBoom(CSolver *solver, CGeometry *geometry
for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
Face_Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
- Coord = geometry->node[iPoint]->GetCoord();
+ Coord = geometry->nodes->GetCoord(iPoint);
/*--- Using Face_Normal(z), and Coord(z) we identify only a surface,
note that there are 2 NEARFIELD_BOUNDARY surfaces ---*/
@@ -9498,20 +9498,20 @@ void COutputLegacy::SpecialOutput_SonicBoom(CSolver *solver, CGeometry *geometry
for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
Face_Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
- Coord = geometry->node[iPoint]->GetCoord();
+ Coord = geometry->nodes->GetCoord(iPoint);
if ((Face_Normal[nDim-1] > 0.0) && (Coord[nDim-1] < 0.0)) {
IdPoint[nVertex_NearField] = iPoint;
- Xcoord[nVertex_NearField] = geometry->node[iPoint]->GetCoord(0);
- Ycoord[nVertex_NearField] = geometry->node[iPoint]->GetCoord(1);
+ Xcoord[nVertex_NearField] = geometry->nodes->GetCoord(iPoint, 0);
+ Ycoord[nVertex_NearField] = geometry->nodes->GetCoord(iPoint, 1);
if (nDim ==2) {
AzimuthalAngle[nVertex_NearField] = 0;
}
if (nDim == 3) {
- Zcoord[nVertex_NearField] = geometry->node[iPoint]->GetCoord(2);
+ Zcoord[nVertex_NearField] = geometry->nodes->GetCoord(iPoint, 2);
/*--- Rotate the nearfield cylinder (AoA) only 3D ---*/
@@ -9564,9 +9564,9 @@ void COutputLegacy::SpecialOutput_SonicBoom(CSolver *solver, CGeometry *geometry
for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
Face_Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
- Coord = geometry->node[iPoint]->GetCoord();
+ Coord = geometry->nodes->GetCoord(iPoint);
- if (geometry->node[iPoint]->GetDomain())
+ if (geometry->nodes->GetDomain(iPoint))
if ((Face_Normal[nDim-1] > 0.0) && (Coord[nDim-1] < 0.0))
nLocalVertex_NearField ++;
}
@@ -9625,14 +9625,14 @@ void COutputLegacy::SpecialOutput_SonicBoom(CSolver *solver, CGeometry *geometry
for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
Face_Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
- Coord = geometry->node[iPoint]->GetCoord();
+ Coord = geometry->nodes->GetCoord(iPoint);
- if (geometry->node[iPoint]->GetDomain())
+ if (geometry->nodes->GetDomain(iPoint))
if ((Face_Normal[nDim-1] > 0.0) && (Coord[nDim-1] < 0.0)) {
Buffer_Send_IdPoint[nLocalVertex_NearField] = iPoint;
- Buffer_Send_Xcoord[nLocalVertex_NearField] = geometry->node[iPoint]->GetCoord(0);
- Buffer_Send_Ycoord[nLocalVertex_NearField] = geometry->node[iPoint]->GetCoord(1);
- Buffer_Send_Zcoord[nLocalVertex_NearField] = geometry->node[iPoint]->GetCoord(2);
+ Buffer_Send_Xcoord[nLocalVertex_NearField] = geometry->nodes->GetCoord(iPoint, 0);
+ Buffer_Send_Ycoord[nLocalVertex_NearField] = geometry->nodes->GetCoord(iPoint, 1);
+ Buffer_Send_Zcoord[nLocalVertex_NearField] = geometry->nodes->GetCoord(iPoint, 2);
Buffer_Send_Pressure[nLocalVertex_NearField] = solver->GetNodes()->GetPressure(iPoint);
Buffer_Send_FaceArea[nLocalVertex_NearField] = fabs(Face_Normal[nDim-1]);
nLocalVertex_NearField++;
@@ -10124,7 +10124,7 @@ void COutputLegacy::SpecialOutput_Distortion(CSolver *solver, CGeometry *geometr
if (Marker_TagBound == Analyze_TagBound) {
for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) nLocalVertex_Surface++;
+ if (geometry->nodes->GetDomain(iPoint)) nLocalVertex_Surface++;
}
}
}
@@ -10216,11 +10216,11 @@ void COutputLegacy::SpecialOutput_Distortion(CSolver *solver, CGeometry *geometr
for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
- Buffer_Send_Coord_x[nVertex_Surface] = geometry->node[iPoint]->GetCoord(0);
- Buffer_Send_Coord_y[nVertex_Surface] = geometry->node[iPoint]->GetCoord(1);
- if (nDim == 3) { Buffer_Send_Coord_z[nVertex_Surface] = geometry->node[iPoint]->GetCoord(2); }
+ Buffer_Send_Coord_x[nVertex_Surface] = geometry->nodes->GetCoord(iPoint, 0);
+ Buffer_Send_Coord_y[nVertex_Surface] = geometry->nodes->GetCoord(iPoint, 1);
+ if (nDim == 3) { Buffer_Send_Coord_z[nVertex_Surface] = geometry->nodes->GetCoord(iPoint, 2); }
Pressure = solver->GetNodes()->GetPressure(iPoint);
Density = solver->GetNodes()->GetDensity(iPoint);
@@ -11189,7 +11189,7 @@ void COutputLegacy::SetSensitivity_Files(CGeometry ***geometry, CConfig **config
for (iPoint = 0; iPoint < nPoint; iPoint++) {
for (iDim = 0; iDim < nDim; iDim++) {
- solver[iZone][INST_0]->GetNodes()->SetSolution(iPoint, iDim, geometry[iZone][INST_0]->node[iPoint]->GetCoord(iDim));
+ solver[iZone][INST_0]->GetNodes()->SetSolution(iPoint, iDim, geometry[iZone][INST_0]->nodes->GetCoord(iPoint, iDim));
}
for (iVar = 0; iVar < nDim; iVar++) {
solver[iZone][INST_0]->GetNodes()->SetSolution(iPoint, iVar+nDim, geometry[iZone][INST_0]->GetSensitivity(iPoint, iVar));
@@ -12539,7 +12539,7 @@ void COutputLegacy::LoadLocalData_Flow(CConfig *config, CGeometry *geometry, CSo
Local_Halo = new int[geometry->GetnPoint()];
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
- Local_Halo[iPoint] = !geometry->node[iPoint]->GetDomain();
+ Local_Halo[iPoint] = !geometry->nodes->GetDomain(iPoint);
/*--- Search all send/recv boundaries on this partition for any periodic
nodes that were part of the original domain. We want to recover these
@@ -12589,7 +12589,7 @@ void COutputLegacy::LoadLocalData_Flow(CConfig *config, CGeometry *geometry, CSo
/*--- Load the grid node coordinate values. ---*/
for (iDim = 0; iDim < geometry->GetnDim(); iDim++) {
- Local_Data[jPoint][iVar] = geometry->node[iPoint]->GetCoord(iDim);
+ Local_Data[jPoint][iVar] = geometry->nodes->GetCoord(iPoint, iDim);
if (config->GetSystemMeasurements() == US)
Local_Data[jPoint][iVar] *= 12.0;
iVar++;
@@ -12651,7 +12651,7 @@ void COutputLegacy::LoadLocalData_Flow(CConfig *config, CGeometry *geometry, CSo
/*--- Load buffers with the three grid velocity components. ---*/
if (dynamic_grid) {
- Grid_Vel = geometry->node[iPoint]->GetGridVel();
+ Grid_Vel = geometry->nodes->GetGridVel(iPoint);
Local_Data[jPoint][iVar] = Grid_Vel[0]; iVar++;
Local_Data[jPoint][iVar] = Grid_Vel[1]; iVar++;
if (geometry->GetnDim() == 3) {
@@ -12699,7 +12699,7 @@ void COutputLegacy::LoadLocalData_Flow(CConfig *config, CGeometry *geometry, CSo
/*--- Load data for the distance to the nearest sharp edge. ---*/
if (config->GetWrt_SharpEdges()) {
- Local_Data[jPoint][iVar] = geometry->node[iPoint]->GetSharpEdge_Distance(); iVar++;
+ Local_Data[jPoint][iVar] = geometry->nodes->GetSharpEdge_Distance(iPoint); iVar++;
}
/*--- Load data for the intermittency of the BC trans. model. ---*/
@@ -12710,7 +12710,7 @@ void COutputLegacy::LoadLocalData_Flow(CConfig *config, CGeometry *geometry, CSo
if (config->GetKind_HybridRANSLES()!=NO_HYBRIDRANSLES){
Local_Data[jPoint][iVar] = solver[FLOW_SOL]->GetNodes()->GetDES_LengthScale(iPoint); iVar++;
- Local_Data[jPoint][iVar] = geometry->node[iPoint]->GetWall_Distance(); iVar++;
+ Local_Data[jPoint][iVar] = geometry->nodes->GetWall_Distance(iPoint); iVar++;
}
if (config->GetKind_RoeLowDiss() != NO_ROELOWDISS){
@@ -12725,7 +12725,7 @@ void COutputLegacy::LoadLocalData_Flow(CConfig *config, CGeometry *geometry, CSo
if (config->GetTime_Marching()) time = config->GetPhysicalTime();
/* Set the pointers to the coordinates and solution of this DOF. */
- const su2double *coor = geometry->node[iPoint]->GetCoord();
+ const su2double *coor = geometry->nodes->GetCoord(iPoint);
su2double *solDOF = solver[FLOW_SOL]->GetNodes()->GetSolution(iPoint);
su2double mmsSol[5] = {0.0,0.0,0.0,0.0,0.0};
su2double error[5] = {0.0,0.0,0.0,0.0,0.0};
@@ -12787,7 +12787,7 @@ void COutputLegacy::LoadLocalData_Flow(CConfig *config, CGeometry *geometry, CSo
/*--- For rotating frame problems, compute the relative velocity. ---*/
if (rotating_frame) {
- Grid_Vel = geometry->node[iPoint]->GetGridVel();
+ Grid_Vel = geometry->nodes->GetGridVel(iPoint);
su2double *Solution = solver[FLOW_SOL]->GetNodes()->GetSolution(iPoint);
Local_Data[jPoint][iVar] = Solution[1]/Solution[0] - Grid_Vel[0]; iVar++;
Local_Data[jPoint][iVar] = Solution[2]/Solution[0] - Grid_Vel[1]; iVar++;
@@ -13182,7 +13182,7 @@ void COutputLegacy::LoadLocalData_IncFlow(CConfig *config, CGeometry *geometry,
Local_Halo = new int[geometry->GetnPoint()];
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
- Local_Halo[iPoint] = !geometry->node[iPoint]->GetDomain();
+ Local_Halo[iPoint] = !geometry->nodes->GetDomain(iPoint);
/*--- Search all send/recv boundaries on this partition for any periodic
nodes that were part of the original domain. We want to recover these
@@ -13232,7 +13232,7 @@ void COutputLegacy::LoadLocalData_IncFlow(CConfig *config, CGeometry *geometry,
/*--- Load the grid node coordinate values. ---*/
for (iDim = 0; iDim < geometry->GetnDim(); iDim++) {
- Local_Data[jPoint][iVar] = geometry->node[iPoint]->GetCoord(iDim); iVar++;
+ Local_Data[jPoint][iVar] = geometry->nodes->GetCoord(iPoint, iDim); iVar++;
}
/*--- Load the conservative variable states for the mean flow variables. ---*/
@@ -13304,7 +13304,7 @@ void COutputLegacy::LoadLocalData_IncFlow(CConfig *config, CGeometry *geometry,
/*--- Load buffers with the three grid velocity components. ---*/
if (dynamic_grid) {
- Grid_Vel = geometry->node[iPoint]->GetGridVel();
+ Grid_Vel = geometry->nodes->GetGridVel(iPoint);
Local_Data[jPoint][iVar] = Grid_Vel[0]; iVar++;
Local_Data[jPoint][iVar] = Grid_Vel[1]; iVar++;
if (geometry->GetnDim() == 3) {
@@ -13348,7 +13348,7 @@ void COutputLegacy::LoadLocalData_IncFlow(CConfig *config, CGeometry *geometry,
/*--- Load data for the distance to the nearest sharp edge. ---*/
if (config->GetWrt_SharpEdges()) {
- Local_Data[jPoint][iVar] = geometry->node[iPoint]->GetSharpEdge_Distance(); iVar++;
+ Local_Data[jPoint][iVar] = geometry->nodes->GetSharpEdge_Distance(iPoint); iVar++;
}
/*--- Load data for the intermittency of the BC trans. model. ---*/
@@ -13380,7 +13380,7 @@ void COutputLegacy::LoadLocalData_IncFlow(CConfig *config, CGeometry *geometry,
if (config->GetTime_Marching()) time = config->GetPhysicalTime();
/* Set the pointers to the coordinates and solution of this DOF. */
- const su2double *coor = geometry->node[iPoint]->GetCoord();
+ const su2double *coor = geometry->nodes->GetCoord(iPoint);
su2double *solDOF = solver[FLOW_SOL]->GetNodes()->GetSolution(iPoint);
su2double mmsSol[5] = {0.0,0.0,0.0,0.0,0.0};
su2double error[5] = {0.0,0.0,0.0,0.0,0.0};
@@ -13704,7 +13704,7 @@ void COutputLegacy::LoadLocalData_AdjFlow(CConfig *config, CGeometry *geometry,
Local_Halo = new int[geometry->GetnPoint()];
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
- Local_Halo[iPoint] = !geometry->node[iPoint]->GetDomain();
+ Local_Halo[iPoint] = !geometry->nodes->GetDomain(iPoint);
/*--- Search all send/recv boundaries on this partition for any periodic
nodes that were part of the original domain. We want to recover these
@@ -13754,7 +13754,7 @@ void COutputLegacy::LoadLocalData_AdjFlow(CConfig *config, CGeometry *geometry,
/*--- Load the grid node coordinate values. ---*/
for (iDim = 0; iDim < geometry->GetnDim(); iDim++) {
- Local_Data[jPoint][iVar] = geometry->node[iPoint]->GetCoord(iDim);
+ Local_Data[jPoint][iVar] = geometry->nodes->GetCoord(iPoint, iDim);
if (config->GetSystemMeasurements() == US)
Local_Data[jPoint][iVar] *= 12.0;
iVar++;
@@ -13835,7 +13835,7 @@ void COutputLegacy::LoadLocalData_AdjFlow(CConfig *config, CGeometry *geometry,
/*--- Load buffers with the three grid velocity components. ---*/
if (dynamic_grid) {
- Grid_Vel = geometry->node[iPoint]->GetGridVel();
+ Grid_Vel = geometry->nodes->GetGridVel(iPoint);
Local_Data[jPoint][iVar] = Grid_Vel[0]; iVar++;
Local_Data[jPoint][iVar] = Grid_Vel[1]; iVar++;
if (geometry->GetnDim() == 3) {
@@ -14011,7 +14011,7 @@ void COutputLegacy::LoadLocalData_Elasticity(CConfig *config, CGeometry *geometr
Local_Halo = new int[geometry->GetnPoint()];
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
- Local_Halo[iPoint] = !geometry->node[iPoint]->GetDomain();
+ Local_Halo[iPoint] = !geometry->nodes->GetDomain(iPoint);
/*--- Search all send/recv boundaries on this partition for any periodic
nodes that were part of the original domain. We want to recover these
@@ -14061,7 +14061,7 @@ void COutputLegacy::LoadLocalData_Elasticity(CConfig *config, CGeometry *geometr
/*--- Load the grid node coordinate values. ---*/
for (iDim = 0; iDim < geometry->GetnDim(); iDim++) {
- Local_Data[jPoint][iVar] = geometry->node[iPoint]->GetCoord(iDim);
+ Local_Data[jPoint][iVar] = geometry->nodes->GetCoord(iPoint, iDim);
if (config->GetSystemMeasurements() == US)
Local_Data[jPoint][iVar] *= 12.0;
iVar++;
@@ -14237,7 +14237,7 @@ void COutputLegacy::LoadLocalData_Base(CConfig *config, CGeometry *geometry, CSo
Local_Halo = new int[geometry->GetnPoint()];
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
- Local_Halo[iPoint] = !geometry->node[iPoint]->GetDomain();
+ Local_Halo[iPoint] = !geometry->nodes->GetDomain(iPoint);
/*--- Search all send/recv boundaries on this partition for any periodic
nodes that were part of the original domain. We want to recover these
@@ -14287,7 +14287,7 @@ void COutputLegacy::LoadLocalData_Base(CConfig *config, CGeometry *geometry, CSo
/*--- Load the grid node coordinate values. ---*/
for (iDim = 0; iDim < geometry->GetnDim(); iDim++) {
- Local_Data[jPoint][iVar] = geometry->node[iPoint]->GetCoord(iDim);
+ Local_Data[jPoint][iVar] = geometry->nodes->GetCoord(iPoint, iDim);
if (config->GetSystemMeasurements() == US)
Local_Data[jPoint][iVar] *= 12.0;
iVar++;
@@ -14447,7 +14447,7 @@ void COutputLegacy::SortVolumetricConnectivity(CConfig *config, CGeometry *geome
if ((geometry->vertex[iMarker][iVertex]->GetRotation_Type() > 0) &&
(geometry->vertex[iMarker][iVertex]->GetRotation_Type() % 2 == 0) &&
(SendRecv < 0)) {
- Added_Periodic.push_back(geometry->node[iPoint]->GetGlobalIndex());
+ Added_Periodic.push_back(geometry->nodes->GetGlobalIndex(iPoint));
}
}
}
@@ -14507,7 +14507,7 @@ void COutputLegacy::SortVolumetricConnectivity(CConfig *config, CGeometry *geome
Local_Halo = new int[geometry->GetnPoint()];
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
- Local_Halo[iPoint] = !geometry->node[iPoint]->GetDomain();
+ Local_Halo[iPoint] = !geometry->nodes->GetDomain(iPoint);
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) {
@@ -14516,7 +14516,7 @@ void COutputLegacy::SortVolumetricConnectivity(CConfig *config, CGeometry *geome
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- Global_Index = geometry->node[iPoint]->GetGlobalIndex();
+ Global_Index = geometry->nodes->GetGlobalIndex(iPoint);
/*--- We need to keep one copy of overlapping halo cells. ---*/
@@ -14635,7 +14635,7 @@ void COutputLegacy::SortVolumetricConnectivity(CConfig *config, CGeometry *geome
/*--- Get the index of the current point. ---*/
iPoint = geometry->elem[ii]->GetNode(jj);
- Global_Index = geometry->node[iPoint]->GetGlobalIndex();
+ Global_Index = geometry->nodes->GetGlobalIndex(iPoint);
/*--- Search for the lowest global index in this element. We
send the element to the processor owning the range that includes
@@ -14643,7 +14643,7 @@ void COutputLegacy::SortVolumetricConnectivity(CConfig *config, CGeometry *geome
for (int kk = 0; kk < NODES_PER_ELEMENT; kk++) {
jPoint = geometry->elem[ii]->GetNode(kk);
- unsigned long newID = geometry->node[jPoint]->GetGlobalIndex();
+ unsigned long newID = geometry->nodes->GetGlobalIndex(jPoint);
if (newID < Global_Index) Global_Index = newID;
}
@@ -14729,7 +14729,7 @@ void COutputLegacy::SortVolumetricConnectivity(CConfig *config, CGeometry *geome
/*--- Get the index of the current point. ---*/
iPoint = geometry->elem[ii]->GetNode(jj);
- Global_Index = geometry->node[iPoint]->GetGlobalIndex();
+ Global_Index = geometry->nodes->GetGlobalIndex(iPoint);
/*--- Search for the lowest global index in this element. We
send the element to the processor owning the range that includes
@@ -14737,7 +14737,7 @@ void COutputLegacy::SortVolumetricConnectivity(CConfig *config, CGeometry *geome
for (int kk = 0; kk < NODES_PER_ELEMENT; kk++) {
jPoint = geometry->elem[ii]->GetNode(kk);
- unsigned long newID = geometry->node[jPoint]->GetGlobalIndex();
+ unsigned long newID = geometry->nodes->GetGlobalIndex(jPoint);
if (newID < Global_Index) Global_Index = newID;
}
@@ -14763,7 +14763,7 @@ void COutputLegacy::SortVolumetricConnectivity(CConfig *config, CGeometry *geome
for (int kk = 0; kk < NODES_PER_ELEMENT; kk++) {
iPoint = geometry->elem[ii]->GetNode(kk);
- connSend[nn] = geometry->node[iPoint]->GetGlobalIndex(); nn++;
+ connSend[nn] = geometry->nodes->GetGlobalIndex(iPoint); nn++;
/*--- Check if this is a halo node. If so, flag this element
as a halo cell. We will use this later to sort and remove
@@ -15033,7 +15033,7 @@ void COutputLegacy::SortSurfaceConnectivity(CConfig *config, CGeometry *geometry
if ((geometry->vertex[iMarker][iVertex]->GetRotation_Type() > 0) &&
(geometry->vertex[iMarker][iVertex]->GetRotation_Type() % 2 == 0) &&
(SendRecv < 0)) {
- Added_Periodic.push_back(geometry->node[iPoint]->GetGlobalIndex());
+ Added_Periodic.push_back(geometry->nodes->GetGlobalIndex(iPoint));
}
}
}
@@ -15093,7 +15093,7 @@ void COutputLegacy::SortSurfaceConnectivity(CConfig *config, CGeometry *geometry
Local_Halo = new int[geometry->GetnPoint()];
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
- Local_Halo[iPoint] = !geometry->node[iPoint]->GetDomain();
+ Local_Halo[iPoint] = !geometry->nodes->GetDomain(iPoint);
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) {
@@ -15102,7 +15102,7 @@ void COutputLegacy::SortSurfaceConnectivity(CConfig *config, CGeometry *geometry
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- Global_Index = geometry->node[iPoint]->GetGlobalIndex();
+ Global_Index = geometry->nodes->GetGlobalIndex(iPoint);
/*--- We need to keep one copy of overlapping halo cells. ---*/
@@ -15225,7 +15225,7 @@ void COutputLegacy::SortSurfaceConnectivity(CConfig *config, CGeometry *geometry
/*--- Get the index of the current point. ---*/
iPoint = geometry->bound[iMarker][ii]->GetNode(jj);
- Global_Index = geometry->node[iPoint]->GetGlobalIndex();
+ Global_Index = geometry->nodes->GetGlobalIndex(iPoint);
/*--- Search for the lowest global index in this element. We
send the element to the processor owning the range that includes
@@ -15233,7 +15233,7 @@ void COutputLegacy::SortSurfaceConnectivity(CConfig *config, CGeometry *geometry
for (int kk = 0; kk < NODES_PER_ELEMENT; kk++) {
jPoint = geometry->bound[iMarker][ii]->GetNode(kk);
- unsigned long newID = geometry->node[jPoint]->GetGlobalIndex();
+ unsigned long newID = geometry->nodes->GetGlobalIndex(jPoint);
if (newID < Global_Index) Global_Index = newID;
}
@@ -15325,7 +15325,7 @@ void COutputLegacy::SortSurfaceConnectivity(CConfig *config, CGeometry *geometry
/*--- Get the index of the current point. ---*/
iPoint = geometry->bound[iMarker][ii]->GetNode(jj);
- Global_Index = geometry->node[iPoint]->GetGlobalIndex();
+ Global_Index = geometry->nodes->GetGlobalIndex(iPoint);
/*--- Search for the lowest global index in this element. We
send the element to the processor owning the range that includes
@@ -15333,7 +15333,7 @@ void COutputLegacy::SortSurfaceConnectivity(CConfig *config, CGeometry *geometry
for (int kk = 0; kk < NODES_PER_ELEMENT; kk++) {
jPoint = geometry->bound[iMarker][ii]->GetNode(kk);
- unsigned long newID = geometry->node[jPoint]->GetGlobalIndex();
+ unsigned long newID = geometry->nodes->GetGlobalIndex(jPoint);
if (newID < Global_Index) Global_Index = newID;
}
@@ -15359,7 +15359,7 @@ void COutputLegacy::SortSurfaceConnectivity(CConfig *config, CGeometry *geometry
for (int kk = 0; kk < NODES_PER_ELEMENT; kk++) {
iPoint = geometry->bound[iMarker][ii]->GetNode(kk);
- connSend[nn] = geometry->node[iPoint]->GetGlobalIndex(); nn++;
+ connSend[nn] = geometry->nodes->GetGlobalIndex(iPoint); nn++;
/*--- Check if this is a halo node. If so, flag this element
as a halo cell. We will use this later to sort and remove
@@ -15582,7 +15582,7 @@ void COutputLegacy::SortOutputData(CConfig *config, CGeometry *geometry) {
Local_Halo = new int[geometry->GetnPoint()];
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
- Local_Halo[iPoint] = !geometry->node[iPoint]->GetDomain();
+ Local_Halo[iPoint] = !geometry->nodes->GetDomain(iPoint);
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) {
@@ -15674,7 +15674,7 @@ void COutputLegacy::SortOutputData(CConfig *config, CGeometry *geometry) {
/*--- Get the global index of the current point. ---*/
- Global_Index = geometry->node[iPoint]->GetGlobalIndex();
+ Global_Index = geometry->nodes->GetGlobalIndex(iPoint);
/*--- Search for the processor that owns this point ---*/
@@ -15758,7 +15758,7 @@ void COutputLegacy::SortOutputData(CConfig *config, CGeometry *geometry) {
/*--- Get the index of the current point. ---*/
- Global_Index = geometry->node[iPoint]->GetGlobalIndex();
+ Global_Index = geometry->nodes->GetGlobalIndex(iPoint);
/*--- Search for the processor that owns this point. ---*/
@@ -16003,7 +16003,7 @@ void COutputLegacy::SortOutputData_Surface(CConfig *config, CGeometry *geometry)
Local_Halo = new int[geometry->GetnPoint()];
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
- Local_Halo[iPoint] = !geometry->node[iPoint]->GetDomain();
+ Local_Halo[iPoint] = !geometry->nodes->GetDomain(iPoint);
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) {
@@ -16546,7 +16546,7 @@ void COutputLegacy::SortOutputData_Surface(CConfig *config, CGeometry *geometry)
if ((geometry->vertex[iMarker][iVertex]->GetRotation_Type() > 0) &&
(geometry->vertex[iMarker][iVertex]->GetRotation_Type() % 2 == 0) &&
(SendRecv < 0)) {
- Added_Periodic.push_back(geometry->node[iPoint]->GetGlobalIndex());
+ Added_Periodic.push_back(geometry->nodes->GetGlobalIndex(iPoint));
}
}
}
@@ -16605,7 +16605,7 @@ void COutputLegacy::SortOutputData_Surface(CConfig *config, CGeometry *geometry)
domain. We will check the communicated list of added periodic points. ---*/
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
- Local_Halo[iPoint] = !geometry->node[iPoint]->GetDomain();
+ Local_Halo[iPoint] = !geometry->nodes->GetDomain(iPoint);
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) {
@@ -16614,7 +16614,7 @@ void COutputLegacy::SortOutputData_Surface(CConfig *config, CGeometry *geometry)
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- Global_Index = geometry->node[iPoint]->GetGlobalIndex();
+ Global_Index = geometry->nodes->GetGlobalIndex(iPoint);
/*--- We need to keep one copy of overlapping halo cells. ---*/
@@ -17822,7 +17822,7 @@ void COutputLegacy::WriteCSV_Slice(CConfig *config, CGeometry *geometry,
int *Local_Halo = new int[geometry->GetnPoint()];
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
- Local_Halo[iPoint] = !geometry->node[iPoint]->GetDomain();
+ Local_Halo[iPoint] = !geometry->nodes->GetDomain(iPoint);
for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) {
@@ -18157,13 +18157,13 @@ void COutputLegacy::SpecialOutput_AnalyzeSurface(CSolver *solver, CGeometry *geo
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
geometry->vertex[iMarker][iVertex]->GetNormal(Vector);
if (axisymmetric) {
- if (geometry->node[iPoint]->GetCoord(1) != 0.0)
- AxiFactor = 2.0*PI_NUMBER*geometry->node[iPoint]->GetCoord(1);
+ if (geometry->nodes->GetCoord(iPoint, 1) != 0.0)
+ AxiFactor = 2.0*PI_NUMBER*geometry->nodes->GetCoord(iPoint, 1);
else
AxiFactor = 1.0;
} else {
@@ -20399,7 +20399,7 @@ void COutputLegacy::PrepareOffsets(CConfig *config, CGeometry *geometry) {
Local_Halo_Sort = new int[geometry->GetnPoint()];
for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++)
- Local_Halo_Sort[iPoint] = !geometry->node[iPoint]->GetDomain();
+ Local_Halo_Sort[iPoint] = !geometry->nodes->GetDomain(iPoint);
for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) {
diff --git a/SU2_CFD/src/python_wrapper_structure.cpp b/SU2_CFD/src/python_wrapper_structure.cpp
index 2cfa56bd1520..a02b006d6060 100644
--- a/SU2_CFD/src/python_wrapper_structure.cpp
+++ b/SU2_CFD/src/python_wrapper_structure.cpp
@@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
- * The SU2 Project is maintained by the SU2 Foundation
+ * The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md)
@@ -258,7 +258,7 @@ unsigned long CDriver::GetNumberHaloVertices(unsigned short iMarker){
nHaloVertices = 0;
for(iVertex = 0; iVertex < geometry_container[ZONE_0][INST_0][MESH_0]->nVertex[iMarker]; iVertex++){
iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode();
- if(!(geometry_container[ZONE_0][INST_0][MESH_0]->node[iPoint]->GetDomain())) nHaloVertices += 1;
+ if(!(geometry_container[ZONE_0][INST_0][MESH_0]->nodes->GetDomain(iPoint))) nHaloVertices += 1;
}
return nHaloVertices;
@@ -270,7 +270,7 @@ unsigned long CDriver::GetVertexGlobalIndex(unsigned short iMarker, unsigned lon
unsigned long iPoint, GlobalIndex;
iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode();
- GlobalIndex = geometry_container[ZONE_0][INST_0][MESH_0]->node[iPoint]->GetGlobalIndex();
+ GlobalIndex = geometry_container[ZONE_0][INST_0][MESH_0]->nodes->GetGlobalIndex(iPoint);
return GlobalIndex;
@@ -281,7 +281,7 @@ bool CDriver::IsAHaloNode(unsigned short iMarker, unsigned long iVertex) {
unsigned long iPoint;
iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode();
- if(geometry_container[ZONE_0][INST_0][MESH_0]->node[iPoint]->GetDomain()) return false;
+ if(geometry_container[ZONE_0][INST_0][MESH_0]->nodes->GetDomain(iPoint)) return false;
else return true;
}
@@ -307,7 +307,7 @@ passivedouble CDriver::GetVertexCoordX(unsigned short iMarker, unsigned long iVe
unsigned long iPoint;
iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode();
- Coord = geometry_container[ZONE_0][INST_0][MESH_0]->node[iPoint]->GetCoord();
+ Coord = geometry_container[ZONE_0][INST_0][MESH_0]->nodes->GetCoord(iPoint);
return SU2_TYPE::GetValue(Coord[0]);
}
@@ -318,7 +318,7 @@ passivedouble CDriver::GetVertexCoordY(unsigned short iMarker, unsigned long iVe
unsigned long iPoint;
iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode();
- Coord = geometry_container[ZONE_0][INST_0][MESH_0]->node[iPoint]->GetCoord();
+ Coord = geometry_container[ZONE_0][INST_0][MESH_0]->nodes->GetCoord(iPoint);
return SU2_TYPE::GetValue(Coord[1]);
}
@@ -329,7 +329,7 @@ passivedouble CDriver::GetVertexCoordZ(unsigned short iMarker, unsigned long iVe
if(nDim == 3) {
iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode();
- Coord = geometry_container[ZONE_0][INST_0][MESH_0]->node[iPoint]->GetCoord();
+ Coord = geometry_container[ZONE_0][INST_0][MESH_0]->nodes->GetCoord(iPoint);
return SU2_TYPE::GetValue(Coord[2]);
}
else {
@@ -372,7 +372,7 @@ bool CDriver::ComputeVertexForces(unsigned short iMarker, unsigned long iVertex)
iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode();
/*--- It is necessary to distinguish the halo nodes from the others, since they introduce non physical forces. ---*/
- if(geometry_container[ZONE_0][INST_0][MESH_0]->node[iPoint]->GetDomain()) {
+ if(geometry_container[ZONE_0][INST_0][MESH_0]->nodes->GetDomain(iPoint)) {
/*--- Get the normal at the vertex: this normal goes inside the fluid domain. ---*/
Normal = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNormal();
AreaSquare = 0.0;
@@ -464,7 +464,7 @@ void CDriver::SetVertexCoordX(unsigned short iMarker, unsigned long iVertex, pas
su2double *Coord;
iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode();
- Coord = geometry_container[ZONE_0][INST_0][MESH_0]->node[iPoint]->GetCoord();
+ Coord = geometry_container[ZONE_0][INST_0][MESH_0]->nodes->GetCoord(iPoint);
PyWrapVarCoord[0] = newPosX - Coord[0];
@@ -476,7 +476,7 @@ void CDriver::SetVertexCoordY(unsigned short iMarker, unsigned long iVertex, pas
su2double *Coord;
iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode();
- Coord = geometry_container[ZONE_0][INST_0][MESH_0]->node[iPoint]->GetCoord();
+ Coord = geometry_container[ZONE_0][INST_0][MESH_0]->nodes->GetCoord(iPoint);
PyWrapVarCoord[1] = newPosY - Coord[1];
}
@@ -487,7 +487,7 @@ void CDriver::SetVertexCoordZ(unsigned short iMarker, unsigned long iVertex, pas
su2double *Coord;
iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode();
- Coord = geometry_container[ZONE_0][INST_0][MESH_0]->node[iPoint]->GetCoord();
+ Coord = geometry_container[ZONE_0][INST_0][MESH_0]->nodes->GetCoord(iPoint);
if(nDim > 2) {
PyWrapVarCoord[2] = newPosZ - Coord[2];
@@ -517,7 +517,7 @@ passivedouble CDriver::GetVertexTemperature(unsigned short iMarker, unsigned lon
iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode();
- if(geometry_container[ZONE_0][INST_0][MESH_0]->node[iPoint]->GetDomain() && compressible){
+ if(geometry_container[ZONE_0][INST_0][MESH_0]->nodes->GetDomain(iPoint) && compressible){
vertexWallTemp = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->GetNodes()->GetTemperature(iPoint);
}
@@ -547,7 +547,7 @@ bool CDriver::ComputeVertexHeatFluxes(unsigned short iMarker, unsigned long iVer
iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode();
- if(geometry_container[ZONE_0][INST_0][MESH_0]->node[iPoint]->GetDomain()){
+ if(geometry_container[ZONE_0][INST_0][MESH_0]->nodes->GetDomain(iPoint)){
halo = false;
}
else{
@@ -602,7 +602,7 @@ passivedouble CDriver::GetVertexNormalHeatFlux(unsigned short iMarker, unsigned
iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode();
- if(geometry_container[ZONE_0][INST_0][MESH_0]->node[iPoint]->GetDomain() && compressible){
+ if(geometry_container[ZONE_0][INST_0][MESH_0]->nodes->GetDomain(iPoint) && compressible){
Normal = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNormal();
Area = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
@@ -891,22 +891,18 @@ void CFluidDriver::StaticMeshUpdate() {
void CFluidDriver::SetInitialMesh() {
- unsigned long iPoint;
-
StaticMeshUpdate();
/*--- Propagate the initial deformation to the past ---*/
//if (!restart) {
- for(iZone = 0; iZone < nZone; iZone++) {
+ for(iZone = 0; iZone < nZone; iZone++) {
for (iMesh = 0; iMesh <= config_container[iZone]->GetnMGLevels(); iMesh++) {
- for(iPoint = 0; iPoint < geometry_container[iZone][INST_0][iMesh]->GetnPoint(); iPoint++) {
- //solver_container[iZone][iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n();
- //solver_container[iZone][iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n1();
- geometry_container[iZone][INST_0][iMesh]->node[iPoint]->SetVolume_n();
- geometry_container[iZone][INST_0][iMesh]->node[iPoint]->SetVolume_nM1();
- geometry_container[iZone][INST_0][iMesh]->node[iPoint]->SetCoord_n();
- geometry_container[iZone][INST_0][iMesh]->node[iPoint]->SetCoord_n1();
- }
+ //solver_container[iZone][iMesh][FLOW_SOL]->nodes->Set_Solution_time_n(iPoint);
+ //solver_container[iZone][iMesh][FLOW_SOL]->nodes->Set_Solution_time_n1(iPoint);
+ geometry_container[iZone][INST_0][iMesh]->nodes->SetVolume_n();
+ geometry_container[iZone][INST_0][iMesh]->nodes->SetVolume_nM1();
+ geometry_container[iZone][INST_0][iMesh]->nodes->SetCoord_n();
+ geometry_container[iZone][INST_0][iMesh]->nodes->SetCoord_n1();
}
}
//}
diff --git a/SU2_CFD/src/solvers/CAdjEulerSolver.cpp b/SU2_CFD/src/solvers/CAdjEulerSolver.cpp
index 0b4b924caa7d..1dda876f9b6f 100644
--- a/SU2_CFD/src/solvers/CAdjEulerSolver.cpp
+++ b/SU2_CFD/src/solvers/CAdjEulerSolver.cpp
@@ -314,7 +314,7 @@ CAdjEulerSolver::CAdjEulerSolver(CGeometry *geometry, CConfig *config, unsigned
iMarker = jMarker;
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
Area = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
@@ -464,7 +464,7 @@ void CAdjEulerSolver::Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geo
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
jDomain = geometry->vertex[iMarker][iVertex]->GetDonorProcessor();
- if ((iDomain == jDomain) && (geometry->node[iPoint]->GetDomain())) {
+ if ((iDomain == jDomain) && (geometry->nodes->GetDomain(iPoint))) {
Buffer_Send_nPointTotal++;
}
}
@@ -565,9 +565,9 @@ void CAdjEulerSolver::Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geo
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
jDomain = geometry->vertex[iMarker][iVertex]->GetDonorProcessor();
- if ((iDomain == jDomain) && (geometry->node[iPoint]->GetDomain())) {
+ if ((iDomain == jDomain) && (geometry->nodes->GetDomain(iPoint))) {
- iGlobalIndex = geometry->node[iPoint]->GetGlobalIndex();
+ iGlobalIndex = geometry->nodes->GetGlobalIndex(iPoint);
jVertex = geometry->vertex[iMarker][iVertex]->GetDonorVertex();
jMarker = geometry->vertex[iMarker][iVertex]->GetDonorMarker();
@@ -780,7 +780,7 @@ void CAdjEulerSolver::Set_MPI_Nearfield(CGeometry *geometry, CConfig *config) {
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
jDomain = geometry->vertex[iMarker][iVertex]->GetDonorProcessor();
- if ((iDomain == jDomain) && (geometry->node[iPoint]->GetDomain())) {
+ if ((iDomain == jDomain) && (geometry->nodes->GetDomain(iPoint))) {
Buffer_Send_nPointTotal++;
}
}
@@ -880,9 +880,9 @@ void CAdjEulerSolver::Set_MPI_Nearfield(CGeometry *geometry, CConfig *config) {
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
jDomain = geometry->vertex[iMarker][iVertex]->GetDonorProcessor();
- if ((iDomain == jDomain) && (geometry->node[iPoint]->GetDomain())) {
+ if ((iDomain == jDomain) && (geometry->nodes->GetDomain(iPoint))) {
- iGlobalIndex = geometry->node[iPoint]->GetGlobalIndex();
+ iGlobalIndex = geometry->nodes->GetGlobalIndex(iPoint);
jVertex = geometry->vertex[iMarker][iVertex]->GetDonorVertex();
jMarker = geometry->vertex[iMarker][iVertex]->GetDonorMarker();
@@ -1102,9 +1102,9 @@ void CAdjEulerSolver::SetForceProj_Vector(CGeometry *geometry, CSolver **solver_
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- x = geometry->node[iPoint]->GetCoord(0);
- y = geometry->node[iPoint]->GetCoord(1);
- if (nDim == 3) z = geometry->node[iPoint]->GetCoord(2);
+ x = geometry->nodes->GetCoord(iPoint, 0);
+ y = geometry->nodes->GetCoord(iPoint, 1);
+ if (nDim == 3) z = geometry->nodes->GetCoord(iPoint, 2);
Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
ForceProj_Vector2 = nodes->GetForceProj_Vector(iPoint);
@@ -1356,9 +1356,9 @@ void CAdjEulerSolver::SetIntBoundary_Jump(CGeometry *geometry, CSolver **solver_
for (iDim = 0; iDim < nDim; iDim++)
UnitNormal[iDim] = Normal[iDim]/Area;
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
- coord = geometry->node[iPoint]->GetCoord();
+ coord = geometry->nodes->GetCoord(iPoint);
DerivativeOF = 0.0;
/*--- Just in case the functional depend also on the surface pressure ---*/
@@ -1584,11 +1584,11 @@ void CAdjEulerSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solve
Solution = new su2double[nVar];
for (iMesh = 1; iMesh <= config->GetnMGLevels(); iMesh++) {
for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) {
- Area_Parent = geometry[iMesh]->node[iPoint]->GetVolume();
+ Area_Parent = geometry[iMesh]->nodes->GetVolume(iPoint);
for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 0.0;
- for (iChildren = 0; iChildren < geometry[iMesh]->node[iPoint]->GetnChildren_CV(); iChildren++) {
- Point_Fine = geometry[iMesh]->node[iPoint]->GetChildren_CV(iChildren);
- Area_Children = geometry[iMesh-1]->node[Point_Fine]->GetVolume();
+ for (iChildren = 0; iChildren < geometry[iMesh]->nodes->GetnChildren_CV(iPoint); iChildren++) {
+ Point_Fine = geometry[iMesh]->nodes->GetChildren_CV(iPoint, iChildren);
+ Area_Children = geometry[iMesh-1]->nodes->GetVolume(Point_Fine);
Solution_Fine = solver_container[iMesh-1][ADJFLOW_SOL]->GetNodes()->GetSolution(Point_Fine);
for (iVar = 0; iVar < nVar; iVar++) {
Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent;
@@ -1640,7 +1640,7 @@ void CAdjEulerSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contai
/*--- Get the distance form a sharp edge ---*/
- SharpEdge_Distance = geometry->node[iPoint]->GetSharpEdge_Distance();
+ SharpEdge_Distance = geometry->nodes->GetSharpEdge_Distance(iPoint);
/*--- Set the primitive variables compressible
adjoint variables ---*/
@@ -1719,7 +1719,7 @@ void CAdjEulerSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_co
iPoint = geometry->edges->GetNode(iEdge,0);
jPoint = geometry->edges->GetNode(iEdge,1);
numerics->SetNormal(geometry->edges->GetNormal(iEdge));
- numerics->SetNeighbor(geometry->node[iPoint]->GetnNeighbor(), geometry->node[jPoint]->GetnNeighbor());
+ numerics->SetNeighbor(geometry->nodes->GetnNeighbor(iPoint), geometry->nodes->GetnNeighbor(jPoint));
/*--- Adjoint variables w/o reconstruction ---*/
@@ -1747,7 +1747,7 @@ void CAdjEulerSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_co
/*--- Mesh motion ---*/
if (grid_movement) {
- numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[jPoint]->GetGridVel());
+ numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(jPoint));
}
/*--- Compute residuals ---*/
@@ -1813,7 +1813,7 @@ void CAdjEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont
/*--- Grid velocities for dynamic meshes ---*/
if (grid_movement) {
- numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[jPoint]->GetGridVel());
+ numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(jPoint));
}
/*--- High order reconstruction using MUSCL strategy ---*/
@@ -1821,8 +1821,8 @@ void CAdjEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont
if (muscl) {
for (iDim = 0; iDim < nDim; iDim++) {
- Vector_i[iDim] = 0.5*(geometry->node[jPoint]->GetCoord(iDim) - geometry->node[iPoint]->GetCoord(iDim));
- Vector_j[iDim] = 0.5*(geometry->node[iPoint]->GetCoord(iDim) - geometry->node[jPoint]->GetCoord(iDim));
+ Vector_i[iDim] = 0.5*(geometry->nodes->GetCoord(jPoint, iDim) - geometry->nodes->GetCoord(iPoint, iDim));
+ Vector_j[iDim] = 0.5*(geometry->nodes->GetCoord(iPoint, iDim) - geometry->nodes->GetCoord(jPoint, iDim));
}
/*--- Adjoint variables using gradient reconstruction and limiters ---*/
@@ -1941,7 +1941,7 @@ void CAdjEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont
nodes->GetSolution(iPoint));
/*--- Load the volume of the dual mesh cell ---*/
- numerics->SetVolume(geometry->node[iPoint]->GetVolume());
+ numerics->SetVolume(geometry->nodes->GetVolume(iPoint));
/*--- Compute the adjoint rotating frame source residual ---*/
numerics->ComputeResidual(Residual, Jacobian_i, config);
@@ -1963,7 +1963,7 @@ void CAdjEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont
for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
/*--- Get control volume ---*/
- Volume = geometry->node[iPoint]->GetVolume();
+ Volume = geometry->nodes->GetVolume(iPoint);
/*--- Get stored harmonic balance source term ---*/
for (iVar = 0; iVar < nVar; iVar++) {
@@ -1996,10 +1996,10 @@ void CAdjEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont
numerics->SetAdjointVar(nodes->GetSolution(iPoint), nodes->GetSolution(iPoint));
/*--- Set control volume ---*/
- numerics->SetVolume(geometry->node[iPoint]->GetVolume());
+ numerics->SetVolume(geometry->nodes->GetVolume(iPoint));
/*--- Set coordinate ---*/
- numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[iPoint]->GetCoord());
+ numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(iPoint));
/*--- Compute Source term Residual ---*/
numerics->ComputeResidual(Residual, Jacobian_i, config);
@@ -2042,27 +2042,27 @@ void CAdjEulerSolver::SetUndivided_Laplacian(CGeometry *geometry, CConfig *confi
#ifdef STRUCTURED_GRID
- if (geometry->node[iPoint]->GetDomain()) nodes->SubtractUnd_Lapl(iPoint, Diff);
- if (geometry->node[jPoint]->GetDomain()) nodes->AddUnd_Lapl(jPoint, Diff);
+ if (geometry->nodes->GetDomain(iPoint)) nodes->SubtractUnd_Lapl(iPoint, Diff);
+ if (geometry->nodes->GetDomain(jPoint)) nodes->AddUnd_Lapl(jPoint, Diff);
#else
- bool boundary_i = geometry->node[iPoint]->GetPhysicalBoundary();
- bool boundary_j = geometry->node[jPoint]->GetPhysicalBoundary();
+ bool boundary_i = geometry->nodes->GetPhysicalBoundary(iPoint);
+ bool boundary_j = geometry->nodes->GetPhysicalBoundary(jPoint);
/*--- Both points inside the domain, or both in the boundary ---*/
if ((!boundary_i && !boundary_j) || (boundary_i && boundary_j)) {
- if (geometry->node[iPoint]->GetDomain()) nodes->SubtractUnd_Lapl(iPoint, Diff);
- if (geometry->node[jPoint]->GetDomain()) nodes->AddUnd_Lapl(jPoint, Diff);
+ if (geometry->nodes->GetDomain(iPoint)) nodes->SubtractUnd_Lapl(iPoint, Diff);
+ if (geometry->nodes->GetDomain(jPoint)) nodes->AddUnd_Lapl(jPoint, Diff);
}
/*--- iPoint inside the domain, jPoint on the boundary ---*/
if (!boundary_i && boundary_j)
- if (geometry->node[iPoint]->GetDomain()) nodes->SubtractUnd_Lapl(iPoint, Diff);
+ if (geometry->nodes->GetDomain(iPoint)) nodes->SubtractUnd_Lapl(iPoint, Diff);
/*--- jPoint inside the domain, iPoint on the boundary ---*/
if (boundary_i && !boundary_j)
- if (geometry->node[jPoint]->GetDomain()) nodes->AddUnd_Lapl(jPoint, Diff);
+ if (geometry->nodes->GetDomain(jPoint)) nodes->AddUnd_Lapl(jPoint, Diff);
#endif
@@ -2088,14 +2088,14 @@ void CAdjEulerSolver::SetUndivided_Laplacian(CGeometry *geometry, CConfig *confi
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
Point_Normal = geometry->vertex[iMarker][iVertex]->GetNormal_Neighbor();
/*--- Interpolate & compute difference in the conserved variables ---*/
for (iVar = 0; iVar < nVar; iVar++) {
- Psi_mirror[iVar] = 2.0*node[iPoint]->GetSolution(iVar) - nodes->GetSolution(Point_Normal, iVar);
+ Psi_mirror[iVar] = 2.0*nodes->GetSolution(iPoint, iVar) - nodes->GetSolution(Point_Normal, iVar);
Diff[iVar] = nodes->GetSolution(iPoint,iVar) - Psi_mirror[iVar];
}
@@ -2134,7 +2134,7 @@ void CAdjEulerSolver::SetCentered_Dissipation_Sensor(CGeometry *geometry, CConfi
for (iPoint = 0; iPoint < nPoint; iPoint++) {
- SharpEdge_Distance = (geometry->node[iPoint]->GetSharpEdge_Distance() - config->GetAdjSharp_LimiterCoeff()*eps);
+ SharpEdge_Distance = (geometry->nodes->GetSharpEdge_Distance(iPoint) - config->GetAdjSharp_LimiterCoeff()*eps);
ds = 0.0;
if (SharpEdge_Distance < -eps) ds = 1.0;
@@ -2169,7 +2169,7 @@ void CAdjEulerSolver::ExplicitRK_Iteration(CGeometry *geometry, CSolver **solver
/*--- Update the solution ---*/
for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
- Vol = geometry->node[iPoint]->GetVolume();
+ Vol = geometry->nodes->GetVolume(iPoint);
Delta = solver_container[FLOW_SOL]->GetNodes()->GetDelta_Time(iPoint) / Vol;
Res_TruncError = nodes->GetResTruncError(iPoint);
@@ -2179,7 +2179,7 @@ void CAdjEulerSolver::ExplicitRK_Iteration(CGeometry *geometry, CSolver **solver
Res = Residual[iVar] + Res_TruncError[iVar];
nodes->AddSolution(iPoint,iVar, -Res*Delta*RK_AlphaCoeff);
AddRes_RMS(iVar, Res*Res);
- AddRes_Max(iVar, fabs(Res), geometry->node[iPoint]->GetGlobalIndex(), geometry->node[iPoint]->GetCoord());
+ AddRes_Max(iVar, fabs(Res), geometry->nodes->GetGlobalIndex(iPoint), geometry->nodes->GetCoord(iPoint));
}
}
@@ -2206,7 +2206,7 @@ void CAdjEulerSolver::ExplicitEuler_Iteration(CGeometry *geometry, CSolver **sol
/*--- Update the solution ---*/
for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
- Vol = geometry->node[iPoint]->GetVolume();
+ Vol = geometry->nodes->GetVolume(iPoint);
Delta = solver_container[FLOW_SOL]->GetNodes()->GetDelta_Time(iPoint) / Vol;
local_Res_TruncError = nodes->GetResTruncError(iPoint);
@@ -2216,7 +2216,7 @@ void CAdjEulerSolver::ExplicitEuler_Iteration(CGeometry *geometry, CSolver **sol
Res = local_Residual[iVar] + local_Res_TruncError[iVar];
nodes->AddSolution(iPoint,iVar, -Res*Delta);
AddRes_RMS(iVar, Res*Res);
- AddRes_Max(iVar, fabs(Res), geometry->node[iPoint]->GetGlobalIndex(), geometry->node[iPoint]->GetCoord());
+ AddRes_Max(iVar, fabs(Res), geometry->nodes->GetGlobalIndex(iPoint), geometry->nodes->GetCoord(iPoint));
}
}
@@ -2254,7 +2254,7 @@ void CAdjEulerSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **sol
/*--- Read the volume ---*/
- Vol = geometry->node[iPoint]->GetVolume();
+ Vol = geometry->nodes->GetVolume(iPoint);
/*--- Modify matrix diagonal to assure diagonal dominance ---*/
@@ -2278,7 +2278,7 @@ void CAdjEulerSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **sol
LinSysRes[total_index] = -(LinSysRes[total_index] + local_Res_TruncError[iVar]);
LinSysSol[total_index] = 0.0;
AddRes_RMS(iVar, LinSysRes[total_index]*LinSysRes[total_index]);
- AddRes_Max(iVar, fabs(LinSysRes[total_index]), geometry->node[iPoint]->GetGlobalIndex(), geometry->node[iPoint]->GetCoord());
+ AddRes_Max(iVar, fabs(LinSysRes[total_index]), geometry->nodes->GetGlobalIndex(iPoint), geometry->nodes->GetCoord(iPoint));
}
}
@@ -2390,7 +2390,7 @@ void CAdjEulerSolver::Inviscid_Sensitivity(CGeometry *geometry, CSolver **solver
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
Psi = nodes->GetSolution(iPoint);
U = solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint);
Enthalpy = solver_container[FLOW_SOL]->GetNodes()->GetEnthalpy(iPoint);
@@ -2401,8 +2401,8 @@ void CAdjEulerSolver::Inviscid_Sensitivity(CGeometry *geometry, CSolver **solver
/*--- Also load the auxiliary variable for first neighbors ---*/
- for (iNeigh = 0; iNeigh < geometry->node[iPoint]->GetnPoint(); iNeigh++) {
- Neigh = geometry->node[iPoint]->GetPoint(iNeigh);
+ for (iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); iNeigh++) {
+ Neigh = geometry->nodes->GetPoint(iPoint, iNeigh);
Psi = nodes->GetSolution(Neigh);
U = solver_container[FLOW_SOL]->GetNodes()->GetSolution(Neigh);
Enthalpy = solver_container[FLOW_SOL]->GetNodes()->GetEnthalpy(Neigh);
@@ -2425,7 +2425,7 @@ void CAdjEulerSolver::Inviscid_Sensitivity(CGeometry *geometry, CSolver **solver
if (config->GetMarker_All_KindBC(iMarker) == EULER_WALL) {
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
d = nodes->GetForceProj_Vector(iPoint);
Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
@@ -2456,7 +2456,7 @@ void CAdjEulerSolver::Inviscid_Sensitivity(CGeometry *geometry, CSolver **solver
/*--- Additional sensitivity term for grid movement ---*/
if (grid_movement) {
- GridVel = geometry->node[iPoint]->GetGridVel();
+ GridVel = geometry->nodes->GetGridVel(iPoint);
v_gradconspsi -= GridVel[iDim] * ConsPsi_Grad[iDim];
}
@@ -2470,7 +2470,7 @@ void CAdjEulerSolver::Inviscid_Sensitivity(CGeometry *geometry, CSolver **solver
if (config->GetSens_Remove_Sharp()) {
eps = config->GetVenkat_LimiterCoeff()*config->GetRefElemLength();
- if ( geometry->node[iPoint]->GetSharpEdge_Distance() < config->GetAdjSharp_LimiterCoeff()*eps )
+ if ( geometry->nodes->GetSharpEdge_Distance(iPoint) < config->GetAdjSharp_LimiterCoeff()*eps )
CSensitivity[iMarker][iVertex] = 0.0;
}
@@ -2495,7 +2495,7 @@ void CAdjEulerSolver::Inviscid_Sensitivity(CGeometry *geometry, CSolver **solver
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
Psi = nodes->GetSolution(iPoint);
U = solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint);
Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
@@ -2542,7 +2542,7 @@ void CAdjEulerSolver::Inviscid_Sensitivity(CGeometry *geometry, CSolver **solver
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
Psi = nodes->GetSolution(iPoint);
U = solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint);
Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
@@ -2693,7 +2693,7 @@ void CAdjEulerSolver::Inviscid_Sensitivity(CGeometry *geometry, CSolver **solver
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
p = solver_container[FLOW_SOL]->GetNodes()->GetPressure(iPoint);
@@ -2821,9 +2821,9 @@ void CAdjEulerSolver::Smooth_Sensitivity(CGeometry *geometry, CSolver **solver_c
ArchLength[0] = 0.0;
for (iVertex = 1; iVertex < nVertex; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex-1]->GetNode();
- Coord_begin = geometry->node[iPoint]->GetCoord();
+ Coord_begin = geometry->nodes->GetCoord(iPoint);
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- Coord_end = geometry->node[iPoint]->GetCoord();
+ Coord_end = geometry->nodes->GetCoord(iPoint);
dist = sqrt (pow( Coord_end[0]-Coord_begin[0], 2.0) + pow( Coord_end[1]-Coord_begin[1], 2.0));
ArchLength[iVertex] = ArchLength[iVertex-1] + dist;
}
@@ -3049,7 +3049,7 @@ void CAdjEulerSolver::BC_Euler_Wall(CGeometry *geometry,
for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
Normal = geometry->vertex[val_marker][iVertex]->GetNormal();
/*--- Create a copy of the adjoint solution ---*/
@@ -3085,7 +3085,7 @@ void CAdjEulerSolver::BC_Euler_Wall(CGeometry *geometry,
/*--- Extra boundary term for grid movement ---*/
if (grid_movement) {
su2double ProjGridVel = 0.0;
- su2double *GridVel = geometry->node[iPoint]->GetGridVel();
+ su2double *GridVel = geometry->nodes->GetGridVel(iPoint);
for (iDim = 0; iDim < nDim; iDim++)
ProjGridVel += GridVel[iDim]*UnitNormal[iDim];
phin -= Psi[nVar-1]*ProjGridVel;
@@ -3111,7 +3111,7 @@ void CAdjEulerSolver::BC_Euler_Wall(CGeometry *geometry,
/*--- Flux adjustment for grid movement ---*/
if (grid_movement) {
su2double ProjGridVel = 0.0;
- su2double *GridVel = geometry->node[iPoint]->GetGridVel();
+ su2double *GridVel = geometry->nodes->GetGridVel(iPoint);
for (iDim = 0; iDim < nDim; iDim++)
ProjGridVel -= GridVel[iDim]*Normal[iDim];
Residual[0] -= ProjGridVel*Psi[0];
@@ -3146,7 +3146,7 @@ void CAdjEulerSolver::BC_Euler_Wall(CGeometry *geometry,
/*--- Jacobian contribution due to grid movement ---*/
if (grid_movement) {
su2double ProjGridVel = 0.0;
- su2double *GridVel = geometry->node[iPoint]->GetGridVel();
+ su2double *GridVel = geometry->nodes->GetGridVel(iPoint);
for (iDim = 0; iDim < nDim; iDim++)
ProjGridVel -= GridVel[iDim]*Normal[iDim];
Jacobian_ii[0][0] -= ProjGridVel;
@@ -3193,7 +3193,7 @@ void CAdjEulerSolver::BC_Sym_Plane(CGeometry *geometry, CSolver **solver_contain
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
geometry->vertex[val_marker][iVertex]->GetNormal(Normal);
@@ -3229,7 +3229,7 @@ void CAdjEulerSolver::BC_Sym_Plane(CGeometry *geometry, CSolver **solver_contain
if (grid_movement) {
su2double ProjGridVel = 0.0;
- su2double *GridVel = geometry->node[iPoint]->GetGridVel();
+ su2double *GridVel = geometry->nodes->GetGridVel(iPoint);
for (iDim = 0; iDim < nDim; iDim++) {
ProjGridVel += GridVel[iDim]*UnitNormal[iDim];
}
@@ -3260,7 +3260,7 @@ void CAdjEulerSolver::BC_Sym_Plane(CGeometry *geometry, CSolver **solver_contain
if (grid_movement) {
su2double ProjGridVel = 0.0;
- su2double *GridVel = geometry->node[iPoint]->GetGridVel();
+ su2double *GridVel = geometry->nodes->GetGridVel(iPoint);
for (iDim = 0; iDim < nDim; iDim++)
ProjGridVel -= GridVel[iDim]*Normal[iDim];
Residual_i[0] -= ProjGridVel*Psi_domain[0];
@@ -3305,7 +3305,7 @@ void CAdjEulerSolver::BC_Sym_Plane(CGeometry *geometry, CSolver **solver_contain
if (grid_movement) {
su2double ProjGridVel = 0.0;
- su2double *GridVel = geometry->node[iPoint]->GetGridVel();
+ su2double *GridVel = geometry->nodes->GetGridVel(iPoint);
for (iDim = 0; iDim < nDim; iDim++)
ProjGridVel -= GridVel[iDim]*Normal[iDim];
Jacobian_ii[0][0] -= ProjGridVel;
@@ -3347,10 +3347,10 @@ void CAdjEulerSolver::BC_Interface_Boundary(CGeometry *geometry, CSolver **solve
for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
- GlobalIndex_iPoint = geometry->node[iPoint]->GetGlobalIndex();
+ GlobalIndex_iPoint = geometry->nodes->GetGlobalIndex(iPoint);
GlobalIndex_jPoint = GetDonorGlobalIndex(val_marker, iVertex);
- if ((geometry->node[iPoint]->GetDomain()) && (GlobalIndex_iPoint != GlobalIndex_jPoint)) {
+ if ((geometry->nodes->GetDomain(iPoint)) && (GlobalIndex_iPoint != GlobalIndex_jPoint)) {
/*--- Store the solution for both points ---*/
@@ -3412,10 +3412,10 @@ void CAdjEulerSolver::BC_NearField_Boundary(CGeometry *geometry, CSolver **solve
for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
- GlobalIndex_iPoint = geometry->node[iPoint]->GetGlobalIndex();
+ GlobalIndex_iPoint = geometry->nodes->GetGlobalIndex(iPoint);
GlobalIndex_jPoint = GetDonorGlobalIndex(val_marker, iVertex);
- if ((geometry->node[iPoint]->GetDomain()) && (GlobalIndex_iPoint != GlobalIndex_jPoint)) {
+ if ((geometry->nodes->GetDomain(iPoint)) && (GlobalIndex_iPoint != GlobalIndex_jPoint)) {
/*--- Store the solution for both points ---*/
@@ -3513,7 +3513,7 @@ void CAdjEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain
/*--- If the node belongs to the domain ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Index of the closest interior node ---*/
@@ -3546,7 +3546,7 @@ void CAdjEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain
/*--- Grid Movement ---*/
if (grid_movement)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint));
/*--- Compute the upwind flux ---*/
@@ -3567,7 +3567,7 @@ void CAdjEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain
/*--- Points in edge, coordinates and normal vector---*/
- visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+ visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
visc_numerics->SetNormal(Normal);
/*--- Conservative variables w/o reconstruction and adjoint variables w/o reconstruction---*/
@@ -3619,7 +3619,7 @@ void CAdjEulerSolver::BC_Supersonic_Inlet(CGeometry *geometry, CSolver **solver_
/*--- Check that the node belongs to the domain (i.e., not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Normal vector for this vertex (negate for outward convention) ---*/
@@ -3653,8 +3653,8 @@ void CAdjEulerSolver::BC_Supersonic_Inlet(CGeometry *geometry, CSolver **solver_
/*--- Grid Movement ---*/
if (grid_movement)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
- geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint),
+ geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
@@ -3680,7 +3680,7 @@ void CAdjEulerSolver::BC_Supersonic_Inlet(CGeometry *geometry, CSolver **solver_
/*--- Points in edge, coordinates and normal vector---*/
- visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+ visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
visc_numerics->SetNormal(Normal);
/*--- Conservative variables w/o reconstruction and adjoint variables w/o reconstruction---*/
@@ -3734,7 +3734,7 @@ void CAdjEulerSolver::BC_Supersonic_Outlet(CGeometry *geometry, CSolver **solver
/*--- Check that the node belongs to the domain (i.e., not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Normal vector for this vertex (negate for outward convention) ---*/
@@ -3768,8 +3768,8 @@ void CAdjEulerSolver::BC_Supersonic_Outlet(CGeometry *geometry, CSolver **solver
/*--- Grid Movement ---*/
if (grid_movement)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
- geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint),
+ geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
@@ -3795,7 +3795,7 @@ void CAdjEulerSolver::BC_Supersonic_Outlet(CGeometry *geometry, CSolver **solver
/*--- Points in edge, coordinates and normal vector---*/
- visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+ visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
visc_numerics->SetNormal(Normal);
/*--- Conservative variables w/o reconstruction and adjoint variables w/o reconstruction---*/
@@ -3852,7 +3852,7 @@ void CAdjEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container,
/*--- Check that the node belongs to the domain (i.e., not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Normal vector for this vertex (negate for outward convention) ---*/
@@ -3923,7 +3923,7 @@ void CAdjEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container,
/*--- Extra boundary term for grid movement ---*/
if (grid_movement) {
ProjGridVel = 0.0;
- GridVel = geometry->node[iPoint]->GetGridVel();
+ GridVel = geometry->nodes->GetGridVel(iPoint);
for (iDim = 0; iDim < nDim; iDim++)
ProjGridVel += GridVel[iDim]*UnitNormal[iDim];
bcn -= (1.0/Gamma_Minus_One)*ProjGridVel;
@@ -3944,8 +3944,8 @@ void CAdjEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container,
/*--- Grid Movement ---*/
if (grid_movement)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
- geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint),
+ geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
@@ -3970,7 +3970,7 @@ void CAdjEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container,
/*--- Points in edge, coordinates and normal vector---*/
- visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+ visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
visc_numerics->SetNormal(Normal);
/*--- Conservative variables w/o reconstruction and adjoint variables w/o reconstruction---*/
@@ -4043,7 +4043,7 @@ void CAdjEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
/*--- If the node belong to the domain ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Normal vector for this vertex (negate for outward convention) ---*/
@@ -4063,7 +4063,7 @@ void CAdjEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor();
- conv_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+ conv_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
/*--- Allocate the value at the outlet ---*/
@@ -4097,7 +4097,7 @@ void CAdjEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
}
/*--- Extra boundary term for grid movement ---*/
if (grid_movement) {
- su2double *GridVel = geometry->node[iPoint]->GetGridVel();
+ su2double *GridVel = geometry->nodes->GetGridVel(iPoint);
for (iDim = 0; iDim < nDim; iDim++)
ProjGridVel += GridVel[iDim]*UnitNormal[iDim];
}
@@ -4166,7 +4166,7 @@ void CAdjEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
if (grid_movement) {
ProjGridVel = 0.0;
- su2double *GridVel = geometry->node[iPoint]->GetGridVel();
+ su2double *GridVel = geometry->nodes->GetGridVel(iPoint);
for (iDim = 0; iDim < nDim; iDim++)
ProjGridVel += GridVel[iDim]*UnitNormal[iDim];
}
@@ -4228,8 +4228,8 @@ void CAdjEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
/*--- Grid Movement ---*/
if (grid_movement)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
- geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint),
+ geometry->nodes->GetGridVel(iPoint));
conv_numerics->ComputeResidual(Residual_i, Residual_j, Jacobian_ii, Jacobian_ij,
Jacobian_ji, Jacobian_jj, config);
@@ -4253,7 +4253,7 @@ void CAdjEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
/*--- Points in edge, coordinates and normal vector---*/
visc_numerics->SetNormal(Normal);
- visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+ visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
/*--- Conservative variables w/o reconstruction and adjoint variables w/o reconstruction---*/
@@ -4312,7 +4312,7 @@ void CAdjEulerSolver::BC_Engine_Inflow(CGeometry *geometry, CSolver **solver_con
/*--- If the node belong to the domain ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Normal vector for this vertex (negate for outward convention) ---*/
@@ -4435,7 +4435,7 @@ void CAdjEulerSolver::BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_co
/*--- Check that the node belongs to the domain (i.e., not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Normal vector for this vertex (negate for outward convention) ---*/
@@ -4516,11 +4516,11 @@ void CAdjEulerSolver::BC_ActDisk_Inlet(CGeometry *geometry, CSolver **solver_con
GlobalIndex_inlet = solver_container[FLOW_SOL]->GetDonorGlobalIndex(val_marker, iVertex);
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
- GlobalIndex = geometry->node[iPoint]->GetGlobalIndex();
+ GlobalIndex = geometry->nodes->GetGlobalIndex(iPoint);
/*--- If the node belong to the domain ---*/
- if ((geometry->node[iPoint]->GetDomain()) && (GlobalIndex != GlobalIndex_inlet)) {
+ if ((geometry->nodes->GetDomain(iPoint)) && (GlobalIndex != GlobalIndex_inlet)) {
/*--- Normal vector for this vertex (negate for outward convention) ---*/
@@ -4649,11 +4649,11 @@ void CAdjEulerSolver::BC_ActDisk_Outlet(CGeometry *geometry, CSolver **solver_co
GlobalIndex_inlet = solver_container[FLOW_SOL]->GetDonorGlobalIndex(val_marker, iVertex);
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
- GlobalIndex = geometry->node[iPoint]->GetGlobalIndex();
+ GlobalIndex = geometry->nodes->GetGlobalIndex(iPoint);
/*--- Check that the node belongs to the domain (i.e., not a halo node) and to discard the perimeter ---*/
- if ((geometry->node[iPoint]->GetDomain()) && (GlobalIndex != GlobalIndex_inlet)) {
+ if ((geometry->nodes->GetDomain(iPoint)) && (GlobalIndex != GlobalIndex_inlet)) {
/*--- Normal vector for this vertex (negate for outward convention) ---*/
@@ -4743,14 +4743,14 @@ void CAdjEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
/*--- Volume at time n-1 and n ---*/
if (Grid_Movement) {
- Volume_nM1 = geometry->node[iPoint]->GetVolume_nM1();
- Volume_n = geometry->node[iPoint]->GetVolume_n();
- Volume_nP1 = geometry->node[iPoint]->GetVolume();
+ Volume_nM1 = geometry->nodes->GetVolume_nM1(iPoint);
+ Volume_n = geometry->nodes->GetVolume_n(iPoint);
+ Volume_nP1 = geometry->nodes->GetVolume(iPoint);
}
else {
- Volume_nM1 = geometry->node[iPoint]->GetVolume();
- Volume_n = geometry->node[iPoint]->GetVolume();
- Volume_nP1 = geometry->node[iPoint]->GetVolume();
+ Volume_nM1 = geometry->nodes->GetVolume(iPoint);
+ Volume_n = geometry->nodes->GetVolume(iPoint);
+ Volume_nP1 = geometry->nodes->GetVolume(iPoint);
}
/*--- Time Step ---*/
@@ -4870,11 +4870,11 @@ void CAdjEulerSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConf
for (iMesh = 1; iMesh <= config->GetnMGLevels(); iMesh++) {
for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) {
- Area_Parent = geometry[iMesh]->node[iPoint]->GetVolume();
+ Area_Parent = geometry[iMesh]->nodes->GetVolume(iPoint);
for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 0.0;
- for (iChildren = 0; iChildren < geometry[iMesh]->node[iPoint]->GetnChildren_CV(); iChildren++) {
- Point_Fine = geometry[iMesh]->node[iPoint]->GetChildren_CV(iChildren);
- Area_Children = geometry[iMesh-1]->node[Point_Fine]->GetVolume();
+ for (iChildren = 0; iChildren < geometry[iMesh]->nodes->GetnChildren_CV(iPoint); iChildren++) {
+ Point_Fine = geometry[iMesh]->nodes->GetChildren_CV(iPoint, iChildren);
+ Area_Children = geometry[iMesh-1]->nodes->GetVolume(Point_Fine);
Solution_Fine = solver[iMesh-1][ADJFLOW_SOL]->GetNodes()->GetSolution(Point_Fine);
for (iVar = 0; iVar < nVar; iVar++) {
Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent;
diff --git a/SU2_CFD/src/solvers/CAdjNSSolver.cpp b/SU2_CFD/src/solvers/CAdjNSSolver.cpp
index 5cccaabcee8a..72e47c79bc5f 100644
--- a/SU2_CFD/src/solvers/CAdjNSSolver.cpp
+++ b/SU2_CFD/src/solvers/CAdjNSSolver.cpp
@@ -251,7 +251,7 @@ CAdjNSSolver::CAdjNSSolver(CGeometry *geometry, CConfig *config, unsigned short
iMarker = jMarker;
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
Area = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
@@ -352,7 +352,7 @@ void CAdjNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container
/*--- Get the distance form a sharp edge ---*/
- SharpEdge_Distance = geometry->node[iPoint]->GetSharpEdge_Distance();
+ SharpEdge_Distance = geometry->nodes->GetSharpEdge_Distance(iPoint);
/*--- Set the primitive variables compressible
adjoint variables ---*/
@@ -432,7 +432,7 @@ void CAdjNSSolver::Viscous_Residual(CGeometry *geometry, CSolver **solver_contai
iPoint = geometry->edges->GetNode(iEdge,0);
jPoint = geometry->edges->GetNode(iEdge,1);
- numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[jPoint]->GetCoord());
+ numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(jPoint));
numerics->SetNormal(geometry->edges->GetNormal(iEdge));
/*--- Primitive variables w/o reconstruction and adjoint variables w/o reconstruction---*/
@@ -494,7 +494,7 @@ void CAdjNSSolver::Source_Residual(CGeometry *geometry, CSolver **solver_contain
/*--- Set volume ---*/
- numerics->SetVolume(geometry->node[iPoint]->GetVolume());
+ numerics->SetVolume(geometry->nodes->GetVolume(iPoint));
/*--- If turbulence computation we must add some coupling terms to the NS adjoint eq. ---*/
@@ -514,7 +514,7 @@ void CAdjNSSolver::Source_Residual(CGeometry *geometry, CSolver **solver_contain
/*--- Set distance to the surface ---*/
- numerics->SetDistance(geometry->node[iPoint]->GetWall_Distance(), 0.0);
+ numerics->SetDistance(geometry->nodes->GetWall_Distance(iPoint), 0.0);
}
@@ -567,7 +567,7 @@ void CAdjNSSolver::Source_Residual(CGeometry *geometry, CSolver **solver_contain
/*--- Set distance to the surface ---*/
- second_numerics->SetDistance(geometry->node[iPoint]->GetWall_Distance(), geometry->node[jPoint]->GetWall_Distance());
+ second_numerics->SetDistance(geometry->nodes->GetWall_Distance(iPoint), geometry->nodes->GetWall_Distance(jPoint));
/*--- Update adjoint viscous residual ---*/
@@ -593,7 +593,7 @@ void CAdjNSSolver::Source_Residual(CGeometry *geometry, CSolver **solver_contain
nodes->GetSolution(iPoint));
/*--- Load the volume of the dual mesh cell ---*/
- second_numerics->SetVolume(geometry->node[iPoint]->GetVolume());
+ second_numerics->SetVolume(geometry->nodes->GetVolume(iPoint));
/*--- Compute the adjoint rotating frame source residual ---*/
second_numerics->ComputeResidual(Residual, Jacobian_i, config);
@@ -613,8 +613,13 @@ void CAdjNSSolver::Viscous_Sensitivity(CGeometry *geometry, CSolver **solver_con
unsigned long iVertex, iPoint;
unsigned short iDim, jDim, iMarker, iPos, jPos;
su2double *d = NULL, **PsiVar_Grad = NULL, **PrimVar_Grad = NULL, div_phi, *Normal = NULL, Area,
- normal_grad_psi5, normal_grad_T, sigma_partial, Laminar_Viscosity = 0.0, heat_flux_factor, temp_sens = 0.0, *Psi = NULL, *U = NULL, Enthalpy, **GridVel_Grad, gradPsi5_v, psi5_tau_partial, psi5_tau_grad_vel, source_v_1, Density, Pressure = 0.0, div_vel, val_turb_ke, vartheta, vartheta_partial, psi5_p_div_vel, Omega[3], rho_v[3] = {0.0,0.0,0.0}, CrossProduct[3], delta[3][3] = {{1.0, 0.0, 0.0},{0.0,1.0,0.0},{0.0,0.0,1.0}}, r, ru, rv, rw, rE, p, T, dp_dr, dp_dru, dp_drv, dp_drw, dp_drE, dH_dr, dH_dru, dH_drv, dH_drw, dH_drE, H, D[3][3], Dd[3], Mach_Inf, eps, scale = 1.0;
- su2double RefVel2, RefDensity, Mach2Vel, *Velocity_Inf, factor;
+ normal_grad_psi5, normal_grad_T, sigma_partial, Laminar_Viscosity = 0.0, heat_flux_factor, temp_sens = 0.0,
+ *Psi = NULL, *U = NULL, Enthalpy, gradPsi5_v, psi5_tau_partial, psi5_tau_grad_vel, source_v_1, Density,
+ Pressure = 0.0, div_vel, val_turb_ke, vartheta, vartheta_partial, psi5_p_div_vel, Omega[3], rho_v[3] = {0.0,0.0,0.0},
+ CrossProduct[3], delta[3][3] = {{1.0, 0.0, 0.0},{0.0,1.0,0.0},{0.0,0.0,1.0}}, r, ru, rv, rw, rE, p, T, dp_dr, dp_dru,
+ dp_drv, dp_drw, dp_drE, dH_dr, dH_dru, dH_drv, dH_drw, dH_drE, H, D[3][3], Dd[3], Mach_Inf, eps, scale = 1.0,
+ RefVel2, RefDensity, Mach2Vel, *Velocity_Inf, factor;
+ const su2double* const* GridVel_Grad;
su2double *USens = new su2double[nVar];
su2double *UnitNormal = new su2double[nDim];
@@ -704,7 +709,7 @@ void CAdjNSSolver::Viscous_Sensitivity(CGeometry *geometry, CSolver **solver_con
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
PsiVar_Grad = nodes->GetGradient(iPoint);
PrimVar_Grad = solver_container[FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint);
@@ -804,7 +809,7 @@ void CAdjNSSolver::Viscous_Sensitivity(CGeometry *geometry, CSolver **solver_con
/*--- Form normal_grad_gridvel = \partial_n (u_omega) ---*/
- GridVel_Grad = geometry->node[iPoint]->GetGridVel_Grad();
+ GridVel_Grad = geometry->nodes->GetGridVel_Grad(iPoint);
for (iDim = 0; iDim < nDim; iDim++) {
normal_grad_gridvel[iDim] = 0.0;
for (jDim = 0; jDim < nDim; jDim++)
@@ -903,7 +908,7 @@ void CAdjNSSolver::Viscous_Sensitivity(CGeometry *geometry, CSolver **solver_con
if (config->GetSens_Remove_Sharp()) {
eps = config->GetVenkat_LimiterCoeff()*config->GetRefElemLength();
- if ( geometry->node[iPoint]->GetSharpEdge_Distance() < config->GetAdjSharp_LimiterCoeff()*eps )
+ if ( geometry->nodes->GetSharpEdge_Distance(iPoint) < config->GetAdjSharp_LimiterCoeff()*eps )
CSensitivity[iMarker][iVertex] = 0.0;
}
@@ -934,7 +939,7 @@ void CAdjNSSolver::Viscous_Sensitivity(CGeometry *geometry, CSolver **solver_con
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
Psi = nodes->GetSolution(iPoint);
U = solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint);
Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
@@ -1088,7 +1093,7 @@ void CAdjNSSolver::Viscous_Sensitivity(CGeometry *geometry, CSolver **solver_con
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
p = solver_container[FLOW_SOL]->GetNodes()->GetPressure(iPoint);
@@ -1242,7 +1247,7 @@ void CAdjNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_contai
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Normal vector for this vertex (negate for outward convention) ---*/
@@ -1272,7 +1277,7 @@ void CAdjNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_contai
/*--- Correct the adjoint velocity BC for dynamic meshes ---*/
if (grid_movement) {
- GridVel = geometry->node[iPoint]->GetGridVel();
+ GridVel = geometry->nodes->GetGridVel(iPoint);
for (iDim = 0; iDim < nDim; iDim++)
phi[iDim] -= Psi[nDim+1]*GridVel[iDim];
}
@@ -1306,7 +1311,7 @@ void CAdjNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_contai
/*--- Get the grid velocity at this node and impose v = u_wall ---*/
- GridVel = geometry->node[iPoint]->GetGridVel();
+ GridVel = geometry->nodes->GetGridVel(iPoint);
for (iDim = 0; iDim < nDim; iDim++) Velocity[iDim] = GridVel[iDim];
/*--- Get some additional quantities from the flow solution ---*/
@@ -1389,8 +1394,8 @@ void CAdjNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_contai
/*--- Get coordinates of i & nearest normal and compute distance ---*/
- Coord_i = geometry->node[iPoint]->GetCoord();
- Coord_j = geometry->node[Point_Normal]->GetCoord();
+ Coord_i = geometry->nodes->GetCoord(iPoint);
+ Coord_j = geometry->nodes->GetCoord(Point_Normal);
dist_ij_2 = 0.0;
for (iDim = 0; iDim < nDim; iDim++) {
Edge_Vector[iDim] = Coord_j[iDim]-Coord_i[iDim];
@@ -1462,8 +1467,8 @@ void CAdjNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_contai
/*--- Get coordinates of i & nearest normal and compute distance ---*/
- Coord_i = geometry->node[iPoint]->GetCoord();
- Coord_j = geometry->node[Point_Normal]->GetCoord();
+ Coord_i = geometry->nodes->GetCoord(iPoint);
+ Coord_j = geometry->nodes->GetCoord(Point_Normal);
dist_ij_2 = 0.0;
for (iDim = 0; iDim < nDim; iDim++) {
Edge_Vector[iDim] = Coord_j[iDim]-Coord_i[iDim];
@@ -1625,7 +1630,7 @@ void CAdjNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_cont
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Initialize the convective & viscous residuals to zero ---*/
for (iVar = 0; iVar < nVar; iVar++) {
@@ -1643,7 +1648,7 @@ void CAdjNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_cont
/*--- Normal vector for this vertex (negate for outward convention) ---*/
geometry->vertex[val_marker][iVertex]->GetNormal(Normal);
- Volume = geometry->node[iPoint]->GetVolume();
+ Volume = geometry->nodes->GetVolume(iPoint);
for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim];
/*--- Get the force projection vector (based on the objective function) ---*/
@@ -1651,7 +1656,7 @@ void CAdjNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_cont
/*--- Adjustments to strong boundary condition for dynamic meshes ---*/
if ( grid_movement) {
- GridVel = geometry->node[iPoint]->GetGridVel();
+ GridVel = geometry->nodes->GetGridVel(iPoint);
for (iDim = 0; iDim < nDim; iDim++) {
phi[iDim] = d[iDim] - Psi[nVar-1]*GridVel[iDim];
}
@@ -1780,7 +1785,7 @@ void CAdjNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_cont
if (grid_movement) {
/*--- Get the appropriate grid velocity at this node ---*/
- GridVel = geometry->node[iPoint]->GetGridVel();
+ GridVel = geometry->nodes->GetGridVel(iPoint);
/*--- Get the enthalpy from the direct solution ---*/
Enthalpy = solver_container[FLOW_SOL]->GetNodes()->GetEnthalpy(iPoint);
diff --git a/SU2_CFD/src/solvers/CAdjTurbSolver.cpp b/SU2_CFD/src/solvers/CAdjTurbSolver.cpp
index 63dbc706e26b..0f58d320d42c 100644
--- a/SU2_CFD/src/solvers/CAdjTurbSolver.cpp
+++ b/SU2_CFD/src/solvers/CAdjTurbSolver.cpp
@@ -203,7 +203,7 @@ void CAdjTurbSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_cont
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
Solution[0] = 0.0;
@@ -227,7 +227,7 @@ void CAdjTurbSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_co
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
Solution[0] = 0.0;
@@ -358,8 +358,8 @@ void CAdjTurbSolver::Viscous_Residual(CGeometry *geometry, CSolver **solver_cont
jPoint = geometry->edges->GetNode(iEdge,1);
/*--- Points coordinates, and set normal vectors and length ---*/
- Coord_i = geometry->node[iPoint]->GetCoord();
- Coord_j = geometry->node[jPoint]->GetCoord();
+ Coord_i = geometry->nodes->GetCoord(iPoint);
+ Coord_j = geometry->nodes->GetCoord(jPoint);
numerics->SetCoord(Coord_i, Coord_j);
numerics->SetNormal(geometry->edges->GetNormal(iEdge));
@@ -434,8 +434,8 @@ void CAdjTurbSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta
numerics->SetAdjointVarGradient(PsiVar_Grad_i, NULL);
/*--- Set volume and distances to the surface ---*/
- numerics->SetVolume(geometry->node[iPoint]->GetVolume());
- numerics->SetDistance(geometry->node[iPoint]->GetWall_Distance(), 0.0);
+ numerics->SetVolume(geometry->nodes->GetVolume(iPoint));
+ numerics->SetDistance(geometry->nodes->GetWall_Distance(iPoint), 0.0);
/*--- Add and Subtract Residual ---*/
numerics->ComputeResidual(Residual, Jacobian_ii, NULL, config);
@@ -499,7 +499,7 @@ void CAdjTurbSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solv
/*--- Read the volume ---*/
- Vol = geometry->node[iPoint]->GetVolume();
+ Vol = geometry->nodes->GetVolume(iPoint);
/*--- Modify matrix diagonal to assure diagonal dominance ---*/
@@ -514,7 +514,7 @@ void CAdjTurbSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solv
LinSysRes[total_index] = -LinSysRes[total_index];
LinSysSol[total_index] = 0.0;
AddRes_RMS(iVar, LinSysRes[total_index]*LinSysRes[total_index]);
- AddRes_Max(iVar, fabs(LinSysRes[total_index]), geometry->node[iPoint]->GetGlobalIndex(), geometry->node[iPoint]->GetCoord());
+ AddRes_Max(iVar, fabs(LinSysRes[total_index]), geometry->nodes->GetGlobalIndex(iPoint), geometry->nodes->GetCoord(iPoint));
}
}
diff --git a/SU2_CFD/src/solvers/CBaselineSolver.cpp b/SU2_CFD/src/solvers/CBaselineSolver.cpp
index 034f49442d1d..595a4cad4dc6 100644
--- a/SU2_CFD/src/solvers/CBaselineSolver.cpp
+++ b/SU2_CFD/src/solvers/CBaselineSolver.cpp
@@ -444,8 +444,8 @@ void CBaselineSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConf
}
for (iDim = 0; iDim < nDim; iDim++) {
- geometry[iInst]->node[iPoint_Local]->SetCoord(iDim, Coord[iDim]);
- geometry[iInst]->node[iPoint_Local]->SetGridVel(iDim, GridVel[iDim]);
+ geometry[iInst]->nodes->SetCoord(iPoint_Local, iDim, Coord[iDim]);
+ geometry[iInst]->nodes->SetGridVel(iPoint_Local, iDim, GridVel[iDim]);
}
}
diff --git a/SU2_CFD/src/solvers/CDiscAdjFEASolver.cpp b/SU2_CFD/src/solvers/CDiscAdjFEASolver.cpp
index 30779f3bb332..14c91a690025 100644
--- a/SU2_CFD/src/solvers/CDiscAdjFEASolver.cpp
+++ b/SU2_CFD/src/solvers/CDiscAdjFEASolver.cpp
@@ -120,7 +120,7 @@ CDiscAdjFEASolver::CDiscAdjFEASolver(CGeometry *geometry, CConfig *config, CSolv
for (iPoint = 0; iPoint < nPoint; iPoint++)
for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
- long iVertex = geometry->node[iPoint]->GetVertex(iMarker);
+ long iVertex = geometry->nodes->GetVertex(iPoint, iMarker);
if (iVertex >= 0) {
nodes->Set_isVertex(iPoint,true);
break;
@@ -649,20 +649,20 @@ void CDiscAdjFEASolver::ExtractAdjoint_Solution(CGeometry *geometry, CConfig *co
residual = nodes->GetSolution(iPoint, iVar) - nodes->GetSolution_Old(iPoint, iVar);
AddRes_RMS(iVar,residual*residual);
- AddRes_Max(iVar,fabs(residual),geometry->node[iPoint]->GetGlobalIndex(),geometry->node[iPoint]->GetCoord());
+ AddRes_Max(iVar,fabs(residual),geometry->nodes->GetGlobalIndex(iPoint),geometry->nodes->GetCoord(iPoint));
}
if (dynamic){
for (iVar = 0; iVar < nVar; iVar++){
residual = nodes->GetSolution_Accel(iPoint, iVar) - nodes->GetSolution_Old_Accel(iPoint, iVar);
AddRes_RMS(iVar,residual*residual);
- AddRes_Max(iVar,fabs(residual),geometry->node[iPoint]->GetGlobalIndex(),geometry->node[iPoint]->GetCoord());
+ AddRes_Max(iVar,fabs(residual),geometry->nodes->GetGlobalIndex(iPoint),geometry->nodes->GetCoord(iPoint));
}
for (iVar = 0; iVar < nVar; iVar++){
residual = nodes->GetSolution_Vel(iPoint, iVar) - nodes->GetSolution_Old_Vel(iPoint, iVar);
AddRes_RMS(iVar,residual*residual);
- AddRes_Max(iVar,fabs(residual),geometry->node[iPoint]->GetGlobalIndex(),geometry->node[iPoint]->GetCoord());
+ AddRes_Max(iVar,fabs(residual),geometry->nodes->GetGlobalIndex(iPoint),geometry->nodes->GetCoord(iPoint));
}
}
}
@@ -831,14 +831,14 @@ void CDiscAdjFEASolver::SetSensitivity(CGeometry *geometry, CSolver **solver, CC
for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) {
- su2double *Coord = geometry->node[iPoint]->GetCoord();
+ su2double *Coord = geometry->nodes->GetCoord(iPoint);
for (unsigned short iDim = 0; iDim < nDim; iDim++) {
su2double Sensitivity;
if(config->GetMultizone_Problem()) {
- Sensitivity = geometry->node[iPoint]->GetAdjointSolution(iDim);
+ Sensitivity = geometry->nodes->GetAdjointSolution(iPoint, iDim);
}
else {
Sensitivity = SU2_TYPE::GetDerivative(Coord[iDim]);
diff --git a/SU2_CFD/src/solvers/CDiscAdjMeshSolver.cpp b/SU2_CFD/src/solvers/CDiscAdjMeshSolver.cpp
index e22b5d9200ed..7fff445086f2 100644
--- a/SU2_CFD/src/solvers/CDiscAdjMeshSolver.cpp
+++ b/SU2_CFD/src/solvers/CDiscAdjMeshSolver.cpp
@@ -105,7 +105,7 @@ CDiscAdjMeshSolver::CDiscAdjMeshSolver(CGeometry *geometry, CConfig *config, CSo
nodes->SetSolution(iPoint,Solution);
for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
- long iVertex = geometry->node[iPoint]->GetVertex(iMarker);
+ long iVertex = geometry->nodes->GetVertex(iPoint, iMarker);
if (iVertex >= 0) {
nodes->Set_isVertex(iPoint,true);
break;
@@ -222,7 +222,7 @@ void CDiscAdjMeshSolver::SetSensitivity(CGeometry *geometry, CSolver **solver, C
/*--- If sharp edge, set the sensitivity to 0 on that region ---*/
if (config->GetSens_Remove_Sharp()) {
eps = config->GetVenkat_LimiterCoeff()*config->GetRefElemLength();
- if ( geometry->node[iPoint]->GetSharpEdge_Distance() < config->GetAdjSharp_LimiterCoeff()*eps )
+ if ( geometry->nodes->GetSharpEdge_Distance(iPoint) < config->GetAdjSharp_LimiterCoeff()*eps )
Sensitivity = 0.0;
}
diff --git a/SU2_CFD/src/solvers/CDiscAdjSolver.cpp b/SU2_CFD/src/solvers/CDiscAdjSolver.cpp
index 6d85ca7d52dd..f81083ab96c4 100644
--- a/SU2_CFD/src/solvers/CDiscAdjSolver.cpp
+++ b/SU2_CFD/src/solvers/CDiscAdjSolver.cpp
@@ -212,7 +212,7 @@ void CDiscAdjSolver::SetMesh_Recording(CGeometry** geometry, CVolumetricMovement
for (iPoint = 0; iPoint < nPoint; iPoint++){
for (iDim = 0; iDim < nDim; iDim++){
- geometry[MESH_0]->node[iPoint]->SetCoord(iDim,nodes->GetGeometry_Direct(iPoint,iDim));
+ geometry[MESH_0]->nodes->SetCoord(iPoint, iDim,nodes->GetGeometry_Direct(iPoint,iDim));
}
}
@@ -514,7 +514,7 @@ void CDiscAdjSolver::ExtractAdjoint_Solution(CGeometry *geometry, CConfig *confi
residual *= isdomain;
AddRes_RMS(iVar,pow(residual,2));
- AddRes_Max(iVar,fabs(residual),geometry->node[iPoint]->GetGlobalIndex(),geometry->node[iPoint]->GetCoord());
+ AddRes_Max(iVar,fabs(residual),geometry->nodes->GetGlobalIndex(iPoint),geometry->nodes->GetCoord(iPoint));
}
}
@@ -636,9 +636,9 @@ void CDiscAdjSolver::ExtractAdjoint_Geometry(CGeometry *geometry, CConfig *confi
/*--- Extract the adjoint solution ---*/
if (config->GetMultizone_Problem())
- geometry->node[iPoint]->GetAdjointCoord_LocalIndex(Solution_Geometry);
+ geometry->nodes->GetAdjointCoord_LocalIndex(iPoint, Solution_Geometry);
else
- geometry->node[iPoint]->GetAdjointCoord(Solution_Geometry);
+ geometry->nodes->GetAdjointCoord(iPoint, Solution_Geometry);
/*--- Store the adjoint solution ---*/
@@ -678,7 +678,7 @@ void CDiscAdjSolver::ExtractAdjoint_Geometry(CGeometry *geometry, CConfig *confi
// residual = node[iPoint]->GetSolution_Geometry(iVar) - node[iPoint]->Get_OldSolution_Geometry(iVar);
//
// AddRes_RMS(iVar,residual*residual);
-// AddRes_Max(iVar,fabs(residual),geometry->node[iPoint]->GetGlobalIndex(),geometry->node[iPoint]->GetCoord());
+// AddRes_Max(iVar,fabs(residual),geometry->nodes->GetGlobalIndex(iPoint),geometry->nodes->GetCoord(iPoint));
// }
// }
//
@@ -731,7 +731,7 @@ void CDiscAdjSolver::SetAdjoint_OutputMesh(CGeometry *geometry, CConfig *config)
for (iDim = 0; iDim < nDim; iDim++){
nodes->SetSensitivity(iPoint,iDim, Solution_Geometry[iDim]);
}
- geometry->node[iPoint]->SetAdjointCoord(Solution_Geometry);
+ geometry->nodes->SetAdjointCoord(iPoint, Solution_Geometry);
}
}
@@ -745,12 +745,12 @@ void CDiscAdjSolver::SetSensitivity(CGeometry *geometry, CSolver **solver, CConf
bool time_stepping = (config->GetTime_Marching() != STEADY);
for (iPoint = 0; iPoint < nPoint; iPoint++) {
- Coord = geometry->node[iPoint]->GetCoord();
+ Coord = geometry->nodes->GetCoord(iPoint);
for (iDim = 0; iDim < nDim; iDim++) {
if(config->GetMultizone_Problem()) {
- Sensitivity = geometry->node[iPoint]->GetAdjointSolution(iDim);
+ Sensitivity = geometry->nodes->GetAdjointSolution(iPoint, iDim);
}
else {
Sensitivity = SU2_TYPE::GetDerivative(Coord[iDim]);
@@ -764,7 +764,7 @@ void CDiscAdjSolver::SetSensitivity(CGeometry *geometry, CSolver **solver, CConf
if (config->GetSens_Remove_Sharp()) {
eps = config->GetVenkat_LimiterCoeff()*config->GetRefElemLength();
- if ( geometry->node[iPoint]->GetSharpEdge_Distance() < config->GetAdjSharp_LimiterCoeff()*eps )
+ if ( geometry->nodes->GetSharpEdge_Distance(iPoint) < config->GetAdjSharp_LimiterCoeff()*eps )
Sensitivity = 0.0;
}
if (!time_stepping) {
@@ -979,11 +979,11 @@ void CDiscAdjSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfi
for (iMesh = 1; iMesh <= config->GetnMGLevels(); iMesh++) {
for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) {
- Area_Parent = geometry[iMesh]->node[iPoint]->GetVolume();
+ Area_Parent = geometry[iMesh]->nodes->GetVolume(iPoint);
for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 0.0;
- for (iChildren = 0; iChildren < geometry[iMesh]->node[iPoint]->GetnChildren_CV(); iChildren++) {
- Point_Fine = geometry[iMesh]->node[iPoint]->GetChildren_CV(iChildren);
- Area_Children = geometry[iMesh-1]->node[Point_Fine]->GetVolume();
+ for (iChildren = 0; iChildren < geometry[iMesh]->nodes->GetnChildren_CV(iPoint); iChildren++) {
+ Point_Fine = geometry[iMesh]->nodes->GetChildren_CV(iPoint, iChildren);
+ Area_Children = geometry[iMesh-1]->nodes->GetVolume(Point_Fine);
Solution_Fine = solver[iMesh-1][ADJFLOW_SOL]->GetNodes()->GetSolution(Point_Fine);
for (iVar = 0; iVar < nVar; iVar++) {
Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent;
diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp
index c77115b9ad3c..c3a0a18bd538 100644
--- a/SU2_CFD/src/solvers/CEulerSolver.cpp
+++ b/SU2_CFD/src/solvers/CEulerSolver.cpp
@@ -1146,8 +1146,8 @@ void CEulerSolver::Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geomet
//ActDisk_Perimeter = geometry->vertex[iMarker][iVertex]->GetActDisk_Perimeter();
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
jDomain = geometry->vertex[iMarker][iVertex]->GetDonorProcessor();
-// if ((iDomain == jDomain) && (geometry->node[iPoint]->GetDomain()) && (!ActDisk_Perimeter)) {
- if ((iDomain == jDomain) && (geometry->node[iPoint]->GetDomain())) {
+// if ((iDomain == jDomain) && (geometry->nodes->GetDomain(iPoint)) && (!ActDisk_Perimeter)) {
+ if ((iDomain == jDomain) && (geometry->nodes->GetDomain(iPoint))) {
Buffer_Send_nPointTotal++;
}
}
@@ -1252,8 +1252,8 @@ void CEulerSolver::Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geomet
jDomain = geometry->vertex[iMarker][iVertex]->GetDonorProcessor();
//ActDisk_Perimeter = geometry->vertex[iMarker][iVertex]->GetActDisk_Perimeter();
-// if ((iDomain == jDomain) && (geometry->node[iPoint]->GetDomain()) && (!ActDisk_Perimeter)) {
- if ((iDomain == jDomain) && (geometry->node[iPoint]->GetDomain())) {
+// if ((iDomain == jDomain) && (geometry->nodes->GetDomain(iPoint)) && (!ActDisk_Perimeter)) {
+ if ((iDomain == jDomain) && (geometry->nodes->GetDomain(iPoint))) {
for (iVar = 0; iVar < nPrimVar; iVar++) {
Buffer_Send_PrimVar[(nPrimVar_)*(PointTotal_Counter+iPointTotal)+iVar] = nodes->GetPrimitive(iPoint,iVar);
@@ -1263,7 +1263,7 @@ void CEulerSolver::Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geomet
Buffer_Send_PrimVar[(nPrimVar_)*(PointTotal_Counter+iPointTotal)+(nPrimVar+1)] = 0.0;
}
- iGlobalIndex = geometry->node[iPoint]->GetGlobalIndex();
+ iGlobalIndex = geometry->nodes->GetGlobalIndex(iPoint);
jVertex = geometry->vertex[iMarker][iVertex]->GetDonorVertex();
jMarker = geometry->vertex[iMarker][iVertex]->GetDonorMarker();
@@ -1485,7 +1485,7 @@ void CEulerSolver::Set_MPI_Nearfield(CGeometry *geometry, CConfig *config) {
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
jDomain = geometry->vertex[iMarker][iVertex]->GetDonorProcessor();
- if ((iDomain == jDomain) && (geometry->node[iPoint]->GetDomain())) {
+ if ((iDomain == jDomain) && (geometry->nodes->GetDomain(iPoint))) {
Buffer_Send_nPointTotal++;
}
}
@@ -1585,8 +1585,8 @@ void CEulerSolver::Set_MPI_Nearfield(CGeometry *geometry, CConfig *config) {
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
jDomain = geometry->vertex[iMarker][iVertex]->GetDonorProcessor();
- if ((iDomain == jDomain) && (geometry->node[iPoint]->GetDomain())) {
- iGlobalIndex = geometry->node[iPoint]->GetGlobalIndex();
+ if ((iDomain == jDomain) && (geometry->nodes->GetDomain(iPoint))) {
+ iGlobalIndex = geometry->nodes->GetGlobalIndex(iPoint);
jVertex = geometry->vertex[iMarker][iVertex]->GetDonorVertex();
jMarker = geometry->vertex[iMarker][iVertex]->GetDonorMarker();
for (iVar = 0; iVar < nPrimVar; iVar++) {
@@ -2326,7 +2326,7 @@ void CEulerSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solver_c
for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) {
/* Set the pointers to the coordinates and solution of this DOF. */
- const su2double *coor = geometry[iMesh]->node[iPoint]->GetCoord();
+ const su2double *coor = geometry[iMesh]->nodes->GetCoord(iPoint);
su2double *solDOF = solver_container[iMesh][FLOW_SOL]->GetNodes()->GetSolution(iPoint);
/* Set the solution in this DOF to the initial condition provided by
@@ -2411,7 +2411,7 @@ void CEulerSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solver_c
Energy_CylND = Pressure_CylND/(Density_CylND*Gamma_Minus_One)+0.5*ModVel_CylND*ModVel_CylND;
- Coord = geometry[iMesh]->node[iPoint]->GetCoord();
+ Coord = geometry[iMesh]->nodes->GetCoord(iPoint);
SubsonicEngine_Cyl = config->GetSubsonicEngine_Cyl();
@@ -2709,8 +2709,6 @@ void CEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
SU2_OMP_FOR_DYN(omp_chunk_size)
for (iPoint = 0; iPoint < nPointDomain; ++iPoint) {
- auto node_i = geometry->node[iPoint];
-
/*--- Set maximum eigenvalues to zero. ---*/
nodes->SetMax_Lambda_Inv(iPoint,0.0);
@@ -2720,12 +2718,11 @@ void CEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
/*--- Loop over the neighbors of point i. ---*/
- for (unsigned short iNeigh = 0; iNeigh < node_i->GetnPoint(); ++iNeigh)
+ for (unsigned short iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh)
{
- jPoint = node_i->GetPoint(iNeigh);
- auto node_j = geometry->node[jPoint];
+ jPoint = geometry->nodes->GetPoint(iPoint,iNeigh);
- iEdge = node_i->GetEdge(iNeigh);
+ iEdge = geometry->nodes->GetEdge(iPoint,iNeigh);
Normal = geometry->edges->GetNormal(iEdge);
Area = 0.0; for (iDim = 0; iDim < nDim; iDim++) Area += pow(Normal[iDim],2); Area = sqrt(Area);
@@ -2737,8 +2734,8 @@ void CEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
/*--- Adjustment for grid movement ---*/
if (dynamic_grid) {
- const su2double *GridVel_i = node_i->GetGridVel();
- const su2double *GridVel_j = node_j->GetGridVel();
+ const su2double *GridVel_i = geometry->nodes->GetGridVel(iPoint);
+ const su2double *GridVel_j = geometry->nodes->GetGridVel(jPoint);
for (iDim = 0; iDim < nDim; iDim++)
Mean_ProjVel -= 0.5 * (GridVel_i[iDim] + GridVel_j[iDim]) * Normal[iDim];
@@ -2780,7 +2777,7 @@ void CEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (!geometry->node[iPoint]->GetDomain()) continue;
+ if (!geometry->nodes->GetDomain(iPoint)) continue;
Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
Area = 0.0; for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; Area = sqrt(Area);
@@ -2793,7 +2790,7 @@ void CEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
/*--- Adjustment for grid movement ---*/
if (dynamic_grid) {
- const su2double *GridVel = geometry->node[iPoint]->GetGridVel();
+ const su2double *GridVel = geometry->nodes->GetGridVel(iPoint);
for (iDim = 0; iDim < nDim; iDim++)
Mean_ProjVel -= GridVel[iDim]*Normal[iDim];
@@ -2830,7 +2827,7 @@ void CEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
SU2_OMP(for schedule(static,omp_chunk_size) nowait)
for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
- Vol = geometry->node[iPoint]->GetVolume();
+ Vol = geometry->nodes->GetVolume(iPoint);
if (Vol != 0.0) {
Local_Delta_Time = nodes->GetLocalCFL(iPoint)*Vol / nodes->GetMax_Lambda_Inv(iPoint);
@@ -2963,7 +2960,7 @@ void CEulerSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_conta
auto jPoint = geometry->edges->GetNode(iEdge,1);
numerics->SetNormal(geometry->edges->GetNormal(iEdge));
- numerics->SetNeighbor(geometry->node[iPoint]->GetnNeighbor(), geometry->node[jPoint]->GetnNeighbor());
+ numerics->SetNeighbor(geometry->nodes->GetnNeighbor(iPoint), geometry->nodes->GetnNeighbor(jPoint));
/*--- Set primitive variables w/o reconstruction ---*/
@@ -2985,7 +2982,7 @@ void CEulerSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_conta
/*--- Grid movement ---*/
if (dynamic_grid) {
- numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[jPoint]->GetGridVel());
+ numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(jPoint));
}
/*--- Compute residuals, and Jacobians ---*/
@@ -3068,8 +3065,8 @@ void CEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_contain
numerics->SetNormal(geometry->edges->GetNormal(iEdge));
- auto Coord_i = geometry->node[iPoint]->GetCoord();
- auto Coord_j = geometry->node[jPoint]->GetCoord();
+ auto Coord_i = geometry->nodes->GetCoord(iPoint);
+ auto Coord_j = geometry->nodes->GetCoord(jPoint);
/*--- Roe Turkel preconditioning ---*/
@@ -3083,8 +3080,8 @@ void CEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_contain
/*--- Grid movement ---*/
if (dynamic_grid) {
- numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
- geometry->node[jPoint]->GetGridVel());
+ numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint),
+ geometry->nodes->GetGridVel(jPoint));
}
/*--- Get primitive and secondary variables ---*/
@@ -3274,9 +3271,9 @@ void CEulerSolver::SumEdgeFluxes(CGeometry* geometry) {
LinSysRes.SetBlock_Zero(iPoint);
- for (unsigned short iNeigh = 0; iNeigh < geometry->node[iPoint]->GetnPoint(); ++iNeigh) {
+ for (unsigned short iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) {
- auto iEdge = geometry->node[iPoint]->GetEdge(iNeigh);
+ auto iEdge = geometry->nodes->GetEdge(iPoint, iNeigh);
if (iPoint == geometry->edges->GetNode(iEdge,0))
LinSysRes.AddBlock(iPoint, EdgeFluxes.GetBlock(iEdge));
@@ -3373,7 +3370,7 @@ void CEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_contain
nodes->GetSolution(iPoint));
/*--- Load the volume of the dual mesh cell ---*/
- numerics->SetVolume(geometry->node[iPoint]->GetVolume());
+ numerics->SetVolume(geometry->nodes->GetVolume(iPoint));
/*--- Compute the rotating frame source residual ---*/
auto residual = numerics->ComputeResidual(config);
@@ -3402,7 +3399,7 @@ void CEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_contain
nodes->GetSolution(iPoint));
/*--- Load the volume of the dual mesh cell ---*/
- numerics->SetVolume(geometry->node[iPoint]->GetVolume());
+ numerics->SetVolume(geometry->nodes->GetVolume(iPoint));
/*--- Compute the rotating frame source residual ---*/
auto residual = numerics->ComputeResidual(config);
@@ -3426,10 +3423,10 @@ void CEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_contain
numerics->SetConservative(nodes->GetSolution(iPoint), nodes->GetSolution(iPoint));
/*--- Set control volume ---*/
- numerics->SetVolume(geometry->node[iPoint]->GetVolume());
+ numerics->SetVolume(geometry->nodes->GetVolume(iPoint));
/*--- Set y coordinate ---*/
- numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[iPoint]->GetCoord());
+ numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(iPoint));
/*--- Compute Source term Residual ---*/
auto residual = numerics->ComputeResidual(config);
@@ -3453,7 +3450,7 @@ void CEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_contain
numerics->SetConservative(nodes->GetSolution(iPoint), nodes->GetSolution(iPoint));
/*--- Set control volume ---*/
- numerics->SetVolume(geometry->node[iPoint]->GetVolume());
+ numerics->SetVolume(geometry->nodes->GetVolume(iPoint));
/*--- Compute Source term Residual ---*/
auto residual = numerics->ComputeResidual(config);
@@ -3472,7 +3469,7 @@ void CEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_contain
for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
/*--- Get control volume ---*/
- su2double Volume = geometry->node[iPoint]->GetVolume();
+ su2double Volume = geometry->nodes->GetVolume(iPoint);
/*--- Get stored time spectral source term and add to residual ---*/
for (iVar = 0; iVar < nVar; iVar++) {
@@ -3497,7 +3494,7 @@ void CEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_contain
numerics->SetPrimitive(nodes->GetPrimitive(iPoint), nodes->GetPrimitive(iPoint));
/*--- Load the volume of the dual mesh cell ---*/
- numerics->SetVolume(geometry->node[iPoint]->GetVolume());
+ numerics->SetVolume(geometry->nodes->GetVolume(iPoint));
/*--- Compute the rotating frame source residual ---*/
auto residual = numerics->ComputeResidual(config);
@@ -3525,10 +3522,10 @@ void CEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_contain
for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
/*--- Get control volume size. ---*/
- su2double Volume = geometry->node[iPoint]->GetVolume();
+ su2double Volume = geometry->nodes->GetVolume(iPoint);
/*--- Get the current point coordinates. ---*/
- const su2double *coor = geometry->node[iPoint]->GetCoord();
+ const su2double *coor = geometry->nodes->GetCoord(iPoint);
/*--- Get the MMS source term. ---*/
vector sourceMan(nVar,0.0);
@@ -3569,11 +3566,11 @@ void CEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) {
nodes->SetLambda(iPoint,0.0);
/*--- Loop over the neighbors of point i. ---*/
- for (unsigned short iNeigh = 0; iNeigh < geometry->node[iPoint]->GetnPoint(); ++iNeigh)
+ for (unsigned short iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh)
{
- auto jPoint = geometry->node[iPoint]->GetPoint(iNeigh);
+ auto jPoint = geometry->nodes->GetPoint(iPoint, iNeigh);
- auto iEdge = geometry->node[iPoint]->GetEdge(iNeigh);
+ auto iEdge = geometry->nodes->GetEdge(iPoint, iNeigh);
auto Normal = geometry->edges->GetNormal(iEdge);
su2double Area = 0.0;
for (unsigned short iDim = 0; iDim < nDim; iDim++) Area += pow(Normal[iDim],2);
@@ -3587,8 +3584,8 @@ void CEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) {
/*--- Adjustment for grid movement ---*/
if (dynamic_grid) {
- const su2double *GridVel_i = geometry->node[iPoint]->GetGridVel();
- const su2double *GridVel_j = geometry->node[jPoint]->GetGridVel();
+ const su2double *GridVel_i = geometry->nodes->GetGridVel(iPoint);
+ const su2double *GridVel_j = geometry->nodes->GetGridVel(jPoint);
for (unsigned short iDim = 0; iDim < nDim; iDim++)
Mean_ProjVel -= 0.5 * (GridVel_i[iDim] + GridVel_j[iDim]) * Normal[iDim];
@@ -3628,7 +3625,7 @@ void CEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) {
/*--- Adjustment for grid movement ---*/
if (dynamic_grid) {
- auto GridVel = geometry->node[iPoint]->GetGridVel();
+ auto GridVel = geometry->nodes->GetGridVel(iPoint);
for (unsigned short iDim = 0; iDim < nDim; iDim++)
Mean_ProjVel -= GridVel[iDim]*Normal[iDim];
}
@@ -3636,7 +3633,7 @@ void CEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) {
/*--- Inviscid contribution ---*/
su2double Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed;
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
nodes->AddLambda(iPoint,Lambda);
}
}
@@ -3672,7 +3669,7 @@ void CEulerSolver::SetUndivided_Laplacian_And_Centered_Dissipation_Sensor(CGeome
SU2_OMP_FOR_DYN(omp_chunk_size)
for (unsigned long iPoint = 0; iPoint < nPointDomain; ++iPoint) {
- const bool boundary_i = geometry->node[iPoint]->GetPhysicalBoundary();
+ const bool boundary_i = geometry->nodes->GetPhysicalBoundary(iPoint);
const su2double Pressure_i = nodes->GetPressure(iPoint);
/*--- Initialize. ---*/
@@ -3683,10 +3680,10 @@ void CEulerSolver::SetUndivided_Laplacian_And_Centered_Dissipation_Sensor(CGeome
jPoint_UndLapl[iPoint] = 0.0;
/*--- Loop over the neighbors of point i. ---*/
- for (unsigned short iNeigh = 0; iNeigh < geometry->node[iPoint]->GetnPoint(); ++iNeigh)
+ for (unsigned short iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh)
{
- auto jPoint = geometry->node[iPoint]->GetPoint(iNeigh);
- bool boundary_j = geometry->node[jPoint]->GetPhysicalBoundary();
+ auto jPoint = geometry->nodes->GetPoint(iPoint, iNeigh);
+ bool boundary_j = geometry->nodes->GetPhysicalBoundary(jPoint);
/*--- If iPoint is boundary it only takes contributions from other boundary points. ---*/
if (boundary_i && !boundary_j) continue;
@@ -3752,12 +3749,12 @@ void CEulerSolver::SetUpwind_Ducros_Sensor(CGeometry *geometry, CConfig *config)
/*---- Ducros sensor for iPoint and its neighbor points to avoid lower dissipation near shocks. ---*/
su2double Ducros_i = 0.0;
- auto nNeigh = geometry->node[iPoint]->GetnNeighbor();
+ const auto nNeigh = geometry->nodes->GetnPoint(iPoint);
for (unsigned short iNeigh = 0; iNeigh <= nNeigh; iNeigh++) {
- auto jPoint = iPoint;
- if (iNeigh < nNeigh) jPoint = geometry->node[iPoint]->GetPoint(iNeigh);
+ auto jPoint = iPoint; // when iNeigh == nNeigh
+ if (iNeigh < nNeigh) jPoint = geometry->nodes->GetPoint(iPoint, iNeigh);
/*---- Dilatation for jPoint ---*/
@@ -3902,10 +3899,10 @@ void CEulerSolver::Pressure_Forces(CGeometry *geometry, CConfig *config) {
/*--- Note that the pressure coefficient is computed at the
halo cells (for visualization purposes), but not the forces ---*/
- if ( (geometry->node[iPoint]->GetDomain()) && (Monitoring == YES) ) {
+ if ( (geometry->nodes->GetDomain(iPoint)) && (Monitoring == YES) ) {
Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
- Coord = geometry->node[iPoint]->GetCoord();
+ Coord = geometry->nodes->GetCoord(iPoint);
/*--- Quadratic objective function for the near-field.
This uses the infinity pressure regardless of Mach number. ---*/
@@ -3919,7 +3916,7 @@ void CEulerSolver::Pressure_Forces(CGeometry *geometry, CConfig *config) {
/*--- Axisymmetric simulations ---*/
- if (axisymmetric) AxiFactor = 2.0*PI_NUMBER*geometry->node[iPoint]->GetCoord(1);
+ if (axisymmetric) AxiFactor = 2.0*PI_NUMBER*geometry->nodes->GetCoord(iPoint, 1);
else AxiFactor = 1.0;
/*--- Force computation, note the minus sign due to the
@@ -4227,10 +4224,10 @@ void CEulerSolver::Momentum_Forces(CGeometry *geometry, CConfig *config) {
/*--- Note that the pressure coefficient is computed at the
halo cells (for visualization purposes), but not the forces ---*/
- if ( (geometry->node[iPoint]->GetDomain()) && (Monitoring == YES) ) {
+ if ( (geometry->nodes->GetDomain(iPoint)) && (Monitoring == YES) ) {
Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
- Coord = geometry->node[iPoint]->GetCoord();
+ Coord = geometry->nodes->GetCoord(iPoint);
Density = nodes->GetDensity(iPoint);
/*--- Quadratic objective function for the near-field.
@@ -4248,7 +4245,7 @@ void CEulerSolver::Momentum_Forces(CGeometry *geometry, CConfig *config) {
/*--- Axisymmetric simulations ---*/
- if (axisymmetric) AxiFactor = 2.0*PI_NUMBER*geometry->node[iPoint]->GetCoord(1);
+ if (axisymmetric) AxiFactor = 2.0*PI_NUMBER*geometry->nodes->GetCoord(iPoint, 1);
else AxiFactor = 1.0;
/*--- Force computation, note the minus sign due to the
@@ -4498,7 +4495,7 @@ void CEulerSolver::Explicit_Iteration(CGeometry *geometry, CSolver **solver_cont
SU2_OMP(for schedule(static,omp_chunk_size) nowait)
for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) {
- su2double Vol = geometry->node[iPoint]->GetVolume() + geometry->node[iPoint]->GetPeriodicVolume();
+ su2double Vol = geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint);
su2double Delta = nodes->GetDelta_Time(iPoint) / Vol;
const su2double* Res_TruncError = nodes->GetResTruncError(iPoint);
@@ -4543,7 +4540,7 @@ void CEulerSolver::Explicit_Iteration(CGeometry *geometry, CSolver **solver_cont
if (fabs(Res) > resMax[iVar]) {
resMax[iVar] = fabs(Res);
idxMax[iVar] = iPoint;
- coordMax[iVar] = geometry->node[iPoint]->GetCoord();
+ coordMax[iVar] = geometry->nodes->GetCoord(iPoint);
}
}
}
@@ -4553,7 +4550,7 @@ void CEulerSolver::Explicit_Iteration(CGeometry *geometry, CSolver **solver_cont
SU2_OMP_CRITICAL
for (unsigned short iVar = 0; iVar < nVar; iVar++) {
AddRes_RMS(iVar, resRMS[iVar]);
- AddRes_Max(iVar, resMax[iVar], geometry->node[idxMax[iVar]]->GetGlobalIndex(), coordMax[iVar]);
+ AddRes_Max(iVar, resMax[iVar], geometry->nodes->GetGlobalIndex(idxMax[iVar]), coordMax[iVar]);
}
}
SU2_OMP_BARRIER
@@ -4633,7 +4630,7 @@ void CEulerSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver
/*--- Read the volume ---*/
- su2double Vol = geometry->node[iPoint]->GetVolume() + geometry->node[iPoint]->GetPeriodicVolume();
+ su2double Vol = geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint);
/*--- Modify matrix diagonal to assure diagonal dominance ---*/
@@ -4669,14 +4666,14 @@ void CEulerSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver
if (Res > resMax[iVar]) {
resMax[iVar] = Res;
idxMax[iVar] = iPoint;
- coordMax[iVar] = geometry->node[iPoint]->GetCoord();
+ coordMax[iVar] = geometry->nodes->GetCoord(iPoint);
}
}
}
SU2_OMP_CRITICAL
for (unsigned short iVar = 0; iVar < nVar; iVar++) {
AddRes_RMS(iVar, resRMS[iVar]);
- AddRes_Max(iVar, resMax[iVar], geometry->node[idxMax[iVar]]->GetGlobalIndex(), coordMax[iVar]);
+ AddRes_Max(iVar, resMax[iVar], geometry->nodes->GetGlobalIndex(idxMax[iVar]), coordMax[iVar]);
}
/*--- Initialize residual and solution at the ghost points ---*/
@@ -4963,7 +4960,7 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
V_inlet = nodes->GetPrimitive(iPoint);
@@ -5017,9 +5014,9 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns
if (nDim == 3) Inlet_ForceZ = -(Pressure - Pressure_Inf)*Vector[2] + MassFlow*Velocity[2];
Inlet_Force[iMarker] += Inlet_ForceX*cos(Alpha)*cos(Beta) + Inlet_ForceY*sin(Beta) +Inlet_ForceZ*sin(Alpha)*cos(Beta);
- Inlet_XCG[iMarker] += geometry->node[iPoint]->GetCoord(0)*Area;
- Inlet_YCG[iMarker] += geometry->node[iPoint]->GetCoord(1)*Area;
- if (nDim == 3) Inlet_ZCG[iMarker] += geometry->node[iPoint]->GetCoord(2)*Area;
+ Inlet_XCG[iMarker] += geometry->nodes->GetCoord(iPoint, 0)*Area;
+ Inlet_YCG[iMarker] += geometry->nodes->GetCoord(iPoint, 1)*Area;
+ if (nDim == 3) Inlet_ZCG[iMarker] += geometry->nodes->GetCoord(iPoint, 2)*Area;
}
}
@@ -5033,7 +5030,7 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
V_outlet = nodes->GetPrimitive(iPoint);
@@ -6105,7 +6102,7 @@ void CEulerSolver::SetActDisk_BCThrust(CGeometry *geometry, CSolver **solver_con
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
geometry->vertex[iMarker][iVertex]->GetNormal(Vector);
@@ -6841,7 +6838,7 @@ void CEulerSolver::BC_Sym_Plane(CGeometry *geometry,
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
/*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*-------------------------------------------------------------------------------*/
/*--- Step 1: For the convective fluxes, create a reflected state of the ---*/
@@ -6855,8 +6852,8 @@ void CEulerSolver::BC_Sym_Plane(CGeometry *geometry,
/*--- Grid movement ---*/
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
- geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint),
+ geometry->nodes->GetGridVel(iPoint));
/*--- Normal vector for this vertex (negate for outward convention). ---*/
geometry->vertex[val_marker][iVertex]->GetNormal(Normal);
@@ -6909,8 +6906,8 @@ void CEulerSolver::BC_Sym_Plane(CGeometry *geometry,
/*-------------------------------------------------------------------------------*/
/*--- Set the normal vector and the coordinates. ---*/
- visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(),
- geometry->node[iPoint]->GetCoord());
+ visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint),
+ geometry->nodes->GetCoord(iPoint));
visc_numerics->SetNormal(Normal);
/*--- Set the primitive and Secondary variables. ---*/
@@ -7050,7 +7047,7 @@ void CEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container,
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Index of the closest interior node ---*/
@@ -7117,7 +7114,7 @@ void CEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container,
Qn_Infty = Vn_Infty;
if (dynamic_grid) {
- GridVel = geometry->node[iPoint]->GetGridVel();
+ GridVel = geometry->nodes->GetGridVel(iPoint);
for (iDim = 0; iDim < nDim; iDim++)
Qn_Infty -= GridVel[iDim]*UnitNormal[iDim];
}
@@ -7206,8 +7203,8 @@ void CEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container,
conv_numerics->SetPrimitive(V_domain, V_infty);
if (dynamic_grid) {
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
- geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint),
+ geometry->nodes->GetGridVel(iPoint));
}
/*--- Compute the convective residual using an upwind scheme ---*/
@@ -7235,8 +7232,8 @@ void CEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container,
/*--- Set the normal vector and the coordinates ---*/
visc_numerics->SetNormal(Normal);
- visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(),
- geometry->node[Point_Normal]->GetCoord());
+ visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint),
+ geometry->nodes->GetCoord(Point_Normal));
/*--- Primitive variables, and gradient ---*/
@@ -7326,7 +7323,7 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container,
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
/*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Index of the closest interior node ---*/
Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor();
@@ -7381,7 +7378,7 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container,
case TOTAL_CONDITIONS_PT:
/*--- Retrieve the specified total conditions for this boundary. ---*/
- if (gravity) P_Total = config->GetRiemann_Var1(Marker_Tag) - geometry->node[iPoint]->GetCoord(nDim-1)*STANDARD_GRAVITY;/// check in which case is true (only freesurface?)
+ if (gravity) P_Total = config->GetRiemann_Var1(Marker_Tag) - geometry->nodes->GetCoord(iPoint, nDim-1)*STANDARD_GRAVITY;/// check in which case is true (only freesurface?)
else P_Total = config->GetRiemann_Var1(Marker_Tag);
T_Total = config->GetRiemann_Var2(Marker_Tag);
Flow_Dir = config->GetRiemann_FlowDir(Marker_Tag);
@@ -7417,7 +7414,7 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container,
case STATIC_SUPERSONIC_INFLOW_PT:
/*--- Retrieve the specified total conditions for this boundary. ---*/
- if (gravity) P_static = config->GetRiemann_Var1(Marker_Tag) - geometry->node[iPoint]->GetCoord(nDim-1)*STANDARD_GRAVITY;/// check in which case is true (only freesurface?)
+ if (gravity) P_static = config->GetRiemann_Var1(Marker_Tag) - geometry->nodes->GetCoord(iPoint, nDim-1)*STANDARD_GRAVITY;/// check in which case is true (only freesurface?)
else P_static = config->GetRiemann_Var1(Marker_Tag);
T_static = config->GetRiemann_Var2(Marker_Tag);
Mach = config->GetRiemann_FlowDir(Marker_Tag);
@@ -7445,7 +7442,7 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container,
/*--- Retrieve the specified total conditions for this boundary. ---*/
- if (gravity) P_static = config->GetRiemann_Var1(Marker_Tag) - geometry->node[iPoint]->GetCoord(nDim-1)*STANDARD_GRAVITY;/// check in which case is true (only freesurface?)
+ if (gravity) P_static = config->GetRiemann_Var1(Marker_Tag) - geometry->nodes->GetCoord(iPoint, nDim-1)*STANDARD_GRAVITY;/// check in which case is true (only freesurface?)
else P_static = config->GetRiemann_Var1(Marker_Tag);
Rho_static = config->GetRiemann_Var2(Marker_Tag);
Mach = config->GetRiemann_FlowDir(Marker_Tag);
@@ -7515,7 +7512,7 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container,
/*--- eigenvalues contribution due to grid motion ---*/
if (dynamic_grid) {
- gridVel = geometry->node[iPoint]->GetGridVel();
+ gridVel = geometry->nodes->GetGridVel(iPoint);
su2double ProjGridVel = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
@@ -7588,7 +7585,7 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container,
/*--- Residual contribution due to grid motion ---*/
if (dynamic_grid) {
- gridVel = geometry->node[iPoint]->GetGridVel();
+ gridVel = geometry->nodes->GetGridVel(iPoint);
su2double projVelocity = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
@@ -7636,7 +7633,7 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container,
/*--- Jacobian contribution due to grid motion ---*/
if (dynamic_grid)
{
- gridVel = geometry->node[iPoint]->GetGridVel();
+ gridVel = geometry->nodes->GetGridVel(iPoint);
su2double projVelocity = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
projVelocity += gridVel[iDim]*Normal[iDim];
@@ -7698,7 +7695,7 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container,
/*--- Set the normal vector and the coordinates ---*/
visc_numerics->SetNormal(Normal);
- visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+ visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
/*--- Primitive variables, and gradient ---*/
@@ -7846,7 +7843,7 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain
/*--- find the node related to the vertex ---*/
iPoint = geometry->turbovertex[val_marker][iSpan][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()){
+ if (geometry->nodes->GetDomain(iPoint)){
/*--- Normalize Normal vector for this vertex (already for outward convention) ---*/
geometry->turbovertex[val_marker][iSpan][iVertex]->GetNormal(UnitNormal);
@@ -7892,7 +7889,7 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain
case TOTAL_CONDITIONS_PT:
/*--- Retrieve the specified total conditions for this boundary. ---*/
- if (gravity) P_Total = config->GetRiemann_Var1(Marker_Tag) - geometry->node[iPoint]->GetCoord(nDim-1)*STANDARD_GRAVITY;/// check in which case is true (only freesurface?)
+ if (gravity) P_Total = config->GetRiemann_Var1(Marker_Tag) - geometry->nodes->GetCoord(iPoint, nDim-1)*STANDARD_GRAVITY;/// check in which case is true (only freesurface?)
else P_Total = config->GetRiemann_Var1(Marker_Tag);
T_Total = config->GetRiemann_Var2(Marker_Tag);
Flow_Dir = config->GetRiemann_FlowDir(Marker_Tag);
@@ -8018,7 +8015,7 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain
/*--- eigenvalues contribution due to grid motion ---*/
if (dynamic_grid){
- gridVel = geometry->node[iPoint]->GetGridVel();
+ gridVel = geometry->nodes->GetGridVel(iPoint);
su2double ProjGridVel = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
@@ -8091,7 +8088,7 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain
/*--- Residual contribution due to grid motion ---*/
if (dynamic_grid) {
- gridVel = geometry->node[iPoint]->GetGridVel();
+ gridVel = geometry->nodes->GetGridVel(iPoint);
su2double projVelocity = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
@@ -8139,7 +8136,7 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain
/*--- Jacobian contribution due to grid motion ---*/
if (dynamic_grid)
{
- gridVel = geometry->node[iPoint]->GetGridVel();
+ gridVel = geometry->nodes->GetGridVel(iPoint);
su2double projVelocity = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
projVelocity += gridVel[iDim]*Normal[iDim];
@@ -8202,7 +8199,7 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain
/*--- Set the normal vector and the coordinates ---*/
visc_numerics->SetNormal(Normal);
- visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+ visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
/*--- Primitive variables, and gradient ---*/
@@ -9071,7 +9068,7 @@ void CEulerSolver::BC_Giles(CGeometry *geometry, CSolver **solver_container, CNu
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
@@ -9098,7 +9095,7 @@ void CEulerSolver::BC_Giles(CGeometry *geometry, CSolver **solver_container, CNu
/*--- Set the normal vector and the coordinates ---*/
visc_numerics->SetNormal(Normal);
- visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+ visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
/*--- Primitive variables, and gradient ---*/
@@ -9211,7 +9208,7 @@ void CEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container,
/*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Normal vector for this vertex (negate for outward convention) ---*/
@@ -9413,7 +9410,7 @@ void CEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container,
conv_numerics->SetPrimitive(V_domain, V_inlet);
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
@@ -9440,7 +9437,7 @@ void CEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container,
// /*--- Set the normal vector and the coordinates ---*/
//
// visc_numerics->SetNormal(Normal);
-// visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
//
// /*--- Primitive variables, and gradient ---*/
//
@@ -9504,7 +9501,7 @@ void CEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
/*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Normal vector for this vertex (negate for outward convention) ---*/
geometry->vertex[val_marker][iVertex]->GetNormal(Normal);
@@ -9524,7 +9521,7 @@ void CEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
/*--- Build the fictitious intlet state based on characteristics ---*/
/*--- Retrieve the specified back pressure for this outlet. ---*/
- if (gravity) P_Exit = config->GetOutlet_Pressure(Marker_Tag) - geometry->node[iPoint]->GetCoord(nDim-1)*STANDARD_GRAVITY;
+ if (gravity) P_Exit = config->GetOutlet_Pressure(Marker_Tag) - geometry->nodes->GetCoord(iPoint, nDim-1)*STANDARD_GRAVITY;
else P_Exit = config->GetOutlet_Pressure(Marker_Tag);
/*--- Non-dim. the inputs if necessary. ---*/
@@ -9591,7 +9588,7 @@ void CEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
conv_numerics->SetPrimitive(V_domain, V_outlet);
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
@@ -9615,7 +9612,7 @@ void CEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
// /*--- Set the normal vector and the coordinates ---*/
//
// visc_numerics->SetNormal(Normal);
-// visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
//
// /*--- Primitive variables, and gradient ---*/
//
@@ -9715,7 +9712,7 @@ void CEulerSolver::BC_Supersonic_Inlet(CGeometry *geometry, CSolver **solver_con
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Current solution at this boundary node ---*/
@@ -9732,8 +9729,8 @@ void CEulerSolver::BC_Supersonic_Inlet(CGeometry *geometry, CSolver **solver_con
conv_numerics->SetPrimitive(V_domain, V_inlet);
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
- geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint),
+ geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
@@ -9758,7 +9755,7 @@ void CEulerSolver::BC_Supersonic_Inlet(CGeometry *geometry, CSolver **solver_con
// /*--- Set the normal vector and the coordinates ---*/
//
// visc_numerics->SetNormal(Normal);
-// visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
//
// /*--- Primitive variables, and gradient ---*/
//
@@ -9819,7 +9816,7 @@ void CEulerSolver::BC_Supersonic_Outlet(CGeometry *geometry, CSolver **solver_co
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Current solution at this boundary node ---*/
@@ -9853,8 +9850,8 @@ void CEulerSolver::BC_Supersonic_Outlet(CGeometry *geometry, CSolver **solver_co
conv_numerics->SetPrimitive(V_domain, V_outlet);
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
- geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint),
+ geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
@@ -9879,7 +9876,7 @@ void CEulerSolver::BC_Supersonic_Outlet(CGeometry *geometry, CSolver **solver_co
// /*--- Set the normal vector and the coordinates ---*/
//
// visc_numerics->SetNormal(Normal);
-// visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
//
// /*--- Primitive variables, and gradient ---*/
//
@@ -10005,7 +10002,7 @@ void CEulerSolver::BC_Engine_Inflow(CGeometry *geometry, CSolver **solver_contai
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Normal vector for this vertex (negate for outward convention) ---*/
@@ -10077,7 +10074,7 @@ void CEulerSolver::BC_Engine_Inflow(CGeometry *geometry, CSolver **solver_contai
/*--- Set grid movement ---*/
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
@@ -10102,7 +10099,7 @@ void CEulerSolver::BC_Engine_Inflow(CGeometry *geometry, CSolver **solver_contai
// /*--- Set the normal vector and the coordinates ---*/
//
// visc_numerics->SetNormal(Normal);
-// visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
//
// /*--- Primitive variables, and gradient ---*/
//
@@ -10193,7 +10190,7 @@ void CEulerSolver::BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_conta
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Normal vector for this vertex (negate for outward convention) ---*/
@@ -10332,7 +10329,7 @@ void CEulerSolver::BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_conta
/*--- Set grid movement ---*/
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
@@ -10357,7 +10354,7 @@ void CEulerSolver::BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_conta
// /*--- Set the normal vector and the coordinates ---*/
//
// visc_numerics->SetNormal(Normal);
-// visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
//
// /*--- Primitive variables, and gradient ---*/
//
@@ -10417,7 +10414,7 @@ void CEulerSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_cont
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
nDonorVertex = GetnSlidingStates(iMarker, iVertex);
@@ -10470,7 +10467,7 @@ void CEulerSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_cont
conv_numerics->SetNormal(Normal);
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint));
/*--- Compute the convective residual using an upwind scheme ---*/
@@ -10515,7 +10512,7 @@ void CEulerSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_cont
/*--- Set the normal vector and the coordinates ---*/
visc_numerics->SetNormal(Normal);
- visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+ visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
/*--- Primitive variables, and gradient ---*/
@@ -10578,10 +10575,10 @@ void CEulerSolver::BC_Interface_Boundary(CGeometry *geometry, CSolver **solver_c
for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
- GlobalIndex_iPoint = geometry->node[iPoint]->GetGlobalIndex();
+ GlobalIndex_iPoint = geometry->nodes->GetGlobalIndex(iPoint);
GlobalIndex_jPoint = GetDonorGlobalIndex(val_marker, iVertex);
- if ((geometry->node[iPoint]->GetDomain()) && (GlobalIndex_iPoint != GlobalIndex_jPoint)) {
+ if ((geometry->nodes->GetDomain(iPoint)) && (GlobalIndex_iPoint != GlobalIndex_jPoint)) {
/*--- Store the solution for both points ---*/
@@ -10640,10 +10637,10 @@ void CEulerSolver::BC_NearField_Boundary(CGeometry *geometry, CSolver **solver_c
for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
- GlobalIndex_iPoint = geometry->node[iPoint]->GetGlobalIndex();
+ GlobalIndex_iPoint = geometry->nodes->GetGlobalIndex(iPoint);
GlobalIndex_jPoint = GetDonorGlobalIndex(val_marker, iVertex);
- if ((geometry->node[iPoint]->GetDomain()) && (GlobalIndex_iPoint != GlobalIndex_jPoint)) {
+ if ((geometry->nodes->GetDomain(iPoint)) && (GlobalIndex_iPoint != GlobalIndex_jPoint)) {
/*--- Store the solution for both points ---*/
@@ -10731,12 +10728,12 @@ void CEulerSolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container, C
for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
- GlobalIndex = geometry->node[iPoint]->GetGlobalIndex();
+ GlobalIndex = geometry->nodes->GetGlobalIndex(iPoint);
GlobalIndex_donor = GetDonorGlobalIndex(val_marker, iVertex);
/*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/
- if ((geometry->node[iPoint]->GetDomain()) &&
+ if ((geometry->nodes->GetDomain(iPoint)) &&
(GlobalIndex != GlobalIndex_donor)) {
/*--- Normal vector for this vertex (negative for outward convention) ---*/
@@ -11038,7 +11035,7 @@ void CEulerSolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container, C
/*--- Grid Movement ---*/
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
@@ -11070,7 +11067,7 @@ void CEulerSolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container, C
// /*--- Set the normal vector and the coordinates ---*/
//
// visc_numerics->SetNormal(Normal);
-// visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[iPoint_Normal]->GetCoord());
+// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->node[iPoint_Normal]->GetCoord());
//
// /*--- Primitive variables, and gradient ---*/
//
@@ -11158,11 +11155,11 @@ void CEulerSolver::BC_Custom(CGeometry *geometry,
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Get the coordinates for the current node. ---*/
- const su2double *coor = geometry->node[iPoint]->GetCoord();
+ const su2double *coor = geometry->nodes->GetCoord(iPoint);
/*--- Get the conservative state from the verification solution. ---*/
@@ -11239,7 +11236,7 @@ void CEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_co
/*--- CV volume at time n+1. As we are on a static mesh, the volume
of the CV will remained fixed for all time steps. ---*/
- Volume_nP1 = geometry->node[iPoint]->GetVolume();
+ Volume_nP1 = geometry->nodes->GetVolume(iPoint);
/*--- Compute the dual time-stepping source term based on the chosen
time discretization scheme (1st- or 2nd-order).---*/
@@ -11274,16 +11271,16 @@ void CEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_co
SU2_OMP_FOR_STAT(omp_chunk_size)
for (iPoint = 0; iPoint < nPointDomain; ++iPoint) {
- GridVel_i = geometry->node[iPoint]->GetGridVel();
+ GridVel_i = geometry->nodes->GetGridVel(iPoint);
U_time_n = nodes->GetSolution_time_n(iPoint);
- for (iNeigh = 0; iNeigh < geometry->node[iPoint]->GetnNeighbor(); iNeigh++) {
+ for (iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); iNeigh++) {
- iEdge = geometry->node[iPoint]->GetEdge(iNeigh);
+ iEdge = geometry->nodes->GetEdge(iPoint, iNeigh);
Normal = geometry->edges->GetNormal(iEdge);
- jPoint = geometry->node[iPoint]->GetPoint(iNeigh);
- GridVel_j = geometry->node[jPoint]->GetGridVel();
+ jPoint = geometry->nodes->GetPoint(iPoint, iNeigh);
+ GridVel_j = geometry->nodes->GetGridVel(jPoint);
/*--- Determine whether to consider the normal outward or inward. ---*/
su2double dir = (geometry->edges->GetNode(iEdge,0) == iPoint)? 0.5 : -0.5;
@@ -11313,7 +11310,7 @@ void CEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_co
/*--- Grid velocities stored at boundary node i ---*/
- GridVel_i = geometry->node[iPoint]->GetGridVel();
+ GridVel_i = geometry->nodes->GetGridVel(iPoint);
/*--- Compute the GCL term by dotting the grid velocity with the face
normal. The normal is negated to match the boundary convention. ---*/
@@ -11349,8 +11346,8 @@ void CEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_co
grids, the volumes will change. On rigidly transforming grids, the
volumes will remain constant. ---*/
- Volume_nM1 = geometry->node[iPoint]->GetVolume_nM1();
- Volume_nP1 = geometry->node[iPoint]->GetVolume();
+ Volume_nM1 = geometry->nodes->GetVolume_nM1(iPoint);
+ Volume_nP1 = geometry->nodes->GetVolume(iPoint);
/*--- Compute the dual time-stepping source residual. Due to the
introduction of the GCL term above, the remainder of the source residual
@@ -11410,7 +11407,7 @@ void CEulerSolver::ComputeVerificationError(CGeometry *geometry,
for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) {
/* Set the pointers to the coordinates and solution of this DOF. */
- const su2double *coor = geometry->node[iPoint]->GetCoord();
+ const su2double *coor = geometry->nodes->GetCoord(iPoint);
su2double *solDOF = nodes->GetSolution(iPoint);
/* Get local error from the verification solution class. */
@@ -11421,8 +11418,8 @@ void CEulerSolver::ComputeVerificationError(CGeometry *geometry,
for (unsigned short iVar = 0; iVar < nVar; iVar++) {
VerificationSolution->AddError_RMS(iVar, error[iVar]*error[iVar]);
VerificationSolution->AddError_Max(iVar, fabs(error[iVar]),
- geometry->node[iPoint]->GetGlobalIndex(),
- geometry->node[iPoint]->GetCoord());
+ geometry->nodes->GetGlobalIndex(iPoint),
+ geometry->nodes->GetCoord(iPoint));
}
}
@@ -11555,8 +11552,8 @@ void CEulerSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig
}
for (iDim = 0; iDim < nDim; iDim++) {
- geometry[MESH_0]->node[iPoint_Local]->SetCoord(iDim, Coord[iDim]);
- geometry[MESH_0]->node[iPoint_Local]->SetGridVel(iDim, GridVel[iDim]);
+ geometry[MESH_0]->nodes->SetCoord(iPoint_Local, iDim, Coord[iDim]);
+ geometry[MESH_0]->nodes->SetGridVel(iPoint_Local, iDim, GridVel[iDim]);
}
}
@@ -11569,7 +11566,7 @@ void CEulerSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig
Coord = &Restart_Data[index];
for (iDim = 0; iDim < nDim; iDim++) {
- geometry[MESH_0]->node[iPoint_Local]->SetCoord(iDim, Coord[iDim]);
+ geometry[MESH_0]->nodes->SetCoord(iPoint_Local, iDim, Coord[iDim]);
}
}
@@ -11645,11 +11642,11 @@ void CEulerSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig
for (iMesh = 1; iMesh <= config->GetnMGLevels(); iMesh++) {
SU2_OMP_FOR_STAT(omp_chunk_size)
for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) {
- Area_Parent = geometry[iMesh]->node[iPoint]->GetVolume();
+ Area_Parent = geometry[iMesh]->nodes->GetVolume(iPoint);
su2double Solution_Coarse[MAXNVAR] = {0.0};
- for (iChildren = 0; iChildren < geometry[iMesh]->node[iPoint]->GetnChildren_CV(); iChildren++) {
- Point_Fine = geometry[iMesh]->node[iPoint]->GetChildren_CV(iChildren);
- Area_Children = geometry[iMesh-1]->node[Point_Fine]->GetVolume();
+ for (iChildren = 0; iChildren < geometry[iMesh]->nodes->GetnChildren_CV(iPoint); iChildren++) {
+ Point_Fine = geometry[iMesh]->nodes->GetChildren_CV(iPoint, iChildren);
+ Area_Children = geometry[iMesh-1]->nodes->GetVolume(Point_Fine);
Solution_Fine = solver[iMesh-1][FLOW_SOL]->GetNodes()->GetSolution(Point_Fine);
for (iVar = 0; iVar < nVar; iVar++) {
Solution_Coarse[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent;
@@ -11791,7 +11788,7 @@ void CEulerSolver::PreprocessAverage(CSolver **solver, CGeometry *geometry, CCon
/*--- Loop over the vertices to sum all the quantities pithc-wise ---*/
for (iVertex = 0; iVertex < geometry->GetnVertexSpan(iMarker,iSpan); iVertex++) {
iPoint = geometry->turbovertex[iMarker][iSpan][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()){
+ if (geometry->nodes->GetDomain(iPoint)){
/*--- Compute the integral fluxes for the boundaries ---*/
Pressure = nodes->GetPressure(iPoint);
diff --git a/SU2_CFD/src/solvers/CFEASolver.cpp b/SU2_CFD/src/solvers/CFEASolver.cpp
index 9bef0fc7b7c5..0fea5defb73d 100644
--- a/SU2_CFD/src/solvers/CFEASolver.cpp
+++ b/SU2_CFD/src/solvers/CFEASolver.cpp
@@ -160,7 +160,7 @@ CFEASolver::CFEASolver(CGeometry *geometry, CConfig *config) : CSolver() {
for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++)
for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
- long iVertex = geometry->node[iPoint]->GetVertex(iMarker);
+ long iVertex = geometry->nodes->GetVertex(iPoint, iMarker);
if (iVertex >= 0) {
nodes->Set_isVertex(iPoint,true);
break;
@@ -503,7 +503,7 @@ void CFEASolver::Set_Prestretch(CGeometry *geometry, CConfig *config) {
/*--- Now fill array with the transform values only for local points ---*/
for (iPoint = 0; iPoint < nPointDomain; iPoint++)
- Global2Local[geometry->node[iPoint]->GetGlobalIndex()] = iPoint;
+ Global2Local[geometry->nodes->GetGlobalIndex(iPoint)] = iPoint;
/*--- Read all lines in the restart file ---*/
@@ -654,7 +654,7 @@ void CFEASolver::Set_ReferenceGeometry(CGeometry *geometry, CConfig *config) {
/*--- Now fill array with the transform values only for local points ---*/
for (iPoint = 0; iPoint < nPointDomain; iPoint++)
- Global2Local[geometry->node[iPoint]->GetGlobalIndex()] = iPoint;
+ Global2Local[geometry->nodes->GetGlobalIndex(iPoint)] = iPoint;
/*--- Read all lines in the restart file ---*/
@@ -722,7 +722,7 @@ void CFEASolver::Set_VertexEliminationSchedule(CGeometry *geometry, const vector
for (auto iMarker : markers) {
for (auto iVertex = 0ul; iVertex < geometry->nVertex[iMarker]; iVertex++) {
auto iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- myPoints.push_back(geometry->node[iPoint]->GetGlobalIndex());
+ myPoints.push_back(geometry->nodes->GetGlobalIndex(iPoint));
}
}
@@ -735,7 +735,7 @@ void CFEASolver::Set_VertexEliminationSchedule(CGeometry *geometry, const vector
/*--- Global to local map for the halo points of the rank (not covered by the CGeometry map). ---*/
unordered_map Global2Local;
for (auto iPoint = nPointDomain; iPoint < nPoint; ++iPoint) {
- Global2Local[geometry->node[iPoint]->GetGlobalIndex()] = iPoint;
+ Global2Local[geometry->nodes->GetGlobalIndex(iPoint)] = iPoint;
}
/*--- Populate elimination list. ---*/
@@ -1424,7 +1424,7 @@ void CFEASolver::Compute_NodalStress(CGeometry *geometry, CNumerics **numerics,
LinSysReact(iPoint,iVar) += simp_penalty*Ta[iVar];
/*--- Divide the nodal stress by the number of elements that will contribute to this point. ---*/
- su2double weight = simp_penalty / geometry->node[iPoint]->GetnElem();
+ su2double weight = simp_penalty / geometry->nodes->GetnElem(iPoint);
for (iStress = 0; iStress < nStress; iStress++)
nodes->AddStress_FEM(iPoint,iStress, weight*element->Get_NodalStress(iNode,iStress));
@@ -1523,7 +1523,7 @@ void CFEASolver::Compute_NodalStress(CGeometry *geometry, CNumerics **numerics,
for (iDim = 0; iDim < nDim; iDim++) {
/*--- Retrieve coordinate ---*/
- val_Coord = geometry->node[iPoint]->GetCoord(iDim);
+ val_Coord = geometry->nodes->GetCoord(iPoint, iDim);
myfile << "X" << iDim + 1 << ": " << val_Coord << " \t " ;
}
@@ -1581,7 +1581,7 @@ void CFEASolver::Compute_NodalStress(CGeometry *geometry, CNumerics **numerics,
for (iDim = 0; iDim < nDim; iDim++) {
/*--- Retrieve coordinate ---*/
- val_Coord = geometry->node[iPoint]->GetCoord(iDim);
+ val_Coord = geometry->nodes->GetCoord(iPoint, iDim);
myfile << "X" << iDim + 1 << ": " << val_Coord << " \t " ;
}
@@ -1809,7 +1809,7 @@ void CFEASolver::BC_Sym_Plane(CGeometry *geometry, CNumerics *numerics, const CC
for (auto iNode = 0u; iNode < nNodes; iNode++) {
auto iPoint = geometry->bound[val_marker][0]->GetNode(iNode);
- nodeCoord[iNode] = geometry->node[iPoint]->GetCoord();
+ nodeCoord[iNode] = geometry->nodes->GetCoord(iPoint);
}
su2double normal[MAXNDIM] = {0.0};
@@ -1986,14 +1986,14 @@ void CFEASolver::Postprocessing(CGeometry *geometry, CSolver **solver_container,
if (Res > resMax[iVar]) {
resMax[iVar] = Res;
idxMax[iVar] = iPoint;
- coordMax[iVar] = geometry->node[iPoint]->GetCoord();
+ coordMax[iVar] = geometry->nodes->GetCoord(iPoint);
}
}
}
SU2_OMP_CRITICAL
for (auto iVar = 0ul; iVar < nVar; iVar++) {
AddRes_RMS(iVar, resRMS[iVar]);
- AddRes_Max(iVar, resMax[iVar], geometry->node[idxMax[iVar]]->GetGlobalIndex(), coordMax[iVar]);
+ AddRes_Max(iVar, resMax[iVar], geometry->nodes->GetGlobalIndex(idxMax[iVar]), coordMax[iVar]);
}
SU2_OMP_BARRIER
@@ -2077,7 +2077,7 @@ void CFEASolver::BC_Normal_Load(CGeometry *geometry, CNumerics *numerics, const
/*--- Use a reference normal from one of the points to decide if computed normal needs to be flipped. ---*/
- auto reference_vertex = geometry->node[indexNode[0]]->GetVertex(val_marker);
+ auto reference_vertex = geometry->nodes->GetVertex(indexNode[0], val_marker);
const su2double* reference_normal = geometry->vertex[val_marker][reference_vertex]->GetNormal();
su2double dot = 0.0;
@@ -2134,7 +2134,7 @@ void CFEASolver::BC_Dir_Load(CGeometry *geometry, CNumerics *numerics, const CCo
for (iNode = 0; iNode < nNodes; iNode++) {
indexNode[iNode] = geometry->bound[val_marker][iElem]->GetNode(iNode);
- nodeCoord[iNode] = geometry->node[indexNode[iNode]]->GetCoord();
+ nodeCoord[iNode] = geometry->nodes->GetCoord(indexNode[iNode]);
}
/*--- Compute area of the boundary element. ---*/
@@ -2184,7 +2184,7 @@ void CFEASolver::BC_Damper(CGeometry *geometry, CNumerics *numerics, const CConf
indexNode[iNode] = iPoint;
for (iDim = 0; iDim < nVar; iDim++)
- nodeCoord[iNode][iDim] = geometry->node[iPoint]->GetCoord(iDim) + nodes->GetSolution(iPoint,iDim);
+ nodeCoord[iNode][iDim] = geometry->nodes->GetCoord(iPoint, iDim) + nodes->GetSolution(iPoint,iDim);
}
/*--- Compute the area of the surface element. ---*/
@@ -2266,7 +2266,7 @@ void CFEASolver::Integrate_FSI_Loads(CGeometry *geometry, const CConfig *config)
for (auto iNode = 0u; iNode < nNode; ++iNode) {
nodeList[iNode] = geometry->bound[iMarker][iElem]->GetNode(iNode);
for (auto iDim = 0u; iDim < nDim; ++iDim)
- coords[iNode][iDim] = geometry->node[nodeList[iNode]]->GetCoord(iDim)+
+ coords[iNode][iDim] = geometry->nodes->GetCoord(nodeList[iNode], iDim)+
nodes->GetSolution(nodeList[iNode],iDim);
}
@@ -3109,7 +3109,7 @@ void CFEASolver::Compute_OFRefNode(CGeometry *geometry, const CConfig *config){
long iPoint = geometry->GetGlobal_to_Local_Point(config->GetRefNode_ID());
if (iPoint >= 0) {
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
for (unsigned short iVar = 0; iVar < nVar; ++iVar)
dist[iVar] = nodes->GetSolution(iPoint,iVar) - config->GetRefNode_Displacement(iVar);
}
@@ -3157,7 +3157,7 @@ void CFEASolver::Compute_OFVolFrac(CGeometry *geometry, const CConfig *config)
SU2_OMP_FOR_STAT(omp_chunk_size)
for (unsigned long iElem = 0; iElem < nElement; ++iElem) {
/*--- count only elements that belong to the partition ---*/
- if (geometry->node[geometry->elem[iElem]->GetNode(0)]->GetDomain()) {
+ if (geometry->nodes->GetDomain(geometry->elem[iElem]->GetNode(0))) {
su2double volume = geometry->elem[iElem]->GetVolume();
su2double rho = element_properties[iElem]->GetPhysicalDensity();
tot_vol_loc += volume;
@@ -3285,7 +3285,7 @@ void CFEASolver::Stiffness_Penalty(CGeometry *geometry, CSolver **solver, CNumer
// Avoid double-counting elements:
// Only add the value if the first node is in the domain
- if (geometry->node[indexNode[0]]->GetDomain()) {
+ if (geometry->nodes->GetDomain(indexNode[0])) {
// Compute the area/volume of the element
su2double elementVolume;
diff --git a/SU2_CFD/src/solvers/CHeatSolver.cpp b/SU2_CFD/src/solvers/CHeatSolver.cpp
index 65ce69480f48..81a75ff62c22 100644
--- a/SU2_CFD/src/solvers/CHeatSolver.cpp
+++ b/SU2_CFD/src/solvers/CHeatSolver.cpp
@@ -424,11 +424,11 @@ void CHeatSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *
for (iMesh = 1; iMesh <= config->GetnMGLevels(); iMesh++) {
for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) {
- Area_Parent = geometry[iMesh]->node[iPoint]->GetVolume();
+ Area_Parent = geometry[iMesh]->nodes->GetVolume(iPoint);
for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 0.0;
- for (iChildren = 0; iChildren < geometry[iMesh]->node[iPoint]->GetnChildren_CV(); iChildren++) {
- Point_Fine = geometry[iMesh]->node[iPoint]->GetChildren_CV(iChildren);
- Area_Children = geometry[iMesh-1]->node[Point_Fine]->GetVolume();
+ for (iChildren = 0; iChildren < geometry[iMesh]->nodes->GetnChildren_CV(iPoint); iChildren++) {
+ Point_Fine = geometry[iMesh]->nodes->GetChildren_CV(iPoint, iChildren);
+ Area_Children = geometry[iMesh-1]->nodes->GetVolume(Point_Fine);
Solution_Fine = solver[iMesh-1][HEAT_SOL]->GetNodes()->GetSolution(Point_Fine);
for (iVar = 0; iVar < nVar; iVar++) {
Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent;
@@ -473,25 +473,25 @@ void CHeatSolver::SetUndivided_Laplacian(CGeometry *geometry, CConfig *config) {
for (iVar = 0; iVar < nVar; iVar++)
Diff[iVar] = nodes->GetSolution(iPoint,iVar) - nodes->GetSolution(jPoint,iVar);
- boundary_i = geometry->node[iPoint]->GetPhysicalBoundary();
- boundary_j = geometry->node[jPoint]->GetPhysicalBoundary();
+ boundary_i = geometry->nodes->GetPhysicalBoundary(iPoint);
+ boundary_j = geometry->nodes->GetPhysicalBoundary(jPoint);
/*--- Both points inside the domain, or both in the boundary ---*/
if ((!boundary_i && !boundary_j) || (boundary_i && boundary_j)) {
- if (geometry->node[iPoint]->GetDomain()) nodes->SubtractUnd_Lapl(iPoint,Diff);
- if (geometry->node[jPoint]->GetDomain()) nodes->AddUnd_Lapl(jPoint,Diff);
+ if (geometry->nodes->GetDomain(iPoint)) nodes->SubtractUnd_Lapl(iPoint,Diff);
+ if (geometry->nodes->GetDomain(jPoint)) nodes->AddUnd_Lapl(jPoint,Diff);
}
/*--- iPoint inside the domain, jPoint on the boundary ---*/
if (!boundary_i && boundary_j)
- if (geometry->node[iPoint]->GetDomain()) nodes->SubtractUnd_Lapl(iPoint,Diff);
+ if (geometry->nodes->GetDomain(iPoint)) nodes->SubtractUnd_Lapl(iPoint,Diff);
/*--- jPoint inside the domain, iPoint on the boundary ---*/
if (boundary_i && !boundary_j)
- if (geometry->node[jPoint]->GetDomain()) nodes->AddUnd_Lapl(jPoint,Diff);
+ if (geometry->nodes->GetDomain(jPoint)) nodes->AddUnd_Lapl(jPoint,Diff);
}
@@ -535,7 +535,7 @@ void CHeatSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_contai
Temp_j = nodes->GetSolution(jPoint,0);
numerics->SetUndivided_Laplacian(nodes->GetUndivided_Laplacian(iPoint), nodes->GetUndivided_Laplacian(jPoint));
- numerics->SetNeighbor(geometry->node[iPoint]->GetnNeighbor(), geometry->node[jPoint]->GetnNeighbor());
+ numerics->SetNeighbor(geometry->nodes->GetnNeighbor(iPoint), geometry->nodes->GetnNeighbor(jPoint));
numerics->SetPrimitive(V_i, V_j);
numerics->SetTemperature(Temp_i, Temp_j);
@@ -593,8 +593,8 @@ void CHeatSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_containe
if (muscl) {
for (iDim = 0; iDim < nDim; iDim++) {
- Vector_i[iDim] = 0.5*(geometry->node[jPoint]->GetCoord(iDim) - geometry->node[iPoint]->GetCoord(iDim));
- Vector_j[iDim] = 0.5*(geometry->node[iPoint]->GetCoord(iDim) - geometry->node[jPoint]->GetCoord(iDim));
+ Vector_i[iDim] = 0.5*(geometry->nodes->GetCoord(jPoint, iDim) - geometry->nodes->GetCoord(iPoint, iDim));
+ Vector_j[iDim] = 0.5*(geometry->nodes->GetCoord(iPoint, iDim) - geometry->nodes->GetCoord(jPoint, iDim));
}
Gradient_i = solver_container[FLOW_SOL]->GetNodes()->GetGradient_Reconstruction(iPoint);
@@ -678,8 +678,8 @@ void CHeatSolver::Viscous_Residual(CGeometry *geometry, CSolver **solver_contain
/*--- Points coordinates, and normal vector ---*/
- numerics->SetCoord(geometry->node[iPoint]->GetCoord(),
- geometry->node[jPoint]->GetCoord());
+ numerics->SetCoord(geometry->nodes->GetCoord(iPoint),
+ geometry->nodes->GetCoord(jPoint));
numerics->SetNormal(geometry->edges->GetNormal(iEdge));
Temp_i_Grad = nodes->GetGradient(iPoint);
@@ -751,7 +751,7 @@ void CHeatSolver::Set_Heatflux_Areas(CGeometry *geometry, CConfig *config) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if(geometry->node[iPoint]->GetDomain()) {
+ if(geometry->nodes->GetDomain(iPoint)) {
Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
Area = 0.0;
@@ -808,7 +808,7 @@ void CHeatSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_conta
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor();
@@ -817,8 +817,8 @@ void CHeatSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_conta
for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim];
Area = sqrt (Area);
- Coord_i = geometry->node[iPoint]->GetCoord();
- Coord_j = geometry->node[Point_Normal]->GetCoord();
+ Coord_i = geometry->nodes->GetCoord(iPoint);
+ Coord_j = geometry->nodes->GetCoord(Point_Normal);
dist_ij = 0;
for (iDim = 0; iDim < nDim; iDim++)
dist_ij += (Coord_j[iDim]-Coord_i[iDim])*(Coord_j[iDim]-Coord_i[iDim]);
@@ -879,7 +879,7 @@ void CHeatSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_contain
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
Normal = geometry->vertex[val_marker][iVertex]->GetNormal();
Area = 0.0;
@@ -931,7 +931,7 @@ void CHeatSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container,
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
geometry->vertex[val_marker][iVertex]->GetNormal(Normal);
for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim];
@@ -959,7 +959,7 @@ void CHeatSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container,
conv_numerics->SetPrimitive(V_domain, V_inlet);
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint));
conv_numerics->SetTemperature(nodes->GetSolution(iPoint,0), config->GetInlet_Ttotal(Marker_Tag)/config->GetTemperature_Ref());
@@ -988,8 +988,8 @@ void CHeatSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container,
for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim];
Area = sqrt (Area);
- Coord_i = geometry->node[iPoint]->GetCoord();
- Coord_j = geometry->node[Point_Normal]->GetCoord();
+ Coord_i = geometry->nodes->GetCoord(iPoint);
+ Coord_j = geometry->nodes->GetCoord(Point_Normal);
dist_ij = 0;
for (iDim = 0; iDim < nDim; iDim++)
dist_ij += (Coord_j[iDim]-Coord_i[iDim])*(Coord_j[iDim]-Coord_i[iDim]);
@@ -1037,7 +1037,7 @@ void CHeatSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor();
@@ -1062,7 +1062,7 @@ void CHeatSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
conv_numerics->SetPrimitive(V_domain, V_outlet);
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint));
conv_numerics->SetTemperature(nodes->GetSolution(iPoint,0), nodes->GetSolution(Point_Normal,0));
@@ -1112,7 +1112,7 @@ void CHeatSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **solv
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
Normal = geometry->vertex[val_marker][iVertex]->GetNormal();
Area = 0.0;
@@ -1140,7 +1140,7 @@ void CHeatSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **solv
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
Normal = geometry->vertex[val_marker][iVertex]->GetNormal();
Area = 0.0;
@@ -1213,12 +1213,12 @@ void CHeatSolver::Heat_Fluxes(CGeometry *geometry, CSolver **solver_container, C
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if(geometry->node[iPoint]->GetDomain()) {
+ if(geometry->nodes->GetDomain(iPoint)) {
iPointNormal = geometry->vertex[iMarker][iVertex]->GetNormal_Neighbor();
- Coord = geometry->node[iPoint]->GetCoord();
- Coord_Normal = geometry->node[iPointNormal]->GetCoord();
+ Coord = geometry->nodes->GetCoord(iPoint);
+ Coord_Normal = geometry->nodes->GetCoord(iPointNormal);
Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
Area = 0.0;
@@ -1251,14 +1251,14 @@ void CHeatSolver::Heat_Fluxes(CGeometry *geometry, CSolver **solver_container, C
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if(geometry->node[iPoint]->GetDomain()) {
+ if(geometry->nodes->GetDomain(iPoint)) {
iPointNormal = geometry->vertex[iMarker][iVertex]->GetNormal_Neighbor();
Twall = nodes->GetSolution(iPoint,0);
- Coord = geometry->node[iPoint]->GetCoord();
- Coord_Normal = geometry->node[iPointNormal]->GetCoord();
+ Coord = geometry->nodes->GetCoord(iPoint);
+ Coord_Normal = geometry->nodes->GetCoord(iPointNormal);
Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
Area = 0.0;
@@ -1372,8 +1372,8 @@ void CHeatSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
Mean_SoundSpeed = sqrt(Mean_ProjVel*Mean_ProjVel + (Mean_BetaInc2/Mean_DensityInc)*Area*Area);
Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed;
- if (geometry->node[iPoint]->GetDomain()) nodes->AddMax_Lambda_Inv(iPoint, Lambda);
- if (geometry->node[jPoint]->GetDomain()) nodes->AddMax_Lambda_Inv(jPoint, Lambda);
+ if (geometry->nodes->GetDomain(iPoint)) nodes->AddMax_Lambda_Inv(iPoint, Lambda);
+ if (geometry->nodes->GetDomain(jPoint)) nodes->AddMax_Lambda_Inv(jPoint, Lambda);
}
/*--- Viscous contribution ---*/
@@ -1388,8 +1388,8 @@ void CHeatSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
}
Lambda = thermal_diffusivity*Area*Area;
- if (geometry->node[iPoint]->GetDomain()) nodes->AddMax_Lambda_Visc(iPoint, Lambda);
- if (geometry->node[jPoint]->GetDomain()) nodes->AddMax_Lambda_Visc(jPoint, Lambda);
+ if (geometry->nodes->GetDomain(iPoint)) nodes->AddMax_Lambda_Visc(iPoint, Lambda);
+ if (geometry->nodes->GetDomain(jPoint)) nodes->AddMax_Lambda_Visc(jPoint, Lambda);
}
@@ -1413,7 +1413,7 @@ void CHeatSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
Mean_SoundSpeed = sqrt(Mean_ProjVel*Mean_ProjVel + (Mean_BetaInc2/Mean_DensityInc)*Area*Area);
Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed;
- if (geometry->node[iPoint]->GetDomain()) nodes->AddMax_Lambda_Inv(iPoint, Lambda);
+ if (geometry->nodes->GetDomain(iPoint)) nodes->AddMax_Lambda_Inv(iPoint, Lambda);
}
/*--- Viscous contribution ---*/
@@ -1428,7 +1428,7 @@ void CHeatSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
}
Lambda = thermal_diffusivity*Area*Area;
- if (geometry->node[iPoint]->GetDomain()) nodes->AddMax_Lambda_Visc(iPoint, Lambda);
+ if (geometry->nodes->GetDomain(iPoint)) nodes->AddMax_Lambda_Visc(iPoint, Lambda);
}
}
@@ -1437,7 +1437,7 @@ void CHeatSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
- Vol = geometry->node[iPoint]->GetVolume();
+ Vol = geometry->nodes->GetVolume(iPoint);
if (Vol != 0.0) {
@@ -1552,7 +1552,7 @@ void CHeatSolver::ExplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_
/*--- Update the solution ---*/
for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
- Vol = geometry->node[iPoint]->GetVolume();
+ Vol = geometry->nodes->GetVolume(iPoint);
Delta = nodes->GetDelta_Time(iPoint) / Vol;
local_Res_TruncError = nodes->GetResTruncError(iPoint);
@@ -1563,7 +1563,7 @@ void CHeatSolver::ExplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_
Res = local_Residual[iVar] + local_Res_TruncError[iVar];
nodes->AddSolution(iPoint,iVar, -Res*Delta);
AddRes_RMS(iVar, Res*Res);
- AddRes_Max(iVar, fabs(Res), geometry->node[iPoint]->GetGlobalIndex(), geometry->node[iPoint]->GetCoord());
+ AddRes_Max(iVar, fabs(Res), geometry->nodes->GetGlobalIndex(iPoint), geometry->nodes->GetCoord(iPoint));
}
}
@@ -1609,7 +1609,7 @@ void CHeatSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_
/*--- Read the volume ---*/
- Vol = geometry->node[iPoint]->GetVolume();
+ Vol = geometry->nodes->GetVolume(iPoint);
/*--- Modify matrix diagonal to assure diagonal dominance ---*/
@@ -1640,7 +1640,7 @@ void CHeatSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_
LinSysRes[total_index] = - (LinSysRes[total_index] + local_Res_TruncError[iVar]);
LinSysSol[total_index] = 0.0;
AddRes_RMS(iVar, LinSysRes[total_index]*LinSysRes[total_index]);
- AddRes_Max(iVar, fabs(LinSysRes[total_index]), geometry->node[iPoint]->GetGlobalIndex(), geometry->node[iPoint]->GetCoord());
+ AddRes_Max(iVar, fabs(LinSysRes[total_index]), geometry->nodes->GetGlobalIndex(iPoint), geometry->nodes->GetCoord(iPoint));
}
}
@@ -1693,11 +1693,11 @@ void CHeatSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solver_co
Solution = new su2double[nVar];
for (iMesh = 1; iMesh <= config->GetnMGLevels(); iMesh++) {
for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) {
- Area_Parent = geometry[iMesh]->node[iPoint]->GetVolume();
+ Area_Parent = geometry[iMesh]->nodes->GetVolume(iPoint);
for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 0.0;
- for (iChildren = 0; iChildren < geometry[iMesh]->node[iPoint]->GetnChildren_CV(); iChildren++) {
- Point_Fine = geometry[iMesh]->node[iPoint]->GetChildren_CV(iChildren);
- Area_Children = geometry[iMesh-1]->node[Point_Fine]->GetVolume();
+ for (iChildren = 0; iChildren < geometry[iMesh]->nodes->GetnChildren_CV(iPoint); iChildren++) {
+ Point_Fine = geometry[iMesh]->nodes->GetChildren_CV(iPoint, iChildren);
+ Area_Children = geometry[iMesh-1]->nodes->GetVolume(Point_Fine);
Solution_Fine = solver_container[iMesh-1][HEAT_SOL]->GetNodes()->GetSolution(Point_Fine);
for (iVar = 0; iVar < nVar; iVar++) {
Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent;
@@ -1775,7 +1775,7 @@ void CHeatSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_con
/*--- CV volume at time n+1. As we are on a static mesh, the volume
of the CV will remained fixed for all time steps. ---*/
- Volume_nP1 = geometry->node[iPoint]->GetVolume();
+ Volume_nP1 = geometry->nodes->GetVolume(iPoint);
/*--- Compute the dual time-stepping source term based on the chosen
time discretization scheme (1st- or 2nd-order).---*/
diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp
index 7229f84819f2..a42f8df0080e 100644
--- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp
+++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp
@@ -1399,7 +1399,7 @@ void CIncEulerSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solve
for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) {
/* Set the pointers to the coordinates and solution of this DOF. */
- const su2double *coor = geometry[iMesh]->node[iPoint]->GetCoord();
+ const su2double *coor = geometry[iMesh]->nodes->GetCoord(iPoint);
su2double *solDOF = solver_container[iMesh][FLOW_SOL]->GetNodes()->GetSolution(iPoint);
/* Set the solution in this DOF to the initial condition provided by
@@ -1418,11 +1418,11 @@ void CIncEulerSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solve
Solution = new su2double[nVar];
for (iMesh = 1; iMesh <= config->GetnMGLevels(); iMesh++) {
for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) {
- Area_Parent = geometry[iMesh]->node[iPoint]->GetVolume();
+ Area_Parent = geometry[iMesh]->nodes->GetVolume(iPoint);
for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 0.0;
- for (iChildren = 0; iChildren < geometry[iMesh]->node[iPoint]->GetnChildren_CV(); iChildren++) {
- Point_Fine = geometry[iMesh]->node[iPoint]->GetChildren_CV(iChildren);
- Area_Children = geometry[iMesh-1]->node[Point_Fine]->GetVolume();
+ for (iChildren = 0; iChildren < geometry[iMesh]->nodes->GetnChildren_CV(iPoint); iChildren++) {
+ Point_Fine = geometry[iMesh]->nodes->GetChildren_CV(iPoint, iChildren);
+ Area_Children = geometry[iMesh-1]->nodes->GetVolume(Point_Fine);
Solution_Fine = solver_container[iMesh-1][FLOW_SOL]->GetNodes()->GetSolution(Point_Fine);
for (iVar = 0; iVar < nVar; iVar++) {
Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent;
@@ -1443,11 +1443,11 @@ void CIncEulerSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solve
Solution = new su2double[nVar_Turb];
for (iMesh = 1; iMesh <= config->GetnMGLevels(); iMesh++) {
for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) {
- Area_Parent = geometry[iMesh]->node[iPoint]->GetVolume();
+ Area_Parent = geometry[iMesh]->nodes->GetVolume(iPoint);
for (iVar = 0; iVar < nVar_Turb; iVar++) Solution[iVar] = 0.0;
- for (iChildren = 0; iChildren < geometry[iMesh]->node[iPoint]->GetnChildren_CV(); iChildren++) {
- Point_Fine = geometry[iMesh]->node[iPoint]->GetChildren_CV(iChildren);
- Area_Children = geometry[iMesh-1]->node[Point_Fine]->GetVolume();
+ for (iChildren = 0; iChildren < geometry[iMesh]->nodes->GetnChildren_CV(iPoint); iChildren++) {
+ Point_Fine = geometry[iMesh]->nodes->GetChildren_CV(iPoint, iChildren);
+ Area_Children = geometry[iMesh-1]->nodes->GetVolume(Point_Fine);
Solution_Fine = solver_container[iMesh-1][TURB_SOL]->GetNodes()->GetSolution(Point_Fine);
for (iVar = 0; iVar < nVar_Turb; iVar++) {
Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent;
@@ -1650,8 +1650,8 @@ void CIncEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_contain
/*--- Adjustment for grid movement ---*/
if (dynamic_grid) {
- su2double *GridVel_i = geometry->node[iPoint]->GetGridVel();
- su2double *GridVel_j = geometry->node[jPoint]->GetGridVel();
+ su2double *GridVel_i = geometry->nodes->GetGridVel(iPoint);
+ su2double *GridVel_j = geometry->nodes->GetGridVel(jPoint);
ProjVel_i = 0.0; ProjVel_j = 0.0;
for (iDim = 0; iDim < nDim; iDim++) {
ProjVel_i += GridVel_i[iDim]*Normal[iDim];
@@ -1663,8 +1663,8 @@ void CIncEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_contain
/*--- Inviscid contribution ---*/
Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed;
- if (geometry->node[iPoint]->GetDomain()) nodes->AddMax_Lambda_Inv(iPoint,Lambda);
- if (geometry->node[jPoint]->GetDomain()) nodes->AddMax_Lambda_Inv(jPoint,Lambda);
+ if (geometry->nodes->GetDomain(iPoint)) nodes->AddMax_Lambda_Inv(iPoint,Lambda);
+ if (geometry->nodes->GetDomain(jPoint)) nodes->AddMax_Lambda_Inv(jPoint,Lambda);
}
@@ -1693,7 +1693,7 @@ void CIncEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_contain
/*--- Adjustment for grid movement ---*/
if (dynamic_grid) {
- su2double *GridVel = geometry->node[iPoint]->GetGridVel();
+ su2double *GridVel = geometry->nodes->GetGridVel(iPoint);
ProjVel = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
ProjVel += GridVel[iDim]*Normal[iDim];
@@ -1703,7 +1703,7 @@ void CIncEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_contain
/*--- Inviscid contribution ---*/
Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed;
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
nodes->AddMax_Lambda_Inv(iPoint,Lambda);
}
@@ -1716,7 +1716,7 @@ void CIncEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_contain
for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
- Vol = geometry->node[iPoint]->GetVolume();
+ Vol = geometry->nodes->GetVolume(iPoint);
if (Vol != 0.0) {
Local_Delta_Time = nodes->GetLocalCFL(iPoint)*Vol / nodes->GetMax_Lambda_Inv(iPoint);
@@ -1828,7 +1828,7 @@ void CIncEulerSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_co
iPoint = geometry->edges->GetNode(iEdge,0); jPoint = geometry->edges->GetNode(iEdge,1);
numerics->SetNormal(geometry->edges->GetNormal(iEdge));
- numerics->SetNeighbor(geometry->node[iPoint]->GetnNeighbor(), geometry->node[jPoint]->GetnNeighbor());
+ numerics->SetNeighbor(geometry->nodes->GetnNeighbor(iPoint), geometry->nodes->GetnNeighbor(jPoint));
/*--- Set primitive variables w/o reconstruction ---*/
@@ -1848,7 +1848,7 @@ void CIncEulerSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_co
/*--- Grid movement ---*/
if (dynamic_grid) {
- numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[jPoint]->GetGridVel());
+ numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(jPoint));
}
/*--- Compute residuals, and Jacobians ---*/
@@ -1898,7 +1898,7 @@ void CIncEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont
/*--- Grid movement ---*/
if (dynamic_grid)
- numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[jPoint]->GetGridVel());
+ numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(jPoint));
/*--- Get primitive variables ---*/
@@ -1910,8 +1910,8 @@ void CIncEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont
if (muscl) {
for (iDim = 0; iDim < nDim; iDim++) {
- Vector_i[iDim] = 0.5*(geometry->node[jPoint]->GetCoord(iDim) - geometry->node[iPoint]->GetCoord(iDim));
- Vector_j[iDim] = 0.5*(geometry->node[iPoint]->GetCoord(iDim) - geometry->node[jPoint]->GetCoord(iDim));
+ Vector_i[iDim] = 0.5*(geometry->nodes->GetCoord(jPoint, iDim) - geometry->nodes->GetCoord(iPoint, iDim));
+ Vector_j[iDim] = 0.5*(geometry->nodes->GetCoord(iPoint, iDim) - geometry->nodes->GetCoord(jPoint, iDim));
}
Gradient_i = nodes->GetGradient_Reconstruction(iPoint);
@@ -2061,7 +2061,7 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont
/*--- Load the volume of the dual mesh cell ---*/
- numerics->SetVolume(geometry->node[iPoint]->GetVolume());
+ numerics->SetVolume(geometry->nodes->GetVolume(iPoint));
/*--- Compute the rotating frame source residual ---*/
@@ -2092,7 +2092,7 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont
/*--- Load the volume of the dual mesh cell ---*/
- numerics->SetVolume(geometry->node[iPoint]->GetVolume());
+ numerics->SetVolume(geometry->nodes->GetVolume(iPoint));
/*--- Compute the rotating frame source residual ---*/
@@ -2121,7 +2121,7 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont
/*--- Load the volume of the dual mesh cell ---*/
- numerics->SetVolume(geometry->node[iPoint]->GetVolume());
+ numerics->SetVolume(geometry->nodes->GetVolume(iPoint));
/*--- Compute the rotating frame source residual ---*/
@@ -2146,7 +2146,7 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont
for (iPoint = 0; iPoint < nPoint; iPoint++) {
- su2double yCoord = geometry->node[iPoint]->GetCoord(1);
+ su2double yCoord = geometry->nodes->GetCoord(iPoint, 1);
su2double yVelocity = nodes->GetVelocity(iPoint,1);
su2double Total_Viscosity = (nodes->GetLaminarViscosity(iPoint) +
nodes->GetEddyViscosity(iPoint));
@@ -2186,12 +2186,12 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont
/*--- Set control volume ---*/
- numerics->SetVolume(geometry->node[iPoint]->GetVolume());
+ numerics->SetVolume(geometry->nodes->GetVolume(iPoint));
/*--- Set y coordinate ---*/
- numerics->SetCoord(geometry->node[iPoint]->GetCoord(),
- geometry->node[iPoint]->GetCoord());
+ numerics->SetCoord(geometry->nodes->GetCoord(iPoint),
+ geometry->nodes->GetCoord(iPoint));
/*--- If viscous, we need gradients for extra terms. ---*/
@@ -2235,7 +2235,7 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont
/*--- Set control volume ---*/
- second_numerics->SetVolume(geometry->node[iPoint]->GetVolume());
+ second_numerics->SetVolume(geometry->nodes->GetVolume(iPoint));
/*--- Compute the residual ---*/
@@ -2253,7 +2253,7 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont
if(solver_container[RAD_SOL]->GetNodes()->GetVol_HeatSource(iPoint)) {
- auto Volume = geometry->node[iPoint]->GetVolume();
+ auto Volume = geometry->nodes->GetVolume(iPoint);
/*--- Subtract integrated source from the residual. ---*/
LinSysRes(iPoint, nDim+1) -= config->GetHeatSource_Val()*Volume;
@@ -2278,10 +2278,10 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont
for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
/*--- Get control volume size. ---*/
- su2double Volume = geometry->node[iPoint]->GetVolume();
+ su2double Volume = geometry->nodes->GetVolume(iPoint);
/*--- Get the current point coordinates. ---*/
- const su2double *coor = geometry->node[iPoint]->GetCoord();
+ const su2double *coor = geometry->nodes->GetCoord(iPoint);
/*--- Get the MMS source term. ---*/
vector sourceMan(nVar,0.0);
@@ -2350,8 +2350,8 @@ void CIncEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) {
/*--- Adjustment for grid movement ---*/
if (dynamic_grid) {
- GridVel_i = geometry->node[iPoint]->GetGridVel();
- GridVel_j = geometry->node[jPoint]->GetGridVel();
+ GridVel_i = geometry->nodes->GetGridVel(iPoint);
+ GridVel_j = geometry->nodes->GetGridVel(jPoint);
ProjVel_i = 0.0; ProjVel_j =0.0;
for (iDim = 0; iDim < nDim; iDim++) {
ProjVel_i += GridVel_i[iDim]*Normal[iDim];
@@ -2363,8 +2363,8 @@ void CIncEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) {
/*--- Inviscid contribution ---*/
Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed;
- if (geometry->node[iPoint]->GetDomain()) nodes->AddLambda(iPoint,Lambda);
- if (geometry->node[jPoint]->GetDomain()) nodes->AddLambda(jPoint,Lambda);
+ if (geometry->nodes->GetDomain(iPoint)) nodes->AddLambda(iPoint,Lambda);
+ if (geometry->nodes->GetDomain(jPoint)) nodes->AddLambda(jPoint,Lambda);
}
@@ -2392,7 +2392,7 @@ void CIncEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) {
/*--- Adjustment for grid movement ---*/
if (dynamic_grid) {
- GridVel = geometry->node[iPoint]->GetGridVel();
+ GridVel = geometry->nodes->GetGridVel(iPoint);
ProjVel = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
ProjVel += GridVel[iDim]*Normal[iDim];
@@ -2402,7 +2402,7 @@ void CIncEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) {
/*--- Inviscid contribution ---*/
Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed;
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
nodes->AddLambda(iPoint,Lambda);
}
@@ -2445,25 +2445,25 @@ void CIncEulerSolver::SetUndivided_Laplacian(CGeometry *geometry, CConfig *confi
for (iVar = 0; iVar < nVar; iVar++)
Diff[iVar] = nodes->GetSolution(iPoint,iVar) - nodes->GetSolution(jPoint,iVar);
- boundary_i = geometry->node[iPoint]->GetPhysicalBoundary();
- boundary_j = geometry->node[jPoint]->GetPhysicalBoundary();
+ boundary_i = geometry->nodes->GetPhysicalBoundary(iPoint);
+ boundary_j = geometry->nodes->GetPhysicalBoundary(jPoint);
/*--- Both points inside the domain, or both in the boundary ---*/
if ((!boundary_i && !boundary_j) || (boundary_i && boundary_j)) {
- if (geometry->node[iPoint]->GetDomain()) nodes->SubtractUnd_Lapl(iPoint,Diff);
- if (geometry->node[jPoint]->GetDomain()) nodes->AddUnd_Lapl(jPoint,Diff);
+ if (geometry->nodes->GetDomain(iPoint)) nodes->SubtractUnd_Lapl(iPoint,Diff);
+ if (geometry->nodes->GetDomain(jPoint)) nodes->AddUnd_Lapl(jPoint,Diff);
}
/*--- iPoint inside the domain, jPoint on the boundary ---*/
if (!boundary_i && boundary_j)
- if (geometry->node[iPoint]->GetDomain()) nodes->SubtractUnd_Lapl(iPoint,Diff);
+ if (geometry->nodes->GetDomain(iPoint)) nodes->SubtractUnd_Lapl(iPoint,Diff);
/*--- jPoint inside the domain, iPoint on the boundary ---*/
if (boundary_i && !boundary_j)
- if (geometry->node[jPoint]->GetDomain()) nodes->AddUnd_Lapl(jPoint,Diff);
+ if (geometry->nodes->GetDomain(jPoint)) nodes->AddUnd_Lapl(jPoint,Diff);
}
@@ -2508,19 +2508,19 @@ void CIncEulerSolver::SetCentered_Dissipation_Sensor(CGeometry *geometry, CConfi
Pressure_i = nodes->GetDensity(iPoint);
Pressure_j = nodes->GetDensity(jPoint);
- boundary_i = geometry->node[iPoint]->GetPhysicalBoundary();
- boundary_j = geometry->node[jPoint]->GetPhysicalBoundary();
+ boundary_i = geometry->nodes->GetPhysicalBoundary(iPoint);
+ boundary_j = geometry->nodes->GetPhysicalBoundary(jPoint);
/*--- Both points inside the domain, or both on the boundary ---*/
if ((!boundary_i && !boundary_j) || (boundary_i && boundary_j)) {
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
iPoint_UndLapl[iPoint] += (Pressure_j - Pressure_i);
jPoint_UndLapl[iPoint] += (Pressure_i + Pressure_j);
}
- if (geometry->node[jPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(jPoint)) {
iPoint_UndLapl[jPoint] += (Pressure_i - Pressure_j);
jPoint_UndLapl[jPoint] += (Pressure_i + Pressure_j);
}
@@ -2530,7 +2530,7 @@ void CIncEulerSolver::SetCentered_Dissipation_Sensor(CGeometry *geometry, CConfi
/*--- iPoint inside the domain, jPoint on the boundary ---*/
if (!boundary_i && boundary_j)
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
iPoint_UndLapl[iPoint] += (Pressure_j - Pressure_i);
jPoint_UndLapl[iPoint] += (Pressure_i + Pressure_j);
}
@@ -2538,7 +2538,7 @@ void CIncEulerSolver::SetCentered_Dissipation_Sensor(CGeometry *geometry, CConfi
/*--- jPoint inside the domain, iPoint on the boundary ---*/
if (boundary_i && !boundary_j)
- if (geometry->node[jPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(jPoint)) {
iPoint_UndLapl[jPoint] += (Pressure_i - Pressure_j);
jPoint_UndLapl[jPoint] += (Pressure_i + Pressure_j);
}
@@ -2701,10 +2701,10 @@ void CIncEulerSolver::Pressure_Forces(CGeometry *geometry, CConfig *config) {
/*--- Note that the pressure coefficient is computed at the
halo cells (for visualization purposes), but not the forces ---*/
- if ( (geometry->node[iPoint]->GetDomain()) && (Monitoring == YES) ) {
+ if ( (geometry->nodes->GetDomain(iPoint)) && (Monitoring == YES) ) {
Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
- Coord = geometry->node[iPoint]->GetCoord();
+ Coord = geometry->nodes->GetCoord(iPoint);
for (iDim = 0; iDim < nDim; iDim++) {
MomentDist[iDim] = Coord[iDim] - Origin[iDim];
@@ -2712,7 +2712,7 @@ void CIncEulerSolver::Pressure_Forces(CGeometry *geometry, CConfig *config) {
/*--- Axisymmetric simulations ---*/
- if (axisymmetric) AxiFactor = 2.0*PI_NUMBER*geometry->node[iPoint]->GetCoord(1);
+ if (axisymmetric) AxiFactor = 2.0*PI_NUMBER*geometry->nodes->GetCoord(iPoint, 1);
else AxiFactor = 1.0;
/*--- Force computation, note the minus sign due to the
@@ -3072,10 +3072,10 @@ void CIncEulerSolver::Momentum_Forces(CGeometry *geometry, CConfig *config) {
/*--- Note that the pressure coefficient is computed at the
halo cells (for visualization purposes), but not the forces ---*/
- if ( (geometry->node[iPoint]->GetDomain()) && (Monitoring == YES) ) {
+ if ( (geometry->nodes->GetDomain(iPoint)) && (Monitoring == YES) ) {
Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
- Coord = geometry->node[iPoint]->GetCoord();
+ Coord = geometry->nodes->GetCoord(iPoint);
Density = nodes->GetDensity(iPoint);
Area = 0.0;
@@ -3092,7 +3092,7 @@ void CIncEulerSolver::Momentum_Forces(CGeometry *geometry, CConfig *config) {
/*--- Axisymmetric simulations ---*/
- if (axisymmetric) AxiFactor = 2.0*PI_NUMBER*geometry->node[iPoint]->GetCoord(1);
+ if (axisymmetric) AxiFactor = 2.0*PI_NUMBER*geometry->nodes->GetCoord(iPoint, 1);
else AxiFactor = 1.0;
/*--- Force computation, note the minus sign due to the
@@ -3351,8 +3351,8 @@ void CIncEulerSolver::ExplicitRK_Iteration(CGeometry *geometry, CSolver **solver
/*--- Update the solution ---*/
for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
- Vol = (geometry->node[iPoint]->GetVolume() +
- geometry->node[iPoint]->GetPeriodicVolume());
+ Vol = (geometry->nodes->GetVolume(iPoint) +
+ geometry->nodes->GetPeriodicVolume(iPoint));
Delta = nodes->GetDelta_Time(iPoint) / Vol;
Res_TruncError = nodes->GetResTruncError(iPoint);
@@ -3366,7 +3366,7 @@ void CIncEulerSolver::ExplicitRK_Iteration(CGeometry *geometry, CSolver **solver
Res += Preconditioner[iVar][jVar]*(Residual[jVar] + Res_TruncError[jVar]);
nodes->AddSolution(iPoint,iVar, -Res*Delta*RK_AlphaCoeff);
AddRes_RMS(iVar, Res*Res);
- AddRes_Max(iVar, fabs(Res), geometry->node[iPoint]->GetGlobalIndex(), geometry->node[iPoint]->GetCoord());
+ AddRes_Max(iVar, fabs(Res), geometry->nodes->GetGlobalIndex(iPoint), geometry->nodes->GetCoord(iPoint));
}
}
}
@@ -3402,8 +3402,8 @@ void CIncEulerSolver::ExplicitEuler_Iteration(CGeometry *geometry, CSolver **sol
/*--- Update the solution ---*/
for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
- Vol = (geometry->node[iPoint]->GetVolume() +
- geometry->node[iPoint]->GetPeriodicVolume());
+ Vol = (geometry->nodes->GetVolume(iPoint) +
+ geometry->nodes->GetPeriodicVolume(iPoint));
Delta = nodes->GetDelta_Time(iPoint) / Vol;
local_Res_TruncError = nodes->GetResTruncError(iPoint);
@@ -3418,7 +3418,7 @@ void CIncEulerSolver::ExplicitEuler_Iteration(CGeometry *geometry, CSolver **sol
Res += Preconditioner[iVar][jVar]*(local_Residual[jVar] + local_Res_TruncError[jVar]);
nodes->AddSolution(iPoint,iVar, -Res*Delta);
AddRes_RMS(iVar, Res*Res);
- AddRes_Max(iVar, fabs(Res), geometry->node[iPoint]->GetGlobalIndex(), geometry->node[iPoint]->GetCoord());
+ AddRes_Max(iVar, fabs(Res), geometry->nodes->GetGlobalIndex(iPoint), geometry->nodes->GetCoord(iPoint));
}
}
}
@@ -3463,8 +3463,8 @@ void CIncEulerSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **sol
/*--- Read the volume ---*/
- Vol = (geometry->node[iPoint]->GetVolume() +
- geometry->node[iPoint]->GetPeriodicVolume());
+ Vol = (geometry->nodes->GetVolume(iPoint) +
+ geometry->nodes->GetPeriodicVolume(iPoint));
/*--- Apply the preconditioner and add to the diagonal. ---*/
@@ -3493,7 +3493,7 @@ void CIncEulerSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **sol
LinSysRes[total_index] = - (LinSysRes[total_index] + local_Res_TruncError[iVar]);
LinSysSol[total_index] = 0.0;
AddRes_RMS(iVar, LinSysRes[total_index]*LinSysRes[total_index]);
- AddRes_Max(iVar, fabs(LinSysRes[total_index]), geometry->node[iPoint]->GetGlobalIndex(), geometry->node[iPoint]->GetCoord());
+ AddRes_Max(iVar, fabs(LinSysRes[total_index]), geometry->nodes->GetGlobalIndex(iPoint), geometry->nodes->GetCoord(iPoint));
}
}
@@ -4058,7 +4058,7 @@ void CIncEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Index of the closest interior node ---*/
@@ -4104,8 +4104,8 @@ void CIncEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain
conv_numerics->SetPrimitive(V_domain, V_infty);
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
- geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint),
+ geometry->nodes->GetGridVel(iPoint));
/*--- Compute the convective residual using an upwind scheme ---*/
@@ -4133,8 +4133,8 @@ void CIncEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain
/*--- Set the normal vector and the coordinates ---*/
visc_numerics->SetNormal(Normal);
- visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(),
- geometry->node[Point_Normal]->GetCoord());
+ visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint),
+ geometry->nodes->GetCoord(Point_Normal));
/*--- Primitive variables, and gradient ---*/
@@ -4201,7 +4201,7 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container,
/*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Index of the closest interior node ---*/
@@ -4356,8 +4356,8 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container,
conv_numerics->SetPrimitive(V_domain, V_inlet);
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
- geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint),
+ geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
@@ -4385,8 +4385,8 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container,
/*--- Set the normal vector and the coordinates ---*/
visc_numerics->SetNormal(Normal);
- visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(),
- geometry->node[Point_Normal]->GetCoord());
+ visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint),
+ geometry->nodes->GetCoord(Point_Normal));
/*--- Primitive variables, and gradient ---*/
@@ -4451,7 +4451,7 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
/*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Index of the closest interior node ---*/
@@ -4564,8 +4564,8 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
conv_numerics->SetPrimitive(V_domain, V_outlet);
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
- geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint),
+ geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
@@ -4594,8 +4594,8 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
/*--- Set the normal vector and the coordinates ---*/
visc_numerics->SetNormal(Normal);
- visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(),
- geometry->node[Point_Normal]->GetCoord());
+ visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint),
+ geometry->nodes->GetCoord(Point_Normal));
/*--- Primitive variables, and gradient ---*/
@@ -4744,7 +4744,7 @@ void CIncEulerSolver::BC_Sym_Plane(CGeometry *geometry,
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
/*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*-------------------------------------------------------------------------------*/
/*--- Step 1: For the convective fluxes, create a reflected state of the ---*/
@@ -4758,7 +4758,7 @@ void CIncEulerSolver::BC_Sym_Plane(CGeometry *geometry,
/*--- Grid movement ---*/
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint));
/*--- Normal vector for this vertex (negate for outward convention). ---*/
geometry->vertex[val_marker][iVertex]->GetNormal(Normal);
@@ -4809,8 +4809,8 @@ void CIncEulerSolver::BC_Sym_Plane(CGeometry *geometry,
/*-------------------------------------------------------------------------------*/
/*--- Set the normal vector and the coordinates. ---*/
- visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(),
- geometry->node[iPoint]->GetCoord());
+ visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint),
+ geometry->nodes->GetCoord(iPoint));
visc_numerics->SetNormal(Normal);
/*--- Set the primitive and Secondary variables. ---*/
@@ -4937,7 +4937,7 @@ void CIncEulerSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_c
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
nDonorVertex = GetnSlidingStates(iMarker, iVertex);
@@ -4977,7 +4977,7 @@ void CIncEulerSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_c
conv_numerics->SetNormal(Normal);
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint));
/*--- Compute the convective residual using an upwind scheme ---*/
@@ -5022,7 +5022,7 @@ void CIncEulerSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_c
/*--- Set the normal vector and the coordinates ---*/
visc_numerics->SetNormal(Normal);
- visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+ visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
/*--- Primitive variables, and gradient ---*/
@@ -5120,11 +5120,11 @@ void CIncEulerSolver::BC_Custom(CGeometry *geometry,
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Get the coordinates for the current node. ---*/
- const su2double *coor = geometry->node[iPoint]->GetCoord();
+ const su2double *coor = geometry->nodes->GetCoord(iPoint);
/*--- Get the conservative state from the verification solution. ---*/
@@ -5233,7 +5233,7 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
/*--- CV volume at time n+1. As we are on a static mesh, the volume
of the CV will remained fixed for all time steps. ---*/
- Volume_nP1 = geometry->node[iPoint]->GetVolume();
+ Volume_nP1 = geometry->nodes->GetVolume(iPoint);
/*--- Compute the dual time-stepping source term based on the chosen
time discretization scheme (1st- or 2nd-order). Note that for an
@@ -5311,8 +5311,8 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
/*--- Grid velocities stored at nodes i & j ---*/
- GridVel_i = geometry->node[iPoint]->GetGridVel();
- GridVel_j = geometry->node[jPoint]->GetGridVel();
+ GridVel_i = geometry->nodes->GetGridVel(iPoint);
+ GridVel_j = geometry->nodes->GetGridVel(jPoint);
/*--- Compute the GCL term by averaging the grid velocities at the
edge mid-point and dotting with the face normal. ---*/
@@ -5380,7 +5380,7 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
/*--- Grid velocities stored at boundary node i ---*/
- GridVel_i = geometry->node[iPoint]->GetGridVel();
+ GridVel_i = geometry->nodes->GetGridVel(iPoint);
/*--- Compute the GCL term by dotting the grid velocity with the face
normal. The normal is negated to match the boundary convention. ---*/
@@ -5462,8 +5462,8 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
grids, the volumes will change. On rigidly transforming grids, the
volumes will remain constant. ---*/
- Volume_nM1 = geometry->node[iPoint]->GetVolume_nM1();
- Volume_nP1 = geometry->node[iPoint]->GetVolume();
+ Volume_nM1 = geometry->nodes->GetVolume_nM1(iPoint);
+ Volume_nP1 = geometry->nodes->GetVolume(iPoint);
/*--- Compute the dual time-stepping source residual. Due to the
introduction of the GCL term above, the remainder of the source residual
@@ -5564,15 +5564,15 @@ void CIncEulerSolver::GetOutlet_Properties(CGeometry *geometry, CConfig *config,
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
V_outlet = nodes->GetPrimitive(iPoint);
geometry->vertex[iMarker][iVertex]->GetNormal(Vector);
if (axisymmetric) {
- if (geometry->node[iPoint]->GetCoord(1) != 0.0)
- AxiFactor = 2.0*PI_NUMBER*geometry->node[iPoint]->GetCoord(1);
+ if (geometry->nodes->GetCoord(iPoint, 1) != 0.0)
+ AxiFactor = 2.0*PI_NUMBER*geometry->nodes->GetCoord(iPoint, 1);
else
AxiFactor = 1.0;
} else {
@@ -5761,7 +5761,7 @@ void CIncEulerSolver::ComputeVerificationError(CGeometry *geometry,
for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) {
/* Set the pointers to the coordinates and solution of this DOF. */
- const su2double *coor = geometry->node[iPoint]->GetCoord();
+ const su2double *coor = geometry->nodes->GetCoord(iPoint);
su2double *solDOF = nodes->GetSolution(iPoint);
/* Get local error from the verification solution class. */
@@ -5772,8 +5772,8 @@ void CIncEulerSolver::ComputeVerificationError(CGeometry *geometry,
for (unsigned short iVar = 0; iVar < nVar; iVar++) {
VerificationSolution->AddError_RMS(iVar, error[iVar]*error[iVar]);
VerificationSolution->AddError_Max(iVar, fabs(error[iVar]),
- geometry->node[iPoint]->GetGlobalIndex(),
- geometry->node[iPoint]->GetCoord());
+ geometry->nodes->GetGlobalIndex(iPoint),
+ geometry->nodes->GetCoord(iPoint));
}
}
@@ -5918,8 +5918,8 @@ void CIncEulerSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConf
}
for (iDim = 0; iDim < nDim; iDim++) {
- geometry[MESH_0]->node[iPoint_Local]->SetCoord(iDim, Coord[iDim]);
- geometry[MESH_0]->node[iPoint_Local]->SetGridVel(iDim, GridVel[iDim]);
+ geometry[MESH_0]->nodes->SetCoord(iPoint_Local, iDim, Coord[iDim]);
+ geometry[MESH_0]->nodes->SetGridVel(iPoint_Local, iDim, GridVel[iDim]);
}
}
@@ -5932,7 +5932,7 @@ void CIncEulerSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConf
for (iDim = 0; iDim < nDim; iDim++) { Coord[iDim] = Restart_Data[index+iDim];}
for (iDim = 0; iDim < nDim; iDim++) {
- geometry[MESH_0]->node[iPoint_Local]->SetCoord(iDim, Coord[iDim]);
+ geometry[MESH_0]->nodes->SetCoord(iPoint_Local, iDim, Coord[iDim]);
}
}
@@ -6004,11 +6004,11 @@ void CIncEulerSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConf
for (iMesh = 1; iMesh <= config->GetnMGLevels(); iMesh++) {
for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) {
- Area_Parent = geometry[iMesh]->node[iPoint]->GetVolume();
+ Area_Parent = geometry[iMesh]->nodes->GetVolume(iPoint);
for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 0.0;
- for (iChildren = 0; iChildren < geometry[iMesh]->node[iPoint]->GetnChildren_CV(); iChildren++) {
- Point_Fine = geometry[iMesh]->node[iPoint]->GetChildren_CV(iChildren);
- Area_Children = geometry[iMesh-1]->node[Point_Fine]->GetVolume();
+ for (iChildren = 0; iChildren < geometry[iMesh]->nodes->GetnChildren_CV(iPoint); iChildren++) {
+ Point_Fine = geometry[iMesh]->nodes->GetChildren_CV(iPoint, iChildren);
+ Area_Children = geometry[iMesh-1]->nodes->GetVolume(Point_Fine);
Solution_Fine = solver[iMesh-1][FLOW_SOL]->GetNodes()->GetSolution(Point_Fine);
for (iVar = 0; iVar < nVar; iVar++) {
Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent;
diff --git a/SU2_CFD/src/solvers/CIncNSSolver.cpp b/SU2_CFD/src/solvers/CIncNSSolver.cpp
index ceb151b1eb2e..45125810f250 100644
--- a/SU2_CFD/src/solvers/CIncNSSolver.cpp
+++ b/SU2_CFD/src/solvers/CIncNSSolver.cpp
@@ -895,8 +895,8 @@ void CIncNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
/*--- Adjustment for grid movement ---*/
if (dynamic_grid) {
- su2double *GridVel_i = geometry->node[iPoint]->GetGridVel();
- su2double *GridVel_j = geometry->node[jPoint]->GetGridVel();
+ su2double *GridVel_i = geometry->nodes->GetGridVel(iPoint);
+ su2double *GridVel_j = geometry->nodes->GetGridVel(jPoint);
ProjVel_i = 0.0; ProjVel_j =0.0;
for (iDim = 0; iDim < nDim; iDim++) {
ProjVel_i += GridVel_i[iDim]*Normal[iDim];
@@ -908,8 +908,8 @@ void CIncNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
/*--- Inviscid contribution ---*/
Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed;
- if (geometry->node[iPoint]->GetDomain()) nodes->AddMax_Lambda_Inv(iPoint,Lambda);
- if (geometry->node[jPoint]->GetDomain()) nodes->AddMax_Lambda_Inv(jPoint,Lambda);
+ if (geometry->nodes->GetDomain(iPoint)) nodes->AddMax_Lambda_Inv(iPoint,Lambda);
+ if (geometry->nodes->GetDomain(jPoint)) nodes->AddMax_Lambda_Inv(jPoint,Lambda);
/*--- Viscous contribution ---*/
@@ -924,8 +924,8 @@ void CIncNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
if (energy) Lambda_2 = (1.0/Mean_Cv)*Mean_Thermal_Conductivity;
Lambda = (Lambda_1 + Lambda_2)*Area*Area/Mean_Density;
- if (geometry->node[iPoint]->GetDomain()) nodes->AddMax_Lambda_Visc(iPoint,Lambda);
- if (geometry->node[jPoint]->GetDomain()) nodes->AddMax_Lambda_Visc(jPoint,Lambda);
+ if (geometry->nodes->GetDomain(iPoint)) nodes->AddMax_Lambda_Visc(iPoint,Lambda);
+ if (geometry->nodes->GetDomain(jPoint)) nodes->AddMax_Lambda_Visc(jPoint,Lambda);
}
@@ -952,7 +952,7 @@ void CIncNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
/*--- Adjustment for grid movement ---*/
if (dynamic_grid) {
- su2double *GridVel = geometry->node[iPoint]->GetGridVel();
+ su2double *GridVel = geometry->nodes->GetGridVel(iPoint);
ProjVel = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
ProjVel += GridVel[iDim]*Normal[iDim];
@@ -962,7 +962,7 @@ void CIncNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
/*--- Inviscid contribution ---*/
Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed;
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
nodes->AddMax_Lambda_Inv(iPoint,Lambda);
}
@@ -979,7 +979,7 @@ void CIncNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
if (energy) Lambda_2 = (1.0/Mean_Cv)*Mean_Thermal_Conductivity;
Lambda = (Lambda_1 + Lambda_2)*Area*Area/Mean_Density;
- if (geometry->node[iPoint]->GetDomain()) nodes->AddMax_Lambda_Visc(iPoint,Lambda);
+ if (geometry->nodes->GetDomain(iPoint)) nodes->AddMax_Lambda_Visc(iPoint,Lambda);
}
}
@@ -989,7 +989,7 @@ void CIncNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
- Vol = geometry->node[iPoint]->GetVolume();
+ Vol = geometry->nodes->GetVolume(iPoint);
if (Vol != 0.0) {
Local_Delta_Time = nodes->GetLocalCFL(iPoint)*Vol / nodes->GetMax_Lambda_Inv(iPoint);
@@ -1098,8 +1098,8 @@ void CIncNSSolver::Viscous_Residual(CGeometry *geometry, CSolver **solver_contai
iPoint = geometry->edges->GetNode(iEdge,0);
jPoint = geometry->edges->GetNode(iEdge,1);
- numerics->SetCoord(geometry->node[iPoint]->GetCoord(),
- geometry->node[jPoint]->GetCoord());
+ numerics->SetCoord(geometry->nodes->GetCoord(iPoint),
+ geometry->nodes->GetCoord(jPoint));
numerics->SetNormal(geometry->edges->GetNormal(iEdge));
/*--- Primitive and secondary variables ---*/
@@ -1249,8 +1249,8 @@ void CIncNSSolver::Friction_Forces(CGeometry *geometry, CConfig *config) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
iPointNormal = geometry->vertex[iMarker][iVertex]->GetNormal_Neighbor();
- Coord = geometry->node[iPoint]->GetCoord();
- Coord_Normal = geometry->node[iPointNormal]->GetCoord();
+ Coord = geometry->nodes->GetCoord(iPoint);
+ Coord_Normal = geometry->nodes->GetCoord(iPointNormal);
Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
@@ -1324,11 +1324,11 @@ void CIncNSSolver::Friction_Forces(CGeometry *geometry, CConfig *config) {
/*--- Note that y+, and heat are computed at the
halo cells (for visualization purposes), but not the forces ---*/
- if ((geometry->node[iPoint]->GetDomain()) && (Monitoring == YES)) {
+ if ((geometry->nodes->GetDomain(iPoint)) && (Monitoring == YES)) {
/*--- Axisymmetric simulations ---*/
- if (axisymmetric) AxiFactor = 2.0*PI_NUMBER*geometry->node[iPoint]->GetCoord(1);
+ if (axisymmetric) AxiFactor = 2.0*PI_NUMBER*geometry->nodes->GetCoord(iPoint, 1);
else AxiFactor = 1.0;
/*--- Force computation ---*/
@@ -1630,7 +1630,7 @@ void CIncNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_contai
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Compute dual-grid area and boundary normal ---*/
@@ -1656,7 +1656,7 @@ void CIncNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_contai
be zero (v = 0), unless there are moving walls (v = u_wall)---*/
if (dynamic_grid) {
- GridVel = geometry->node[iPoint]->GetGridVel();
+ GridVel = geometry->nodes->GetGridVel(iPoint);
for (iDim = 0; iDim < nDim; iDim++) Vector[iDim] = GridVel[iDim];
} else {
for (iDim = 0; iDim < nDim; iDim++) Vector[iDim] = 0.0;
@@ -1736,7 +1736,7 @@ void CIncNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_cont
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Initialize the convective & viscous residuals to zero ---*/
@@ -1753,7 +1753,7 @@ void CIncNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_cont
be zero (v = 0), unless there are moving walls (v = u_wall)---*/
if (dynamic_grid) {
- GridVel = geometry->node[iPoint]->GetGridVel();
+ GridVel = geometry->nodes->GetGridVel(iPoint);
for (iDim = 0; iDim < nDim; iDim++) Vector[iDim] = GridVel[iDim];
} else {
for (iDim = 0; iDim < nDim; iDim++) Vector[iDim] = 0.0;
@@ -1786,8 +1786,8 @@ void CIncNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_cont
/*--- Get coordinates of i & nearest normal and compute distance ---*/
- Coord_i = geometry->node[iPoint]->GetCoord();
- Coord_j = geometry->node[Point_Normal]->GetCoord();
+ Coord_i = geometry->nodes->GetCoord(iPoint);
+ Coord_j = geometry->nodes->GetCoord(Point_Normal);
dist_ij = 0;
for (iDim = 0; iDim < nDim; iDim++)
dist_ij += (Coord_j[iDim]-Coord_i[iDim])*(Coord_j[iDim]-Coord_i[iDim]);
@@ -1876,7 +1876,7 @@ void CIncNSSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **sol
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Initialize the convective & viscous residuals to zero ---*/
@@ -1893,7 +1893,7 @@ void CIncNSSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **sol
be zero (v = 0), unless there are moving walls (v = u_wall)---*/
if (dynamic_grid) {
- GridVel = geometry->node[iPoint]->GetGridVel();
+ GridVel = geometry->nodes->GetGridVel(iPoint);
for (iDim = 0; iDim < nDim; iDim++) Vector[iDim] = GridVel[iDim];
} else {
for (iDim = 0; iDim < nDim; iDim++) Vector[iDim] = 0.0;
@@ -1922,8 +1922,8 @@ void CIncNSSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **sol
/*--- Get coordinates of i & nearest normal and compute distance ---*/
- Coord_i = geometry->node[iPoint]->GetCoord();
- Coord_j = geometry->node[Point_Normal]->GetCoord();
+ Coord_i = geometry->nodes->GetCoord(iPoint);
+ Coord_j = geometry->nodes->GetCoord(Point_Normal);
dist_ij = 0;
for (iDim = 0; iDim < nDim; iDim++)
dist_ij += (Coord_j[iDim]-Coord_i[iDim])*(Coord_j[iDim]-Coord_i[iDim]);
diff --git a/SU2_CFD/src/solvers/CMeshSolver.cpp b/SU2_CFD/src/solvers/CMeshSolver.cpp
index 605ac55a47d8..0a692b0f396c 100644
--- a/SU2_CFD/src/solvers/CMeshSolver.cpp
+++ b/SU2_CFD/src/solvers/CMeshSolver.cpp
@@ -80,10 +80,10 @@ CMeshSolver::CMeshSolver(CGeometry *geometry, CConfig *config) : CFEASolver(true
for (iPoint = 0; iPoint < nPoint; iPoint++) {
for (iDim = 0; iDim < nDim; ++iDim)
- nodes->SetMesh_Coord(iPoint, iDim, geometry->node[iPoint]->GetCoord(iDim));
+ nodes->SetMesh_Coord(iPoint, iDim, geometry->nodes->GetCoord(iPoint, iDim));
for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
- long iVertex = geometry->node[iPoint]->GetVertex(iMarker);
+ long iVertex = geometry->nodes->GetVertex(iPoint, iMarker);
if (iVertex >= 0) {
nodes->Set_isVertex(iPoint,true);
break;
@@ -535,7 +535,7 @@ void CMeshSolver::UpdateGridCoord(CGeometry *geometry, CConfig *config){
/*--- Compute the current coordinate as Mesh_Coord + Displacement ---*/
su2double val_coord = nodes->GetMesh_Coord(iPoint,iDim) + val_disp;
/*--- Update the geometry container ---*/
- geometry->node[iPoint]->SetCoord(iDim, val_coord);
+ geometry->nodes->SetCoord(iPoint, iDim, val_coord);
}
}
@@ -592,7 +592,7 @@ void CMeshSolver::ComputeGridVelocity(CGeometry *geometry, CConfig *config){
/*--- Store grid velocity for this point ---*/
- geometry->node[iPoint]->SetGridVel(iDim, GridVel);
+ geometry->nodes->SetGridVel(iPoint, iDim, GridVel);
}
}
@@ -731,7 +731,7 @@ void CMeshSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *
su2double curr_coord = Restart_Data[index+iDim];
/// TODO: "Double deformation" in multizone adjoint if this is set here?
/// In any case it should not be needed as deformation is called before other solvers
- ///geometry[MESH_0]->node[iPoint_Local]->SetCoord(iDim, curr_coord);
+ ///geometry[MESH_0]->nodes->SetCoord(iPoint_Local, iDim, curr_coord);
/*--- Store the displacements computed as the current coordinates
minus the coordinates of the reference mesh file ---*/
@@ -998,7 +998,7 @@ void CMeshSolver::Surface_Pitching(CGeometry *geometry, CConfig *config, unsigne
/*--- Index and coordinates of the current point ---*/
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- Coord = geometry->node[iPoint]->GetCoord();
+ Coord = geometry->nodes->GetCoord(iPoint);
/*--- Calculate non-dim. position from rotation center ---*/
@@ -1104,7 +1104,7 @@ void CMeshSolver::Surface_Rotating(CGeometry *geometry, CConfig *config, unsigne
/*--- Index and coordinates of the current point ---*/
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- Coord = geometry->node[iPoint]->GetCoord();
+ Coord = geometry->nodes->GetCoord(iPoint);
/*--- Calculate non-dim. position from rotation center ---*/
diff --git a/SU2_CFD/src/solvers/CNSSolver.cpp b/SU2_CFD/src/solvers/CNSSolver.cpp
index 158e556b8860..5389d7c392e9 100644
--- a/SU2_CFD/src/solvers/CNSSolver.cpp
+++ b/SU2_CFD/src/solvers/CNSSolver.cpp
@@ -318,8 +318,8 @@ void CNSSolver::Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CSolv
auto iPoint = geometry->edges->GetNode(iEdge,0);
auto jPoint = geometry->edges->GetNode(iEdge,1);
- numerics->SetCoord(geometry->node[iPoint]->GetCoord(),
- geometry->node[jPoint]->GetCoord());
+ numerics->SetCoord(geometry->nodes->GetCoord(iPoint),
+ geometry->nodes->GetCoord(jPoint));
numerics->SetNormal(geometry->edges->GetNormal(iEdge));
@@ -461,8 +461,8 @@ void CNSSolver::Friction_Forces(CGeometry *geometry, CConfig *config) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
iPointNormal = geometry->vertex[iMarker][iVertex]->GetNormal_Neighbor();
- Coord = geometry->node[iPoint]->GetCoord();
- Coord_Normal = geometry->node[iPointNormal]->GetCoord();
+ Coord = geometry->nodes->GetCoord(iPoint);
+ Coord_Normal = geometry->nodes->GetCoord(iPointNormal);
Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
@@ -562,11 +562,11 @@ void CNSSolver::Friction_Forces(CGeometry *geometry, CConfig *config) {
/*--- Note that y+, and heat are computed at the
halo cells (for visualization purposes), but not the forces ---*/
- if ((geometry->node[iPoint]->GetDomain()) && (Monitoring == YES)) {
+ if ((geometry->nodes->GetDomain(iPoint)) && (Monitoring == YES)) {
/*--- Axisymmetric simulations ---*/
- if (axisymmetric) AxiFactor = 2.0*PI_NUMBER*geometry->node[iPoint]->GetCoord(1);
+ if (axisymmetric) AxiFactor = 2.0*PI_NUMBER*geometry->nodes->GetCoord(iPoint, 1);
else AxiFactor = 1.0;
/*--- Force computation ---*/
@@ -979,7 +979,7 @@ void CNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_container
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- If it is a customizable patch, retrieve the specified wall heat flux. ---*/
@@ -1008,7 +1008,7 @@ void CNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_container
be zero (v = 0), unless there are moving walls (v = u_wall)---*/
if (dynamic_grid) {
- GridVel = geometry->node[iPoint]->GetGridVel();
+ GridVel = geometry->nodes->GetGridVel(iPoint);
for (iDim = 0; iDim < nDim; iDim++) Vector[iDim] = GridVel[iDim];
} else {
for (iDim = 0; iDim < nDim; iDim++) Vector[iDim] = 0.0;
@@ -1036,7 +1036,7 @@ void CNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_container
/*--- Get the grid velocity at the current boundary node ---*/
- GridVel = geometry->node[iPoint]->GetGridVel();
+ GridVel = geometry->nodes->GetGridVel(iPoint);
ProjGridVel = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
ProjGridVel += GridVel[iDim]*UnitNormal[iDim]*Area;
@@ -1115,8 +1115,8 @@ void CNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_container
/*--- Get coordinates of i & nearest normal and compute distance ---*/
- Coord_i = geometry->node[iPoint]->GetCoord();
- Coord_j = geometry->node[Point_Normal]->GetCoord();
+ Coord_i = geometry->nodes->GetCoord(iPoint);
+ Coord_j = geometry->nodes->GetCoord(Point_Normal);
dist_ij = 0;
for (iDim = 0; iDim < nDim; iDim++)
@@ -1230,7 +1230,7 @@ void CNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_contain
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- If it is a customizable patch, retrieve the specified wall temperature. ---*/
@@ -1257,8 +1257,8 @@ void CNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_contain
/*--- Get coordinates of i & nearest normal and compute distance ---*/
- Coord_i = geometry->node[iPoint]->GetCoord();
- Coord_j = geometry->node[Point_Normal]->GetCoord();
+ Coord_i = geometry->nodes->GetCoord(iPoint);
+ Coord_j = geometry->nodes->GetCoord(Point_Normal);
dist_ij = 0;
for (iDim = 0; iDim < nDim; iDim++)
dist_ij += (Coord_j[iDim]-Coord_i[iDim])*(Coord_j[iDim]-Coord_i[iDim]);
@@ -1268,7 +1268,7 @@ void CNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_contain
be zero (v = 0), unless there is grid motion (v = u_wall)---*/
if (dynamic_grid) {
- GridVel = geometry->node[iPoint]->GetGridVel();
+ GridVel = geometry->nodes->GetGridVel(iPoint);
for (iDim = 0; iDim < nDim; iDim++) Vector[iDim] = GridVel[iDim];
}
else {
@@ -1351,7 +1351,7 @@ void CNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_contain
/*--- Get the grid velocity at the current boundary node ---*/
- GridVel = geometry->node[iPoint]->GetGridVel();
+ GridVel = geometry->nodes->GetGridVel(iPoint);
ProjGridVel = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
ProjGridVel += GridVel[iDim]*UnitNormal[iDim]*Area;
@@ -1497,13 +1497,13 @@ void CNSSolver::SetRoe_Dissipation(CGeometry *geometry, CConfig *config){
if (kind_roe_dissipation == FD || kind_roe_dissipation == FD_DUCROS){
- su2double wall_distance = geometry->node[iPoint]->GetWall_Distance();
+ su2double wall_distance = geometry->nodes->GetWall_Distance(iPoint);
nodes->SetRoe_Dissipation_FD(iPoint, wall_distance);
} else if (kind_roe_dissipation == NTS || kind_roe_dissipation == NTS_DUCROS) {
- const su2double delta = geometry->node[iPoint]->GetMaxLength();
+ const su2double delta = geometry->nodes->GetMaxLength(iPoint);
assert(delta > 0 && "Delta must be initialized and non-negative");
nodes->SetRoe_Dissipation_NTS(iPoint, delta, config->GetConst_DES());
}
@@ -1551,7 +1551,7 @@ void CNSSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **solver
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Compute dual-grid area and boundary normal ---*/
@@ -1574,8 +1574,8 @@ void CNSSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **solver
/*--- Get coordinates of i & nearest normal and compute distance ---*/
- Coord_i = geometry->node[iPoint]->GetCoord();
- Coord_j = geometry->node[Point_Normal]->GetCoord();
+ Coord_i = geometry->nodes->GetCoord(iPoint);
+ Coord_j = geometry->nodes->GetCoord(Point_Normal);
dist_ij = 0;
for (iDim = 0; iDim < nDim; iDim++)
dist_ij += (Coord_j[iDim]-Coord_i[iDim])*(Coord_j[iDim]-Coord_i[iDim]);
@@ -1585,7 +1585,7 @@ void CNSSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **solver
be zero (v = 0), unless there is grid motion (v = u_wall)---*/
if (dynamic_grid) {
- GridVel = geometry->node[iPoint]->GetGridVel();
+ GridVel = geometry->nodes->GetGridVel(iPoint);
for (iDim = 0; iDim < nDim; iDim++) Vector[iDim] = GridVel[iDim];
}
else {
@@ -1693,7 +1693,7 @@ void CNSSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **solver
/*--- Get the grid velocity at the current boundary node ---*/
- GridVel = geometry->node[iPoint]->GetGridVel();
+ GridVel = geometry->nodes->GetGridVel(iPoint);
ProjGridVel = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
ProjGridVel += GridVel[iDim]*UnitNormal[iDim]*Area;
@@ -1890,12 +1890,12 @@ void CNSSolver::SetTauWall_WF(CGeometry *geometry, CSolver **solver_container, C
/*--- Check if the node belongs to the domain (i.e, not a halo node)
and the neighbor is not part of the physical boundary ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Get coordinates of the current vertex and nearest normal point ---*/
- Coord = geometry->node[iPoint]->GetCoord();
- Coord_Normal = geometry->node[Point_Normal]->GetCoord();
+ Coord = geometry->nodes->GetCoord(iPoint);
+ Coord_Normal = geometry->nodes->GetCoord(Point_Normal);
/*--- Compute dual-grid area and boundary normal ---*/
diff --git a/SU2_CFD/src/solvers/CRadP1Solver.cpp b/SU2_CFD/src/solvers/CRadP1Solver.cpp
index 3cc014fc91b8..cba809e51f02 100644
--- a/SU2_CFD/src/solvers/CRadP1Solver.cpp
+++ b/SU2_CFD/src/solvers/CRadP1Solver.cpp
@@ -226,8 +226,8 @@ void CRadP1Solver::Viscous_Residual(CGeometry *geometry, CSolver **solver_contai
/*--- Points coordinates, and normal vector ---*/
- numerics->SetCoord(geometry->node[iPoint]->GetCoord(),
- geometry->node[jPoint]->GetCoord());
+ numerics->SetCoord(geometry->nodes->GetCoord(iPoint),
+ geometry->nodes->GetCoord(jPoint));
numerics->SetNormal(geometry->edges->GetNormal(iEdge));
/*--- Radiation variables w/o reconstruction, and its gradients ---*/
@@ -266,7 +266,7 @@ void CRadP1Solver::Source_Residual(CGeometry *geometry, CSolver **solver_contain
/*--- Set volume ---*/
- numerics->SetVolume(geometry->node[iPoint]->GetVolume());
+ numerics->SetVolume(geometry->nodes->GetVolume(iPoint));
/*--- Compute the source term ---*/
@@ -313,7 +313,7 @@ void CRadP1Solver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_cont
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Compute dual-grid area and boundary normal ---*/
Normal = geometry->vertex[val_marker][iVertex]->GetNormal();
@@ -390,7 +390,7 @@ void CRadP1Solver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container,
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Compute dual-grid area and boundary normal ---*/
Normal = geometry->vertex[val_marker][iVertex]->GetNormal();
@@ -464,7 +464,7 @@ void CRadP1Solver::BC_Marshak(CGeometry *geometry, CSolver **solver_container, C
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Compute dual-grid area and boundary normal ---*/
Normal = geometry->vertex[val_marker][iVertex]->GetNormal();
@@ -534,7 +534,7 @@ void CRadP1Solver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver
/*--- Read the volume ---*/
- Vol = geometry->node[iPoint]->GetVolume();
+ Vol = geometry->nodes->GetVolume(iPoint);
/*--- Modify matrix diagonal to assure diagonal dominance ---*/
@@ -557,7 +557,7 @@ void CRadP1Solver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver
LinSysRes[total_index] = - (LinSysRes[total_index]);
LinSysSol[total_index] = 0.0;
AddRes_RMS(iVar, LinSysRes[total_index]*LinSysRes[total_index]);
- AddRes_Max(iVar, fabs(LinSysRes[total_index]), geometry->node[iPoint]->GetGlobalIndex(), geometry->node[iPoint]->GetCoord());
+ AddRes_Max(iVar, fabs(LinSysRes[total_index]), geometry->nodes->GetGlobalIndex(iPoint), geometry->nodes->GetCoord(iPoint));
}
}
@@ -629,8 +629,8 @@ void CRadP1Solver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
/*--- Viscous contribution ---*/
Lambda = GammaP1*Area*Area;
- if (geometry->node[iPoint]->GetDomain()) nodes->AddMax_Lambda_Visc(iPoint, Lambda);
- if (geometry->node[jPoint]->GetDomain()) nodes->AddMax_Lambda_Visc(jPoint, Lambda);
+ if (geometry->nodes->GetDomain(iPoint)) nodes->AddMax_Lambda_Visc(iPoint, Lambda);
+ if (geometry->nodes->GetDomain(jPoint)) nodes->AddMax_Lambda_Visc(jPoint, Lambda);
}
@@ -648,7 +648,7 @@ void CRadP1Solver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
/*--- Viscous contribution ---*/
Lambda = GammaP1*Area*Area;
- if (geometry->node[iPoint]->GetDomain()) nodes->AddMax_Lambda_Visc(iPoint, Lambda);
+ if (geometry->nodes->GetDomain(iPoint)) nodes->AddMax_Lambda_Visc(iPoint, Lambda);
}
}
@@ -657,7 +657,7 @@ void CRadP1Solver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
- Vol = geometry->node[iPoint]->GetVolume();
+ Vol = geometry->nodes->GetVolume(iPoint);
if (Vol != 0.0) {
diff --git a/SU2_CFD/src/solvers/CRadSolver.cpp b/SU2_CFD/src/solvers/CRadSolver.cpp
index 321b846ba021..6130cc489010 100644
--- a/SU2_CFD/src/solvers/CRadSolver.cpp
+++ b/SU2_CFD/src/solvers/CRadSolver.cpp
@@ -58,7 +58,7 @@ void CRadSolver::SetVolumetricHeatSource(CGeometry *geometry, CConfig *config) {
// Loop over all points and determine whether they are inside
for (iPoint = 0; iPoint < nPoint; iPoint ++) {
check = 0;
- OP = geometry->node[iPoint]->GetCoord();
+ OP = geometry->nodes->GetCoord(iPoint);
// Reference point with respect to center of the ellipse
for (iDim = 0; iDim < nDim; iDim++) CP[iDim] = OP[iDim]-OC[iDim];
// Rotate point with respect to Z axis
diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp
index 8bffbfd17c6d..804007466a82 100644
--- a/SU2_CFD/src/solvers/CSolver.cpp
+++ b/SU2_CFD/src/solvers/CSolver.cpp
@@ -480,22 +480,22 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry,
we can accumulate the total control volume size on all
periodic faces. ---*/
- bufDSend[buf_offset] = geometry->node[iPoint]->GetVolume() +
- geometry->node[iPoint]->GetPeriodicVolume();
+ bufDSend[buf_offset] = geometry->nodes->GetVolume(iPoint) +
+ geometry->nodes->GetPeriodicVolume(iPoint);
break;
case PERIODIC_NEIGHBORS:
nNeighbor = 0;
- for (iNeighbor = 0; iNeighbor < geometry->node[iPoint]->GetnPoint(); iNeighbor++) {
- Neighbor_Point = geometry->node[iPoint]->GetPoint(iNeighbor);
+ for (iNeighbor = 0; iNeighbor < geometry->nodes->GetnPoint(iPoint); iNeighbor++) {
+ Neighbor_Point = geometry->nodes->GetPoint(iPoint, iNeighbor);
/*--- Check if this neighbor lies on the periodic face so
that we avoid double counting neighbors on both sides. If
not, increment the count of neighbors for the donor. ---*/
- if (!geometry->node[Neighbor_Point]->GetPeriodicBoundary())
+ if (!geometry->nodes->GetPeriodicBoundary(Neighbor_Point))
nNeighbor++;
}
@@ -634,13 +634,13 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry,
for (iVar = 0; iVar< nVar; iVar++)
Und_Lapl[iVar] = 0.0;
- for (iNeighbor = 0; iNeighbor < geometry->node[iPoint]->GetnPoint(); iNeighbor++) {
- jPoint = geometry->node[iPoint]->GetPoint(iNeighbor);
+ for (iNeighbor = 0; iNeighbor < geometry->nodes->GetnPoint(iPoint); iNeighbor++) {
+ jPoint = geometry->nodes->GetPoint(iPoint, iNeighbor);
/*--- Avoid periodic boundary points so that we do not
duplicate edges on both sides of the periodic BC. ---*/
- if (!geometry->node[jPoint]->GetPeriodicBoundary()) {
+ if (!geometry->nodes->GetPeriodicBoundary(jPoint)) {
/*--- Solution differences ---*/
@@ -657,14 +657,14 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry,
(base_nodes->GetSolution(jPoint,nVar-1) + Pressure_j));
}
- boundary_i = geometry->node[iPoint]->GetPhysicalBoundary();
- boundary_j = geometry->node[jPoint]->GetPhysicalBoundary();
+ boundary_i = geometry->nodes->GetPhysicalBoundary(iPoint);
+ boundary_j = geometry->nodes->GetPhysicalBoundary(jPoint);
/*--- Both points inside the domain, or both in the boundary ---*/
if ((!boundary_i && !boundary_j) ||
( boundary_i && boundary_j)) {
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
for (iVar = 0; iVar< nVar; iVar++)
Und_Lapl[iVar] -= Diff[iVar];
}
@@ -673,7 +673,7 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry,
/*--- iPoint inside the domain, jPoint on the boundary ---*/
if (!boundary_i && boundary_j)
- if (geometry->node[iPoint]->GetDomain()){
+ if (geometry->nodes->GetDomain(iPoint)){
for (iVar = 0; iVar< nVar; iVar++)
Und_Lapl[iVar] -= Diff[iVar];
}
@@ -725,13 +725,13 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry,
on both sides of the periodic face. ---*/
Sensor_i = 0.0; Sensor_j = 0.0;
- for (iNeighbor = 0; iNeighbor < geometry->node[iPoint]->GetnPoint(); iNeighbor++) {
- jPoint = geometry->node[iPoint]->GetPoint(iNeighbor);
+ for (iNeighbor = 0; iNeighbor < geometry->nodes->GetnPoint(iPoint); iNeighbor++) {
+ jPoint = geometry->nodes->GetPoint(iPoint, iNeighbor);
/*--- Avoid halos and boundary points so that we don't
duplicate edges on both sides of the periodic BC. ---*/
- if (!geometry->node[jPoint]->GetPeriodicBoundary()) {
+ if (!geometry->nodes->GetPeriodicBoundary(jPoint)) {
/*--- Use density instead of pressure for incomp. flows. ---*/
@@ -743,14 +743,14 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry,
Pressure_j = base_nodes->GetPressure(jPoint);
}
- boundary_i = geometry->node[iPoint]->GetPhysicalBoundary();
- boundary_j = geometry->node[jPoint]->GetPhysicalBoundary();
+ boundary_i = geometry->nodes->GetPhysicalBoundary(iPoint);
+ boundary_j = geometry->nodes->GetPhysicalBoundary(jPoint);
/*--- Both points inside domain, or both on boundary ---*/
if ((!boundary_i && !boundary_j) ||
(boundary_i && boundary_j)) {
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
Sensor_i += Pressure_j - Pressure_i;
Sensor_j += Pressure_i + Pressure_j;
}
@@ -759,7 +759,7 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry,
/*--- iPoint inside the domain, jPoint on the boundary ---*/
if (!boundary_i && boundary_j) {
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
Sensor_i += (Pressure_j - Pressure_i);
Sensor_j += (Pressure_i + Pressure_j);
@@ -884,7 +884,7 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry,
/*--- Get coordinates for the current point. ---*/
- Coord_i = geometry->node[iPoint]->GetCoord();
+ Coord_i = geometry->nodes->GetCoord(iPoint);
/*--- Get the position vector from rotation center to point. ---*/
@@ -941,17 +941,17 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry,
r11 = 0.0; r12 = 0.0; r22 = 0.0;
r13 = 0.0; r23_a = 0.0; r23_b = 0.0; r33 = 0.0;
- for (iNeighbor = 0; iNeighbor < geometry->node[iPoint]->GetnPoint(); iNeighbor++) {
- jPoint = geometry->node[iPoint]->GetPoint(iNeighbor);
+ for (iNeighbor = 0; iNeighbor < geometry->nodes->GetnPoint(iPoint); iNeighbor++) {
+ jPoint = geometry->nodes->GetPoint(iPoint, iNeighbor);
/*--- Avoid periodic boundary points so that we do not
duplicate edges on both sides of the periodic BC. ---*/
- if (!geometry->node[jPoint]->GetPeriodicBoundary()) {
+ if (!geometry->nodes->GetPeriodicBoundary(jPoint)) {
/*--- Get coordinates for the neighbor point. ---*/
- Coord_j = geometry->node[jPoint]->GetCoord();
+ Coord_j = geometry->nodes->GetCoord(jPoint);
/*--- Get the position vector from rotation center. ---*/
@@ -1093,7 +1093,7 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry,
/*--- Get coordinates ---*/
- Coord_i = geometry->node[iPoint]->GetCoord();
+ Coord_i = geometry->nodes->GetCoord(iPoint);
/*--- Get the position vector from rot center to point. ---*/
@@ -1150,17 +1150,17 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry,
r11 = 0.0; r12 = 0.0; r22 = 0.0;
r13 = 0.0; r23_a = 0.0; r23_b = 0.0; r33 = 0.0;
- for (iNeighbor = 0; iNeighbor < geometry->node[iPoint]->GetnPoint(); iNeighbor++) {
- jPoint = geometry->node[iPoint]->GetPoint(iNeighbor);
+ for (iNeighbor = 0; iNeighbor < geometry->nodes->GetnPoint(iPoint); iNeighbor++) {
+ jPoint = geometry->nodes->GetPoint(iPoint, iNeighbor);
/*--- Avoid periodic boundary points so that we do not
duplicate edges on both sides of the periodic BC. ---*/
- if (!geometry->node[jPoint]->GetPeriodicBoundary()) {
+ if (!geometry->nodes->GetPeriodicBoundary(jPoint)) {
/*--- Get coordinates for the neighbor point. ---*/
- Coord_j = geometry->node[jPoint]->GetCoord();
+ Coord_j = geometry->nodes->GetCoord(jPoint);
/*--- Get the position vector from rotation center. ---*/
@@ -1298,8 +1298,8 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry,
Sol_Max[iVar] = base_nodes->GetSolution_Max(iPoint, iVar);
}
- for (iNeighbor = 0; iNeighbor < geometry->node[iPoint]->GetnPoint(); iNeighbor++) {
- jPoint = geometry->node[iPoint]->GetPoint(iNeighbor);
+ for (iNeighbor = 0; iNeighbor < geometry->nodes->GetnPoint(iPoint); iNeighbor++) {
+ jPoint = geometry->nodes->GetPoint(iPoint, iNeighbor);
for (iVar = 0; iVar < nPrimVarGrad; iVar++) {
Sol_Min[iVar] = min(Sol_Min[iVar], base_nodes->GetPrimitive(jPoint, iVar));
Sol_Max[iVar] = max(Sol_Max[iVar], base_nodes->GetPrimitive(jPoint, iVar));
@@ -1396,8 +1396,8 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry,
Sol_Max[iVar] = base_nodes->GetSolution_Max(iPoint, iVar);
}
- for (iNeighbor = 0; iNeighbor < geometry->node[iPoint]->GetnPoint(); iNeighbor++) {
- jPoint = geometry->node[iPoint]->GetPoint(iNeighbor);
+ for (iNeighbor = 0; iNeighbor < geometry->nodes->GetnPoint(iPoint); iNeighbor++) {
+ jPoint = geometry->nodes->GetPoint(iPoint, iNeighbor);
for (iVar = 0; iVar < nVar; iVar++) {
Sol_Min[iVar] = min(Sol_Min[iVar], base_nodes->GetSolution(jPoint, iVar));
Sol_Max[iVar] = max(Sol_Max[iVar], base_nodes->GetSolution(jPoint, iVar));
@@ -1608,8 +1608,8 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry,
total volume spread across the periodic faces. ---*/
Volume = (bufDRecv[buf_offset] +
- geometry->node[iPoint]->GetPeriodicVolume());
- geometry->node[iPoint]->SetPeriodicVolume(Volume);
+ geometry->nodes->GetPeriodicVolume(iPoint));
+ geometry->nodes->SetPeriodicVolume(iPoint, Volume);
break;
@@ -1617,9 +1617,9 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry,
/*--- Store the extra neighbors on the periodic face. ---*/
- nNeighbor = (geometry->node[iPoint]->GetnNeighbor() +
+ nNeighbor = (geometry->nodes->GetnNeighbor(iPoint) +
bufSRecv[buf_offset]);
- geometry->node[iPoint]->SetnNeighbor(nNeighbor);
+ geometry->nodes->SetnNeighbor(iPoint, nNeighbor);
break;
@@ -2749,8 +2749,8 @@ void CSolver::SetRotatingFrame_GCL(CGeometry *geometry, CConfig *config) {
/*--- Grid Velocity at each edge point ---*/
- su2double *GridVel_i = geometry->node[iPoint]->GetGridVel();
- su2double *GridVel_j = geometry->node[jPoint]->GetGridVel();
+ su2double *GridVel_i = geometry->nodes->GetGridVel(iPoint);
+ su2double *GridVel_j = geometry->nodes->GetGridVel(jPoint);
for (iDim = 0; iDim < nDim; iDim++)
Vector[iDim] = 0.5* (GridVel_i[iDim] + GridVel_j[iDim]);
@@ -2786,7 +2786,7 @@ void CSolver::SetRotatingFrame_GCL(CGeometry *geometry, CConfig *config) {
/*--- Grid Velocity at each edge point ---*/
- su2double *GridVel = geometry->node[Point]->GetGridVel();
+ su2double *GridVel = geometry->nodes->GetGridVel(Point);
/*--- Summed normal components ---*/
@@ -2893,112 +2893,20 @@ void CSolver::Update_Cross_Term(CConfig *config, su2passivematrix &cross_term) {
}
void CSolver::SetGridVel_Gradient(CGeometry *geometry, CConfig *config) {
- unsigned short iDim, jDim, iVar, iNeigh;
- unsigned long iPoint, jPoint;
- su2double *Coord_i, *Coord_j, *Solution_i, *Solution_j, Smatrix[3][3],
- r11, r12, r13, r22, r23, r23_a, r23_b, r33, weight, detR2, z11, z12, z13,
- z22, z23, z33, product;
- su2double **Cvector;
-
- /*--- Note that all nVar entries in this routine have been changed to nDim ---*/
- Cvector = new su2double* [nDim];
- for (iVar = 0; iVar < nDim; iVar++)
- Cvector[iVar] = new su2double [nDim];
-
- /*--- Loop over points of the grid ---*/
- for (iPoint = 0; iPoint < geometry->GetnPointDomain(); iPoint++) {
-
- Coord_i = geometry->node[iPoint]->GetCoord();
- Solution_i = geometry->node[iPoint]->GetGridVel();
-
- /*--- Inizialization of variables ---*/
- for (iVar = 0; iVar < nDim; iVar++)
- for (iDim = 0; iDim < nDim; iDim++)
- Cvector[iVar][iDim] = 0.0;
- r11 = 0.0; r12 = 0.0; r13 = 0.0; r22 = 0.0; r23 = 0.0; r23_a = 0.0; r23_b = 0.0; r33 = 0.0;
-
- for (iNeigh = 0; iNeigh < geometry->node[iPoint]->GetnPoint(); iNeigh++) {
- jPoint = geometry->node[iPoint]->GetPoint(iNeigh);
- Coord_j = geometry->node[jPoint]->GetCoord();
- Solution_j = geometry->node[jPoint]->GetGridVel();
-
- weight = 0.0;
- for (iDim = 0; iDim < nDim; iDim++)
- weight += (Coord_j[iDim]-Coord_i[iDim])*(Coord_j[iDim]-Coord_i[iDim]);
-
- /*--- Sumations for entries of upper triangular matrix R ---*/
- r11 += (Coord_j[0]-Coord_i[0])*(Coord_j[0]-Coord_i[0])/(weight);
- r12 += (Coord_j[0]-Coord_i[0])*(Coord_j[1]-Coord_i[1])/(weight);
- r22 += (Coord_j[1]-Coord_i[1])*(Coord_j[1]-Coord_i[1])/(weight);
- if (nDim == 3) {
- r13 += (Coord_j[0]-Coord_i[0])*(Coord_j[2]-Coord_i[2])/(weight);
- r23_a += (Coord_j[1]-Coord_i[1])*(Coord_j[2]-Coord_i[2])/(weight);
- r23_b += (Coord_j[0]-Coord_i[0])*(Coord_j[2]-Coord_i[2])/(weight);
- r33 += (Coord_j[2]-Coord_i[2])*(Coord_j[2]-Coord_i[2])/(weight);
- }
- /*--- Entries of c:= transpose(A)*b ---*/
- for (iVar = 0; iVar < nDim; iVar++)
- for (iDim = 0; iDim < nDim; iDim++)
- Cvector[iVar][iDim] += (Coord_j[iDim]-Coord_i[iDim])*(Solution_j[iVar]-Solution_i[iVar])/(weight);
- }
-
- /*--- Entries of upper triangular matrix R ---*/
- r11 = sqrt(r11);
- r12 = r12/(r11);
- r22 = sqrt(r22-r12*r12);
- if (nDim == 3) {
- r13 = r13/(r11);
- r23 = r23_a/(r22) - r23_b*r12/(r11*r22);
- r33 = sqrt(r33-r23*r23-r13*r13);
- }
- /*--- S matrix := inv(R)*traspose(inv(R)) ---*/
- if (nDim == 2) {
- detR2 = (r11*r22)*(r11*r22);
- Smatrix[0][0] = (r12*r12+r22*r22)/(detR2);
- Smatrix[0][1] = -r11*r12/(detR2);
- Smatrix[1][0] = Smatrix[0][1];
- Smatrix[1][1] = r11*r11/(detR2);
- }
- else {
- detR2 = (r11*r22*r33)*(r11*r22*r33);
- z11 = r22*r33;
- z12 = -r12*r33;
- z13 = r12*r23-r13*r22;
- z22 = r11*r33;
- z23 = -r11*r23;
- z33 = r11*r22;
- Smatrix[0][0] = (z11*z11+z12*z12+z13*z13)/(detR2);
- Smatrix[0][1] = (z12*z22+z13*z23)/(detR2);
- Smatrix[0][2] = (z13*z33)/(detR2);
- Smatrix[1][0] = Smatrix[0][1];
- Smatrix[1][1] = (z22*z22+z23*z23)/(detR2);
- Smatrix[1][2] = (z23*z33)/(detR2);
- Smatrix[2][0] = Smatrix[0][2];
- Smatrix[2][1] = Smatrix[1][2];
- Smatrix[2][2] = (z33*z33)/(detR2);
- }
- /*--- Computation of the gradient: S*c ---*/
- for (iVar = 0; iVar < nDim; iVar++) {
- for (iDim = 0; iDim < nDim; iDim++) {
- product = 0.0;
- for (jDim = 0; jDim < nDim; jDim++)
- product += Smatrix[iDim][jDim]*Cvector[iVar][jDim];
- geometry->node[iPoint]->SetGridVel_Grad(iVar, iDim, product);
- }
- }
- }
+ /// TODO: No comms needed for this gradient? The Rmatrix should be allocated somewhere.
- /*--- Deallocate memory ---*/
- for (iVar = 0; iVar < nDim; iVar++)
- delete [] Cvector[iVar];
- delete [] Cvector;
+ const auto& gridVel = geometry->nodes->GetGridVel();
+ auto& gridVelGrad = geometry->nodes->GetGridVel_Grad();
+ auto rmatrix = CVectorOfMatrix(nPoint,nDim,nDim);
+ computeGradientsLeastSquares(nullptr, GRID_VELOCITY, PERIODIC_NONE, *geometry, *config,
+ true, gridVel, 0, nDim, gridVelGrad, rmatrix);
}
void CSolver::SetAuxVar_Surface_Gradient(CGeometry *geometry, CConfig *config) {
- unsigned short iDim, jDim, iNeigh, iMarker, Boundary;
+ unsigned short iDim, jDim, iNeigh, iMarker;
unsigned short nDim = geometry->GetnDim();
unsigned long iPoint, jPoint, iVertex;
su2double *Coord_i, *Coord_j, AuxVar_i, AuxVar_j;
@@ -3012,99 +2920,92 @@ void CSolver::SetAuxVar_Surface_Gradient(CGeometry *geometry, CConfig *config) {
/*--- Loop over boundary markers to select those for Euler or NS walls ---*/
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
- Boundary = config->GetMarker_All_KindBC(iMarker);
- switch (Boundary) {
- case EULER_WALL:
- case HEAT_FLUX:
- case ISOTHERMAL:
- case CHT_WALL_INTERFACE:
-
- /*--- Loop over points on the surface (Least-Squares approximation) ---*/
- for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
- iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (geometry->node[iPoint]->GetDomain()) {
- Coord_i = geometry->node[iPoint]->GetCoord();
- AuxVar_i = base_nodes->GetAuxVar(iPoint);
- /*--- Inizialization of variables ---*/
- for (iDim = 0; iDim < nDim; iDim++)
- Cvector[iDim] = 0.0;
- su2double r11 = 0.0, r12 = 0.0, r13 = 0.0, r22 = 0.0, r23 = 0.0, r23_a = 0.0, r23_b = 0.0, r33 = 0.0;
-
- for (iNeigh = 0; iNeigh < geometry->node[iPoint]->GetnPoint(); iNeigh++) {
- jPoint = geometry->node[iPoint]->GetPoint(iNeigh);
- Coord_j = geometry->node[jPoint]->GetCoord();
- AuxVar_j = base_nodes->GetAuxVar(jPoint);
-
- su2double weight = 0;
- for (iDim = 0; iDim < nDim; iDim++)
- weight += (Coord_j[iDim]-Coord_i[iDim])*(Coord_j[iDim]-Coord_i[iDim]);
-
- /*--- Sumations for entries of upper triangular matrix R ---*/
- r11 += (Coord_j[0]-Coord_i[0])*(Coord_j[0]-Coord_i[0])/weight;
- r12 += (Coord_j[0]-Coord_i[0])*(Coord_j[1]-Coord_i[1])/weight;
- r22 += (Coord_j[1]-Coord_i[1])*(Coord_j[1]-Coord_i[1])/weight;
- if (nDim == 3) {
- r13 += (Coord_j[0]-Coord_i[0])*(Coord_j[2]-Coord_i[2])/weight;
- r23_a += (Coord_j[1]-Coord_i[1])*(Coord_j[2]-Coord_i[2])/weight;
- r23_b += (Coord_j[0]-Coord_i[0])*(Coord_j[2]-Coord_i[2])/weight;
- r33 += (Coord_j[2]-Coord_i[2])*(Coord_j[2]-Coord_i[2])/weight;
- }
+ if (config->GetSolid_Wall(iMarker)) {
- /*--- Entries of c:= transpose(A)*b ---*/
- for (iDim = 0; iDim < nDim; iDim++)
- Cvector[iDim] += (Coord_j[iDim]-Coord_i[iDim])*(AuxVar_j-AuxVar_i)/weight;
- }
+ /*--- Loop over points on the surface (Least-Squares approximation) ---*/
+ for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
+ iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
+ if (geometry->nodes->GetDomain(iPoint)) {
+ Coord_i = geometry->nodes->GetCoord(iPoint);
+ AuxVar_i = base_nodes->GetAuxVar(iPoint);
- /*--- Entries of upper triangular matrix R ---*/
- r11 = sqrt(r11);
- r12 = r12/r11;
- r22 = sqrt(r22-r12*r12);
+ /*--- Inizialization of variables ---*/
+ for (iDim = 0; iDim < nDim; iDim++)
+ Cvector[iDim] = 0.0;
+ su2double r11 = 0.0, r12 = 0.0, r13 = 0.0, r22 = 0.0, r23 = 0.0, r23_a = 0.0, r23_b = 0.0, r33 = 0.0;
+
+ for (iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); iNeigh++) {
+ jPoint = geometry->nodes->GetPoint(iPoint, iNeigh);
+ Coord_j = geometry->nodes->GetCoord(jPoint);
+ AuxVar_j = base_nodes->GetAuxVar(jPoint);
+
+ su2double weight = 0;
+ for (iDim = 0; iDim < nDim; iDim++)
+ weight += (Coord_j[iDim]-Coord_i[iDim])*(Coord_j[iDim]-Coord_i[iDim]);
+
+ /*--- Sumations for entries of upper triangular matrix R ---*/
+ r11 += (Coord_j[0]-Coord_i[0])*(Coord_j[0]-Coord_i[0])/weight;
+ r12 += (Coord_j[0]-Coord_i[0])*(Coord_j[1]-Coord_i[1])/weight;
+ r22 += (Coord_j[1]-Coord_i[1])*(Coord_j[1]-Coord_i[1])/weight;
if (nDim == 3) {
- r13 = r13/r11;
- r23 = r23_a/r22 - r23_b*r12/(r11*r22);
- r33 = sqrt(r33-r23*r23-r13*r13);
- }
- /*--- S matrix := inv(R)*traspose(inv(R)) ---*/
- if (nDim == 2) {
- su2double detR2 = (r11*r22)*(r11*r22);
- Smatrix[0][0] = (r12*r12+r22*r22)/detR2;
- Smatrix[0][1] = -r11*r12/detR2;
- Smatrix[1][0] = Smatrix[0][1];
- Smatrix[1][1] = r11*r11/detR2;
- }
- else {
- su2double detR2 = (r11*r22*r33)*(r11*r22*r33);
- su2double z11, z12, z13, z22, z23, z33; // aux vars
- z11 = r22*r33;
- z12 = -r12*r33;
- z13 = r12*r23-r13*r22;
- z22 = r11*r33;
- z23 = -r11*r23;
- z33 = r11*r22;
- Smatrix[0][0] = (z11*z11+z12*z12+z13*z13)/detR2;
- Smatrix[0][1] = (z12*z22+z13*z23)/detR2;
- Smatrix[0][2] = (z13*z33)/detR2;
- Smatrix[1][0] = Smatrix[0][1];
- Smatrix[1][1] = (z22*z22+z23*z23)/detR2;
- Smatrix[1][2] = (z23*z33)/detR2;
- Smatrix[2][0] = Smatrix[0][2];
- Smatrix[2][1] = Smatrix[1][2];
- Smatrix[2][2] = (z33*z33)/detR2;
- }
- /*--- Computation of the gradient: S*c ---*/
- su2double product;
- for (iDim = 0; iDim < nDim; iDim++) {
- product = 0.0;
- for (jDim = 0; jDim < nDim; jDim++)
- product += Smatrix[iDim][jDim]*Cvector[jDim];
- base_nodes->SetAuxVarGradient(iPoint, iDim, product);
+ r13 += (Coord_j[0]-Coord_i[0])*(Coord_j[2]-Coord_i[2])/weight;
+ r23_a += (Coord_j[1]-Coord_i[1])*(Coord_j[2]-Coord_i[2])/weight;
+ r23_b += (Coord_j[0]-Coord_i[0])*(Coord_j[2]-Coord_i[2])/weight;
+ r33 += (Coord_j[2]-Coord_i[2])*(Coord_j[2]-Coord_i[2])/weight;
}
+
+ /*--- Entries of c:= transpose(A)*b ---*/
+ for (iDim = 0; iDim < nDim; iDim++)
+ Cvector[iDim] += (Coord_j[iDim]-Coord_i[iDim])*(AuxVar_j-AuxVar_i)/weight;
}
- } /*--- End of loop over surface points ---*/
- break;
- default:
- break;
+
+ /*--- Entries of upper triangular matrix R ---*/
+ r11 = sqrt(r11);
+ r12 = r12/r11;
+ r22 = sqrt(r22-r12*r12);
+ if (nDim == 3) {
+ r13 = r13/r11;
+ r23 = r23_a/r22 - r23_b*r12/(r11*r22);
+ r33 = sqrt(r33-r23*r23-r13*r13);
+ }
+ /*--- S matrix := inv(R)*traspose(inv(R)) ---*/
+ if (nDim == 2) {
+ su2double detR2 = (r11*r22)*(r11*r22);
+ Smatrix[0][0] = (r12*r12+r22*r22)/detR2;
+ Smatrix[0][1] = -r11*r12/detR2;
+ Smatrix[1][0] = Smatrix[0][1];
+ Smatrix[1][1] = r11*r11/detR2;
+ }
+ else {
+ su2double detR2 = (r11*r22*r33)*(r11*r22*r33);
+ su2double z11, z12, z13, z22, z23, z33; // aux vars
+ z11 = r22*r33;
+ z12 = -r12*r33;
+ z13 = r12*r23-r13*r22;
+ z22 = r11*r33;
+ z23 = -r11*r23;
+ z33 = r11*r22;
+ Smatrix[0][0] = (z11*z11+z12*z12+z13*z13)/detR2;
+ Smatrix[0][1] = (z12*z22+z13*z23)/detR2;
+ Smatrix[0][2] = (z13*z33)/detR2;
+ Smatrix[1][0] = Smatrix[0][1];
+ Smatrix[1][1] = (z22*z22+z23*z23)/detR2;
+ Smatrix[1][2] = (z23*z33)/detR2;
+ Smatrix[2][0] = Smatrix[0][2];
+ Smatrix[2][1] = Smatrix[1][2];
+ Smatrix[2][2] = (z33*z33)/detR2;
+ }
+ /*--- Computation of the gradient: S*c ---*/
+ su2double product;
+ for (iDim = 0; iDim < nDim; iDim++) {
+ product = 0.0;
+ for (jDim = 0; jDim < nDim; jDim++)
+ product += Smatrix[iDim][jDim]*Cvector[jDim];
+ base_nodes->SetAuxVarGradient(iPoint, iDim, product);
+ }
+ }
+ } /*--- End of loop over surface points ---*/
}
}
@@ -3503,7 +3404,7 @@ void CSolver::Restart_OldGeometry(CGeometry *geometry, CConfig *config) {
if (nDim == 3){
Coord[2] = PrintingToolbox::stod(point_line[3]);
}
- geometry->node[iPoint_Local]->SetCoord_n(Coord);
+ geometry->nodes->SetCoord_n(iPoint_Local, Coord);
iPoint_Global_Local++;
}
@@ -3570,7 +3471,7 @@ void CSolver::Restart_OldGeometry(CGeometry *geometry, CConfig *config) {
Coord[2] = PrintingToolbox::stod(point_line[3]);
}
- geometry->node[iPoint_Local]->SetCoord_n1(Coord);
+ geometry->nodes->SetCoord_n1(iPoint_Local, Coord);
iPoint_Global_Local++;
}
@@ -4341,7 +4242,7 @@ void CSolver::LoadInletProfile(CGeometry **geometry,
for (iVertex = 0; iVertex < geometry[MESH_0]->nVertex[iMarker]; iVertex++) {
iPoint = geometry[MESH_0]->vertex[iMarker][iVertex]->GetNode();
- Coord = geometry[MESH_0]->node[iPoint]->GetCoord();
+ Coord = geometry[MESH_0]->nodes->GetCoord(iPoint);
if(Interpolate == false) {
@@ -4380,7 +4281,7 @@ void CSolver::LoadInletProfile(CGeometry **geometry,
} else {
- unsigned long GlobalIndex = geometry[MESH_0]->node[iPoint]->GetGlobalIndex();
+ unsigned long GlobalIndex = geometry[MESH_0]->nodes->GetGlobalIndex(iPoint);
cout << "WARNING: Did not find a match between the points in the inlet file" << endl;
cout << "and point " << GlobalIndex;
cout << std::scientific;
@@ -4509,8 +4410,8 @@ void CSolver::LoadInletProfile(CGeometry **geometry,
children from the interior volume will not be included in
the averaging. ---*/
- for (iChildren = 0; iChildren < geometry[iMesh]->node[iPoint]->GetnChildren_CV(); iChildren++) {
- Point_Fine = geometry[iMesh]->node[iPoint]->GetChildren_CV(iChildren);
+ for (iChildren = 0; iChildren < geometry[iMesh]->nodes->GetnChildren_CV(iPoint); iChildren++) {
+ Point_Fine = geometry[iMesh]->nodes->GetChildren_CV(iPoint, iChildren);
for (iVar = 0; iVar < nColumns; iVar++) Inlet_Fine[iVar] = 0.0;
Area_Children = solver[iMesh-1][KIND_SOLVER]->GetInletAtVertex(Inlet_Fine.data(), Point_Fine, KIND_MARKER,
Marker_Tag, geometry[iMesh-1], config);
@@ -4594,7 +4495,7 @@ void CSolver::ComputeVertexTractions(CGeometry *geometry, CConfig *config){
iNormal = geometry->vertex[iMarker][iVertex]->GetNormal();
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
// Retrieve the values of pressure
Pn = base_nodes->GetPressure(iPoint);
@@ -4664,7 +4565,7 @@ void CSolver::RegisterVertexTractions(CGeometry *geometry, CConfig *config){
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Register the vertex traction as output ---*/
for (iDim = 0; iDim < nDim; iDim++) {
@@ -4696,7 +4597,7 @@ void CSolver::SetVertexTractionsAdjoint(CGeometry *geometry, CConfig *config){
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Set the adjoint of the vertex traction from the value received ---*/
for (iDim = 0; iDim < nDim; iDim++) {
@@ -4769,7 +4670,7 @@ void CSolver::ComputeResidual_Multizone(CGeometry *geometry, CConfig *config){
residual = (base_nodes->Get_BGSSolution(iPoint,iVar) - base_nodes->Get_BGSSolution_k(iPoint,iVar))*domain;
base_nodes->Set_BGSSolution_k(iPoint,iVar, base_nodes->Get_BGSSolution(iPoint,iVar));
AddRes_BGS(iVar, residual*residual);
- AddRes_Max_BGS(iVar, fabs(residual), geometry->node[iPoint]->GetGlobalIndex(), geometry->node[iPoint]->GetCoord());
+ AddRes_Max_BGS(iVar, fabs(residual), geometry->nodes->GetGlobalIndex(iPoint), geometry->nodes->GetCoord(iPoint));
}
}
diff --git a/SU2_CFD/src/solvers/CTransLMSolver.cpp b/SU2_CFD/src/solvers/CTransLMSolver.cpp
index afe2182b6aba..3fe406311827 100644
--- a/SU2_CFD/src/solvers/CTransLMSolver.cpp
+++ b/SU2_CFD/src/solvers/CTransLMSolver.cpp
@@ -207,7 +207,7 @@ void CTransLMSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solv
/*--- Build implicit system ---*/
for (iPoint = 0; iPoint < geometry->GetnPointDomain(); iPoint++) {
- Vol = geometry->node[iPoint]->GetVolume();
+ Vol = geometry->nodes->GetVolume(iPoint);
/*--- Modify matrix diagonal to assure diagonal dominance ---*/
@@ -223,7 +223,7 @@ void CTransLMSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solv
LinSysRes[total_index] = -LinSysRes[total_index];
LinSysSol[total_index] = 0.0;
AddRes_RMS(iVar, LinSysRes[total_index]*LinSysRes[total_index]*Vol);
- AddRes_Max(iVar, fabs(LinSysRes[total_index]), geometry->node[iPoint]->GetGlobalIndex(), geometry->node[iPoint]->GetCoord());
+ AddRes_Max(iVar, fabs(LinSysRes[total_index]), geometry->nodes->GetGlobalIndex(iPoint), geometry->nodes->GetCoord(iPoint));
}
}
@@ -311,8 +311,8 @@ void CTransLMSolver::Viscous_Residual(CGeometry *geometry, CSolver **solver_cont
jPoint = geometry->edges->GetNode(iEdge,1);
/*--- Points coordinates, and normal vector ---*/
- numerics->SetCoord(geometry->node[iPoint]->GetCoord(),
- geometry->node[jPoint]->GetCoord());
+ numerics->SetCoord(geometry->nodes->GetCoord(iPoint),
+ geometry->nodes->GetCoord(jPoint));
numerics->SetNormal(geometry->edges->GetNormal(iEdge));
@@ -381,11 +381,11 @@ void CTransLMSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta
/*--- Set volume ---*/
- numerics->SetVolume(geometry->node[iPoint]->GetVolume());
+ numerics->SetVolume(geometry->nodes->GetVolume(iPoint));
/*--- Set distance to the surface ---*/
- numerics->SetDistance(geometry->node[iPoint]->GetWall_Distance(), 0.0);
+ numerics->SetDistance(geometry->nodes->GetWall_Distance(iPoint), 0.0);
/*--- Compute the source term ---*/
@@ -424,7 +424,7 @@ void CTransLMSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_cont
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
/*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Normal vector for this vertex (negate for outward convention) ---*/
geometry->vertex[val_marker][iVertex]->GetNormal(Normal);
@@ -463,7 +463,7 @@ void CTransLMSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_cont
// iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
//
// /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
-// if (geometry->node[iPoint]->GetDomain()) {
+// if (geometry->nodes->GetDomain(iPoint)) {
//
// /*--- Impose boundary values (Dirichlet) ---*/
// Solution[0] = 0.0;
@@ -496,7 +496,7 @@ void CTransLMSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_containe
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Impose boundary values (Dirichlet) ---*/
Solution[0] = Intermittency_Inf;
diff --git a/SU2_CFD/src/solvers/CTurbSASolver.cpp b/SU2_CFD/src/solvers/CTurbSASolver.cpp
index dd24b8d171be..8aaa43915661 100644
--- a/SU2_CFD/src/solvers/CTurbSASolver.cpp
+++ b/SU2_CFD/src/solvers/CTurbSASolver.cpp
@@ -403,7 +403,7 @@ void CTurbSASolver::Source_Residual(CGeometry *geometry, CSolver **solver_contai
/*--- Set volume ---*/
- numerics->SetVolume(geometry->node[iPoint]->GetVolume());
+ numerics->SetVolume(geometry->nodes->GetVolume(iPoint));
/*--- Get Hybrid RANS/LES Type and set the appropriate wall distance ---*/
@@ -411,7 +411,7 @@ void CTurbSASolver::Source_Residual(CGeometry *geometry, CSolver **solver_contai
/*--- Set distance to the surface ---*/
- numerics->SetDistance(geometry->node[iPoint]->GetWall_Distance(), 0.0);
+ numerics->SetDistance(geometry->nodes->GetWall_Distance(iPoint), 0.0);
} else {
@@ -444,7 +444,7 @@ void CTurbSASolver::Source_Residual(CGeometry *geometry, CSolver **solver_contai
SU2_OMP_FOR_STAT(omp_chunk_size)
for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) {
- su2double Volume = geometry->node[iPoint]->GetVolume();
+ su2double Volume = geometry->nodes->GetVolume(iPoint);
/*--- Access stored harmonic balance source term ---*/
@@ -477,7 +477,7 @@ void CTurbSASolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_conta
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Get the velocity vector ---*/
@@ -513,7 +513,7 @@ void CTurbSASolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_con
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Get the velocity vector ---*/
for (iVar = 0; iVar < nVar; iVar++)
@@ -545,7 +545,7 @@ void CTurbSASolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Allocate the value at the infinity ---*/
@@ -558,7 +558,7 @@ void CTurbSASolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container
/*--- Grid Movement ---*/
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint));
conv_numerics->SetPrimitive(V_domain, V_infty);
@@ -611,7 +611,7 @@ void CTurbSASolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, CN
/*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Normal vector for this vertex (negate for outward convention) ---*/
@@ -645,8 +645,8 @@ void CTurbSASolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, CN
conv_numerics->SetNormal(Normal);
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
- geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint),
+ geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
@@ -659,7 +659,7 @@ void CTurbSASolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, CN
// /*--- Viscous contribution, commented out because serious convergence problems ---*/
//
-// visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
// visc_numerics->SetNormal(Normal);
//
// /*--- Conservative variables w/o reconstruction ---*/
@@ -704,7 +704,7 @@ void CTurbSASolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, C
/*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Allocate the value at the outlet ---*/
@@ -738,8 +738,8 @@ void CTurbSASolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, C
conv_numerics->SetNormal(Normal);
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
- geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint),
+ geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
@@ -752,7 +752,7 @@ void CTurbSASolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, C
// /*--- Viscous contribution, commented out because serious convergence problems ---*/
//
-// visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
// visc_numerics->SetNormal(Normal);
//
// /*--- Conservative variables w/o reconstruction ---*/
@@ -798,7 +798,7 @@ void CTurbSASolver::BC_Engine_Inflow(CGeometry *geometry, CSolver **solver_conta
/*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Allocate the value at the infinity ---*/
@@ -828,8 +828,8 @@ void CTurbSASolver::BC_Engine_Inflow(CGeometry *geometry, CSolver **solver_conta
/*--- Set grid movement ---*/
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
- geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint),
+ geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
@@ -842,7 +842,7 @@ void CTurbSASolver::BC_Engine_Inflow(CGeometry *geometry, CSolver **solver_conta
// /*--- Viscous contribution, commented out because serious convergence problems ---*/
//
-// visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[iPoint]->GetCoord());
+// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(iPoint));
// visc_numerics->SetNormal(Normal);
//
// /*--- Conservative variables w/o reconstruction ---*/
@@ -892,7 +892,7 @@ void CTurbSASolver::BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_cont
/*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Normal vector for this vertex (negate for outward convention) ---*/
@@ -925,8 +925,8 @@ void CTurbSASolver::BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_cont
/*--- Set grid movement ---*/
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
- geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint),
+ geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
@@ -939,7 +939,7 @@ void CTurbSASolver::BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_cont
// /*--- Viscous contribution, commented out because serious convergence problems ---*/
//
-// visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[iPoint]->GetCoord());
+// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(iPoint));
// visc_numerics->SetNormal(Normal);
//
// /*--- Conservative variables w/o reconstruction ---*/
@@ -999,11 +999,11 @@ void CTurbSASolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container,
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
GlobalIndex_donor = solver_container[FLOW_SOL]->GetDonorGlobalIndex(val_marker, iVertex);
- GlobalIndex = geometry->node[iPoint]->GetGlobalIndex();
+ GlobalIndex = geometry->nodes->GetGlobalIndex(iPoint);
/*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/
- if ((geometry->node[iPoint]->GetDomain()) && (GlobalIndex != GlobalIndex_donor)) {
+ if ((geometry->nodes->GetDomain(iPoint)) && (GlobalIndex != GlobalIndex_donor)) {
/*--- Normal vector for this vertex (negate for outward convention) ---*/
@@ -1085,7 +1085,7 @@ void CTurbSASolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container,
/*--- Grid Movement ---*/
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
@@ -1099,7 +1099,7 @@ void CTurbSASolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container,
// /*--- Viscous contribution, commented out because serious convergence problems ---*/
//
// visc_numerics->SetNormal(Normal);
-// visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[iPoint_Normal]->GetCoord());
+// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->node[iPoint_Normal]->GetCoord());
//
// /*--- Conservative variables w/o reconstruction ---*/
//
@@ -1195,8 +1195,8 @@ void CTurbSASolver::BC_Inlet_MixingPlane(CGeometry *geometry, CSolver **solver_c
conv_numerics->SetNormal(Normal);
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
- geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint),
+ geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
@@ -1209,7 +1209,7 @@ void CTurbSASolver::BC_Inlet_MixingPlane(CGeometry *geometry, CSolver **solver_c
/*--- Viscous contribution ---*/
- visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+ visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
visc_numerics->SetNormal(Normal);
/*--- Conservative variables w/o reconstruction ---*/
@@ -1311,8 +1311,8 @@ void CTurbSASolver::BC_Inlet_Turbo(CGeometry *geometry, CSolver **solver_contain
conv_numerics->SetNormal(Normal);
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
- geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint),
+ geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
@@ -1325,7 +1325,7 @@ void CTurbSASolver::BC_Inlet_Turbo(CGeometry *geometry, CSolver **solver_contain
/*--- Viscous contribution ---*/
- visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+ visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
visc_numerics->SetNormal(Normal);
/*--- Conservative variables w/o reconstruction ---*/
@@ -1367,7 +1367,7 @@ void CTurbSASolver::BC_Interface_Boundary(CGeometry *geometry, CSolver **solver_
// for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
// iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
//
- // if (geometry->node[iPoint]->GetDomain()) {
+ // if (geometry->nodes->GetDomain(iPoint)) {
//
// /*--- Find the associate pair to the original node ---*/
// jPoint = geometry->vertex[val_marker][iVertex]->GetDonorPoint();
@@ -1385,8 +1385,8 @@ void CTurbSASolver::BC_Interface_Boundary(CGeometry *geometry, CSolver **solver_
//
// /*--- Retrieve flow solution for both points ---*/
// for (iVar = 0; iVar < solver_container[FLOW_SOL]->GetnVar(); iVar++) {
- // FlowPrimVar_i[iVar] = solver_container[FLOW_SOL]->node[iPoint]->GetSolution(iVar);
- // FlowPrimVar_j[iVar] = solver_container[FLOW_SOL]->node[jPoint]->GetSolution(iVar);
+ // FlowPrimVar_i[iVar] = solver_container[FLOW_SOL]->nodes->GetSolution(iPoint, iVar);
+ // FlowPrimVar_j[iVar] = solver_container[FLOW_SOL]->nodes->GetSolution(jPoint, iVar);
// }
//
// /*--- Set Flow Variables ---*/
@@ -1421,7 +1421,7 @@ void CTurbSASolver::BC_Interface_Boundary(CGeometry *geometry, CSolver **solver_
// node individually, this must be changed ---*/
// for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
// iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
- // if (geometry->node[iPoint]->GetDomain()) {
+ // if (geometry->nodes->GetDomain(iPoint)) {
//
// /*--- Find the associate pair to the original node ---*/
// jPoint = geometry->vertex[val_marker][iVertex]->GetPeriodicPointDomain()[0];
@@ -1434,7 +1434,7 @@ void CTurbSASolver::BC_Interface_Boundary(CGeometry *geometry, CSolver **solver_
// if ((jProcessor != rank) && compute) {
//
// Conserv_Var = nodes->GetSolution(iPoint);
- // Flow_Var = solver_container[FLOW_SOL]->node[iPoint]->GetSolution();
+ // Flow_Var = solver_container[FLOW_SOL]->nodes->GetSolution(iPoint);
//
// for (iVar = 0; iVar < nVar; iVar++)
// Buffer_Send_U[iVar] = Conserv_Var[iVar];
@@ -1452,7 +1452,7 @@ void CTurbSASolver::BC_Interface_Boundary(CGeometry *geometry, CSolver **solver_
//
// iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
//
- // if (geometry->node[iPoint]->GetDomain()) {
+ // if (geometry->nodes->GetDomain(iPoint)) {
//
// /*--- Find the associate pair to the original node ---*/
// jPoint = geometry->vertex[val_marker][iVertex]->GetPeriodicPointDomain()[0];
@@ -1473,7 +1473,7 @@ void CTurbSASolver::BC_Interface_Boundary(CGeometry *geometry, CSolver **solver_
// Buffer_Receive_U[iVar] = nodes->GetSolution(jPoint,iVar);
//
// for (iVar = 0; iVar < solver_container[FLOW_SOL]->GetnVar(); iVar++)
- // Buffer_Send_U[nVar+iVar] = solver_container[FLOW_SOL]->node[jPoint]->GetSolution(iVar);
+ // Buffer_Send_U[nVar+iVar] = solver_container[FLOW_SOL]->nodes->GetSolution(jPoint, iVar);
//
// }
//
@@ -1488,7 +1488,7 @@ void CTurbSASolver::BC_Interface_Boundary(CGeometry *geometry, CSolver **solver_
//
// /*--- Retrieve flow solution for both points ---*/
// for (iVar = 0; iVar < solver_container[FLOW_SOL]->GetnVar(); iVar++) {
- // FlowPrimVar_i[iVar] = solver_container[FLOW_SOL]->node[iPoint]->GetSolution(iVar);
+ // FlowPrimVar_i[iVar] = solver_container[FLOW_SOL]->nodes->GetSolution(iPoint, iVar);
// FlowPrimVar_j[iVar] = Buffer_Receive_U[nVar + iVar];
// }
//
@@ -1530,7 +1530,7 @@ void CTurbSASolver::BC_NearField_Boundary(CGeometry *geometry, CSolver **solver_
// for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
// iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
//
- // if (geometry->node[iPoint]->GetDomain()) {
+ // if (geometry->nodes->GetDomain(iPoint)) {
//
// /*--- Find the associate pair to the original node ---*/
// jPoint = geometry->vertex[val_marker][iVertex]->GetDonorPoint();
@@ -1548,8 +1548,8 @@ void CTurbSASolver::BC_NearField_Boundary(CGeometry *geometry, CSolver **solver_
//
// /*--- Retrieve flow solution for both points ---*/
// for (iVar = 0; iVar < solver_container[FLOW_SOL]->GetnVar(); iVar++) {
- // FlowPrimVar_i[iVar] = solver_container[FLOW_SOL]->node[iPoint]->GetSolution(iVar);
- // FlowPrimVar_j[iVar] = solver_container[FLOW_SOL]->node[jPoint]->GetSolution(iVar);
+ // FlowPrimVar_i[iVar] = solver_container[FLOW_SOL]->nodes->GetSolution(iPoint, iVar);
+ // FlowPrimVar_j[iVar] = solver_container[FLOW_SOL]->nodes->GetSolution(jPoint, iVar);
// }
//
// /*--- Set Flow Variables ---*/
@@ -1584,7 +1584,7 @@ void CTurbSASolver::BC_NearField_Boundary(CGeometry *geometry, CSolver **solver_
// node individually, this must be changed ---*/
// for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
// iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
- // if (geometry->node[iPoint]->GetDomain()) {
+ // if (geometry->nodes->GetDomain(iPoint)) {
//
// /*--- Find the associate pair to the original node ---*/
// jPoint = geometry->vertex[val_marker][iVertex]->GetPeriodicPointDomain()[0];
@@ -1597,7 +1597,7 @@ void CTurbSASolver::BC_NearField_Boundary(CGeometry *geometry, CSolver **solver_
// if ((jProcessor != rank) && compute) {
//
// Conserv_Var = nodes->GetSolution(iPoint);
- // Flow_Var = solver_container[FLOW_SOL]->node[iPoint]->GetSolution();
+ // Flow_Var = solver_container[FLOW_SOL]->nodes->GetSolution(iPoint);
//
// for (iVar = 0; iVar < nVar; iVar++)
// Buffer_Send_U[iVar] = Conserv_Var[iVar];
@@ -1615,7 +1615,7 @@ void CTurbSASolver::BC_NearField_Boundary(CGeometry *geometry, CSolver **solver_
//
// iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
//
- // if (geometry->node[iPoint]->GetDomain()) {
+ // if (geometry->nodes->GetDomain(iPoint)) {
//
// /*--- Find the associate pair to the original node ---*/
// jPoint = geometry->vertex[val_marker][iVertex]->GetPeriodicPointDomain()[0];
@@ -1636,7 +1636,7 @@ void CTurbSASolver::BC_NearField_Boundary(CGeometry *geometry, CSolver **solver_
// Buffer_Receive_U[iVar] = nodes->GetSolution(jPoint,iVar);
//
// for (iVar = 0; iVar < solver_container[FLOW_SOL]->GetnVar(); iVar++)
- // Buffer_Send_U[nVar+iVar] = solver_container[FLOW_SOL]->node[jPoint]->GetSolution(iVar);
+ // Buffer_Send_U[nVar+iVar] = solver_container[FLOW_SOL]->nodes->GetSolution(jPoint, iVar);
//
// }
//
@@ -1651,7 +1651,7 @@ void CTurbSASolver::BC_NearField_Boundary(CGeometry *geometry, CSolver **solver_
//
// /*--- Retrieve flow solution for both points ---*/
// for (iVar = 0; iVar < solver_container[FLOW_SOL]->GetnVar(); iVar++) {
- // FlowPrimVar_i[iVar] = solver_container[FLOW_SOL]->node[iPoint]->GetSolution(iVar);
+ // FlowPrimVar_i[iVar] = solver_container[FLOW_SOL]->nodes->GetSolution(iPoint, iVar);
// FlowPrimVar_j[iVar] = Buffer_Receive_U[nVar + iVar];
// }
//
@@ -1740,18 +1740,18 @@ void CTurbSASolver::SetNuTilde_WF(CGeometry *geometry, CSolver **solver_containe
iPoint_Neighbor = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor();
- for(iNode = 0; iNode < geometry->node[iPoint]->GetnPoint(); iNode++) {
- iPoint_Neighbor = geometry->node[iPoint]->GetPoint(iNode);
+ for(iNode = 0; iNode < geometry->nodes->GetnPoint(iPoint); iNode++) {
+ iPoint_Neighbor = geometry->nodes->GetPoint(iPoint, iNode);
/*--- Check if the node belongs to the domain (i.e, not a halo node)
and the neighbor is not part of the physical boundary ---*/
- if (geometry->node[iPoint]->GetDomain() && (!geometry->node[iPoint_Neighbor]->GetBoundary())) {
+ if (geometry->nodes->GetDomain(iPoint) && (!geometry->nodes->GetBoundary(iPoint_Neighbor))) {
/*--- Get coordinates of the current vertex and nearest normal point ---*/
- Coord = geometry->node[iPoint]->GetCoord();
- Coord_Normal = geometry->node[iPoint_Neighbor]->GetCoord();
+ Coord = geometry->nodes->GetCoord(iPoint);
+ Coord_Normal = geometry->nodes->GetCoord(iPoint_Neighbor);
/*--- Compute dual-grid area and boundary normal ---*/
@@ -1978,9 +1978,9 @@ void CTurbSASolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CC
SU2_OMP_FOR_DYN(omp_chunk_size)
for (iPoint = 0; iPoint < nPointDomain; iPoint++){
- coord_i = geometry->node[iPoint]->GetCoord();
- nNeigh = geometry->node[iPoint]->GetnPoint();
- wallDistance = geometry->node[iPoint]->GetWall_Distance();
+ coord_i = geometry->nodes->GetCoord(iPoint);
+ nNeigh = geometry->nodes->GetnPoint(iPoint);
+ wallDistance = geometry->nodes->GetWall_Distance(iPoint);
primVarGrad = solver[FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint);
vorticity = solver[FLOW_SOL]->GetNodes()->GetVorticity(iPoint);
density = solver[FLOW_SOL]->GetNodes()->GetDensity(iPoint);
@@ -2019,7 +2019,7 @@ void CTurbSASolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CC
1997
---*/
- maxDelta = geometry->node[iPoint]->GetMaxLength();
+ maxDelta = geometry->nodes->GetMaxLength(iPoint);
distDES = constDES * maxDelta;
lengthScale = min(distDES,wallDistance);
@@ -2031,7 +2031,7 @@ void CTurbSASolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CC
Theoretical and Computational Fluid Dynamics - 2006
---*/
- maxDelta = geometry->node[iPoint]->GetMaxLength();
+ maxDelta = geometry->nodes->GetMaxLength(iPoint);
r_d = (kinematicViscosityTurb+kinematicViscosity)/(uijuij*k2*pow(wallDistance, 2.0));
f_d = 1.0-tanh(pow(8.0*r_d,3.0));
@@ -2047,13 +2047,13 @@ void CTurbSASolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CC
---*/
for (iNeigh = 0; iNeigh < nNeigh; iNeigh++){
- jPoint = geometry->node[iPoint]->GetPoint(iNeigh);
- coord_j = geometry->node[jPoint]->GetCoord();
+ jPoint = geometry->nodes->GetPoint(iPoint, iNeigh);
+ coord_j = geometry->nodes->GetCoord(jPoint);
for ( iDim = 0; iDim < nDim; iDim++){
deltaAux = abs(coord_j[iDim] - coord_i[iDim]);
delta[iDim] = max(delta[iDim], deltaAux);
}
- deltaDDES = geometry->node[iPoint]->GetMaxLength();
+ deltaDDES = geometry->nodes->GetMaxLength(iPoint);
}
omega = sqrt(vorticity[0]*vorticity[0] +
@@ -2100,12 +2100,12 @@ void CTurbSASolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CC
ln_max = 0.0;
deltaDDES = 0.0;
for (iNeigh = 0;iNeigh < nNeigh; iNeigh++){
- jPoint = geometry->node[iPoint]->GetPoint(iNeigh);
- coord_j = geometry->node[jPoint]->GetCoord();
+ jPoint = geometry->nodes->GetPoint(iPoint, iNeigh);
+ coord_j = geometry->nodes->GetCoord(jPoint);
for (iDim = 0; iDim < nDim; iDim++){
delta[iDim] = fabs(coord_j[iDim] - coord_i[iDim]);
}
- deltaDDES = geometry->node[iPoint]->GetMaxLength();
+ deltaDDES = geometry->nodes->GetMaxLength(iPoint);
ln[0] = delta[1]*ratioOmega[2] - delta[2]*ratioOmega[1];
ln[1] = delta[2]*ratioOmega[0] - delta[0]*ratioOmega[2];
ln[2] = delta[0]*ratioOmega[1] - delta[1]*ratioOmega[0];
diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp
index d1e6ecdf0c4b..80be3f9f2444 100644
--- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp
+++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp
@@ -327,7 +327,7 @@ void CTurbSSTSolver::Postprocessing(CGeometry *geometry, CSolver **solver_contai
su2double rho = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint);
su2double mu = solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint);
- su2double dist = geometry->node[iPoint]->GetWall_Distance();
+ su2double dist = geometry->nodes->GetWall_Distance(iPoint);
const su2double *Vorticity = solver_container[FLOW_SOL]->GetNodes()->GetVorticity(iPoint);
su2double VorticityMag = sqrt(Vorticity[0]*Vorticity[0] +
@@ -379,11 +379,11 @@ void CTurbSSTSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta
/*--- Set volume ---*/
- numerics->SetVolume(geometry->node[iPoint]->GetVolume());
+ numerics->SetVolume(geometry->nodes->GetVolume(iPoint));
/*--- Set distance to the surface ---*/
- numerics->SetDistance(geometry->node[iPoint]->GetWall_Distance(), 0.0);
+ numerics->SetDistance(geometry->nodes->GetWall_Distance(iPoint), 0.0);
/*--- Menter's first blending function ---*/
@@ -431,14 +431,14 @@ void CTurbSSTSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_cont
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- distance to closest neighbor ---*/
jPoint = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor();
distance = 0.0;
for (iDim = 0; iDim < nDim; iDim++) {
- distance += pow(geometry->node[iPoint]->GetCoord(iDim)-
- geometry->node[jPoint]->GetCoord(iDim), 2);
+ distance += pow(geometry->nodes->GetCoord(iPoint, iDim)-
+ geometry->nodes->GetCoord(jPoint, iDim), 2);
}
distance = sqrt(distance);
@@ -479,14 +479,14 @@ void CTurbSSTSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_co
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- distance to closest neighbor ---*/
jPoint = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor();
distance = 0.0;
for (iDim = 0; iDim < nDim; iDim++) {
- distance += (geometry->node[iPoint]->GetCoord(iDim) - geometry->node[jPoint]->GetCoord(iDim))*
- (geometry->node[iPoint]->GetCoord(iDim) - geometry->node[jPoint]->GetCoord(iDim));
+ distance += (geometry->nodes->GetCoord(iPoint, iDim) - geometry->nodes->GetCoord(jPoint, iDim))*
+ (geometry->nodes->GetCoord(iPoint, iDim) - geometry->nodes->GetCoord(jPoint, iDim));
}
distance = sqrt(distance);
@@ -531,7 +531,7 @@ void CTurbSSTSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_containe
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Allocate the value at the infinity ---*/
@@ -563,7 +563,7 @@ void CTurbSSTSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_containe
/*--- Grid Movement ---*/
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint));
/*--- Compute residuals and Jacobians ---*/
@@ -600,7 +600,7 @@ void CTurbSSTSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, C
/*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Normal vector for this vertex (negate for outward convention) ---*/
@@ -637,8 +637,8 @@ void CTurbSSTSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, C
conv_numerics->SetNormal(Normal);
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
- geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint),
+ geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
@@ -651,7 +651,7 @@ void CTurbSSTSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, C
// /*--- Viscous contribution, commented out because serious convergence problems ---*/
//
- // visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+ // visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
// visc_numerics->SetNormal(Normal);
//
// /*--- Conservative variables w/o reconstruction ---*/
@@ -702,7 +702,7 @@ void CTurbSSTSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
/*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/
- if (geometry->node[iPoint]->GetDomain()) {
+ if (geometry->nodes->GetDomain(iPoint)) {
/*--- Allocate the value at the outlet ---*/
@@ -736,8 +736,8 @@ void CTurbSSTSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
conv_numerics->SetNormal(Normal);
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
- geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint),
+ geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
@@ -750,7 +750,7 @@ void CTurbSSTSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
// /*--- Viscous contribution, commented out because serious convergence problems ---*/
//
-// visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
// visc_numerics->SetNormal(Normal);
//
// /*--- Conservative variables w/o reconstruction ---*/
@@ -846,8 +846,8 @@ void CTurbSSTSolver::BC_Inlet_MixingPlane(CGeometry *geometry, CSolver **solver_
conv_numerics->SetNormal(Normal);
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
- geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint),
+ geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
auto conv_residual = conv_numerics->ComputeResidual(config);
@@ -857,7 +857,7 @@ void CTurbSSTSolver::BC_Inlet_MixingPlane(CGeometry *geometry, CSolver **solver_
Jacobian.AddBlock2Diag(iPoint, conv_residual.jacobian_i);
/*--- Viscous contribution ---*/
- visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+ visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
visc_numerics->SetNormal(Normal);
/*--- Conservative variables w/o reconstruction ---*/
@@ -971,8 +971,8 @@ void CTurbSSTSolver::BC_Inlet_Turbo(CGeometry *geometry, CSolver **solver_contai
conv_numerics->SetNormal(Normal);
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
- geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint),
+ geometry->nodes->GetGridVel(iPoint));
/*--- Compute the residual using an upwind scheme ---*/
auto conv_residual = conv_numerics->ComputeResidual(config);
@@ -982,7 +982,7 @@ void CTurbSSTSolver::BC_Inlet_Turbo(CGeometry *geometry, CSolver **solver_contai
Jacobian.AddBlock2Diag(iPoint, conv_residual.jacobian_i);
/*--- Viscous contribution ---*/
- visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+ visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
visc_numerics->SetNormal(Normal);
/*--- Conservative variables w/o reconstruction ---*/
diff --git a/SU2_CFD/src/solvers/CTurbSolver.cpp b/SU2_CFD/src/solvers/CTurbSolver.cpp
index d1fa5b3a1b0a..10444ae32e9b 100644
--- a/SU2_CFD/src/solvers/CTurbSolver.cpp
+++ b/SU2_CFD/src/solvers/CTurbSolver.cpp
@@ -145,14 +145,14 @@ void CTurbSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_containe
/*--- Grid Movement ---*/
if (dynamic_grid)
- numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
- geometry->node[jPoint]->GetGridVel());
+ numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint),
+ geometry->nodes->GetGridVel(jPoint));
if (muscl || musclFlow) {
const su2double *Limiter_i = nullptr, *Limiter_j = nullptr;
- const auto Coord_i = geometry->node[iPoint]->GetCoord();
- const auto Coord_j = geometry->node[jPoint]->GetCoord();
+ const auto Coord_i = geometry->nodes->GetCoord(iPoint);
+ const auto Coord_j = geometry->nodes->GetCoord(jPoint);
su2double Vector_ij[MAXNDIM] = {0.0};
for (iDim = 0; iDim < nDim; iDim++) {
@@ -255,8 +255,8 @@ void CTurbSolver::Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CSo
/*--- Points coordinates, and normal vector ---*/
- numerics->SetCoord(geometry->node[iPoint]->GetCoord(),
- geometry->node[jPoint]->GetCoord());
+ numerics->SetCoord(geometry->nodes->GetCoord(iPoint),
+ geometry->nodes->GetCoord(jPoint));
numerics->SetNormal(geometry->edges->GetNormal(iEdge));
/*--- Conservative variables w/o reconstruction ---*/
@@ -298,9 +298,9 @@ void CTurbSolver::SumEdgeFluxes(CGeometry* geometry) {
LinSysRes.SetBlock_Zero(iPoint);
- for (unsigned short iNeigh = 0; iNeigh < geometry->node[iPoint]->GetnPoint(); ++iNeigh) {
+ for (unsigned short iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) {
- auto iEdge = geometry->node[iPoint]->GetEdge(iNeigh);
+ auto iEdge = geometry->nodes->GetEdge(iPoint, iNeigh);
if (iPoint == geometry->edges->GetNode(iEdge,0))
LinSysRes.AddBlock(iPoint, EdgeFluxes.GetBlock(iEdge));
@@ -419,7 +419,7 @@ void CTurbSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_conta
const auto iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- if (!geometry->node[iPoint]->GetDomain()) continue;
+ if (!geometry->nodes->GetDomain(iPoint)) continue;
const auto Point_Normal = geometry->vertex[iMarker][iVertex]->GetNormal_Neighbor();
const auto nDonorVertex = GetnSlidingStates(iMarker,iVertex);
@@ -465,7 +465,7 @@ void CTurbSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_conta
conv_numerics->SetNormal(Normal);
if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
+ conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint));
auto residual = conv_numerics->ComputeResidual(config);
@@ -487,7 +487,7 @@ void CTurbSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_conta
/*--- Set the normal vector and the coordinates ---*/
visc_numerics->SetNormal(Normal);
- visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+ visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal));
/*--- Primitive variables ---*/
@@ -547,7 +547,7 @@ void CTurbSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_
/*--- Read the volume ---*/
- su2double Vol = (geometry->node[iPoint]->GetVolume() + geometry->node[iPoint]->GetPeriodicVolume());
+ su2double Vol = (geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint));
/*--- Modify matrix diagonal to assure diagonal dominance ---*/
@@ -566,14 +566,14 @@ void CTurbSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_
if (Res > resMax[iVar]) {
resMax[iVar] = Res;
idxMax[iVar] = iPoint;
- coordMax[iVar] = geometry->node[iPoint]->GetCoord();
+ coordMax[iVar] = geometry->nodes->GetCoord(iPoint);
}
}
}
SU2_OMP_CRITICAL
for (unsigned short iVar = 0; iVar < nVar; iVar++) {
AddRes_RMS(iVar, resRMS[iVar]);
- AddRes_Max(iVar, resMax[iVar], geometry->node[idxMax[iVar]]->GetGlobalIndex(), coordMax[iVar]);
+ AddRes_Max(iVar, resMax[iVar], geometry->nodes->GetGlobalIndex(idxMax[iVar]), coordMax[iVar]);
}
/*--- Initialize residual and solution at the ghost points ---*/
@@ -765,7 +765,7 @@ void CTurbSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_con
/*--- CV volume at time n+1. As we are on a static mesh, the volume
of the CV will remained fixed for all time steps. ---*/
- Volume_nP1 = geometry->node[iPoint]->GetVolume();
+ Volume_nP1 = geometry->nodes->GetVolume(iPoint);
/*--- Compute the dual time-stepping source term based on the chosen
time discretization scheme (1st- or 2nd-order).---*/
@@ -829,7 +829,7 @@ void CTurbSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_con
SU2_OMP_FOR_STAT(omp_chunk_size)
for (iPoint = 0; iPoint < nPointDomain; ++iPoint) {
- GridVel_i = geometry->node[iPoint]->GetGridVel();
+ GridVel_i = geometry->nodes->GetGridVel(iPoint);
U_time_n = nodes->GetSolution_time_n(iPoint);
Density_n = 1.0;
@@ -840,13 +840,13 @@ void CTurbSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_con
Density_n = flowNodes->GetSolution_time_n(iPoint,0);
}
- for (iNeigh = 0; iNeigh < geometry->node[iPoint]->GetnNeighbor(); iNeigh++) {
+ for (iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); iNeigh++) {
- iEdge = geometry->node[iPoint]->GetEdge(iNeigh);
+ iEdge = geometry->nodes->GetEdge(iPoint, iNeigh);
Normal = geometry->edges->GetNormal(iEdge);
- jPoint = geometry->node[iPoint]->GetPoint(iNeigh);
- GridVel_j = geometry->node[jPoint]->GetGridVel();
+ jPoint = geometry->nodes->GetPoint(iPoint, iNeigh);
+ GridVel_j = geometry->nodes->GetGridVel(jPoint);
/*--- Determine whether to consider the normal outward or inward. ---*/
su2double dir = (geometry->edges->GetNode(iEdge,0) == iPoint)? 0.5 : -0.5;
@@ -878,7 +878,7 @@ void CTurbSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_con
/*--- Grid velocities stored at boundary node i ---*/
- GridVel_i = geometry->node[iPoint]->GetGridVel();
+ GridVel_i = geometry->nodes->GetGridVel(iPoint);
/*--- Compute the GCL term by dotting the grid velocity with the face
normal. The normal is negated to match the boundary convention. ---*/
@@ -929,8 +929,8 @@ void CTurbSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_con
grids, the volumes will change. On rigidly transforming grids, the
volumes will remain constant. ---*/
- Volume_nM1 = geometry->node[iPoint]->GetVolume_nM1();
- Volume_nP1 = geometry->node[iPoint]->GetVolume();
+ Volume_nM1 = geometry->nodes->GetVolume_nM1(iPoint);
+ Volume_nP1 = geometry->nodes->GetVolume(iPoint);
/*--- Compute the dual time-stepping source residual. Due to the
introduction of the GCL term above, the remainder of the source residual
@@ -1077,11 +1077,11 @@ void CTurbSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *
for (iMesh = 1; iMesh <= config->GetnMGLevels(); iMesh++) {
SU2_OMP_FOR_STAT(omp_chunk_size)
for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) {
- Area_Parent = geometry[iMesh]->node[iPoint]->GetVolume();
+ Area_Parent = geometry[iMesh]->nodes->GetVolume(iPoint);
su2double Solution_Coarse[MAXNVAR] = {0.0};
- for (iChildren = 0; iChildren < geometry[iMesh]->node[iPoint]->GetnChildren_CV(); iChildren++) {
- Point_Fine = geometry[iMesh]->node[iPoint]->GetChildren_CV(iChildren);
- Area_Children = geometry[iMesh-1]->node[Point_Fine]->GetVolume();
+ for (iChildren = 0; iChildren < geometry[iMesh]->nodes->GetnChildren_CV(iPoint); iChildren++) {
+ Point_Fine = geometry[iMesh]->nodes->GetChildren_CV(iPoint, iChildren);
+ Area_Children = geometry[iMesh-1]->nodes->GetVolume(Point_Fine);
Solution_Fine = solver[iMesh-1][TURB_SOL]->GetNodes()->GetSolution(Point_Fine);
for (iVar = 0; iVar < nVar; iVar++) {
Solution_Coarse[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent;
diff --git a/SU2_DOT/src/SU2_DOT.cpp b/SU2_DOT/src/SU2_DOT.cpp
index 5b3f00380e98..e55d8da09269 100644
--- a/SU2_DOT/src/SU2_DOT.cpp
+++ b/SU2_DOT/src/SU2_DOT.cpp
@@ -889,7 +889,7 @@ void SetSensitivity_Files(CGeometry ***geometry, CConfig **config, unsigned shor
for (iPoint = 0; iPoint < nPoint; iPoint++) {
for (iDim = 0; iDim < nDim; iDim++) {
- solver->GetNodes()->SetSolution(iPoint, iDim, geometry[iZone][INST_0]->node[iPoint]->GetCoord(iDim));
+ solver->GetNodes()->SetSolution(iPoint, iDim, geometry[iZone][INST_0]->nodes->GetCoord(iPoint, iDim));
solver->GetNodes()->SetSolution(iPoint, iDim+nDim, geometry[iZone][INST_0]->GetSensitivity(iPoint, iDim));
}
}