Commit 4684a13f authored by Mattijs Janssens's avatar Mattijs Janssens
Browse files

Merge branch 'feature-zoneInformation' into 'develop'

ENH: Adds basic information for faceZone and cellZones during checkMesh (fixes #560)

See merge request !142
parents 2f2e0cf1 b5f96306
......@@ -35,9 +35,78 @@ License
#include "processorPolyPatch.H"
#include "surfaceWriter.H"
#include "checkTools.H"
#include "treeBoundBox.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class PatchType>
void Foam::checkPatch
(
const bool allGeometry,
const word& name,
const PatchType& pp,
pointSet& points
)
{
Info<< " "
<< setw(20) << name
<< setw(9) << returnReduce(pp.size(), sumOp<label>())
<< setw(9) << returnReduce(pp.nPoints(), sumOp<label>());
if (!Pstream::parRun())
{
typedef typename PatchType::surfaceTopo TopoType;
TopoType pTyp = pp.surfaceType();
if (pp.empty())
{
Info<< setw(34) << "ok (empty)";
}
else if (pTyp == TopoType::MANIFOLD)
{
if (pp.checkPointManifold(true, &points))
{
Info<< setw(34)
<< "multiply connected (shared point)";
}
else
{
Info<< setw(34) << "ok (closed singly connected)";
}
// Add points on non-manifold edges to make set complete
pp.checkTopology(false, &points);
}
else
{
pp.checkTopology(false, &points);
if (pTyp == TopoType::OPEN)
{
Info<< setw(34)
<< "ok (non-closed singly connected)";
}
else
{
Info<< setw(34)
<< "multiply connected (shared edge)";
}
}
}
if (allGeometry)
{
const labelList& mp = pp.meshPoints();
if (returnReduce(mp.size(), sumOp<label>()) > 0)
{
boundBox bb(pp.points(), mp, true); // reduce
Info<< ' ' << bb;
}
}
}
Foam::label Foam::checkTopology
(
const polyMesh& mesh,
......@@ -466,6 +535,13 @@ Foam::label Foam::checkTopology
}
}
// Non-manifold points
pointSet points
(
mesh,
"nonManifoldPoints",
mesh.nPoints()/1000
);
{
if (!Pstream::parRun())
......@@ -478,17 +554,8 @@ Foam::label Foam::checkTopology
Info<< "\nChecking basic patch addressing..." << endl;
}
const polyBoundaryMesh& patches = mesh.boundaryMesh();
// Non-manifold points
pointSet points
(
mesh,
"nonManifoldPoints",
mesh.nPoints()/1000
);
Pout.setf(ios_base::left);
Info<< " "
......@@ -511,76 +578,127 @@ Foam::label Foam::checkTopology
if (!isA<processorPolyPatch>(pp))
{
Info<< " "
<< setw(20) << pp.name()
<< setw(9) << returnReduce(pp.size(), sumOp<label>())
<< setw(9) << returnReduce(pp.nPoints(), sumOp<label>());
checkPatch(allGeometry, pp.name(), pp, points);
Info<< endl;
}
}
if (!Pstream::parRun())
{
primitivePatch::surfaceTopo pTyp = pp.surfaceType();
//Info.setf(ios_base::right);
}
if (pp.empty())
{
Info<< setw(34) << "ok (empty)";
}
else if (pTyp == primitivePatch::MANIFOLD)
{
if (pp.checkPointManifold(true, &points))
{
Info<< setw(34)
<< "multiply connected (shared point)";
}
else
{
Info<< setw(34) << "ok (closed singly connected)";
}
{
if (!Pstream::parRun())
{
Info<< "\nChecking faceZone topology for multiply connected"
<< " surfaces..." << endl;
}
else
{
Info<< "\nChecking basic faceZone addressing..." << endl;
}
// Add points on non-manifold edges to make set complete
pp.checkTopology(false, &points);
}
else
{
pp.checkTopology(false, &points);
Pout.setf(ios_base::left);
if (pTyp == primitivePatch::OPEN)
{
Info<< setw(34)
<< "ok (non-closed singly connected)";
}
else
{
Info<< setw(34)
<< "multiply connected (shared edge)";
}
}
}
const faceZoneMesh& faceZones = mesh.faceZones();
if (allGeometry)
{
const labelList& mp = pp.meshPoints();
if (faceZones.size())
{
Info<< " "
<< setw(20) << "FaceZone"
<< setw(9) << "Faces"
<< setw(9) << "Points";
if (returnReduce(mp.size(), sumOp<label>()) > 0)
{
boundBox bb(pp.points(), mp, true); // reduce
Info<< ' ' << bb;
}
}
if (!Pstream::parRun())
{
Info<< setw(34) << "Surface topology";
}
if (allGeometry)
{
Info<< " Bounding box";
}
Info<< endl;
forAll(faceZones, zoneI)
{
const faceZone& fz = faceZones[zoneI];
checkPatch(allGeometry, fz.name(), fz(), points);
Info<< endl;
}
}
if (points.size())
else
{
Info<< " <<Writing " << returnReduce(points.size(), sumOp<label>())
<< " conflicting points to set "
<< points.name() << endl;
Info<< " No faceZones found."<<endl;
}
}
points.instance() = mesh.pointsInstance();
points.write();
label nPoints = returnReduce(points.size(), sumOp<label>());
if (nPoints)
{
Info<< " <<Writing " << nPoints
<< " conflicting points to set " << points.name() << endl;
points.instance() = mesh.pointsInstance();
points.write();
if (setWriter.valid())
{
mergeAndWrite(setWriter, points);
}
}
//Info.setf(ios_base::right);
{
Info<< "\nChecking basic cellZone addressing..." << endl;
Pout.setf(ios_base::left);
const cellZoneMesh& cellZones = mesh.cellZones();
if (cellZones.size())
{
Info<< " "
<< setw(20) << "CellZone"
<< setw(9) << "Cells"
<< setw(9) << "Points"
<< setw(13) << "BoundingBox" <<endl;
const cellList& cells = mesh.cells();
const faceList& faces = mesh.faces();
treeBoundBox bb(boundBox::invertedBox);
PackedBoolList isZonePoint(mesh.nPoints());
forAll(cellZones, zoneI)
{
const cellZone& cZone = cellZones[zoneI];
forAll(cZone, i)
{
const label cellI = cZone[i];
const cell& cFaces = cells[cellI];
forAll(cFaces, cFacei)
{
const face& f = faces[cFaces[cFacei]];
forAll(f, fp)
{
if (isZonePoint.set(f[fp]))
{
bb.add(mesh.points()[f[fp]]);
}
}
}
}
Info<< " "
<< setw(20) << cZone.name()
<< setw(9) << returnReduce(cZone.size(), sumOp<label>())
<< setw(9)
<< returnReduce(isZonePoint.count(), sumOp<label>())
<< setw(3) << bb << endl;
}
}
else
{
Info<< " No cellZones found."<<endl;
}
}
// Force creation of all addressing if requested.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment