Molecular Dynamics  v0.4
Project for the Practical hosted by the Scientific Computing Chair
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
FileHandler Class Reference

Wrapper class for file handling. More...

#include <FileHandler.h>

Collaboration diagram for FileHandler:
Collaboration graph

Public Types

enum class  outputFormat {
  vtk , xyz , xml , txt ,
  invalid
}
 Supported output formats. More...
 
enum class  inputFormat { txt , xml , invalid }
 Supported input formats. More...
 

Public Member Functions

void writeToFile (ParticleContainer &particles, int iteration, outputFormat format, std::string &baseName)
 Write particles to a file. More...
 

Static Public Member Functions

static void readFile (ParticleContainer &particles, std::string &filePath, inputFormat format)
 Read particles from a txt-file. More...
 

Private Attributes

outputWriter::VTKWriter vtkWriter
 
outputWriter::XYZWriter xyzWriter
 

Detailed Description

Wrapper class for file handling.

The main goal of this class is to abstract the file handling to make it convenient in the future to add more input and output methods.

Member Enumeration Documentation

◆ inputFormat

Supported input formats.

This enum class enables the user to select the desired input format.

Enumerator
txt 
xml 
invalid 

◆ outputFormat

Supported output formats.

This enum class enables the user to select the desired output format in the writeToFile method.

Enumerator
vtk 
xyz 
xml 
txt 
invalid 

Member Function Documentation

◆ readFile()

void FileHandler::readFile ( ParticleContainer particles,
std::string &  filePath,
inputFormat  format 
)
static

Read particles from a txt-file.

Parameters
particlesParticle container in which the newly read-in particles will be stored.
filePathFile path to the input txt-file of the particles to be read.
formatType of the input file.

Supported txt file formats at the moment: Particle, Cuboid.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeToFile()

void FileHandler::writeToFile ( ParticleContainer particles,
int  iteration,
outputFormat  format,
std::string &  baseName 
)

Write particles to a file.

Parameters
particlesParticles which will be written to the file.
iterationCurrent iteration step of the simulation.
formatType of the output file.
baseNameBase name of the output file.

Write particles to a file. You can choose between different output formats. The file will be created in the directory, in which this program was executed.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ vtkWriter

outputWriter::VTKWriter FileHandler::vtkWriter
private

◆ xyzWriter

outputWriter::XYZWriter FileHandler::xyzWriter
private

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