ENH: add polyBoundaryMesh::nNonProcessor() method

- returns the number of non-processorPolyPatch patches, which is invariant
  across all processors.
This commit is contained in:
Mark Olesen
2018-02-20 11:41:13 +01:00
parent 8716061a4a
commit 80fad8483b
2 changed files with 28 additions and 8 deletions

View File

@ -167,10 +167,6 @@ Foam::polyBoundaryMesh::polyBoundaryMesh
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::polyBoundaryMesh::~polyBoundaryMesh()
{}
void Foam::polyBoundaryMesh::clearGeom() void Foam::polyBoundaryMesh::clearGeom()
{ {
forAll(*this, patchi) forAll(*this, patchi)
@ -505,6 +501,28 @@ void Foam::polyBoundaryMesh::setGroup
} }
Foam::label Foam::polyBoundaryMesh::nNonProcessor() const
{
const polyPatchList& patches = *this;
label nonProc = 0;
for (const polyPatch& p : patches)
{
if (isA<processorPolyPatch>(p))
{
break;
}
else
{
++nonProc;
}
}
return nonProc;
}
Foam::wordList Foam::polyBoundaryMesh::names() const Foam::wordList Foam::polyBoundaryMesh::names() const
{ {
const polyPatchList& patches = *this; const polyPatchList& patches = *this;
@ -856,7 +874,6 @@ bool Foam::polyBoundaryMesh::checkParallelSync(const bool report) const
return false; return false;
} }
const polyBoundaryMesh& bm = *this; const polyBoundaryMesh& bm = *this;
bool hasError = false; bool hasError = false;

View File

@ -82,10 +82,10 @@ class polyBoundaryMesh
void calcGeometry(); void calcGeometry();
//- Disallow construct as copy //- Disallow construct as copy
polyBoundaryMesh(const polyBoundaryMesh&); polyBoundaryMesh(const polyBoundaryMesh&) = delete;
//- Disallow assignment //- Disallow assignment
void operator=(const polyBoundaryMesh&); void operator=(const polyBoundaryMesh&) = delete;
public: public:
@ -126,7 +126,7 @@ public:
//- Destructor //- Destructor
~polyBoundaryMesh(); ~polyBoundaryMesh() = default;
//- Clear geometry at this level and at patches //- Clear geometry at this level and at patches
void clearGeom(); void clearGeom();
@ -151,6 +151,9 @@ public:
// Only valid for singly connected polyBoundaryMesh and not parallel // Only valid for singly connected polyBoundaryMesh and not parallel
const List<labelPairList>& neighbourEdges() const; const List<labelPairList>& neighbourEdges() const;
//- Return the number of non-processor patches
label nNonProcessor() const;
//- Return a list of patch names //- Return a list of patch names
wordList names() const; wordList names() const;