edgeCollapser: Test breaks in all possible strings

This change tests all edges when breaking strings, not just those
connected to collapsing cells. In rare cases a cell can collapse despite
none of it's connected edges being marked as collapsing, because enough
of it's points collapse together via other edges.
This commit is contained in:
Will Bainbridge
2017-11-07 18:16:03 +00:00
parent edda7d3c89
commit 3260aeed80
2 changed files with 23 additions and 53 deletions

View File

@ -854,7 +854,6 @@ void Foam::edgeCollapser::checkBoundaryPointMergeEdges
Foam::label Foam::edgeCollapser::breakStringsAtEdges
(
const PackedBoolList& markedEdges,
PackedBoolList& collapseEdge,
List<pointEdgeCollapse>& allPointInfo
) const
@ -866,44 +865,32 @@ Foam::label Foam::edgeCollapser::breakStringsAtEdges
forAll(edges, eI)
{
if (markedEdges[eI])
const edge& e = edges[eI];
const label startCollapseIndex
= allPointInfo[e.start()].collapseIndex();
if (startCollapseIndex != -1 && startCollapseIndex != -2)
{
const edge& e = edges[eI];
const label endCollapseIndex
= allPointInfo[e.end()].collapseIndex();
const label startCollapseIndex
= allPointInfo[e.start()].collapseIndex();
if (startCollapseIndex != -1 && startCollapseIndex != -2)
if (!collapseEdge[eI] && startCollapseIndex == endCollapseIndex)
{
const label endCollapseIndex
= allPointInfo[e.end()].collapseIndex();
const labelList& ptEdgesStart = pointEdges[e.start()];
if
(
!collapseEdge[eI]
&& startCollapseIndex == endCollapseIndex
)
forAll(ptEdgesStart, ptEdgeI)
{
const labelList& ptEdgesStart = pointEdges[e.start()];
const label edgeI = ptEdgesStart[ptEdgeI];
forAll(ptEdgesStart, ptEdgeI)
const label nbrPointi = edges[edgeI].otherVertex(e.start());
const label nbrIndex =
allPointInfo[nbrPointi].collapseIndex();
if (collapseEdge[edgeI] && nbrIndex == startCollapseIndex)
{
const label edgeI = ptEdgesStart[ptEdgeI];
const label nbrPointi
= edges[edgeI].otherVertex(e.start());
const label nbrIndex
= allPointInfo[nbrPointi].collapseIndex();
if
(
collapseEdge[edgeI]
&& nbrIndex == startCollapseIndex
)
{
collapseEdge[edgeI] = false;
nUncollapsed++;
}
collapseEdge[edgeI] = false;
nUncollapsed++;
}
}
}
@ -1736,8 +1723,6 @@ void Foam::edgeCollapser::consistentCollapse
}
}
PackedBoolList markedEdges(mesh_.nEdges());
if (!allowCellCollapse)
{
// Check collapsed cells
@ -1775,13 +1760,12 @@ void Foam::edgeCollapser::consistentCollapse
collapseEdge[edgeI] = false;
nUncollapsed++;
}
markedEdges[edgeI] = true;
}
nFaces += isCollapsedFace[facei] ? 1 : 0;
// Uncollapsed this face.
isCollapsedFace[facei] = false;
nFaces++;
}
}
@ -1796,20 +1780,7 @@ void Foam::edgeCollapser::consistentCollapse
}
}
syncTools::syncEdgeList
(
mesh_,
markedEdges,
orEqOp<unsigned int>(),
0
);
nUncollapsed += breakStringsAtEdges
(
markedEdges,
collapseEdge,
allPointInfo
);
nUncollapsed += breakStringsAtEdges(collapseEdge, allPointInfo);
reduce(nUncollapsed, sumOp<label>());

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -184,7 +184,6 @@ private:
// location
label breakStringsAtEdges
(
const PackedBoolList& markedEdges,
PackedBoolList& collapseEdge,
List<pointEdgeCollapse>& allPointInfo
) const;