BALL  1.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
10 #endif
11 
12 #ifndef BALL_SYSTEM_BINARYFILEADAPTOR_H
14 #endif
15 
16 namespace BALL
17 {
29  : public TrajectoryFile
30  {
31 
32  public:
33 
37 
45  {
46  public:
47 
64 
72 
78 
84 
89 
94 
99 
105 
111 
115 
119 
124 
128 
132  float lambda;
133 
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
276 
277  // the precision of the file in bytes per value
279 
280  // a flag deciding if the file contains velocities
282 
283  // a flag deciding if the file contains forces
285 
286  // the index of the current timestep / snapshot
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 
300  };
301 } // namespace BALL
302 
303 #endif // BALL_FORMAT_TRRFILE_H