DOLFINx 0.12.0.0
DOLFINx C++
Loading...
Searching...
No Matches
VTKFile.h
1// Copyright (C) 2020 Garth N. Wells
2//
3// This file is part of DOLFINx (https://www.fenicsproject.org)
4//
5// SPDX-License-Identifier: LGPL-3.0-or-later
6
7#pragma once
8
9#include <concepts>
10#include <dolfinx/common/MPI.h>
11#include <dolfinx/common/types.h>
12#include <filesystem>
13#include <functional>
14#include <memory>
15#include <string>
16#include <string_view>
17
18namespace pugi
19{
20class xml_document;
21}
22
23namespace dolfinx::fem
24{
25template <dolfinx::scalar T, std::floating_point U>
26class Function;
27}
28
29namespace dolfinx::mesh
30{
31template <std::floating_point T>
32class Mesh;
33}
34
35namespace dolfinx::io
36{
37
48{
49public:
51 VTKFile(MPI_Comm comm, const std::filesystem::path& filename,
52 std::string_view file_mode);
53
55 ~VTKFile();
56
58 void close();
59
61 void flush();
62
69 template <std::floating_point U>
70 void write(const mesh::Mesh<U>& mesh, double t = 0.0);
71
88 template <dolfinx::scalar T, std::floating_point U = scalar_value_t<T>>
89 void
90 write(const std::vector<std::reference_wrapper<const fem::Function<T, U>>>& u,
91 double t);
92
93private:
94 std::unique_ptr<pugi::xml_document> _pvd_xml;
95
96 std::filesystem::path _filename;
97
98 // MPI communicator
100};
101} // namespace dolfinx::io
A duplicate MPI communicator and manage lifetime of the communicator.
Definition MPI.h:43
Definition Function.h:47
void write(const mesh::Mesh< U > &mesh, double t=0.0)
Write a mesh to file.
Definition VTKFile.cpp:767
void close()
Close file.
Definition VTKFile.cpp:735
~VTKFile()
Destructor.
Definition VTKFile.cpp:725
void flush()
Flushes XML files to disk.
Definition VTKFile.cpp:752
VTKFile(MPI_Comm comm, const std::filesystem::path &filename, std::string_view file_mode)
Create VTK file.
Definition VTKFile.cpp:713
A Mesh consists of a set of connected and numbered mesh topological entities, and geometry data.
Definition Mesh.h:23
Finite element method functionality.
Definition assemble_expression_impl.h:23
Support for file IO.
Definition ADIOS2Writers.h:43
Mesh data structures and algorithms on meshes.
Definition DofMap.h:32