mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: align faceZone handling (functionObjects, sampling)
- pattern as per surfaceFieldValue::setFaceZoneFaces()
1. define faceId, facePatchId assuming an internal face
2. if actually a boundary face:
- get facePatchId
- ignore if emptyPolyPatch or coupledPolyPatch (neighbour side)
- get patch relative faceId
This currently seems to be the least amount of code clutter.
ENH: recover some memory my shrinking lists in fluxSummary
BUG: potentially trailing rubbish in the heatExchangerModel lists
- the final resize to length actually used was missing.
Does not affect any released versions
This commit is contained in:
@ -314,7 +314,7 @@ void Foam::ensightMesh::correct()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Face exclusion for empty/processor types
|
// Face exclusion for empty types and neighbour side of coupled
|
||||||
// so they are ignored for face zones
|
// so they are ignored for face zones
|
||||||
|
|
||||||
if (fzoneIds.size())
|
if (fzoneIds.size())
|
||||||
@ -324,15 +324,16 @@ void Foam::ensightMesh::correct()
|
|||||||
|
|
||||||
for (const polyPatch& p : mesh_.boundaryMesh())
|
for (const polyPatch& p : mesh_.boundaryMesh())
|
||||||
{
|
{
|
||||||
const auto* procPatch = isA<processorPolyPatch>(p);
|
const auto* cpp = isA<coupledPolyPatch>(p);
|
||||||
|
|
||||||
if (isA<emptyPolyPatch>(p))
|
if
|
||||||
|
(
|
||||||
|
isA<emptyPolyPatch>(p)
|
||||||
|
|| (cpp && !cpp->owner())
|
||||||
|
)
|
||||||
{
|
{
|
||||||
excludeFace.set(p.range());
|
// Ignore empty patch
|
||||||
}
|
// Ignore neighbour side of coupled
|
||||||
else if (procPatch && !procPatch->owner())
|
|
||||||
{
|
|
||||||
// Exclude neighbour-side, retain owner-side only
|
|
||||||
excludeFace.set(p.range());
|
excludeFace.set(p.range());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -168,9 +168,9 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::setFaceZoneFaces()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
faceId_.resize(numFaces);
|
faceId_.resize_nocopy(numFaces);
|
||||||
facePatchId_.resize(numFaces);
|
facePatchId_.resize_nocopy(numFaces);
|
||||||
faceFlip_.resize(numFaces);
|
faceFlip_.resize_nocopy(numFaces);
|
||||||
|
|
||||||
numFaces = 0;
|
numFaces = 0;
|
||||||
|
|
||||||
@ -192,21 +192,20 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::setFaceZoneFaces()
|
|||||||
{
|
{
|
||||||
facePatchId = mesh_.boundaryMesh().whichPatch(meshFacei);
|
facePatchId = mesh_.boundaryMesh().whichPatch(meshFacei);
|
||||||
const polyPatch& pp = mesh_.boundaryMesh()[facePatchId];
|
const polyPatch& pp = mesh_.boundaryMesh()[facePatchId];
|
||||||
|
|
||||||
|
if (isA<emptyPolyPatch>(pp))
|
||||||
|
{
|
||||||
|
continue; // Ignore empty patch
|
||||||
|
}
|
||||||
|
|
||||||
const auto* cpp = isA<coupledPolyPatch>(pp);
|
const auto* cpp = isA<coupledPolyPatch>(pp);
|
||||||
|
|
||||||
if (cpp)
|
if (cpp && !cpp->owner())
|
||||||
{
|
{
|
||||||
faceId = (cpp->owner() ? pp.whichFace(meshFacei) : -1);
|
continue; // Ignore neighbour side
|
||||||
}
|
|
||||||
else if (!isA<emptyPolyPatch>(pp))
|
|
||||||
{
|
|
||||||
faceId = pp.whichFace(meshFacei);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
faceId = -1;
|
|
||||||
facePatchId = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
faceId = pp.whichFace(meshFacei);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (faceId >= 0)
|
if (faceId >= 0)
|
||||||
|
|||||||
@ -201,56 +201,62 @@ void Foam::functionObjects::fluxSummary::initialiseFaceZone
|
|||||||
names.append(faceZoneName);
|
names.append(faceZoneName);
|
||||||
directions.append(Zero); // dummy value
|
directions.append(Zero); // dummy value
|
||||||
|
|
||||||
DynamicList<label> faceIDs(fZone.size());
|
labelList faceIds(fZone.size());
|
||||||
DynamicList<label> facePatchIDs(fZone.size());
|
labelList facePatchIds(fZone.size());
|
||||||
DynamicList<bool> flips(fZone.size());
|
boolList faceFlips(fZone.size());
|
||||||
|
|
||||||
|
// Total number of faces selected
|
||||||
|
label numFaces = 0;
|
||||||
|
|
||||||
forAll(fZone, i)
|
forAll(fZone, i)
|
||||||
{
|
{
|
||||||
label facei = fZone[i];
|
const label meshFacei = fZone[i];
|
||||||
const bool isFlip = fZone.flipMap()[i];
|
const bool isFlip = fZone.flipMap()[i];
|
||||||
|
|
||||||
label faceID = -1;
|
// Internal faces
|
||||||
label facePatchID = -1;
|
label faceId = meshFacei;
|
||||||
if (mesh_.isInternalFace(facei))
|
label facePatchId = -1;
|
||||||
|
|
||||||
|
// Boundary faces
|
||||||
|
if (!mesh_.isInternalFace(meshFacei))
|
||||||
{
|
{
|
||||||
faceID = facei;
|
facePatchId = mesh_.boundaryMesh().whichPatch(meshFacei);
|
||||||
facePatchID = -1;
|
const polyPatch& pp = mesh_.boundaryMesh()[facePatchId];
|
||||||
}
|
|
||||||
else
|
if (isA<emptyPolyPatch>(pp))
|
||||||
{
|
{
|
||||||
facePatchID = mesh_.boundaryMesh().whichPatch(facei);
|
continue; // Ignore empty patch
|
||||||
const polyPatch& pp = mesh_.boundaryMesh()[facePatchID];
|
}
|
||||||
|
|
||||||
const auto* cpp = isA<coupledPolyPatch>(pp);
|
const auto* cpp = isA<coupledPolyPatch>(pp);
|
||||||
|
|
||||||
if (cpp)
|
if (cpp && !cpp->owner())
|
||||||
{
|
{
|
||||||
faceID = (cpp->owner() ? pp.whichFace(facei) : -1);
|
continue; // Ignore neighbour side
|
||||||
}
|
|
||||||
else if (!isA<emptyPolyPatch>(pp))
|
|
||||||
{
|
|
||||||
faceID = pp.whichFace(facei);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
faceID = -1;
|
|
||||||
facePatchID = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
faceId = pp.whichFace(meshFacei);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (faceID >= 0)
|
if (faceId >= 0)
|
||||||
{
|
{
|
||||||
// Orientation set by faceZone flip map
|
// Orientation set by faceZone flip map
|
||||||
flips.append(isFlip);
|
faceIds[numFaces] = faceId;
|
||||||
faceIDs.append(faceID);
|
facePatchIds[numFaces] = facePatchId;
|
||||||
facePatchIDs.append(facePatchID);
|
faceFlips[numFaces] = isFlip;
|
||||||
|
|
||||||
|
++numFaces;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// could reduce some copying here
|
// Shrink to size used
|
||||||
faceID.append(faceIDs);
|
faceIds.resize(numFaces);
|
||||||
facePatchID.append(facePatchIDs);
|
facePatchIds.resize(numFaces);
|
||||||
faceFlip.append(flips);
|
faceFlips.resize(numFaces);
|
||||||
|
|
||||||
|
faceID.append(std::move(faceIds));
|
||||||
|
facePatchID.append(std::move(facePatchIds));
|
||||||
|
faceFlip.append(std::move(faceFlips));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -281,78 +287,84 @@ void Foam::functionObjects::fluxSummary::initialiseFaceZoneAndDirection
|
|||||||
names.append(faceZoneName);
|
names.append(faceZoneName);
|
||||||
directions.append(refDir);
|
directions.append(refDir);
|
||||||
|
|
||||||
DynamicList<label> faceIDs(fZone.size());
|
labelList faceIds(fZone.size());
|
||||||
DynamicList<label> facePatchIDs(fZone.size());
|
labelList facePatchIds(fZone.size());
|
||||||
DynamicList<bool> flips(fZone.size());
|
boolList faceFlips(fZone.size());
|
||||||
|
|
||||||
const surfaceVectorField& Sf = mesh_.Sf();
|
const surfaceVectorField& Sf = mesh_.Sf();
|
||||||
const surfaceScalarField& magSf = mesh_.magSf();
|
const surfaceScalarField& magSf = mesh_.magSf();
|
||||||
|
|
||||||
vector n(Zero);
|
vector n(Zero);
|
||||||
|
|
||||||
|
// Total number of faces selected
|
||||||
|
label numFaces = 0;
|
||||||
|
|
||||||
forAll(fZone, i)
|
forAll(fZone, i)
|
||||||
{
|
{
|
||||||
label facei = fZone[i];
|
const label meshFacei = fZone[i];
|
||||||
|
|
||||||
label faceID = -1;
|
// Internal faces
|
||||||
label facePatchID = -1;
|
label faceId = meshFacei;
|
||||||
if (mesh_.isInternalFace(facei))
|
label facePatchId = -1;
|
||||||
|
|
||||||
|
// Boundary faces
|
||||||
|
if (!mesh_.isInternalFace(meshFacei))
|
||||||
{
|
{
|
||||||
faceID = facei;
|
facePatchId = mesh_.boundaryMesh().whichPatch(meshFacei);
|
||||||
facePatchID = -1;
|
const polyPatch& pp = mesh_.boundaryMesh()[facePatchId];
|
||||||
}
|
|
||||||
else
|
if (isA<emptyPolyPatch>(pp))
|
||||||
{
|
{
|
||||||
facePatchID = mesh_.boundaryMesh().whichPatch(facei);
|
continue; // Ignore empty patch
|
||||||
const polyPatch& pp = mesh_.boundaryMesh()[facePatchID];
|
}
|
||||||
|
|
||||||
const auto* cpp = isA<coupledPolyPatch>(pp);
|
const auto* cpp = isA<coupledPolyPatch>(pp);
|
||||||
|
|
||||||
if (cpp)
|
if (cpp && !cpp->owner())
|
||||||
{
|
{
|
||||||
faceID = (cpp->owner() ? pp.whichFace(facei) : -1);
|
continue; // Ignore neighbour side
|
||||||
}
|
|
||||||
else if (!isA<emptyPolyPatch>(pp))
|
|
||||||
{
|
|
||||||
faceID = pp.whichFace(facei);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
faceID = -1;
|
|
||||||
facePatchID = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
faceId = pp.whichFace(meshFacei);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (faceID >= 0)
|
if (faceId >= 0)
|
||||||
{
|
{
|
||||||
// orientation set by comparison with reference direction
|
// Orientation set by comparison with reference direction
|
||||||
if (facePatchID != -1)
|
if (facePatchId != -1)
|
||||||
{
|
{
|
||||||
n = Sf.boundaryField()[facePatchID][faceID]
|
n = Sf.boundaryField()[facePatchId][faceId]
|
||||||
/(magSf.boundaryField()[facePatchID][faceID] + ROOTVSMALL);
|
/(magSf.boundaryField()[facePatchId][faceId] + ROOTVSMALL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
n = Sf[faceID]/(magSf[faceID] + ROOTVSMALL);
|
n = Sf[faceId]/(magSf[faceId] + ROOTVSMALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((n & refDir) > tolerance_)
|
if ((n & refDir) > tolerance_)
|
||||||
{
|
{
|
||||||
flips.append(false);
|
faceFlips[numFaces] = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flips.append(true);
|
faceFlips[numFaces] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
faceIDs.append(faceID);
|
faceIds[numFaces] = faceId;
|
||||||
facePatchIDs.append(facePatchID);
|
facePatchIds[numFaces] = facePatchId;
|
||||||
|
|
||||||
|
++numFaces;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// could reduce copying here
|
// Shrink to size used
|
||||||
faceID.append(faceIDs);
|
faceIds.resize(numFaces);
|
||||||
facePatchID.append(facePatchIDs);
|
facePatchIds.resize(numFaces);
|
||||||
faceFlip.append(flips);
|
faceFlips.resize(numFaces);
|
||||||
|
|
||||||
|
faceID.append(std::move(faceIds));
|
||||||
|
facePatchID.append(std::move(facePatchIds));
|
||||||
|
faceFlip.append(std::move(faceFlips));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -498,7 +510,7 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection
|
|||||||
<< "Starting walk to split patch into faceZones"
|
<< "Starting walk to split patch into faceZones"
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
globalIndex globalFaces(patch.size());
|
const globalIndex globalFaces(patch.size());
|
||||||
|
|
||||||
label oldFaceID = 0;
|
label oldFaceID = 0;
|
||||||
label regioni = 0;
|
label regioni = 0;
|
||||||
|
|||||||
@ -70,7 +70,7 @@ setFaceZoneFaces(const dictionary& dict)
|
|||||||
|
|
||||||
label numFaces = fZone.size();
|
label numFaces = fZone.size();
|
||||||
|
|
||||||
if (!returnReduce(bool(numFaces), orOp<bool>()))
|
if (!returnReduceOr(numFaces))
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction(dict)
|
FatalIOErrorInFunction(dict)
|
||||||
<< "referenceFaceZone: " << faceZoneName
|
<< "referenceFaceZone: " << faceZoneName
|
||||||
@ -78,49 +78,55 @@ setFaceZoneFaces(const dictionary& dict)
|
|||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
faceId_.resize(numFaces);
|
faceId_.resize_nocopy(numFaces);
|
||||||
facePatchId_.resize(numFaces);
|
facePatchId_.resize_nocopy(numFaces);
|
||||||
|
|
||||||
numFaces = 0;
|
numFaces = 0;
|
||||||
|
|
||||||
forAll(fZone, i)
|
// TDB: handle multiple zones
|
||||||
{
|
{
|
||||||
const label meshFacei = fZone[i];
|
forAll(fZone, i)
|
||||||
|
|
||||||
// Internal faces
|
|
||||||
label faceId = meshFacei;
|
|
||||||
label facePatchId = -1;
|
|
||||||
|
|
||||||
// Boundary faces
|
|
||||||
if (!mesh.isInternalFace(meshFacei))
|
|
||||||
{
|
{
|
||||||
facePatchId = mesh.boundaryMesh().whichPatch(meshFacei);
|
const label meshFacei = fZone[i];
|
||||||
const polyPatch& pp = mesh.boundaryMesh()[facePatchId];
|
|
||||||
const auto* cpp = isA<coupledPolyPatch>(pp);
|
|
||||||
|
|
||||||
if (cpp)
|
// Internal faces
|
||||||
{
|
label faceId = meshFacei;
|
||||||
faceId = (cpp->owner() ? pp.whichFace(meshFacei) : -1);
|
label facePatchId = -1;
|
||||||
}
|
|
||||||
else if (!isA<emptyPolyPatch>(pp))
|
// Boundary faces
|
||||||
|
if (!mesh.isInternalFace(meshFacei))
|
||||||
{
|
{
|
||||||
|
facePatchId = mesh.boundaryMesh().whichPatch(meshFacei);
|
||||||
|
const polyPatch& pp = mesh.boundaryMesh()[facePatchId];
|
||||||
|
|
||||||
|
if (isA<emptyPolyPatch>(pp))
|
||||||
|
{
|
||||||
|
continue; // Ignore empty patch
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto* cpp = isA<coupledPolyPatch>(pp);
|
||||||
|
|
||||||
|
if (cpp && !cpp->owner())
|
||||||
|
{
|
||||||
|
continue; // Ignore neighbour side
|
||||||
|
}
|
||||||
|
|
||||||
faceId = pp.whichFace(meshFacei);
|
faceId = pp.whichFace(meshFacei);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (faceId >= 0)
|
||||||
{
|
{
|
||||||
faceId = -1;
|
faceId_[numFaces] = faceId;
|
||||||
facePatchId = -1;
|
facePatchId_[numFaces] = facePatchId;
|
||||||
|
|
||||||
|
++numFaces;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (faceId >= 0)
|
|
||||||
{
|
|
||||||
faceId_[numFaces] = faceId;
|
|
||||||
facePatchId_[numFaces] = facePatchId;
|
|
||||||
|
|
||||||
++numFaces;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Shrink to size used
|
||||||
|
faceId_.resize(numFaces);
|
||||||
|
facePatchId_.resize(numFaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -76,51 +76,58 @@ void Foam::fv::directionalPressureGradientExplicitSource::initialise()
|
|||||||
{
|
{
|
||||||
const faceZone& fZone = mesh_.faceZones()[zoneID_];
|
const faceZone& fZone = mesh_.faceZones()[zoneID_];
|
||||||
|
|
||||||
faceId_.setSize(fZone.size());
|
// Total number of faces selected
|
||||||
facePatchId_.setSize(fZone.size());
|
label numFaces = fZone.size();
|
||||||
|
|
||||||
label count = 0;
|
faceId_.resize_nocopy(numFaces);
|
||||||
forAll(fZone, i)
|
facePatchId_.resize_nocopy(numFaces);
|
||||||
|
|
||||||
|
numFaces = 0;
|
||||||
|
|
||||||
|
// TDB: handle multiple zones
|
||||||
{
|
{
|
||||||
const label faceI = fZone[i];
|
forAll(fZone, i)
|
||||||
|
|
||||||
label faceId = -1;
|
|
||||||
label facePatchId = -1;
|
|
||||||
if (mesh_.isInternalFace(faceI))
|
|
||||||
{
|
{
|
||||||
faceId = faceI;
|
const label meshFacei = fZone[i];
|
||||||
facePatchId = -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
facePatchId = mesh_.boundaryMesh().whichPatch(faceI);
|
|
||||||
const polyPatch& pp = mesh_.boundaryMesh()[facePatchId];
|
|
||||||
const auto* cpp = isA<coupledPolyPatch>(pp);
|
|
||||||
|
|
||||||
if (cpp)
|
// Internal faces
|
||||||
{
|
label faceId = meshFacei;
|
||||||
faceId = (cpp->owner() ? pp.whichFace(faceI) : -1);
|
label facePatchId = -1;
|
||||||
}
|
|
||||||
else if (!isA<emptyPolyPatch>(pp))
|
|
||||||
{
|
|
||||||
faceId = pp.whichFace(faceI);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
faceId = -1;
|
|
||||||
facePatchId = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (faceId >= 0)
|
// Boundary faces
|
||||||
{
|
if (!mesh_.isInternalFace(meshFacei))
|
||||||
facePatchId_[count] = facePatchId;
|
{
|
||||||
faceId_[count] = faceId;
|
facePatchId = mesh_.boundaryMesh().whichPatch(meshFacei);
|
||||||
count++;
|
const polyPatch& pp = mesh_.boundaryMesh()[facePatchId];
|
||||||
|
|
||||||
|
if (isA<emptyPolyPatch>(pp))
|
||||||
|
{
|
||||||
|
continue; // Ignore empty patch
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto* cpp = isA<coupledPolyPatch>(pp);
|
||||||
|
|
||||||
|
if (cpp && !cpp->owner())
|
||||||
|
{
|
||||||
|
continue; // Ignore neighbour side
|
||||||
|
}
|
||||||
|
|
||||||
|
faceId = pp.whichFace(meshFacei);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (faceId >= 0)
|
||||||
|
{
|
||||||
|
faceId_[numFaces] = faceId;
|
||||||
|
facePatchId_[numFaces] = facePatchId;
|
||||||
|
|
||||||
|
++numFaces;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
faceId_.setSize(count);
|
|
||||||
facePatchId_.setSize(count);
|
// Shrink to size used
|
||||||
|
faceId_.resize(numFaces);
|
||||||
|
facePatchId_.resize(numFaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -78,60 +78,62 @@ void Foam::heatExchangerModel::initialise()
|
|||||||
|
|
||||||
const faceZone& fZone = mesh_.faceZones()[zoneID];
|
const faceZone& fZone = mesh_.faceZones()[zoneID];
|
||||||
|
|
||||||
faceId_.setSize(fZone.size());
|
// Total number of faces selected
|
||||||
facePatchId_.setSize(fZone.size());
|
label numFaces = fZone.size();
|
||||||
faceSign_.setSize(fZone.size());
|
|
||||||
|
|
||||||
label count = 0;
|
faceId_.resize_nocopy(numFaces);
|
||||||
forAll(fZone, i)
|
facePatchId_.resize_nocopy(numFaces);
|
||||||
|
faceSign_.resize_nocopy(numFaces);
|
||||||
|
|
||||||
|
numFaces = 0;
|
||||||
|
|
||||||
|
// TDB: handle multiple zones
|
||||||
{
|
{
|
||||||
const label facei = fZone[i];
|
forAll(fZone, i)
|
||||||
label faceId = -1;
|
|
||||||
label facePatchId = -1;
|
|
||||||
if (mesh_.isInternalFace(facei))
|
|
||||||
{
|
{
|
||||||
faceId = facei;
|
const label meshFacei = fZone[i];
|
||||||
facePatchId = -1;
|
const label flipSign = (fZone.flipMap()[i] ? -1 : 1);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
facePatchId = mesh_.boundaryMesh().whichPatch(facei);
|
|
||||||
const polyPatch& pp = mesh_.boundaryMesh()[facePatchId];
|
|
||||||
const auto* cpp = isA<coupledPolyPatch>(pp);
|
|
||||||
|
|
||||||
if (cpp)
|
// Internal faces
|
||||||
{
|
label faceId = meshFacei;
|
||||||
faceId = (cpp->owner() ? pp.whichFace(facei) : -1);
|
label facePatchId = -1;
|
||||||
}
|
|
||||||
else if (!isA<emptyPolyPatch>(pp))
|
|
||||||
{
|
|
||||||
faceId = pp.whichFace(facei);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
faceId = -1;
|
|
||||||
facePatchId = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (faceId >= 0)
|
// Boundary faces
|
||||||
{
|
if (!mesh_.isInternalFace(meshFacei))
|
||||||
if (fZone.flipMap()[i])
|
|
||||||
{
|
{
|
||||||
faceSign_[count] = -1;
|
facePatchId = mesh_.boundaryMesh().whichPatch(meshFacei);
|
||||||
|
const polyPatch& pp = mesh_.boundaryMesh()[facePatchId];
|
||||||
|
|
||||||
|
if (isA<emptyPolyPatch>(pp))
|
||||||
|
{
|
||||||
|
continue; // Ignore empty patch
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto* cpp = isA<coupledPolyPatch>(pp);
|
||||||
|
|
||||||
|
if (cpp && !cpp->owner())
|
||||||
|
{
|
||||||
|
continue; // Ignore neighbour side
|
||||||
|
}
|
||||||
|
|
||||||
|
faceId = pp.whichFace(meshFacei);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (faceId >= 0)
|
||||||
{
|
{
|
||||||
faceSign_[count] = 1;
|
faceId_[numFaces] = faceId;
|
||||||
|
facePatchId_[numFaces] = facePatchId;
|
||||||
|
faceSign_[numFaces] = flipSign;
|
||||||
|
|
||||||
|
++numFaces;
|
||||||
}
|
}
|
||||||
faceId_[count] = faceId;
|
|
||||||
facePatchId_[count] = facePatchId;
|
|
||||||
count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
faceId_.setSize(count);
|
|
||||||
facePatchId_.setSize(count);
|
// Shrink to size used
|
||||||
faceSign_.setSize(count);
|
faceId_.resize(numFaces);
|
||||||
|
facePatchId_.resize(numFaces);
|
||||||
|
faceSign_.resize(numFaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -151,19 +151,18 @@ bool Foam::sampledFaceZone::update()
|
|||||||
// Could also check numFaces
|
// Could also check numFaces
|
||||||
|
|
||||||
// The mesh face or local patch face and the patch id
|
// The mesh face or local patch face and the patch id
|
||||||
faceId_.resize(numFaces);
|
faceId_.resize_nocopy(numFaces);
|
||||||
facePatchId_.resize(numFaces);
|
facePatchId_.resize_nocopy(numFaces);
|
||||||
|
|
||||||
IndirectList<face> selectedFaces(mesh().faces(), labelList());
|
IndirectList<face> selectedFaces(mesh().faces(), labelList());
|
||||||
labelList& meshFaceIds = selectedFaces.addressing();
|
labelList& meshFaceIds = selectedFaces.addressing();
|
||||||
meshFaceIds.resize(numFaces);
|
meshFaceIds.resize_nocopy(numFaces);
|
||||||
|
|
||||||
numFaces = 0;
|
numFaces = 0;
|
||||||
|
|
||||||
forAll(zoneIDs(), idx)
|
for (const label zoneId : zoneIDs())
|
||||||
{
|
{
|
||||||
const label zonei = zoneIDs()[idx];
|
const faceZone& fZone = mesh().faceZones()[zoneId];
|
||||||
const faceZone& fZone = mesh().faceZones()[zonei];
|
|
||||||
|
|
||||||
for (const label meshFacei : fZone)
|
for (const label meshFacei : fZone)
|
||||||
{
|
{
|
||||||
@ -179,26 +178,17 @@ bool Foam::sampledFaceZone::update()
|
|||||||
|
|
||||||
if (isA<emptyPolyPatch>(pp))
|
if (isA<emptyPolyPatch>(pp))
|
||||||
{
|
{
|
||||||
// Do not sample an empty patch
|
continue; // Ignore empty patch
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto* procPatch = isA<processorPolyPatch>(pp);
|
|
||||||
if (procPatch && !procPatch->owner())
|
|
||||||
{
|
|
||||||
// Do not sample neighbour-side, retain owner-side only
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto* cpp = isA<coupledPolyPatch>(pp);
|
const auto* cpp = isA<coupledPolyPatch>(pp);
|
||||||
if (cpp)
|
|
||||||
|
if (cpp && !cpp->owner())
|
||||||
{
|
{
|
||||||
faceId = (cpp->owner() ? pp.whichFace(meshFacei) : -1);
|
continue; // Ignore neighbour side
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
faceId = pp.whichFace(meshFacei);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
faceId = pp.whichFace(meshFacei);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (faceId >= 0)
|
if (faceId >= 0)
|
||||||
@ -206,6 +196,7 @@ bool Foam::sampledFaceZone::update()
|
|||||||
faceId_[numFaces] = faceId;
|
faceId_[numFaces] = faceId;
|
||||||
facePatchId_[numFaces] = facePatchId;
|
facePatchId_[numFaces] = facePatchId;
|
||||||
meshFaceIds[numFaces] = meshFacei;
|
meshFaceIds[numFaces] = meshFacei;
|
||||||
|
|
||||||
++numFaces;
|
++numFaces;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user