DOLFINx 0.8.0
DOLFINx C++ interface
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
17namespace pugi
18{
19class xml_document;
20}
21
22namespace dolfinx::fem
23{
24template <dolfinx::scalar T, std::floating_point U>
25class Function;
26}
27
28namespace dolfinx::mesh
29{
30template <std::floating_point T>
31class Mesh;
32}
33
34namespace dolfinx::io
35{
36
47{
48public:
50 VTKFile(MPI_Comm comm, const std::filesystem::path& filename,
51 const std::string& file_mode);
52
54 ~VTKFile();
55
57 void close();
58
60 void flush();
61
66 template <std::floating_point U>
67 void write(const mesh::Mesh<U>& mesh, double time = 0.0);
68
83 template <dolfinx::scalar T, std::floating_point U = scalar_value_type_t<T>>
84 void
85 write(const std::vector<std::reference_wrapper<const fem::Function<T, U>>>& u,
86 double t);
87
88private:
89 std::unique_ptr<pugi::xml_document> _pvd_xml;
90
91 std::filesystem::path _filename;
92
93 // MPI communicator
95};
96} // namespace dolfinx::io
A duplicate MPI communicator and manage lifetime of the communicator.
Definition MPI.h:43
Definition Function.h:45
Output of meshes and functions in VTK/ParaView format.
Definition VTKFile.h:47
void write(const mesh::Mesh< U > &mesh, double time=0.0)
Write a mesh to file. Supports arbitrary order Lagrange isoparametric cells.
Definition VTKFile.cpp:747
void close()
Close file.
Definition VTKFile.cpp:715
VTKFile(MPI_Comm comm, const std::filesystem::path &filename, const std::string &file_mode)
Create VTK file.
Definition VTKFile.cpp:693
~VTKFile()
Destructor.
Definition VTKFile.cpp:705
void flush()
Flushes XML files to disk.
Definition VTKFile.cpp:732
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_matrix_impl.h:26
Support for file IO.
Definition ADIOS2Writers.h:41
Mesh data structures and algorithms on meshes.
Definition DofMap.h:32