Skip to content

Commit 8613e73

Browse files
committed
implement suggestions
1 parent 986f0ee commit 8613e73

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Common/src/geometry/CGeometry.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -978,19 +978,18 @@ void CGeometry::PreprocessPeriodicComms(CGeometry* geometry, CConfig* config) {
978978

979979
if (iRank == destRank) {
980980
/*--- Check if we have already added this (point, marker) pair
981-
for this destination rank. ---*/
982-
auto pointMarkerPair = std::make_pair(iPoint, static_cast<unsigned long>(iMarker));
983-
if (Points_Send_All[destRank].find(pointMarkerPair) == Points_Send_All[destRank].end()) {
981+
for this destination rank. Use the result if insert(), which is
982+
a pair whose second element is success. ---*/
983+
const auto pointMarkerPair = std::make_pair(iPoint, static_cast<unsigned long>(iMarker));
984+
const auto insertResult = Points_Send_All[destRank].insert(pointMarkerPair);
985+
if (insertResult.second) {
984986
Local_Point_PeriodicSend[ii] = iPoint;
985987
Local_Marker_PeriodicSend[ii] = static_cast<unsigned long>(iMarker);
986988
jj = ii * nPackets;
987989
idSend[jj] = geometry->vertex[iMarker][iVertex]->GetDonorPoint();
988990
jj++;
989991
idSend[jj] = static_cast<unsigned long>(iPeriodic);
990992
ii++;
991-
992-
/*--- Store the (point, marker) pair in the set for the destination rank. ---*/
993-
Points_Send_All[destRank].insert(pointMarkerPair);
994993
}
995994
}
996995
}

0 commit comments

Comments
 (0)