Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members

TrajectoryFile Class Reference
[Molecular Dynamics Trajectory File Formats]

Trajectory file format for MD simulation. More...

#include <trajectoryFile.h>

Inheritance diagram for TrajectoryFile:

File DCDFile TRRFile List of all members.

Public Member Functions

Constructors and Destructor
 TrajectoryFile () throw ()
 Default constructor.
 TrajectoryFile (const TrajectoryFile &file) throw ()
 Copy constructor.
 TrajectoryFile (const String &filename, File::OpenMode open_mode=std::ios::in) throw (Exception::FileNotFound)
 Detailed constructor requiring a filename and the mode in which this file should be opened.
virtual ~TrajectoryFile () throw ()
 Destructor.
Assignment
const TrajectoryFileoperator= (const TrajectoryFile &file) throw ()
 Assignment operator.
virtual void clear () throw ()
 Clear method.
Predicates
bool operator== (const TrajectoryFile &file) const throw ()
 Equality operator.
Accessors
Size getNumberOfSnapShots () const throw ()
 get the number of snapshots stored in this instance.
Size getNumberOfAtoms () const throw ()
 get the number of atoms coverd by each snapshot.
Public methods for file handling
virtual bool readHeader () throw ()
 Read the header of an existing file.
virtual bool writeHeader () throw ()
 Write a header.
virtual bool append (const SnapShot &snapshot) throw ()
 Append a SnapShot to an existing file.
virtual bool read (SnapShot &snapshot) throw ()
 Read the next SnapShot from the file.
virtual bool flushToDisk (const std::vector< SnapShot > &buffer) throw (File::CannotWrite)
 Write several SnapShots to disk.

Protected Attributes

Size number_of_snapshots_
Size number_of_atoms_

Detailed Description

Trajectory file format for MD simulation.

This is more an interface definition than an actual class, because it would not make too much sense to create yet-another-trajectory-format. This class will be specialized by actual formats, like DCD.


Constructor & Destructor Documentation

TrajectoryFile::TrajectoryFile const String filename,
File::OpenMode  open_mode = std::ios::in
throw (Exception::FileNotFound)
 

Detailed constructor requiring a filename and the mode in which this file should be opened.

See also:
File
Parameters:
filename the name of the file
open_mode the mode in which this file should be opened


Member Function Documentation

virtual bool TrajectoryFile::append const SnapShot snapshot  )  throw () [virtual]
 

Append a SnapShot to an existing file.

Note that this method does note update the header.

Parameters:
snapshot the SnapShot we want to save
Returns:
true, if writing was successful

Reimplemented in DCDFile, and TRRFile.

virtual bool TrajectoryFile::flushToDisk const std::vector< SnapShot > &  buffer  )  throw (File::CannotWrite) [virtual]
 

Write several SnapShots to disk.

Parameters:
buffer a vector of snapshots
Returns:
true, if flushing was successful, false ow.

Reimplemented in DCDFile, and TRRFile.

Size TrajectoryFile::getNumberOfAtoms  )  const throw ()
 

get the number of atoms coverd by each snapshot.

Returns:
the number of atoms

Size TrajectoryFile::getNumberOfSnapShots  )  const throw ()
 

get the number of snapshots stored in this instance.

Returns:
the number of snapshots of this instance

virtual bool TrajectoryFile::read SnapShot snapshot  )  throw () [virtual]
 

Read the next SnapShot from the file.

Parameters:
snapshot a buffer for result delivery
Returns:
true if a snapshot could be read, false ow.

Reimplemented in DCDFile, and TRRFile.

virtual bool TrajectoryFile::readHeader  )  throw () [virtual]
 

Read the header of an existing file.

Returns:
true if the header could be read successfully, false ow.

Reimplemented in DCDFile.

virtual bool TrajectoryFile::writeHeader  )  throw () [virtual]
 

Write a header.

Returns:
true if the header could be written successfully, false ow.

Reimplemented in DCDFile.