Flow123d  JS_before_hm-1804-gf2ad740aa
msh_pvdreader.hh
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 msh_pvdreader.hh
15  * @brief
16  * @author dalibor
17  */
18 
19 #ifndef MSH_PVD_READER_HH
20 #define MSH_PVD_READER_HH
21 
22 #include <string>
23 #include <istream>
24 
25 #include "io/msh_basereader.hh"
26 #include "system/file_path.hh"
27 
28 
29 class VtkMeshReader;
30 
31 
32 class PvdMeshReader : public BaseMeshReader {
33 public:
34  /**
35  * Construct the PVD reader from given FilePath.
36  * This opens the file for reading.
37  */
38  PvdMeshReader(const FilePath &file_name);
39 
40  /// Destructor
42 
43  /**
44  * Read regions from the VTK file and save the physical sections as regions in the RegionDB.
45  *
46  * Region Labels starting with '!' are treated as boundary regions. Elements of these regions are used just to
47  * assign regions to the boundary and are not used in actual FEM computations.
48  */
49  void read_physical_names(Mesh * mesh) override;
50 
51  /**
52  * Find header of DataArray section of VTK file given by field_name.
53  */
54  MeshDataHeader & find_header(HeaderQuery &header_query) override;
55 
56 protected:
57  /// Represents data of one VTK file defined in PVD file.
58  struct VtkFileData {
59  /// Constructor
60  VtkFileData(double t, FilePath file) : time(t), file_name(file), reader(nullptr) {}
61 
62  double time; ///< time step of VTK file
63  FilePath file_name; ///< path to VTK file
64  VtkMeshReader * reader; ///< reader is created only if it's needed
65  };
66 
67  /**
68  * private method for reading of nodes
69  */
70  void read_nodes(Mesh * mesh) override;
71 
72  /**
73  * Method for reading of elements.
74  * Input of the mesh allows changing regions within the input file.
75  */
76  void read_elements(Mesh * mesh) override;
77 
78  /**
79  * This method is specified for PVD reader. Table of mesh data headers (same as for GMSH or VTK) is not created,
80  * but list of times and appropriate VTK files is filled.
81  */
82  void make_header_table() override;
83 
84  /**
85  * Implements @p BaseMeshReader::read_element_data.
86  */
87  void read_element_data(ElementDataCacheBase &data_cache, MeshDataHeader actual_header, unsigned int n_components,
88  bool boundary_domain) override;
89 
90  /// Store list of VTK files and time steps declared in PVD file.
92 
93  /// Path to PVD file allows construct FilePath objects of VTK files.
94  std::string pvd_path_dir_;
95 
96  /// Iterator to items of \p file_list_
98 
99 };
100 
101 #endif /* MSH_PVD_READER_HH */
102 
PvdMeshReader::VtkFileData::file_name
FilePath file_name
path to VTK file
Definition: msh_pvdreader.hh:63
PvdMeshReader::find_header
MeshDataHeader & find_header(HeaderQuery &header_query) override
Definition: msh_pvdreader.cc:97
PvdMeshReader
Definition: msh_pvdreader.hh:32
msh_basereader.hh
PvdMeshReader::read_physical_names
void read_physical_names(Mesh *mesh) override
Definition: msh_pvdreader.cc:47
file_path.hh
FilePath
Dedicated class for storing path to input and output files.
Definition: file_path.hh:54
PvdMeshReader::make_header_table
void make_header_table() override
Definition: msh_pvdreader.cc:72
VtkMeshReader
Definition: msh_vtkreader.hh:40
std::vector
Definition: doxy_dummy_defs.hh:7
PvdMeshReader::VtkFileData
Represents data of one VTK file defined in PVD file.
Definition: msh_pvdreader.hh:58
PvdMeshReader::pvd_path_dir_
std::string pvd_path_dir_
Path to PVD file allows construct FilePath objects of VTK files.
Definition: msh_pvdreader.hh:94
PvdMeshReader::file_list_
std::vector< VtkFileData > file_list_
Store list of VTK files and time steps declared in PVD file.
Definition: msh_pvdreader.hh:91
PvdMeshReader::read_nodes
void read_nodes(Mesh *mesh) override
Definition: msh_pvdreader.cc:53
PvdMeshReader::read_elements
void read_elements(Mesh *mesh) override
Definition: msh_pvdreader.cc:59
PvdMeshReader::PvdMeshReader
PvdMeshReader(const FilePath &file_name)
Definition: msh_pvdreader.cc:29
BaseMeshReader
Definition: msh_basereader.hh:58
PvdMeshReader::~PvdMeshReader
~PvdMeshReader()
Destructor.
Definition: msh_pvdreader.cc:39
PvdMeshReader::VtkFileData::time
double time
time step of VTK file
Definition: msh_pvdreader.hh:62
ElementDataCacheBase
Definition: element_data_cache_base.hh:33
PvdMeshReader::list_it_
std::vector< VtkFileData >::iterator list_it_
Iterator to items of file_list_.
Definition: msh_pvdreader.hh:97
BaseMeshReader::MeshDataHeader
Definition: msh_basereader.hh:100
Mesh
Definition: mesh.h:98
PvdMeshReader::read_element_data
void read_element_data(ElementDataCacheBase &data_cache, MeshDataHeader actual_header, unsigned int n_components, bool boundary_domain) override
Definition: msh_pvdreader.cc:64
PvdMeshReader::VtkFileData::reader
VtkMeshReader * reader
reader is created only if it's needed
Definition: msh_pvdreader.hh:64
PvdMeshReader::VtkFileData::VtkFileData
VtkFileData(double t, FilePath file)
Constructor.
Definition: msh_pvdreader.hh:60
BaseMeshReader::HeaderQuery
Definition: msh_basereader.hh:132