Flow123d  DF_patch_fe_data_tables-586fb30
output_vtk.cc
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file output_vtk.cc
15  * @brief The functions for outputs to VTK files.
16  */
17 
18 #include "output_vtk.hh"
20 #include "element_data_cache.hh"
21 #include "output_mesh.hh"
22 #include "mesh/mesh.h"
23 
24 #include <limits.h>
25 #include "input/factory.hh"
27 #include "system/file_path.hh"
28 #include "tools/time_governor.hh"
29 #include "la/distribution.hh"
30 
31 #include "config.h"
32 
34 
35 
36 using namespace Input::Type;
37 
39  return Record("vtk", "Parameters of vtk output format.")
40  // It is derived from abstract class
42  .declare_key("variant", OutputVTK::get_input_type_variant(), Default("\"ascii\""),
43  "Variant of output stream file format.")
44  // The parallel or serial variant
45  .declare_key("parallel", Bool(), Default("false"),
46  "Parallel or serial version of file format.")
47  .close();
48 }
49 
50 
52  return Selection("VTK variant (ascii or binary)")
54  "ASCII variant of VTK file format")
56  "Uncompressed appended binary XML VTK format without usage of base64 encoding of appended data.")
57 #ifdef FLOW123D_HAVE_ZLIB
59  "Appended binary XML VTK format without usage of base64 encoding of appended data. Compressed with ZLib.")
60 #endif // FLOW123D_HAVE_ZLIB
61  .close();
62 }
63 
64 
65 const int OutputVTK::registrar = Input::register_class< OutputVTK >("vtk") +
67 
68 
69 const std::vector<std::string> OutputVTK::formats = { "ascii", "appended", "appended" };
70 
71 
72 
74 {
75  this->enable_refinement_ = true;
76 }
77 
78 
79 
81 {
82  // Perform output of last time step
83  this->write_time_frame();
84 
85  this->write_tail();
86 }
87 
88 
89 
90 void OutputVTK::init_from_input(const std::string &equation_name,
91  const Input::Record &in_rec,
92  const std::shared_ptr<TimeUnitConversion>& time_unit_conv)
93 {
94  OutputTime::init_from_input(equation_name, in_rec, time_unit_conv);
95 
96  auto format_rec = (Input::Record)(input_record_.val<Input::AbstractRecord>("format"));
97  variant_type_ = format_rec.val<VTKVariant>("variant");
98  this->parallel_ = format_rec.val<bool>("parallel");
99  this->fix_main_file_extension(".pvd");
100 
101  if(this->rank_ == 0) {
102  try {
103  this->_base_filename.open_stream( this->_base_file );
104  this->set_stream_precision(this->_base_file);
105  } INPUT_CATCH(FilePath::ExcFileOpen, FilePath::EI_Address_String, input_record_)
106 
107  LogOut() << "Writing flow output file: " << this->_base_filename << " ... ";
108  }
109 
110  this->make_subdirectory();
111  this->write_head();
112 
113 }
114 
115 string OutputVTK::form_vtu_filename_(string basename, int i_step, int rank) {
116  ostringstream ss;
117  if (this->parallel_) {
118  // parallel file
119  ss << basename << "/" << basename << "-"
120  << std::setw(6) << std::setfill('0') << i_step << "." << rank << ".vtu";
121  } else {
122  // serial file
123  ss << basename << "/" << basename << "-"
124  << std::setw(6) << std::setfill('0') << i_step << ".vtu";
125  }
126  return ss.str();
127 }
128 
129 string pvd_dataset_line(double step, int rank, string file) {
130  ostringstream ss;
131  ss
132  << "<DataSet timestep=\"" << step
133  << "\" group=\"\" part=\"" << rank
134  << "\" file=\"" << file
135  << "\"/>\n";
136  return ss.str();
137 }
138 
140 {
141  ASSERT_PTR(this->nodes_).error();
142 
143  /* Output of serial format is implemented only in the first process */
144  if ( (this->rank_ != 0) && (!parallel_) ) {
145  return 0;
146  }
147 
148  /**
149  * TODO:
150  * - common creation of the VTU filename
151  * - names of parallel file: <base name>_<frame>.<rank>.vtu
152  * - for serial case use rank=0
153  */
154 
155  /* Write DataSets to the PVD file only in the first process */
156  if (this->rank_ == 0) {
157  ASSERT(this->_base_file.is_open())(this->_base_filename).error();
158 
159  /* Set floating point precision to max */
160  //this->_base_file.precision(std::numeric_limits<double>::digits10);
161  //int current_step = this->get_parallel_current_step();
162 
163  /* Write dataset lines to the PVD file. */
164  double corrected_time = (isfinite(this->registered_time_)?this->registered_time_:0);
165  corrected_time /= this->time_unit_converter->get_coef();
166  if (parallel_) {
167  for (int i_rank=0; i_rank<n_proc_; ++i_rank) {
168  string file = this->form_vtu_filename_(main_output_basename_, current_step, i_rank);
169  this->_base_file << pvd_dataset_line(corrected_time, i_rank, file);
170  }
171  } else {
172  string file = this->form_vtu_filename_(main_output_basename_, current_step, -1);
173  this->_base_file << pvd_dataset_line(corrected_time, 0, file);
174  }
175  }
176 
177  /* write VTU file */
178  {
179  /* Open VTU file */
180  std::string frame_file_name = this->form_vtu_filename_(main_output_basename_, current_step, this->rank_);
181  FilePath frame_file_path({main_output_dir_, frame_file_name}, FilePath::output_file);
182  try {
183  frame_file_path.open_stream(_data_file);
184  this->set_stream_precision(_data_file);
185  } INPUT_CATCH(FilePath::ExcFileOpen, FilePath::EI_Address_String, input_record_)
186 
187  LogOut() << __func__ << ": Writing output (frame: " << this->current_step
188  << ", rank: " << this->rank_
189  << ") file: " << frame_file_name << " ... ";
190 
191  this->write_vtk_vtu();
192 
193  /* Close stream for file of current frame */
194  _data_file.close();
195  //delete data_file;
196  //this->_data_file = NULL;
197 
198  LogOut() << "O.K.";
199 
200  }
201 
202  return 1;
203 }
204 
205 
206 
207 
209 {
210  ASSERT_EQ(this->_base_filename.extension(), ".pvd").error();
211  main_output_dir_ = this->_base_filename.parent_path();
212  main_output_basename_ = this->_base_filename.stem();
213 
214  if(this->rank_ == 0) {
215  vector<string> sub_path = { main_output_dir_, main_output_basename_, "__tmp__" };
216  FilePath fp(sub_path, FilePath::output_file);
217  fp.create_output_dir();
218  }
219 }
220 
221 
222 
223 
225 {
226  ofstream &file = this->_data_file;
227 
228  file << "<?xml version=\"1.0\"?>" << endl;
229  // TODO: test endianess of platform (this would be important, when raw
230  // data will be saved to the VTK file)
231  file << "<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\"";
232  if ( this->variant_type_ != VTKVariant::VARIANT_ASCII ) {
233  file << " header_type=\"UInt64\"";
234  }
235  if ( this->variant_type_ == VTKVariant::VARIANT_BINARY_ZLIB ) {
236  file << " compressor=\"vtkZLibDataCompressor\"";
237  }
238  file << ">" << endl;
239  file << "<UnstructuredGrid>" << endl;
240 }
241 
242 
243 
244 std::shared_ptr<ElementDataCache<unsigned int>> OutputVTK::fill_element_types_data()
245 {
246  auto &offsets = *( this->offsets_->get_data().get() );
247  unsigned int n_elements = offsets.size()-1;
248 
249  auto types = std::make_shared<ElementDataCache<unsigned int>>("types", (unsigned int)ElementDataCacheBase::N_SCALAR, n_elements);
250  std::vector< unsigned int >& data = *( types->get_data().get() );
251  int n_nodes;
252 
253  for(unsigned int i=0; i < n_elements; i++)
254  {
255  n_nodes = offsets[i+1]-offsets[i];
256  switch(n_nodes) {
257  case 2:
258  data[i] = (unsigned int)VTK_LINE;
259  break;
260  case 3:
261  data[i] = (unsigned int)VTK_TRIANGLE;
262  break;
263  case 4:
264  data[i] = (unsigned int)VTK_TETRA;
265  break;
266  }
267  }
268 
269  return types;
270 }
271 
272 
273 
274 void OutputVTK::write_vtk_data(OutputTime::OutputDataPtr output_data, unsigned int start)
275 {
276  // names of types in DataArray section
277  static const std::vector<std::string> types = {
278  "Int8", "UInt8", "Int16", "UInt16", "Int32", "UInt32", "Float32", "Float64" };
279 
280  ofstream &file = this->_data_file;
281 
282  file << "<DataArray type=\"" << types[output_data->vtk_type()] << "\" ";
283  // possibly write name
284  if( ! output_data->field_input_name().empty())
285  file << "Name=\"" << output_data->field_input_name() <<"\" ";
286  // write number of components
287  if (output_data->n_comp() > 1)
288  {
289  file
290  << "NumberOfComponents=\"" << output_data->n_comp() << "\" ";
291  }
292  file << "format=\"" << formats[this->variant_type_] << "\"";
293 
294  if ( this->variant_type_ == VTKVariant::VARIANT_ASCII ) {
295  // ascii output
296  file << ">" << endl;
297  //file << std::fixed << std::setprecision(10); // Set precision to max
298  output_data->print_ascii_all(file, start);
299  file << "\n</DataArray>" << endl;
300  } else {
301  // binary output is stored to appended_data_ stream
302  double range_min, range_max;
303  output_data->get_min_max_range(range_min, range_max);
304  file << " offset=\"" << appended_data_.tellp() << "\" ";
305  file << "RangeMin=\"" << range_min << "\" RangeMax=\"" << range_max << "\"/>" << endl;
306  if ( this->variant_type_ == VTKVariant::VARIANT_BINARY_UNCOMPRESSED ) {
307  output_data->print_binary_all( appended_data_, true, start );
308  } else { // ZLib compression
309  stringstream uncompressed_data, compressed_data;
310  output_data->print_binary_all( uncompressed_data, false, start );
311  this->compress_data(uncompressed_data, compressed_data);
312  appended_data_ << compressed_data.str();
313  }
314  }
315 
316 }
317 
318 
319 void OutputVTK::compress_data(stringstream &uncompressed_stream, stringstream &compressed_stream) {
320  // size of block of compressed data.
321  static const size_t BUF_SIZE = 32 * 1024;
322 
323  string uncompressed_string = uncompressed_stream.str(); // full uncompressed string
324  zlib_ulong uncompressed_size = uncompressed_string.size(); // size of uncompressed string
325  stringstream compressed_data; // helper stream stores blocks of compress data
326 
327  zlib_ulong count_of_blocks = (uncompressed_size + BUF_SIZE - 1) / BUF_SIZE;
328  zlib_ulong last_block_size = (uncompressed_size % BUF_SIZE);
329  compressed_stream.write(reinterpret_cast<const char*>(&count_of_blocks), sizeof(unsigned long long int));
330  compressed_stream.write(reinterpret_cast<const char*>(&BUF_SIZE), sizeof(unsigned long long int));
331  compressed_stream.write(reinterpret_cast<const char*>(&last_block_size), sizeof(unsigned long long int));
332 
333  for (zlib_ulong i=0; i<count_of_blocks; ++i) {
334  // get block of data for compression
335  std::string data_block = uncompressed_string.substr(i*BUF_SIZE, BUF_SIZE);
336  zlib_ulong data_block_size = data_block.size();
337 
338  std::vector<uint8_t> buffer;
339  uint8_t temp_buffer[BUF_SIZE];
340 
341  // set zlib object
342  z_stream strm;
343  strm.zalloc = 0;
344  strm.zfree = 0;
345  strm.next_in = reinterpret_cast<uint8_t *>(&data_block[0]);
346  strm.avail_in = data_block_size;
347  strm.next_out = temp_buffer;
348  strm.avail_out = BUF_SIZE;
349 
350  // compression of data
351  deflateInit(&strm, Z_BEST_COMPRESSION);
352  while (strm.avail_in != 0) {
353  int res = deflate(&strm, Z_NO_FLUSH);
354  ASSERT_EQ(res, Z_OK).error();
355  if (strm.avail_out == 0) {
356  buffer.insert(buffer.end(), temp_buffer, temp_buffer + BUF_SIZE);
357  strm.next_out = temp_buffer;
358  strm.avail_out = BUF_SIZE;
359  }
360  }
361  int deflate_res = Z_OK;
362  while (deflate_res == Z_OK) {
363  if (strm.avail_out == 0) {
364  buffer.insert(buffer.end(), temp_buffer, temp_buffer + BUF_SIZE);
365  strm.next_out = temp_buffer;
366  strm.avail_out = BUF_SIZE;
367  }
368  deflate_res = deflate(&strm, Z_FINISH);
369  }
370  ASSERT_EQ(deflate_res, Z_STREAM_END).error();
371  buffer.insert(buffer.end(), temp_buffer, temp_buffer + BUF_SIZE - strm.avail_out);
372  deflateEnd(&strm);
373 
374  // store compress data and its size to streams
375  std::string str(buffer.begin(), buffer.end());
376  zlib_ulong compressed_data_size = str.size();
377  compressed_stream.write(reinterpret_cast<const char*>(&compressed_data_size), sizeof(unsigned long long int));
378  compressed_data << str;
379  }
380  // push compress data to returned stream
381  compressed_stream << compressed_data.str();
382 }
383 
384 
386 {
387  for(OutputDataPtr data : output_data_vec)
388  if( ! data->is_dummy())
389  write_vtk_data(data);
390 }
391 
392 
393 
394 
396  OutputDataFieldVec &output_data_vec)
397 {
398  if (output_data_vec.empty()) return;
399 
400  file << "Scalars=\"";
401  for(OutputDataPtr data : output_data_vec )
402  if (data->n_comp() == ElementDataCacheBase::N_SCALAR
403  && ! data->is_dummy())
404  file << data->field_input_name() << ",";
405  file << "\" ";
406 
407  file << "Vectors=\"";
408  for(OutputDataPtr data : output_data_vec )
409  if (data->n_comp() == ElementDataCacheBase::N_VECTOR
410  && ! data->is_dummy())
411  file << data->field_input_name() << ",";
412  file << "\" ";
413 
414  file << "Tensors=\"";
415  for(OutputDataPtr data : output_data_vec )
416  if (data->n_comp() == ElementDataCacheBase::N_TENSOR
417  && ! data->is_dummy())
418  file << data->field_input_name() << ",";
419  file << "\"";
420 }
421 
422 
424 {
425  ofstream &file = this->_data_file;
426 
427  // merge node and corner data
428  OutputDataFieldVec node_corner_data(output_data_vec_[NODE_DATA]);
429  node_corner_data.insert(node_corner_data.end(),
430  output_data_vec_[CORNER_DATA].begin(), output_data_vec_[CORNER_DATA].end());
431 
432  if( ! node_corner_data.empty() ) {
433  /* Write <PointData begin */
434  file << "<PointData ";
435  write_vtk_data_names(file, node_corner_data);
436  file << ">" << endl;
437 
438  /* Write data on nodes */
439  this->write_vtk_field_data(output_data_vec_[NODE_DATA]);
440 
441  /* Write data in corners of elements */
442  this->write_vtk_field_data(output_data_vec_[CORNER_DATA]);
443 
444  /* Write PointData end */
445  file << "</PointData>" << endl;
446  }
447 }
448 
449 
451 {
452  ofstream &file = this->_data_file;
453 
454  auto &data_map = this->output_data_vec_[ELEM_DATA];
455  if (data_map.empty()) return;
456 
457  /* Write CellData begin */
458  file << "<CellData ";
459  write_vtk_data_names(file, data_map);
460  file << ">" << endl;
461 
462  /* Write own data */
463  this->write_vtk_field_data(data_map);
464 
465  /* Write PointData end */
466  file << "</CellData>" << endl;
467 }
468 
469 
471 {
472  ofstream &file = this->_data_file;
473 
474  auto &data_map = this->output_data_vec_[NATIVE_DATA];
475  if (data_map.empty()) return;
476 
477  /* Write Flow123dData begin */
478  file << "<Flow123dData ";
479  write_vtk_data_names(file, data_map);
480  file << ">" << endl;
481 
482  /* Write own data */
483  for(OutputDataPtr output_data : data_map) {
484  file << "<DataArray type=\"Float64\" ";
485  file << "Name=\"" << output_data->field_input_name() <<"\" ";
486  file << "format=\"" << formats[this->variant_type_] << "\" ";
487  file << "dof_handler_hash=\"" << output_data->dof_handler_hash() << "\" ";
488  file << "n_dofs_per_element=\"" << output_data->n_dofs_per_element() << "\"";
489  //file << " fe_type=\"" << output_data->fe_type() << "\"";
490 
491  if ( this->variant_type_ == VTKVariant::VARIANT_ASCII ) {
492  // ascii output
493  file << ">" << endl;
494  //file << std::fixed << std::setprecision(10); // Set precision to max
495  output_data->print_ascii_all(file);
496  file << "\n</DataArray>" << endl;
497  } else {
498  // binary output is stored to appended_data_ stream
499  double range_min, range_max;
500  output_data->get_min_max_range(range_min, range_max);
501  file << " offset=\"" << appended_data_.tellp() << "\" ";
502  file << "RangeMin=\"" << range_min << "\" RangeMax=\"" << range_max << "\"/>" << endl;
503  if ( this->variant_type_ == VTKVariant::VARIANT_BINARY_UNCOMPRESSED ) {
504  output_data->print_binary_all( appended_data_ );
505  } else { // ZLib compression
506  stringstream uncompressed_data, compressed_data;
507  output_data->print_binary_all( uncompressed_data, false );
508  this->compress_data(uncompressed_data, compressed_data);
509  appended_data_ << compressed_data.str();
510  }
511  }
512  }
513 
514  /* Write Flow123dData end */
515  file << "</Flow123dData>" << endl;
516 }
517 
518 
520 {
521  ofstream &file = this->_data_file;
522 
523  file << "</UnstructuredGrid>" << endl;
524  if ( this->variant_type_ != VTKVariant::VARIANT_ASCII ) {
525  // appended data of binary compressed output
526  file << "<AppendedData encoding=\"raw\">" << endl;
527  // appended data starts with '_' character
528  file << "_" << appended_data_.str() << endl;
529  file << "</AppendedData>" << endl;
530  }
531  file << "</VTKFile>" << endl;
532 }
533 
534 
536 {
537  ofstream &file = this->_data_file;
538 
539  /* Write header */
540  this->write_vtk_vtu_head();
541 
542  /* Write Piece begin */
543  file << "<Piece NumberOfPoints=\"" << this->nodes_->n_values()
544  << "\" NumberOfCells=\"" << this->offsets_->n_values()-1 <<"\">" << endl;
545 
546  /* Write VTK Geometry */
547  file << "<Points>" << endl;
548  write_vtk_data(this->nodes_);
549  file << "</Points>" << endl;
550 
551  /* Write VTK Topology */
552  file << "<Cells>" << endl;
553  write_vtk_data(this->connectivity_);
554  write_vtk_data(this->offsets_, 1);
555  auto types = fill_element_types_data();
556  write_vtk_data( types );
557  file << "</Cells>" << endl;
558 
559  /* Write VTK scalar and vector data on nodes to the file */
560  this->write_vtk_node_data();
561 
562  /* Write VTK data on elements */
563  this->write_vtk_element_data();
564 
565  /* Write own VTK native data (skipped by Paraview) */
566  this->write_vtk_native_data();
567 
568  /* Write Piece end */
569  file << "</Piece>" << endl;
570 
571  /* Write tail */
572  this->write_vtk_vtu_tail();
573 }
574 
575 
576 
578 {
579  /* Output to PVD file is implemented only in the first process */
580  if(this->rank_ != 0) {
581  return 0;
582  }
583 
584  LogOut() << __func__ << ": Writing output file (head) " << this->_base_filename << " ... ";
585 
586  this->_base_file << "<?xml version=\"1.0\"?>" << endl;
587  this->_base_file << "<VTKFile type=\"Collection\" version=\"0.1\" byte_order=\"LittleEndian\">" << endl;
588  this->_base_file << "<Collection>" << endl;
589 
590  LogOut() << "O.K.";
591 
592  return 1;
593 }
594 
595 
597 {
598  /* Output to PVD file is implemented only in the first process */
599  if(this->rank_ != 0) {
600  return 0;
601  }
602 
603  LogOut() << __func__ << ": Writing output file (tail) " << this->_base_filename << " ... ";
604 
605  this->_base_file << "</Collection>" << endl;
606  this->_base_file << "</VTKFile>" << endl;
607 
608  LogOut() << "O.K.";
609 
610  return 1;
611 }
612 
613 
614 
615 
616 
617 
#define ASSERT(expr)
Definition: asserts.hh:351
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
Definition: asserts.hh:333
#define ASSERT_PTR(ptr)
Definition of assert macro checking non-null pointer (PTR) only for debug mode.
Definition: asserts.hh:341
Dedicated class for storing path to input and output files.
Definition: file_path.hh:54
@ output_file
Definition: file_path.hh:69
void open_stream(Stream &stream) const
Definition: file_path.cc:211
void create_output_dir()
Definition: file_path.cc:176
Accessor to the polymorphic input data of a type given by an AbstracRecord object.
Definition: accessors.hh:458
Accessor to the data with type Type::Record.
Definition: accessors.hh:291
Class for declaration of the input of type Bool.
Definition: type_base.hh:452
Class Input::Type::Default specifies default value of keys of a Input::Type::Record.
Definition: type_record.hh:61
Record type proxy class.
Definition: type_record.hh:182
unsigned int size() const
Returns number of keys in the Record.
Definition: type_record.hh:602
virtual Record & derive_from(Abstract &parent)
Method to derive new Record from an AbstractRecord parent.
Definition: type_record.cc:196
Record & close() const
Close the Record for further declarations of keys.
Definition: type_record.cc:304
Record & declare_key(const string &key, std::shared_ptr< TypeBase > type, const Default &default_value, const string &description, TypeBase::attribute_map key_attributes=TypeBase::attribute_map())
Declares a new key of the Record.
Definition: type_record.cc:503
Template for classes storing finite set of named values.
Selection & add_value(const int value, const std::string &key, const std::string &description="", TypeBase::attribute_map attributes=TypeBase::attribute_map())
Adds one new value with name given by key to the Selection.
const Selection & close() const
Close the Selection, no more values can be added.
static Input::Type::Abstract & get_input_format_type()
The specification of output file format.
Definition: output_time.cc:65
std::shared_ptr< ElementDataCacheBase > OutputDataPtr
Definition: output_time.hh:144
virtual void init_from_input(const std::string &equation_name, const Input::Record &in_rec, const std::shared_ptr< TimeUnitConversion > &time_unit_conv)
Constructor of OutputTime object. It opens base file for writing.
Definition: output_time.cc:84
int write_data(void)
This function write data to VTK (.pvd) file format for curent time.
Definition: output_vtk.cc:139
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:535
OutputVTK()
The constructor of this class. The head of file is written, when constructor is called.
Definition: output_vtk.cc:73
void write_vtk_field_data(OutputDataFieldVec &output_data_map)
Definition: output_vtk.cc:385
int write_tail(void)
This function writes tail of VTK (.pvd) file format.
Definition: output_vtk.cc:596
void write_vtk_vtu_tail(void)
Write tail of VTK file (.vtu)
Definition: output_vtk.cc:519
std::shared_ptr< ElementDataCache< unsigned int > > fill_element_types_data()
Fills the data cache with VTK element types indicators.
Definition: output_vtk.cc:244
void write_vtk_node_data(void)
Write data on nodes to the VTK file (.vtu)
Definition: output_vtk.cc:423
int write_head(void)
This function writes header of VTK (.pvd) file format.
Definition: output_vtk.cc:577
void write_vtk_data(OutputDataPtr output_data, unsigned int start=0)
Definition: output_vtk.cc:274
void make_subdirectory()
Definition: output_vtk.cc:208
string form_vtu_filename_(string basename, int i_step, int rank)
Definition: output_vtk.cc:115
void compress_data(stringstream &uncompressed_stream, stringstream &compressed_stream)
Definition: output_vtk.cc:319
uLong zlib_ulong
Definition: output_vtk.hh:48
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....
Definition: output_vtk.cc:395
VTKVariant
The declaration enumeration used for variant of file VTK format.
Definition: output_vtk.hh:100
@ VARIANT_BINARY_ZLIB
Definition: output_vtk.hh:103
@ VARIANT_BINARY_UNCOMPRESSED
Definition: output_vtk.hh:102
static const Input::Type::Selection & get_input_type_variant()
The definition of input record for selection of variant of file format.
Definition: output_vtk.cc:51
void write_vtk_vtu_head(void)
Write header of VTK file (.vtu)
Definition: output_vtk.cc:224
~OutputVTK()
The destructor of this class. It writes tail of the file too.
Definition: output_vtk.cc:80
static const int registrar
Registrar of class to factory.
Definition: output_vtk.hh:137
static const Input::Type::Record & get_input_type()
The definition of input record for vtk file format.
Definition: output_vtk.cc:38
void write_vtk_native_data(void)
Write native data (part of our own data skipped by Paraview) to the VTK file (.vtu)
Definition: output_vtk.cc:470
void write_vtk_element_data(void)
Write data on elements to the VTK file (.vtu)
Definition: output_vtk.cc:450
static const std::vector< std::string > formats
Formats of DataArray section.
Definition: output_vtk.hh:140
void init_from_input(const std::string &equation_name, const Input::Record &in_rec, const std::shared_ptr< TimeUnitConversion > &time_unit_conv) override
Override OutputTime::init_from_input.
Definition: output_vtk.cc:90
Support classes for parallel programing.
#define FLOW123D_FORCE_LINK_IN_CHILD(x)
Definition: global_defs.h:104
#define INPUT_CATCH(ExceptionType, AddressEITag, input_accessor)
Definition: accessors.hh:63
#define LogOut()
Macro defining 'log' record of log.
Definition: logger.hh:281
Classes for auxiliary output mesh.
string pvd_dataset_line(double step, int rank, string file)
Definition: output_vtk.cc:129
Basic time management class.