Documentation 6b54b78464
Loading...
Searching...
No Matches
CParaviewBinaryFileWriter.hpp
Go to the documentation of this file.
1/*!
2 * \file CParaviewBinaryFileWriter.hpp
3 * \brief Headers fo paraview binary file writer class.
4 * \author T. Albring
5 * \version 8.5.0 "Harrier"
6 *
7 * SU2 Project Website: https://su2code.github.io
8 *
9 * The SU2 Project is maintained by the SU2 Foundation
10 * (http://su2foundation.org)
11 *
12 * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)
13 *
14 * SU2 is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * SU2 is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
26 */
27
28#pragma once
29
30#include <array>
31
32#include "CFileWriter.hpp"
33
35 private:
36
37 /*!
38 * \brief Boolean storing whether we are on a big or little endian machine
39 */
40 bool bigEndian;
41
42 static constexpr unsigned short NCOORDS = 3; /*!< \brief Points and vectors always have 3 components. */
43
44 /*!
45 * \brief Element types, in the order in which the cells are written.
46 */
47 static constexpr std::array<GEO_TYPE, 7> elemTypes = {LINE, TRIANGLE, QUADRILATERAL, TETRAHEDRON,
49
50 /*!
51 * \brief Write the point coordinates.
52 */
53 void WritePoints();
54
55 /*!
56 * \brief Write the cells in the classic layout: the number of nodes followed by the node ids of each cell, Int32.
57 * \param[in] GlobalCellStorage - Total size of that array.
58 */
59 void WriteCellsInt32(unsigned long GlobalCellStorage);
60
61 /*!
62 * \brief Write the cells in the layout of VTK >= 9.0: Int64 offsets and connectivity.
63 */
64 void WriteCellsInt64();
65
66 /*!
67 * \brief Write the type of each cell.
68 */
69 void WriteCellTypes();
70
71 /*!
72 * \brief Write the fields, as scalars or 3-component vectors.
73 */
74 void WritePointData();
75
76 /*!
77 * \brief Write 3 fields starting at firstVar as a vector (the third component is 0 in 2D).
78 * \param[in] firstVar - Index of the first field in the data sorter.
79 */
80 void WriteVectorArray(unsigned short firstVar);
81
82 /*!
83 * \brief Write the point values of this rank (nComponents per point) at their place in the file.
84 * \param[in,out] buffer - Values, byte-swapped in place to big endian.
85 * \param[in] nComponents - Values per point.
86 */
87 void WritePointArray(vector<float>& buffer, unsigned short nComponents);
88
89public:
90
91 /*!
92 * \brief File extension
93 */
94 const static string fileExt;
95
96 /*!
97 * \brief Construct a file writer using field names and the data sorter.
98 * \param[in] valDataSorter - The parallel sorted data to write
99 */
101
102 /*!
103 * \brief Destructor
104 */
106
107 /*!
108 * \brief Write sorted data to file in paraview binary file format
109 * \param[in] val_filename - The name of the file
110 */
111 void WriteData(string val_filename) override ;
112};
113
Headers fo the file writer class.
Definition CFileWriter.hpp:42
Definition CParallelDataSorter.hpp:39
Definition CParaviewBinaryFileWriter.hpp:34
~CParaviewBinaryFileWriter() override
Destructor.
static const string fileExt
File extension.
Definition CParaviewBinaryFileWriter.hpp:94
void WriteData(string val_filename) override
Write sorted data to file in paraview binary file format.
Definition CParaviewBinaryFileWriter.cpp:51
@ TRIANGLE
VTK nomenclature for defining a triangle element.
Definition option_structure.hpp:134
@ PYRAMID
VTK nomenclature for defining a pyramid element.
Definition option_structure.hpp:139
@ PRISM
VTK nomenclature for defining a prism element.
Definition option_structure.hpp:138
@ QUADRILATERAL
VTK nomenclature for defining a quadrilateral element.
Definition option_structure.hpp:135
@ HEXAHEDRON
VTK nomenclature for defining a hexahedron element.
Definition option_structure.hpp:137
@ LINE
VTK nomenclature for defining a line element.
Definition option_structure.hpp:133
@ TETRAHEDRON
VTK nomenclature for defining a tetrahedron element.
Definition option_structure.hpp:136