foamVtkCore.H
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) 2016-2022 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
26Namespace
27 Foam::vtk
28
29Description
30 Namespace for handling VTK input/output.
31
32SourceFiles
33 foamVtkCore.C
34
35\*---------------------------------------------------------------------------*/
36
37#ifndef Foam_vtk_core_H
38#define Foam_vtk_core_H
39
40#include <cstdint>
41#include "Enum.H"
42
43// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44
45namespace Foam
46{
47namespace vtk
48{
49
50// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51
52 // Enumerations
53
54 //- The context when outputting a VTK file (XML or legacy).
55 enum OutputContext : uint8_t
56 {
59 APPEND
60 };
61
62
63 //- The output format type for file contents.
64 // Upper bits for output type, lower bits for the format itself.
65 enum class formatType : uint8_t
66 {
67 INLINE_ASCII = 0,
68 INLINE_BASE64 = 0x01,
69 APPEND_BASE64 = 0x11,
70 APPEND_BINARY = 0x12,
71 LEGACY_ASCII = 0x20,
72 LEGACY_BINARY = 0x22,
73 };
74
75 //- Test for vtk append format (xml)
76 inline bool isAppend(enum formatType fmt) noexcept
77 {
78 return (uint8_t(fmt) & 0x10);
79 }
80
81 //- Test for vtk legacy format
82 inline bool isLegacy(enum formatType fmt) noexcept
83 {
84 return (uint8_t(fmt) & 0x20);
85 }
86
87
88 //- Equivalent to enumeration in "vtkCellType.h" (should be uint8_t)
89 enum cellType : uint8_t
90 {
108 VTK_POLYHEDRON = 42
109 };
110
111
112 //- Some common XML tags for vtk files
113 enum class fileTag : uint8_t
114 {
115 VTK_FILE,
116 DATA_ARRAY,
117 BLOCK,
118 PIECE,
119 DATA_SET,
120 POINTS,
121 CELLS,
122 POLYS,
123 VERTS,
124 LINES,
125 CELL_DATA,
126 POINT_DATA,
127 FIELD_DATA,
128 POLY_DATA,
131 };
132
133 //- File extension (without ".") for some vtk XML file content types
135
136 //- Version string for some vtk XML file content types
138
139 //- Strings corresponding to the vtk XML tags
141
142 //- Some common XML attributes for vtk files
143 enum class fileAttr : uint8_t
144 {
145 OFFSET,
153 };
154
155 //- Strings corresponding to the vtk XML attributes
157
158 //- Some common names for XML DataArray entries
159 enum class dataArrayAttr : uint8_t
160 {
161 POINTS,
162 OFFSETS,
164 TYPES,
165 FACES,
167 };
168
169 //- Strings corresponding to the vtk XML DataArray attributes
171
172
173/*---------------------------------------------------------------------------*\
174 Namespace legacy
175\*---------------------------------------------------------------------------*/
176
177namespace legacy
178{
179
180 //- Legacy file extension ("vtk")
181 extern const word fileExtension;
182
183 //- Legacy content names (POLYDATA, UNSTRUCTURED_GRID)
185
186 //- Legacy file tags (eg, LINES, CELL_DATA, POINT_DATA, ...)
188
189 //- Legacy attributes (eg, OFFSETS)
191
192
193} // End namespace legacy
194
195
196// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197
198} // End namespace vtk
199
200} // End namespace Foam
201
202// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203
204#endif
205
206// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
A class for handling words, derived from Foam::string.
Definition: word.H:68
const Foam::Enum< dataArrayAttr > dataArrayAttrNames
Legacy attributes (eg, OFFSETS)
const word fileExtension
Legacy file extension ("vtk")
const Foam::Enum< vtk::fileTag > fileTagNames
Legacy file tags (eg, LINES, CELL_DATA, POINT_DATA, ...)
const Foam::Enum< vtk::fileTag > contentNames
Legacy content names (POLYDATA, UNSTRUCTURED_GRID)
const Foam::Enum< dataArrayAttr > dataArrayAttrNames
Strings corresponding to the vtk XML DataArray attributes.
const Foam::Enum< fileAttr > fileAttrNames
Strings corresponding to the vtk XML attributes.
fileAttr
Some common XML attributes for vtk files.
Definition: foamVtkCore.H:144
@ NUMBER_OF_POLYS
"NumberOfPolys"
@ NUMBER_OF_COMPONENTS
"NumberOfComponents"
@ NUMBER_OF_TUPLES
"NumberOfTuples"
@ NUMBER_OF_LINES
"NumberOfLines"
@ NUMBER_OF_CELLS
"NumberOfCells"
@ NUMBER_OF_VERTS
"NumberOfVerts"
@ NUMBER_OF_POINTS
"NumberOfPoints"
dataArrayAttr
Some common names for XML DataArray entries.
Definition: foamVtkCore.H:160
@ FACEOFFSETS
"faceoffsets"
@ CONNECTIVITY
"connectivity"
fileTag
Some common XML tags for vtk files.
Definition: foamVtkCore.H:114
@ FIELD_DATA
"FieldData"
@ CELL_DATA
"CellData"
@ POINT_DATA
"PointData"
@ DATA_ARRAY
"DataArray"
@ UNSTRUCTURED_GRID
"UnstructuredGrid"
@ VTK_FILE
"VTKFile"
@ MULTI_BLOCK
"vtkMultiBlockDataSet"
@ POLY_DATA
"PolyData"
@ DATA_SET
"DataSet"
formatType
The output format type for file contents.
Definition: foamVtkCore.H:66
@ APPEND_BASE64
XML append base64, appendBase64Formatter.
@ APPEND_BINARY
XML append raw binary, appendRawFormatter.
@ INLINE_ASCII
XML inline ASCII, asciiFormatter.
@ LEGACY_ASCII
Legacy ASCII, legacyAsciiFormatter.
@ LEGACY_BINARY
Legacy raw binary, legacyRawFormatter.
@ INLINE_BASE64
XML inline base64, base64Formatter.
bool isAppend(enum formatType fmt) noexcept
Test for vtk append format (xml)
Definition: foamVtkCore.H:76
const Foam::Enum< fileTag > fileExtension
File extension (without ".") for some vtk XML file content types.
OutputContext
The context when outputting a VTK file (XML or legacy).
Definition: foamVtkCore.H:56
@ INLINE
Generate header and inline data.
Definition: foamVtkCore.H:57
@ HEADER
Generate header only.
Definition: foamVtkCore.H:58
@ APPEND
Generate append-data.
Definition: foamVtkCore.H:59
bool isLegacy(enum formatType fmt) noexcept
Test for vtk legacy format.
Definition: foamVtkCore.H:82
const Foam::Enum< fileTag > fileTagNames
Strings corresponding to the vtk XML tags.
const Foam::Enum< fileTag > fileContentVersions
Version string for some vtk XML file content types.
cellType
Equivalent to enumeration in "vtkCellType.h" (should be uint8_t)
Definition: foamVtkCore.H:90
@ VTK_TRIANGLE_STRIP
Definition: foamVtkCore.H:97
@ VTK_POLY_LINE
Definition: foamVtkCore.H:95
@ VTK_TRIANGLE
Definition: foamVtkCore.H:96
@ VTK_EMPTY_CELL
Definition: foamVtkCore.H:91
@ VTK_POLYHEDRON
Definition: foamVtkCore.H:108
@ VTK_PENTAGONAL_PRISM
Definition: foamVtkCore.H:106
@ VTK_HEXAGONAL_PRISM
Definition: foamVtkCore.H:107
@ VTK_HEXAHEDRON
Definition: foamVtkCore.H:103
@ VTK_POLY_VERTEX
Definition: foamVtkCore.H:93
Namespace for OpenFOAM.