Flow123d  jenkins-Flow123d-windows-release-multijob-285
output_vtk.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2007 Technical University of Liberec. All rights reserved.
4  *
5  * Please make a following refer to Flow123d on your project site if you use the program for any purpose,
6  * especially for academic research:
7  * Flow123d, Research Centre: Advanced Remedial Technologies, Technical University of Liberec, Czech Republic
8  *
9  * This program is free software; you can redistribute it and/or modify it under the terms
10  * of the GNU General Public License version 3 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along with this program; if not,
17  * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 021110-1307, USA.
18  *
19  *
20  * $Id: $
21  * $Revision: $
22  * $LastChangedBy: $
23  * $LastChangedDate: $
24  *
25  * @file output_vtk.h
26  * @brief Header: The functions for VTK outputs.
27  *
28  */
29 
30 #ifndef OUTPUT_VTK_HH_
31 #define OUTPUT_VTK_HH_
32 
33 #include "input/accessors.hh"
34 
35 #include "output_data_base.hh"
36 #include "output_time.hh"
37 
38 /**
39  * \brief This class is used for output data to VTK file format
40  */
41 class OutputVTK : public OutputTime {
42 
43 public:
44 
45  /**
46  * \brief The constructor of this class. The head of file is written, when
47  * constructor is called
48  */
49  OutputVTK(const Input::Record &in_rec);
50 
51  /**
52  * \brief The constructor of this class. The head of file is written, when
53  * constructor is called
54  */
55  OutputVTK();
56 
57  /**
58  * \brief The destructor of this class. It writes tail of the file too.
59  */
60  ~OutputVTK();
61 
62  /**
63  * \brief The definition of input record for vtk file format
64  */
66 
67  /**
68  * \brief The definition of input record for selection of variant of file format
69  */
71 
72  /**
73  * \brief The definition of input record for selection of compression type
74  */
76 
77  /**
78  * \brief This function write data to VTK (.pvd) file format
79  * for curent time
80  */
81  int write_data(void);
82 
83  /**
84  * \brief This function writes header of VTK (.pvd) file format
85  */
86  int write_head(void);
87 
88  /**
89  * \brief This function writes tail of VTK (.pvd) file format
90  */
91  int write_tail(void);
92 
93 protected:
94 
95  /**
96  * \brief The declaration enumeration used for variant of file VTK format
97  */
98  typedef enum Variant {
101  } Variant;
102 
103  /**
104  * \brief The declaration of enumeration used for type of compression
105  * used in file format
106  */
107  typedef enum Compression {
110  } Compression;
111 
112  // VTK Element types
113  typedef enum {
116  VTK_LINE = 3,
122  VTK_QUAD = 9,
123  VTK_TETRA = 10,
124  VTK_VOXEL = 11,
126  VTK_WEDGE = 13,
133  } VTKElemType;
134 
135  // VTK Element size (number of nodes)
136  typedef enum {
140  } VTKElemSize;
141 
142  /**
143  * \brief Write header of VTK file (.vtu)
144  */
145  void write_vtk_vtu_head(void);
146 
147  /**
148  * \brief Write geometry (position of nodes) to the VTK file (.vtu)
149  */
150  void write_vtk_geometry(void);
151 
152  /**
153  * \brief Write topology (connection of nodes) to the VTK file (.vtu)
154  */
155  void write_vtk_topology(void);
156 
157  /**
158  * \brief Write geometry (position of nodes) to the VTK file (.vtu)
159  *
160  * This method is used, when discontinuous data are saved to the .vtu file
161  */
162  void write_vtk_discont_geometry(void);
163 
164  /**
165  * \brief Write topology (connection of nodes) to the VTK file (.vtu)
166  *
167  * This method is used, when discontinuous data are saved to the .vtu file
168  */
169  void write_vtk_discont_topology(void);
170 
171  /**
172  * Write registered data to output stream using ascii format
173  */
174  void write_vtk_data_ascii(OutputDataFieldVec &output_data_map);
175 
176  /**
177  * \brief Write names of data sets in @p output_data vector that have value type equal to @p type.
178  * Output is done into stream @p file.
179  */
180  void write_vtk_data_names(ofstream &file,
181  OutputDataFieldVec &output_data_map);
182 
183  /**
184  * \brief Write data on nodes to the VTK file (.vtu)
185  */
186  void write_vtk_node_data(void);
187 
188  /**
189  * \brief Write data on elements to the VTK file (.vtu)
190  */
191  void write_vtk_element_data(void);
192 
193  /**
194  * \brief Write tail of VTK file (.vtu)
195  */
196  void write_vtk_vtu_tail(void);
197 
198  /**
199  * \brief This function write all scalar and vector data on nodes and elements
200  * to the VTK file (.vtu)
201  */
202  void write_vtk_vtu(void);
203 
204  /**
205  * Set appropriate file path substrings.
206  * Make subdirectory for VTU time frames.
207  */
208  void make_subdirectory();
209 
210 
211  /**
212  * Data output stream (could be same as base_file)
213  */
214  ofstream _data_file;
215 
216  /**
217  * Path to time frame VTU data subdirectory
218  */
219  string subdir_name_;
220 
222 
224 };
225 
226 #endif /* OUTPUT_VTK_HH_ */
void write_vtk_discont_topology(void)
Write topology (connection of nodes) to the VTK file (.vtu)
Definition: output_vtk.cc:312
void make_subdirectory()
Definition: output_vtk.cc:157
static Input::Type::Selection input_type_variant
The definition of input record for selection of variant of file format.
Definition: output_vtk.hh:70
void write_vtk_vtu(void)
This function write all scalar and vector data on nodes and elements to the VTK file (...
Definition: output_vtk.cc:489
string subdir_name_
Definition: output_vtk.hh:219
void write_vtk_geometry(void)
Write geometry (position of nodes) to the VTK file (.vtu)
Definition: output_vtk.cc:185
string main_output_basename_
Definition: output_vtk.hh:221
int write_head(void)
This function writes header of VTK (.pvd) file format.
Definition: output_vtk.cc:544
string main_output_dir_
Definition: output_vtk.hh:223
void write_vtk_element_data(void)
Write data on elements to the VTK file (.vtu)
Definition: output_vtk.cc:460
void write_vtk_discont_geometry(void)
Write geometry (position of nodes) to the VTK file (.vtu)
Definition: output_vtk.cc:283
static Input::Type::Record input_type
The definition of input record for vtk file format.
Definition: output_vtk.hh:65
int write_data(void)
This function write data to VTK (.pvd) file format for curent time.
Definition: output_vtk.cc:97
ofstream _data_file
Definition: output_vtk.hh:214
static Input::Type::Selection input_type_compression
The definition of input record for selection of compression type.
Definition: output_vtk.hh:75
Accessor to the data with type Type::Record.
Definition: accessors.hh:327
void write_vtk_vtu_tail(void)
Write tail of VTK file (.vtu)
Definition: output_vtk.cc:480
This class is used for output data to VTK file format.
Definition: output_vtk.hh:41
int write_tail(void)
This function writes tail of VTK (.pvd) file format.
Definition: output_vtk.cc:565
The class for outputting data during time.
Definition: output_time.hh:32
~OutputVTK()
The destructor of this class. It writes tail of the file too.
Definition: output_vtk.cc:89
void write_vtk_data_ascii(OutputDataFieldVec &output_data_map)
Definition: output_vtk.cc:383
OutputVTK()
The constructor of this class. The head of file is written, when constructor is called.
Definition: output_vtk.cc:84
void write_vtk_node_data(void)
Write data on nodes to the VTK file (.vtu)
Definition: output_vtk.cc:433
Variant
The declaration enumeration used for variant of file VTK format.
Definition: output_vtk.hh:98
Record type proxy class.
Definition: type_record.hh:169
std::vector< OutputDataPtr > OutputDataFieldVec
Definition: output_time.hh:174
void write_vtk_vtu_head(void)
Write header of VTK file (.vtu)
Definition: output_vtk.cc:174
Compression
The declaration of enumeration used for type of compression used in file format.
Definition: output_vtk.hh:107
Template for classes storing finite set of named values.
void write_vtk_topology(void)
Write topology (connection of nodes) to the VTK file (.vtu)
Definition: output_vtk.cc:215
void write_vtk_data_names(ofstream &file, OutputDataFieldVec &output_data_map)
Write names of data sets in output_data vector that have value type equal to type. Output is done into stream file.
Definition: output_vtk.cc:411