Version: SMASH-2.0
vtkoutput.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2014-2020
4  * SMASH Team
5  *
6  * GNU General Public License (GPLv3 or later)
7  *
8  */
9 
10 #ifndef SRC_INCLUDE_SMASH_VTKOUTPUT_H_
11 #define SRC_INCLUDE_SMASH_VTKOUTPUT_H_
12 
13 #include <memory>
14 #include <string>
15 
16 #include <boost/filesystem.hpp>
17 
18 #include "density.h"
19 #include "forwarddeclarations.h"
20 #include "outputinterface.h"
21 #include "outputparameters.h"
22 
23 namespace smash {
24 
29 class VtkOutput : public OutputInterface {
30  public:
38  VtkOutput(const bf::path &path, const std::string &name,
39  const OutputParameters &out_par);
40  ~VtkOutput();
41 
50  void at_eventstart(const Particles &particles, const int event_number,
51  const EventInfo &event) override;
52 
62  void at_eventend(const Particles &particles, const int event_number,
63  const EventInfo &event) override;
64 
73  void at_intermediate_time(const Particles &particles,
74  const std::unique_ptr<Clock> &clock,
75  const DensityParameters &dens_param,
76  const EventInfo &event) override;
77 
87  const ThermodynamicQuantity tq, const DensityType dt,
88  RectangularLattice<DensityOnLattice> &lattice) override;
89 
99  const ThermodynamicQuantity tq, const DensityType dt,
100  RectangularLattice<EnergyMomentumTensor> &lattice) override;
101 
108  void thermodynamics_output(const GrandCanThermalizer &gct) override;
109 
110  private:
116  void write(const Particles &particles);
117 
124  std::string make_filename(const std::string &description, int counter);
125 
132  std::string make_varname(const ThermodynamicQuantity tq,
133  const DensityType dens_type);
134 
142  template <typename T>
143  void write_vtk_header(std::ofstream &file, RectangularLattice<T> &lat,
144  const std::string &description);
145 
154  template <typename T, typename F>
155  void write_vtk_scalar(std::ofstream &file, RectangularLattice<T> &lat,
156  const std::string &varname, F &&function);
157 
166  template <typename T, typename F>
167  void write_vtk_vector(std::ofstream &file, RectangularLattice<T> &lat,
168  const std::string &varname, F &&function);
169 
171  const bf::path base_path_;
172 
174  int current_event_ = 0;
177 
190 };
191 
192 } // namespace smash
193 
194 #endif // SRC_INCLUDE_SMASH_VTKOUTPUT_H_
smash
Definition: action.h:24
outputparameters.h
smash::VtkOutput::vtk_v_landau_output_counter_
int vtk_v_landau_output_counter_
Number of Landau rest frame velocity vtk output in current event.
Definition: vtkoutput.h:185
smash::VtkOutput::thermodynamics_output
void thermodynamics_output(const ThermodynamicQuantity tq, const DensityType dt, RectangularLattice< DensityOnLattice > &lattice) override
Prints the density lattice in VTK format on a grid.
Definition: vtkoutput.cc:238
smash::DensityParameters
A class to pre-calculate and store parameters relevant for density calculation.
Definition: density.h:108
smash::VtkOutput::make_varname
std::string make_varname(const ThermodynamicQuantity tq, const DensityType dens_type)
Make a variable name given quantity and density type.
Definition: vtkoutput.cc:232
smash::VtkOutput::write_vtk_vector
void write_vtk_vector(std::ofstream &file, RectangularLattice< T > &lat, const std::string &varname, F &&function)
Write a VTK vector.
Definition: vtkoutput.cc:212
smash::VtkOutput::at_eventstart
void at_eventstart(const Particles &particles, const int event_number, const EventInfo &event) override
Writes the initial particle information list of an event to the VTK output.
Definition: vtkoutput.cc:60
smash::VtkOutput::at_eventend
void at_eventend(const Particles &particles, const int event_number, const EventInfo &event) override
Writes the final particle information list of an event to the VTK output.
Definition: vtkoutput.cc:76
smash::VtkOutput::write_vtk_scalar
void write_vtk_scalar(std::ofstream &file, RectangularLattice< T > &lat, const std::string &varname, F &&function)
Write a VTK scalar.
Definition: vtkoutput.cc:194
smash::VtkOutput::base_path_
const bf::path base_path_
filesystem path for output
Definition: vtkoutput.h:171
smash::EventInfo
Structure to contain custom data for output.
Definition: outputinterface.h:35
smash::VtkOutput::vtk_density_output_counter_
int vtk_density_output_counter_
Number of density lattice vtk output in current event.
Definition: vtkoutput.h:179
smash::VtkOutput::is_thermodynamics_output_
bool is_thermodynamics_output_
Is the VTK output a thermodynamics output.
Definition: vtkoutput.h:189
smash::VtkOutput::vtk_tmn_output_counter_
int vtk_tmn_output_counter_
Number of energy-momentum tensor lattice vtk output in current event.
Definition: vtkoutput.h:181
smash::VtkOutput::VtkOutput
VtkOutput(const bf::path &path, const std::string &name, const OutputParameters &out_par)
Create a new VTK output.
Definition: vtkoutput.cc:23
smash::VtkOutput::write_vtk_header
void write_vtk_header(std::ofstream &file, RectangularLattice< T > &lat, const std::string &description)
Write the VTK header.
Definition: vtkoutput.cc:177
forwarddeclarations.h
outputinterface.h
smash::OutputParameters
Helper structure for Experiment to hold output options and parameters.
Definition: outputparameters.h:25
smash::VtkOutput::~VtkOutput
~VtkOutput()
Definition: vtkoutput.cc:34
smash::RectangularLattice
A container class to hold all the arrays on the lattice and access them.
Definition: lattice.h:47
smash::VtkOutput::vtk_fluidization_counter_
int vtk_fluidization_counter_
Number of fluidization output.
Definition: vtkoutput.h:187
smash::OutputInterface
Abstraction of generic output.
Definition: outputinterface.h:65
density.h
smash::VtkOutput::vtk_tmn_landau_output_counter_
int vtk_tmn_landau_output_counter_
Number of Landau frame energy-momentum tensor vtk output in current event.
Definition: vtkoutput.h:183
smash::VtkOutput::vtk_output_counter_
int vtk_output_counter_
Number of vtk output in current event.
Definition: vtkoutput.h:176
smash::VtkOutput
Definition: vtkoutput.h:29
smash::VtkOutput::write
void write(const Particles &particles)
Write the given particles to the output.
Definition: vtkoutput.cc:89
smash::Particles
Definition: particles.h:33
smash::DensityType
DensityType
Allows to choose which kind of density to calculate.
Definition: density.h:36
smash::VtkOutput::make_filename
std::string make_filename(const std::string &description, int counter)
Make a file name given a description and a counter.
Definition: vtkoutput.cc:225
smash::VtkOutput::current_event_
int current_event_
Event number.
Definition: vtkoutput.h:174
ThermodynamicQuantity
ThermodynamicQuantity
Represents thermodynamic quantities that can be printed out.
Definition: forwarddeclarations.h:186
smash::GrandCanThermalizer
The GrandCanThermalizer class implements the following functionality:
Definition: grandcan_thermalizer.h:227
smash::VtkOutput::at_intermediate_time
void at_intermediate_time(const Particles &particles, const std::unique_ptr< Clock > &clock, const DensityParameters &dens_param, const EventInfo &event) override
Writes out all current particles.
Definition: vtkoutput.cc:79