LOOS 4.1.0
The Lightweight Object Oriented Structural analysis library/toolkit
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
loos::TrajectoryWriter Class Referenceabstract

Base class for writing trajectories. More...

#include <trajwriter.hpp>

Inheritance diagram for loos::TrajectoryWriter:
Inheritance graph
[legend]
Collaboration diagram for loos::TrajectoryWriter:
Collaboration graph
[legend]

Public Member Functions

 TrajectoryWriter (const std::string &fname, const bool append=false)
 Write a trajectory to a file, optionally appending.
 
 TrajectoryWriter (std::iostream *s, const bool append=false)
 Write a trajectory to a stream.
 
virtual void setComments (const std::vector< std::string > &comments)
 Set comments in metadata (not all formats support)
 
virtual void setComments (const std::string &s)
 Set comment in metadata (not all formats support)
 
virtual void writeFrame (const AtomicGroup &model)=0
 Wirte a single frame.
 
virtual void writeFrame (const AtomicGroup &model, const uint step, const double time)
 Write a single frame specifying the step and timepoint.
 
virtual bool hasFrameStep () const
 Can format write step on a per-frame basis?
 
virtual bool hasFrameTime () const
 Can format write time on a per-frame basis?
 
virtual bool hasComments () const
 Does format support comments in metadata?
 
virtual uint framesWritten () const =0
 Total frames in output file.
 
bool isAppending () const
 Returns true if appending to an existing trajectory.
 

Protected Attributes

std::iostream * stream_
 
std::string _filename
 
bool appending_
 
bool delete_
 

Detailed Description

Base class for writing trajectories.

This is the interface for creating and writing to trajectories. The interface is kept simple on purpose to make it easy to work with multiple formats. This means that trajectory and frame metadata may be set to default values. If you need more control over how the trajectory is written, then use the derived classes explicitly.

Constructor & Destructor Documentation

◆ TrajectoryWriter()

loos::TrajectoryWriter::TrajectoryWriter ( std::iostream * s,
const bool append = false )
inline

Write a trajectory to a stream.

Note that this constructor assumes that the stream is correctly prepped by the caller...if you need to seekp() to the end of the stream for appending, then this must be done before instantiating the TrajectoryWriter object.

Member Function Documentation

◆ framesWritten()

virtual uint loos::TrajectoryWriter::framesWritten ( ) const
pure virtual

Total frames in output file.

For files being appended too, this includes the frames already written...

Implemented in loos::XTCWriter, and loos::DCDWriter.

◆ hasComments()

virtual bool loos::TrajectoryWriter::hasComments ( ) const
inlinevirtual

Does format support comments in metadata?

Reimplemented in loos::DCDWriter.

◆ setComments()

virtual void loos::TrajectoryWriter::setComments ( const std::vector< std::string > & comments)
inlinevirtual

Set comments in metadata (not all formats support)

Reimplemented in loos::DCDWriter.

◆ writeFrame() [1/2]

virtual void loos::TrajectoryWriter::writeFrame ( const AtomicGroup & model)
pure virtual

Wirte a single frame.

Implemented in loos::DCDWriter, and loos::XTCWriter.

◆ writeFrame() [2/2]

virtual void loos::TrajectoryWriter::writeFrame ( const AtomicGroup & model,
const uint step,
const double time )
inlinevirtual

Write a single frame specifying the step and timepoint.

Not all formats support this. By default, it will drop the extra data and call writeFrame()

Reimplemented in loos::XTCWriter.


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