BALL  1.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Protected Attributes | Private Member Functions | List of all members
BALL::TRRFile Class Reference

#include <BALL/FORMAT/TRRFile.h>

Inheritance diagram for BALL::TRRFile:
BALL::TrajectoryFile BALL::File

Classes

class  TRRHeader

Public Member Functions

Constructors and Destructor
 TRRFile ()
 Default constructor.
 TRRFile (const String &name, File::OpenMode open_mode=std::ios::in)
 Construct and open a file.
virtual ~TRRFile ()
 Destructor.
Assignment
virtual void clear ()
 Clear method.
Predicates
bool operator== (const TRRFile &file) const
 Equality operator.
Public methods for file handling
virtual bool init ()
 Initialize the file for usage.
virtual bool writeNextHeader (const TRRHeader &header)
virtual bool readNextHeader (TRRHeader &header)
virtual bool append (const SnapShot &snapshot)
virtual bool read (SnapShot &snapshot)
virtual TRRFileoperator>> (SnapShotManager &ssm)
 Read the whole file into a SnapShotManager.
virtual bool flushToDisk (const std::vector< SnapShot > &buffer)
Accessors
bool hasVelocities () const
void setVelocityStorage (bool storage)
bool hasForces () const
void setForceStorage (bool storage)
Size getPrecision () const
bool setPrecision (const Size precision)
float getTimestep () const
void setTimestep (float timestep)
Vector3 getBoundingBoxX () const
Vector3 getBoundingBoxY () const
Vector3 getBoundingBoxZ () const
void setBoundingBox (const Vector3 &x, const Vector3 &y, const Vector3 &z)
- Public Member Functions inherited from BALL::TrajectoryFile
 TrajectoryFile ()
 Default constructor.
 TrajectoryFile (const String &filename, File::OpenMode open_mode=std::ios::in)
virtual ~TrajectoryFile ()
 Destructor.
bool operator== (const TrajectoryFile &file) const
 Equality operator.
Size getNumberOfSnapShots () const
Size getNumberOfAtoms () const
virtual bool readHeader ()
virtual bool writeHeader ()
- Public Member Functions inherited from BALL::File
 File ()
 File (const String &name, OpenMode open_mode=std::ios::in)
virtual ~File ()
bool isValid () const
bool open (const String &name, File::OpenMode open_mode=std::ios::in)
bool reopen ()
bool reopen (File::OpenMode open_mode)
void close ()
const StringgetName () const
void setName (const String &name)
const StringgetOriginalName () const
Size getSize ()
File::OpenMode getOpenMode () const
Type getType (bool trace_link) const
bool copyTo (const String &destination_name, Size buffer_size=4096)
bool moveTo (const String &destination_name)
bool remove ()
bool renameTo (const String &new_path)
bool truncate (Size size=0)
std::fstream & getFileStream ()
TransformationManagergetTransformationManager ()
const TransformationManagergetTransformationManager () const
bool operator== (const File &file) const
bool operator!= (const File &file) const
bool isOpen () const
bool isClosed () const
bool isAccessible () const
bool isCanonized () const
bool isReadable () const
bool isWritable () const
bool isExecutable () const

Protected Attributes

TRRHeader header_
Size precision_
bool has_velocities_
bool has_forces_
Size timestep_index_
float timestep_
Vector3 box1_
Vector3 box2_
Vector3 box3_
BinaryFileAdaptor< Sizeadapt_size_
BinaryFileAdaptor< char > adapt_char_
BinaryFileAdaptor< floatadapt_float_
BinaryFileAdaptor< doubleadapt_double_
- Protected Attributes inherited from BALL::TrajectoryFile
Size number_of_snapshots_
Size number_of_atoms_
- Protected Attributes inherited from BALL::File
String name_
String original_name_
OpenMode open_mode_
bool is_open_
bool is_temporary_

Private Member Functions

const TRRFileoperator= (const TRRFile &file)

Additional Inherited Members

- Public Types inherited from BALL::File
typedef std::ios::openmode OpenMode
enum  Transformation { TRANSFORMATION__EXEC = 1, TRANSFORMATION__FILTER = 2, TRANSFORMATION__URL = 3 }
enum  Type {
  TYPE__UNKNOWN = 0, TYPE__DIRECTORY = 1, TYPE__CHAR_SPECIAL_FILE = 2, TYPE__BLOCK_SPECIAL_FILE = 3,
  TYPE__REGULAR_FILE = 4, TYPE__SYMBOLIC_LINK = 5, TYPE__SOCKET = 6, TYPE__FIFO_SPECIAL_FILE = 7
}
- Static Public Member Functions inherited from BALL::File
static Size getSize (String name)
static Type getType (String name, bool trace_link)
static bool copy (String source_name, String destination_name, Size buffer_size=4096)
static bool move (const String &source_name, const String &destination_name)
static bool remove (String name)
static bool rename (String old_path, String new_path)
static bool truncate (String path, Size size=0)
static bool createTemporaryFilename (String &temporary, const String &suffix=".TMP")
static void enableTransformation (Transformation transformation)
static void disableTransformation (Transformation transformation)
static bool isTransformationEnabled (Transformation transformation)
static void registerTransformation (const String &pattern, const String &exec)
static void unregisterTransformation (const String &pattern)
static bool isAccessible (String name)
static bool isReadable (String name)
static bool isWritable (String name)
static bool isExecutable (String name)
- Static Public Attributes inherited from BALL::File
static const OpenMode MODE_IN
 Open for input (default)
