From e8ac5f424e8388f458293976f64242c1b71ff79c Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Tue, 13 Sep 2022 12:32:40 +0100 Subject: [PATCH] mergePoints: Removed unused point merging code --- .../manipulation/polyDualMesh/meshDualiser.C | 62 -------------- .../polyMesh/globalMeshData/globalMeshData.C | 29 ------- .../polyMesh/globalMeshData/globalMeshData.H | 12 +-- src/meshTools/edgeMesh/edgeMesh.C | 80 +------------------ src/meshTools/edgeMesh/edgeMesh.H | 6 +- .../meshToMesh/meshToMeshParallelOps.C | 34 -------- 6 files changed, 5 insertions(+), 218 deletions(-) diff --git a/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C b/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C index e792e2fcd3..71fb47db43 100644 --- a/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C +++ b/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C @@ -29,7 +29,6 @@ License #include "polyTopoChange.H" #include "polyTopoChangeMap.H" #include "edgeFaceCirculator.H" -#include "mergePoints.H" #include "OFstream.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -42,43 +41,6 @@ namespace Foam // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::meshDualiser::checkPolyTopoChange(const polyTopoChange& meshMod) -{ - // Assume no removed points - pointField points(meshMod.points().size()); - forAll(meshMod.points(), i) - { - points[i] = meshMod.points()[i]; - } - - labelList oldToNew; - label nUnique = mergePoints - ( - points, - 1e-6, - false, - oldToNew - ); - - if (nUnique < points.size()) - { - labelListList newToOld(invertOneToMany(nUnique, oldToNew)); - - forAll(newToOld, newI) - { - if (newToOld[newI].size() != 1) - { - FatalErrorInFunction - << "duplicate verts:" << newToOld[newI] - << " coords:" - << UIndirectList(points, newToOld[newI])() - << abort(FatalError); - } - } - } -} - - // Dump state so far. void Foam::meshDualiser::dumpPolyTopoChange ( @@ -215,29 +177,6 @@ Foam::label Foam::meshDualiser::addInternalFace reverse(newFace); } - if (debug) - { - pointField facePoints(meshMod.points(), newFace); - - labelList oldToNew; - label nUnique = mergePoints - ( - facePoints, - 1e-6, - false, - oldToNew - ); - - if (nUnique < facePoints.size()) - { - FatalErrorInFunction - << "verts:" << verts << " newFace:" << newFace - << " face points:" << facePoints - << abort(FatalError); - } - } - - label zoneID = -1; bool zoneFlip = false; if (masterFacei != -1) @@ -1269,7 +1208,6 @@ void Foam::meshDualiser::setRefinement if (debug) { dumpPolyTopoChange(meshMod, "generatedPoints_"); - checkPolyTopoChange(meshMod); } diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C index ae8df070b4..cebbf3e1fa 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C @@ -31,7 +31,6 @@ License #include "polyMesh.H" #include "distributionMap.H" #include "labelIOList.H" -#include "mergePoints.H" #include "globalIndexAndTransform.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -1987,34 +1986,6 @@ Foam::pointField Foam::globalMeshData::sharedPoints() const } -Foam::pointField Foam::globalMeshData::geometricSharedPoints() const -{ - // Get coords of my shared points - pointField sharedPoints(mesh_.points(), sharedPointLabels()); - - // Append from all processors - combineReduce(sharedPoints, ListPlusEqOp()); - - // Merge tolerance - scalar tolDim = matchTol_ * mesh_.bounds().mag(); - - // And see how many are unique - labelList pMap; - pointField mergedPoints; - - Foam::mergePoints - ( - sharedPoints, // coordinates to merge - tolDim, // tolerance - false, // verbosity - pMap, - mergedPoints - ); - - return mergedPoints; -} - - Foam::label Foam::globalMeshData::nGlobalPoints() const { if (nGlobalPoints_ == -1) diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H index 5edbbbd7c5..37cd330bad 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H @@ -459,17 +459,11 @@ public: const labelList& sharedPointGlobalLabels() const; //- Collect coordinates of shared points on all processors. - // (does parallel communication!) - // Note: not valid for cyclicParallel since shared cyclic points - // are merged into single global point. (use geometricSharedPoints - // instead) + // Does parallel communication. Not valid for points on + // cyclics since these combine into a single shared point but + // span multiple locations. pointField sharedPoints() const; - //- Like sharedPoints but keeps cyclic points separate. - // (does geometric merging; uses matchTol_*bb as merging tolerance) - // Use sharedPoints() instead. - pointField geometricSharedPoints() const; - // Globally shared edge addressing diff --git a/src/meshTools/edgeMesh/edgeMesh.C b/src/meshTools/edgeMesh/edgeMesh.C index 328e0cbd82..bff13e5bdf 100644 --- a/src/meshTools/edgeMesh/edgeMesh.C +++ b/src/meshTools/edgeMesh/edgeMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,7 +24,6 @@ License \*---------------------------------------------------------------------------*/ #include "edgeMesh.H" -#include "mergePoints.H" #include "addToRunTimeSelectionTable.H" #include "addToMemberFunctionSelectionTable.H" #include "ListOps.H" @@ -277,83 +276,6 @@ void Foam::edgeMesh::scalePoints(const scalar scaleFactor) } -void Foam::edgeMesh::mergePoints -( - const scalar mergeDist, - labelList& reversePointMap - // labelList& edgeMap -) -{ - pointField newPoints; - labelList pointMap; - - bool hasMerged = Foam::mergePoints - ( - points_, - mergeDist, - false, - pointMap, - newPoints, - vector::zero - ); - - if (hasMerged) - { - pointEdgesPtr_.clear(); - - points_.transfer(newPoints); - - // connectivity changed - pointEdgesPtr_.clear(); - - // Renumber and make sure e[0] < e[1] (not really necessary) - forAll(edges_, edgeI) - { - edge& e = edges_[edgeI]; - - label p0 = pointMap[e[0]]; - label p1 = pointMap[e[1]]; - - if (p0 < p1) - { - e[0] = p0; - e[1] = p1; - } - else - { - e[0] = p1; - e[1] = p0; - } - } - - // Compact using a hashtable and commutative hash of edge. - EdgeMap