Commit 94e1fd68 authored by Henry Weller's avatar Henry Weller
Browse files

pairPatchAgglomeration: Do not use the result agglomeratePatch if the return...

pairPatchAgglomeration: Do not use the result agglomeratePatch if the return indicates it is not valid
Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1157
parent d8f45cf8
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -147,6 +147,7 @@ void Foam::pairPatchAgglomeration::setEdgeWeights
if (eFaces.size() == 2)
{
const edge edgeCommon = edge(eFaces[0], eFaces[1]);
if (facePairWeight_.found(edgeCommon))
{
facePairWeight_[edgeCommon] += edgeLength;
......@@ -155,6 +156,7 @@ void Foam::pairPatchAgglomeration::setEdgeWeights
{
facePairWeight_.insert(edgeCommon, edgeLength);
}
// If the fine 'pair' faces was featured edge so it is
// the coarse 'pair'
if (fineFeaturedFaces.found(edgeCommon))
......@@ -366,7 +368,7 @@ bool Foam::pairPatchAgglomeration::agglomeratePatch
void Foam::pairPatchAgglomeration:: agglomerate()
{
label nPairLevels = 0;
label nCreatedLevels = 1; //0 level is the base patch
label nCreatedLevels = 1; // 0 level is the base patch
label nCoarseFaces = 0;
label nCoarseFacesOld = 0;
......@@ -374,9 +376,9 @@ void Foam::pairPatchAgglomeration:: agglomerate()
{
const bPatch& patch = patchLevels_[nCreatedLevels - 1];
tmp<labelField> finalAgglomPtr(new labelField(patch.size()));
bool agglomOK = false;
while (!agglomOK)
do
{
finalAgglomPtr = agglomerateOneLevel
(
......@@ -386,34 +388,42 @@ void Foam::pairPatchAgglomeration:: agglomerate()
if (nCoarseFaces > 0)
{
agglomOK = agglomeratePatch
if
(
patch,
finalAgglomPtr,
nCreatedLevels
);
(
agglomOK = agglomeratePatch
(
patch,
finalAgglomPtr,
nCreatedLevels
)
)
)
{
restrictAddressing_.set(nCreatedLevels, finalAgglomPtr);
mapBaseToTopAgglom(nCreatedLevels);
setEdgeWeights(nCreatedLevels);
restrictAddressing_.set(nCreatedLevels, finalAgglomPtr);
mapBaseToTopAgglom(nCreatedLevels);
setEdgeWeights(nCreatedLevels);
if (nPairLevels % mergeLevels_)
{
combineLevels(nCreatedLevels);
}
else
{
nCreatedLevels++;
}
if (nPairLevels % mergeLevels_)
{
combineLevels(nCreatedLevels);
nPairLevels++;
}
else
{
nCreatedLevels++;
}
nPairLevels++;
}
else
{
agglomOK = true;
}
reduce(nCoarseFaces, sumOp<label>());
}
} while (!agglomOK);
nFaces_[nCreatedLevels] = nCoarseFaces;
......@@ -456,7 +466,7 @@ Foam::tmp<Foam::labelField> Foam::pairPatchAgglomeration::agglomerateOneLevel
label matchFaceNeibNo = -1;
scalar maxFaceWeight = -GREAT;
// check faces to find ungrouped neighbour with largest face weight
// Check faces to find ungrouped neighbour with largest face weight
forAll(fFaces, i)
{
label faceNeig = fFaces[i];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment