ENH: use nBoundaryFaces() in more places (less clutter, more clarity)

- noexcept for some methods
- add std:: qualifier to unique_ptr for additional clarity
This commit is contained in:
Mark Olesen
2022-01-19 10:30:01 +01:00
parent 61aef196ed
commit 6b99fea4e7
9 changed files with 26 additions and 25 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2019 OpenFOAM Foundation Copyright (C) 2011-2019 OpenFOAM Foundation
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -236,14 +236,14 @@ Foam::labelList Foam::polyMeshTetDecomposition::findFaceBasePts
labelList tetBasePtIs(mesh.nFaces(), -1); labelList tetBasePtIs(mesh.nFaces(), -1);
label nInternalFaces = mesh.nInternalFaces(); const label nInternalFaces = mesh.nInternalFaces();
for (label fI = 0; fI < nInternalFaces; ++fI) for (label fI = 0; fI < nInternalFaces; ++fI)
{ {
tetBasePtIs[fI] = findSharedBasePoint(mesh, fI, tol, report); tetBasePtIs[fI] = findSharedBasePoint(mesh, fI, tol, report);
} }
pointField neighbourCellCentres(mesh.nFaces() - nInternalFaces); pointField neighbourCellCentres(mesh.nBoundaryFaces());
for (label facei = nInternalFaces; facei < mesh.nFaces(); ++facei) for (label facei = nInternalFaces; facei < mesh.nFaces(); ++facei)
{ {
@ -257,8 +257,8 @@ Foam::labelList Foam::polyMeshTetDecomposition::findFaceBasePts
SubList<label> boundaryFaceTetBasePtIs SubList<label> boundaryFaceTetBasePtIs
( (
tetBasePtIs, tetBasePtIs,
mesh.nFaces() - nInternalFaces, mesh.nBoundaryFaces(),
nInternalFaces mesh.nInternalFaces()
); );
for for

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -727,8 +728,8 @@ void Foam::polyDualMesh::calcDual
SubList<face> SubList<face>
( (
mesh.faces(), mesh.faces(),
mesh.nFaces() - nIntFaces, mesh.nBoundaryFaces(),
nIntFaces mesh.nInternalFaces()
), ),
mesh.points() mesh.points()
); );
@ -781,7 +782,7 @@ void Foam::polyDualMesh::calcDual
pointField dualPoints pointField dualPoints
( (
mesh.nCells() // cell centres mesh.nCells() // cell centres
+ mesh.nFaces() - nIntFaces // boundary face centres + mesh.nBoundaryFaces() // boundary face centres
+ featureEdges.size() // additional boundary edges + featureEdges.size() // additional boundary edges
+ featurePoints.size() // additional boundary points + featurePoints.size() // additional boundary points
); );
@ -803,7 +804,7 @@ void Foam::polyDualMesh::calcDual
// Boundary faces centres // Boundary faces centres
const pointField& faceCentres = mesh.faceCentres(); const pointField& faceCentres = mesh.faceCentres();
boundaryFacePoint_.setSize(mesh.nFaces() - nIntFaces); boundaryFacePoint_.setSize(mesh.nBoundaryFaces());
for (label facei = nIntFaces; facei < mesh.nFaces(); facei++) for (label facei = nIntFaces; facei < mesh.nFaces(); facei++)
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2020 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -65,7 +65,7 @@ void Foam::dynamicRefineFvMesh::calculateProtectedCells
unrefineableCell = protectedCell_; unrefineableCell = protectedCell_;
// Get neighbouring cell level // Get neighbouring cell level
labelList neiLevel(nFaces()-nInternalFaces()); labelList neiLevel(nBoundaryFaces());
for (label facei = nInternalFaces(); facei < nFaces(); ++facei) for (label facei = nInternalFaces(); facei < nFaces(); ++facei)
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2015-2021 OpenCFD Ltd. Copyright (C) 2015-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -385,7 +385,7 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection
labelList cellAddr(mesh_.nCells(), -1); labelList cellAddr(mesh_.nCells(), -1);
const labelList& cellIDs = mesh_.cellZones()[cellZonei]; const labelList& cellIDs = mesh_.cellZones()[cellZonei];
labelUIndList(cellAddr, cellIDs) = identity(cellIDs.size()); labelUIndList(cellAddr, cellIDs) = identity(cellIDs.size());
labelList nbrFaceCellAddr(mesh_.nFaces() - nInternalFaces, -1); labelList nbrFaceCellAddr(mesh_.nBoundaryFaces(), -1);
forAll(pbm, patchi) forAll(pbm, patchi)
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2021 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -141,7 +141,7 @@ void Foam::fv::rotorDiskSource::setFaceArea(vector& axis, const bool correct)
// Calculate cell addressing for selected cells // Calculate cell addressing for selected cells
labelList cellAddr(mesh_.nCells(), -1); labelList cellAddr(mesh_.nCells(), -1);
labelUIndList(cellAddr, cells_) = identity(cells_.size()); labelUIndList(cellAddr, cells_) = identity(cells_.size());
labelList nbrFaceCellAddr(mesh_.nFaces() - nInternalFaces, -1); labelList nbrFaceCellAddr(mesh_.nBoundaryFaces(), -1);
forAll(pbm, patchi) forAll(pbm, patchi)
{ {
const polyPatch& pp = pbm[patchi]; const polyPatch& pp = pbm[patchi];

View File

@ -539,8 +539,8 @@ Foam::labelList Foam::meshRefinement::nearestIntersection
// Swap neighbouring cell centres and cell level // Swap neighbouring cell centres and cell level
labelList neiLevel(mesh_.nFaces()-mesh_.nInternalFaces()); labelList neiLevel(mesh_.nBoundaryFaces());
pointField neiCc(mesh_.nFaces()-mesh_.nInternalFaces()); pointField neiCc(mesh_.nBoundaryFaces());
calcNeighbourData(neiLevel, neiCc); calcNeighbourData(neiLevel, neiCc);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2019,2022 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -193,7 +193,7 @@ void Foam::meshRefinement::markOutsideFaces
} }
{ {
const label nBnd = mesh_.nFaces()-mesh_.nInternalFaces(); const label nBnd = mesh_.nBoundaryFaces();
labelList neiRefineCell(nBnd); labelList neiRefineCell(nBnd);
syncTools::swapBoundaryCellList(mesh_, refineCell, neiRefineCell); syncTools::swapBoundaryCellList(mesh_, refineCell, neiRefineCell);
@ -948,8 +948,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::removeGapCells
) )
{ {
// Swap neighbouring cell centres and cell level // Swap neighbouring cell centres and cell level
labelList neiLevel(mesh_.nFaces()-mesh_.nInternalFaces()); labelList neiLevel(mesh_.nBoundaryFaces());
pointField neiCc(mesh_.nFaces()-mesh_.nInternalFaces()); pointField neiCc(mesh_.nBoundaryFaces());
calcNeighbourData(neiLevel, neiCc); calcNeighbourData(neiLevel, neiCc);
labelList refineCell(mesh_.nCells(), -1); labelList refineCell(mesh_.nCells(), -1);

View File

@ -2092,8 +2092,8 @@ Foam::labelList Foam::meshRefinement::refineCandidates
// Swap neighbouring cell centres and cell level // Swap neighbouring cell centres and cell level
labelList neiLevel(mesh_.nFaces()-mesh_.nInternalFaces()); labelList neiLevel(mesh_.nBoundaryFaces());
pointField neiCc(mesh_.nFaces()-mesh_.nInternalFaces()); pointField neiCc(mesh_.nBoundaryFaces());
calcNeighbourData(neiLevel, neiCc); calcNeighbourData(neiLevel, neiCc);

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2020 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -114,7 +114,7 @@ void Foam::cellToFace::combine
// Get coupled cell status // Get coupled cell status
boolList neiInSet(mesh_.nFaces()-nInt, false); boolList neiInSet(mesh_.nBoundaryFaces(), false);
for (const polyPatch& pp : patches) for (const polyPatch& pp : patches)
{ {