From 9d8af49c1661af00c280a1a9b7f036ccefed1c4d Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 16 Oct 2018 13:50:13 +0200 Subject: [PATCH] ENH: parallel and xml output for surfaces (issue #926) --- src/meshTools/Make/files | 1 + src/meshTools/output/foamVtkSurfaceWriter.C | 477 ++++++++++++++++++ src/meshTools/output/foamVtkSurfaceWriter.H | 239 +++++++++ .../output/foamVtkSurfaceWriterTemplates.C | 130 +++++ 4 files changed, 847 insertions(+) create mode 100644 src/meshTools/output/foamVtkSurfaceWriter.C create mode 100644 src/meshTools/output/foamVtkSurfaceWriter.H create mode 100644 src/meshTools/output/foamVtkSurfaceWriterTemplates.C diff --git a/src/meshTools/Make/files b/src/meshTools/Make/files index e89cf987fc..4c1116e0b6 100644 --- a/src/meshTools/Make/files +++ b/src/meshTools/Make/files @@ -298,6 +298,7 @@ meshStructure/topoDistanceData.C meshStructure/pointTopoDistanceData.C output/foamVtkIndPatchWriter.C +output/foamVtkSurfaceWriter.C output/foamVtkWriteTopoSet.C output/foamVtkWriteFaceSet.C output/foamVtkWritePointSet.C diff --git a/src/meshTools/output/foamVtkSurfaceWriter.C b/src/meshTools/output/foamVtkSurfaceWriter.C new file mode 100644 index 0000000000..7bf887d232 --- /dev/null +++ b/src/meshTools/output/foamVtkSurfaceWriter.C @@ -0,0 +1,477 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "foamVtkSurfaceWriter.H" +#include "foamVtkOutput.H" +#include "globalIndex.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::vtk::surfaceWriter::beginPiece() +{ + // Basic sizes + nLocalPoints_ = points_.size(); + nLocalFaces_ = faces_.size(); + nLocalVerts_ = 0; + + for (const face& f : faces_) + { + nLocalVerts_ += f.size(); + } + + numberOfPoints_ = nLocalPoints_; + numberOfCells_ = nLocalFaces_; + + if (parallel_) + { + reduce(numberOfPoints_, sumOp