Note: this is documentation for an old release. View the latest documentation at docs.fenicsproject.org/dolfinx/v0.9.0/cpp/doxygen/dc/dca/VTKFile_8h_source.html
DOLFINx 0.7.3
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
This class represents a function in a finite element function space , given by.
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:750
void close()
Close file.
Definition VTKFile.cpp:718
~VTKFile()
Destructor.
Definition VTKFile.cpp:708
void flush()
Flushes XML files to disk.
Definition VTKFile.cpp:735
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:25
Support for file IO.
Definition ADIOS2Writers.h:41
Mesh data structures and algorithms on meshes.
Definition DofMap.h:32