BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
snapShotManager.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 // $Id: snapShotManager.h,v 1.19.20.1 2007/05/10 10:51:04 amoll Exp $
5 //
6 
7 #ifndef BALL_MOLMEC_COMMON_SNAPSHOTMANAGER_H
8 #define BALL_MOLMEC_COMMON_SNAPSHOTMANAGER_H
9 
10 #ifndef BALL_MOLMEC_COMMON_SNAPSHOT_H
12 #endif
13 
14 #ifndef BALL_DATATYPE_OPTIONS_H
15 # include <BALL/DATATYPE/options.h>
16 #endif
17 
18 #ifndef BALL_SYSTEM_FILE_H
19 # include <BALL/SYSTEM/file.h>
20 #endif
21 
22 namespace BALL
23 {
24  class TrajectoryFile;
25  class System;
26  class ForceField;
27 
34 {
35  public:
36 
39  {
44  static const char* FLUSH_TO_DISK_FREQUENCY;
45  };
46 
49  {
55  };
56 
57 
59 
60 
61 
62 
65 
72  SnapShotManager(System* my_system, TrajectoryFile* my_snapshot_file = 0);
73 
81  SnapShotManager(System* my_system, const ForceField* my_force_field, TrajectoryFile* my_snapshot_file);
82 
91  SnapShotManager (System* my_system, const ForceField* my_force_field,
92  const Options& my_options, TrajectoryFile* file);
93 
95  SnapShotManager(const SnapShotManager& manager);
96 
98  virtual ~SnapShotManager();
99 
101 
104 
111  bool setup(System* my_system, const ForceField* my_forcefield, TrajectoryFile* my_snapshot_file);
112 
119  bool setup(System* my_system, TrajectoryFile* my_snapshot_file);
120 
125  virtual bool setup();
126 
128 
131 
134  const SnapShotManager& operator = (const SnapShotManager& manager);
135 
137  virtual void clear();
138 
140 
142 
145  virtual bool isValid() const;
146 
148 
150 
155  void setSystem(System* my_system);
156 
158  System* getSystem() const;
159 
161  void setForceField(const ForceField* my_ff);
162 
164  const ForceField* getForceField() const;
165 
167  void setTrajectoryFile(TrajectoryFile* my_file);
168 
170  TrajectoryFile* getTrajectoryFile() const;
171 
176  void setFlushToDiskFrequency(Size number);
177 
181  Size getFlushToDiskFrequency() const;
182 
189  virtual void takeSnapShot() throw(File::CannotWrite);
190 
197  virtual bool applySnapShot(Size number);
198 
203  virtual bool applyFirstSnapShot();
204 
210  virtual bool applyNextSnapShot();
211 
217  virtual bool applyLastSnapShot();
218 
221  virtual void flushToDisk() throw(File::CannotWrite);
222 
224  Size getNumberOfSnapShotsInBuffer() { return snapshot_buffer_.size(); }
225 
227  Position getCurrentSnapshotNumber() const { return current_snapshot_ + 1; }
228 
231  bool readFromFile();
232 
234  void clearBuffer();
235 
237 
239 
242 
244  //_ @name Protected Attributes
245  //_@{
246 
247  protected:
248 
249  //_ The system to which the SnapshotManager is bound
251 
252  //_ The force field of the current system
254 
255  //_ A vector containing those snapshot objects currently in memory
256  vector<SnapShot> snapshot_buffer_;
257 
258  //_ The trajectory file where the data is saved in
260 
261  /*_ The frequency of saving snapshots in memory to disk.
262  After flush_to_disk_frequency_ iterations, a save is done.
263  */
265 
266  //_ Number of taken SnapShot sine last flushToDisk
268 
269  //_ Number of the current SnapShot (used with buffer_)
271 
272  //_@}
273  /*_ @name Protected methods
274  */
275  //_@{
276 
277  /*_ Calculate the kinetic energy
278  */
279  double calculateKineticEnergy_();
280 
281  //_@}
282 
283 }; // end of class SnapshotManager
284 
285 } // namespace
286 #endif // BALL_MOLMEC_COMMON_SNAPSHOTMANAGER_H
#define BALL_CREATE(name)
Definition: create.h:62
const ForceField * force_field_ptr_
vector< SnapShot > snapshot_buffer_
Options options
The available options for this class.
Local class for handling options.
static const char * FLUSH_TO_DISK_FREQUENCY
Local class for handling default values for the options.
Position getCurrentSnapshotNumber() const
static const Size FLUSH_TO_DISK_FREQUENCY
TrajectoryFile * trajectory_file_ptr_
#define BALL_EXPORT
Definition: COMMON/global.h:50