From 0d2dbaf61b23673f7f085ef5eb35003ea35a7ca9 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 17 Sep 2018 15:41:58 +0200 Subject: [PATCH] ENH: parallel and xml output for vtk topoSet writers (issue #926) - introduce lower-level vtk::indirectPatchWriter class --- .../mesh/manipulation/setSet/setSet.C | 93 ++-- .../dataConversion/foamToVTK/foamToVTK.C | 50 +- src/meshTools/Make/files | 2 + src/meshTools/output/foamVtkIndPatchWriter.C | 449 ++++++++++++++++++ src/meshTools/output/foamVtkIndPatchWriter.H | 222 +++++++++ .../output/foamVtkIndPatchWriterTemplates.C | 130 +++++ .../output/foamVtkWriteCellSetFaces.C | 109 ++--- src/meshTools/output/foamVtkWriteFaceSet.C | 95 ++-- src/meshTools/output/foamVtkWritePointSet.C | 210 ++++++-- src/meshTools/output/foamVtkWritePointSet.H | 73 --- ...tkWriteFaceSet.H => foamVtkWriteTopoSet.C} | 94 ++-- ...teCellSetFaces.H => foamVtkWriteTopoSet.H} | 74 ++- 12 files changed, 1251 insertions(+), 350 deletions(-) create mode 100644 src/meshTools/output/foamVtkIndPatchWriter.C create mode 100644 src/meshTools/output/foamVtkIndPatchWriter.H create mode 100644 src/meshTools/output/foamVtkIndPatchWriterTemplates.C delete mode 100644 src/meshTools/output/foamVtkWritePointSet.H rename src/meshTools/output/{foamVtkWriteFaceSet.H => foamVtkWriteTopoSet.C} (51%) rename src/meshTools/output/{foamVtkWriteCellSetFaces.H => foamVtkWriteTopoSet.H} (52%) diff --git a/applications/utilities/mesh/manipulation/setSet/setSet.C b/applications/utilities/mesh/manipulation/setSet/setSet.C index fa48186c90..e37212d160 100644 --- a/applications/utilities/mesh/manipulation/setSet/setSet.C +++ b/applications/utilities/mesh/manipulation/setSet/setSet.C @@ -43,9 +43,7 @@ Description #include "topoSetSource.H" #include "Fstream.H" #include "demandDrivenData.H" -#include "foamVtkWriteCellSetFaces.H" -#include "foamVtkWriteFaceSet.H" -#include "foamVtkWritePointSet.H" +#include "foamVtkWriteTopoSet.H" #include "IOobjectList.H" #include "cellZoneSet.H" #include "faceZoneSet.H" @@ -70,47 +68,26 @@ using namespace Foam; void writeVTK ( const polyMesh& mesh, - const topoSet& currentSet, - const fileName& vtkBaseName + const topoSet& currSet, + const fileName& outputName ) { - if (isA(currentSet)) - { - // Faces of set with OpenFOAM faceID as value - vtk::writeFaceSet + if + ( + !vtk::writeTopoSet ( mesh, - dynamicCast(currentSet), - mesh.time().path()/vtkBaseName, - vtk::formatType::LEGACY_BINARY - ); - } - else if (isA(currentSet)) - { - // External faces of cellset with OpenFOAM cellID as value - vtk::writeCellSetFaces - ( - mesh, - dynamicCast(currentSet), - mesh.time().path()/vtkBaseName, - vtk::formatType::LEGACY_BINARY - ); - } - else if (isA(currentSet)) - { - vtk::writePointSet - ( - mesh, - dynamicCast(currentSet), - mesh.time().path()/vtkBaseName, - vtk::formatType::LEGACY_BINARY - ); - } - else + currSet, + vtk::formatType::INLINE_BASE64, // XML-binary + // vtk::formatType::LEGACY_BINARY, + outputName, + false // Not parallel + ) + ) { WarningInFunction - << "Don't know how to handle set of type " << currentSet.type() - << endl; + << "Don't know how to handle set of type " + << currSet.type() << nl; } } @@ -502,35 +479,35 @@ bool doCommand if (!noSync) currentSet.sync(mesh); // Write + Info<< " Writing " << currentSet.name() + << " (size " + << returnReduce(currentSet.size(), sumOp