DOLFIN
DOLFIN C++ interface
Toggle main menu visibility
Loading...
Searching...
No Matches
dolfin
io
VTKFile.h
1
// Copyright (C) 2005-2017 Garth N. Wells
2
//
3
// This file is part of DOLFIN.
4
//
5
// DOLFIN is free software: you can redistribute it and/or modify
6
// it under the terms of the GNU Lesser General Public License as published by
7
// the Free Software Foundation, either version 3 of the License, or
8
// (at your option) any later version.
9
//
10
// DOLFIN is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// GNU Lesser General Public License for more details.
14
//
15
// You should have received a copy of the GNU Lesser General Public License
16
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
17
18
#ifndef __VTK_FILE_H
19
#define __VTK_FILE_H
20
21
#include <fstream>
22
#include <string>
23
#include <utility>
24
#include <vector>
25
#include "GenericFile.h"
26
27
namespace
pugi
28
{
29
class
xml_node;
30
}
31
32
namespace
dolfin
33
{
34
35
class
Function
;
36
class
GenericFunction
;
37
class
Mesh
;
38
template
<
typename
T>
class
MeshFunction
;
39
41
44
45
class
VTKFile
:
public
GenericFile
46
{
47
public
:
48
50
VTKFile
(
const
std::string filename, std::string encoding);
51
52
// Destructor
53
~VTKFile
();
54
56
void
write
(
const
Mesh
& mesh);
57
59
void
write
(
const
MeshFunction<bool>
& meshfunction);
60
62
void
write
(
const
MeshFunction<std::size_t>
& meshfunction);
63
65
void
write
(
const
MeshFunction<int>
& meshfunction);
66
68
void
write
(
const
MeshFunction<double>
& meshfunction);
69
71
void
write
(
const
Function
& u);
72
74
void
write
(
const
Mesh
& mesh,
double
t);
75
77
void
write
(
const
MeshFunction<int>
& mesh,
double
t);
78
80
void
write
(
const
MeshFunction<std::size_t>
& mf,
double
t);
81
83
void
write
(
const
MeshFunction<double>
& mf,
double
t);
84
86
void
write
(
const
MeshFunction<bool>
& mf,
double
t);
87
89
void
write
(
const
Function
& u,
double
t);
90
91
private
:
92
93
void
write_function(
const
Function
& u,
double
time
);
94
95
void
write_mesh(
const
Mesh
& mesh,
double
time
);
96
97
std::string init(
const
Mesh
& mesh, std::size_t dim)
const
;
98
99
void
finalize(std::string vtu_filename,
double
time
);
100
101
void
results_write(
const
Function
& u, std::string file)
const
;
102
103
void
write_point_data(
const
GenericFunction
& u,
const
Mesh
& mesh,
104
std::string file)
const
;
105
106
void
pvd_file_write(std::size_t step,
double
time
, std::string file);
107
108
109
void
pvtu_write_function(std::size_t dim, std::size_t rank,
110
const
std::string data_location,
111
const
std::string name,
112
const
std::string filename,
113
std::size_t num_processes)
const
;
114
115
void
pvtu_write_mesh(
const
std::string pvtu_filename,
116
const
std::size_t num_processes)
const
;
117
118
void
pvtu_write(
const
Function
& u,
const
std::string pvtu_filename)
const
;
119
120
void
vtk_header_open(std::size_t num_vertices, std::size_t num_cells,
121
std::string file)
const
;
122
123
void
vtk_header_close(std::string file)
const
;
124
125
std::string vtu_name(
const
int
process,
const
int
num_processes,
126
const
int
counter, std::string ext)
const
;
127
128
void
clear_file(std::string file)
const
;
129
130
template
<
typename
T>
131
void
mesh_function_write(T& meshfunction,
double
time
);
132
133
// Strip path from file
134
std::string strip_path(std::string file)
const
;
135
136
private
:
137
138
void
pvtu_write_mesh(pugi::xml_node xml_node)
const
;
139
140
// File encoding
141
const
std::string _encoding;
142
std::string encode_string;
143
144
bool
binary;
145
bool
compress;
146
147
};
148
149
}
150
151
#endif
dolfin::Function
Definition
Function.h:66
dolfin::GenericFile::GenericFile
GenericFile(std::string filename, std::string filetype)
Constructor.
Definition
GenericFile.cpp:33
dolfin::GenericFunction
Definition
GenericFunction.h:54
dolfin::MeshFunction
Definition
MeshFunction.h:59
dolfin::Mesh
Definition
Mesh.h:83
dolfin::VTKFile::VTKFile
VTKFile(const std::string filename, std::string encoding)
Create VTK file.
Definition
VTKFile.cpp:44
dolfin::VTKFile::write
void write(const Mesh &mesh)
Output mesh.
Definition
VTKFile.cpp:84
dolfin
Definition
adapt.h:30
dolfin::time
double time()
Return wall time elapsed since some implementation dependent epoch.
Definition
timing.cpp:48
Generated by
1.17.0