ENH: pairPatchAgglomeration - updated constructors

This commit is contained in:
Andrew Heather
2016-12-07 09:25:42 +00:00
parent 56071431ac
commit 87056a2308
4 changed files with 61 additions and 61 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -69,7 +69,6 @@ int main(int argc, char *argv[])
bool writeAgglom = readBool(agglomDict.lookup("writeFacesAgglomeration"));
const polyBoundaryMesh& boundary = mesh.boundaryMesh();
labelListIOList finalAgglom
@ -95,15 +94,20 @@ int main(int argc, char *argv[])
{
label patchi = patchids[i];
const polyPatch& pp = boundary[patchi];
if (!pp.coupled())
{
Info << "\nAgglomerating patch : " << pp.name() << endl;
pairPatchAgglomeration agglomObject
(
pp,
pp.localFaces(),
pp.localPoints(),
agglomDict.subDict(pp.name())
);
agglomObject.agglomerate();
finalAgglom[patchi] =
agglomObject.restrictTopBottomAddressing();
@ -116,42 +120,42 @@ int main(int argc, char *argv[])
}
// - All patches which are not agglomarated are identity for finalAgglom
forAll(boundary, patchid)
// All patches which are not agglomerated are identity for finalAgglom
forAll(boundary, patchi)
{
if (finalAgglom[patchid].size() == 0)
if (finalAgglom[patchi].size() == 0)
{
finalAgglom[patchid] = identity(boundary[patchid].size());
finalAgglom[patchi] = identity(boundary[patchi].size());
}
}
// Sync agglomeration across coupled patches
labelList nbrAgglom(mesh.nFaces() - mesh.nInternalFaces(), -1);
forAll(boundary, patchid)
forAll(boundary, patchi)
{
const polyPatch& pp = boundary[patchid];
const polyPatch& pp = boundary[patchi];
if (pp.coupled())
{
finalAgglom[patchid] = identity(pp.size());
finalAgglom[patchi] = identity(pp.size());
forAll(pp, i)
{
nbrAgglom[pp.start() - mesh.nInternalFaces() + i] =
finalAgglom[patchid][i];
const label agglomi = pp.start() - mesh.nInternalFaces() + i;
nbrAgglom[agglomi] = finalAgglom[patchi][i];
}
}
}
syncTools::swapBoundaryFaceList(mesh, nbrAgglom);
forAll(boundary, patchid)
forAll(boundary, patchi)
{
const polyPatch& pp = boundary[patchid];
const polyPatch& pp = boundary[patchi];
if (pp.coupled() && !refCast<const coupledPolyPatch>(pp).owner())
{
forAll(pp, i)
{
finalAgglom[patchid][i] =
nbrAgglom[pp.start() - mesh.nInternalFaces() + i];
const label agglomi = pp.start() - mesh.nInternalFaces() + i
finalAgglom[patchi][i] = nbrAgglom[agglomi];
}
}
}
@ -179,13 +183,13 @@ int main(int argc, char *argv[])
facesAgglomeration.boundaryFieldRef();
label coarsePatchIndex = 0;
forAll(boundary, patchid)
forAll(boundary, patchi)
{
const polyPatch& pp = boundary[patchid];
const polyPatch& pp = boundary[patchi];
if (pp.size() > 0)
{
fvPatchScalarField& bFacesAgglomeration =
facesAgglomerationBf[patchid];
facesAgglomerationBf[patchi];
forAll(bFacesAgglomeration, j)
{
@ -193,11 +197,11 @@ int main(int argc, char *argv[])
index.toGlobal
(
Pstream::myProcNo(),
finalAgglom[patchid][j] + coarsePatchIndex
finalAgglom[patchi][j] + coarsePatchIndex
);
}
coarsePatchIndex += max(finalAgglom[patchid]) + 1;
coarsePatchIndex += max(finalAgglom[patchi]) + 1;
}
}