22 #include <pugixml.hpp> 42 if (file_data.reader !=
nullptr)
delete file_data.reader;
64 bool boundary_domain) {
66 ASSERT(!boundary_domain).error(
"Reading PVD data of boundary elements is not supported yet!\n");
67 list_it_->reader->read_element_data(data_cache, actual_header, n_components, boundary_domain);
73 ASSERT(
file_list_[0].reader ==
nullptr).error(
"Method check_compatible_mesh must be called as first, before reading element data.\n");
76 file_list_[0].reader->check_compatible_mesh(mesh);
85 pugi::xml_document doc;;
86 doc.load_file(
tok_.f_name().c_str() );
87 pugi::xml_node node = doc.child(
"VTKFile").child(
"Collection");
89 double last_time = -numeric_limits<double>::infinity();
95 for (pugi::xml_node subnode = node.child(
"DataSet"); subnode; subnode = subnode.next_sibling(
"DataSet")) {
96 double time = subnode.attribute(
"timestep").as_double();
97 if (time <= last_time) {
98 WarningOut().fmt(
"Wrong time order in PVD file '{}', time '{}'. Skipping this time step.\n",
tok_.f_name(), time );
100 sub_paths[1] = subnode.attribute(
"file").as_string();
111 return t * (1.0 + 2.0*numeric_limits<double>::epsilon()) < a.
time;
122 if (!list_it_->reader) {
123 list_it_->reader =
new VtkMeshReader(list_it_->file_name, this->element_data_values_, list_it_->time);
126 list_it_->reader->has_compatible_mesh_ =
true;
void read_elements(Mesh *mesh) override
std::string pvd_path_dir_
Path to PVD file allows construct FilePath objects of VTK files.
void check_compatible_mesh(Mesh &mesh) override
PvdMeshReader(const FilePath &file_name)
std::shared_ptr< ElementDataFieldMap > element_data_values_
Cache with last read element data.
Represents data of one VTK file defined in PVD file.
std::string data_section_name_
Store name of field data section specify for type of mesh file.
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
void make_header_table() override
std::vector< VtkFileData > file_list_
Store list of VTK files and time steps declared in PVD file.
string parent_path() const
void read_physical_names(Mesh *mesh) override
Dedicated class for storing path to input and output files.
~PvdMeshReader()
Destructor.
std::vector< VtkFileData >::iterator list_it_
Iterator to items of file_list_.
void read_element_data(ElementDataCacheBase &data_cache, MeshDataHeader actual_header, unsigned int n_components, bool boundary_domain) override
MeshDataHeader actual_header_
Header of actual loaded data.
#define WarningOut()
Macro defining 'warning' record of log.
bool has_compatible_mesh_
Tokenizer tok_
Tokenizer used for reading ASCII file format.
MeshDataHeader & find_header(HeaderQuery &header_query) override
void read_nodes(Mesh *mesh) override
vector< LongIdx > boundary_elements_id_
vector< LongIdx > bulk_elements_id_