Documentation a537f1bdf2
Loading...
Searching...
No Matches
CParaviewVTMFileWriter.hpp
Go to the documentation of this file.
1/*!
2 * \file CParaviewVTMFileWriter.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 "CFileWriter.hpp"
31#include "../../../../Common/include/CConfig.hpp"
32
33
35
36 /*!
37 * \brief String stream that stores the content of the vtm file
38 */
39 stringstream output;
40
41 /*!
42 * \brief The folder name where all the files associated with the datasets will be stored
43 */
44 string folderName;
45
46
47 /*!
48 * \brief The iteration number that may be appended to the folder name
49 */
50 string iterationNumber;
51
52 /*!
53 * \brief The current zone index
54 */
55 unsigned short iZone;
56
57 /*!
58 * \brief The total number of zones
59 */
60 unsigned short nZone;
61
62 /*!
63 * \brief Current physical time
64 */
65 su2double curTime;
66
67 /*!
68 * \brief Number of data sets
69 */
70 int nWrittenDatasets;
71
72 /*!
73 * \brief Accumulated bandwidth
74 */
75 su2double accumulatedBandwidth;
76
77public:
78
79 /*!
80 * \brief File extension
81 */
82 const static string fileExt;
83
84 /*!
85 * \brief Construct a file writer using field names, dimension.
86 * \param[in] valFolderName - The name of the output folder
87 * \param[in] valTime - The current physical time
88 * \param[in] valiZone - The index of the current zone
89 * \param[in] valnZone - The total number of zones
90 */
91 CParaviewVTMFileWriter(su2double valTime, unsigned short valiZone, unsigned short valnZone);
92
93 /*!
94 * \brief Destructor
95 */
97
98 /*!
99 * \brief Write sorted data to file in paraview binary file format
100 * \param[in] val_filename - The name of the file
101 */
102 void WriteData(string val_filename) override ;
103
104 /*!
105 * \brief Write all data of the zones, boundaries into the folder
106 * \param[in] val_foldername - The name of the file folder
107 * \param[in] config - The config options
108 * \param[in] multiZoneHeaderString
109 * \param[in] volumeDataSorter - sorted volume data
110 * \param[in] surfaceDataSorter - sorted surface data
111 * \param[in] geometry - the geometry of the problem
112 */
113 void WriteFolderData(const string& foldername, CConfig *config,
114 string multiZoneHeaderString,
115 CParallelDataSorter* volumeDataSorter,
116 CParallelDataSorter* surfaceDataSorter,
117 CGeometry *geometry);
118
119
120 /*!
121 * \brief Add a new dataset by writing data from a datasorter to file and adding it to the vtm file
122 * \param[in] name - The name of the dataset
123 * \param[in] file - The name of the vtu dataset file to write
124 * \param[in] dataSorter - Datasorter object containing the actual data. Note, data must be sorted.
125 */
126 //void AddDataset(string name, string file, CParallelDataSorter* dataSorter);
127 void AddDataset(const string& foldername, string name, const string& file, CParallelDataSorter* dataSorter,
128 bool doublePrecision);
129
130 /*!
131 * \brief Start a new block
132 * \param[in] name - The name of the block
133 */
134 inline void StartBlock(string name){
135 if (rank == MASTER_NODE){
136 output << "<Block name=\"" << name << "\">" << endl;
137 }
138 }
139
140 /*!
141 * \brief Close currently opened block
142 */
143 inline void EndBlock(){
144 if (rank == MASTER_NODE){
145 output << "</Block>" << endl;
146 }
147 }
148
149 /*!
150 * \brief Add a new dataset by writing it to the vtm file
151 * \param[in] name - Name of the dataset
152 * \param[in] file - vtu file where the data is stored
153 */
154 inline void AddDataset(string name, string file){
155 if (rank == MASTER_NODE){
156 output << "<DataSet name=\"" << name <<"\" file=\"" << file << "\"/>" << endl;
157 }
158 }
159
160 /*!
161 * \brief Get the name of the folder where the data will be stored
162 * \return The folder name
163 */
164 inline string GetFolderName() const{
165 return folderName;
166 }
167};
Headers fo the file writer class.
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Definition CFileWriter.hpp:42
CParallelDataSorter * dataSorter
The parallel data sorter.
Definition CFileWriter.hpp:80
int rank
The MPI rank.
Definition CFileWriter.hpp:48
Parent class for defining the geometry of the problem (complete geometry, multigrid agglomerated geom...
Definition CGeometry.hpp:75
Definition CParallelDataSorter.hpp:39
Definition CParaviewVTMFileWriter.hpp:34
void AddDataset(string name, string file)
Add a new dataset by writing it to the vtm file.
Definition CParaviewVTMFileWriter.hpp:154
string GetFolderName() const
Get the name of the folder where the data will be stored.
Definition CParaviewVTMFileWriter.hpp:164
static const string fileExt
File extension.
Definition CParaviewVTMFileWriter.hpp:82
~CParaviewVTMFileWriter() override
Destructor.
void WriteData(string val_filename) override
Write sorted data to file in paraview binary file format.
Definition CParaviewVTMFileWriter.cpp:50
void AddDataset(const string &foldername, string name, const string &file, CParallelDataSorter *dataSorter, bool doublePrecision)
Add a new dataset by writing data from a datasorter to file and adding it to the vtm file.
Definition CParaviewVTMFileWriter.cpp:90
void WriteFolderData(const string &foldername, CConfig *config, string multiZoneHeaderString, CParallelDataSorter *volumeDataSorter, CParallelDataSorter *surfaceDataSorter, CGeometry *geometry)
Write all data of the zones, boundaries into the folder.
Definition CParaviewVTMFileWriter.cpp:118
void EndBlock()
Close currently opened block.
Definition CParaviewVTMFileWriter.hpp:143
void StartBlock(string name)
Start a new block.
Definition CParaviewVTMFileWriter.hpp:134
passivedouble su2double
Definition code_config.hpp:181
const int MASTER_NODE
Master node for MPI parallelization.
Definition option_structure.hpp:112