00001
00002
00003
00004
00005
00006
00007 #ifndef BALL_FORMAT_DCDFILE_H
00008 #define BALL_FORMAT_DCDFILE_H
00009
00010 #ifndef BALL_FORMAT_TRAJECTORYFILE_H
00011 # include <BALL/FORMAT/trajectoryFile.h>
00012 #endif
00013
00014 namespace BALL
00015 {
00035 class BALL_EXPORT DCDFile
00036 : public TrajectoryFile
00037 {
00038
00039 public:
00040
00041 BALL_CREATE(DCDFile)
00042
00043
00046
00048 DCDFile()
00049 ;
00050
00052 DCDFile(const DCDFile& file)
00053 throw(Exception::FileNotFound);
00054
00056 DCDFile(const String& name, File::OpenMode open_mode = std::ios::in)
00057 throw(Exception::FileNotFound);
00058
00060 virtual ~DCDFile()
00061 ;
00062
00064
00067
00069 const DCDFile& operator = (const DCDFile& file)
00070 ;
00071
00073 virtual void clear()
00074 ;
00075
00077
00080
00082 bool operator == (const DCDFile& file) const
00083 ;
00084
00086 bool isSwappingBytes() const
00087 ;
00088
00090 bool hasVelocities() const
00091 ;
00092
00094
00095
00096
00099 virtual bool open(const String& name, File::OpenMode open_mode = std::ios::in)
00100 throw(Exception::FileNotFound);
00101
00104 bool init()
00105 ;
00106
00110 virtual bool readHeader()
00111 ;
00112
00116 virtual bool writeHeader()
00117 ;
00118
00121 virtual bool seekAndWriteHeader()
00122 ;
00123
00124
00125
00131 virtual bool append(const SnapShot& snapshot)
00132 ;
00133
00138 virtual bool read(SnapShot& snapshot)
00139 ;
00140
00143 virtual bool flushToDisk(const std::vector<SnapShot>& buffer)
00144 throw(File::CannotWrite);
00145
00147
00150
00152 void enableVelocityStorage()
00153 ;
00154
00156 void disableVelocityStorage()
00157 ;
00158
00160
00161 protected:
00162
00163
00164 void writeSize_(const Size& data)
00165 { *this << BinaryFileAdaptor<Size>(data);}
00166
00167
00168 void writeFloat_(const float& data)
00169 { *this << BinaryFileAdaptor<float>(data);}
00170
00171
00172 void writeVector_(const vector<Vector3>& v)
00173 ;
00174
00175
00176 float readFloat_()
00177 ;
00178
00179
00180 Size readSize_()
00181 ;
00182
00183
00184 bool readSize_(Size expected_size, const String& what)
00185 ;
00186
00187
00188 bool readVector_(vector<Vector3>& v)
00189 ;
00190
00191
00192 Size verbosity_;
00193
00194
00195 bool swap_bytes_;
00196
00197
00198 bool has_velocities_;
00199
00200
00201 bool charmm_extra_block_A_;
00202
00203
00204 bool charmm_extra_block_B_;
00205
00206
00207 String CORD_;
00208
00209
00210 Size step_number_of_starting_time_;
00211
00212
00213 Size steps_between_saves_;
00214
00215
00216 double time_step_length_;
00217
00218
00219 Size number_of_comments_;
00220
00221
00222
00223
00224
00225
00226 Position current_snapshot_;
00227
00228 BinaryFileAdaptor<Size> adapt_size_;
00229 BinaryFileAdaptor<float> adapt_float_;
00230 };
00231 }
00232
00233 #endif // BALL_FORMAT_DCDFILE_H