ENH: use concise forms for walking processor and cyclic boundaries

This commit is contained in:
Mark Olesen
2021-01-22 13:29:00 +01:00
parent f24e3f113f
commit 6cdf89dced
22 changed files with 525 additions and 699 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -315,21 +315,16 @@ bool Foam::functionObjects::AMIWeights::read(const dictionary& dict)
{
if (fvMeshFunctionObject::read(dict) && writeFile::read(dict))
{
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
patchIDs_.clear();
labelHashSet ids;
forAll(pbm, patchi)
{
if (isA<cyclicAMIPolyPatch>(pbm[patchi]))
{
const auto& ami =
static_cast<const cyclicAMIPolyPatch&>(pbm[patchi]);
if (ami.owner())
{
ids.insert(patchi);
}
for (const polyPatch& pp : mesh_.boundaryMesh())
{
const auto* amicpp = isA<cyclicAMIPolyPatch>(pp);
if (amicpp && amicpp->owner())
{
ids.insert(pp.index());
}
}

View File

@ -211,16 +211,11 @@ void Foam::functionObjects::extractEulerianParticles::setBlockedFaces
const polyPatch& pp = mesh_.boundaryMesh()[patchi];
const scalarField& alphafp = alphaf.boundaryField()[patchi];
const auto* cpp = isA<coupledPolyPatch>(pp);
if (isA<coupledPolyPatch>(pp))
if (cpp)
{
const coupledPolyPatch& cpp =
refCast<const coupledPolyPatch>(pp);
if (cpp.owner())
{
patchFacei = cpp.whichFace(facei);
}
patchFacei = (cpp->owner() ? pp.whichFace(facei) : -1);
}
else if (!isA<emptyPolyPatch>(pp))
{

View File

@ -193,21 +193,15 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::setFaceZoneFaces()
{
facePatchId = mesh_.boundaryMesh().whichPatch(meshFacei);
const polyPatch& pp = mesh_.boundaryMesh()[facePatchId];
const auto* cpp = isA<coupledPolyPatch>(pp);
if (isA<coupledPolyPatch>(pp))
if (cpp)
{
if (refCast<const coupledPolyPatch>(pp).owner())
{
faceId = pp.whichFace(meshFacei);
}
else
{
faceId = -1;
}
faceId = (cpp->owner() ? pp.whichFace(meshFacei) : -1);
}
else if (!isA<emptyPolyPatch>(pp))
{
faceId = meshFacei - pp.start();
faceId = pp.whichFace(meshFacei);
}
else
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2015-2020 OpenCFD Ltd.
Copyright (C) 2015-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -208,6 +208,7 @@ void Foam::functionObjects::fluxSummary::initialiseFaceZone
forAll(fZone, i)
{
label facei = fZone[i];
const bool isFlip = fZone.flipMap()[i];
label faceID = -1;
label facePatchID = -1;
@ -220,20 +221,15 @@ void Foam::functionObjects::fluxSummary::initialiseFaceZone
{
facePatchID = mesh_.boundaryMesh().whichPatch(facei);
const polyPatch& pp = mesh_.boundaryMesh()[facePatchID];
if (isA<coupledPolyPatch>(pp))
const auto* cpp = isA<coupledPolyPatch>(pp);
if (cpp)
{
if (refCast<const coupledPolyPatch>(pp).owner())
{
faceID = pp.whichFace(facei);
}
else
{
faceID = -1;
}
faceID = (cpp->owner() ? pp.whichFace(facei) : -1);
}
else if (!isA<emptyPolyPatch>(pp))
{
faceID = facei - pp.start();
faceID = pp.whichFace(facei);
}
else
{
@ -245,15 +241,7 @@ void Foam::functionObjects::fluxSummary::initialiseFaceZone
if (faceID >= 0)
{
// Orientation set by faceZone flip map
if (fZone.flipMap()[i])
{
flips.append(true);
}
else
{
flips.append(false);
}
flips.append(isFlip);
faceIDs.append(faceID);
facePatchIDs.append(facePatchID);
}
@ -317,20 +305,15 @@ void Foam::functionObjects::fluxSummary::initialiseFaceZoneAndDirection
{
facePatchID = mesh_.boundaryMesh().whichPatch(facei);
const polyPatch& pp = mesh_.boundaryMesh()[facePatchID];
if (isA<coupledPolyPatch>(pp))
const auto* cpp = isA<coupledPolyPatch>(pp);
if (cpp)
{
if (refCast<const coupledPolyPatch>(pp).owner())
{
faceID = pp.whichFace(facei);
}
else
{
faceID = -1;
}
faceID = (cpp->owner() ? pp.whichFace(facei) : -1);
}
else if (!isA<emptyPolyPatch>(pp))
{
faceID = facei - pp.start();
faceID = pp.whichFace(facei);
}
else
{