BALL
1.4.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
include
BALL
FORMAT
TRRFile.h
Go to the documentation of this file.
1
// -*- Mode: C++; tab-width: 2; -*-
2
// vi: set ts=2:
3
//
4
5
#ifndef BALL_FORMAT_TRRFILE_H
6
#define BALL_FORMAT_TRRFILE_H
7
8
#ifndef BALL_FORMAT_TRAJECTORYFILE_H
9
# include <
BALL/FORMAT/trajectoryFile.h
>
10
#endif
11
12
#ifndef BALL_SYSTEM_BINARYFILEADAPTOR_H
13
# include <
BALL/SYSTEM/binaryFileAdaptor.h
>
14
#endif
15
16
namespace
BALL
17
{
28
class
BALL_EXPORT
TRRFile
29
:
public
TrajectoryFile
30
{
31
32
public
:
33
37
44
class
BALL_EXPORT
TRRHeader
45
{
46
public
:
47
49
Size
MAGIC
;
51
Size
VERSION
;
53
Size
title_string_length
;
55
String
title_string
;
59
Size
ir_size
;
63
Size
e_size
;
64
71
Size
bounding_box_data_size
;
72
77
Size
vir_size
;
78
83
Size
pres_size
;
84
88
Size
top_size
;
89
93
Size
sym_size
;
94
98
Size
position_data_size
;
99
104
Size
velocity_data_size
;
105
110
Size
force_data_size
;
111
114
Size
number_of_atoms
;
115
118
Size
timestep_index
;
119
123
Size
nre
;
124
127
float
timestep_time
;
128
132
float
lambda
;
133
134
TRRHeader
()
135
: MAGIC(1993),
136
VERSION(13),
137
title_string_length(24),
138
title_string(
"Created by BALL::TRRFile"
),
139
ir_size(0),
140
e_size(0),
141
vir_size(0),
142
pres_size(0),
143
top_size(0),
144
sym_size(0),
145
velocity_data_size(0),
146
force_data_size(0),
147
timestep_index(0),
148
nre(0),
149
timestep_time(0.002),
150
lambda(0)
151
{
152
}
153
};
154
156
160
162
TRRFile
();
163
165
TRRFile
(
const
String
& name,
File::OpenMode
open_mode = std::ios::in);
166
168
virtual
~
TRRFile
();
170
174
176
virtual
void
clear();
178
182
184
bool
operator == (
const
TRRFile
& file)
const
;
186
188
189
191
virtual
bool
init();
192
198
virtual
bool
writeNextHeader(
const
TRRHeader& header);
199
204
virtual
bool
readNextHeader(TRRHeader& header);
205
210
virtual
bool
append(
const
SnapShot
& snapshot);
211
216
virtual
bool
read(
SnapShot
& snapshot);
217
219
virtual
TRRFile
&
operator >>
(
SnapShotManager
& ssm);
220
224
virtual
bool
flushToDisk(
const
std::vector<SnapShot>& buffer);
226
227
230
232
bool
hasVelocities()
const
;
233
235
void
setVelocityStorage(
bool
storage);
236
238
bool
hasForces()
const
;
239
241
void
setForceStorage(
bool
storage);
242
244
Size
getPrecision()
const
;
245
247
bool
setPrecision(
const
Size
precision);
248
250
float
getTimestep()
const
;
251
253
void
setTimestep(
float
timestep);
254
256
Vector3
getBoundingBoxX()
const
;
257
259
Vector3
getBoundingBoxY()
const
;
260
262
Vector3
getBoundingBoxZ()
const
;
263
265
void
setBoundingBox(
const
Vector3
& x,
const
Vector3
& y,
const
Vector3
& z);
266
268
269
private
:
270
const
TRRFile
& operator = (
const
TRRFile
& file);
271
272
protected
:
273
274
// the current step's header
275
TRRHeader
header_
;
276
277
// the precision of the file in bytes per value
278
Size
precision_
;
279
280
// a flag deciding if the file contains velocities
281
bool
has_velocities_
;
282
283
// a flag deciding if the file contains forces
284
bool
has_forces_
;
285
286
// the index of the current timestep / snapshot
287
Size
timestep_index_
;
288
289
// the length of the timestep
290
float
timestep_
;
291
292
// three vectors containing the base vectors of the box in
293
// nanometers
294
Vector3
box1_, box2_,
box3_
;
295
296
BinaryFileAdaptor<Size>
adapt_size_
;
297
BinaryFileAdaptor<char>
adapt_char_
;
298
BinaryFileAdaptor<float>
adapt_float_
;
299
BinaryFileAdaptor<double>
adapt_double_
;
300
};
301
}
// namespace BALL
302
303
#endif // BALL_FORMAT_TRRFILE_H
Generated by
1.8.1.2