ENH: use vtk::surfaceWriter in shortestPathSet debugging

This commit is contained in:
Mark Olesen
2019-02-07 09:45:13 +01:00
committed by Andrew Heather
parent 3a6e596a09
commit 2016f88eba

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd. \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -33,10 +33,8 @@ License
#include "fvMesh.H" #include "fvMesh.H"
#include "volFields.H" #include "volFields.H"
#include "OBJstream.H" #include "OBJstream.H"
#include "surfaceWriter.H"
#include "meshedSurfRef.H"
#include "PatchTools.H" #include "PatchTools.H"
#include "vtkSurfaceWriter.H" #include "foamVtkSurfaceWriter.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -840,20 +838,16 @@ Foam::shortestPathSet::shortestPathSet
{ {
if (debug) if (debug)
{ {
fileName outputDir; fileName outputDir =
if (Pstream::master()) (
{
outputDir =
mesh.time().globalPath() mesh.time().globalPath()
/ functionObject::outputPrefix / functionObject::outputPrefix
/ mesh.pointsInstance(); / mesh.pointsInstance()
);
outputDir.clean(); outputDir.clean();
mkDir(outputDir);
Info<< "shortestPathSet : Writing blocked faces to " Info<< "shortestPathSet : Writing blocked faces to "
<< outputDir << endl; << outputDir << endl;
}
const vtkSurfaceWriter surfWriter;
const indirectPrimitivePatch setPatch const indirectPrimitivePatch setPatch
( (
@ -864,8 +858,10 @@ Foam::shortestPathSet::shortestPathSet
), ),
mesh.points() mesh.points()
); );
if (Pstream::parRun()) if (Pstream::parRun())
{ {
// Topological merge
labelList pointToGlobal; labelList pointToGlobal;
labelList uniqueMeshPointLabels; labelList uniqueMeshPointLabels;
autoPtr<globalIndex> globalPoints; autoPtr<globalIndex> globalPoints;
@ -891,30 +887,28 @@ Foam::shortestPathSet::shortestPathSet
// Write // Write
if (Pstream::master()) if (Pstream::master())
{ {
surfWriter.write vtk::surfaceWriter writer
(
outputDir,
"blockedFace",
meshedSurfRef
( (
mergedPoints, mergedPoints,
mergedFaces mergedFaces,
) (outputDir / "blockedFace"),
false // serial only - already merged
); );
writer.writeGeometry();
} }
} }
else else
{ {
surfWriter.write vtk::surfaceWriter writer
(
outputDir,
"blockedFace",
meshedSurfRef
( (
setPatch.localPoints(), setPatch.localPoints(),
setPatch.localFaces() setPatch.localFaces(),
) (outputDir / "blockedFace"),
false // serial only - redundant
); );
writer.writeGeometry();
} }
} }