static const OpenMode MODE_OUT
 Open for output.
static const OpenMode MODE_APP
 Append. Seek to end before each write operation.
static const OpenMode MODE_BINARY
 Binary mode.
static const OpenMode MODE_ATE
 Seek to end directly after opening.
static const OpenMode MODE_TRUNC
 Truncate an existing file.
static const String TRANSFORMATION_EXEC_PREFIX
 Prefix for filenames that are created through the execution of commands "exec:".
static const String TRANSFORMATION_FILE_PREFIX
 Prefix for files (to mimick URL-like behavior) "file:".
static const String TRANSFORMATION_FTP_PREFIX
 Prefix for FTP-transfers "ftp://".
static const String TRANSFORMATION_HTTP_PREFIX
 Prefix for HTTP-transfer "http://".
- Static Protected Attributes inherited from BALL::File
static HashSet< Stringcreated_temp_filenames_
static TransformationManager transformation_manager_
static Size transformation_methods_

Detailed Description

TRR Trajectory file format. This class enables BALL to read and write GROMACS TRR files. This format is portable.

In a TRR file, each timestep is preceded by a header. The header is handled by the nested TRRHeader class.

Definition at line 28 of file TRRFile.h.

Constructor & Destructor Documentation

BALL::TRRFile::TRRFile ( )

Default constructor.

BALL::TRRFile::TRRFile ( const String name,
File::OpenMode  open_mode = std::ios::in 
)

Construct and open a file.

virtual BALL::TRRFile::~TRRFile ( )
virtual

Destructor.

Member Function Documentation

virtual bool BALL::TRRFile::append ( const SnapShot snapshot)
virtual

Append a SnapShot to an existing file

Parameters
snapshotthe SnapShot we want to store
Returns
true, if writing was successful

Reimplemented from BALL::TrajectoryFile.

virtual void BALL::TRRFile::clear ( )
virtual

Clear method.

Reimplemented from BALL::TrajectoryFile.

virtual bool BALL::TRRFile::flushToDisk ( const std::vector< SnapShot > &  buffer)
virtual

Flush the SnapShot buffer to disk.

Exceptions
File::CannotWriteif writing to the file failed

Reimplemented from BALL::TrajectoryFile.

Vector3 BALL::TRRFile::getBoundingBoxX ( ) const
Vector3 BALL::TRRFile::getBoundingBoxY ( ) const
Vector3 BALL::TRRFile::getBoundingBoxZ ( ) const
Size BALL::TRRFile::getPrecision ( ) const
float BALL::TRRFile::getTimestep ( ) const
bool BALL::TRRFile::hasForces ( ) const
bool BALL::TRRFile::hasVelocities ( ) const
virtual bool BALL::TRRFile::init ( )
virtual

Initialize the file for usage.

const TRRFile& BALL::TRRFile::operator= ( const TRRFile file)
private
bool BALL::TRRFile::operator== ( const TRRFile file) const

Equality operator.

virtual TRRFile& BALL::TRRFile::operator>> ( SnapShotManager ssm)
virtual

Read the whole file into a SnapShotManager.

virtual bool BALL::TRRFile::read ( SnapShot snapshot)
virtual

Read the next snapshot from the file

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

Reimplemented from BALL::TrajectoryFile.

virtual bool BALL::TRRFile::readNextHeader ( TRRHeader header)
virtual

Reads the next header preceding the next data block.

Parameters
headera buffer for result delivery
Returns
true, if a header could be read, false ow.
void BALL::TRRFile::setBoundingBox ( const Vector3 x,
const Vector3 y,
const Vector3 z 
)
void BALL::TRRFile::setForceStorage ( bool  storage)
bool BALL::TRRFile::setPrecision ( const Size  precision)
void BALL::TRRFile::setTimestep ( float  timestep)
void BALL::TRRFile::setVelocityStorage ( bool  storage)
virtual bool BALL::TRRFile::writeNextHeader ( const TRRHeader header)
virtual

Writes the next header that shall preceed the next data block.

Parameters
headerthe TRRHeader we want to write
Returns
true, if a header could be written, false ow.

Member Data Documentation

BinaryFileAdaptor<char> BALL::TRRFile::adapt_char_
protected

Definition at line 297 of file TRRFile.h.

BinaryFileAdaptor<double> BALL::TRRFile::adapt_double_
protected

Definition at line 299 of file TRRFile.h.

BinaryFileAdaptor<float> BALL::TRRFile::adapt_float_
protected

Definition at line 298 of file TRRFile.h.

BinaryFileAdaptor<Size> BALL::TRRFile::adapt_size_
protected

Definition at line 296 of file TRRFile.h.

Vector3 BALL::TRRFile::box1_
protected

Definition at line 294 of file TRRFile.h.

Vector3 BALL::TRRFile::box2_
protected

Definition at line 294 of file TRRFile.h.

Vector3 BALL::TRRFile::box3_
protected

Definition at line 294 of file TRRFile.h.

bool BALL::TRRFile::has_forces_
protected

Definition at line 284 of file TRRFile.h.

bool BALL::TRRFile::has_velocities_
protected

Definition at line 281 of file TRRFile.h.

TRRHeader BALL::TRRFile::header_
protected

Definition at line 275 of file TRRFile.h.

Size BALL::TRRFile::precision_
protected

Definition at line 278 of file TRRFile.h.

float BALL::TRRFile::timestep_
protected

Definition at line 290 of file TRRFile.h.

Size BALL::TRRFile::timestep_index_
protected

Definition at line 287 of file TRRFile.h.