faunus
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
Faunus::XTCWriter Class Reference

Writes frames into an XTC file (GROMACS compressed trajectory file format). More...

#include <io.h>

Public Member Functions

 XTCWriter (const std::string &filename)
 
void write (const TrajectoryFrame &frame)
 Writes a frame into the file. More...
 
void writeNext (const TrajectoryFrame &frame)
 Writes a next frame into the file using own automatic counter for step and timestamp. More...
 
template<RequirePointIterator begin_iterator, typename end_iterator >
void writeNext (const Point &box, begin_iterator coordinates_begin, end_iterator coordinates_end)
 Writes a next frame into the file using own automatic counter for step and timestamp. More...
 

Public Attributes

const std::string filename
 name of the trajectory file, mainly for error reporting
 

Protected Member Functions

void writeFrame ()
 Actual wrapper around C function that writes the current frame into xtc_frame. More...
 
void writeFrameAt (int step, float time)
 Actual wrapper around C function that writes the current frame into xtc_frame overriding step and timestamp. More...
 

Detailed Description

Writes frames into an XTC file (GROMACS compressed trajectory file format).

It is a wrapper around C function calls.

The frames can be provided as a TrajectoryFrame structure or as a list of positions in an input iterator. The class is responsible for I/O operations, not data conversion.

Constructor & Destructor Documentation

◆ XTCWriter()

Faunus::XTCWriter::XTCWriter ( const std::string &  filename)
explicit
Parameters
filenamea name of the XTC file to open

Member Function Documentation

◆ write()

void Faunus::XTCWriter::write ( const TrajectoryFrame frame)

Writes a frame into the file.

Parameters
[in]frameframe to be written
Exceptions
std::runtime_errorwhen other I/O error occures

◆ writeFrame()

void Faunus::XTCWriter::writeFrame ( )
protected

Actual wrapper around C function that writes the current frame into xtc_frame.

Exceptions
std::runtime_errorwhen other I/O error occures

◆ writeFrameAt()

void Faunus::XTCWriter::writeFrameAt ( int  step,
float  time 
)
protected

Actual wrapper around C function that writes the current frame into xtc_frame overriding step and timestamp.

Exceptions
std::runtime_errorwhen other I/O error occures

◆ writeNext() [1/2]

void Faunus::XTCWriter::writeNext ( const TrajectoryFrame frame)

Writes a next frame into the file using own automatic counter for step and timestamp.

The corresponding values in the frame are ignored.

Parameters
[in]frameframe to be written
Exceptions
std::runtime_errorwhen other I/O error occures

◆ writeNext() [2/2]

template<RequirePointIterator begin_iterator, typename end_iterator >
void Faunus::XTCWriter::writeNext ( const Point box,
begin_iterator  coordinates_begin,
end_iterator  coordinates_end 
)
inline

Writes a next frame into the file using own automatic counter for step and timestamp.

Template Parameters
begin_iterator
end_iterator
Parameters
[in]boxdimensions of the cubic box (xyz)
[in]coordinates_begininput iterator with coordinates (not particles)
[in]coordinates_endinput iterator's end

The documentation for this class was generated from the following files: