diff --git a/Common/include/geometry/CGeometry.hpp b/Common/include/geometry/CGeometry.hpp
index b7585475c29e..5eea74037a32 100644
--- a/Common/include/geometry/CGeometry.hpp
+++ b/Common/include/geometry/CGeometry.hpp
@@ -191,7 +191,7 @@ class CGeometry {
CPrimalGrid** face; /*!< \brief Face vector (primal grid information). */
CPrimalGrid*** bound; /*!< \brief Boundary vector (primal grid information). */
CPoint** node; /*!< \brief Node vector (dual grid information). */
- CEdge** edge; /*!< \brief Edge 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). */
unsigned long *nVertex; /*!< \brief Number of vertex for each marker. */
diff --git a/Common/include/geometry/dual_grid/CEdge.hpp b/Common/include/geometry/dual_grid/CEdge.hpp
index b7bf28881e67..7a8e6b1a8865 100644
--- a/Common/include/geometry/dual_grid/CEdge.hpp
+++ b/Common/include/geometry/dual_grid/CEdge.hpp
@@ -1,7 +1,6 @@
/*!
* \file CEdge.hpp
- * \brief Headers of the main subroutines for doing the complete dual grid structure.
- * The subroutines and functions are in the CEdge.cpp file.
+ * \brief Declaration of the edge class CEdge.cpp file.
* \author F. Palacios, T. Economon
* \version 7.0.4 "Blackbird"
*
@@ -25,154 +24,187 @@
* You should have received a copy of the GNU Lesser General Public
* License along with SU2. If not, see .
*/
+
#pragma once
-#include "CDualGrid.hpp"
+#include "../../toolboxes/C2DContainer.hpp"
/*!
* \class CEdge
- * \brief Class for defining an edge.
+ * \brief Class for defining the edges of the dual grid.
* \author F. Palacios
*/
-class CEdge final : public CDualGrid {
+class CEdge {
+ static_assert(su2activematrix::Storage == StorageType::RowMajor, "Needed to return normal as pointer.");
+
private:
- su2double *Coord_CG; /*!< \brief Center-of-gravity of the element. */
- unsigned long *Nodes; /*!< \brief Vector to store the global nodes of an element. */
- su2double *Normal; /*!< \brief Normal al elemento y coordenadas de su centro de gravedad. */
+ su2matrix Nodes; /*!< \brief Vector to store the node indices of the edge. */
+ su2activematrix Normal; /*!< \brief Normal (area) of the edge. */
+ su2activematrix Coord_CG; /*!< \brief Center-of-gravity (mid point) of the edge. */
public:
+ enum NodePosition : unsigned long {LEFT = 0, RIGHT = 1};
/*!
* \brief Constructor of the class.
- * \param[in] val_iPoint - First node of the edge.
- * \param[in] val_jPoint - Second node of the edge.
- * \param[in] val_nDim - Number of dimensions of the problem.
+ * \param[in] nEdge - Number of edges
+ * \param[in] nDim - Number of dimensions of the problem.
*/
- CEdge(unsigned long val_iPoint, unsigned long val_jPoint, unsigned short val_nDim);
+ CEdge(unsigned long nEdge, unsigned long nDim);
/*!
- * \brief Destructor of the class.
+ * \brief No default construction.
*/
- ~CEdge(void) override;
+ CEdge() = delete;
/*!
* \brief Set the center of gravity of the edge.
- * \param[in] val_coord - Coordinates of all the nodes needed for computing the centre of gravity of an edge.
+ * \param[in] iEdge - Edge index.
+ * \param[in] nodeCoord - Coordinates of the two nodes.
*/
- void SetCoord_CG(su2double **val_coord);
+ template
+ void SetCoord_CG(unsigned long iEdge, const T& nodeCoord) {
+ for (auto iDim = 0u; iDim < Coord_CG.cols(); ++iDim)
+ Coord_CG(iEdge,iDim) = 0.5 * (nodeCoord[0][iDim] + nodeCoord[1][iDim]);
+ }
/*!
- * \brief Obtain the centre of gravity of the edge.
- * \param[in] val_dim - Position to read the coordinate.
- * \return Coordinate val_dim of the centre of gravity.
+ * \brief Obtain the center of gravity of the edge.
+ * \param[in] iEdge - Edge index.
+ * \param[in] iDim - Dimension.
+ * \return Coordinate of the centre of gravity.
*/
- inline su2double GetCG(unsigned short val_dim) const { return Coord_CG[val_dim]; }
+ inline su2double GetCG(unsigned long iEdge, unsigned long iDim) const { return Coord_CG(iEdge,iDim); }
/*!
- * \brief Get the nodes of the edge.
- * \param[in] val_node - Position of the node that makes the edge.
- * \return Index of the node that compose the edge.
+ * \brief Get left/right node index defining the edge.
+ * \param[in] iEdge - Edge index.
+ * \param[in] iNode - Node index 0 or 1, LEFT or RIGHT.
+ * \return Index of the node that composes the edge.
*/
+ inline unsigned long GetNode(unsigned long iEdge, unsigned long iNode) const { return Nodes(iEdge,iNode); }
- inline unsigned long GetNode(unsigned short val_node) const { return Nodes[val_node]; }
+ /*!
+ * \brief Set the node indices of an edge.
+ * \param[in] iEdge - Edge index.
+ * \param[in] iPoint - Index of left node.
+ * \param[in] jPoint - Index of right node.
+ */
+ inline void SetNodes(unsigned long iEdge, unsigned long iPoint, unsigned long jPoint) {
+ Nodes(iEdge, LEFT) = iPoint;
+ Nodes(iEdge, RIGHT) = jPoint;
+ }
/*!
- * \brief Get the number of nodes of an element.
- * \return Number of nodes that set an edge (2).
+ * \brief Get the number of nodes of an edge (2).
*/
- inline unsigned short GetnNodes() const override { return 2; }
+ inline unsigned long GetnNodes() const { return 2; }
/*!
- * \brief Compute Volume associated to each edge.
- * \param[in] val_coord_Edge_CG - Coordinates of the centre of gravity of the edge.
- * \param[in] val_coord_FaceElem_CG - Coordinates of the centre of gravity of the face of an element.
- * \param[in] val_coord_Elem_CG - Coordinates of the centre of gravity of the element.
- * \param[in] val_coord_Point - Coordinates of the point that form the control volume.
+ * \brief Compute the volume associated with an edge (3D version).
+ * \param[in] coord_Edge_CG - Coordinates of the centre of gravity of the edge.
+ * \param[in] coord_FaceElem_CG - Coordinates of the centre of gravity of the face of an element.
+ * \param[in] coord_Elem_CG - Coordinates of the centre of gravity of the element.
+ * \param[in] coord_Point - Coordinates of the point that form the control volume.
* \return Local volume associated to the edge.
*/
- su2double GetVolume(su2double *val_coord_Edge_CG, su2double *val_coord_FaceElem_CG, su2double *val_coord_Elem_CG, su2double *val_coord_Point) const;
+ static su2double GetVolume(const su2double* coord_Edge_CG,
+ const su2double* coord_FaceElem_CG,
+ const su2double* coord_Elem_CG,
+ const su2double* coord_Point);
/*!
- * \overload
- * \param[in] val_coord_Edge_CG - Coordinates of the centre of gravity of the edge.
- * \param[in] val_coord_Elem_CG - Coordinates of the centre of gravity of the element.
- * \param[in] val_coord_Point - Coordinates of the point that form the control volume.
+ * \brief Compute the volume associated with an edge (2D version).
+ * \param[in] coord_Edge_CG - Coordinates of the centre of gravity of the edge.
+ * \param[in] coord_Elem_CG - Coordinates of the centre of gravity of the element.
+ * \param[in] coord_Point - Coordinates of the point that form the control volume.
* \return Local volume associated to the edge.
*/
- su2double GetVolume(su2double *val_coord_Edge_CG, su2double *val_coord_Elem_CG, su2double *val_coord_Point) const;
+ static su2double GetVolume(const su2double* coord_Edge_CG,
+ const su2double* coord_Elem_CG,
+ const su2double* coord_Point);
/*!
- * \brief Set the face that correspond to an edge.
- * \param[in] val_coord_Edge_CG - Coordinates of the centre of gravity of the edge.
- * \param[in] val_coord_FaceElem_CG - Coordinates of the centre of gravity of the face of an element.
- * \param[in] val_coord_Elem_CG - Coordinates of the centre of gravity of the element.
+ * \brief Set the face that corresponds to an edge (3D version).
+ * \param[in] iEdge - Edge index.
+ * \param[in] coord_Edge_CG - Coordinates of the centre of gravity of the edge.
+ * \param[in] coord_FaceElem_CG - Coordinates of the centre of gravity of the face of an element.
+ * \param[in] coord_Elem_CG - Coordinates of the centre of gravity of the element.
* \param[in] config - Definition of the particular problem.
* \return Compute the normal (dimensional) to the face that makes the control volume boundaries.
*/
- void SetNodes_Coord(su2double *val_coord_Edge_CG, su2double *val_coord_FaceElem_CG, su2double *val_coord_Elem_CG) override;
+ void SetNodes_Coord(unsigned long iEdge,
+ const su2double* coord_Edge_CG,
+ const su2double* coord_FaceElem_CG,
+ const su2double* coord_Elem_CG);
/*!
- * \overload
- * \brief Set the face that correspond to an edge.
- * \param[in] val_coord_Edge_CG - Coordinates of the centre of gravity of the edge.
- * \param[in] val_coord_Elem_CG - Coordinates of the centre of gravity of the element.
+ * \brief Set the face that corresponds to an edge (2D version).
+ * \param[in] iEdge - Edge index.
+ * \param[in] coord_Edge_CG - Coordinates of the centre of gravity of the edge.
+ * \param[in] coord_Elem_CG - Coordinates of the centre of gravity of the element.
* \param[in] config - Definition of the particular problem.
* \return Compute the normal (dimensional) to the face that makes the contorl volume boundaries.
*/
- void SetNodes_Coord(su2double *val_coord_Edge_CG, su2double *val_coord_Elem_CG) override;
+ void SetNodes_Coord(unsigned long iEdge,
+ const su2double* coord_Edge_CG,
+ const su2double* coord_Elem_CG);
/*!
* \brief Copy the the normal vector of a face.
- * \param[in] val_normal - Vector where the subroutine is goint to copy the normal (dimensional).
+ * \param[in] iEdge - Edge index.
+ * \param[out] normal - Object into which the normal (dimensional) will be copied.
*/
- inline void GetNormal(su2double *val_normal) const override {
- for (unsigned short iDim = 0; iDim < nDim; iDim++)
- val_normal[iDim] = Normal[iDim];
+ template
+ inline void GetNormal(unsigned long iEdge, T& normal) const {
+ for (auto iDim = 0ul; iDim < Normal.cols(); iDim++)
+ normal[iDim] = Normal(iEdge,iDim);
}
/*!
* \brief Get the normal to a face of the control volume asociated with an edge.
+ * \param[in] iEdge - Edge index.
* \return Dimensional normal vector, the modulus is the area of the face.
*/
- inline su2double *GetNormal(void) override { return Normal; }
+ inline const su2double* GetNormal(unsigned long iEdge) const { return Normal[iEdge]; }
/*!
- * \brief Initialize normal vector.
+ * \brief Initialize normal vector to 0.
*/
- inline void SetZeroValues(void) override {
- for (unsigned short iDim = 0; iDim < nDim; iDim ++)
- Normal[iDim] = 0.0;
- }
+ void SetZeroValues(void);
/*!
- * \brief Set the normal vector.
- * \param[in] val_face_normal - Vector to initialize the normal vector.
+ * \brief Set the normal vector of an edge.
+ * \param[in] iEdge - Edge index.
+ * \param[in] normal - Vector to initialize the normal vector.
* \return Value of the normal vector.
*/
- inline void SetNormal(const su2double *val_face_normal) override {
- for (unsigned short iDim = 0; iDim < nDim; iDim++)
- Normal[iDim]=val_face_normal[iDim];
+ template
+ void SetNormal(unsigned long iEdge, const T& normal) {
+ for (auto iDim = 0ul; iDim < Normal.cols(); ++iDim)
+ Normal(iEdge,iDim) = normal[iDim];
}
/*!
- * \brief Add a vector to the normal vector.
- * \param[in] val_face_normal - Vector to add to the normal vector.
+ * \brief Add a vector to the normal vector of an edge.
+ * \param[in] iEdge - Edge index.
+ * \param[in] normal - Vector to add to the normal vector.
*/
- inline void AddNormal(const su2double *val_face_normal) override {
- for (unsigned short iDim = 0; iDim < nDim; iDim++)
- Normal[iDim] += val_face_normal[iDim];
+ template
+ void AddNormal(unsigned long iEdge, const T& normal) {
+ for (auto iDim = 0ul; iDim < Normal.cols(); ++iDim)
+ Normal(iEdge,iDim) += normal[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 Subtract a vector to the normal vector of an edge.
+ * \param[in] iEdge - Edge index.
+ * \param[in] normal - Vector to add to the normal vector.
*/
- inline su2double *GetCoord(void) override { return NULL; }
-
- /*!
- * \brief This function does nothing (it comes from a pure virtual function, that implies the
- * definition of the function in all the derived classes).
- */
- inline void SetCoord(const su2double *val_coord) override { }
+ template
+ void SubNormal(unsigned long iEdge, const T& normal) {
+ for (auto iDim = 0ul; iDim < Normal.cols(); ++iDim)
+ Normal(iEdge,iDim) -= normal[iDim];
+ }
};
diff --git a/Common/include/geometry/primal_grid/CPrimalGrid.hpp b/Common/include/geometry/primal_grid/CPrimalGrid.hpp
index 5fdeb2947f78..bfa83fa56017 100644
--- a/Common/include/geometry/primal_grid/CPrimalGrid.hpp
+++ b/Common/include/geometry/primal_grid/CPrimalGrid.hpp
@@ -170,7 +170,7 @@ class CPrimalGrid {
* \brief Set the center of gravity of an element (including edges).
* \param[in] val_coord - Coordinates of the element.
*/
- void SetCoord_CG(su2double **val_coord);
+ void SetCoord_CG(const su2double* const* val_coord);
/*!
* \brief Get the center of gravity of an element (including edges).
diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp
index 788e4b0db9c4..da24fb333479 100644
--- a/Common/include/option_structure.hpp
+++ b/Common/include/option_structure.hpp
@@ -127,6 +127,7 @@ const unsigned short N_POINTS_TETRAHEDRON = 4; /*!< \brief General output & CG
const unsigned short N_POINTS_HEXAHEDRON = 8; /*!< \brief General output & CGNS defines. */
const unsigned short N_POINTS_PYRAMID = 5; /*!< \brief General output & CGNS defines. */
const unsigned short N_POINTS_PRISM = 6; /*!< \brief General output & CGNS defines. */
+enum: unsigned short{N_POINTS_MAXIMUM = 8}; /*!< \brief Max. out of the above, used for static arrays, keep it up to date. */
const int CGNS_STRING_SIZE = 33; /*!< \brief Length of strings used in the CGNS format. */
const int SU2_CONN_SIZE = 10; /*!< \brief Size of the connectivity array that is allocated for each element
diff --git a/Common/include/toolboxes/graph_toolbox.hpp b/Common/include/toolboxes/graph_toolbox.hpp
index c172e9413b41..23a406c853e6 100644
--- a/Common/include/toolboxes/graph_toolbox.hpp
+++ b/Common/include/toolboxes/graph_toolbox.hpp
@@ -403,8 +403,8 @@ CEdgeToNonZeroMap mapEdgesToSparsePattern(Geometry_t& geometry,
for(Index_t iEdge = 0; iEdge < geometry.GetnEdge(); ++iEdge)
{
- Index_t iPoint = geometry.edge[iEdge]->GetNode(0);
- Index_t jPoint = geometry.edge[iEdge]->GetNode(1);
+ Index_t iPoint = geometry.edges->GetNode(iEdge,0);
+ Index_t jPoint = geometry.edges->GetNode(iEdge,1);
edgeMap(iEdge,0) = pattern.quickFindInnerIdx(iPoint,jPoint);
edgeMap(iEdge,1) = pattern.quickFindInnerIdx(jPoint,iPoint);
diff --git a/Common/src/fem_geometry_structure.cpp b/Common/src/fem_geometry_structure.cpp
index c4cdfa7494c4..b7650f70947c 100644
--- a/Common/src/fem_geometry_structure.cpp
+++ b/Common/src/fem_geometry_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)
@@ -5761,7 +5761,7 @@ void CMeshFEM_DG::MetricTermsVolumeElements(CConfig *config) {
/* Loop over the different standard elements. */
for(unsigned long i=0; iGetRotation_Rate(1)/Omega_Ref,
config->GetRotation_Rate(2)/Omega_Ref};
- /* Array used to store the distance to the rotation center. */
+ /* Array used to store the distance to the rotation center. */
su2double dist[] = {0.0, 0.0, 0.0};
/* Loop over the owned volume elements. */
@@ -6865,15 +6865,15 @@ void CMeshFEM_DG::InitStaticMeshMovement(CConfig *config,
default: /* Just to avoid a compiler warning. */
break;
}
-
+
if (config->GetSurface_Movement(MOVING_WALL)){
/*--- Loop over the physical boundaries. Skip the periodic boundaries. ---*/
for(unsigned short i=0; iGetMarker_All_Moving(i) == YES) {
-
+
/* Determine the prescribed translation velocity, rotation rate
and rotation center. */
const su2double Center[] = {config->GetMotion_Origin(0),
@@ -6885,31 +6885,31 @@ void CMeshFEM_DG::InitStaticMeshMovement(CConfig *config,
const su2double vTrans[] = {config->GetTranslation_Rate(0)/Vel_Ref,
config->GetTranslation_Rate(1)/Vel_Ref,
config->GetTranslation_Rate(2)/Vel_Ref};
-
+
/* Easier storage of the surface elements and loop over them. */
vector &surfElem = boundaries[i].surfElem;
-
+
for(unsigned long l=0; lGetnZone();
-
+
nVolElemOwned = 0;
nVolElemTot = 0;
-
+
nElem_Bound = NULL;
Tag_to_Marker = NULL;
elem = NULL;
face = NULL;
bound = NULL;
node = NULL;
- edge = NULL;
+ edges = NULL;
vertex = NULL;
nVertex = NULL;
newBound = NULL;
@@ -6964,12 +6964,12 @@ CDummyMeshFEM_DG::CDummyMeshFEM_DG(CConfig *config): CMeshFEM_DG() {
Zcoord_plane.clear();
FaceArea_plane.clear();
Plane_points.clear();
-
+
/*--- Arrays for defining the linear partitioning ---*/
-
+
beg_node = NULL;
end_node = NULL;
-
+
nPointLinear = NULL;
nPointCumulative = NULL;
@@ -6979,82 +6979,82 @@ CDummyMeshFEM_DG::CDummyMeshFEM_DG(CConfig *config): CMeshFEM_DG() {
CustomBoundaryTemperature = NULL; //Customized temperature wall
/*--- MPI point-to-point data structures ---*/
-
+
nP2PSend = 0;
nP2PRecv = 0;
-
+
countPerPoint = 0;
-
+
bufD_P2PSend = NULL;
bufD_P2PRecv = NULL;
-
+
bufS_P2PSend = NULL;
bufS_P2PRecv = NULL;
-
+
req_P2PSend = NULL;
req_P2PRecv = NULL;
-
+
nPoint_P2PSend = new int[size];
nPoint_P2PRecv = new int[size];
-
+
Neighbors_P2PSend = NULL;
Neighbors_P2PRecv = NULL;
-
+
Local_Point_P2PSend = NULL;
Local_Point_P2PRecv = NULL;
/*--- MPI periodic data structures ---*/
-
+
nPeriodicSend = 0;
nPeriodicRecv = 0;
-
+
countPerPeriodicPoint = 0;
-
+
bufD_PeriodicSend = NULL;
bufD_PeriodicRecv = NULL;
-
+
bufS_PeriodicSend = NULL;
bufS_PeriodicRecv = NULL;
-
+
req_PeriodicSend = NULL;
req_PeriodicRecv = NULL;
-
+
nPoint_PeriodicSend = NULL;
nPoint_PeriodicRecv = NULL;
-
+
Neighbors_PeriodicSend = NULL;
Neighbors_PeriodicRecv = NULL;
-
+
Local_Point_PeriodicSend = NULL;
Local_Point_PeriodicRecv = NULL;
-
+
Local_Marker_PeriodicSend = NULL;
Local_Marker_PeriodicRecv = NULL;
-
+
nVertex = new unsigned long[config->GetnMarker_All()];
-
+
for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++){
nVertex[iMarker] = 0;
}
-
+
Tag_to_Marker = new string[config->GetnMarker_All()];
-
+
this->nDim = nDim;
-
-
+
+
for (unsigned short iRank = 0; iRank < size; iRank++){
nPoint_P2PRecv[iRank] = 0;
nPoint_P2PSend[iRank] = 0;
}
-
+
for (unsigned short i=0; i <= config->GetnLevels_TimeAccurateLTS(); i++){
nMatchingFacesWithHaloElem.push_back(0);
- }
-
+ }
+
boundaries.resize(config->GetnMarker_All());
-
+
nDim = CConfig::GetnDim(config->GetMesh_FileName(), config->GetMesh_FileFormat());
-
+
}
CDummyMeshFEM_DG::~CDummyMeshFEM_DG(){}
diff --git a/Common/src/geometry/CDummyGeometry.cpp b/Common/src/geometry/CDummyGeometry.cpp
index b42fc818fb21..f8b657018b92 100644
--- a/Common/src/geometry/CDummyGeometry.cpp
+++ b/Common/src/geometry/CDummyGeometry.cpp
@@ -47,7 +47,7 @@ CDummyGeometry::CDummyGeometry(CConfig *config){
face = NULL;
bound = NULL;
node = NULL;
- edge = NULL;
+ edges = NULL;
vertex = NULL;
nVertex = NULL;
newBound = NULL;
diff --git a/Common/src/geometry/CGeometry.cpp b/Common/src/geometry/CGeometry.cpp
index 4b4441e01b35..06d1c2cb0264 100644
--- a/Common/src/geometry/CGeometry.cpp
+++ b/Common/src/geometry/CGeometry.cpp
@@ -66,7 +66,7 @@ CGeometry::CGeometry(void) {
face = NULL;
bound = NULL;
node = NULL;
- edge = NULL;
+ edges = NULL;
vertex = NULL;
nVertex = NULL;
newBound = NULL;
@@ -143,7 +143,7 @@ CGeometry::CGeometry(void) {
CGeometry::~CGeometry(void) {
- unsigned long iElem, iElem_Bound, iEdge, iFace, iPoint, iVertex;
+ unsigned long iElem, iElem_Bound, iFace, iPoint, iVertex;
unsigned short iMarker;
if (elem != NULL) {
@@ -174,12 +174,7 @@ CGeometry::~CGeometry(void) {
delete[] node;
}
-
- if (edge != NULL) {
- for (iEdge = 0; iEdge < nEdge; iEdge ++)
- if (edge[iEdge] != NULL) delete edge[iEdge];
- delete[] edge;
- }
+ delete edges;
if (vertex != NULL) {
for (iMarker = 0; iMarker < nMarker; iMarker++) {
@@ -1553,35 +1548,36 @@ bool CGeometry::CheckEdge(unsigned long first_point, unsigned long second_point)
}
void CGeometry::SetEdges(void) {
- unsigned long iPoint, jPoint;
- long iEdge;
- unsigned short jNode, iNode;
- long TestEdge = 0;
nEdge = 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++)
+ 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) {
- TestEdge = node[jPoint]->GetEdge(jNode);
+ auto TestEdge = node[jPoint]->GetEdge(jNode);
+ if (TestEdge == -1) {
+ node[iPoint]->SetEdge(nEdge, iNode);
+ node[jPoint]->SetEdge(nEdge, jNode);
+ nEdge++;
+ }
break;
}
- if (TestEdge == -1) {
- node[iPoint]->SetEdge(nEdge, iNode);
- node[jPoint]->SetEdge(nEdge, jNode);
- nEdge++;
}
}
+ }
- edge = new CEdge*[nEdge];
+ edges = new CEdge(nEdge,nDim);
- for (iPoint = 0; iPoint < nPoint; iPoint++)
- for (iNode = 0; iNode < node[iPoint]->GetnPoint(); iNode++) {
- jPoint = node[iPoint]->GetPoint(iNode);
- iEdge = FindEdge(iPoint, jPoint);
- if (iPoint < jPoint) edge[iEdge] = new CEdge(iPoint, jPoint, nDim);
+ for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) {
+ for (auto iNode = 0u; iNode < node[iPoint]->GetnPoint(); iNode++) {
+ auto jPoint = node[iPoint]->GetPoint(iNode);
+ if (iPoint < jPoint) {
+ auto iEdge = FindEdge(iPoint, jPoint);
+ edges->SetNodes(iEdge, iPoint, jPoint);
+ }
}
+ }
}
void CGeometry::SetFaces(void) {
@@ -1625,8 +1621,8 @@ void CGeometry::TestGeometry(void) {
for (unsigned long iEdge = 0; iEdge < nEdge; iEdge++) {
para_file << "Edge index: " << iEdge << endl;
- para_file << " Point index: " << edge[iEdge]->GetNode(0) << "\t" << edge[iEdge]->GetNode(1) << endl;
- edge[iEdge]->GetNormal(Normal);
+ para_file << " Point index: " << edges->GetNode(iEdge,0) << "\t" << edges->GetNode(iEdge,1) << endl;
+ edges->GetNormal(iEdge,Normal);
para_file << " Face normal : ";
for (unsigned short iDim = 0; iDim < nDim; iDim++)
para_file << Normal[iDim] << "\t";
@@ -4027,8 +4023,8 @@ const CCompressedSparsePatternUL& CGeometry::GetEdgeColoring(su2double* efficien
for (unsigned long iEdge = 0; iEdge < nEdge; ++iEdge) {
outerPtr(iEdge) = 2*iEdge;
- innerIdx(iEdge*2+0) = edge[iEdge]->GetNode(0);
- innerIdx(iEdge*2+1) = edge[iEdge]->GetNode(1);
+ innerIdx(iEdge*2+0) = edges->GetNode(iEdge,0);
+ innerIdx(iEdge*2+1) = edges->GetNode(iEdge,1);
}
outerPtr(nEdge) = 2*nEdge;
diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp
index 5f5336594e47..db05047f27b8 100644
--- a/Common/src/geometry/CMultiGridGeometry.cpp
+++ b/Common/src/geometry/CMultiGridGeometry.cpp
@@ -1103,8 +1103,7 @@ void CMultiGridGeometry::SetControlVolume(CConfig *config, CGeometry *fine_grid,
long FineEdge, CoarseEdge;
unsigned short iChildren, iNode, iDim;
bool change_face_orientation;
- su2double *Normal, Coarse_Volume, Area, *NormalFace = NULL;
- Normal = new su2double [nDim];
+ su2double Coarse_Volume, Area;
/*--- Compute the area of the coarse volume ---*/
for (iCoarsePoint = 0; iCoarsePoint < nPoint; iCoarsePoint ++) {
@@ -1119,8 +1118,7 @@ void CMultiGridGeometry::SetControlVolume(CConfig *config, CGeometry *fine_grid,
/*--- Update or not the values of faces at the edge ---*/
if (action != ALLOCATE) {
- for (iEdge=0; iEdge < nEdge; iEdge++)
- edge[iEdge]->SetZeroValues();
+ edges->SetZeroValues();
}
for (iCoarsePoint = 0; iCoarsePoint < nPoint; iCoarsePoint ++)
@@ -1139,27 +1137,28 @@ void CMultiGridGeometry::SetControlVolume(CConfig *config, CGeometry *fine_grid,
CoarseEdge = FindEdge(iParent, iCoarsePoint);
- fine_grid->edge[FineEdge]->GetNormal(Normal);
+ const auto Normal = fine_grid->edges->GetNormal(FineEdge);
if (change_face_orientation) {
- for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim];
- edge[CoarseEdge]->AddNormal(Normal);
+ edges->SubNormal(CoarseEdge,Normal);
}
else {
- edge[CoarseEdge]->AddNormal(Normal);
+ edges->AddNormal(CoarseEdge,Normal);
}
}
}
}
- delete[] Normal;
/*--- Check if there is a normal with null area ---*/
for (iEdge = 0; iEdge < nEdge; iEdge++) {
- NormalFace = edge[iEdge]->GetNormal();
+ 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 (iDim = 0; iDim < nDim; iDim++) NormalFace[iDim] = EPS*EPS;
+ if (Area == 0.0) {
+ su2double DefaultNormal[3] = {EPS*EPS};
+ edges->SetNormal(iEdge, DefaultNormal);
+ }
}
}
diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp
index 2219e8f0f73f..3c423dfbe514 100644
--- a/Common/src/geometry/CPhysicalGeometry.cpp
+++ b/Common/src/geometry/CPhysicalGeometry.cpp
@@ -7206,80 +7206,57 @@ void CPhysicalGeometry::GatherInOutAverageValues(CConfig *config, bool allocate)
void CPhysicalGeometry::SetCoord_CG(void) {
- unsigned short nNode, iDim, iMarker, iNode;
+ unsigned short iMarker, iNode;
unsigned long elem_poin, edge_poin, iElem, iEdge;
- su2double **Coord;
+
+ /*--- Buffer of pointers to node coordinates ---*/
+ array Coord;
/*--- Compute the center of gravity for elements ---*/
for (iElem = 0; iElemGetnNodes();
- Coord = new su2double* [nNode];
+ assert(elem[iElem]->GetnNodes() <= N_POINTS_MAXIMUM && "Insufficient N_POINTS_MAXIMUM");
/*--- Store the coordinates for all the element nodes ---*/
-
- for (iNode = 0; iNode < nNode; iNode++) {
+ for (iNode = 0; iNode < elem[iElem]->GetnNodes(); iNode++) {
elem_poin = elem[iElem]->GetNode(iNode);
- Coord[iNode] = new su2double [nDim];
- for (iDim = 0; iDim < nDim; iDim++)
- Coord[iNode][iDim]=node[elem_poin]->GetCoord(iDim);
+ Coord[iNode] = node[elem_poin]->GetCoord();
}
/*--- Compute the element CG coordinates ---*/
-
- elem[iElem]->SetCoord_CG(Coord);
-
- for (iNode = 0; iNode < nNode; iNode++)
- if (Coord[iNode] != NULL) delete[] Coord[iNode];
- if (Coord != NULL) delete[] Coord;
+ elem[iElem]->SetCoord_CG(Coord.data());
}
/*--- Center of gravity for face elements ---*/
- for (iMarker = 0; iMarker < nMarker; iMarker++)
+ for (iMarker = 0; iMarker < nMarker; iMarker++) {
for (iElem = 0; iElem < nElem_Bound[iMarker]; iElem++) {
- nNode = bound[iMarker][iElem]->GetnNodes();
- Coord = new su2double* [nNode];
/*--- Store the coordinates for all the element nodes ---*/
-
- for (iNode = 0; iNode < nNode; iNode++) {
+ for (iNode = 0; iNode < bound[iMarker][iElem]->GetnNodes(); iNode++) {
elem_poin = bound[iMarker][iElem]->GetNode(iNode);
- Coord[iNode] = new su2double [nDim];
- for (iDim = 0; iDim < nDim; iDim++)
- Coord[iNode][iDim]=node[elem_poin]->GetCoord(iDim);
+ Coord[iNode] = node[elem_poin]->GetCoord();
}
- /*--- Compute the element CG coordinates ---*/
- bound[iMarker][iElem]->SetCoord_CG(Coord);
- for (iNode = 0; iNode < nNode; iNode++)
- if (Coord[iNode] != NULL) delete[] Coord[iNode];
- if (Coord != NULL) delete[] Coord;
+ /*--- Compute the element CG coordinates ---*/
+ bound[iMarker][iElem]->SetCoord_CG(Coord.data());
}
+ }
/*--- Center of gravity for edges ---*/
for (iEdge = 0; iEdge < nEdge; iEdge++) {
- nNode = edge[iEdge]->GetnNodes();
- Coord = new su2double* [nNode];
/*--- Store the coordinates for all the element nodes ---*/
-
- for (iNode = 0; iNode < nNode; iNode++) {
- edge_poin=edge[iEdge]->GetNode(iNode);
- Coord[iNode] = new su2double [nDim];
- for (iDim = 0; iDim < nDim; iDim++)
- Coord[iNode][iDim]=node[edge_poin]->GetCoord(iDim);
+ for (iNode = 0; iNode < edges->GetnNodes(); iNode++) {
+ edge_poin=edges->GetNode(iEdge,iNode);
+ Coord[iNode] = node[edge_poin]->GetCoord();
}
/*--- Compute the edge CG coordinates ---*/
-
- edge[iEdge]->SetCoord_CG(Coord);
-
- for (iNode = 0; iNode < nNode; iNode++)
- if (Coord[iNode] != NULL) delete[] Coord[iNode];
- if (Coord != NULL) delete[] Coord;
+ edges->SetCoord_CG(iEdge, Coord.data());
}
+
}
void CPhysicalGeometry::SetBoundControlVolume(CConfig *config, unsigned short action) {
@@ -7323,7 +7300,7 @@ void CPhysicalGeometry::SetBoundControlVolume(CConfig *config, unsigned short ac
iEdge = FindEdge(iPoint, Neighbor_Point);
for (iDim = 0; iDim < nDim; iDim++) {
- Coord_Edge_CG[iDim] = edge[iEdge]->GetCG(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);
}
@@ -8193,13 +8170,12 @@ void CPhysicalGeometry::SetControlVolume(CConfig *config, unsigned short action)
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, *NormalFace = NULL;
+ Volume, DomainVolume, my_DomainVolume;
bool change_face_orientation;
/*--- Update values of faces of the edge ---*/
if (action != ALLOCATE) {
- for (iEdge = 0; iEdge < (long)nEdge; iEdge++)
- edge[iEdge]->SetZeroValues();
+ edges->SetZeroValues();
for (iPoint = 0; iPoint < nPoint; iPoint++)
node[iPoint]->SetVolume (0.0);
}
@@ -8211,7 +8187,7 @@ void CPhysicalGeometry::SetControlVolume(CConfig *config, unsigned short action)
Coord_FacejPoint = new su2double [nDim];
my_DomainVolume = 0.0;
- for (iElem = 0; iElem < nElem; iElem++)
+ for (iElem = 0; iElem < nElem; iElem++) {
for (iFace = 0; iFace < elem[iElem]->GetnFaces(); iFace++) {
/*--- In 2D all the faces have only one edge ---*/
@@ -8243,7 +8219,7 @@ void CPhysicalGeometry::SetControlVolume(CConfig *config, unsigned short action)
iEdge = FindEdge(face_iPoint, face_jPoint);
for (iDim = 0; iDim < nDim; iDim++) {
- Coord_Edge_CG[iDim] = edge[iEdge]->GetCG(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);
@@ -8253,40 +8229,39 @@ void CPhysicalGeometry::SetControlVolume(CConfig *config, unsigned short action)
switch (nDim) {
case 2:
/*--- Two dimensional problem ---*/
- if (change_face_orientation) edge[iEdge]->SetNodes_Coord(Coord_Elem_CG, Coord_Edge_CG);
- else edge[iEdge]->SetNodes_Coord(Coord_Edge_CG, Coord_Elem_CG);
- Area = edge[iEdge]->GetVolume(Coord_FaceiPoint, Coord_Edge_CG, Coord_Elem_CG);
+ 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 = edge[iEdge]->GetVolume(Coord_FacejPoint, Coord_Edge_CG, Coord_Elem_CG);
+ 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) edge[iEdge]->SetNodes_Coord(Coord_FaceElem_CG, Coord_Edge_CG, Coord_Elem_CG);
- else edge[iEdge]->SetNodes_Coord(Coord_Edge_CG, Coord_FaceElem_CG, Coord_Elem_CG);
- Volume = edge[iEdge]->GetVolume(Coord_FaceiPoint, Coord_Edge_CG, Coord_FaceElem_CG, Coord_Elem_CG);
+ 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 = edge[iEdge]->GetVolume(Coord_FacejPoint, Coord_Edge_CG, Coord_FaceElem_CG, Coord_Elem_CG);
+ Volume = CEdge::GetVolume(Coord_FacejPoint, Coord_Edge_CG, Coord_FaceElem_CG, Coord_Elem_CG);
node[face_jPoint]->AddVolume(Volume); my_DomainVolume +=Volume;
break;
}
}
}
+ }
/*--- Check if there is a normal with null area ---*/
for (iEdge = 0; iEdge < (long)nEdge; iEdge++) {
- NormalFace = edge[iEdge]->GetNormal();
+ 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 (iDim = 0; iDim < nDim; iDim++) NormalFace[iDim] = EPS*EPS;
+ if (Area == 0.0) {
+ su2double DefaultArea[3] = {EPS*EPS};
+ edges->SetNormal(iEdge, DefaultArea);
+ }
}
-
-#ifdef HAVE_MPI
SU2_MPI::Allreduce(&my_DomainVolume, &DomainVolume, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
-#else
- DomainVolume = my_DomainVolume;
-#endif
if ((rank == MASTER_NODE) && (action == ALLOCATE)) {
if (nDim == 2) cout <<"Area of the computational grid: "<< DomainVolume <<"."<< endl;
@@ -8366,7 +8341,7 @@ void CPhysicalGeometry::VisualizeControlVolume(CConfig *config, unsigned short a
iEdge = FindEdge(face_iPoint, face_jPoint);
for (iDim = 0; iDim < nDim; iDim++) {
- Coord_Edge_CG[iDim] = edge[iEdge]->GetCG(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);
@@ -8569,10 +8544,10 @@ void CPhysicalGeometry::SetCoord_Smoothing (unsigned short val_nSmooth, su2doubl
/*--- Loop over Interior edges ---*/
for (iEdge = 0; iEdge < nEdge; iEdge++) {
- iPoint = edge[iEdge]->GetNode(0);
+ iPoint = edges->GetNode(iEdge,0);
Coord_i = node[iPoint]->GetCoord();
- jPoint = edge[iEdge]->GetNode(1);
+ jPoint = edges->GetNode(iEdge,1);
Coord_j = node[jPoint]->GetCoord();
/*--- Accumulate nearest neighbor Coord to Res_sum for each variable ---*/
@@ -9018,8 +8993,8 @@ void CPhysicalGeometry::ComputeMeshQualityStatistics(CConfig *config) {
/*--- Point identification, edge normal vector and area ---*/
- const unsigned long iPoint = edge[iEdge]->GetNode(0);
- const unsigned long jPoint = edge[iEdge]->GetNode(1);
+ 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();
@@ -9028,7 +9003,7 @@ void CPhysicalGeometry::ComputeMeshQualityStatistics(CConfig *config) {
is computed by summing the normals of adjacent faces along
the edge between iPoint & jPoint. ---*/
- const su2double *Normal = edge[iEdge]->GetNormal();
+ const su2double *Normal = edges->GetNormal(iEdge);
/*--- Get the coordinates for point i & j. ---*/
@@ -9195,7 +9170,7 @@ void CPhysicalGeometry::ComputeMeshQualityStatistics(CConfig *config) {
/*--- Collect the CG and coordinates for this sub-element face. ---*/
for (unsigned short iDim = 0; iDim < nDim; iDim++) {
- Coord_Edge_CG[iDim] = edge[iEdge]->GetCG(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);
@@ -9207,28 +9182,24 @@ void CPhysicalGeometry::ComputeMeshQualityStatistics(CConfig *config) {
su2double Volume_i, Volume_j;
switch (nDim) {
case 2:
+ Volume_i = CEdge::GetVolume(Coord_FaceiPoint.data(),
+ Coord_Edge_CG.data(),
+ Coord_Elem_CG.data());
- Volume_i = edge[iEdge]->GetVolume(Coord_FaceiPoint.data(),
- Coord_Edge_CG.data(),
- Coord_Elem_CG.data());
-
- Volume_j = edge[iEdge]->GetVolume(Coord_FacejPoint.data(),
- Coord_Edge_CG.data(),
- Coord_Elem_CG.data());
-
+ Volume_j = CEdge::GetVolume(Coord_FacejPoint.data(),
+ Coord_Edge_CG.data(),
+ Coord_Elem_CG.data());
break;
case 3:
-
- Volume_i = edge[iEdge]->GetVolume(Coord_FaceiPoint.data(),
- Coord_Edge_CG.data(),
- Coord_FaceElem_CG.data(),
- Coord_Elem_CG.data());
-
- Volume_j = edge[iEdge]->GetVolume(Coord_FacejPoint.data(),
- Coord_Edge_CG.data(),
- Coord_FaceElem_CG.data(),
- Coord_Elem_CG.data());
-
+ Volume_i = CEdge::GetVolume(Coord_FaceiPoint.data(),
+ Coord_Edge_CG.data(),
+ Coord_FaceElem_CG.data(),
+ Coord_Elem_CG.data());
+
+ Volume_j = CEdge::GetVolume(Coord_FacejPoint.data(),
+ Coord_Edge_CG.data(),
+ Coord_FaceElem_CG.data(),
+ Coord_Elem_CG.data());
break;
}
diff --git a/Common/src/geometry/dual_grid/CEdge.cpp b/Common/src/geometry/dual_grid/CEdge.cpp
index 8ba4a330433c..c61167768e01 100644
--- a/Common/src/geometry/dual_grid/CEdge.cpp
+++ b/Common/src/geometry/dual_grid/CEdge.cpp
@@ -1,6 +1,6 @@
/*!
* \file CEdge.cpp
- * \brief Main classes for defining the edges of the dual grid
+ * \brief Implementation of the edge class.
* \author F. Palacios, T. Economon
* \version 7.0.4 "Blackbird"
*
@@ -26,150 +26,116 @@
*/
#include "../../../include/geometry/dual_grid/CEdge.hpp"
+#include "../../../include/toolboxes/geometry_toolbox.hpp"
-CEdge::CEdge(unsigned long val_iPoint, unsigned long val_jPoint, unsigned short val_nDim) : CDualGrid(val_nDim) {
+using namespace GeometryToolbox;
- unsigned short iDim;
-
- /*--- Pointers initialization ---*/
- Coord_CG = NULL;
- Normal = NULL;
- Nodes = NULL;
-
- /*--- Allocate center of gravity coordinates, nodes, and face normal ---*/
- Coord_CG = new su2double [nDim];
- Normal = new su2double [nDim];
- Nodes = new unsigned long[2];
-
- /*--- Initializate the structure ---*/
- for (iDim = 0; iDim < nDim; iDim++) {
- Coord_CG[iDim] = 0.0;
- Normal[iDim] = 0.0;
- }
-
- Nodes[0] = val_iPoint;
- Nodes[1] = val_jPoint;
+CEdge::CEdge(unsigned long nEdge, unsigned long nDim) :
+ Nodes(nEdge,2), Normal(nEdge,nDim), Coord_CG(nEdge,nDim) {
+ Normal = su2double(0.0);
+ Coord_CG = su2double(0.0);
}
-CEdge::~CEdge() {
-
- if (Coord_CG != NULL) delete[] Coord_CG;
- if (Normal != NULL) delete[] Normal;
- if (Nodes != NULL) delete[] Nodes;
-
+void CEdge::SetZeroValues(void) {
+ Normal = su2double(0.0);
}
-void CEdge::SetCoord_CG(su2double **val_coord) {
+su2double CEdge::GetVolume(const su2double *coord_Edge_CG,
+ const su2double *coord_FaceElem_CG,
+ const su2double *coord_Elem_CG,
+ const su2double *coord_Point) {
- unsigned short iDim, iNode;
+ constexpr unsigned long nDim = 3;
- for (iDim = 0; iDim < nDim; iDim++) {
- Coord_CG[iDim] = 0.0;
- for (iNode = 0; iNode < 2; iNode++)
- Coord_CG[iDim] += val_coord[iNode][iDim] / 2.0;
- }
-
-}
-
-su2double CEdge::GetVolume(su2double *val_coord_Edge_CG, su2double *val_coord_FaceElem_CG, su2double *val_coord_Elem_CG, su2double *val_coord_Point) const {
-
- unsigned short iDim;
- su2double vec_a[3] = {0.0,0.0,0.0}, vec_b[3] = {0.0,0.0,0.0}, vec_c[3] = {0.0,0.0,0.0}, vec_d[3] = {0.0,0.0,0.0}, Local_Volume;
+ su2double vec_a[nDim] = {0.0}, vec_b[nDim] = {0.0}, vec_c[nDim] = {0.0}, vec_d[nDim] = {0.0};
AD::StartPreacc();
- AD::SetPreaccIn(val_coord_Edge_CG, nDim);
- AD::SetPreaccIn(val_coord_Elem_CG, nDim);
- AD::SetPreaccIn(val_coord_FaceElem_CG, nDim);
- AD::SetPreaccIn(val_coord_Point, nDim);
+ AD::SetPreaccIn(coord_Edge_CG, nDim);
+ AD::SetPreaccIn(coord_Elem_CG, nDim);
+ AD::SetPreaccIn(coord_FaceElem_CG, nDim);
+ AD::SetPreaccIn(coord_Point, nDim);
- for (iDim = 0; iDim < nDim; iDim++) {
- vec_a[iDim] = val_coord_Edge_CG[iDim] - val_coord_Point[iDim];
- vec_b[iDim] = val_coord_FaceElem_CG[iDim] - val_coord_Point[iDim];
- vec_c[iDim] = val_coord_Elem_CG[iDim] - val_coord_Point[iDim];
- }
+ Distance(nDim, coord_Edge_CG, coord_Point, vec_a);
+ Distance(nDim, coord_FaceElem_CG, coord_Point, vec_b);
+ Distance(nDim, coord_Elem_CG, coord_Point, vec_c);
- vec_d[0] = vec_a[1] * vec_b[2] - vec_a[2] * vec_b[1];
- vec_d[1] = -(vec_a[0] * vec_b[2] - vec_a[2] * vec_b[0]);
- vec_d[2] = vec_a[0] * vec_b[1] - vec_a[1] * vec_b[0];
+ CrossProduct(vec_a, vec_b, vec_d);
- Local_Volume = fabs( vec_c[0] * vec_d[0] + vec_c[1] * vec_d[1] + vec_c[2] * vec_d[2] ) / 6.0;
+ su2double Local_Volume = fabs(DotProduct(nDim, vec_c, vec_d)) / 6.0;
AD::SetPreaccOut(Local_Volume);
AD::EndPreacc();
return Local_Volume;
-
}
-su2double CEdge::GetVolume(su2double *val_coord_Edge_CG, su2double *val_coord_Elem_CG, su2double *val_coord_Point) const {
+su2double CEdge::GetVolume(const su2double *coord_Edge_CG,
+ const su2double *coord_Elem_CG,
+ const su2double *coord_Point) {
+
+ constexpr unsigned long nDim = 2;
- unsigned short iDim;
- su2double vec_a[2] = {0.0,0.0}, vec_b[2] = {0.0,0.0}, Local_Volume;
+ su2double vec_a[nDim] = {0.0}, vec_b[nDim] = {0.0};
AD::StartPreacc();
- AD::SetPreaccIn(val_coord_Edge_CG, nDim);
- AD::SetPreaccIn(val_coord_Elem_CG, nDim);
- AD::SetPreaccIn(val_coord_Point, nDim);
+ AD::SetPreaccIn(coord_Edge_CG, nDim);
+ AD::SetPreaccIn(coord_Elem_CG, nDim);
+ AD::SetPreaccIn(coord_Point, nDim);
- for (iDim = 0; iDim < nDim; iDim++) {
- vec_a[iDim] = val_coord_Elem_CG[iDim] - val_coord_Point[iDim];
- vec_b[iDim] = val_coord_Edge_CG[iDim] - val_coord_Point[iDim];
- }
+ Distance(nDim, coord_Elem_CG, coord_Point, vec_a);
+ Distance(nDim, coord_Edge_CG, coord_Point, vec_b);
- Local_Volume = 0.5 * fabs( vec_a[0] * vec_b[1] - vec_a[1] * vec_b[0] );
+ su2double Local_Volume = 0.5 * fabs(vec_a[0]*vec_b[1] - vec_a[1]*vec_b[0]);
AD::SetPreaccOut(Local_Volume);
AD::EndPreacc();
return Local_Volume;
-
}
-void CEdge::SetNodes_Coord(su2double *val_coord_Edge_CG, su2double *val_coord_FaceElem_CG, su2double *val_coord_Elem_CG) {
+void CEdge::SetNodes_Coord(unsigned long iEdge,
+ const su2double *coord_Edge_CG,
+ const su2double *coord_FaceElem_CG,
+ const su2double *coord_Elem_CG) {
+
+ constexpr unsigned long nDim = 3;
- unsigned short iDim;
- su2double vec_a[3] = {0.0,0.0,0.0}, vec_b[3] = {0.0,0.0,0.0}, Dim_Normal[3];
+ su2double vec_a[nDim] = {0.0}, vec_b[nDim] = {0.0}, Dim_Normal[nDim];
AD::StartPreacc();
- AD::SetPreaccIn(val_coord_Edge_CG, nDim);
- AD::SetPreaccIn(val_coord_Elem_CG, nDim);
- AD::SetPreaccIn(val_coord_FaceElem_CG, nDim);
- AD::SetPreaccIn(Normal, nDim);
+ AD::SetPreaccIn(coord_Edge_CG, nDim);
+ AD::SetPreaccIn(coord_Elem_CG, nDim);
+ AD::SetPreaccIn(coord_FaceElem_CG, nDim);
+ AD::SetPreaccIn(Normal[iEdge], nDim);
- for (iDim = 0; iDim < nDim; iDim++) {
- vec_a[iDim] = val_coord_Elem_CG[iDim]-val_coord_Edge_CG[iDim];
- vec_b[iDim] = val_coord_FaceElem_CG[iDim]-val_coord_Edge_CG[iDim];
- }
+ Distance(nDim, coord_Elem_CG, coord_Edge_CG, vec_a);
+ Distance(nDim, coord_FaceElem_CG, coord_Edge_CG, vec_b);
- Dim_Normal[0] = 0.5 * ( vec_a[1] * vec_b[2] - vec_a[2] * vec_b[1] );
- Dim_Normal[1] = -0.5 * ( vec_a[0] * vec_b[2] - vec_a[2] * vec_b[0] );
- Dim_Normal[2] = 0.5 * ( vec_a[0] * vec_b[1] - vec_a[1] * vec_b[0] );
+ CrossProduct(vec_a, vec_b, Dim_Normal);
- Normal[0] += Dim_Normal[0];
- Normal[1] += Dim_Normal[1];
- Normal[2] += Dim_Normal[2];
+ for (auto iDim = 0ul; iDim < nDim; ++iDim)
+ Normal(iEdge,iDim) += 0.5 * Dim_Normal[iDim];
- AD::SetPreaccOut(Normal, nDim);
+ AD::SetPreaccOut(Normal[iEdge], nDim);
AD::EndPreacc();
}
-void CEdge::SetNodes_Coord(su2double *val_coord_Edge_CG, su2double *val_coord_Elem_CG) {
+void CEdge::SetNodes_Coord(unsigned long iEdge,
+ const su2double *coord_Edge_CG,
+ const su2double *coord_Elem_CG) {
- su2double Dim_Normal[2];
+ constexpr unsigned long nDim = 2;
AD::StartPreacc();
- AD::SetPreaccIn(val_coord_Elem_CG, nDim);
- AD::SetPreaccIn(val_coord_Edge_CG, nDim);
- AD::SetPreaccIn(Normal, nDim);
-
- Dim_Normal[0] = val_coord_Elem_CG[1] - val_coord_Edge_CG[1];
- Dim_Normal[1] = -(val_coord_Elem_CG[0] - val_coord_Edge_CG[0]);
+ AD::SetPreaccIn(coord_Elem_CG, nDim);
+ AD::SetPreaccIn(coord_Edge_CG, nDim);
+ AD::SetPreaccIn(Normal[iEdge], nDim);
- Normal[0] += Dim_Normal[0];
- Normal[1] += Dim_Normal[1];
+ Normal(iEdge,0) += coord_Elem_CG[1] - coord_Edge_CG[1];
+ Normal(iEdge,1) -= coord_Elem_CG[0] - coord_Edge_CG[0];
- AD::SetPreaccOut(Normal, nDim);
+ AD::SetPreaccOut(Normal[iEdge], nDim);
AD::EndPreacc();
}
diff --git a/Common/src/geometry/primal_grid/CPrimalGrid.cpp b/Common/src/geometry/primal_grid/CPrimalGrid.cpp
index 80453b4fa49a..9e0e162b6cfe 100644
--- a/Common/src/geometry/primal_grid/CPrimalGrid.cpp
+++ b/Common/src/geometry/primal_grid/CPrimalGrid.cpp
@@ -53,7 +53,7 @@ CPrimalGrid::~CPrimalGrid() {
if (JacobianFaceIsConstant != NULL) delete[] JacobianFaceIsConstant;
}
-void CPrimalGrid::SetCoord_CG(su2double **val_coord) {
+void CPrimalGrid::SetCoord_CG(const su2double* const* val_coord) {
unsigned short iDim, iNode, NodeFace, iFace;
AD::StartPreacc();
diff --git a/Common/src/grid_adaptation_structure.cpp b/Common/src/grid_adaptation_structure.cpp
index 4cd95b027789..dd936eda15f5 100644
--- a/Common/src/grid_adaptation_structure.cpp
+++ b/Common/src/grid_adaptation_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)
@@ -41,23 +41,23 @@ CGridAdaptation::CGridAdaptation(CGeometry *geometry, CConfig *config) {
size = SU2_MPI::GetSize();
rank = SU2_MPI::GetRank();
-
+
unsigned long iPoint;
-
+
nDim = geometry->GetnDim();
-
- switch (config->GetKind_Solver()) {
-
+
+ switch (config->GetKind_Solver()) {
+
default:
nVar = geometry->GetnDim()+2;
- break;
+ 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()];
+ AdjVar_Res = new su2double* [geometry->GetnPoint()];
LinVar_Res = new su2double* [geometry->GetnPoint()];
Gradient = new su2double* [geometry->GetnPoint()];
Gradient_Flow = new su2double* [geometry->GetnPoint()];
@@ -71,48 +71,48 @@ CGridAdaptation::CGridAdaptation(CGeometry *geometry, CConfig *config) {
LinVar_Sol[iPoint] = new su2double [nVar];
ConsVar_Res[iPoint] = new su2double [nVar];
LinVar_Res[iPoint] = new su2double [nVar];
- AdjVar_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];
+ 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_Adapt[iVar];
+ delete [] ConsVar_Sol[iVar];
delete [] ConsVar_Res[iVar];
- delete [] AdjVar_Adapt[iVar];
- delete [] AdjVar_Sol[iVar];
+ delete [] AdjVar_Adapt[iVar];
+ delete [] AdjVar_Sol[iVar];
delete [] AdjVar_Res[iVar];
- delete [] LinVar_Adapt[iVar];
- delete [] LinVar_Sol[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 [] Gradient_Adj[iDim];
}
- delete [] ConsVar_Adapt;
+ delete [] ConsVar_Adapt;
delete [] ConsVar_Sol;
delete [] ConsVar_Res;
- delete [] AdjVar_Adapt;
+ delete [] AdjVar_Adapt;
delete [] AdjVar_Sol;
delete [] AdjVar_Res;
- delete [] LinVar_Adapt;
- delete [] LinVar_Sol;
+ delete [] LinVar_Adapt;
+ delete [] LinVar_Sol;
delete [] LinVar_Res;
delete [] Gradient;
- delete [] Gradient_Flow;
- delete [] Gradient_Adj;
- delete [] Index;
+ delete [] Gradient_Flow;
+ delete [] Gradient_Adj;
+ delete [] Index;
}
void CGridAdaptation::GetFlowSolution(CGeometry *geometry, CConfig *config) {
@@ -121,7 +121,7 @@ void CGridAdaptation::GetFlowSolution(CGeometry *geometry, CConfig *config) {
su2double dummy;
string text_line;
-
+
string mesh_filename = config->GetSolution_FileName();
ifstream restart_file;
@@ -132,19 +132,19 @@ void CGridAdaptation::GetFlowSolution(CGeometry *geometry, CConfig *config) {
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);
-
+
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];
}
@@ -154,14 +154,14 @@ void CGridAdaptation::GetFlowSolution(CGeometry *geometry, CConfig *config) {
void CGridAdaptation::GetFlowResidual(CGeometry *geometry, CConfig *config) {
unsigned long iPoint, index;
unsigned short iVar;
-
+
// su2double dummy[5];
su2double dummy;
string text_line;
-
+
string mesh_filename = config->GetSolution_FileName();
ifstream restart_file;
-
+
char *cstr = new char [mesh_filename.size()+1];
strcpy (cstr, mesh_filename.c_str());
@@ -169,7 +169,7 @@ void CGridAdaptation::GetFlowResidual(CGeometry *geometry, CConfig *config) {
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);
@@ -178,10 +178,10 @@ void CGridAdaptation::GetFlowResidual(CGeometry *geometry, CConfig *config) {
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++)
@@ -196,35 +196,35 @@ void CGridAdaptation::GetAdjSolution(CGeometry *geometry, CConfig *config) {
unsigned short iVar;
su2double dummy;
string text_line;
-
+
string copy, mesh_filename;
ifstream restart_file;
/*--- Get the adjoint solution file name ---*/
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()) {
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);
-
+
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];
}
-
+
restart_file.close();
}
@@ -269,29 +269,29 @@ void CGridAdaptation::GetAdjResidual(CGeometry *geometry, CConfig *config) {
}
strcat(cstr, buffer);
-
+
restart_file.open(cstr, ios::in);
-
+
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);
-
+
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][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][0] >> AdjVar_Res[iPoint][1] >> AdjVar_Res[iPoint][2] >>
AdjVar_Res[iPoint][3] >> AdjVar_Res[iPoint][4];
}
restart_file.close();
@@ -299,16 +299,16 @@ void CGridAdaptation::GetAdjResidual(CGeometry *geometry, CConfig *config) {
void CGridAdaptation::SetComplete_Refinement(CGeometry *geometry, unsigned short strength) {
unsigned long iElem;
-
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
geometry->elem[iElem]->SetDivide (true);
}
}
void CGridAdaptation::SetNo_Refinement(CGeometry *geometry, unsigned short strength) {
unsigned long iElem;
-
- for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
+
+ for (iElem = 0; iElem < geometry->GetnElem(); iElem ++) {
geometry->elem[iElem]->SetDivide (false);
}
}
@@ -317,7 +317,7 @@ void CGridAdaptation::SetWake_Refinement(CGeometry *geometry, unsigned short str
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);
@@ -339,7 +339,7 @@ void CGridAdaptation::SetSupShock_Refinement(CGeometry *geometry, CConfig *confi
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);
@@ -353,134 +353,134 @@ void CGridAdaptation::SetSupShock_Refinement(CGeometry *geometry, CConfig *confi
}
long CGridAdaptation::CheckRectCode(bool *AdaptCode) {
-
+
int Code = -1;
-
+
// Default
-
+
if ((AdaptCode[0] == true) || (AdaptCode[1] == true) || (AdaptCode[2] == true) || (AdaptCode[3] == true)) { Code = 0; }
-
+
// Combination 1:4
-
+
if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == true)) {Code = 1; return Code;}
-
+
// Combination 1:2
-
+
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;}
-
+
return Code;
-
+
}
long CGridAdaptation::CheckRectExtCode(bool *AdaptCode) {
-
+
int Code = -1;
-
+
if ((AdaptCode[0] == true) || (AdaptCode[1] == true) || (AdaptCode[2] == true) || (AdaptCode[3] == true)) {Code = 0;}
-
+
// Combination 1R -> 3T
-
+
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] == 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;}
-
+
// Combination 1R -> 4T
-
+
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] == 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;}
-
+
// Combination 1R -> 1R+3T
-
+
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] == 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;}
-
+
return Code;
-
+
}
long CGridAdaptation::CheckTriangleCode(bool *AdaptCode) {
-
+
int Code = -1;
-
+
if ((AdaptCode[0] == true) || (AdaptCode[1] == true) || (AdaptCode[2] == true)) {Code = 0;}
-
+
// Combination 1T -> 3T
-
+
if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == true)) {Code = 1; return Code;}
-
+
// Combination 1T -> 2T
-
+
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] == false) && (AdaptCode[2] == true)) {Code = 4; return Code;}
-
+
// 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] == false) && (AdaptCode[2] == true)) {Code = 6; return Code;}
-
+
if ((AdaptCode[0] == false) && (AdaptCode[1] == true) && (AdaptCode[2] == true)) {Code = 7; return Code;}
-
+
return Code;
-
+
}
long CGridAdaptation::CheckTetraCode(bool *AdaptCode) {
-
+
int Code = -1;
unsigned short nDivEdges, iVar;
-
+
// Default
-
+
if ((AdaptCode[0] == true) || (AdaptCode[1] == true) || (AdaptCode[2] == true) || (AdaptCode[3] == true) || (AdaptCode[4] == true) ||
(AdaptCode[5] == true) ) { Code = 0; }
-
+
// 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;}
-
+
// 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] == 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] == 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.
-
+
nDivEdges = 0;
for (iVar = 0; iVar < 6; iVar ++)
if (AdaptCode[iVar] == true) nDivEdges++;
-
+
if ((nDivEdges == 1) || (nDivEdges == 2) || (nDivEdges == 3)) {Code = 6; return Code;}
-
+
return Code;
}
@@ -488,481 +488,481 @@ long CGridAdaptation::CheckTetraCode(bool *AdaptCode) {
long CGridAdaptation::CheckHexaCode(bool *AdaptCode) {
int Code = -1;
-
+
// 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; }
-
+
// 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;}
-
+
// 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] == 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;}
-
+
// 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] == 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; }
-
+
return Code;
}
long CGridAdaptation::CheckPyramCode(bool *AdaptCode) {
-
+
int Code = -1;
-
+
if ((AdaptCode[0] == true) || (AdaptCode[1] == true) || (AdaptCode[2] == true) || (AdaptCode[3] == true)) {Code = 0;}
-
+
// Combination 1P -> 1P
-
+
if ((AdaptCode[0] == false) && (AdaptCode[1] == false) && (AdaptCode[2] == false) && (AdaptCode[3] == false)) {Code = 1; return Code;}
-
+
// Combination 1P -> 3T
-
+
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] == 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;}
-
+
// Combination 1P -> 4T
-
+
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] == 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;}
-
+
// Combination 1P -> 2P
-
+
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;}
-
+
// Combination 1P -> 1P+3T
-
+
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] == 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;}
-
-
+
+
// Combination 1P -> 4P
-
+
if ((AdaptCode[0] == true) && (AdaptCode[1] == true) && (AdaptCode[2] == true) && (AdaptCode[3] == true)) {Code = 16; return Code;}
-
+
return Code;
}
void CGridAdaptation::RectDivision(long code , long *nodes, long **Division, long *nPart) {
-
+
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[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];
-
- 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[3][1] = nodes[8]; Division[3][2] = nodes[6]; Division[3][3] = nodes[3]; Division[3][4] = nodes[7];
-
- }
-
+ 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[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];
+
+ }
+
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];
-
- Division[1][1] = nodes[4]; Division[1][2] = nodes[1]; Division[1][3] = nodes[2]; Division[1][4] = nodes[6];
-
- }
-
+ 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];
+
+ }
+
if (code == 3) {
// number of nodes at each new element
- Division[0][0] = 5; Division[1][0] = 5;
+ 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];
-
- Division[1][1] = nodes[5]; Division[1][2] = nodes[2]; Division[1][3] = nodes[3]; Division[1][4] = nodes[7];
-
- }
-
+ 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];
+
+ }
+
}
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;
-
+
// 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[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;
-
+
// 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[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;
-
+
// 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[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;
-
+
// 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[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;
-
+
// 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[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];
-
- }
-
+
+ }
+
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];
-
+
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[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;
-
+
// 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[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];
-
- }
-
+
+ }
+
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];
-
+
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[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;
-
+
// 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[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];
-
- }
-
+
+ }
+
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];
-
+
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[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;
-
+
// 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[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];
-
- }
-
+
+ }
+
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];
-
+
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[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];
-
+
Division[1][1] = nodes[3]; Division[1][2] = nodes[1]; Division[1][3] = nodes[4];
-
+
Division[2][1] = nodes[5]; Division[2][2] = nodes[4]; Division[2][3] = nodes[2];
Division[3][1] = nodes[3]; Division[3][2] = nodes[4]; Division[3][3] = nodes[5];
return;
- }
-
+ }
+
if (code == 2) {
// 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[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];
-
+
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];
-
+
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;
-
+
// 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];
-
+
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];
-
+
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;
-
+
nDiv = 0;
do { new_div = false;
-
+
// 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; }
+ 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;
-
+
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;
}
-
+
if (target_elem != -1) {
for (iNode = 0; iNode < 6; iNode++)
new_triangle[nElem][iNode] = new_triangle[target_elem][iNode];
@@ -973,9 +973,9 @@ void CGridAdaptation::TriangleDivision(long code , long *nodes, long *edges, lon
nElem++;
}
}
-
+
*nPart = nElem;
-
+
for (iTriangle = 0; iTriangle < nElem; iTriangle++) {
Division[iTriangle][0] = 3;
iVar = 1;
@@ -989,7 +989,7 @@ void CGridAdaptation::TriangleDivision(long code , long *nodes, long *edges, lon
if (iNode == 5) Division[iTriangle][iVar] = nodes[5];
iVar++;
}
-
+
}
}
@@ -997,125 +997,125 @@ void CGridAdaptation::TriangleDivision(long code , long *nodes, long *edges, lon
void CGridAdaptation::TetraDivision(long code , long *nodes, long *edges, long **Division, long *nPart) {
-
+
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[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];
-
- }
-
+ 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;
+ 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];
-
- }
-
+ 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;
+ 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];
-
- }
-
+ 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;
+ 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];
-
- }
-
+ 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;
+ 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];
-
- }
-
+ 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; }
+ 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];
@@ -1127,9 +1127,9 @@ void CGridAdaptation::TetraDivision(long code , long *nodes, long *edges, long *
}
}
}
-
+
*nPart = nElem;
-
+
for (iTetra = 0; iTetra < nElem; iTetra++) {
Division[iTetra][0] = 4;
iVar = 1;
@@ -1147,405 +1147,405 @@ void CGridAdaptation::TetraDivision(long code , long *nodes, long *edges, long *
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]
+
+// 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]
+// 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]
+
+// 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) {
-
+
// number of nodes at each new element
- Division[0][0] = 9; Division[1][0] = 9; Division[2][0] = 9; Division[3][0] = 9;
+ 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][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[20]; Division[1][2] = nodes[9]; Division[1][3] = nodes[2]; Division[1][4] = nodes[10];
+
+ 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][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][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][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];
-
- Division[5][1] = nodes[26]; Division[5][2] = nodes[22]; Division[5][3] = nodes[18]; Division[5][4] = nodes[23];
+
+ 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];
-
- Division[6][1] = nodes[26]; Division[6][2] = nodes[23]; Division[6][3] = nodes[19]; Division[6][4] = nodes[24];
+
+ 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][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] = 9; Division[1][0] = 9; Division[2][0] = 9; Division[3][0] = 9;
+ 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][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[0]; Division[1][2] = nodes[8]; Division[1][3] = nodes[10]; Division[1][4] = nodes[3];
+
+ 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[25]; Division[2][2] = nodes[17]; Division[2][3] = nodes[18]; Division[2][4] = nodes[23];
+
+ 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][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] = 9; Division[1][0] = 9; Division[2][0] = 9; Division[3][0] = 9;
+ 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][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[1][1] = nodes[3]; Division[1][2] = nodes[11]; Division[1][9] = nodes[2]; Division[1][4] = nodes[2];
+
+ 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][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];
-
- Division[3][1] = nodes[19]; Division[3][2] = nodes[24]; Division[3][3] = nodes[22]; Division[3][4] = nodes[18];
+
+ 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];
-
- }
-
+
+ }
+
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][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][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];
-
- Division[2][1] = nodes[20]; Division[2][2] = nodes[10]; Division[2][3] = nodes[0]; Division[2][4] = nodes[8];
+
+ 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];
-
- Division[3][1] = nodes[20]; Division[3][2] = nodes[10]; Division[3][3] = nodes[3]; Division[3][4] = nodes[11];
+
+ 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 (code == 5) {
// number of nodes at each new element
- Division[0][0] = 9; Division[1][0] = 9;
+ 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][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];
-
- Division[1][1] = nodes[16]; Division[1][2] = nodes[17]; Division[1][3] = nodes[18]; Division[1][4] = nodes[19];
+
+ 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];
-
- }
-
+
+ }
+
if (code == 6) {
// number of nodes at each new element
- Division[0][0] = 9; Division[1][0] = 9;
+ 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][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][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] = 9; Division[1][0] = 9;
+ Division[0][0] = 9; Division[1][0] = 9;
*nPart = 2;
-
+
// 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][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[8]; Division[1][3] = nodes[10]; Division[1][4] = nodes[3];
+
+ 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];
-
- }
+
+ }
}
void CGridAdaptation::PyramDivision(long code , long *nodes, long **Division, long *nPart) {
if (code == 1) {
-
+
// number of nodes at each new element
Division[0][0] = 6;
*nPart = 1;
-
+
// 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[0][1] = nodes[0]; Division[0][2] = nodes[1]; Division[0][3] = nodes[2]; Division[0][4] = nodes[3]; Division[0][5] = 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];
-
+
Division[1][1] = nodes[5]; Division[1][2] = nodes[2]; Division[1][3] = nodes[3]; Division[1][4] = nodes[4];
-
- Division[2][1] = nodes[5]; Division[2][2] = nodes[3]; Division[2][3] = nodes[0]; Division[2][4] = nodes[4];
-
- }
-
+
+ Division[2][1] = nodes[5]; Division[2][2] = nodes[3]; Division[2][3] = nodes[0]; 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;
-
+
// 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];
-
- Division[2][1] = nodes[3]; Division[2][2] = nodes[6]; Division[2][3] = nodes[2]; Division[2][4] = nodes[4];
-
- }
-
+
+ Division[2][1] = nodes[3]; Division[2][2] = nodes[6]; Division[2][3] = nodes[2]; Division[2][4] = 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];
-
+
Division[1][1] = nodes[1]; Division[1][2] = nodes[2]; Division[1][3] = nodes[7]; Division[1][4] = nodes[4];
-
- Division[2][1] = nodes[0]; Division[2][2] = nodes[7]; Division[2][3] = nodes[3]; Division[2][4] = nodes[4];
-
- }
-
+
+ Division[2][1] = nodes[0]; Division[2][2] = nodes[7]; Division[2][3] = nodes[3]; Division[2][4] = 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;
-
+
// 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[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];
-
- }
-
+
+ Division[2][1] = nodes[8]; Division[2][2] = nodes[2]; Division[2][3] = nodes[3]; Division[2][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];
-
+
Division[1][1] = nodes[5]; Division[1][2] = nodes[1]; Division[1][3] = nodes[6]; Division[1][4] = nodes[4];
-
- Division[2][1] = nodes[5]; Division[2][2] = nodes[6]; Division[2][3] = nodes[3]; Division[2][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[5]; Division[2][2] = nodes[6]; Division[2][3] = nodes[3]; Division[2][4] = nodes[4];
+
+ Division[3][1] = nodes[6]; Division[3][2] = nodes[2]; 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];
-
+
Division[1][1] = nodes[0]; Division[1][2] = nodes[6]; Division[1][3] = nodes[7]; Division[1][4] = nodes[4];
-
- 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];
-
- }
-
+
+ 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];
+
+ }
+
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];
-
+
Division[1][1] = nodes[8]; Division[1][2] = nodes[1]; Division[1][3] = nodes[7]; Division[1][4] = 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];
-
- }
-
+
+ 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 == 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];
-
+
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];
-
- Division[3][1] = nodes[8]; Division[3][2] = nodes[2]; Division[3][3] = nodes[3]; Division[3][4] = nodes[4];
-
- }
-
+
+ Division[2][1] = nodes[8]; Division[2][2] = nodes[5]; Division[2][3] = nodes[2]; Division[2][4] = nodes[4];
+
+ Division[3][1] = nodes[8]; Division[3][2] = nodes[2]; Division[3][3] = nodes[3]; Division[3][4] = 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];
-
- }
-
+
+ }
+
if (code == 11) {
// 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[1]; Division[0][3] = nodes[6]; Division[0][4] = nodes[8]; Division[0][5] = 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 == 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[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[6]; Division[1][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];
-
- }
-
+
+ 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 == 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;
-
+
// 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[1][1] = nodes[6]; Division[1][2] = nodes[2]; Division[1][3] = nodes[7]; Division[1][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];
-
- }
-
+
+ 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 == 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;
-
+
// 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[1][1] = nodes[0]; Division[1][2] = nodes[5]; Division[1][3] = nodes[8]; Division[1][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];
-
- }
-
+
+ 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 == 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;
-
+
// 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[1][1] = nodes[0]; Division[1][2] = nodes[5]; Division[1][3] = nodes[8]; Division[1][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];
-
- }
-
+
+ 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 == 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;
-
+
// 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[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[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[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];
-
- }
+
+ }
}
-void CGridAdaptation::SetHomothetic_Adaptation2D(CGeometry *geometry, CPhysicalGeometry *geo_adapt,
+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;
@@ -1553,14 +1553,14 @@ void CGridAdaptation::SetHomothetic_Adaptation2D(CGeometry *geometry, CPhysicalG
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) ||
@@ -1568,18 +1568,18 @@ void CGridAdaptation::SetHomothetic_Adaptation2D(CGeometry *geometry, CPhysicalG
(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()];
@@ -1587,13 +1587,13 @@ void CGridAdaptation::SetHomothetic_Adaptation2D(CGeometry *geometry, CPhysicalG
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];
@@ -1601,14 +1601,14 @@ void CGridAdaptation::SetHomothetic_Adaptation2D(CGeometry *geometry, CPhysicalG
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;
@@ -1618,30 +1618,30 @@ void CGridAdaptation::SetHomothetic_Adaptation2D(CGeometry *geometry, CPhysicalG
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 *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) {
@@ -1658,31 +1658,31 @@ void CGridAdaptation::SetHomothetic_Adaptation2D(CGeometry *geometry, CPhysicalG
}
}
}
-
- for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++)
+
+ 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);
-
+ 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) {
@@ -1700,168 +1700,168 @@ void CGridAdaptation::SetHomothetic_Adaptation2D(CGeometry *geometry, CPhysicalG
}
}
}
-
+
/*--- 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]);
-
+
/*--- Set the RectAdaptCode ---*/
-
+
if (RectAdaptCode[iElem] == 1) {
RectElemCode[iElem][0] = 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->GetnElem()];
-
+
for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) NodeAtEdges[iEdge] = -1;
for (iElem = 0; iElem < geometry->GetnElem(); iElem++) NodeAtElem[iElem] = -1;
nPoint_new = geometry->GetnPoint();
-
+
su2double **NewNodeCoord;
NewNodeCoord = new su2double *[4*geometry->GetnPoint()];
for (iPoint = 0; iPoint < 4*geometry->GetnPoint(); iPoint++)
NewNodeCoord[iPoint] = new su2double[geometry->GetnDim()];
-
+
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) {
-
+
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++)
+ 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 (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;
-
+
/*--- 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;}
- for (iDim = 0; iDim < geometry->GetnDim(); iDim++)
+ 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 (int iIndex = 0; iIndex < 1; iIndex++) {
-
+
if (RectElemCode[iElem][iIndex] == true) {
-
- if (NodeAtElem[RectElemIndex[iElem][iIndex]] != -1)
+
+ 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++)
+ 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));
-
+
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 ++) {
@@ -1870,20 +1870,20 @@ void CGridAdaptation::SetHomothetic_Adaptation2D(CGeometry *geometry, CPhysicalG
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()];
@@ -1891,63 +1891,63 @@ void CGridAdaptation::SetHomothetic_Adaptation2D(CGeometry *geometry, CPhysicalG
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;
-
+
+ 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;
+ 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) {
@@ -1980,27 +1980,27 @@ void CGridAdaptation::SetHomothetic_Adaptation2D(CGeometry *geometry, CPhysicalG
}
}
}
-
+
/*--- 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),
+ geo_adapt->elem[iElemNew] = new CTriangle(geometry->elem[iElem]->GetNode(0),
+ geometry->elem[iElem]->GetNode(1),
geometry->elem[iElem]->GetNode(2), 2);
iElemNew++;
}
@@ -2015,50 +2015,50 @@ void CGridAdaptation::SetHomothetic_Adaptation2D(CGeometry *geometry, CPhysicalG
}
}
}
-
+
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[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[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],
+ 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][2],
+ Division[iPart][3],
Division[iPart][4], 2);
iElemNew++;
}
@@ -2066,72 +2066,72 @@ void CGridAdaptation::SetHomothetic_Adaptation2D(CGeometry *geometry, CPhysicalG
}
}
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][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];
-
+
+ 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],
+ 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][2],
+ Division[iPart][3],
Division[iPart][4], 2);
iElemNew++;
}
@@ -2139,21 +2139,21 @@ void CGridAdaptation::SetHomothetic_Adaptation2D(CGeometry *geometry, CPhysicalG
}
}
}
-
+
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++) {
+ 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;
@@ -2163,24 +2163,24 @@ void CGridAdaptation::SetHomothetic_Adaptation2D(CGeometry *geometry, CPhysicalG
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++) {
-
+ for (iVertex = 0; iVertex < geometry->GetnElem_Bound(iMarker); iVertex++) {
+
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) {
-
-
+
+
// 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
@@ -2188,23 +2188,23 @@ void CGridAdaptation::SetHomothetic_Adaptation2D(CGeometry *geometry, CPhysicalG
// 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);
-//
+//
// }
-
+
geo_adapt->node[ip_01]->SetBoundary(geometry->GetnMarker());
geo_adapt->bound[iMarker][nNewBCcv] = new CLine(ip_0, ip_01, 2);
nNewBCcv++;
@@ -2217,15 +2217,15 @@ void CGridAdaptation::SetHomothetic_Adaptation2D(CGeometry *geometry, CPhysicalG
}
}
}
-
- delete [] DivEdge;
- delete [] DivElem;
- delete [] NodeAtEdges;
- delete [] NodeAtElem;
-
+
+ delete [] DivEdge;
+ delete [] DivElem;
+ delete [] NodeAtEdges;
+ delete [] NodeAtElem;
+
}
-void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalGeometry *geo_adapt,
+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;
@@ -2234,17 +2234,17 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
unsigned short counter;
unsigned short nMarker_Max = config->GetnMarker_Max();
- long *TetraAdaptCode;
+ long *TetraAdaptCode;
long **TetraEdgeIndex; bool **TetraEdgeCode; long **TetraEdgeNode;
-
- long *HexaAdaptCode;
+
+ 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) ||
@@ -2252,18 +2252,18 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
(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()];
@@ -2274,12 +2274,12 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
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];
@@ -2288,24 +2288,24 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
HexaFaceNode[iElem] = new long [6];
HexaElemIndex[iElem] = new long [1];
HexaElemCode[iElem] = new bool [1];
- HexaElemNode[iElem] = new long [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);
@@ -2316,7 +2316,7 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
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;
@@ -2327,28 +2327,28 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
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][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) ||
+ 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++)
@@ -2361,11 +2361,11 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
}
}
}
-
+
/*--- 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 (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++) {
@@ -2376,15 +2376,15 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
}
}
}
-
+
/*--- Initial edges that are going to be divided ---*/
- bool *DivEdge = new bool[geometry->GetnEdge()];
+ 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) {
@@ -2402,18 +2402,18 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
}
}
}
-
+
/*--- Only with tets, check if an element have more than 4 divided edges, the element should be completelly divided ---*/
- bool new_elem;
+ 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++;
@@ -2421,8 +2421,8 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
if (DivEdge[TetraEdgeIndex[iElem][3]]) counter++;
if (DivEdge[TetraEdgeIndex[iElem][4]]) counter++;
if (DivEdge[TetraEdgeIndex[iElem][5]]) counter++;
-
- if ((counter > 3) && (!DivElem[iElem])) {
+
+ 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;
@@ -2431,12 +2431,12 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
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,
+
+ /*--- 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) {
@@ -2454,24 +2454,24 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
}
}
}
-
- // Only those elements that verify certain rules will be marked for hexa adaptation...
+
+ // 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][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;
}
@@ -2486,35 +2486,35 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
}
}
}
-
+
// 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 ++) {
@@ -2522,51 +2522,51 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
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
+
+ // 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 == 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++)
+
+ 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);
@@ -2575,19 +2575,19 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
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
+
+ // 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;}
@@ -2600,26 +2600,26 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
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++)
+
+ 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;
@@ -2630,37 +2630,37 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
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++)
+
+ 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)
+
+ 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++)
+ 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) +
@@ -2669,23 +2669,23 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
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 ++) {
@@ -2694,34 +2694,34 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
nSemiDivided++;
}
}
-
- // If semidivision, then divide add a new point (hexa), divide the hexahedron into Tetras,
+
+ // 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 nPyram = nSemiDivided*6;
+
long *PyramAdaptCode;
- long **PyramNode;
+ long **PyramNode;
long **HexaPyramIndex;
long *PyramHexaIndex;
-
- long **PyramEdgeIndex;
+
+ long **PyramEdgeIndex;
bool **PyramEdgeCode;
- long **PyramEdgeNode;
-
+ 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];
+ 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];
+ 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];
@@ -2730,19 +2730,19 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
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.
+
+ // 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);
@@ -2751,117 +2751,117 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
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;
-
+
+ // 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;
+ 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;
-
+
+ // 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;
+ 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;
-
+
+ // 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;
+ 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;
-
+
+ // 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;
+ 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;
-
+
+ // 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;
+ 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;
-
+
+ // 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;
+ if (DivEdge[PyramEdgeIndex[nPyram][iIndex]] == true) PyramEdgeCode[nPyram][iIndex] = true;
nPyram++;
-
- nPoint_new++;
-
+ 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 ++) {
@@ -2905,26 +2905,26 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
}
}
}
-
+
// 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),
+ 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++;
}
@@ -2958,73 +2958,73 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
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[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[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);}
+ 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],
+ 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];
@@ -3032,7 +3032,7 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
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];
@@ -3040,33 +3040,33 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
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],
+ 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][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[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.
@@ -3074,27 +3074,27 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
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],
+ 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],
+ geo_adapt->elem[iElemNew] = new CPyramid(Division[iPart][1],
+ Division[iPart][2],
+ Division[iPart][3],
Division[iPart][4],
Division[iPart][5]);
iElemNew++;
@@ -3103,12 +3103,12 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
}
}
}
-
+
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()];
@@ -3118,22 +3118,22 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
// 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++) {
+ 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++) {
-
+ 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());
@@ -3144,24 +3144,24 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
}
else {
// First the corners
- nodes[0] = geometry->bound[iMarker][iVertex]->GetNode(0);
- nodes[1] = geometry->bound[iMarker][iVertex]->GetNode(1);
+ 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++;
@@ -3170,10 +3170,10 @@ void CGridAdaptation::SetHomothetic_Adaptation3D(CGeometry *geometry, CPhysicalG
}
geo_adapt->SetnElem_Bound(iMarker, nNewBCcv);
}
-
- delete [] DivEdge;
+
+ delete [] DivEdge;
delete [] DivElem;
- delete [] NodeAtEdges;
+ delete [] NodeAtEdges;
delete [] NodeAtElem;
}
@@ -3181,25 +3181,25 @@ void CGridAdaptation::SetIndicator_Flow(CGeometry *geometry, CConfig *config, un
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, *Normal;
+ 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->edge[iEdge]->GetNode(0); Solution_0 = ConsVar_Sol[Point_0][0];
- Point_1 = geometry->edge[iEdge]->GetNode(1); Solution_1 = ConsVar_Sol[Point_1][0];
- Normal = geometry->edge[iEdge]->GetNormal();
+ 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];
@@ -3207,28 +3207,28 @@ void CGridAdaptation::SetIndicator_Flow(CGeometry *geometry, CConfig *config, un
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];
- Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
+ 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->node[iPoint]->GetVolume();
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->node[iPoint]->GetVolume();
@@ -3238,9 +3238,9 @@ void CGridAdaptation::SetIndicator_Flow(CGeometry *geometry, CConfig *config, un
norm = sqrt(norm);
Index[iPoint] = pow(Dual_Area, scale_area)*norm;
}
-
+
SetSensorElem(geometry, config, max_elem_new);
-
+
}
@@ -3249,26 +3249,25 @@ void CGridAdaptation::SetIndicator_Adj(CGeometry *geometry, CConfig *config, uns
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, *Normal;
+ 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->edge[iEdge]->GetNode(0); Solution_0 = AdjVar_Sol[Point_0][0];
- Point_1 = geometry->edge[iEdge]->GetNode(1); Solution_1 = AdjVar_Sol[Point_1][0];
- Normal = geometry->edge[iEdge]->GetNormal();
+ Point_0 = geometry->edges->GetNode(iEdge,0); Solution_0 = AdjVar_Sol[Point_0][0];
+ Point_1 = geometry->edges->GetNode(iEdge,1); Solution_1 = AdjVar_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];
@@ -3276,29 +3275,29 @@ void CGridAdaptation::SetIndicator_Adj(CGeometry *geometry, CConfig *config, uns
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 = AdjVar_Sol[Point][0];
- Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
+ 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->node[iPoint]->GetVolume();
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->node[iPoint]->GetVolume();
@@ -3308,67 +3307,67 @@ void CGridAdaptation::SetIndicator_Adj(CGeometry *geometry, CConfig *config, uns
norm = sqrt(norm);
Index[iPoint] = pow(Dual_Area, scale_area)*norm;
}
-
+
SetSensorElem(geometry, config, max_elem_new);
-
+
}
void CGridAdaptation::SetIndicator_FlowAdj(CGeometry *geometry, CConfig *config) {
su2double Dual_Area;
unsigned long Point = 0, Point_0 = 0, Point_1 = 0, iEdge, iVertex, iPoint, iElem, max_elem_new_flow, max_elem_new_adj;
unsigned short iDim, iMarker;
- su2double norm, DualArea, Partial_Res, *Normal;
+ su2double norm, DualArea, Partial_Res;
su2double scale_area = config->GetDualVol_Power();
-
+
// Initialization
max_elem_new_flow = SU2_TYPE::Int(0.5*0.01*config->GetNew_Elem_Adapt()*su2double(geometry->GetnElem()));
max_elem_new_adj = SU2_TYPE::Int(0.5*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_Flow[iPoint][iDim] = 0.0;
Gradient_Adj[iPoint][iDim] = 0.0;
}
-
+
for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
- Point_0 = geometry->edge[iEdge]->GetNode(0);
- Point_1 = geometry->edge[iEdge]->GetNode(1);
- Normal = geometry->edge[iEdge]->GetNormal();
+ Point_0 = geometry->edges->GetNode(iEdge,0);
+ Point_1 = geometry->edges->GetNode(iEdge,1);
+ const auto Normal = geometry->edges->GetNormal(iEdge);
for (iDim = 0; iDim < nDim; iDim++) {
Partial_Res = 0.5 * ( ConsVar_Sol[Point_0][0] + ConsVar_Sol[Point_1][0] ) * Normal[iDim];
Gradient_Flow[Point_0][iDim] = Gradient_Flow[Point_0][iDim] + Partial_Res;
Gradient_Flow[Point_1][iDim] = Gradient_Flow[Point_1][iDim] - Partial_Res;
-
+
Partial_Res = 0.5 * ( AdjVar_Sol[Point_0][0] + AdjVar_Sol[Point_1][0] ) * Normal[iDim];
Gradient_Adj[Point_0][iDim] = Gradient_Adj[Point_0][iDim] + Partial_Res;
Gradient_Adj[Point_1][iDim] = Gradient_Adj[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();
- Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
+ const auto Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
for (iDim = 0; iDim < nDim; iDim++) {
Gradient_Flow[Point][iDim] = Gradient_Flow[Point][iDim] - ConsVar_Sol[Point][0] * Normal[iDim];
Gradient_Adj[Point][iDim] = Gradient_Adj[Point][iDim] - AdjVar_Sol[Point][0] * Normal[iDim];
}
}
}
-
+
for (iPoint = 0; iPointGetnPoint(); iPoint++)
for (iDim = 0; iDim < nDim; iDim++) {
DualArea = geometry->node[iPoint]->GetVolume();
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();
@@ -3378,22 +3377,22 @@ void CGridAdaptation::SetIndicator_FlowAdj(CGeometry *geometry, CConfig *config)
norm = sqrt(norm);
Index[iPoint] = pow(Dual_Area, scale_area)*norm;
}
-
-
+
+
SetSensorElem(geometry, config, max_elem_new_flow);
-
+
// 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_Adj[iPoint][iDim]*Gradient_Adj[iPoint][iDim];
- norm = sqrt(norm);
+ norm = sqrt(norm);
Index[iPoint] = pow(Dual_Area, scale_area)*norm;
}
-
+
SetSensorElem(geometry, config, max_elem_new_adj);
-
+
}
void CGridAdaptation::SetIndicator_Robust(CGeometry *geometry, CConfig *config) {
@@ -3401,22 +3400,22 @@ void CGridAdaptation::SetIndicator_Robust(CGeometry *geometry, CConfig *config)
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);
}
-
-
+
+
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];
-
+
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);
@@ -3425,10 +3424,10 @@ void CGridAdaptation::SetIndicator_Robust(CGeometry *geometry, CConfig *config)
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]);
}
-
+
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);
@@ -3439,21 +3438,21 @@ void CGridAdaptation::SetIndicator_Computable(CGeometry *geometry, CConfig *conf
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()));
+
+ 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];
-
+
Index[iPoint] = pow(Dual_Area, scale_area)*sqrt(Index[iPoint]);
}
-
+
SetSensorElem(geometry, config, max_elem_new);
}
@@ -3465,36 +3464,36 @@ void CGridAdaptation::SetIndicator_Computable_Robust(CGeometry *geometry, CConfi
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()));
+ 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];
-
+
Index[iPoint] = pow(Dual_Area, scale_area)*sqrt(Index[iPoint]);
}
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;
-
+
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);
-
+
restart_flowfile << "Restart file generated with SU2_MSH" << endl;
for (iPoint = 0; iPoint < nPoint_new; iPoint++) {
@@ -3508,16 +3507,16 @@ void CGridAdaptation::SetRestart_FlowSolution(CConfig *config, CPhysicalGeometry
restart_flowfile << endl;
}
restart_flowfile.close();
-
+
}
void CGridAdaptation::SetRestart_AdjSolution(CConfig *config, CPhysicalGeometry *geo_adapt, string mesh_adjfilename) {
-
+
char cstr[MAX_STRING_SIZE], buffer[50];
unsigned short iDim, iVar;
unsigned long iPoint;
string copy;
-
+
copy.assign(mesh_adjfilename);
unsigned short lastindex = copy.find_last_of(".");
copy = copy.substr(0, lastindex);
@@ -3546,36 +3545,36 @@ void CGridAdaptation::SetRestart_AdjSolution(CConfig *config, CPhysicalGeometry
if (config->GetKind_ObjFunc() == SURFACE_MACH) SPRINTF (buffer, "_mach.dat");
if (config->GetKind_ObjFunc() == CUSTOM_OBJFUNC) SPRINTF (buffer, "_custom.dat");
}
-
+
strcat(cstr, buffer);
-
+
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 (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.close();
}
void CGridAdaptation::SetRestart_LinSolution(CConfig *config, CPhysicalGeometry *geo_adapt, string mesh_linfilename) {
-
+
unsigned long iPoint;
unsigned short iVar, iDim;
-
+
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);
@@ -3584,13 +3583,13 @@ void CGridAdaptation::SetRestart_LinSolution(CConfig *config, CPhysicalGeometry
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.close();
}
@@ -3599,14 +3598,14 @@ void CGridAdaptation::SetSensorElem(CGeometry *geometry, CConfig *config, unsign
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 ++) {
@@ -3621,12 +3620,12 @@ void CGridAdaptation::SetSensorElem(CGeometry *geometry, CConfig *config, unsign
}
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;
@@ -3638,7 +3637,7 @@ void CGridAdaptation::SetSensorElem(CGeometry *geometry, CConfig *config, unsign
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;
}
@@ -3652,7 +3651,7 @@ void CGridAdaptation::SetSensorElem(CGeometry *geometry, CConfig *config, unsign
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/interface_interpolation/CInterpolator.cpp b/Common/src/interface_interpolation/CInterpolator.cpp
index 2b2c0aa7c89d..118ea1287d6d 100644
--- a/Common/src/interface_interpolation/CInterpolator.cpp
+++ b/Common/src/interface_interpolation/CInterpolator.cpp
@@ -222,10 +222,10 @@ void CInterpolator::ReconstructBoundary(unsigned long val_zone, int val_marker){
for (jEdge = 0; jEdge < nEdges; jEdge++){
EdgeIndex = geom->node[iPoint]->GetEdge(jEdge);
- if( iPoint == geom->edge[EdgeIndex]->GetNode(0) )
- dPoint = geom->edge[EdgeIndex]->GetNode(1);
+ if( iPoint == geom->edges->GetNode(EdgeIndex,0) )
+ dPoint = geom->edges->GetNode(EdgeIndex,1);
else
- dPoint = geom->edge[EdgeIndex]->GetNode(0);
+ dPoint = geom->edges->GetNode(EdgeIndex,0);
if ( geom->node[dPoint]->GetVertex(val_marker) != -1 )
nNodes++;
@@ -242,10 +242,10 @@ void CInterpolator::ReconstructBoundary(unsigned long val_zone, int val_marker){
for (jEdge = 0; jEdge < nEdges; jEdge++){
EdgeIndex = geom->node[iPoint]->GetEdge(jEdge);
- if( iPoint == geom->edge[EdgeIndex]->GetNode(0) )
- dPoint = geom->edge[EdgeIndex]->GetNode(1);
+ if( iPoint == geom->edges->GetNode(EdgeIndex,0) )
+ dPoint = geom->edges->GetNode(EdgeIndex,1);
else
- dPoint = geom->edge[EdgeIndex]->GetNode(0);
+ dPoint = geom->edges->GetNode(EdgeIndex,0);
if ( geom->node[dPoint]->GetVertex(val_marker) != -1 ){
Aux_Send_Map[nLocalVertex][nNodes] = geom->node[dPoint]->GetGlobalIndex();
diff --git a/Common/src/linear_algebra/CSysMatrix.cpp b/Common/src/linear_algebra/CSysMatrix.cpp
index 4f5190bcf809..07b241b7e04c 100644
--- a/Common/src/linear_algebra/CSysMatrix.cpp
+++ b/Common/src/linear_algebra/CSysMatrix.cpp
@@ -984,7 +984,8 @@ unsigned long CSysMatrix::BuildLineletPreconditioner(CGeometry *geom
bool add_point;
unsigned long iEdge, iPoint, jPoint, index_Point, iLinelet, iVertex, next_Point, counter, iElem;
unsigned short iMarker, iNode;
- su2double alpha = 0.9, weight, max_weight, *normal, area, volume_iPoint, volume_jPoint;
+ su2double alpha = 0.9, weight, max_weight, area, volume_iPoint, volume_jPoint;
+ const su2double* normal;
unsigned long Local_nPoints, Local_nLineLets, Global_nPoints, Global_nLineLets, max_nElem;
/*--- Memory allocation --*/
@@ -1049,7 +1050,7 @@ unsigned long CSysMatrix::BuildLineletPreconditioner(CGeometry *geom
jPoint = geometry->node[iPoint]->GetPoint(iNode);
if ((check_Point[jPoint]) && geometry->node[jPoint]->GetDomain()) {
iEdge = geometry->FindEdge(iPoint, jPoint);
- normal = geometry->edge[iEdge]->GetNormal();
+ 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();
@@ -1067,7 +1068,7 @@ unsigned long CSysMatrix::BuildLineletPreconditioner(CGeometry *geom
for (iNode = 0; iNode < geometry->node[iPoint]->GetnPoint(); iNode++) {
jPoint = geometry->node[iPoint]->GetPoint(iNode);
iEdge = geometry->FindEdge(iPoint, jPoint);
- normal = geometry->edge[iEdge]->GetNormal();
+ 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();
diff --git a/Common/src/linear_algebra/CSysVector.cpp b/Common/src/linear_algebra/CSysVector.cpp
index bd25e33f700d..4cde67f472de 100644
--- a/Common/src/linear_algebra/CSysVector.cpp
+++ b/Common/src/linear_algebra/CSysVector.cpp
@@ -106,8 +106,7 @@ void CSysVector::PassiveCopy(const CSysVector& other) {
template
CSysVector::~CSysVector() {
- if (vec_val != nullptr)
- MemoryAllocation::aligned_free(vec_val);
+ MemoryAllocation::aligned_free(vec_val);
}
template
diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp
index 91c98a978257..c639b62b190a 100644
--- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp
+++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp
@@ -103,10 +103,10 @@ void computeGradientsGreenGauss(CSolver* solver,
/*--- Determine if edge points inwards or outwards of iPoint.
* If inwards we need to flip the area vector. ---*/
- su2double dir = (iPoint == geometry.edge[iEdge]->GetNode(0))? 1.0 : -1.0;
+ su2double dir = (iPoint == geometry.edges->GetNode(iEdge,0))? 1.0 : -1.0;
su2double weight = dir * halfOnVol;
- const su2double* area = geometry.edge[iEdge]->GetNormal();
+ const su2double* area = geometry.edges->GetNormal(iEdge);
AD::SetPreaccIn(area, nDim);
for (size_t iVar = varBegin; iVar < varEnd; ++iVar)
diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp
index 13ae40cfbf87..ad50124b32d1 100644
--- a/SU2_CFD/include/numerics/CNumerics.hpp
+++ b/SU2_CFD/include/numerics/CNumerics.hpp
@@ -185,8 +185,9 @@ class CNumerics {
unsigned short
Neighbor_i, /*!< \brief Number of neighbors of the point i. */
Neighbor_j; /*!< \brief Number of neighbors of the point j. */
+ const su2double
+ *Normal; /*!< \brief Normal vector, its norm is the area of the face. */
su2double
- *Normal, /*!< \brief Normal vector, its norm is the area of the face. */
*UnitNormal, /*!< \brief Unitary normal vector. */
*UnitNormald; /*!< \brief Derivative of unitary normal vector. */
su2double
@@ -700,7 +701,7 @@ class CNumerics {
* \brief Set the value of the normal vector to the face between two points.
* \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
*/
- inline void SetNormal(su2double *val_normal) { Normal = val_normal; }
+ inline void SetNormal(const su2double *val_normal) { Normal = val_normal; }
/*!
* \brief Set the value of the volume of the control volume.
@@ -741,9 +742,9 @@ class CNumerics {
* \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
* \param[out] val_Proj_Flux - Pointer to the projected flux.
*/
- void GetInviscidProjFlux(su2double *val_density, su2double *val_velocity,
- su2double *val_pressure, su2double *val_enthalpy,
- su2double *val_normal, su2double *val_Proj_Flux);
+ void GetInviscidProjFlux(const su2double *val_density, const su2double *val_velocity,
+ const su2double *val_pressure, const su2double *val_enthalpy,
+ const su2double *val_normal, su2double *val_Proj_Flux);
/*!
* \brief Compute the projected inviscid flux vector for incompresible simulations
@@ -754,10 +755,10 @@ class CNumerics {
* \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
* \param[out] val_Proj_Flux - Pointer to the projected flux.
*/
- void GetInviscidIncProjFlux(su2double *val_density, su2double *val_velocity,
- su2double *val_pressure, su2double *val_betainc2,
- su2double *val_enthalpy,
- su2double *val_normal, su2double *val_Proj_Flux);
+ void GetInviscidIncProjFlux(const su2double *val_density, const su2double *val_velocity,
+ const su2double *val_pressure, const su2double *val_betainc2,
+ const su2double *val_enthalpy, const su2double *val_normal,
+ su2double *val_Proj_Flux);
/*!
* \brief Compute the projection of the inviscid Jacobian matrices.
@@ -767,8 +768,8 @@ class CNumerics {
* \param[in] val_scale - Scale of the projection.
* \param[out] val_Proj_Jac_tensor - Pointer to the projected inviscid Jacobian.
*/
- void GetInviscidProjJac(su2double *val_velocity, su2double *val_energy,
- su2double *val_normal, su2double val_scale,
+ void GetInviscidProjJac(const su2double *val_velocity, const su2double *val_energy,
+ const su2double *val_normal, su2double val_scale,
su2double **val_Proj_Jac_tensor);
/*!
@@ -780,8 +781,8 @@ class CNumerics {
* \param[in] val_scale - Scale of the projection.
* \param[out] val_Proj_Jac_tensor - Pointer to the projected inviscid Jacobian.
*/
- void GetInviscidIncProjJac(su2double *val_density, su2double *val_velocity,
- su2double *val_betainc2, su2double *val_normal,
+ void GetInviscidIncProjJac(const su2double *val_density, const su2double *val_velocity,
+ const su2double *val_betainc2, const su2double *val_normal,
su2double val_scale,
su2double **val_Proj_Jac_tensor);
@@ -797,13 +798,13 @@ class CNumerics {
* \param[in] val_scale - Scale of the projection.
* \param[out] val_Proj_Jac_tensor - Pointer to the projected inviscid Jacobian.
*/
- void GetInviscidIncProjJac(su2double *val_density,
- su2double *val_velocity,
- su2double *val_betainc2,
- su2double *val_cp,
- su2double *val_temperature,
- su2double *val_dRhodT,
- su2double *val_normal,
+ void GetInviscidIncProjJac(const su2double *val_density,
+ const su2double *val_velocity,
+ const su2double *val_betainc2,
+ const su2double *val_cp,
+ const su2double *val_temperature,
+ const su2double *val_dRhodT,
+ const su2double *val_normal,
su2double val_scale,
su2double **val_Proj_Jac_Tensor);
@@ -817,12 +818,12 @@ class CNumerics {
* \param[in] val_dRhodT - Value of the derivative of density w.r.t. temperature.
* \param[out] val_Precon - Pointer to the preconditioning matrix.
*/
- void GetPreconditioner(su2double *val_density,
- su2double *val_velocity,
- su2double *val_betainc2,
- su2double *val_cp,
- su2double *val_temperature,
- su2double *val_drhodt,
+ void GetPreconditioner(const su2double *val_density,
+ const su2double *val_velocity,
+ const su2double *val_betainc2,
+ const su2double *val_cp,
+ const su2double *val_temperature,
+ const su2double *val_drhodt,
su2double **val_Precon);
/*!
@@ -833,10 +834,10 @@ class CNumerics {
* \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
* \param[out] val_Proj_Jac_tensor - Pointer to the projected inviscid Jacobian.
*/
- void GetPreconditionedProjJac(su2double *val_density,
- su2double *val_velocity,
- su2double *val_betainc2,
- su2double *val_normal,
+ void GetPreconditionedProjJac(const su2double *val_density,
+ const su2double *val_velocity,
+ const su2double *val_betainc2,
+ const su2double *val_normal,
su2double **val_Proj_Jac_Tensor);
/*!
@@ -847,9 +848,9 @@ class CNumerics {
* \param[in] val_scale - Scale of the projection.
* \param[out] val_Proj_Jac_tensor - Pointer to the projected inviscid Jacobian.
*/
- void GetInviscidProjJac(su2double *val_velocity, su2double *val_enthalphy,
- su2double *val_chi, su2double *val_kappa,
- su2double *val_normal, su2double val_scale,
+ void GetInviscidProjJac(const su2double *val_velocity, const su2double *val_enthalphy,
+ const su2double *val_chi, const su2double *val_kappa,
+ const su2double *val_normal, su2double val_scale,
su2double **val_Proj_Jac_tensor);
/*!
@@ -858,8 +859,8 @@ class CNumerics {
* \param[in] val_Mean_PrimVar - Mean Value of the secondary variables.
* \param[out] val_Jac_PC - Pointer to the Jacobian dPdC.
*/
- void GetPrimitive2Conservative (su2double *val_Mean_PrimVar,
- su2double *val_Mean_SecVar,
+ void GetPrimitive2Conservative (const su2double *val_Mean_PrimVar,
+ const su2double *val_Mean_SecVar,
su2double **val_Jac_PC);
/*!
@@ -874,10 +875,10 @@ class CNumerics {
* \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
* \param[out] val_p_tensor - Pointer to the P matrix.
*/
- void GetPMatrix(su2double *val_density, su2double *val_velocity,
- su2double *val_soundspeed, su2double *val_enthalpy,
- su2double *val_chi, su2double *val_kappa,
- su2double *val_normal, su2double **val_p_tensor);
+ void GetPMatrix(const su2double *val_density, const su2double *val_velocity,
+ const su2double *val_soundspeed, const su2double *val_enthalpy,
+ const su2double *val_chi, const su2double *val_kappa,
+ const su2double *val_normal, su2double **val_p_tensor);
/*!
* \brief Computation of the matrix P, this matrix diagonalize the conservative Jacobians in
@@ -888,8 +889,8 @@ class CNumerics {
* \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
* \param[out] val_p_tensor - Pointer to the P matrix.
*/
- void GetPMatrix(su2double *val_density, su2double *val_velocity,
- su2double *val_soundspeed, su2double *val_normal,
+ void GetPMatrix(const su2double *val_density, const su2double *val_velocity,
+ const su2double *val_soundspeed, const su2double *val_normal,
su2double **val_p_tensor);
/*!
@@ -902,7 +903,7 @@ class CNumerics {
* \param[out] val_invR_invPe - Pointer to the matrix of conversion from entropic to conserved variables.
*/
void GetinvRinvPe(su2double Beta2, su2double val_enthalpy, su2double val_soundspeed,
- su2double val_density, su2double* val_velocity,
+ su2double val_density, const su2double* val_velocity,
su2double** val_invR_invPe);
/*!
@@ -914,7 +915,7 @@ class CNumerics {
* \param[out] val_invR_invPe - Pointer to the matrix of conversion from entropic to conserved variables.
*/
void GetRMatrix(su2double val_pressure, su2double val_soundspeed,
- su2double val_density, su2double* val_velocity,
+ su2double val_density, const su2double* val_velocity,
su2double** val_invR_invPe);
/*!
* \brief Computation of the matrix R.
@@ -1003,8 +1004,8 @@ class CNumerics {
* \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
* \param[out] val_invp_tensor - Pointer to inverse of the P matrix.
*/
- void GetPMatrix_inv(su2double *val_density, su2double *val_velocity,
- su2double *val_soundspeed, su2double *val_normal,
+ void GetPMatrix_inv(const su2double *val_density, const su2double *val_velocity,
+ const su2double *val_soundspeed, const su2double *val_normal,
su2double **val_invp_tensor);
/*!
@@ -1014,10 +1015,10 @@ class CNumerics {
su2double ViscDens_i, su2double ViscDens_j, su2double *Velocity_i, su2double *Velocity_j,
su2double sq_vel_i, su2double sq_vel_j,
su2double XiDens_i, su2double XiDens_j, su2double **Mean_GradPhi, su2double *Mean_GradPsiE,
- su2double dPhiE_dn, su2double *Normal, su2double *Edge_Vector, su2double dist_ij_2, su2double *val_residual_i,
- su2double *val_residual_j,
- su2double **val_Jacobian_ii, su2double **val_Jacobian_ij, su2double **val_Jacobian_ji,
- su2double **val_Jacobian_jj, bool implicit);
+ su2double dPhiE_dn, const su2double *Normal, su2double *Edge_Vector, su2double dist_ij_2,
+ su2double *val_residual_i, su2double *val_residual_j,
+ su2double **val_Jacobian_ii, su2double **val_Jacobian_ij,
+ su2double **val_Jacobian_ji, su2double **val_Jacobian_jj, bool implicit);
/*!
* \brief Computation of the projected inviscid lambda (eingenvalues).
@@ -1026,8 +1027,8 @@ class CNumerics {
* \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
* \param[in] val_Lambda_Vector - Pointer to Lambda matrix.
*/
- void GetJacInviscidLambda_fabs(su2double *val_velocity, su2double val_soundspeed,
- su2double *val_normal, su2double *val_Lambda_Vector);
+ void GetJacInviscidLambda_fabs(const su2double *val_velocity, su2double val_soundspeed,
+ const su2double *val_normal, su2double *val_Lambda_Vector);
/*!
* \brief Compute the numerical residual.
diff --git a/SU2_CFD/include/solvers/CEulerSolver.hpp b/SU2_CFD/include/solvers/CEulerSolver.hpp
index 85fb2d8a5c1e..70e4e98f14ab 100644
--- a/SU2_CFD/include/solvers/CEulerSolver.hpp
+++ b/SU2_CFD/include/solvers/CEulerSolver.hpp
@@ -996,7 +996,7 @@ class CEulerSolver : public CSolver {
* \brief Set the new solution variables to the current solution value for classical RK.
* \param[in] geometry - Geometrical definition of the problem.
*/
- inline void Set_NewSolution(CGeometry *geometry) final { nodes->SetSolution_New(); }
+ inline void Set_NewSolution() final { nodes->SetSolution_New(); }
/*!
* \brief Update the solution using a Runge-Kutta scheme.
diff --git a/SU2_CFD/include/solvers/CFEM_DG_EulerSolver.hpp b/SU2_CFD/include/solvers/CFEM_DG_EulerSolver.hpp
index 86a24d8faa60..c8f775c9fc42 100644
--- a/SU2_CFD/include/solvers/CFEM_DG_EulerSolver.hpp
+++ b/SU2_CFD/include/solvers/CFEM_DG_EulerSolver.hpp
@@ -402,16 +402,14 @@ class CFEM_DG_EulerSolver : public CSolver {
/*!
* \brief Set the working solution of the first time level to the current
- solution. Used for Runge-Kutta type schemes.
- * \param[in] geometry - Geometrical definition of the problem.
+ * solution. Used for Runge-Kutta type schemes.
*/
- void Set_OldSolution(CGeometry *geometry) final;
+ void Set_OldSolution() final;
/*!
* \brief Set the new solution to the current solution for classical RK.
- * \param[in] geometry - Geometrical definition of the problem.
*/
- void Set_NewSolution(CGeometry *geometry) final;
+ void Set_NewSolution() final;
/*!
* \brief Function to compute the time step for solving the Euler equations.
diff --git a/SU2_CFD/include/solvers/CSolver.hpp b/SU2_CFD/include/solvers/CSolver.hpp
index ab8656c98b9f..1e9405a0e604 100644
--- a/SU2_CFD/include/solvers/CSolver.hpp
+++ b/SU2_CFD/include/solvers/CSolver.hpp
@@ -619,16 +619,14 @@ class CSolver {
/*!
* \brief Set the old solution variables to the current solution value for Runge-Kutta iteration.
- It is a virtual function, because for the DG-FEM solver a different version is needed.
- * \param[in] geometry - Geometrical definition of the problem.
+ * It is a virtual function, because for the DG-FEM solver a different version is needed.
*/
- inline virtual void Set_OldSolution(CGeometry *geometry) { base_nodes->Set_OldSolution(); }
+ inline virtual void Set_OldSolution() { base_nodes->Set_OldSolution(); }
/*!
* \brief Set the new solution variables to the current solution value for classical RK.
- * \param[in] geometry - Geometrical definition of the problem.
*/
- inline virtual void Set_NewSolution(CGeometry *geometry) { }
+ inline virtual void Set_NewSolution() { }
/*!
* \brief Load the geometries at the previous time states n and nM1.
diff --git a/SU2_CFD/include/solvers/CTurbSASolver.hpp b/SU2_CFD/include/solvers/CTurbSASolver.hpp
index 7004e3c6f23a..2061a25c7a90 100644
--- a/SU2_CFD/include/solvers/CTurbSASolver.hpp
+++ b/SU2_CFD/include/solvers/CTurbSASolver.hpp
@@ -285,20 +285,6 @@ class CTurbSASolver final : public CTurbSolver {
CConfig *config,
unsigned short val_marker) override;
- /*!
- * \brief Impose the fluid interface boundary condition using tranfer data.
- * \param[in] geometry - Geometrical definition of the problem.
- * \param[in] solver_container - Container vector with all the solutions.
- * \param[in] conv_numerics - Description of the numerical method.
- * \param[in] visc_numerics - Description of the numerical method.
- * \param[in] config - Definition of the particular problem.
- */
- void BC_Fluid_Interface(CGeometry *geometry,
- CSolver **solver_container,
- CNumerics *conv_numerics,
- CNumerics *visc_numerics,
- CConfig *config) override;
-
/*!
* \brief Impose the near-field boundary condition using the residual.
* \param[in] geometry - Geometrical definition of the problem.
diff --git a/SU2_CFD/include/solvers/CTurbSSTSolver.hpp b/SU2_CFD/include/solvers/CTurbSSTSolver.hpp
index b8896995929a..c9eac760f597 100644
--- a/SU2_CFD/include/solvers/CTurbSSTSolver.hpp
+++ b/SU2_CFD/include/solvers/CTurbSSTSolver.hpp
@@ -228,19 +228,6 @@ class CTurbSSTSolver final : public CTurbSolver {
CNumerics *visc_numerics,
CConfig *config,
unsigned short val_marker) override;
- /*!
- * \brief Impose the interface state across sliding meshes.
- * \param[in] geometry - Geometrical definition of the problem.
- * \param[in] solver_container - Container vector with all the solutions.
- * \param[in] conv_numerics - Description of the numerical method.
- * \param[in] visc_numerics - Description of the numerical method.
- * \param[in] config - Definition of the particular problem.
- */
- void BC_Fluid_Interface(CGeometry *geometry,
- CSolver **solver_container,
- CNumerics *conv_numerics,
- CNumerics *visc_numerics,
- CConfig *config) override;
/*!
* \brief Get the constants for the SST model.
@@ -259,7 +246,6 @@ class CTurbSSTSolver final : public CTurbSolver {
}
}
-
/*!
* \brief Store of a set of provided inlet profile values at a vertex.
* \param[in] val_inlet - vector containing the inlet values for the current vertex.
diff --git a/SU2_CFD/include/solvers/CTurbSolver.hpp b/SU2_CFD/include/solvers/CTurbSolver.hpp
index e6e69b478ec2..80612ab80573 100644
--- a/SU2_CFD/include/solvers/CTurbSolver.hpp
+++ b/SU2_CFD/include/solvers/CTurbSolver.hpp
@@ -227,6 +227,20 @@ class CTurbSolver : public CSolver {
CNumerics *numerics,
CConfig *config) final;
+ /*!
+ * \brief Impose the fluid interface boundary condition using tranfer data.
+ * \param[in] geometry - Geometrical definition of the problem.
+ * \param[in] solver_container - Container vector with all the solutions.
+ * \param[in] conv_numerics - Description of the numerical method.
+ * \param[in] visc_numerics - Description of the numerical method.
+ * \param[in] config - Definition of the particular problem.
+ */
+ void BC_Fluid_Interface(CGeometry *geometry,
+ CSolver **solver_container,
+ CNumerics *conv_numerics,
+ CNumerics *visc_numerics,
+ CConfig *config) final;
+
/*!
* \brief Update the solution using an implicit solver.
* \param[in] geometry - Geometrical definition of the problem.
diff --git a/SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp b/SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp
index 80110ba09c12..2378cfed07c8 100644
--- a/SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp
+++ b/SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp
@@ -912,7 +912,7 @@ void CDiscAdjMultizoneDriver::Set_SolutionOld_To_Solution(unsigned short iZone)
for (unsigned short iSol=0; iSol < MAX_SOLS; iSol++) {
auto solver = solver_container[iZone][INST_0][MESH_0][iSol];
if (solver && solver->GetAdjoint())
- solver->GetNodes()->Set_OldSolution();
+ solver->Set_OldSolution();
}
}
diff --git a/SU2_CFD/src/integration/CFEM_DG_Integration.cpp b/SU2_CFD/src/integration/CFEM_DG_Integration.cpp
index 455466ddf07c..9f13106a8ed7 100644
--- a/SU2_CFD/src/integration/CFEM_DG_Integration.cpp
+++ b/SU2_CFD/src/integration/CFEM_DG_Integration.cpp
@@ -154,10 +154,10 @@ void CFEM_DG_Integration::Space_Integration(CGeometry *geometry,
if iStep == 0, set the old solution (working solution for the DG part),
and if needed, the new solution. ---*/
if (iStep == 0) {
- solver_container[MainSolver]->Set_OldSolution(geometry);
+ solver_container[MainSolver]->Set_OldSolution();
if (config->GetKind_TimeIntScheme() == CLASSICAL_RK4_EXPLICIT) {
- solver_container[MainSolver]->Set_NewSolution(geometry);
+ solver_container[MainSolver]->Set_NewSolution();
}
}
diff --git a/SU2_CFD/src/integration/CMultiGridIntegration.cpp b/SU2_CFD/src/integration/CMultiGridIntegration.cpp
index 537d7e8b7bcc..34592654fdbf 100644
--- a/SU2_CFD/src/integration/CMultiGridIntegration.cpp
+++ b/SU2_CFD/src/integration/CMultiGridIntegration.cpp
@@ -176,10 +176,10 @@ void CMultiGridIntegration::MultiGrid_Cycle(CGeometry ****geometry,
/*--- Set the old solution ---*/
- solver_fine->Set_OldSolution(geometry_fine);
+ solver_fine->Set_OldSolution();
if (classical_rk4)
- solver_fine->Set_NewSolution(geometry_fine);
+ solver_fine->Set_NewSolution();
/*--- Compute time step, max eigenvalue, and integration scheme (steady and unsteady problems) ---*/
@@ -269,9 +269,9 @@ void CMultiGridIntegration::MultiGrid_Cycle(CGeometry ****geometry,
solver_fine->Preprocessing(geometry_fine, solver_container_fine, config, iMesh, iRKStep, RunTime_EqSystem, false);
if (iRKStep == 0) {
- solver_fine->Set_OldSolution(geometry_fine);
+ solver_fine->Set_OldSolution();
- if (classical_rk4) solver_fine->Set_NewSolution(geometry_fine);
+ if (classical_rk4) solver_fine->Set_NewSolution();
solver_fine->SetTime_Step(geometry_fine, solver_container_fine, config, iMesh, config->GetTimeIter());
}
diff --git a/SU2_CFD/src/integration/CSingleGridIntegration.cpp b/SU2_CFD/src/integration/CSingleGridIntegration.cpp
index cda1d0830c22..521727ea66e7 100644
--- a/SU2_CFD/src/integration/CSingleGridIntegration.cpp
+++ b/SU2_CFD/src/integration/CSingleGridIntegration.cpp
@@ -55,7 +55,7 @@ void CSingleGridIntegration::SingleGrid_Iteration(CGeometry ****geometry, CSolve
/*--- Set the old solution ---*/
- solvers_fine[Solver_Position]->Set_OldSolution(geometry_fine);
+ solvers_fine[Solver_Position]->Set_OldSolution();
/*--- Time step evaluation ---*/
diff --git a/SU2_CFD/src/iteration_structure.cpp b/SU2_CFD/src/iteration_structure.cpp
index 734d14f96d44..d3df3c5d4311 100644
--- a/SU2_CFD/src/iteration_structure.cpp
+++ b/SU2_CFD/src/iteration_structure.cpp
@@ -1844,12 +1844,12 @@ void CDiscAdjFluidIteration::Preprocess(COutput *output,
/*--- Temporarily store the loaded solution in the Solution_Old array ---*/
for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) {
- solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->Set_OldSolution();
+ solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->Set_OldSolution();
if (turbulent) {
- solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->Set_OldSolution();
+ solver[val_iZone][val_iInst][iMesh][TURB_SOL]->Set_OldSolution();
}
if (heat) {
- solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_OldSolution();
+ solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->Set_OldSolution();
}
if (grid_IsMoving) {
for(iPoint=0; iPointGetnPoint();iPoint++) {
@@ -2969,7 +2969,7 @@ void CDiscAdjHeatIteration::Preprocess(COutput *output,
/*--- Temporarily store the loaded solution in the Solution_Old array ---*/
for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++)
- solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_OldSolution();
+ solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->Set_OldSolution();
/*--- Set Solution at timestep n to solution at n-1 ---*/
diff --git a/SU2_CFD/src/numerics/CNumerics.cpp b/SU2_CFD/src/numerics/CNumerics.cpp
index bf1ec07baee0..6748a830e10a 100644
--- a/SU2_CFD/src/numerics/CNumerics.cpp
+++ b/SU2_CFD/src/numerics/CNumerics.cpp
@@ -33,24 +33,24 @@
CNumerics::CNumerics(void) {
- Normal = NULL;
- UnitNormal = NULL;
- UnitNormald = NULL;
+ Normal = nullptr;
+ UnitNormal = nullptr;
+ UnitNormald = nullptr;
- Proj_Flux_Tensor = NULL;
- Flux_Tensor = NULL;
+ Proj_Flux_Tensor = nullptr;
+ Flux_Tensor = nullptr;
- tau = NULL;
- delta = NULL;
- delta3 = NULL;
+ tau = nullptr;
+ delta = nullptr;
+ delta3 = nullptr;
- Diffusion_Coeff_i = NULL;
- Diffusion_Coeff_j = NULL;
+ Diffusion_Coeff_i = nullptr;
+ Diffusion_Coeff_j = nullptr;
- Vector = NULL;
+ Vector = nullptr;
- l = NULL;
- m = NULL;
+ l = nullptr;
+ m = nullptr;
using_uq = false;
@@ -59,24 +59,12 @@ CNumerics::CNumerics(void) {
CNumerics::CNumerics(unsigned short val_nDim, unsigned short val_nVar,
const CConfig* config) {
- unsigned short iVar, iDim, jDim;
+ unsigned short iVar, iDim;
- Normal = NULL;
- UnitNormal = NULL;
- UnitNormald = NULL;
+ Normal = nullptr;
- Proj_Flux_Tensor = NULL;
- Flux_Tensor = NULL;
-
- tau = NULL;
- delta = NULL;
- delta3 = NULL;
-
- Diffusion_Coeff_i = NULL;
- Diffusion_Coeff_j = NULL;
-
- l = NULL;
- m = NULL;
+ Diffusion_Coeff_i = nullptr;
+ Diffusion_Coeff_j = nullptr;
nDim = val_nDim;
nVar = val_nVar;
@@ -86,51 +74,38 @@ CNumerics::CNumerics(unsigned short val_nDim, unsigned short val_nVar,
Prandtl_Turb = config->GetPrandtl_Turb();
Gas_Constant = config->GetGas_ConstantND();
- UnitNormal = new su2double [nDim];
- UnitNormald = new su2double [nDim];
+ UnitNormal = new su2double [nDim] ();
+ UnitNormald = new su2double [nDim] ();
Flux_Tensor = new su2double* [nVar];
for (iVar = 0; iVar < (nVar); iVar++)
- Flux_Tensor[iVar] = new su2double [nDim];
+ Flux_Tensor[iVar] = new su2double [nDim] ();
tau = new su2double* [nDim];
- for (iDim = 0; iDim < nDim; iDim++) {
- tau[iDim] = new su2double [nDim];
- }
+ for (iDim = 0; iDim < nDim; iDim++)
+ tau[iDim] = new su2double [nDim] ();
delta = new su2double* [nDim];
for (iDim = 0; iDim < nDim; iDim++) {
- delta[iDim] = new su2double [nDim];
- }
-
- for (iDim = 0; iDim < nDim; iDim++) {
- for (jDim = 0; jDim < nDim; jDim++) {
- if (iDim == jDim) delta[iDim][jDim] = 1.0;
- else delta[iDim][jDim]=0.0;
- }
+ delta[iDim] = new su2double [nDim] ();
+ delta[iDim][iDim] = 1.0;
}
delta3 = new su2double* [3];
for (iDim = 0; iDim < 3; iDim++) {
- delta3[iDim] = new su2double [3];
+ delta3[iDim] = new su2double [3] ();
+ delta3[iDim][iDim] = 1.0;
}
- for (iDim = 0; iDim < 3; iDim++) {
- for (jDim = 0; jDim < 3; jDim++) {
- if (iDim == jDim) delta3[iDim][jDim] = 1.0;
- else delta3[iDim][jDim]=0.0;
- }
- }
-
- Proj_Flux_Tensor = new su2double [nVar];
+ Proj_Flux_Tensor = new su2double [nVar] ();
turb_ke_i = 0.0;
turb_ke_j = 0.0;
- Vector = new su2double[nDim];
+ Vector = new su2double[nDim] ();
- l = new su2double [nDim];
- m = new su2double [nDim];
+ l = new su2double [nDim] ();
+ m = new su2double [nDim] ();
Dissipation_ij = 1.0;
@@ -175,46 +150,42 @@ CNumerics::CNumerics(unsigned short val_nDim, unsigned short val_nVar,
CNumerics::~CNumerics(void) {
- if (UnitNormal!= NULL) delete [] UnitNormal;
- if (UnitNormald!= NULL) delete [] UnitNormald;
+ delete [] UnitNormal;
+ delete [] UnitNormald;
// visc
- if (Proj_Flux_Tensor!= NULL) delete [] Proj_Flux_Tensor;
+ delete [] Proj_Flux_Tensor;
- if (Flux_Tensor!= NULL) {
- for (unsigned short iVar = 0; iVar < nVar; iVar++) {
+ if (Flux_Tensor) {
+ for (unsigned short iVar = 0; iVar < nVar; iVar++)
delete [] Flux_Tensor[iVar];
- }
delete [] Flux_Tensor;
}
- if (tau != NULL) {
- for (unsigned short iDim = 0; iDim < nDim; iDim++) {
+ if (tau) {
+ for (unsigned short iDim = 0; iDim < nDim; iDim++)
delete [] tau[iDim];
- }
delete [] tau;
}
- if (delta != NULL) {
- for (unsigned short iDim = 0; iDim < nDim; iDim++) {
+ if (delta) {
+ for (unsigned short iDim = 0; iDim < nDim; iDim++)
delete [] delta[iDim];
- }
delete [] delta;
}
- if (delta3 != NULL) {
- for (unsigned short iDim = 0; iDim < 3; iDim++) {
+ if (delta3) {
+ for (unsigned short iDim = 0; iDim < 3; iDim++)
delete [] delta3[iDim];
- }
delete [] delta3;
}
- if (Diffusion_Coeff_i != NULL) delete [] Diffusion_Coeff_i;
- if (Diffusion_Coeff_j != NULL) delete [] Diffusion_Coeff_j;
- if (Vector != NULL) delete [] Vector;
+ delete [] Diffusion_Coeff_i;
+ delete [] Diffusion_Coeff_j;
+ delete [] Vector;
- if (l != NULL) delete [] l;
- if (m != NULL) delete [] m;
+ delete [] l;
+ delete [] m;
if (using_uq) {
for (unsigned short iDim = 0; iDim < 3; iDim++){
@@ -275,11 +246,11 @@ void CNumerics::GetInviscidFlux(su2double val_density, su2double *val_velocity,
}
}
-void CNumerics::GetInviscidProjFlux(su2double *val_density,
- su2double *val_velocity,
- su2double *val_pressure,
- su2double *val_enthalpy,
- su2double *val_normal,
+void CNumerics::GetInviscidProjFlux(const su2double *val_density,
+ const su2double *val_velocity,
+ const su2double *val_pressure,
+ const su2double *val_enthalpy,
+ const su2double *val_normal,
su2double *val_Proj_Flux) {
su2double rhou, rhov, rhow;
@@ -328,13 +299,13 @@ void CNumerics::GetInviscidProjFlux(su2double *val_density,
}
-void CNumerics::GetInviscidIncProjFlux(su2double *val_density,
- su2double *val_velocity,
- su2double *val_pressure,
- su2double *val_betainc2,
- su2double *val_enthalpy,
- su2double *val_normal,
- su2double *val_Proj_Flux) {
+void CNumerics::GetInviscidIncProjFlux(const su2double *val_density,
+ const su2double *val_velocity,
+ const su2double *val_pressure,
+ const su2double *val_betainc2,
+ const su2double *val_enthalpy,
+ const su2double *val_normal,
+ su2double *val_Proj_Flux) {
su2double rhou, rhov, rhow;
if (nDim == 2) {
@@ -360,8 +331,8 @@ void CNumerics::GetInviscidIncProjFlux(su2double *val_density,
}
-void CNumerics::GetInviscidProjJac(su2double *val_velocity, su2double *val_energy,
- su2double *val_normal, su2double val_scale,
+void CNumerics::GetInviscidProjJac(const su2double *val_velocity, const su2double *val_energy,
+ const su2double *val_normal, su2double val_scale,
su2double **val_Proj_Jac_Tensor) {
AD_BEGIN_PASSIVE
unsigned short iDim, jDim;
@@ -398,10 +369,10 @@ void CNumerics::GetInviscidProjJac(su2double *val_velocity, su2double *val_energ
}
-void CNumerics::GetInviscidProjJac(su2double *val_velocity, su2double *val_enthalpy,
- su2double *val_chi, su2double *val_kappa,
- su2double *val_normal, su2double val_scale,
- su2double **val_Proj_Jac_Tensor) {
+void CNumerics::GetInviscidProjJac(const su2double *val_velocity, const su2double *val_enthalpy,
+ const su2double *val_chi, const su2double *val_kappa,
+ const su2double *val_normal, su2double val_scale,
+ su2double **val_Proj_Jac_Tensor) {
AD_BEGIN_PASSIVE
unsigned short iDim, jDim;
su2double sqvel, proj_vel, phi, a1, a2;
@@ -436,8 +407,11 @@ void CNumerics::GetInviscidProjJac(su2double *val_velocity, su2double *val_entha
AD_END_PASSIVE
}
-void CNumerics::GetInviscidIncProjJac(su2double *val_density, su2double *val_velocity, su2double *val_betainc2, su2double *val_cp, su2double *val_temperature, su2double *val_dRhodT, su2double *val_normal,
- su2double val_scale, su2double **val_Proj_Jac_Tensor) {
+void CNumerics::GetInviscidIncProjJac(const su2double *val_density, const su2double *val_velocity,
+ const su2double *val_betainc2, const su2double *val_cp,
+ const su2double *val_temperature, const su2double *val_dRhodT,
+ const su2double *val_normal, su2double val_scale,
+ su2double **val_Proj_Jac_Tensor) {
AD_BEGIN_PASSIVE
unsigned short iDim;
su2double proj_vel;
@@ -504,9 +478,10 @@ void CNumerics::GetInviscidIncProjJac(su2double *val_density, su2double *val_vel
AD_END_PASSIVE
}
-void CNumerics::GetPreconditioner(su2double *val_density, su2double *val_velocity,
- su2double *val_betainc2, su2double *val_cp,
- su2double *val_temperature, su2double *val_drhodt, su2double **val_Precon) {
+void CNumerics::GetPreconditioner(const su2double *val_density, const su2double *val_velocity,
+ const su2double *val_betainc2, const su2double *val_cp,
+ const su2double *val_temperature, const su2double *val_drhodt,
+ su2double **val_Precon) {
unsigned short iDim, jDim;
val_Precon[0][0] = 1.0/(*val_betainc2);
@@ -530,8 +505,9 @@ void CNumerics::GetPreconditioner(su2double *val_density, su2double *val_velocit
}
-void CNumerics::GetPreconditionedProjJac(su2double *val_density, su2double *val_lambda,
- su2double *val_betainc2, su2double *val_normal, su2double **val_invPrecon_A) {
+void CNumerics::GetPreconditionedProjJac(const su2double *val_density, const su2double *val_lambda,
+ const su2double *val_betainc2, const su2double *val_normal,
+ su2double **val_invPrecon_A) {
unsigned short iDim, jDim, kDim;
val_invPrecon_A[0][0] = val_lambda[nDim]/2.0 + val_lambda[nDim+1]/2.0;
@@ -562,8 +538,9 @@ void CNumerics::GetPreconditionedProjJac(su2double *val_density, su2double *val_
}
-void CNumerics::GetPMatrix(su2double *val_density, su2double *val_velocity,
- su2double *val_soundspeed, su2double *val_normal, su2double **val_p_tensor) {
+void CNumerics::GetPMatrix(const su2double *val_density, const su2double *val_velocity,
+ const su2double *val_soundspeed, const su2double *val_normal,
+ su2double **val_p_tensor) {
su2double sqvel, rhooc, rhoxc;
//su2double c2;
@@ -635,9 +612,10 @@ void CNumerics::GetPMatrix(su2double *val_density, su2double *val_velocity,
}
-void CNumerics::GetPMatrix(su2double *val_density, su2double *val_velocity, su2double *val_soundspeed,
- su2double *val_enthalpy, su2double *val_chi, su2double *val_kappa,
- su2double *val_normal, su2double **val_p_tensor) {
+void CNumerics::GetPMatrix(const su2double *val_density, const su2double *val_velocity,
+ const su2double *val_soundspeed, const su2double *val_enthalpy,
+ const su2double *val_chi, const su2double *val_kappa,
+ const su2double *val_normal, su2double **val_p_tensor) {
su2double sqvel, rhooc, zeta;
//su2double rhoxc, c2;
@@ -707,8 +685,8 @@ void CNumerics::GetPMatrix(su2double *val_density, su2double *val_velocity, su2d
}
-void CNumerics::GetPMatrix_inv(su2double *val_density, su2double *val_velocity,
- su2double *val_soundspeed, su2double *val_normal,
+void CNumerics::GetPMatrix_inv(const su2double *val_density, const su2double *val_velocity,
+ const su2double *val_soundspeed, const su2double *val_normal,
su2double **val_invp_tensor) {
su2double rhoxc, c2, gm1, k0orho, k1orho, gm1_o_c2, gm1_o_rhoxc, sqvel;
@@ -858,7 +836,7 @@ void CNumerics::GetPMatrix_inv(su2double **val_invp_tensor, su2double *val_densi
void CNumerics::GetinvRinvPe(su2double Beta2, su2double val_enthalpy,
su2double val_soundspeed, su2double val_density,
- su2double* val_velocity, su2double **invRinvPe) {
+ const su2double* val_velocity, su2double **invRinvPe) {
su2double sqvel;
su2double factor = 1.0/(val_soundspeed*val_soundspeed*Beta2);
@@ -927,7 +905,7 @@ void CNumerics::GetinvRinvPe(su2double Beta2, su2double val_enthalpy,
}
void CNumerics::GetRMatrix(su2double val_pressure, su2double val_soundspeed, su2double val_density,
- su2double* val_velocity, su2double **R_Matrix) {
+ const su2double* val_velocity, su2double **R_Matrix) {
su2double sqvel;
//su2double factor = 1.0/(val_soundspeed*val_soundspeed*1);
@@ -1323,8 +1301,8 @@ void CNumerics::GetPrecondJacobian(su2double Beta2, su2double r_hat, su2double s
}
-void CNumerics::GetJacInviscidLambda_fabs(su2double *val_velocity, su2double val_soundspeed,
- su2double *val_normal, su2double *val_Lambda_Vector) {
+void CNumerics::GetJacInviscidLambda_fabs(const su2double *val_velocity, su2double val_soundspeed,
+ const su2double *val_normal, su2double *val_Lambda_Vector) {
su2double ProjVelocity = 0;
for (unsigned short iDim = 0; iDim < nDim; iDim++)
@@ -1349,7 +1327,7 @@ void CNumerics::GetAdjViscousFlux_Jac(su2double Pressure_i, su2double Pressure_j
su2double ViscDens_i, su2double ViscDens_j, su2double *Velocity_i, su2double *Velocity_j,
su2double sq_vel_i, su2double sq_vel_j,
su2double XiDens_i, su2double XiDens_j, su2double **Mean_GradPhi, su2double *Mean_GradPsiE,
- su2double dPhiE_dn, su2double *Normal, su2double *Edge_Vector, su2double dist_ij_2, su2double *val_residual_i, su2double *val_residual_j,
+ su2double dPhiE_dn, const su2double *Normal, su2double *Edge_Vector, su2double dist_ij_2, su2double *val_residual_i, su2double *val_residual_j,
su2double **val_Jacobian_ii, su2double **val_Jacobian_ij, su2double **val_Jacobian_ji,
su2double **val_Jacobian_jj, bool implicit) {
@@ -1697,8 +1675,9 @@ void CNumerics::GetAdjViscousFlux_Jac(su2double Pressure_i, su2double Pressure_j
}
-void CNumerics::GetPrimitive2Conservative (su2double *val_Mean_PrimVar, su2double *val_Mean_SecVar, su2double **val_Jac_PC) {
-
+void CNumerics::GetPrimitive2Conservative (const su2double *val_Mean_PrimVar,
+ const su2double *val_Mean_SecVar,
+ su2double **val_Jac_PC) {
unsigned short iVar, jVar, iDim;
// order of primitives: T, vx, vy, vz, P, rho, h, c, MuLam, MuEddy, kt, Cp
diff --git a/SU2_CFD/src/numerics/turbulent/turb_diffusion.cpp b/SU2_CFD/src/numerics/turbulent/turb_diffusion.cpp
index 9c8ba317c580..cce266371604 100644
--- a/SU2_CFD/src/numerics/turbulent/turb_diffusion.cpp
+++ b/SU2_CFD/src/numerics/turbulent/turb_diffusion.cpp
@@ -37,16 +37,16 @@ CAvgGrad_Scalar::CAvgGrad_Scalar(unsigned short val_nDim,
implicit(config->GetKind_TimeIntScheme_Turb() == EULER_IMPLICIT),
incompressible(config->GetKind_Regime() == INCOMPRESSIBLE)
{
- Proj_Mean_GradTurbVar_Normal = new su2double [nVar];
- Proj_Mean_GradTurbVar_Edge = new su2double [nVar];
- Proj_Mean_GradTurbVar = new su2double [nVar];
+ Proj_Mean_GradTurbVar_Normal = new su2double [nVar] ();
+ Proj_Mean_GradTurbVar_Edge = new su2double [nVar] ();
+ Proj_Mean_GradTurbVar = new su2double [nVar] ();
- Flux = new su2double [nVar];
+ Flux = new su2double [nVar] ();
Jacobian_i = new su2double* [nVar];
Jacobian_j = new su2double* [nVar];
for (unsigned short iVar = 0; iVar < nVar; iVar++) {
- Jacobian_i[iVar] = new su2double [nVar];
- Jacobian_j[iVar] = new su2double [nVar];
+ Jacobian_i[iVar] = new su2double [nVar] ();
+ Jacobian_j[iVar] = new su2double [nVar] ();
}
}
diff --git a/SU2_CFD/src/solvers/CAdjEulerSolver.cpp b/SU2_CFD/src/solvers/CAdjEulerSolver.cpp
index be1ebaaca0ac..967918aa9d68 100644
--- a/SU2_CFD/src/solvers/CAdjEulerSolver.cpp
+++ b/SU2_CFD/src/solvers/CAdjEulerSolver.cpp
@@ -1716,9 +1716,9 @@ void CAdjEulerSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_co
/*--- Points in edge, normal, and neighbors---*/
- iPoint = geometry->edge[iEdge]->GetNode(0);
- jPoint = geometry->edge[iEdge]->GetNode(1);
- numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
+ 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());
/*--- Adjoint variables w/o reconstruction ---*/
@@ -1794,9 +1794,9 @@ void CAdjEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont
/*--- Points in edge and normal vectors ---*/
- iPoint = geometry->edge[iEdge]->GetNode(0);
- jPoint = geometry->edge[iEdge]->GetNode(1);
- numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
+ iPoint = geometry->edges->GetNode(iEdge,0);
+ jPoint = geometry->edges->GetNode(iEdge,1);
+ numerics->SetNormal(geometry->edges->GetNormal(iEdge));
/*--- Adjoint variables w/o reconstruction ---*/
@@ -2034,8 +2034,8 @@ void CAdjEulerSolver::SetUndivided_Laplacian(CGeometry *geometry, CConfig *confi
nodes->SetUnd_LaplZero();
for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
- iPoint = geometry->edge[iEdge]->GetNode(0);
- jPoint = geometry->edge[iEdge]->GetNode(1);
+ iPoint = geometry->edges->GetNode(iEdge,0);
+ jPoint = geometry->edges->GetNode(iEdge,1);
for (iVar = 0; iVar < nVar; iVar++)
Diff[iVar] = nodes->GetSolution(iPoint,iVar) - nodes->GetSolution(jPoint,iVar);
diff --git a/SU2_CFD/src/solvers/CAdjNSSolver.cpp b/SU2_CFD/src/solvers/CAdjNSSolver.cpp
index aa2d87de7887..9123db566c21 100644
--- a/SU2_CFD/src/solvers/CAdjNSSolver.cpp
+++ b/SU2_CFD/src/solvers/CAdjNSSolver.cpp
@@ -429,11 +429,11 @@ void CAdjNSSolver::Viscous_Residual(CGeometry *geometry, CSolver **solver_contai
/*--- Points in edge, coordinates and normal vector---*/
- iPoint = geometry->edge[iEdge]->GetNode(0);
- jPoint = geometry->edge[iEdge]->GetNode(1);
+ iPoint = geometry->edges->GetNode(iEdge,0);
+ jPoint = geometry->edges->GetNode(iEdge,1);
numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[jPoint]->GetCoord());
- numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
+ numerics->SetNormal(geometry->edges->GetNormal(iEdge));
/*--- Primitive variables w/o reconstruction and adjoint variables w/o reconstruction---*/
@@ -536,9 +536,9 @@ void CAdjNSSolver::Source_Residual(CGeometry *geometry, CSolver **solver_contain
/*--- Points in edge, and normal vector ---*/
- iPoint = geometry->edge[iEdge]->GetNode(0);
- jPoint = geometry->edge[iEdge]->GetNode(1);
- second_numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
+ iPoint = geometry->edges->GetNode(iEdge,0);
+ jPoint = geometry->edges->GetNode(iEdge,1);
+ second_numerics->SetNormal(geometry->edges->GetNormal(iEdge));
/*--- Conservative variables w/o reconstruction ---*/
diff --git a/SU2_CFD/src/solvers/CAdjTurbSolver.cpp b/SU2_CFD/src/solvers/CAdjTurbSolver.cpp
index d2bb13098b9d..63dbc706e26b 100644
--- a/SU2_CFD/src/solvers/CAdjTurbSolver.cpp
+++ b/SU2_CFD/src/solvers/CAdjTurbSolver.cpp
@@ -305,8 +305,8 @@ void CAdjTurbSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_conta
for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
/*--- Points in edge ---*/
- iPoint = geometry->edge[iEdge]->GetNode(0);
- jPoint = geometry->edge[iEdge]->GetNode(1);
+ iPoint = geometry->edges->GetNode(iEdge,0);
+ jPoint = geometry->edges->GetNode(iEdge,1);
/*--- Conservative variables w/o reconstruction ---*/
U_i = solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint);
@@ -314,7 +314,7 @@ void CAdjTurbSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_conta
numerics->SetConservative(U_i, U_j);
/*--- Set normal vectors and length ---*/
- numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
+ numerics->SetNormal(geometry->edges->GetNormal(iEdge));
/*--- Turbulent adjoint variables w/o reconstruction ---*/
TurbPsi_i = nodes->GetSolution(iPoint);
@@ -327,7 +327,7 @@ void CAdjTurbSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_conta
numerics->SetTurbVarGradient(TurbVar_Grad_i, TurbVar_Grad_j);
/*--- Set normal vectors and length ---*/
- numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
+ numerics->SetNormal(geometry->edges->GetNormal(iEdge));
numerics->ComputeResidual(Residual_i, Residual_j, Jacobian_ii, Jacobian_ij, Jacobian_ji, Jacobian_jj, config);
@@ -354,14 +354,14 @@ void CAdjTurbSolver::Viscous_Residual(CGeometry *geometry, CSolver **solver_cont
for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
/*--- Points in edge ---*/
- iPoint = geometry->edge[iEdge]->GetNode(0);
- jPoint = geometry->edge[iEdge]->GetNode(1);
+ iPoint = geometry->edges->GetNode(iEdge,0);
+ 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();
numerics->SetCoord(Coord_i, Coord_j);
- numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
+ numerics->SetNormal(geometry->edges->GetNormal(iEdge));
/*--- Conservative variables w/o reconstruction, turbulent variables w/o reconstruction,
and turbulent adjoint variables w/o reconstruction ---*/
@@ -451,8 +451,8 @@ void CAdjTurbSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta
// for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
//
// /*--- Points in edge ---*/
-// iPoint = geometry->edge[iEdge]->GetNode(0);
-// jPoint = geometry->edge[iEdge]->GetNode(1);
+// iPoint = geometry->edges->GetNode(iEdge,0);
+// jPoint = geometry->edges->GetNode(iEdge,1);
//
// /*--- Gradient of turbulent variables w/o reconstruction ---*/
// TurbVar_Grad_i = solver_container[TURB_SOL]->GetNodes()->GetGradient(iPoint);
@@ -465,7 +465,7 @@ void CAdjTurbSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta
// second_numerics->SetTurbAdjointVar(TurbPsi_i, TurbPsi_j);
//
// /*--- Set normal vectors and length ---*/
-// second_numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
+// second_numerics->SetNormal(geometry->edges->GetNormal(iEdge));
//
// /*--- Add and Subtract Residual ---*/
// second_numerics->ComputeResidual(Residual, Jacobian_ii, Jacobian_jj, config);
diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp
index 5c97dcd97699..18ae2bacd76e 100644
--- a/SU2_CFD/src/solvers/CEulerSolver.cpp
+++ b/SU2_CFD/src/solvers/CEulerSolver.cpp
@@ -2725,7 +2725,7 @@ void CEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
auto node_j = geometry->node[jPoint];
iEdge = node_i->GetEdge(iNeigh);
- Normal = geometry->edge[iEdge]->GetNormal();
+ Normal = geometry->edges->GetNormal(iEdge);
Area = 0.0; for (iDim = 0; iDim < nDim; iDim++) Area += pow(Normal[iDim],2); Area = sqrt(Area);
/*--- Mean Values ---*/
@@ -2958,10 +2958,10 @@ void CEulerSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_conta
/*--- Points in edge, set normal vectors, and number of neighbors ---*/
- auto iPoint = geometry->edge[iEdge]->GetNode(0);
- auto jPoint = geometry->edge[iEdge]->GetNode(1);
+ auto iPoint = geometry->edges->GetNode(iEdge,0);
+ auto jPoint = geometry->edges->GetNode(iEdge,1);
- numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
+ numerics->SetNormal(geometry->edges->GetNormal(iEdge));
numerics->SetNeighbor(geometry->node[iPoint]->GetnNeighbor(), geometry->node[jPoint]->GetnNeighbor());
/*--- Set primitive variables w/o reconstruction ---*/
@@ -3062,10 +3062,10 @@ void CEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_contain
/*--- Points in edge and normal vectors ---*/
- auto iPoint = geometry->edge[iEdge]->GetNode(0);
- auto jPoint = geometry->edge[iEdge]->GetNode(1);
+ auto iPoint = geometry->edges->GetNode(iEdge,0);
+ auto jPoint = geometry->edges->GetNode(iEdge,1);
- numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
+ numerics->SetNormal(geometry->edges->GetNormal(iEdge));
auto Coord_i = geometry->node[iPoint]->GetCoord();
auto Coord_j = geometry->node[jPoint]->GetCoord();
@@ -3277,7 +3277,7 @@ void CEulerSolver::SumEdgeFluxes(CGeometry* geometry) {
auto iEdge = geometry->node[iPoint]->GetEdge(iNeigh);
- if (iPoint == geometry->edge[iEdge]->GetNode(0))
+ if (iPoint == geometry->edges->GetNode(iEdge,0))
LinSysRes.AddBlock(iPoint, EdgeFluxes.GetBlock(iEdge));
else
LinSysRes.SubtractBlock(iPoint, EdgeFluxes.GetBlock(iEdge));
@@ -3573,7 +3573,7 @@ void CEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) {
auto jPoint = geometry->node[iPoint]->GetPoint(iNeigh);
auto iEdge = geometry->node[iPoint]->GetEdge(iNeigh);
- auto Normal = geometry->edge[iEdge]->GetNormal();
+ auto Normal = geometry->edges->GetNormal(iEdge);
su2double Area = 0.0;
for (unsigned short iDim = 0; iDim < nDim; iDim++) Area += pow(Normal[iDim],2);
Area = sqrt(Area);
@@ -11280,13 +11280,13 @@ void CEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_co
for (iNeigh = 0; iNeigh < geometry->node[iPoint]->GetnNeighbor(); iNeigh++) {
iEdge = geometry->node[iPoint]->GetEdge(iNeigh);
- Normal = geometry->edge[iEdge]->GetNormal();
+ Normal = geometry->edges->GetNormal(iEdge);
jPoint = geometry->node[iPoint]->GetPoint(iNeigh);
GridVel_j = geometry->node[jPoint]->GetGridVel();
/*--- Determine whether to consider the normal outward or inward. ---*/
- su2double dir = (geometry->edge[iEdge]->GetNode(0) == iPoint)? 0.5 : -0.5;
+ su2double dir = (geometry->edges->GetNode(iEdge,0) == iPoint)? 0.5 : -0.5;
Residual_GCL = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
diff --git a/SU2_CFD/src/solvers/CFEM_DG_EulerSolver.cpp b/SU2_CFD/src/solvers/CFEM_DG_EulerSolver.cpp
index 08c2a322f3cf..c5a9ebed1d53 100644
--- a/SU2_CFD/src/solvers/CFEM_DG_EulerSolver.cpp
+++ b/SU2_CFD/src/solvers/CFEM_DG_EulerSolver.cpp
@@ -3444,7 +3444,7 @@ void CFEM_DG_EulerSolver::ComputeSpatialJacobian(CGeometry *geometry, CSolver *
nNonZeroEntries[i+1] = nNonZeroEntries[i] + nonZeroEntriesJacobian[i].size();
/* Copy the solution into the working variables. */
- Set_OldSolution(geometry);
+ Set_OldSolution();
/* Allocate the memory for local part of the Jacobian. Note that passivedouble
must be used for the Jacobian matrix. */
@@ -3574,12 +3574,12 @@ void CFEM_DG_EulerSolver::ComputeSpatialJacobian(CGeometry *geometry, CSolver *
}
}
-void CFEM_DG_EulerSolver::Set_OldSolution(CGeometry *geometry) {
+void CFEM_DG_EulerSolver::Set_OldSolution() {
memcpy(VecWorkSolDOFs[0].data(), VecSolDOFs.data(), VecSolDOFs.size()*sizeof(su2double));
}
-void CFEM_DG_EulerSolver::Set_NewSolution(CGeometry *geometry) {
+void CFEM_DG_EulerSolver::Set_NewSolution() {
memcpy(VecSolDOFsNew.data(), VecSolDOFs.data(), VecSolDOFs.size()*sizeof(su2double));
}
diff --git a/SU2_CFD/src/solvers/CHeatSolver.cpp b/SU2_CFD/src/solvers/CHeatSolver.cpp
index 1a919c472cf5..65ce69480f48 100644
--- a/SU2_CFD/src/solvers/CHeatSolver.cpp
+++ b/SU2_CFD/src/solvers/CHeatSolver.cpp
@@ -465,8 +465,8 @@ void CHeatSolver::SetUndivided_Laplacian(CGeometry *geometry, CConfig *config) {
for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
- iPoint = geometry->edge[iEdge]->GetNode(0);
- jPoint = geometry->edge[iEdge]->GetNode(1);
+ iPoint = geometry->edges->GetNode(iEdge,0);
+ jPoint = geometry->edges->GetNode(iEdge,1);
/*--- Solution differences ---*/
@@ -523,9 +523,9 @@ void CHeatSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_contai
for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
/*--- Points in edge ---*/
- iPoint = geometry->edge[iEdge]->GetNode(0);
- jPoint = geometry->edge[iEdge]->GetNode(1);
- numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
+ iPoint = geometry->edges->GetNode(iEdge,0);
+ jPoint = geometry->edges->GetNode(iEdge,1);
+ numerics->SetNormal(geometry->edges->GetNormal(iEdge));
/*--- Primitive variables w/o reconstruction ---*/
V_i = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint);
@@ -574,9 +574,9 @@ void CHeatSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_containe
for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
/*--- Points in edge ---*/
- iPoint = geometry->edge[iEdge]->GetNode(0);
- jPoint = geometry->edge[iEdge]->GetNode(1);
- numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
+ iPoint = geometry->edges->GetNode(iEdge,0);
+ jPoint = geometry->edges->GetNode(iEdge,1);
+ numerics->SetNormal(geometry->edges->GetNormal(iEdge));
/*--- Primitive variables w/o reconstruction ---*/
V_i = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint);
@@ -673,14 +673,14 @@ void CHeatSolver::Viscous_Residual(CGeometry *geometry, CSolver **solver_contain
for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
- iPoint = geometry->edge[iEdge]->GetNode(0);
- jPoint = geometry->edge[iEdge]->GetNode(1);
+ iPoint = geometry->edges->GetNode(iEdge,0);
+ jPoint = geometry->edges->GetNode(iEdge,1);
/*--- Points coordinates, and normal vector ---*/
numerics->SetCoord(geometry->node[iPoint]->GetCoord(),
geometry->node[jPoint]->GetCoord());
- numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
+ numerics->SetNormal(geometry->edges->GetNormal(iEdge));
Temp_i_Grad = nodes->GetGradient(iPoint);
Temp_j_Grad = nodes->GetGradient(jPoint);
@@ -1321,8 +1321,9 @@ void CHeatSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
unsigned short iDim, iMarker;
unsigned long iEdge, iVertex, iPoint = 0, jPoint = 0;
- su2double *Normal, Area, Vol, laminar_viscosity, eddy_viscosity, thermal_diffusivity, Prandtl_Lam, Prandtl_Turb, Mean_ProjVel, Mean_BetaInc2, Mean_DensityInc, Mean_SoundSpeed, Lambda;
+ su2double Area, Vol, laminar_viscosity, eddy_viscosity, thermal_diffusivity, Prandtl_Lam, Prandtl_Turb, Mean_ProjVel, Mean_BetaInc2, Mean_DensityInc, Mean_SoundSpeed, Lambda;
su2double Global_Delta_Time = 0.0, Global_Delta_UnstTimeND = 0.0, Local_Delta_Time = 0.0, Local_Delta_Time_Inv, Local_Delta_Time_Visc, CFL_Reduction, K_v = 0.25;
+ const su2double* Normal;
bool flow = ((config->GetKind_Solver() == INC_NAVIER_STOKES)
|| (config->GetKind_Solver() == INC_RANS)
@@ -1355,11 +1356,11 @@ void CHeatSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
- iPoint = geometry->edge[iEdge]->GetNode(0);
- jPoint = geometry->edge[iEdge]->GetNode(1);
+ iPoint = geometry->edges->GetNode(iEdge,0);
+ jPoint = geometry->edges->GetNode(iEdge,1);
/*--- get the edge's normal vector to compute the edge's area ---*/
- Normal = geometry->edge[iEdge]->GetNormal();
+ Normal = geometry->edges->GetNormal(iEdge);
Area = 0; for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; Area = sqrt(Area);
/*--- Inviscid contribution ---*/
diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp
index 5232b9a95a08..17903a2ae478 100644
--- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp
+++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp
@@ -1607,9 +1607,10 @@ unsigned long CIncEulerSolver::SetPrimitive_Variables(CSolver **solver_container
void CIncEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, CConfig *config,
unsigned short iMesh, unsigned long Iteration) {
- su2double *Normal, Area, Vol, Mean_SoundSpeed = 0.0, Mean_ProjVel = 0.0,
+ su2double Area, Vol, Mean_SoundSpeed = 0.0, Mean_ProjVel = 0.0,
Mean_BetaInc2, Lambda, Local_Delta_Time,
Global_Delta_Time = 1E6, Global_Delta_UnstTimeND, ProjVel, ProjVel_i, ProjVel_j;
+ const su2double* Normal;
unsigned long iEdge, iVertex, iPoint, jPoint;
unsigned short iDim, iMarker;
@@ -1632,10 +1633,10 @@ void CIncEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_contain
/*--- Point identification, Normal vector and area ---*/
- iPoint = geometry->edge[iEdge]->GetNode(0);
- jPoint = geometry->edge[iEdge]->GetNode(1);
+ iPoint = geometry->edges->GetNode(iEdge,0);
+ jPoint = geometry->edges->GetNode(iEdge,1);
- Normal = geometry->edge[iEdge]->GetNormal();
+ Normal = geometry->edges->GetNormal(iEdge);
Area = 0.0;
for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim];
@@ -1826,8 +1827,8 @@ void CIncEulerSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_co
/*--- Points in edge, set normal vectors, and number of neighbors ---*/
- iPoint = geometry->edge[iEdge]->GetNode(0); jPoint = geometry->edge[iEdge]->GetNode(1);
- numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
+ 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());
/*--- Set primitive variables w/o reconstruction ---*/
@@ -1892,8 +1893,8 @@ void CIncEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont
/*--- Points in edge and normal vectors ---*/
- iPoint = geometry->edge[iEdge]->GetNode(0); jPoint = geometry->edge[iEdge]->GetNode(1);
- numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
+ iPoint = geometry->edges->GetNode(iEdge,0); jPoint = geometry->edges->GetNode(iEdge,1);
+ numerics->SetNormal(geometry->edges->GetNormal(iEdge));
/*--- Grid movement ---*/
@@ -2314,8 +2315,9 @@ void CIncEulerSolver::Source_Template(CGeometry *geometry, CSolver **solver_cont
void CIncEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) {
- su2double *Normal, Area, Mean_SoundSpeed = 0.0, Mean_ProjVel = 0.0,
+ su2double Area, Mean_SoundSpeed = 0.0, Mean_ProjVel = 0.0,
Mean_BetaInc2, Lambda, ProjVel, ProjVel_i, ProjVel_j, *GridVel, *GridVel_i, *GridVel_j;
+ const su2double* Normal;
unsigned long iEdge, iVertex, iPoint, jPoint;
unsigned short iDim, iMarker;
@@ -2332,10 +2334,10 @@ void CIncEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) {
/*--- Point identification, Normal vector and area ---*/
- iPoint = geometry->edge[iEdge]->GetNode(0);
- jPoint = geometry->edge[iEdge]->GetNode(1);
+ iPoint = geometry->edges->GetNode(iEdge,0);
+ jPoint = geometry->edges->GetNode(iEdge,1);
- Normal = geometry->edge[iEdge]->GetNormal();
+ Normal = geometry->edges->GetNormal(iEdge);
Area = 0.0;
for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim];
Area = sqrt(Area);
@@ -2436,8 +2438,8 @@ void CIncEulerSolver::SetUndivided_Laplacian(CGeometry *geometry, CConfig *confi
for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
- iPoint = geometry->edge[iEdge]->GetNode(0);
- jPoint = geometry->edge[iEdge]->GetNode(1);
+ iPoint = geometry->edges->GetNode(iEdge,0);
+ jPoint = geometry->edges->GetNode(iEdge,1);
/*--- Solution differences ---*/
@@ -2499,8 +2501,8 @@ void CIncEulerSolver::SetCentered_Dissipation_Sensor(CGeometry *geometry, CConfi
for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
- iPoint = geometry->edge[iEdge]->GetNode(0);
- jPoint = geometry->edge[iEdge]->GetNode(1);
+ iPoint = geometry->edges->GetNode(iEdge,0);
+ jPoint = geometry->edges->GetNode(iEdge,1);
/*--- Get the pressure, or density for incompressible solvers ---*/
@@ -5171,7 +5173,8 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
su2double *V_time_nM1, *V_time_n, *V_time_nP1;
su2double U_time_nM1[5], U_time_n[5], U_time_nP1[5];
su2double Volume_nM1, Volume_nP1, TimeStep;
- su2double *Normal = NULL, *GridVel_i = NULL, *GridVel_j = NULL, Residual_GCL;
+ su2double *GridVel_i = NULL, *GridVel_j = NULL, Residual_GCL;
+ const su2double* Normal;
bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
bool energy = config->GetEnergy_Equation();
@@ -5303,9 +5306,9 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
/*--- Get indices for nodes i & j plus the face normal ---*/
- iPoint = geometry->edge[iEdge]->GetNode(0);
- jPoint = geometry->edge[iEdge]->GetNode(1);
- Normal = geometry->edge[iEdge]->GetNormal();
+ iPoint = geometry->edges->GetNode(iEdge,0);
+ jPoint = geometry->edges->GetNode(iEdge,1);
+ Normal = geometry->edges->GetNormal(iEdge);
/*--- Grid velocities stored at nodes i & j ---*/
diff --git a/SU2_CFD/src/solvers/CIncNSSolver.cpp b/SU2_CFD/src/solvers/CIncNSSolver.cpp
index bcf97f59b4a4..b369c8867906 100644
--- a/SU2_CFD/src/solvers/CIncNSSolver.cpp
+++ b/SU2_CFD/src/solvers/CIncNSSolver.cpp
@@ -853,11 +853,12 @@ unsigned long CIncNSSolver::SetPrimitive_Variables(CSolver **solver_container, C
void CIncNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned long Iteration) {
- su2double Mean_BetaInc2, *Normal, Area, Vol, Mean_SoundSpeed = 0.0, Mean_ProjVel = 0.0, Lambda, Local_Delta_Time, Local_Delta_Time_Visc,
+ su2double Mean_BetaInc2, Area, Vol, Mean_SoundSpeed = 0.0, Mean_ProjVel = 0.0, Lambda, Local_Delta_Time, Local_Delta_Time_Visc,
Global_Delta_Time = 1E6, Mean_LaminarVisc = 0.0, Mean_EddyVisc = 0.0, Mean_Density = 0.0, Mean_Thermal_Conductivity = 0.0, Mean_Cv = 0.0, Lambda_1, Lambda_2, K_v = 0.25, Global_Delta_UnstTimeND;
unsigned long iEdge, iVertex, iPoint = 0, jPoint = 0;
unsigned short iDim, iMarker;
su2double ProjVel, ProjVel_i, ProjVel_j;
+ const su2double* Normal;
bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
bool dual_time = ((config->GetTime_Marching() == DT_STEPPING_1ST) ||
@@ -879,10 +880,10 @@ void CIncNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
/*--- Point identification, Normal vector and area ---*/
- iPoint = geometry->edge[iEdge]->GetNode(0);
- jPoint = geometry->edge[iEdge]->GetNode(1);
+ iPoint = geometry->edges->GetNode(iEdge,0);
+ jPoint = geometry->edges->GetNode(iEdge,1);
- Normal = geometry->edge[iEdge]->GetNormal();
+ Normal = geometry->edges->GetNormal(iEdge);
Area = 0; for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; Area = sqrt(Area);
/*--- Mean Values ---*/
@@ -1096,11 +1097,11 @@ void CIncNSSolver::Viscous_Residual(CGeometry *geometry, CSolver **solver_contai
/*--- Points, coordinates and normal vector in edge ---*/
- iPoint = geometry->edge[iEdge]->GetNode(0);
- jPoint = geometry->edge[iEdge]->GetNode(1);
+ iPoint = geometry->edges->GetNode(iEdge,0);
+ jPoint = geometry->edges->GetNode(iEdge,1);
numerics->SetCoord(geometry->node[iPoint]->GetCoord(),
geometry->node[jPoint]->GetCoord());
- numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
+ numerics->SetNormal(geometry->edges->GetNormal(iEdge));
/*--- Primitive and secondary variables ---*/
diff --git a/SU2_CFD/src/solvers/CNSSolver.cpp b/SU2_CFD/src/solvers/CNSSolver.cpp
index ee9cab7c11ec..b2bae06ab55a 100644
--- a/SU2_CFD/src/solvers/CNSSolver.cpp
+++ b/SU2_CFD/src/solvers/CNSSolver.cpp
@@ -315,13 +315,13 @@ void CNSSolver::Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CSolv
/*--- Points, coordinates and normal vector in edge ---*/
- auto iPoint = geometry->edge[iEdge]->GetNode(0);
- auto jPoint = geometry->edge[iEdge]->GetNode(1);
+ 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->SetNormal(geometry->edge[iEdge]->GetNormal());
+ numerics->SetNormal(geometry->edges->GetNormal(iEdge));
/*--- Primitive and secondary variables. ---*/
diff --git a/SU2_CFD/src/solvers/CRadP1Solver.cpp b/SU2_CFD/src/solvers/CRadP1Solver.cpp
index 51a1b26d6a9f..3cc014fc91b8 100644
--- a/SU2_CFD/src/solvers/CRadP1Solver.cpp
+++ b/SU2_CFD/src/solvers/CRadP1Solver.cpp
@@ -221,14 +221,14 @@ void CRadP1Solver::Viscous_Residual(CGeometry *geometry, CSolver **solver_contai
/*--- Points in edge ---*/
- iPoint = geometry->edge[iEdge]->GetNode(0);
- jPoint = geometry->edge[iEdge]->GetNode(1);
+ iPoint = geometry->edges->GetNode(iEdge,0);
+ jPoint = geometry->edges->GetNode(iEdge,1);
/*--- Points coordinates, and normal vector ---*/
numerics->SetCoord(geometry->node[iPoint]->GetCoord(),
geometry->node[jPoint]->GetCoord());
- numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
+ numerics->SetNormal(geometry->edges->GetNormal(iEdge));
/*--- Radiation variables w/o reconstruction, and its gradients ---*/
@@ -601,10 +601,11 @@ void CRadP1Solver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
unsigned short iDim, iMarker;
unsigned long iEdge, iVertex, iPoint = 0, jPoint = 0;
- su2double *Normal, Area, Vol, Lambda;
+ su2double Area, Vol, Lambda;
su2double Global_Delta_Time = 1E6, Local_Delta_Time = 0.0, K_v = 0.25;
su2double CFL = config->GetCFL_Rad();
su2double GammaP1 = 1.0 / (3.0*(Absorption_Coeff + Scattering_Coeff));
+ const su2double* Normal;
/*--- Compute spectral radius based on thermal conductivity ---*/
@@ -618,11 +619,11 @@ void CRadP1Solver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
- iPoint = geometry->edge[iEdge]->GetNode(0);
- jPoint = geometry->edge[iEdge]->GetNode(1);
+ iPoint = geometry->edges->GetNode(iEdge,0);
+ jPoint = geometry->edges->GetNode(iEdge,1);
/*--- Get the edge's normal vector to compute the edge's area ---*/
- Normal = geometry->edge[iEdge]->GetNormal();
+ Normal = geometry->edges->GetNormal(iEdge);
Area = 0; for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; Area = sqrt(Area);
/*--- Viscous contribution ---*/
diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp
index df895dc71013..8bffbfd17c6d 100644
--- a/SU2_CFD/src/solvers/CSolver.cpp
+++ b/SU2_CFD/src/solvers/CSolver.cpp
@@ -2729,14 +2729,15 @@ void CSolver::SetRotatingFrame_GCL(CGeometry *geometry, CConfig *config) {
unsigned short iDim, nDim = geometry->GetnDim(), iVar, nVar = GetnVar(), iMarker;
unsigned long iVertex, iEdge;
- su2double ProjGridVel, *Normal;
+ su2double ProjGridVel;
+ const su2double* Normal;
/*--- Loop interior edges ---*/
for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
- const unsigned long iPoint = geometry->edge[iEdge]->GetNode(0);
- const unsigned long jPoint = geometry->edge[iEdge]->GetNode(1);
+ const unsigned long iPoint = geometry->edges->GetNode(iEdge,0);
+ const unsigned long jPoint = geometry->edges->GetNode(iEdge,1);
/*--- Solution at each edge point ---*/
@@ -2753,7 +2754,7 @@ void CSolver::SetRotatingFrame_GCL(CGeometry *geometry, CConfig *config) {
for (iDim = 0; iDim < nDim; iDim++)
Vector[iDim] = 0.5* (GridVel_i[iDim] + GridVel_j[iDim]);
- Normal = geometry->edge[iEdge]->GetNormal();
+ Normal = geometry->edges->GetNormal(iEdge);
ProjGridVel = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
diff --git a/SU2_CFD/src/solvers/CTransLMSolver.cpp b/SU2_CFD/src/solvers/CTransLMSolver.cpp
index b80ffa45311b..afe2182b6aba 100644
--- a/SU2_CFD/src/solvers/CTransLMSolver.cpp
+++ b/SU2_CFD/src/solvers/CTransLMSolver.cpp
@@ -270,9 +270,9 @@ void CTransLMSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_conta
for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
/*--- Points in edge and normal vectors ---*/
- iPoint = geometry->edge[iEdge]->GetNode(0);
- jPoint = geometry->edge[iEdge]->GetNode(1);
- numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
+ iPoint = geometry->edges->GetNode(iEdge,0);
+ jPoint = geometry->edges->GetNode(iEdge,1);
+ numerics->SetNormal(geometry->edges->GetNormal(iEdge));
/*--- Conservative variables w/o reconstruction ---*/
U_i = solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint);
@@ -307,14 +307,14 @@ void CTransLMSolver::Viscous_Residual(CGeometry *geometry, CSolver **solver_cont
for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
/*--- Points in edge ---*/
- iPoint = geometry->edge[iEdge]->GetNode(0);
- jPoint = geometry->edge[iEdge]->GetNode(1);
+ iPoint = geometry->edges->GetNode(iEdge,0);
+ jPoint = geometry->edges->GetNode(iEdge,1);
/*--- Points coordinates, and normal vector ---*/
numerics->SetCoord(geometry->node[iPoint]->GetCoord(),
geometry->node[jPoint]->GetCoord());
- numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
+ numerics->SetNormal(geometry->edges->GetNormal(iEdge));
/*--- Conservative variables w/o reconstruction ---*/
numerics->SetConservative(solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint),
diff --git a/SU2_CFD/src/solvers/CTurbSASolver.cpp b/SU2_CFD/src/solvers/CTurbSASolver.cpp
index a9f9fe88b4d6..dd24b8d171be 100644
--- a/SU2_CFD/src/solvers/CTurbSASolver.cpp
+++ b/SU2_CFD/src/solvers/CTurbSASolver.cpp
@@ -1517,129 +1517,6 @@ void CTurbSASolver::BC_Interface_Boundary(CGeometry *geometry, CSolver **solver_
//
}
-void CTurbSASolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_container,
- CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config){
-
- unsigned long iVertex, jVertex, iPoint, Point_Normal = 0;
- unsigned short iDim, iVar, jVar, iMarker;
-
- unsigned short nPrimVar = solver_container[FLOW_SOL]->GetnPrimVar();
- su2double Normal[MAXNDIM] = {0.0};
- su2double *PrimVar_i = new su2double[nPrimVar];
- su2double *PrimVar_j = new su2double[nPrimVar];
-
- unsigned long nDonorVertex;
- su2double weight;
-
- for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
-
- if (config->GetMarker_All_KindBC(iMarker) == FLUID_INTERFACE) {
-
- for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
-
- iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- Point_Normal = geometry->vertex[iMarker][iVertex]->GetNormal_Neighbor();
-
- if (geometry->node[iPoint]->GetDomain()) {
-
- nDonorVertex = GetnSlidingStates(iMarker, iVertex);
-
- /*--- Initialize Residual, this will serve to accumulate the average ---*/
-
- for (iVar = 0; iVar < nVar; iVar++) {
- Residual[iVar] = 0.0;
- for (jVar = 0; jVar < nVar; jVar++)
- Jacobian_i[iVar][jVar] = 0.0;
- }
-
- /*--- Loop over the nDonorVertexes and compute the averaged flux ---*/
-
- for (jVertex = 0; jVertex < nDonorVertex; jVertex++) {
-
- geometry->vertex[iMarker][iVertex]->GetNormal(Normal);
- for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim];
-
- for (iVar = 0; iVar < nPrimVar; iVar++) {
- PrimVar_i[iVar] = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint,iVar);
- PrimVar_j[iVar] = solver_container[FLOW_SOL]->GetSlidingState(iMarker, iVertex, iVar, jVertex);
- }
-
- /*--- Get the weight computed in the interpolator class for the j-th donor vertex ---*/
-
- weight = solver_container[FLOW_SOL]->GetSlidingState(iMarker, iVertex, nPrimVar, jVertex);
-
- /*--- Set primitive variables ---*/
-
- conv_numerics->SetPrimitive( PrimVar_i, PrimVar_j );
-
- /*--- Set the turbulent variable states ---*/
- Solution_i[0] = nodes->GetSolution(iPoint,0);
- Solution_j[0] = GetSlidingState(iMarker, iVertex, 0, jVertex);
-
- conv_numerics->SetTurbVar(Solution_i, Solution_j);
- /*--- Set the normal vector ---*/
-
- conv_numerics->SetNormal(Normal);
-
- if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
-
- /*--- Compute the convective residual using an upwind scheme ---*/
-
- auto residual = conv_numerics->ComputeResidual(config);
-
- /*--- Accumulate the residuals to compute the average ---*/
-
- for (iVar = 0; iVar < nVar; iVar++) {
- Residual[iVar] += weight*residual.residual[iVar];
- for (jVar = 0; jVar < nVar; jVar++)
- Jacobian_i[iVar][jVar] += weight*residual.jacobian_i[iVar][jVar];
- }
- }
-
- /*--- Add Residuals and Jacobians ---*/
-
- LinSysRes.AddBlock(iPoint, Residual);
-
- Jacobian.AddBlock2Diag(iPoint, Jacobian_i);
-
- /*--- Set the normal vector and the coordinates ---*/
-
- visc_numerics->SetNormal(Normal);
- visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
-
- /*--- Primitive variables, and gradient ---*/
-
- visc_numerics->SetPrimitive(PrimVar_i, PrimVar_j);
- // visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive());
-
- /*--- Turbulent variables and its gradients ---*/
-
- visc_numerics->SetTurbVar(Solution_i, Solution_j);
- visc_numerics->SetTurbVarGradient(nodes->GetGradient(iPoint), nodes->GetGradient(iPoint));
-
- /*--- Compute and update residual ---*/
-
- auto residual = visc_numerics->ComputeResidual(config);
-
- LinSysRes.SubtractBlock(iPoint, residual);
-
- /*--- Jacobian contribution for implicit integration ---*/
-
- Jacobian.SubtractBlock2Diag(iPoint, residual.jacobian_i);
-
- }
- }
- }
- }
-
- /*--- Free locally allocated memory ---*/
-
- delete [] PrimVar_i;
- delete [] PrimVar_j;
-
-}
-
void CTurbSASolver::BC_NearField_Boundary(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics,
CConfig *config, unsigned short val_marker) {
diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp
index b713103e1468..d1e6ecdf0c4b 100644
--- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp
+++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp
@@ -1011,132 +1011,6 @@ void CTurbSSTSolver::BC_Inlet_Turbo(CGeometry *geometry, CSolver **solver_contai
}
-void CTurbSSTSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics,
- CNumerics *visc_numerics, CConfig *config){
-
- unsigned long iVertex, jVertex, iPoint, Point_Normal = 0;
- unsigned short iDim, iVar, jVar, iMarker;
-
- unsigned short nPrimVar = solver_container[FLOW_SOL]->GetnPrimVar();
- su2double *Normal = new su2double[nDim];
- su2double *PrimVar_i = new su2double[nPrimVar];
- su2double *PrimVar_j = new su2double[nPrimVar];
-
- unsigned long nDonorVertex;
- su2double weight;
-
- for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
-
- if (config->GetMarker_All_KindBC(iMarker) == FLUID_INTERFACE) {
-
- for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
-
- iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
- Point_Normal = geometry->vertex[iMarker][iVertex]->GetNormal_Neighbor();
-
- if (geometry->node[iPoint]->GetDomain()) {
-
- nDonorVertex = GetnSlidingStates(iMarker, iVertex);
-
- /*--- Initialize Residual, this will serve to accumulate the average ---*/
-
- for (iVar = 0; iVar < nVar; iVar++) {
- Residual[iVar] = 0.0;
- for (jVar = 0; jVar < nVar; jVar++)
- Jacobian_i[iVar][jVar] = 0.0;
- }
-
- /*--- Loop over the nDonorVertexes and compute the averaged flux ---*/
-
- for (jVertex = 0; jVertex < nDonorVertex; jVertex++){
-
- geometry->vertex[iMarker][iVertex]->GetNormal(Normal);
- for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim];
-
- for (iVar = 0; iVar < nPrimVar; iVar++) {
- PrimVar_i[iVar] = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint,iVar);
- PrimVar_j[iVar] = solver_container[FLOW_SOL]->GetSlidingState(iMarker, iVertex, iVar, jVertex);
- }
-
- /*--- Get the weight computed in the interpolator class for the j-th donor vertex ---*/
-
- weight = solver_container[FLOW_SOL]->GetSlidingState(iMarker, iVertex, nPrimVar, jVertex);
-
- /*--- Set primitive variables ---*/
-
- conv_numerics->SetPrimitive( PrimVar_i, PrimVar_j );
-
- /*--- Set the turbulent variable states ---*/
- Solution_i[0] = nodes->GetSolution(iPoint,0);
- Solution_i[1] = nodes->GetSolution(iPoint,1);
-
- Solution_j[0] = GetSlidingState(iMarker, iVertex, 0, jVertex);
- Solution_j[1] = GetSlidingState(iMarker, iVertex, 1, jVertex);
-
- conv_numerics->SetTurbVar(Solution_i, Solution_j);
-
- /*--- Set the normal vector ---*/
-
- conv_numerics->SetNormal(Normal);
-
- if (dynamic_grid)
- conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
-
- auto residual = conv_numerics->ComputeResidual(config);
-
- /*--- Accumulate the residuals to compute the average ---*/
-
- for (iVar = 0; iVar < nVar; iVar++) {
- Residual[iVar] += weight*residual.residual[iVar];
- for (jVar = 0; jVar < nVar; jVar++)
- Jacobian_i[iVar][jVar] += weight*residual.jacobian_i[iVar][jVar];
- }
- }
-
- /*--- Add Residuals and Jacobians ---*/
-
- LinSysRes.AddBlock(iPoint, Residual);
-
- Jacobian.AddBlock2Diag(iPoint, Jacobian_i);
-
- /*--- Set the normal vector and the coordinates ---*/
-
- visc_numerics->SetNormal(Normal);
- visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
-
- /*--- Primitive variables, and gradient ---*/
-
- visc_numerics->SetPrimitive(PrimVar_i, PrimVar_j);
- // visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive());
-
- /*--- Turbulent variables and its gradients ---*/
-
- visc_numerics->SetTurbVar(Solution_i, Solution_j);
- visc_numerics->SetTurbVarGradient(nodes->GetGradient(iPoint), nodes->GetGradient(iPoint));
-
- /*--- Compute and update residual ---*/
-
- auto residual = visc_numerics->ComputeResidual(config);
-
- LinSysRes.SubtractBlock(iPoint, residual);
-
- /*--- Jacobian contribution for implicit integration ---*/
-
- Jacobian.SubtractBlock2Diag(iPoint, residual.jacobian_i);
-
- }
- }
- }
- }
-
- /*--- Free locally allocated memory ---*/
-
- delete [] Normal;
- delete [] PrimVar_i;
- delete [] PrimVar_j;
-
-}
-
void CTurbSSTSolver::SetInletAtVertex(su2double *val_inlet,
unsigned short iMarker,
unsigned long iVertex) {
diff --git a/SU2_CFD/src/solvers/CTurbSolver.cpp b/SU2_CFD/src/solvers/CTurbSolver.cpp
index ca6b17b3d181..aa754e1a3090 100644
--- a/SU2_CFD/src/solvers/CTurbSolver.cpp
+++ b/SU2_CFD/src/solvers/CTurbSolver.cpp
@@ -125,10 +125,10 @@ void CTurbSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_containe
/*--- Points in edge and normal vectors ---*/
- auto iPoint = geometry->edge[iEdge]->GetNode(0);
- auto jPoint = geometry->edge[iEdge]->GetNode(1);
+ auto iPoint = geometry->edges->GetNode(iEdge,0);
+ auto jPoint = geometry->edges->GetNode(iEdge,1);
- numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
+ numerics->SetNormal(geometry->edges->GetNormal(iEdge));
/*--- Primitive variables w/o reconstruction ---*/
@@ -250,14 +250,14 @@ void CTurbSolver::Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CSo
/*--- Points in edge ---*/
- auto iPoint = geometry->edge[iEdge]->GetNode(0);
- auto jPoint = geometry->edge[iEdge]->GetNode(1);
+ auto iPoint = geometry->edges->GetNode(iEdge,0);
+ auto jPoint = geometry->edges->GetNode(iEdge,1);
/*--- Points coordinates, and normal vector ---*/
numerics->SetCoord(geometry->node[iPoint]->GetCoord(),
geometry->node[jPoint]->GetCoord());
- numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
+ numerics->SetNormal(geometry->edges->GetNormal(iEdge));
/*--- Conservative variables w/o reconstruction ---*/
@@ -302,7 +302,7 @@ void CTurbSolver::SumEdgeFluxes(CGeometry* geometry) {
auto iEdge = geometry->node[iPoint]->GetEdge(iNeigh);
- if (iPoint == geometry->edge[iEdge]->GetNode(0))
+ if (iPoint == geometry->edges->GetNode(iEdge,0))
LinSysRes.AddBlock(iPoint, EdgeFluxes.GetBlock(iEdge));
else
LinSysRes.SubtractBlock(iPoint, EdgeFluxes.GetBlock(iEdge));
@@ -404,6 +404,121 @@ void CTurbSolver::BC_Periodic(CGeometry *geometry, CSolver **solver_container,
}
+void CTurbSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics,
+ CNumerics *visc_numerics, CConfig *config) {
+
+ const bool sst = (config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST);
+ const auto nPrimVar = solver_container[FLOW_SOL]->GetnPrimVar();
+ su2double *PrimVar_j = new su2double[nPrimVar];
+
+ for (auto iMarker = 0u; iMarker < config->GetnMarker_All(); iMarker++) {
+
+ if (config->GetMarker_All_KindBC(iMarker) != FLUID_INTERFACE) continue;
+
+ for (auto iVertex = 0u; iVertex < geometry->nVertex[iMarker]; iVertex++) {
+
+ const auto iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
+
+ if (!geometry->node[iPoint]->GetDomain()) continue;
+
+ const auto Point_Normal = geometry->vertex[iMarker][iVertex]->GetNormal_Neighbor();
+ const auto nDonorVertex = GetnSlidingStates(iMarker,iVertex);
+
+ su2double Normal[MAXNDIM] = {0.0};
+ for (auto iDim = 0u; iDim < nDim; iDim++)
+ Normal[iDim] = -geometry->vertex[iMarker][iVertex]->GetNormal()[iDim];
+
+ /*--- Initialize Residual, this will serve to accumulate the average ---*/
+
+ for (auto iVar = 0u; iVar < nVar; iVar++) {
+ Residual[iVar] = 0.0;
+ for (auto jVar = 0u; jVar < nVar; jVar++)
+ Jacobian_i[iVar][jVar] = 0.0;
+ }
+
+ su2double* PrimVar_i = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint);
+
+ /*--- Loop over the nDonorVertexes and compute the averaged flux ---*/
+
+ for (auto jVertex = 0u; jVertex < nDonorVertex; jVertex++) {
+
+ for (auto iVar = 0u; iVar < nPrimVar; iVar++)
+ PrimVar_j[iVar] = solver_container[FLOW_SOL]->GetSlidingState(iMarker, iVertex, iVar, jVertex);
+
+ /*--- Get the weight computed in the interpolator class for the j-th donor vertex ---*/
+
+ const su2double weight = solver_container[FLOW_SOL]->GetSlidingState(iMarker, iVertex, nPrimVar, jVertex);
+
+ /*--- Set primitive variables ---*/
+
+ conv_numerics->SetPrimitive( PrimVar_i, PrimVar_j );
+
+ /*--- Set the turbulent variable states ---*/
+
+ for (auto iVar = 0u; iVar < nVar; ++iVar)
+ Solution_j[iVar] = GetSlidingState(iMarker, iVertex, iVar, jVertex);
+
+ conv_numerics->SetTurbVar(nodes->GetSolution(iPoint), Solution_j);
+
+ /*--- Set the normal vector ---*/
+
+ conv_numerics->SetNormal(Normal);
+
+ if (dynamic_grid)
+ conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
+
+ auto residual = conv_numerics->ComputeResidual(config);
+
+ /*--- Accumulate the residuals to compute the average ---*/
+
+ for (auto iVar = 0u; iVar < nVar; iVar++) {
+ Residual[iVar] += weight*residual.residual[iVar];
+ for (auto jVar = 0u; jVar < nVar; jVar++)
+ Jacobian_i[iVar][jVar] += weight*residual.jacobian_i[iVar][jVar];
+ }
+ }
+
+ /*--- Add Residuals and Jacobians ---*/
+
+ LinSysRes.AddBlock(iPoint, Residual);
+
+ Jacobian.AddBlock2Diag(iPoint, Jacobian_i);
+
+ /*--- Set the normal vector and the coordinates ---*/
+
+ visc_numerics->SetNormal(Normal);
+ visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
+
+ /*--- Primitive variables ---*/
+
+ visc_numerics->SetPrimitive(PrimVar_i, PrimVar_j);
+
+ /*--- Turbulent variables and their gradients ---*/
+
+ visc_numerics->SetTurbVar(Solution_i, Solution_j);
+ visc_numerics->SetTurbVarGradient(nodes->GetGradient(iPoint), nodes->GetGradient(iPoint));
+
+ /*--- Menter's first blending function ---*/
+
+ if(sst) visc_numerics->SetF1blending(nodes->GetF1blending(iPoint), nodes->GetF1blending(iPoint));
+
+ /*--- Compute and update residual ---*/
+
+ auto residual = visc_numerics->ComputeResidual(config);
+
+ LinSysRes.SubtractBlock(iPoint, residual);
+
+ /*--- Jacobian contribution for implicit integration ---*/
+
+ Jacobian.SubtractBlock2Diag(iPoint, residual.jacobian_i);
+
+ }
+ }
+
+ delete [] PrimVar_j;
+
+}
+
void CTurbSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) {
const bool adjoint = config->GetContinuous_Adjoint() || (config->GetDiscrete_Adjoint() && config->GetFrozen_Visc_Disc());
@@ -728,13 +843,13 @@ void CTurbSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_con
for (iNeigh = 0; iNeigh < geometry->node[iPoint]->GetnNeighbor(); iNeigh++) {
iEdge = geometry->node[iPoint]->GetEdge(iNeigh);
- Normal = geometry->edge[iEdge]->GetNormal();
+ Normal = geometry->edges->GetNormal(iEdge);
jPoint = geometry->node[iPoint]->GetPoint(iNeigh);
GridVel_j = geometry->node[jPoint]->GetGridVel();
/*--- Determine whether to consider the normal outward or inward. ---*/
- su2double dir = (geometry->edge[iEdge]->GetNode(0) == iPoint)? 0.5 : -0.5;
+ su2double dir = (geometry->edges->GetNode(iEdge,0) == iPoint)? 0.5 : -0.5;
Residual_GCL = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
diff --git a/UnitTests/Common/geometry/dual_grid/CDualGrid_tests.cpp b/UnitTests/Common/geometry/dual_grid/CDualGrid_tests.cpp
index 2c01f209291e..509a06c0c9f4 100644
--- a/UnitTests/Common/geometry/dual_grid/CDualGrid_tests.cpp
+++ b/UnitTests/Common/geometry/dual_grid/CDualGrid_tests.cpp
@@ -44,15 +44,13 @@ TEST_CASE("Volume Computation", "[Dual Grid]") {
Coord_Elem_CG[0] = scaling*0.653846; Coord_Elem_CG[1] = scaling*1.12927; Coord_Elem_CG[2] = scaling*0.00835789;
Coord_Edge_CG[0] = scaling*0.664943; Coord_Edge_CG[1] = scaling*1.14623; Coord_Edge_CG[2] = scaling*0.00935524;
- CEdge edge2d(0, 1, 2);
SECTION("2D Edge"){
- su2double volume = edge2d.GetVolume(Coord_FaceiPoint, Coord_Edge_CG, Coord_Elem_CG);
+ su2double volume = CEdge::GetVolume(Coord_FaceiPoint, Coord_Edge_CG, Coord_Elem_CG);
REQUIRE(volume == Approx(0.00607415));
}
- CEdge edge3d(0, 1, 3);
SECTION("3D Edge"){
- su2double volume = edge3d.GetVolume(Coord_FaceiPoint, Coord_Edge_CG, Coord_FaceElem_CG, Coord_Elem_CG);
+ su2double volume = CEdge::GetVolume(Coord_FaceiPoint, Coord_Edge_CG, Coord_FaceElem_CG, Coord_Elem_CG);
REQUIRE(volume == Approx(0.000546832));
}