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 "polyTopoChange.H"
#include "polyTopoChangeMap.H" #include "polyTopoChangeMap.H"
#include "edgeFaceCirculator.H" #include "edgeFaceCirculator.H"
#include "mergePoints.H"
#include "OFstream.H" #include "OFstream.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -42,43 +41,6 @@ namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * 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. // Dump state so far.
void Foam::meshDualiser::dumpPolyTopoChange void Foam::meshDualiser::dumpPolyTopoChange
( (
@ -215,29 +177,6 @@ Foam::label Foam::meshDualiser::addInternalFace
reverse(newFace); 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; label zoneID = -1;
bool zoneFlip = false; bool zoneFlip = false;
if (masterFacei != -1) if (masterFacei != -1)
@ -1269,7 +1208,6 @@ void Foam::meshDualiser::setRefinement
if (debug) if (debug)
{ {
dumpPolyTopoChange(meshMod, "generatedPoints_"); dumpPolyTopoChange(meshMod, "generatedPoints_");
checkPolyTopoChange(meshMod);
} }

View File

@ -31,7 +31,6 @@ License
#include "polyMesh.H" #include "polyMesh.H"
#include "distributionMap.H" #include "distributionMap.H"
#include "labelIOList.H" #include "labelIOList.H"
#include "mergePoints.H"
#include "globalIndexAndTransform.H" #include "globalIndexAndTransform.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * 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 Foam::label Foam::globalMeshData::nGlobalPoints() const
{ {
if (nGlobalPoints_ == -1) if (nGlobalPoints_ == -1)

View File

@ -459,17 +459,11 @@ public:
const labelList& sharedPointGlobalLabels() const; const labelList& sharedPointGlobalLabels() const;
//- Collect coordinates of shared points on all processors. //- Collect coordinates of shared points on all processors.
// (does parallel communication!) // Does parallel communication. Not valid for points on
// Note: not valid for cyclicParallel since shared cyclic points // cyclics since these combine into a single shared point but
// are merged into single global point. (use geometricSharedPoints // span multiple locations.
// instead)
pointField sharedPoints() const; 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 // Globally shared edge addressing

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,7 +24,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "edgeMesh.H" #include "edgeMesh.H"
#include "mergePoints.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "addToMemberFunctionSelectionTable.H" #include "addToMemberFunctionSelectionTable.H"
#include "ListOps.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() void Foam::edgeMesh::mergeEdges()
{ {
EdgeMap<label> existingEdges(2*edges_.size()); EdgeMap<label> existingEdges(2*edges_.size());

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -249,10 +249,6 @@ public:
//- Scale points. A non-positive factor is ignored //- Scale points. A non-positive factor is ignored
virtual void scalePoints(const scalar); 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 //- Merge duplicate edges
virtual void mergeEdges(); virtual void mergeEdges();

View File

@ -27,7 +27,6 @@ License
#include "OFstream.H" #include "OFstream.H"
#include "Time.H" #include "Time.H"
#include "globalIndex.H" #include "globalIndex.H"
#include "mergePoints.H"
#include "processorPolyPatch.H" #include "processorPolyPatch.H"
#include "SubField.H" #include "SubField.H"
@ -203,7 +202,6 @@ Foam::autoPtr<Foam::distributionMap> Foam::meshToMesh::calcProcMap
} }
} }
// debug printing
if (debug) if (debug)
{ {
Pout<< "Of my " << cells.size() << " target cells I need to send to:" 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]);
}
}
}
} }