MolSim
Loading...
Searching...
No Matches
VTKWriter.h
Go to the documentation of this file.
1
11#pragma once
12
13#include "FileWriter.h"
15#include "objects/Particle.h"
16#include <string>
17
19class VTKWriter : public FileWriter {
20 private:
24 std::string m_basename = "MD_vtk";
26 std::string m_dirname = "vtk";
27
33 void initializeOutput(int numParticles);
34
41 void writeFile(int iteration, int total);
42
48 void plotParticle(const Particle &p);
49
50 public:
53
59 explicit VTKWriter(const std::string &basename);
60
67 VTKWriter(const std::string &basename, const std::string &dirname);
68
70 virtual ~VTKWriter();
71
80 void writeParticles(const ParticleContainer &particles, int iteration, int total) override;
81};
General class used to strictly write particle data to some output file. data.
Model of a single particle.
Superclass which implements functionality to output data to a file on disk.
Definition FileWriter.h:16
Class for encapsulating multiple Particle objects..
Definition ParticleContainer.h:17
Particle class modeling a particle's position, velocity, force, mass and type.
Definition Particle.h:46
Class corresponding to the VTKFile_t schema type.
Definition vtk-unstructured.h:1771
Class which implements functionality to generate VTK output from particles.
Definition VTKWriter.h:19
VTKWriter(const std::string &basename, const std::string &dirname)
Creates a new VTKWriter with the given basename for future file outputs in the specified directory.
VTKWriter(const std::string &basename)
Creates a new VTKWriter with the given basename for future file outputs.
void writeFile(int iteration, int total)
Writes the contents of m_vtkFile into a given VTK file. Terminates program execution on error.
VTKFile_t * m_vtkFile
The VTK file instance containing particle data.
Definition VTKWriter.h:22
void initializeOutput(int numParticles)
Initializes m_vtkFile with necessary metadata for writing purposes. Terminates program execution on e...
void writeParticles(const ParticleContainer &particles, int iteration, int total) override
Writes the type, mass, position, velocity and force of a ParticleContainer to a VTK file....
std::string m_basename
The base name of the generated files.
Definition VTKWriter.h:24
void plotParticle(const Particle &p)
Plots a single particle to m_vtkFile. Terminates program execution on error.
std::string m_dirname
The name of the directory in which to store the generated files.
Definition VTKWriter.h:26
VTKWriter()
Creates a new uninitialized VTKWriter.
virtual ~VTKWriter()
Destroys the current VTKWriter object.
Generated from vtk-unstructured.xsd.