ENH: static test methods for matching simple cell shapes

- (tet, pyr, hex) can be identified from their number of faces
  and vertices. For these common shapes can use static `test()`
  method instead of the virtual isA() method.

  This is much cheaper for calling on an individual basis since
  it avoids the overhead of constructing an object.

ENH: tetCell edge/reverseEdge (already had tetEdge)
This commit is contained in:
Mark Olesen
2020-12-03 14:18:29 +01:00
parent b7c8a45de2
commit b966b7cd4b
18 changed files with 337 additions and 198 deletions

View File

@ -133,12 +133,9 @@ void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
<< endl;
// Construct shape recognizers
hexMatcher hex;
prismMatcher prism;
wedgeMatcher wedge;
pyrMatcher pyr;
tetWedgeMatcher tetWedge;
tetMatcher tet;
// Counters for different cell types
label nHex = 0;
@ -153,15 +150,15 @@ void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
for (label celli = 0; celli < mesh.nCells(); celli++)
{
if (hex.isA(mesh, celli))
if (hexMatcher::test(mesh, celli))
{
nHex++;
}
else if (tet.isA(mesh, celli))
else if (tetMatcher::test(mesh, celli))
{
nTet++;
}
else if (pyr.isA(mesh, celli))
else if (pyrMatcher::test(mesh, celli))
{
nPyr++;
}