ENH: polyBoundaryMesh additional faces() and faceOwner() slice methods

- return a subList view of the mesh faces, owners
This commit is contained in:
Mark Olesen 2023-11-06 13:58:00 +01:00
parent 546b204793
commit 08a9b03891
3 changed files with 36 additions and 2 deletions

View File

@ -52,9 +52,9 @@ void writeVTKtetMesh(const fileName& output, const polyMesh& mesh_)
{ {
nTets += 2 * faces[facei].nTriangles(); nTets += 2 * faces[facei].nTriangles();
} }
for (label facei = mesh_.nInternalFaces(); facei < mesh_.nFaces(); ++facei) for (const face& f : mesh_.boundaryMesh().faces())
{ {
nTets += faces[facei].nTriangles(); nTets += f.nTriangles();
} }
const label nPoints = (mesh_.nPoints() + mesh_.nCells()); const label nPoints = (mesh_.nPoints() + mesh_.nCells());

View File

@ -300,6 +300,34 @@ void Foam::polyBoundaryMesh::calcGeometry()
} }
const Foam::faceList::subList Foam::polyBoundaryMesh::faces() const
{
return faceList::subList
(
mesh_.faces(),
mesh_.nBoundaryFaces(),
mesh_.nInternalFaces()
);
}
const Foam::labelList::subList Foam::polyBoundaryMesh::faceOwner() const
{
return labelList::subList
(
mesh_.faceOwner(),
mesh_.nBoundaryFaces(),
mesh_.nInternalFaces()
);
}
// Potentially useful to simplify logic elsewhere?
// const Foam::labelList::subList Foam::polyBoundaryMesh::faceNeighbour() const
// {
// return labelList::subList();
// }
Foam::UPtrList<const Foam::labelUList> Foam::UPtrList<const Foam::labelUList>
Foam::polyBoundaryMesh::faceCells() const Foam::polyBoundaryMesh::faceCells() const
{ {

View File

@ -171,6 +171,12 @@ public:
return mesh_; return mesh_;
} }
//- Return mesh faces for the entire boundary
const faceList::subList faces() const;
//- Return face owner for the entire boundary
const labelList::subList faceOwner() const;
//- Return a list of faceCells for each patch //- Return a list of faceCells for each patch
UPtrList<const labelUList> faceCells() const; UPtrList<const labelUList> faceCells() const;