BALL 1.5.0
DCDFile.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_DCDFILE_H
6#define BALL_FORMAT_DCDFILE_H
7
8#ifndef BALL_FORMAT_TRAJECTORYFILE_H
10#endif
11
12#ifndef BALL_SYSTEM_BINARYFILEADAPTOR_H
14#endif
15
16namespace BALL
17{
38 : public TrajectoryFile
39 {
40 public:
41
45
48
52 DCDFile(const String& name, File::OpenMode open_mode = std::ios::in);
53
55 virtual ~DCDFile();
56
58
61
63 virtual void clear();
64
66
69
71 bool operator == (const DCDFile& file) const;
72
74 bool isSwappingBytes() const;
75
77 bool hasVelocities() const;
78
80
82
86 virtual bool open(const String& name, File::OpenMode open_mode = std::ios::in);
87
90 bool init();
91
95 virtual bool readHeader();
96
100 virtual bool writeHeader();
101
104 virtual bool seekAndWriteHeader();
105
106 // ?????:
107 // should append() also write the header? what is more intuitive?
113 virtual bool append(const SnapShot& snapshot);
114
119 virtual bool read(SnapShot& snapshot);
120
123 virtual bool flushToDisk(const std::vector<SnapShot>& buffer);
124
126
129
132
135
137
138 private:
139 const DCDFile& operator = (const DCDFile& file);
140
141 protected:
142
143 //_
144 void writeSize_(const Size& data)
145 { *this << BinaryFileAdaptor<Size>(data);}
146
147 //_
148 void writeFloat_(const float& data)
149 { *this << BinaryFileAdaptor<float>(data);}
150
151 //_
152 void writeVector_(const vector<Vector3>& v);
153
154 //_
155 float readFloat_();
156
157 //_
159
160 //_
161 bool readSize_(Size expected_size, const String& what);
162
163 //_
164 bool readVector_(vector<Vector3>& v);
165
166 //_
168
169 // a flag indicating that we have to swap bytes when reading data
171
172 // a floag indicating that this DCD file contains atom velocities
174
175 //_
177
178 //_
180
181 //_
183
184 //_
186
187 //_
189
190 //_
192
193 //_
195
196 /*_ We had a problem with read(Snapshot), as it
197 still returned true at the end of file. No idea
198 why the stream was still good! To fix this,
199 I added this member to count the current read snapshot.
200 */
202
205 };
206} // namespace BALL
207
208#endif // BALL_FORMAT_DCDFILE_H
Definition: constants.h:13
BALL_EXPORT bool operator==(const String &s1, const String &s2)
bool readVector_(vector< Vector3 > &v)
BinaryFileAdaptor< float > adapt_float_
Definition: DCDFile.h:204
virtual ~DCDFile()
Destructor.
DCDFile(const String &name, File::OpenMode open_mode=std::ios::in)
DCDFile()
Default constructor.
Size number_of_comments_
Definition: DCDFile.h:194
virtual bool append(const SnapShot &snapshot)
bool has_velocities_
Definition: DCDFile.h:173
bool swap_bytes_
Definition: DCDFile.h:170
bool isSwappingBytes() const
void enableVelocityStorage()
Size readSize_()
bool charmm_extra_block_B_
Definition: DCDFile.h:179
void writeVector_(const vector< Vector3 > &v)
String CORD_
Definition: DCDFile.h:182
virtual bool readHeader()
BinaryFileAdaptor< Size > adapt_size_
Definition: DCDFile.h:203
virtual bool writeHeader()
void writeFloat_(const float &data)
Definition: DCDFile.h:148
virtual bool read(SnapShot &snapshot)
Size step_number_of_starting_time_
Definition: DCDFile.h:185
bool charmm_extra_block_A_
Definition: DCDFile.h:176
virtual bool seekAndWriteHeader()
virtual bool open(const String &name, File::OpenMode open_mode=std::ios::in)
bool hasVelocities() const
virtual bool flushToDisk(const std::vector< SnapShot > &buffer)
Position current_snapshot_
Definition: DCDFile.h:201
void disableVelocityStorage()
bool readSize_(Size expected_size, const String &what)
virtual void clear()
Clear method.
float readFloat_()
Size verbosity_
Definition: DCDFile.h:167
Size steps_between_saves_
Definition: DCDFile.h:188
void writeSize_(const Size &data)
Definition: DCDFile.h:144
double time_step_length_
Definition: DCDFile.h:191
std::ios::openmode OpenMode
Definition: file.h:165
#define BALL_EXPORT
Definition: COMMON/global.h:50