diff --git a/Common/include/interface_interpolation/CInterpolator.hpp b/Common/include/interface_interpolation/CInterpolator.hpp index 17b0de4839c..53834bf6da8 100644 --- a/Common/include/interface_interpolation/CInterpolator.hpp +++ b/Common/include/interface_interpolation/CInterpolator.hpp @@ -56,8 +56,8 @@ class CInterpolator { Buffer_Send_nVertex_Donor[1], /*!< \brief Buffer to send number of vertices on the local processor. */ *Buffer_Receive_nVertex_Donor; /*!< \brief Buffer to store the number of vertices per processor on the Donor domain. */ - long *Buffer_Send_GlobalPoint, /*!< \brief Buffer to send global point indices. */ - *Buffer_Receive_GlobalPoint; /*!< \brief Buffer to receive global point indices. */ + su2vector Buffer_Send_GlobalPoint; /*!< \brief Buffer to send global point indices. */ + su2vector Buffer_Receive_GlobalPoint; /*!< \brief Buffer to receive global point indices. */ su2activematrix Buffer_Send_Coord; /*!< \brief Buffer to send coordinate values. */ su2activematrix Buffer_Receive_Coord; /*!< \brief Buffer to receive coordinate values. */ diff --git a/Common/src/interface_interpolation/CInterpolator.cpp b/Common/src/interface_interpolation/CInterpolator.cpp index 05e7c55550d..390e72d30d8 100644 --- a/Common/src/interface_interpolation/CInterpolator.cpp +++ b/Common/src/interface_interpolation/CInterpolator.cpp @@ -102,12 +102,11 @@ void CInterpolator::Collect_VertexInfo(int markDonor, int markTarget, iLocalVertexDonor++; } } - auto nBuffer_Point = MaxLocalVertex_Donor; SU2_MPI::Allgather(Buffer_Send_Coord.data(), Buffer_Send_Coord.size(), MPI_DOUBLE, Buffer_Receive_Coord.data(), Buffer_Send_Coord.size(), MPI_DOUBLE, SU2_MPI::GetComm()); - SU2_MPI::Allgather(Buffer_Send_GlobalPoint, nBuffer_Point, MPI_LONG, - Buffer_Receive_GlobalPoint, nBuffer_Point, MPI_LONG, SU2_MPI::GetComm()); + SU2_MPI::Allgather(Buffer_Send_GlobalPoint.data(), MaxLocalVertex_Donor, MPI_LONG, + Buffer_Receive_GlobalPoint.data(), MaxLocalVertex_Donor, MPI_LONG, SU2_MPI::GetComm()); } unsigned long CInterpolator::Collect_ElementInfo(int markDonor, unsigned short nDim, bool compress, @@ -206,7 +205,7 @@ void CInterpolator::ReconstructBoundary(unsigned long val_zone, int val_marker){ // coordinates of all domain vertices on the marker su2activematrix Buffer_Send_Coord(nLocalVertex, nDim); // global point IDs of all domain vertices on the marker - long *Buffer_Send_GlobalPoint = new long [ nVertex ]; + su2vector Buffer_Send_GlobalPoint(nVertex); // Assign to each domain vertex on the marker, identified by local point ID, // a set of surface-neighbor vertices on the marker, identified by global point ID. @@ -217,7 +216,7 @@ void CInterpolator::ReconstructBoundary(unsigned long val_zone, int val_marker){ iPoint = geom->vertex[val_marker][iVertex]->GetNode(); if (geom->nodes->GetDomain(iPoint)) { unsigned long iLocalVertex = iVertex_to_iLocalVertex[iVertex]; - Buffer_Send_GlobalPoint[iLocalVertex] = static_cast( geom->nodes->GetGlobalIndex(iPoint) ); + Buffer_Send_GlobalPoint[iLocalVertex] = geom->nodes->GetGlobalIndex(iPoint); for (iDim = 0; iDim < nDim; iDim++) Buffer_Send_Coord[iLocalVertex][iDim] = geom->nodes->GetCoord(iPoint, iDim); neighbors.insert(pair >(iPoint, unordered_set())); @@ -277,7 +276,7 @@ void CInterpolator::ReconstructBoundary(unsigned long val_zone, int val_marker){ SU2_MPI::Allreduce(&nLocalLinkedNodes, &nGlobalLinkedNodes, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); Buffer_Receive_Coord.resize(nGlobalVertex, nDim); - Buffer_Receive_GlobalPoint = new long[ nGlobalVertex ]; + Buffer_Receive_GlobalPoint.resize(nGlobalVertex); Buffer_Receive_Proc.resize(nGlobalVertex); Buffer_Receive_nLinkedNodes = new unsigned long[ nGlobalVertex ]; @@ -337,7 +336,7 @@ void CInterpolator::ReconstructBoundary(unsigned long val_zone, int val_marker){ SU2_MPI::Send( &nLocalVertex, 1, MPI_UNSIGNED_LONG, 0, 0, SU2_MPI::GetComm()); SU2_MPI::Send(Buffer_Send_Coord.data(), Buffer_Send_Coord.size(), MPI_DOUBLE, 0, 1, SU2_MPI::GetComm()); - SU2_MPI::Send( Buffer_Send_GlobalPoint, nLocalVertex, MPI_LONG, 0, 1, SU2_MPI::GetComm()); + SU2_MPI::Send( Buffer_Send_GlobalPoint.data(), nLocalVertex, MPI_LONG, 0, 1, SU2_MPI::GetComm()); SU2_MPI::Send( Buffer_Send_nLinkedNodes.data(), nLocalVertex, MPI_UNSIGNED_LONG, 0, 1, SU2_MPI::GetComm()); SU2_MPI::Send(Buffer_Send_StartLinkedNodes, nLocalVertex, MPI_UNSIGNED_LONG, 0, 1, SU2_MPI::GetComm()); } @@ -367,7 +366,7 @@ void CInterpolator::ReconstructBoundary(unsigned long val_zone, int val_marker){ unsigned long jPoint = uptr[ jLinkedNode ]; bool found = false; // Global point index has been found for (kVertex = 0; kVertex < nGlobalVertex; kVertex++){ - if( Buffer_Receive_GlobalPoint[kVertex] == long(jPoint) ){ + if( Buffer_Receive_GlobalPoint[kVertex] == jPoint ){ uptr[ jLinkedNode ] = kVertex; found = true; break; @@ -385,7 +384,7 @@ void CInterpolator::ReconstructBoundary(unsigned long val_zone, int val_marker){ } } - SU2_MPI::Bcast(Buffer_Receive_GlobalPoint, nGlobalVertex, MPI_LONG, 0, SU2_MPI::GetComm()); + SU2_MPI::Bcast(Buffer_Receive_GlobalPoint.data(), nGlobalVertex, MPI_UNSIGNED_LONG, 0, SU2_MPI::GetComm()); SU2_MPI::Bcast(Buffer_Receive_Coord.data(), Buffer_Receive_Coord.size(), MPI_DOUBLE, 0, SU2_MPI::GetComm()); SU2_MPI::Bcast(Buffer_Receive_Proc.data(), nGlobalVertex, MPI_UNSIGNED_LONG, 0, SU2_MPI::GetComm()); @@ -393,7 +392,6 @@ void CInterpolator::ReconstructBoundary(unsigned long val_zone, int val_marker){ SU2_MPI::Bcast(Buffer_Receive_StartLinkedNodes, nGlobalVertex, MPI_UNSIGNED_LONG, 0, SU2_MPI::GetComm()); SU2_MPI::Bcast(Buffer_Receive_LinkedNodes.data(), nGlobalLinkedNodes, MPI_UNSIGNED_LONG, 0, SU2_MPI::GetComm()); - delete [] Buffer_Send_GlobalPoint; Buffer_Send_GlobalPoint = nullptr; delete [] Buffer_Send_LinkedNodes; Buffer_Send_LinkedNodes = nullptr; delete [] Buffer_Send_StartLinkedNodes; Buffer_Send_StartLinkedNodes = nullptr; diff --git a/Common/src/interface_interpolation/CIsoparametric.cpp b/Common/src/interface_interpolation/CIsoparametric.cpp index d12b8051bfa..264ad68f25d 100644 --- a/Common/src/interface_interpolation/CIsoparametric.cpp +++ b/Common/src/interface_interpolation/CIsoparametric.cpp @@ -94,9 +94,9 @@ void CIsoparametric::SetTransferCoeff(const CConfig* const* config) { Buffer_Receive_nVertex_Donor+nProcessor, 0ul); Buffer_Send_Coord.resize(MaxLocalVertex_Donor, nDim); - Buffer_Send_GlobalPoint = new long [ MaxLocalVertex_Donor ]; + Buffer_Send_GlobalPoint .resize(MaxLocalVertex_Donor); Buffer_Receive_Coord.resize(nProcessor*MaxLocalVertex_Donor,nDim); - Buffer_Receive_GlobalPoint = new long [ nProcessor * MaxLocalVertex_Donor ]; + Buffer_Receive_GlobalPoint.resize(nProcessor * MaxLocalVertex_Donor); /*--- Collect coordinates and global point indices. ---*/ Collect_VertexInfo(markDonor, markTarget, nVertexDonor, nDim); @@ -125,9 +125,6 @@ void CIsoparametric::SetTransferCoeff(const CConfig* const* config) { } assert((iCount == nGlobalVertexDonor) && "Global donor point count mismatch."); - delete[] Buffer_Send_GlobalPoint; - delete[] Buffer_Receive_GlobalPoint; - /*--- Collect donor element (face) information. ---*/ vector allNumElem; diff --git a/Common/src/interface_interpolation/CNearestNeighbor.cpp b/Common/src/interface_interpolation/CNearestNeighbor.cpp index f15040cc086..de855b4ba7e 100644 --- a/Common/src/interface_interpolation/CNearestNeighbor.cpp +++ b/Common/src/interface_interpolation/CNearestNeighbor.cpp @@ -87,9 +87,9 @@ void CNearestNeighbor::SetTransferCoeff(const CConfig* const* config) { Buffer_Receive_nVertex_Donor+nProcessor, 0ul); Buffer_Send_Coord.resize(MaxLocalVertex_Donor, nDim); - Buffer_Send_GlobalPoint = new long [ MaxLocalVertex_Donor ]; + Buffer_Send_GlobalPoint.resize(MaxLocalVertex_Donor); Buffer_Receive_Coord.resize(nProcessor * MaxLocalVertex_Donor, nDim); - Buffer_Receive_GlobalPoint = new long [ nProcessor * MaxLocalVertex_Donor ]; + Buffer_Receive_GlobalPoint.resize(nProcessor * MaxLocalVertex_Donor); /*--- Collect coordinates and global point indices. ---*/ Collect_VertexInfo(markDonor, markTarget, nVertexDonor, nDim); @@ -169,9 +169,6 @@ void CNearestNeighbor::SetTransferCoeff(const CConfig* const* config) { } END_SU2_OMP_PARALLEL - delete[] Buffer_Send_GlobalPoint; - delete[] Buffer_Receive_GlobalPoint; - } delete[] Buffer_Receive_nVertex_Donor; diff --git a/Common/src/interface_interpolation/CRadialBasisFunction.cpp b/Common/src/interface_interpolation/CRadialBasisFunction.cpp index 337fdd49ab8..45ea480a93b 100644 --- a/Common/src/interface_interpolation/CRadialBasisFunction.cpp +++ b/Common/src/interface_interpolation/CRadialBasisFunction.cpp @@ -144,9 +144,9 @@ void CRadialBasisFunction::SetTransferCoeff(const CConfig* const* config) { /*--- Gather coordinates and global point indices. ---*/ Buffer_Send_Coord.resize(MaxLocalVertex_Donor, nDim); - Buffer_Send_GlobalPoint = new long [ MaxLocalVertex_Donor ]; + Buffer_Send_GlobalPoint.resize(MaxLocalVertex_Donor); Buffer_Receive_Coord.resize(nProcessor * MaxLocalVertex_Donor, nDim); - Buffer_Receive_GlobalPoint = new long [ nProcessor * MaxLocalVertex_Donor ]; + Buffer_Receive_GlobalPoint.resize(nProcessor * MaxLocalVertex_Donor); Collect_VertexInfo(markDonor, markTarget, nVertexDonor, nDim); @@ -171,9 +171,6 @@ void CRadialBasisFunction::SetTransferCoeff(const CConfig* const* config) { } assert((iCount == nGlobalVertexDonor) && "Global donor point count mismatch."); - delete[] Buffer_Send_GlobalPoint; - delete[] Buffer_Receive_GlobalPoint; - /*--- Give an MPI-independent order to the points (required due to high condition * number of the RBF matrix, avoids diff results with diff number of ranks. ---*/ vector order(nGlobalVertexDonor); diff --git a/Common/src/interface_interpolation/CSlidingMesh.cpp b/Common/src/interface_interpolation/CSlidingMesh.cpp index 83791a00e4d..bdcdddfe88f 100644 --- a/Common/src/interface_interpolation/CSlidingMesh.cpp +++ b/Common/src/interface_interpolation/CSlidingMesh.cpp @@ -80,7 +80,7 @@ void CSlidingMesh::SetTransferCoeff(const CConfig* const* config) { unsigned long *Target_nLinkedNodes, *Target_StartLinkedNodes, *target_segment; su2vector Target_LinkedNodes; - long *Target_GlobalPoint, *Donor_GlobalPoint; + su2vector Target_GlobalPoint, Donor_GlobalPoint; su2double *target_iMidEdge_point, *target_jMidEdge_point, **target_element; su2activematrix TargetPoint_Coord; @@ -226,7 +226,7 @@ void CSlidingMesh::SetTransferCoeff(const CConfig* const* config) { /*--- Contruct information regarding the target cell ---*/ - long dPoint = target_geometry->nodes->GetGlobalIndex(target_iPoint); + unsigned long dPoint = target_geometry->nodes->GetGlobalIndex(target_iPoint); for (jVertexTarget = 0; jVertexTarget < nGlobalVertex_Target; jVertexTarget++) if( dPoint == Target_GlobalPoint[jVertexTarget] ) break; @@ -461,7 +461,7 @@ void CSlidingMesh::SetTransferCoeff(const CConfig* const* config) { for (iDim = 0; iDim < nDim; iDim++) Coord_i[iDim] = target_geometry->nodes->GetCoord(target_iPoint, iDim); - long dPoint = target_geometry->nodes->GetGlobalIndex(target_iPoint); + unsigned long dPoint = target_geometry->nodes->GetGlobalIndex(target_iPoint); for (target_iPoint = 0; target_iPoint < nGlobalVertex_Target; target_iPoint++){ if( dPoint == Target_GlobalPoint[target_iPoint] ) break; @@ -703,11 +703,9 @@ void CSlidingMesh::SetTransferCoeff(const CConfig* const* config) { } } - delete [] Target_GlobalPoint; delete [] Target_nLinkedNodes; delete [] Target_StartLinkedNodes; - delete [] Donor_GlobalPoint; delete [] Donor_nLinkedNodes; delete [] Donor_StartLinkedNodes;