DOLFIN-X
DOLFIN-X C++ interface
VTKFile.h
1 // Copyright (C) 2005-2019 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 <fstream>
10 #include <petscsys.h>
11 #include <string>
12 #include <utility>
13 #include <vector>
14 
15 namespace pugi
16 {
17 class xml_node;
18 }
19 
20 namespace dolfinx
21 {
22 namespace function
23 {
24 template <typename T>
25 class Function;
26 }
27 
28 namespace mesh
29 {
30 class Mesh;
31 } // namespace mesh
32 
33 namespace io
34 {
35 
37 
40 
41 class VTKFile
42 {
43 public:
45  VTKFile(const std::string filename);
46 
48  ~VTKFile() = default;
49 
51  void write(const mesh::Mesh& mesh);
52 
55 
57  void write(const mesh::Mesh& mesh, double t);
58 
60  void write(const function::Function<PetscScalar>& u, double t);
61 
62 private:
63  const std::string _filename;
64 
65  // Counter for the number of times various data has been written
66  std::size_t _counter;
67 };
68 } // namespace io
69 } // namespace dolfinx
This class represents a function in a finite element function space , given by.
Definition: Function.h:42
Output of meshes and functions in VTK format.
Definition: VTKFile.h:42
VTKFile(const std::string filename)
Create VTK file.
Definition: VTKFile.cpp:604
void write(const mesh::Mesh &mesh)
Output mesh.
Definition: VTKFile.cpp:609
~VTKFile()=default
Destructor.
A Mesh consists of a set of connected and numbered mesh topological entities, and geometry data.
Definition: Mesh.h:47