From f8a0677a660362f0504f7fa0165039c4c5d37b96 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 16 Feb 2021 10:18:16 +0100 Subject: [PATCH] ENH: replace base implementation of Foam::Swap with std::swap - eliminates a potentially invalid code branch. Since it essentially had the same internals as std::swap anyhow, make that more evident. ENH: use std::swap for basic types - makes it clearer that they do not rely on any special semantics --- .../fluent3DMeshToFoam/fluent3DMeshToFoam.L | 3 ++- .../ideasUnvToFoam/ideasUnvToFoam.C | 5 ++-- .../conformalVoronoiMeshCalcDualMesh.C | 4 +-- .../indexedCell/indexedCellI.H | 7 ++--- .../manipulation/renumberMesh/renumberMesh.C | 4 +-- .../HashTables/HashTable/HashTable.C | 8 +++--- .../containers/Lists/FixedList/FixedListI.H | 2 +- src/OpenFOAM/matrices/Matrix/Matrix.C | 8 +++--- .../GAMGAgglomerateLduAddressing.C | 4 +-- src/OpenFOAM/meshes/meshShapes/face/face.C | 3 ++- .../meshes/meshShapes/triFace/triFaceI.H | 4 +-- .../polyMeshTetDecomposition/tetIndicesI.H | 5 ++-- .../meshes/primitiveShapes/cut/cutTemplates.C | 11 ++++---- src/OpenFOAM/primitives/Swap/Swap.H | 24 +++++------------ src/conversion/ccm/reader/ccmReaderMesh.C | 4 +-- src/conversion/fire/FIREMeshReader.C | 4 +-- .../createShellMesh/createShellMesh.C | 6 ++--- .../polyTopoChange/combineFaces.C | 4 +-- .../vtk/read/vtkUnstructuredReader.C | 8 +++--- src/lagrangian/basic/particle/particle.C | 2 +- .../movement/lumpedPointMovement.C | 4 +-- .../meshRefinement/meshRefinementRefine.C | 4 +-- src/meshTools/polyTopoChange/polyTopoChange.C | 4 +-- .../searchableCone/searchableCone.C | 6 ++--- .../searchableCylinder/searchableCylinder.C | 6 ++--- .../randomRenumber/randomRenumber.C | 3 ++- .../sampledSet/patchSeed/patchSeedSet.C | 4 +-- .../isoSurface/isoSurfaceCellTemplates.C | 22 ++++++++-------- .../isoSurface/isoSurfacePointTemplates.C | 22 ++++++++-------- .../surface/isoSurface/isoSurfaceTopo.C | 26 +++++++++---------- 30 files changed, 108 insertions(+), 113 deletions(-) diff --git a/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L b/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L index 858e1335de..066da1368a 100644 --- a/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L +++ b/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -889,7 +890,7 @@ int main(int argc, char *argv[]) { faces[facei].flip(); } - Swap(owner[facei], neighbour[facei]); + std::swap(owner[facei], neighbour[facei]); } } diff --git a/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C b/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C index 0443453675..6c2d2188b6 100644 --- a/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C +++ b/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -889,8 +890,8 @@ int main(int argc, char *argv[]) if (own[facei] == -1 && nei[facei] != -1) { // Boundary face with incorrect orientation - boundaryFaces[facei] = boundaryFaces[facei].reverseFace(); - Swap(own[facei], nei[facei]); + boundaryFaces[facei].flip(); + std::swap(own[facei], nei[facei]); nReverse++; } } diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C index 013e6c8d2f..4a548c89ef 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2016 OpenFOAM Foundation - Copyright (C) 2018-2020 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -2348,7 +2348,7 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches { forAll(procPatchFaces, fI) { - procPatchFaces[fI] = procPatchFaces[fI].reverseFace(); + procPatchFaces[fI].flip(); } } diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellI.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellI.H index aa3aa26576..6ebf8ca347 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellI.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellI.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -325,7 +326,7 @@ inline Foam::tetCell CGAL::indexedCell::vertexGlobalIndices { if (tVGI[j - 1] > tVGI[j]) { - Foam::Swap(tVGI[j - 1], tVGI[j]); + std::swap(tVGI[j - 1], tVGI[j]); } } } @@ -354,8 +355,8 @@ CGAL::indexedCell::globallyOrderedCellVertices { if (tVGI[j - 1] > tVGI[j]) { - Foam::Swap(tVGI[j - 1], tVGI[j]); - Foam::Swap(vertexMap[j - 1], vertexMap[j]); + std::swap(tVGI[j - 1], tVGI[j]); + std::swap(vertexMap[j - 1], vertexMap[j]); } } } diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C index 5fd9762ef0..352fdbac33 100644 --- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C +++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -441,7 +441,7 @@ autoPtr reorderMesh if (nei < own) { newFaces[facei].flip(); - Swap(newOwner[facei], newNeighbour[facei]); + std::swap(newOwner[facei], newNeighbour[facei]); flipFaceFlux.insert(facei); } } diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C index 126353040b..c4801b8c80 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2019 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -661,9 +661,9 @@ void Foam::HashTable::swap(HashTable& rhs) return; // Self-swap is a no-op } - Foam::Swap(size_, rhs.size_); - Foam::Swap(capacity_, rhs.capacity_); - Foam::Swap(table_, rhs.table_); + std::swap(size_, rhs.size_); + std::swap(capacity_, rhs.capacity_); + std::swap(table_, rhs.table_); } diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H b/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H index 86eea83432..5bdcf55eb5 100644 --- a/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H +++ b/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/src/OpenFOAM/matrices/Matrix/Matrix.C b/src/OpenFOAM/matrices/Matrix/Matrix.C index aa1fc97c92..84a089b8cd 100644 --- a/src/OpenFOAM/matrices/Matrix/Matrix.C +++ b/src/OpenFOAM/matrices/Matrix/Matrix.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -294,9 +294,9 @@ void Foam::Matrix::swap(Matrix& mat) return; // Self-swap is a no-op } - Foam::Swap(mRows_, mat.mRows_); - Foam::Swap(nCols_, mat.nCols_); - Foam::Swap(v_, mat.v_); + std::swap(mRows_, mat.mRows_); + std::swap(nCols_, mat.nCols_); + std::swap(v_, mat.v_); } diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerateLduAddressing.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerateLduAddressing.C index 6206846271..6c1c9f8e25 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerateLduAddressing.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerateLduAddressing.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -717,7 +717,7 @@ void Foam::GAMGAgglomeration::calculateRegionMaster const label index = agglomProcIDs.find(agglomToMaster[myAgglom]); - Swap(agglomProcIDs[0], agglomProcIDs[index]); + std::swap(agglomProcIDs[0], agglomProcIDs[index]); } diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.C b/src/OpenFOAM/meshes/meshShapes/face/face.C index 328216967a..868c13df89 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/face.C +++ b/src/OpenFOAM/meshes/meshShapes/face/face.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -474,7 +475,7 @@ void Foam::face::flip() { for (label i=1; i < (n+1)/2; ++i) { - Swap(operator[](i), operator[](n-i)); + std::swap(operator[](i), operator[](n-i)); } } } diff --git a/src/OpenFOAM/meshes/meshShapes/triFace/triFaceI.H b/src/OpenFOAM/meshes/meshShapes/triFace/triFaceI.H index fed0b49c43..e1f2c00869 100644 --- a/src/OpenFOAM/meshes/meshShapes/triFace/triFaceI.H +++ b/src/OpenFOAM/meshes/meshShapes/triFace/triFaceI.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2013 OpenFOAM Foundation - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -140,7 +140,7 @@ inline Foam::label Foam::triFace::collapse() inline void Foam::triFace::flip() { - Swap(operator[](1), operator[](2)); + std::swap(operator[](1), operator[](2)); } diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/tetIndicesI.H b/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/tetIndicesI.H index 2f0d2b6974..d40a9afe4c 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/tetIndicesI.H +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/tetIndicesI.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -100,7 +101,7 @@ inline Foam::triFace Foam::tetIndices::faceTriIs if (mesh.faceOwner()[face()] != cell()) { - Swap(facePtI, faceOtherPtI); + std::swap(facePtI, faceOtherPtI); } return triFace(f[faceBasePtI], f[facePtI], f[faceOtherPtI]); @@ -144,7 +145,7 @@ inline Foam::triFace Foam::tetIndices::triIs if (mesh.faceOwner()[face()] != cell()) { - Swap(facePtI, faceOtherPtI); + std::swap(facePtI, faceOtherPtI); } return triFace(faceBasePtI, facePtI, faceOtherPtI); diff --git a/src/OpenFOAM/meshes/primitiveShapes/cut/cutTemplates.C b/src/OpenFOAM/meshes/primitiveShapes/cut/cutTemplates.C index b06d353474..3c565956eb 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/cut/cutTemplates.C +++ b/src/OpenFOAM/meshes/primitiveShapes/cut/cutTemplates.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -57,7 +58,7 @@ typename Foam::cut::opAddResult::type Foam::triCut { if (level[(i + 1)%3]*level[(i + 2)%3] >= 0) { - Swap(indices[0], indices[i]); + std::swap(indices[0], indices[i]); break; } } @@ -71,7 +72,7 @@ typename Foam::cut::opAddResult::type Foam::triCut // Correct the sign if (indices[0] != 0) { - Swap(indices[1], indices[2]); + std::swap(indices[1], indices[2]); } // Permute the data @@ -165,7 +166,7 @@ typename Foam::cut::opAddResult::type Foam::tetCut { break; } - Swap(indices[i], indices[j]); + std::swap(indices[i], indices[j]); signChange = !signChange; } @@ -179,14 +180,14 @@ typename Foam::cut::opAddResult::type Foam::tetCut n = 4 - n; for (label i = 0; i < 2; ++i) { - Swap(indices[i], indices[3-i]); + std::swap(indices[i], indices[3-i]); } } // Correct the sign if (signChange) { - Swap(indices[2], indices[3]); + std::swap(indices[2], indices[3]); } // Permute the data diff --git a/src/OpenFOAM/primitives/Swap/Swap.H b/src/OpenFOAM/primitives/Swap/Swap.H index 868586e501..61ebf0a2b9 100644 --- a/src/OpenFOAM/primitives/Swap/Swap.H +++ b/src/OpenFOAM/primitives/Swap/Swap.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -29,12 +29,14 @@ InNamespace Description Swap arguments as per std::swap, but in Foam namespace. + For complex structures, it is usual to provide a member swap() method + and a function specialization for Swap(). + \*---------------------------------------------------------------------------*/ #ifndef Swap_H #define Swap_H -#include #include // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -42,26 +44,12 @@ Description namespace Foam { -//- Swap non-array types as per std::swap example, but in Foam namespace. +//- Swap non-array types as per std::swap, but in Foam namespace. // \sa http://www.cplusplus.com/reference/utility/swap/ template void Swap(T& a, T& b) { - // compile-time resolution with std::enable_if not yet working - if (std::is_fundamental::value || std::is_pointer::value) - { - // Use copy/assign for simple types - const T tmp = a; - a = b; - b = tmp; - } - else - { - // Use move/assignment - T tmp(std::move(a)); - a = std::move(b); - b = std::move(tmp); - } + std::swap(a, b); } diff --git a/src/conversion/ccm/reader/ccmReaderMesh.C b/src/conversion/ccm/reader/ccmReaderMesh.C index acc7f1f865..f621a5cadc 100644 --- a/src/conversion/ccm/reader/ccmReaderMesh.C +++ b/src/conversion/ccm/reader/ccmReaderMesh.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -2291,7 +2291,7 @@ void Foam::ccm::reader::reorderMesh() { faceOwner_[faceI] = faceNeighbour_[faceI]; faceNeighbour_[faceI] = own; - faces_[faceI] = faces_[faceI].reverseFace(); + faces_[faceI].flip(); } // And check the face diff --git a/src/conversion/fire/FIREMeshReader.C b/src/conversion/fire/FIREMeshReader.C index 941e1d3e53..88e9e26b98 100644 --- a/src/conversion/fire/FIREMeshReader.C +++ b/src/conversion/fire/FIREMeshReader.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2019 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -214,7 +214,7 @@ void Foam::fileFormats::FIREMeshReader::reorganize() if (owner_[faceI] > neigh_[faceI]) { - Swap(owner_[faceI], neigh_[faceI]); + std::swap(owner_[faceI], neigh_[faceI]); } } } diff --git a/src/dynamicMesh/createShellMesh/createShellMesh.C b/src/dynamicMesh/createShellMesh/createShellMesh.C index 02646f5206..364b5e7667 100644 --- a/src/dynamicMesh/createShellMesh/createShellMesh.C +++ b/src/dynamicMesh/createShellMesh/createShellMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -756,8 +756,8 @@ void Foam::createShellMesh::setRefinement if (minCelli > maxCelli) { // Swap - Swap(minCelli, maxCelli); - newF = newF.reverseFace(); + std::swap(minCelli, maxCelli); + newF.flip(); } patchi = -1; } diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/combineFaces.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/combineFaces.C index 7c843f3c8e..440fccfd22 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/combineFaces.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/combineFaces.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018-2019 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -407,7 +407,7 @@ Foam::labelListList Foam::combineFaces::getMergeSets } if (maxIndex != 0) { - Swap(faceIDs[0], faceIDs[maxIndex]); + std::swap(faceIDs[0], faceIDs[maxIndex]); } } diff --git a/src/fileFormats/vtk/read/vtkUnstructuredReader.C b/src/fileFormats/vtk/read/vtkUnstructuredReader.C index 7e67639aca..73e5a839cf 100644 --- a/src/fileFormats/vtk/read/vtkUnstructuredReader.C +++ b/src/fileFormats/vtk/read/vtkUnstructuredReader.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2016 OpenFOAM Foundation - Copyright (C) 2018-2019 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -907,9 +907,9 @@ void Foam::vtkUnstructuredReader::read(ISstream& inFile) if (((topCc - bottomCc) & bottomNormal) < 0) { // Flip top and bottom - Swap(shape[0], shape[3]); - Swap(shape[1], shape[4]); - Swap(shape[2], shape[5]); + std::swap(shape[0], shape[3]); + std::swap(shape[1], shape[4]); + std::swap(shape[2], shape[5]); nSwapped++; } } diff --git a/src/lagrangian/basic/particle/particle.C b/src/lagrangian/basic/particle/particle.C index c4d4382873..a0eaddfc02 100644 --- a/src/lagrangian/basic/particle/particle.C +++ b/src/lagrangian/basic/particle/particle.C @@ -146,7 +146,7 @@ void Foam::particle::movingTetReverseTransform void Foam::particle::reflect() { - Swap(coordinates_.c(), coordinates_.d()); + std::swap(coordinates_.c(), coordinates_.d()); } diff --git a/src/lumpedPointMotion/movement/lumpedPointMovement.C b/src/lumpedPointMotion/movement/lumpedPointMovement.C index 195307dade..1a6601d38f 100644 --- a/src/lumpedPointMotion/movement/lumpedPointMovement.C +++ b/src/lumpedPointMotion/movement/lumpedPointMovement.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -795,7 +795,7 @@ void Foam::lumpedPointMovement::setInterpolator { // Order by distance, which is not really needed, // but helps with diagnostics - Swap(nei1, nei2); + std::swap(nei1, nei2); } diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementRefine.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementRefine.C index f5d9c5f395..69deef02ce 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementRefine.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementRefine.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2015-2019 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -1166,7 +1166,7 @@ Foam::label Foam::meshRefinement::markSurfaceCurvatureRefinement if (!isMasterFace[faceI]) { - Swap(start[i], end[i]); + std::swap(start[i], end[i]); } minLevel[i] = min(cellLevel[own], neiLevel[bFaceI]); diff --git a/src/meshTools/polyTopoChange/polyTopoChange.C b/src/meshTools/polyTopoChange/polyTopoChange.C index 30268d36e3..9d7f32735a 100644 --- a/src/meshTools/polyTopoChange/polyTopoChange.C +++ b/src/meshTools/polyTopoChange/polyTopoChange.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2015-2019 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -1197,7 +1197,7 @@ void Foam::polyTopoChange::compact ) { faces_[facei].flip(); - Swap(faceOwner_[facei], faceNeighbour_[facei]); + std::swap(faceOwner_[facei], faceNeighbour_[facei]); flipFaceFlux_.flip(facei); faceZoneFlip_.flip(facei); } diff --git a/src/meshTools/searchableSurfaces/searchableCone/searchableCone.C b/src/meshTools/searchableSurfaces/searchableCone/searchableCone.C index 321f5d6a38..6200b1ff1b 100644 --- a/src/meshTools/searchableSurfaces/searchableCone/searchableCone.C +++ b/src/meshTools/searchableSurfaces/searchableCone/searchableCone.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -383,7 +383,7 @@ void Foam::searchableCone::findLineAll if (tPoint2 < tPoint1) { - Swap(tPoint1, tPoint2); + std::swap(tPoint1, tPoint2); } if (tPoint1 > magV || tPoint2 < 0) { @@ -546,7 +546,7 @@ void Foam::searchableCone::findLineAll t2 = (-b + sqrtDisc)/(2.0*a); if (t2 < t1) { - Swap(t1, t2); + std::swap(t1, t2); } if (t1 >= 0.0 && t1 <= magV && t1 >= tPoint1 && t1 <= tPoint2) diff --git a/src/meshTools/searchableSurfaces/searchableCylinder/searchableCylinder.C b/src/meshTools/searchableSurfaces/searchableCylinder/searchableCylinder.C index e6ac0dc29a..ee1f2c88bc 100644 --- a/src/meshTools/searchableSurfaces/searchableCylinder/searchableCylinder.C +++ b/src/meshTools/searchableSurfaces/searchableCylinder/searchableCylinder.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -253,7 +253,7 @@ void Foam::searchableCylinder::findLineAll tPoint2 = -(point2Start&unitDir_)/s; if (tPoint2 < tPoint1) { - Swap(tPoint1, tPoint2); + std::swap(tPoint1, tPoint2); } if (tPoint1 > magV || tPoint2 < 0) { @@ -365,7 +365,7 @@ void Foam::searchableCylinder::findLineAll t2 = (-b + sqrtDisc)/(2*a); if (t2 < t1) { - Swap(t1, t2); + std::swap(t1, t2); } if (t1 >= 0 && t1 <= magV && t1 >= tPoint1 && t1 <= tPoint2) diff --git a/src/renumber/renumberMethods/randomRenumber/randomRenumber.C b/src/renumber/renumberMethods/randomRenumber/randomRenumber.C index 9f1b704d53..8b18ecdf18 100644 --- a/src/renumber/renumberMethods/randomRenumber/randomRenumber.C +++ b/src/renumber/renumberMethods/randomRenumber/randomRenumber.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2012 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -68,7 +69,7 @@ Foam::labelList Foam::randomRenumber::renumber forAll(newToOld, i) { label j = rndGen.position