31 using namespace
Input::Type;
34 return Record(
"vtk",
"Parameters of vtk output format.")
38 "Variant of output stream file format.")
41 "Parallel or serial version of file format.")
44 "Compression used in output stream file format.")
50 return Selection(
"VTK variant (ascii or binary)")
52 "ASCII variant of VTK file format")
54 "Binary variant of VTK file format (not supported yet)")
60 return Selection(
"Type of compression of VTK file format")
62 "Data in VTK file format are not compressed")
64 "Data in VTK file format are compressed using zlib (not supported yet)")
111 << std::setw(6) << std::setfill(
'0') << this->
current_step 115 std::string frame_file_name = ss.str();
124 this->
_base_file.precision(std::numeric_limits<double>::digits10);
128 this->
_base_file << scientific <<
"<DataSet timestep=\"" << (isfinite(this->
time)?this->
time:0)
129 <<
"\" group=\"\" part=\"0\" file=\"" << relative_frame_file <<
"\"/>" << endl;
133 LogOut() << __func__ <<
": Writing output (frame " << this->current_step <<
") file " << relative_frame_file <<
" ... ";
168 file <<
"<?xml version=\"1.0\"?>" << endl;
171 file <<
"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\">" << endl;
172 file <<
"<UnstructuredGrid>" << endl;
180 unsigned int n_elements = offsets.size();
182 data.resize(n_elements);
185 n_nodes = offsets[0];
198 for(
unsigned int i=1; i < n_elements; i++)
200 n_nodes = offsets[i]-offsets[i-1];
223 if( ! output_data->output_field_name.empty())
224 file <<
"Name=\"" << output_data->output_field_name <<
"\" ";
226 if (output_data->n_elem_ > 1)
229 <<
"NumberOfComponents=\"" << output_data->n_elem_ <<
"\" ";
231 file <<
"format=\"ascii\">" 235 file.precision(std::numeric_limits<double>::digits10);
237 output_data->print_all(file);
239 file <<
"\n</DataArray>" << endl;
256 if (output_data_vec.empty())
return;
258 file <<
"Scalars=\"";
263 file <<
"Vectors=\"";
268 file <<
"Tensors=\"";
281 node_corner_data.insert(node_corner_data.end(),
284 if( ! node_corner_data.empty() ) {
286 file <<
"<PointData ";
297 file <<
"</PointData>" << endl;
307 if (data_map.empty())
return;
310 file <<
"<CellData ";
318 file <<
"</CellData>" << endl;
326 file <<
"</UnstructuredGrid>" << endl;
327 file <<
"</VTKFile>" << endl;
342 file <<
"<Piece NumberOfPoints=\"" <<
output_mesh_->n_nodes()
343 <<
"\" NumberOfCells=\"" <<
output_mesh_->n_elements() <<
"\">" << endl;
346 file <<
"<Points>" << endl;
348 file <<
"</Points>" << endl;
352 file <<
"<Cells>" << endl;
355 auto types = std::make_shared<MeshData<unsigned int>>(
"types");
358 file <<
"</Cells>" << endl;
367 file <<
"</Piece>" << endl;
372 <<
"\" NumberOfCells=\"" <<
output_mesh_->n_elements() <<
"\">" << endl;
375 file <<
"<Points>" << endl;
377 file <<
"</Points>" << endl;
380 file <<
"<Cells>" << endl;
383 auto types = std::make_shared<MeshData<unsigned int>>(
"types");
386 file <<
"</Cells>" << endl;
395 file <<
"</Piece>" << endl;
407 if(this->
rank != 0) {
414 this->
_base_file <<
"<?xml version=\"1.0\"?>" << endl;
415 this->
_base_file <<
"<VTKFile type=\"Collection\" version=\"0.1\" byte_order=\"LittleEndian\">" << endl;
427 if(this->
rank != 0) {
Classes for auxiliary output mesh.
std::shared_ptr< OutputMesh > output_mesh_
Output mesh.
std::shared_ptr< OutputMeshDiscontinuous > output_mesh_discont_
Discontinuous (non-conforming) mesh. Used for CORNER_DATA.
void fix_main_file_extension(std::string extension)
static const Input::Type::Record & get_input_type()
The definition of input record for vtk file format.
void write_vtk_vtu(void)
This function write all scalar and vector data on nodes and elements to the VTK file (...
static const int registrar
Registrar of class to factory.
static Input::Type::Abstract & get_input_format_type()
The specification of output file format.
void fill_element_types_vector(std::vector< unsigned int > &data)
Fills the given vector with VTK element types indicators.
string main_output_basename_
int write_head(void)
This function writes header of VTK (.pvd) file format.
void write_vtk_element_data(void)
Write data on elements to the VTK file (.vtu)
#define LogOut()
Macro defining 'log' record of log.
void open_stream(Stream &stream) const
int write_data(void)
This function write data to VTK (.pvd) file format for curent time.
static const Input::Type::Selection & get_input_type_compression()
The definition of input record for selection of compression type.
void write_vtk_vtu_tail(void)
Write tail of VTK file (.vtu)
This class is used for output data to VTK file format.
string parent_path() const
static const std::string vtk_value_type_map(VTKValueType t)
int write_tail(void)
This function writes tail of VTK (.pvd) file format.
~OutputVTK()
The destructor of this class. It writes tail of the file too.
Dedicated class for storing path to input and output files.
void write_vtk_data_ascii(OutputDataFieldVec &output_data_map)
OutputVTK()
The constructor of this class. The head of file is written, when constructor is called.
#define ASSERT_PTR(ptr)
Definition of assert macro checking non-null pointer (PTR)
void write_vtk_node_data(void)
Write data on nodes to the VTK file (.vtu)
OutputDataFieldVec output_data_vec_[N_DISCRETE_SPACES]
std::shared_ptr< OutputDataBase > OutputDataPtr
bool enable_refinement_
Auxliary flag for refinement enabling, due to gmsh format.
void write_vtk_vtu_head(void)
Write header of VTK file (.vtu)
#define FLOW123D_FORCE_LINK_IN_CHILD(x)
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual)
static const Input::Type::Selection & get_input_type_variant()
The definition of input record for selection of variant of file format.
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.