MolSim
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
XYZWriter Class Reference

Class which implements functionality to generate VTK output from particles. More...

#include <XYZWriter.h>

Inheritance diagram for XYZWriter:
FileWriter

Public Member Functions

 XYZWriter ()
 Creates a new uninitialized XYZWriter.
 
 XYZWriter (const std::string &basename)
 Creates a new XYZWriter with the given basename for future file outputs.
 
 XYZWriter (const std::string &basename, const std::string &dirname)
 Creates a new XYZWriter with the given basename for future file outputs in the specified directory.
 
virtual ~XYZWriter ()
 Destroys the current XYZWriter object.
 
void writeParticles (const ParticleContainer &particles, int iteration, int total) override
 Writes the type, mass, position, velocity and force of a ParticleContainer to a XYZ file. Terminates program execution on error.
 
- Public Member Functions inherited from FileWriter
 FileWriter ()
 Creates a new FileWriter with no file initialized.
 
 FileWriter (const std::string &filename)
 Creates a new FileWriter and opens the file with the given name.
 
virtual ~FileWriter ()
 Closes the opened file and destroys the FileWriter object.
 
void openFile (const std::string &filename)
 Opens / creates the file with the given name.
 
void closeFile ()
 Closes the opened file if it exists, otherwise does nothing.
 
void writeFile (const std::string &content, const std::string &filename="", int iteration=-1, int total=-1)
 Overwrites the contents of the file opened in m_file with a given string. On error, the program will terminate.
 

Private Attributes

std::string m_basename = "MD_xyz"
 The base name of the generated files.
 
std::string m_dirname = "xyz"
 The name of the directory in which to store the generated files.
 

Additional Inherited Members

- Static Public Member Functions inherited from FileWriter
static void initializeFolder (const std::string &dirname)
 (Re)initializes the output directory.
 
- Protected Attributes inherited from FileWriter
std::ofstream m_file
 Output stream containing the file to write contents to.
 

Detailed Description

Class which implements functionality to generate VTK output from particles.

Constructor & Destructor Documentation

◆ XYZWriter() [1/3]

XYZWriter::XYZWriter ( )

Creates a new uninitialized XYZWriter.

◆ XYZWriter() [2/3]

XYZWriter::XYZWriter ( const std::string &  basename)
explicit

Creates a new XYZWriter with the given basename for future file outputs.

Parameters
basenameThe base name of the generated files.

◆ XYZWriter() [3/3]

XYZWriter::XYZWriter ( const std::string &  basename,
const std::string &  dirname 
)

Creates a new XYZWriter with the given basename for future file outputs in the specified directory.

Parameters
basenameThe base name of the generated files.
dirnameThe directory name of the generated files.

◆ ~XYZWriter()

virtual XYZWriter::~XYZWriter ( )
virtual

Destroys the current XYZWriter object.

Member Function Documentation

◆ writeParticles()

void XYZWriter::writeParticles ( const ParticleContainer particles,
int  iteration,
int  total 
)
overridevirtual

Writes the type, mass, position, velocity and force of a ParticleContainer to a XYZ file. Terminates program execution on error.

Parameters
particlesThe ParticleContainer.
iterationThe number of the current iteration, used to generate a unique filename.
totalThe total number of iterations, used to display the current percentage.

Implements FileWriter.

Member Data Documentation

◆ m_basename

std::string XYZWriter::m_basename = "MD_xyz"
private

The base name of the generated files.

◆ m_dirname

std::string XYZWriter::m_dirname = "xyz"
private

The name of the directory in which to store the generated files.


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