@@ -723,49 +723,45 @@ int CSlidingMesh::Build_3D_surface_element(const su2vector<unsigned long>& map,
723723 /* --- Given a node "centralNode", this routines reconstruct the vertex centered
724724 * surface element around the node and store it into "element" ---*/
725725
726- unsigned long iNode, jNode, kNode , iElementNode, iPoint, jPoint, nOuterNodes;
727-
728726 constexpr unsigned short nDim = 3 ;
729- unsigned short iDim, nTmp;
730727
731- int NextNode, **OuterNodesNeighbour, CurrentNode, StartIndex, count ;
732- const unsigned long *OuterNodes, *ptr ;
728+ int **OuterNodesNeighbour;
729+ const unsigned long *OuterNodes;
733730
734731 /* --- Store central node as element first point --- */
735732
736- for (iDim = 0 ; iDim < nDim; iDim++)
733+ for (unsigned short iDim = 0 ; iDim < nDim; iDim++)
737734 element[0 ][iDim] = coord (centralNode,iDim);
738735
739- nOuterNodes = nNeighbor[centralNode];
736+ unsigned long nOuterNodes = nNeighbor[centralNode];
740737
741738 OuterNodes = &map[ startIndex[centralNode] ];
742739
743740 /* --- Allocate auxiliary structure, vectors are longer than needed but this avoid further re-allocations due to length variation --- */
744741
745742 OuterNodesNeighbour = new int *[nOuterNodes];
746- for ( iNode = 0 ; iNode < nOuterNodes; iNode++ )
743+ for ( unsigned long iNode = 0 ; iNode < nOuterNodes; iNode++ )
747744 OuterNodesNeighbour[ iNode ] = new int [2 ];
748745
749746 /* --- Finds which and how many nodes belong to the specified marker, initialize some variables --- */
750747
751- for ( iNode = 0 ; iNode < nOuterNodes; iNode++ ){
748+ for ( unsigned long iNode = 0 ; iNode < nOuterNodes; iNode++ ){
752749 OuterNodesNeighbour[ iNode ][0 ] = -1 ;
753750 OuterNodesNeighbour[ iNode ][1 ] = -1 ;
754751 }
755752
756753 /* --- For each outer node, the program finds the two neighbouring outer nodes --- */
757754
758- StartIndex = 0 ;
759- for ( iNode = 0 ; iNode < nOuterNodes; iNode++ ){
755+ int StartNode = 0 ;
756+ for ( unsigned long iNode = 0 ; iNode < nOuterNodes; iNode++ ){
760757
761- count = 0 ;
762- iPoint = OuterNodes[ iNode ];
763- ptr = &map[ startIndex[iPoint] ];
764- nTmp = nNeighbor[iPoint];
758+ int count = 0 ; // number of neighboring outer nodes already found
759+ const unsigned long iPoint = OuterNodes[ iNode ];
760+ const unsigned long *ptr = &map[ startIndex[iPoint] ];
765761
766- for ( jNode = 0 ; jNode < nTmp ; jNode++ ){
767- jPoint = ptr[jNode];
768- for ( kNode = 0 ; kNode < nOuterNodes; kNode ++ ){
762+ for ( unsigned long jNode = 0 ; jNode < nNeighbor[iPoint] ; jNode++ ){
763+ const unsigned long jPoint = ptr[jNode];
764+ for ( unsigned long kNode = 0 ; kNode < nOuterNodes; kNode ++ ){
769765 if ( jPoint == OuterNodes[ kNode ] && jPoint != centralNode){
770766 OuterNodesNeighbour[iNode][count] = (int )kNode ;
771767 count++;
@@ -776,23 +772,23 @@ int CSlidingMesh::Build_3D_surface_element(const su2vector<unsigned long>& map,
776772
777773 // If the central node belongs to two different markers, ie at corners, makes this outer node the starting point for reconstructing the element
778774 if ( count == 1 )
779- StartIndex = (int )iNode;
775+ StartNode = (int )iNode;
780776 }
781777
782778 /* --- Build element, starts from one outer node and loops along the external edges until the element is reconstructed --- */
783779
784- CurrentNode = StartIndex ;
785- NextNode = OuterNodesNeighbour[ CurrentNode ][0 ];
786- iElementNode = 1 ;
780+ int CurrentNode = StartNode ;
781+ int NextNode = OuterNodesNeighbour[ CurrentNode ][0 ];
782+ unsigned long iElementNode = 1 ;
787783
788784 while ( NextNode != -1 ){
789785
790- for (iDim = 0 ; iDim < nDim; iDim++)
786+ for (unsigned short iDim = 0 ; iDim < nDim; iDim++)
791787 element[ iElementNode ][iDim] = ( element[0 ][iDim] + coord (OuterNodes[ CurrentNode ], iDim) )/2 .;
792788
793789 iElementNode++;
794790
795- for (iDim = 0 ; iDim < nDim; iDim++)
791+ for (unsigned short iDim = 0 ; iDim < nDim; iDim++)
796792 element[ iElementNode ][iDim] = ( element[0 ][iDim] + coord[ OuterNodes[ CurrentNode ] ][ iDim] +
797793 coord (OuterNodes[ NextNode ], iDim) )/3 .;
798794 iElementNode++;
@@ -806,23 +802,23 @@ int CSlidingMesh::Build_3D_surface_element(const su2vector<unsigned long>& map,
806802 NextNode = OuterNodesNeighbour[ NextNode ][0 ];
807803 }
808804
809- if (CurrentNode == StartIndex )
805+ if (CurrentNode == StartNode )
810806 break ;
811807 }
812808
813- if ( CurrentNode == StartIndex ){ // This is a closed element, so add again element 1 to the end of the structure, useful later
809+ if ( CurrentNode == StartNode ){ // This is a closed element, so add again element 1 to the end of the structure, useful later
814810
815- for (iDim = 0 ; iDim < nDim; iDim++)
811+ for (unsigned short iDim = 0 ; iDim < nDim; iDim++)
816812 element[ iElementNode ][iDim] = element[1 ][iDim];
817813 iElementNode++;
818814 }
819815 else {
820- for (iDim = 0 ; iDim < nDim; iDim++)
816+ for (unsigned short iDim = 0 ; iDim < nDim; iDim++)
821817 element[ iElementNode ][iDim] = ( element[0 ][iDim] + coord (OuterNodes[ CurrentNode ], iDim) )/2 .;
822818 iElementNode++;
823819 }
824820
825- for ( iNode = 0 ; iNode < nOuterNodes; iNode++ )
821+ for ( unsigned long iNode = 0 ; iNode < nOuterNodes; iNode++ )
826822 delete [] OuterNodesNeighbour[ iNode ];
827823 delete [] OuterNodesNeighbour;
828824
0 commit comments