foamVtkWriteTopoSet.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2018-2021 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
28#include "foamVtkWriteTopoSet.H"
29#include "polyMesh.H"
30#include "topoSet.H"
31#include "faceSet.H"
32#include "cellSet.H"
33#include "pointSet.H"
34
35// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36
38(
39 const polyMesh& mesh,
40 const topoSet& set,
41 const vtk::outputOptions opts,
42 const fileName& file,
43 bool parallel
44)
45{
46 {
47 const auto* ptr = isA<pointSet>(set);
48 if (ptr)
49 {
50 return vtk::writePointSet(mesh, *ptr, opts, file, parallel);
51 }
52 }
53 {
54 const auto* ptr = isA<faceSet>(set);
55 if (ptr)
56 {
57 return vtk::writeFaceSet(mesh, *ptr, opts, file, parallel);
58 }
59 }
60 {
61 const auto* ptr = isA<cellSet>(set);
62 if (ptr)
63 {
64 return vtk::writeCellSetFaces(mesh, *ptr, opts, file, parallel);
65 }
66 }
67
69 << "No VTK writer for '" << set.type() << "' topoSet" << nl << endl;
70
71 return false;
72}
73
74
75// ************************************************************************* //
A class for handling file names.
Definition: fileName.H:76
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:67
Encapsulated combinations of output format options. This is primarily useful when defining the output...
dynamicFvMesh & mesh
Write topoSet in VTK format.
#define WarningInFunction
Report a warning using Foam::Warning.
bool writeTopoSet(const polyMesh &mesh, const topoSet &set, const vtk::outputOptions opts, const fileName &file, bool parallel=Pstream::parRun())
Dispatch to vtk::writeCellSetFaces, vtk::writeFaceSet, vtk::writePointSet.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53