BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Static Public Attributes | 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. More...
 
 TRRFile (const String &name, File::OpenMode open_mode=std::ios::in)
 Construct and open a file. More...
 
virtual ~TRRFile ()
 Destructor. More...
 
Assignment
virtual void clear ()
 Clear method. More...
 
Predicates
bool operator== (const TRRFile &file) const
 Equality operator. More...
 
Public methods for file handling
virtual bool init ()
 Initialize the file for usage. More...
 
virtual bool readHeader ()
 
virtual bool writeNextHeader (const TRRHeader &header)
 
virtual bool readNextHeader (TRRHeader &header)
 
virtual bool append (const SnapShot &snapshot)
 
virtual bool read (SnapShot &snapshot)
 
virtual bool skipFrame ()
 
virtual Size getNumberOfSnapShots ()
 
virtual TRRFileoperator>> (SnapShotManager &ssm)
 Read the whole file into a SnapShotManager. More...
 
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. More...
 
 TrajectoryFile (const String &filename, File::OpenMode open_mode=std::ios::in)
 
virtual ~TrajectoryFile ()
 Destructor. More...
 
bool operator== (const TrajectoryFile &file) const
 Equality operator. More...
 
Size getNumberOfAtoms () const
 
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
 

Static Public Attributes

static const double to_angstrom
 
static const double to_nanometer
 

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_
 
Size old_file_size_
 
- 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 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
virtual Size BALL::TRRFile::getNumberOfSnapShots ( )
virtual

get the number of snapshots stored in this instance.

Returns
the number of snapshots of this instance

Reimplemented from BALL::TrajectoryFile.

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::readHeader ( )
virtual

Read file header This function is actually a nop, since TRRFiles don't have file headers; it is only provided for interface reasons.

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::skipFrame ( )
virtual

Skip the next snapshot in the file

Returns
true, if a snapshot could be read, false otherwise.
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 315 of file TRRFile.h.

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

Definition at line 317 of file TRRFile.h.

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

Definition at line 316 of file TRRFile.h.

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

Definition at line 314 of file TRRFile.h.

Vector3 BALL::TRRFile::box1_
protected

Definition at line 312 of file TRRFile.h.

Vector3 BALL::TRRFile::box2_
protected

Definition at line 312 of file TRRFile.h.

Vector3 BALL::TRRFile::box3_
protected

Definition at line 312 of file TRRFile.h.

bool BALL::TRRFile::has_forces_
protected

Definition at line 302 of file TRRFile.h.

bool BALL::TRRFile::has_velocities_
protected

Definition at line 299 of file TRRFile.h.

TRRHeader BALL::TRRFile::header_
protected

Definition at line 293 of file TRRFile.h.

Size BALL::TRRFile::old_file_size_
protected

Definition at line 319 of file TRRFile.h.

Size BALL::TRRFile::precision_
protected

Definition at line 296 of file TRRFile.h.

float BALL::TRRFile::timestep_
protected

Definition at line 308 of file TRRFile.h.

Size BALL::TRRFile::timestep_index_
protected

Definition at line 305 of file TRRFile.h.

const double BALL::TRRFile::to_angstrom
static

Definition at line 33 of file TRRFile.h.

const double BALL::TRRFile::to_nanometer
static

Definition at line 34 of file TRRFile.h.