ENH: add blockFaces.vtp output for blockMesh -write-vtk
This commit is contained in:
parent
f459b11e24
commit
f078643f8c
@ -75,6 +75,7 @@ Usage
|
|||||||
|
|
||||||
#include "blockMesh.H"
|
#include "blockMesh.H"
|
||||||
#include "foamVtkInternalMeshWriter.H"
|
#include "foamVtkInternalMeshWriter.H"
|
||||||
|
#include "foamVtkSurfaceWriter.H"
|
||||||
#include "attachPolyTopoChanger.H"
|
#include "attachPolyTopoChanger.H"
|
||||||
#include "polyTopoChange.H"
|
#include "polyTopoChange.H"
|
||||||
#include "cyclicPolyPatch.H"
|
#include "cyclicPolyPatch.H"
|
||||||
|
@ -13,22 +13,25 @@ License
|
|||||||
Description
|
Description
|
||||||
VTK output of blockMesh topology blocks
|
VTK output of blockMesh topology blocks
|
||||||
|
|
||||||
|
Always write in ASCII since the mesh is small and we want easily
|
||||||
|
readable output for inspection.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// Common
|
||||||
|
|
||||||
|
refPtr<polyMesh> topoMeshPtr(blocks.topology(true));
|
||||||
|
const polyMesh& topoMesh = topoMeshPtr();
|
||||||
|
|
||||||
|
// Internal mesh - ie, the blocks
|
||||||
{
|
{
|
||||||
// Non-legacy and ASCII (mesh is small, want readable output)
|
const vtk::vtuCells topoCells(topoMesh, vtk::formatType::INLINE_ASCII);
|
||||||
const vtk::outputOptions writeOpts = vtk::formatType::INLINE_ASCII;
|
|
||||||
|
|
||||||
refPtr<polyMesh> topoMeshPtr(blocks.topology(true));
|
|
||||||
const polyMesh& topoMesh = topoMeshPtr();
|
|
||||||
|
|
||||||
const vtk::vtuCells topoCells(topoMesh, writeOpts);
|
|
||||||
|
|
||||||
vtk::internalMeshWriter writer
|
vtk::internalMeshWriter writer
|
||||||
(
|
(
|
||||||
topoMesh,
|
topoMesh,
|
||||||
topoCells,
|
topoCells,
|
||||||
writeOpts,
|
vtk::formatType::INLINE_ASCII,
|
||||||
runTime.path()/"blockTopology"
|
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
|
rm -rf system/machines
|
||||||
|
|
||||||
# Possible blockMesh output
|
# Possible blockMesh output
|
||||||
rm -f blockTopology.vtu blockTopology.obj blockCentres.obj
|
rm -f blockTopology.vtu blockFaces.vtp blockTopology.obj blockCentres.obj
|
||||||
|
|
||||||
# From mpirunDebug
|
# From mpirunDebug
|
||||||
rm -f gdbCommands mpirun.schema
|
rm -f gdbCommands mpirun.schema
|
||||||
|
@ -271,7 +271,12 @@ Foam::blockMesh::blockMesh
|
|||||||
{
|
{
|
||||||
// Command-line options have precedence over dictionary setting
|
// 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);
|
verbose_ = meshDict_.getOrDefault("verbose", verboseOutput);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user