Skip to content
Snippets Groups Projects
Commit f078643f authored by Mark OLESEN's avatar Mark OLESEN
Browse files

ENH: add blockFaces.vtp output for blockMesh -write-vtk

parent f459b11e
No related merge requests found
......@@ -75,6 +75,7 @@ Usage
#include "blockMesh.H"
#include "foamVtkInternalMeshWriter.H"
#include "foamVtkSurfaceWriter.H"
#include "attachPolyTopoChanger.H"
#include "polyTopoChange.H"
#include "cyclicPolyPatch.H"
......
......@@ -13,22 +13,25 @@ License
Description
VTK output of blockMesh topology blocks
Always write in ASCII since the mesh is small and we want easily
readable output for inspection.
\*---------------------------------------------------------------------------*/
{
// Non-legacy and ASCII (mesh is small, want readable output)
const vtk::outputOptions writeOpts = vtk::formatType::INLINE_ASCII;
// Common
refPtr<polyMesh> topoMeshPtr(blocks.topology(true));
const polyMesh& topoMesh = topoMeshPtr();
refPtr<polyMesh> topoMeshPtr(blocks.topology(true));
const polyMesh& topoMesh = topoMeshPtr();
const vtk::vtuCells topoCells(topoMesh, writeOpts);
// Internal mesh - ie, the blocks
{
const vtk::vtuCells topoCells(topoMesh, vtk::formatType::INLINE_ASCII);
vtk::internalMeshWriter writer
(
topoMesh,
topoCells,
writeOpts,
vtk::formatType::INLINE_ASCII,
runTime.path()/"blockTopology"
);
......@@ -99,4 +102,64 @@ Description
}
// Block boundary faces
{
const label nIntFaces = topoMesh.nInternalFaces();
const label nBndFaces = topoMesh.nBoundaryFaces();
faceList bndFaces
(
faceList::subList(topoMesh.faces(), nBndFaces, nIntFaces)
);
vtk::surfaceWriter writer
(
topoMesh.points(),
bndFaces,
vtk::formatType::INLINE_ASCII,
runTime.path()/"blockFaces"
);
labelList blockIds(nBndFaces, -1);
labelList cellFaceIds(nBndFaces, -1);
labelList patchIds(nBndFaces, -1);
{
const labelList& own = topoMesh.faceOwner();
const cellList& cells = topoMesh.cells();
const polyPatchList& patches = topoMesh.boundaryMesh();
for (const polyPatch& pp : patches)
{
label bndFacei = pp.start() - nIntFaces;
label meshFacei = pp.start();
forAll(pp, bfacei)
{
const label celli = own[meshFacei];
const label cellFacei = cells[celli].find(meshFacei);
blockIds[bndFacei] = celli;
cellFaceIds[bndFacei] = cellFacei;
patchIds[bndFacei] = pp.index();
++bndFacei;
++meshFacei;
}
}
}
Info<< "Writing block boundary faces in vtk format: "
<< args.relativePath(writer.output()).c_str() << endl;
writer.writeGeometry();
writer.beginCellData();
writer.writeCellData("block", blockIds);
writer.writeCellData("face", cellFaceIds);
writer.writeCellData("patch", patchIds);
}
// ************************************************************************* //
......@@ -123,7 +123,7 @@ cleanCase()
rm -rf system/machines
# Possible blockMesh output
rm -f blockTopology.vtu blockTopology.obj blockCentres.obj
rm -f blockTopology.vtu blockFaces.vtp blockTopology.obj blockCentres.obj
# From mpirunDebug
rm -f gdbCommands mpirun.schema
......
......@@ -271,7 +271,12 @@ Foam::blockMesh::blockMesh
{
// Command-line options have precedence over dictionary setting
if (!verbose_)
if (verbose_ < 0)
{
// Forced as 'off'
verbose_ = 0;
}
else if (!verbose_)
{
verbose_ = meshDict_.getOrDefault("verbose", verboseOutput);
}
......
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