mergePoints: Removed unused point merging code

This commit is contained in:
Will Bainbridge
2022-09-13 12:32:40 +01:00
parent e84f3d110c
commit e8ac5f424e
6 changed files with 5 additions and 218 deletions

View File

@ -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<point>(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);
}

View File

@ -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<pointField>());
// 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)

View File

@ -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

View File

@ -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<label> edgeToLabel(2*edges_.size());
label newEdgeI = 0;
forAll(edges_, edgeI)
{
const edge& e = edges_[edgeI];
if (e[0] != e[1])
{
if (edgeToLabel.insert(e, newEdgeI))
{
newEdgeI++;
}
}
}
edges_.setSize(newEdgeI);
forAllConstIter(EdgeMap<label>, edgeToLabel, iter)
{
edges_[iter()] = iter.key();
}
}
}
void Foam::edgeMesh::mergeEdges()
{
EdgeMap<label> existingEdges(2*edges_.size());

View File

@ -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
@ -249,10 +249,6 @@ public:
//- Scale points. A non-positive factor is ignored
virtual void scalePoints(const scalar);
//- Merge common points (points within mergeDist). Return map from
// old to new points.
virtual void mergePoints(const scalar mergeDist, labelList&);
//- Merge duplicate edges
virtual void mergeEdges();

View File

@ -27,7 +27,6 @@ License
#include "OFstream.H"
#include "Time.H"
#include "globalIndex.H"
#include "mergePoints.H"
#include "processorPolyPatch.H"
#include "SubField.H"
@ -203,7 +202,6 @@ Foam::autoPtr<Foam::distributionMap> Foam::meshToMesh::calcProcMap
}
}
// debug printing
if (debug)
{
Pout<< "Of my " << cells.size() << " target cells I need to send to:"
@ -830,38 +828,6 @@ void Foam::meshToMesh::distributeAndMergeCells
}
}
}
if (debug)
{
// only merging points in debug mode
labelList oldToNew;
pointField newTgtPoints;
bool hasMerged = mergePoints
(
tgtPoints,
small,
false,
oldToNew,
newTgtPoints
);
if (hasMerged)
{
if (debug)
{
Pout<< "Merged from " << tgtPoints.size()
<< " down to " << newTgtPoints.size() << " points" << endl;
}
tgtPoints.transfer(newTgtPoints);
forAll(tgtFaces, i)
{
inplaceRenumber(oldToNew, tgtFaces[i]);
}
}
}
}