mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: checkMesh: output information about zones
This commit is contained in:
@ -35,9 +35,78 @@ License
|
|||||||
#include "processorPolyPatch.H"
|
#include "processorPolyPatch.H"
|
||||||
#include "surfaceWriter.H"
|
#include "surfaceWriter.H"
|
||||||
#include "checkTools.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
|
Foam::label Foam::checkTopology
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -466,6 +535,13 @@ Foam::label Foam::checkTopology
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Non-manifold points
|
||||||
|
pointSet points
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
"nonManifoldPoints",
|
||||||
|
mesh.nPoints()/1000
|
||||||
|
);
|
||||||
|
|
||||||
{
|
{
|
||||||
if (!Pstream::parRun())
|
if (!Pstream::parRun())
|
||||||
@ -478,17 +554,8 @@ Foam::label Foam::checkTopology
|
|||||||
Info<< "\nChecking basic patch addressing..." << endl;
|
Info<< "\nChecking basic patch addressing..." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
// Non-manifold points
|
|
||||||
pointSet points
|
|
||||||
(
|
|
||||||
mesh,
|
|
||||||
"nonManifoldPoints",
|
|
||||||
mesh.nPoints()/1000
|
|
||||||
);
|
|
||||||
|
|
||||||
Pout.setf(ios_base::left);
|
Pout.setf(ios_base::left);
|
||||||
|
|
||||||
Info<< " "
|
Info<< " "
|
||||||
@ -511,80 +578,24 @@ Foam::label Foam::checkTopology
|
|||||||
|
|
||||||
if (!isA<processorPolyPatch>(pp))
|
if (!isA<processorPolyPatch>(pp))
|
||||||
{
|
{
|
||||||
Info<< " "
|
checkPatch(allGeometry, pp.name(), pp, points);
|
||||||
<< setw(20) << pp.name()
|
|
||||||
<< setw(9) << returnReduce(pp.size(), sumOp<label>())
|
|
||||||
<< setw(9) << returnReduce(pp.nPoints(), sumOp<label>());
|
|
||||||
|
|
||||||
if (!Pstream::parRun())
|
|
||||||
{
|
|
||||||
primitivePatch::surfaceTopo pTyp = pp.surfaceType();
|
|
||||||
|
|
||||||
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)";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add points on non-manifold edges to make set complete
|
|
||||||
pp.checkTopology(false, &points);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pp.checkTopology(false, &points);
|
|
||||||
|
|
||||||
if (pTyp == primitivePatch::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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (points.size())
|
|
||||||
{
|
|
||||||
Info<< " <<Writing " << returnReduce(points.size(), sumOp<label>())
|
|
||||||
<< " conflicting points to set "
|
|
||||||
<< points.name() << endl;
|
|
||||||
|
|
||||||
points.instance() = mesh.pointsInstance();
|
|
||||||
points.write();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Info.setf(ios_base::right);
|
//Info.setf(ios_base::right);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
Info<< "\nChecking basic faceZone addressing..." << endl;
|
if (!Pstream::parRun())
|
||||||
|
{
|
||||||
|
Info<< "\nChecking faceZone topology for multiply connected"
|
||||||
|
<< " surfaces..." << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "\nChecking basic faceZone addressing..." << endl;
|
||||||
|
}
|
||||||
|
|
||||||
Pout.setf(ios_base::left);
|
Pout.setf(ios_base::left);
|
||||||
|
|
||||||
@ -595,38 +606,23 @@ Foam::label Foam::checkTopology
|
|||||||
Info<< " "
|
Info<< " "
|
||||||
<< setw(20) << "FaceZone"
|
<< setw(20) << "FaceZone"
|
||||||
<< setw(9) << "Faces"
|
<< setw(9) << "Faces"
|
||||||
<< setw(9) << "Points"
|
<< setw(9) << "Points";
|
||||||
<< setw(13) << "BoundingBox" <<endl;
|
|
||||||
|
|
||||||
const pointField& points = mesh.points();
|
if (!Pstream::parRun())
|
||||||
const faceList& faces = mesh.faces();
|
{
|
||||||
|
Info<< setw(34) << "Surface topology";
|
||||||
|
}
|
||||||
|
if (allGeometry)
|
||||||
|
{
|
||||||
|
Info<< " Bounding box";
|
||||||
|
}
|
||||||
|
Info<< endl;
|
||||||
|
|
||||||
DynamicList<point> localPoints;
|
|
||||||
forAll(faceZones, zoneI)
|
forAll(faceZones, zoneI)
|
||||||
{
|
{
|
||||||
const faceZone& fZone = faceZones[zoneI];
|
const faceZone& fz = faceZones[zoneI];
|
||||||
localPoints.setCapacity(10*faces.size());
|
checkPatch(allGeometry, fz.name(), fz(), points);
|
||||||
|
Info<< endl;
|
||||||
forAll(fZone, i)
|
|
||||||
{
|
|
||||||
const label faceI = fZone[i];
|
|
||||||
const face& f = faces[faceI];
|
|
||||||
const pointField facePoints(f.points(points));
|
|
||||||
|
|
||||||
forAll(facePoints, pointI)
|
|
||||||
{
|
|
||||||
const point& pt = facePoints[pointI];
|
|
||||||
localPoints.append(pt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
boundBox bb(localPoints, true);
|
|
||||||
|
|
||||||
Info<< " "
|
|
||||||
<< setw(20) << fZone.name()
|
|
||||||
<< setw(9) << returnReduce(fZone.size(), sumOp<label>())
|
|
||||||
<< setw(9)
|
|
||||||
<< returnReduce(localPoints.size(), sumOp<label>())
|
|
||||||
<< setw(3) << bb << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -635,6 +631,20 @@ Foam::label Foam::checkTopology
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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<< "\nChecking basic cellZone addressing..." << endl;
|
Info<< "\nChecking basic cellZone addressing..." << endl;
|
||||||
|
|
||||||
@ -651,37 +661,38 @@ Foam::label Foam::checkTopology
|
|||||||
<< setw(9) << "Points"
|
<< setw(9) << "Points"
|
||||||
<< setw(13) << "BoundingBox" <<endl;
|
<< setw(13) << "BoundingBox" <<endl;
|
||||||
|
|
||||||
const pointField& points = mesh.points();
|
|
||||||
const cellList& cells = mesh.cells();
|
const cellList& cells = mesh.cells();
|
||||||
const faceList& faces = mesh.faces();
|
const faceList& faces = mesh.faces();
|
||||||
|
treeBoundBox bb(boundBox::invertedBox);
|
||||||
|
PackedBoolList isZonePoint(mesh.nPoints());
|
||||||
|
|
||||||
DynamicList<point> localPoints;
|
|
||||||
forAll(cellZones, zoneI)
|
forAll(cellZones, zoneI)
|
||||||
{
|
{
|
||||||
const cellZone& cZone = cellZones[zoneI];
|
const cellZone& cZone = cellZones[zoneI];
|
||||||
localPoints.setCapacity(10*faces.size());
|
|
||||||
|
|
||||||
forAll(cZone, i)
|
forAll(cZone, i)
|
||||||
{
|
{
|
||||||
const label cellI = cZone[i];
|
const label cellI = cZone[i];
|
||||||
const cell& c = cells[cellI];
|
const cell& cFaces = cells[cellI];
|
||||||
const pointField cellPoints(c.points(faces, points));
|
forAll(cFaces, cFacei)
|
||||||
|
|
||||||
forAll(cellPoints, pointI)
|
|
||||||
{
|
{
|
||||||
const point& pt = cellPoints[pointI];
|
const face& f = faces[cFaces[cFacei]];
|
||||||
localPoints.append(pt);
|
forAll(f, fp)
|
||||||
|
{
|
||||||
|
if (isZonePoint.set(f[fp]))
|
||||||
|
{
|
||||||
|
bb.add(mesh.points()[f[fp]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boundBox bb(localPoints, true);
|
|
||||||
|
|
||||||
Info<< " "
|
Info<< " "
|
||||||
<< setw(20) << cZone.name()
|
<< setw(20) << cZone.name()
|
||||||
<< setw(9) << returnReduce(cZone.size(), sumOp<label>())
|
<< setw(9) << returnReduce(cZone.size(), sumOp<label>())
|
||||||
<< setw(9)
|
<< setw(9)
|
||||||
<< returnReduce(localPoints.size(), sumOp<label>())
|
<< returnReduce(isZonePoint.count(), sumOp<label>())
|
||||||
<< setw(3) << bb << endl;
|
<< setw(3) << bb << endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user