DOLFIN
DOLFIN C++ interface
Toggle main menu visibility
Loading...
Searching...
No Matches
dolfin
io
GenericFile.h
1
// Copyright (C) 2003-2011 Johan Hoffman and Anders Logg
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
// Modified by Ola Skavhaug 2009.
19
20
#ifndef __GENERIC_FILE_H
21
#define __GENERIC_FILE_H
22
23
#include <map>
24
#include <string>
25
#include <utility>
26
#include <vector>
27
28
namespace
dolfin
29
{
30
31
class
GenericDofMap
;
32
class
Function
;
33
class
GenericMatrix
;
34
class
GenericVector
;
35
class
LocalMeshData
;
36
class
Mesh
;
37
template
<
typename
T>
class
MeshFunction
;
38
template
<
typename
T>
class
MeshValueCollection
;
39
class
Parameters
;
40
class
Table
;
41
43
44
class
GenericFile
45
{
46
public
:
47
49
GenericFile
(std::string filename,
50
std::string filetype);
51
53
virtual
~GenericFile
();
54
55
// Input
56
virtual
void
read(
Mesh
& mesh);
57
virtual
void
read(
GenericVector
& x);
58
virtual
void
read(
GenericMatrix
& A);
59
virtual
void
read(
GenericDofMap
& dofmap);
60
virtual
void
read(
LocalMeshData
& data);
61
virtual
void
read(
MeshFunction<int>
& mesh_function);
62
virtual
void
read(
MeshFunction<std::size_t>
& mesh_function);
63
virtual
void
read(
MeshFunction<double>
& mesh_function);
64
virtual
void
read(
MeshFunction<bool>
& mesh_function);
65
virtual
void
read(
MeshValueCollection<int>
& mesh_markers);
66
virtual
void
read(
MeshValueCollection<std::size_t>
& mesh_markers);
67
virtual
void
read(
MeshValueCollection<double>
& mesh_markers);
68
virtual
void
read(
MeshValueCollection<bool>
& mesh_markers);
69
virtual
void
read(
Parameters
&
parameters
);
70
virtual
void
read(
Table
& table);
71
virtual
void
read(std::vector<int>& x);
72
virtual
void
read(std::vector<std::size_t>& x);
73
virtual
void
read(std::vector<double>& x);
74
virtual
void
read(std::map<std::size_t, int>& map);
75
virtual
void
read(std::map<std::size_t, std::size_t>& map);
76
virtual
void
read(std::map<std::size_t, double>& map);
77
virtual
void
read(std::map<std::size_t, std::vector<int>>& array_map);
78
virtual
void
read(std::map<std::size_t, std::vector<std::size_t>>& array_map);
79
virtual
void
read(std::map<std::size_t, std::vector<double>>& array_map);
80
virtual
void
read(
Function
& u);
81
82
// Output
83
virtual
void
write(
const
GenericVector
& x);
84
virtual
void
write(
const
GenericMatrix
& A);
85
virtual
void
write(
const
Mesh
& mesh);
86
virtual
void
write(
const
GenericDofMap
& dofmap);
87
virtual
void
write(
const
LocalMeshData
& data);
88
virtual
void
write(
const
MeshFunction<int>
& mesh_function);
89
virtual
void
write(
const
MeshFunction<std::size_t>
& mesh_function);
90
virtual
void
write(
const
MeshFunction<double>
& mesh_function);
91
virtual
void
write(
const
MeshFunction<bool>
& mesh_function);
92
virtual
void
write(
const
MeshValueCollection<int>
& mesh_markers);
93
virtual
void
write(
const
MeshValueCollection<std::size_t>
& mesh_markers);
94
virtual
void
write(
const
MeshValueCollection<double>
& mesh_markers);
95
virtual
void
write(
const
MeshValueCollection<bool>
& mesh_markers);
96
virtual
void
write(
const
Function
& u);
97
98
// Output with time
99
virtual
void
write(
const
Mesh
& mesh,
double
time
);
100
virtual
void
write(
const
MeshFunction<int>
& mf,
double
time
);
101
virtual
void
write(
const
MeshFunction<std::size_t>
& mf,
double
time
);
102
virtual
void
write(
const
MeshFunction<double>
& mf,
double
time
);
103
virtual
void
write(
const
MeshFunction<bool>
& mf,
double
time
);
104
virtual
void
write(
const
Function
& u,
double
time
);
105
106
virtual
void
write(
const
Parameters
&
parameters
);
107
virtual
void
write(
const
Table
& table);
108
virtual
void
write(
const
std::vector<int>& x);
109
virtual
void
write(
const
std::vector<std::size_t>& x);
110
virtual
void
write(
const
std::vector<double>& x);
111
virtual
void
write(
const
std::map<std::size_t, int>& map);
112
virtual
void
write(
const
std::map<std::size_t, std::size_t>& map);
113
virtual
void
write(
const
std::map<std::size_t, double>& map);
114
virtual
void
write(
const
std::map<std::size_t, std::vector<int>>& array_map);
115
virtual
void
write(
const
std::map<std::size_t,
116
std::vector<std::size_t>>& array_map);
117
virtual
void
write(
const
std::map<std::size_t,
118
std::vector<double>>& array_map);
119
120
void
_read();
121
void
_write(std::size_t process_number);
122
123
// Return filename
124
std::string name()
const
125
{
return
_filename; }
126
127
protected
:
128
129
void
read_not_impl(
const
std::string
object
)
const
;
130
void
write_not_impl(
const
std::string
object
)
const
;
131
132
std::string _filename;
133
std::string _filetype;
134
135
bool
opened_read;
136
bool
opened_write;
137
138
// True if we have written a header
139
bool
check_header;
140
141
// Counters for the number of times various data has been written
142
std::size_t counter;
143
std::size_t counter1;
144
std::size_t counter2;
145
146
};
147
148
}
149
150
#endif
dolfin::Function
Definition
Function.h:66
dolfin::GenericDofMap
This class provides a generic interface for dof maps.
Definition
GenericDofMap.h:50
dolfin::GenericFile::~GenericFile
virtual ~GenericFile()
Destructor.
Definition
GenericFile.cpp:41
dolfin::GenericFile::GenericFile
GenericFile(std::string filename, std::string filetype)
Constructor.
Definition
GenericFile.cpp:33
dolfin::GenericMatrix
This class defines a common interface for matrices.
Definition
GenericMatrix.h:47
dolfin::GenericVector
This class defines a common interface for vectors.
Definition
GenericVector.h:48
dolfin::LocalMeshData
This class stores mesh data on a local processor corresponding to a portion of a (larger) global mesh...
Definition
LocalMeshData.h:59
dolfin::MeshFunction
Definition
MeshFunction.h:59
dolfin::MeshValueCollection
Definition
MeshValueCollection.h:51
dolfin::Mesh
Definition
Mesh.h:83
dolfin::Parameters
Definition
Parameters.h:95
dolfin::Table
Definition
Table.h:50
dolfin
Definition
adapt.h:30
dolfin::time
double time()
Return wall time elapsed since some implementation dependent epoch.
Definition
timing.cpp:48
dolfin::parameters
GlobalParameters parameters
The global parameter database.
Definition
GlobalParameters.cpp:32
Generated by
1.17.0