checks on zones

This commit is contained in:
mattijs
2009-06-30 22:16:01 +01:00
parent e6416c2604
commit e28256477a
5 changed files with 143 additions and 4 deletions

View File

@ -7,6 +7,31 @@
#include "pointSet.H"
#include "IOmanip.H"
bool Foam::checkSync(const wordList& names)
{
List<wordList> allNames(Pstream::nProcs());
allNames[Pstream::myProcNo()] = names;
Pstream::gatherList(allNames);
bool hasError = false;
for (label procI = 1; procI < allNames.size(); procI++)
{
if (allNames[procI] != allNames[0])
{
hasError = true;
Info<< " ***Inconsistent zones across processors, "
"processor 0 has zones:" << allNames[0]
<< ", processor " << procI << " has zones:"
<< allNames[procI]
<< endl;
}
}
return hasError;
}
Foam::label Foam::checkTopology
(
const polyMesh& mesh,
@ -24,6 +49,31 @@ Foam::label Foam::checkTopology
// Check if the boundary processor patches are correct
mesh.boundaryMesh().checkParallelSync(true);
// Check names of zones are equal
if (checkSync(mesh.cellZones().names()))
{
noFailedChecks++;
}
if (checkSync(mesh.faceZones().names()))
{
noFailedChecks++;
}
if (checkSync(mesh.pointZones().names()))
{
noFailedChecks++;
}
// Check contents of faceZones consistent
{
forAll(mesh.faceZones(), zoneI)
{
if (mesh.faceZones()[zoneI].checkParallelSync(true))
{
noFailedChecks++;
}
}
}
{
pointSet points(mesh, "unusedPoints", mesh.nPoints()/100);
if (mesh.checkPoints(true, &points))

View File

@ -1,8 +1,11 @@
#include "label.H"
#include "wordList.H"
namespace Foam
{
class polyMesh;
bool checkSync(const wordList& names);
label checkTopology(const polyMesh&, const bool, const bool);
}

View File

@ -69,13 +69,13 @@ void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
<< " cells: "
<< returnReduce(mesh.cells().size(), sumOp<label>()) << nl
<< " boundary patches: "
<< returnReduce(mesh.boundaryMesh().size(), sumOp<label>()) << nl
<< mesh.boundaryMesh().size() << nl
<< " point zones: "
<< returnReduce(mesh.pointZones().size(), sumOp<label>()) << nl
<< mesh.pointZones().size() << nl
<< " face zones: "
<< returnReduce(mesh.faceZones().size(), sumOp<label>()) << nl
<< mesh.faceZones().size() << nl
<< " cell zones: "
<< returnReduce(mesh.cellZones().size(), sumOp<label>()) << nl
<< mesh.cellZones().size() << nl
<< endl;