Version: SMASH-3.4
smash::VtkOutput Class Reference

#include <vtkoutput.h>

Output format processible by ParaView , intended for simple visualization.

Definition at line 31 of file vtkoutput.h.

Inheritance diagram for smash::VtkOutput:
[legend]
Collaboration diagram for smash::VtkOutput:
[legend]

Public Member Functions

 VtkOutput (const std::filesystem::path &path, const std::string &name, const OutputParameters &out_par)
 Create a new VTK output. More...
 
 ~VtkOutput ()
 
void at_eventstart (const Particles &particles, const EventLabel &event_label, const EventInfo &event) override
 Writes the initial particle information list of an event to the VTK output. More...
 
void at_eventend (const Particles &particles, const EventLabel &event_label, const EventInfo &event) override
 Writes the final particle information list of an event to the VTK output. More...
 
void at_intermediate_time (const Particles &particles, const std::unique_ptr< Clock > &clock, const DensityParameters &dens_param, const EventLabel &event_label, const EventInfo &event) override
 Writes out all current particles. More...
 
void thermodynamics_output (const ThermodynamicQuantity tq, const DensityType dt, RectangularLattice< DensityOnLattice > &lattice) override
 Prints the density lattice in VTK format on a grid. More...
 
void thermodynamics_output (const ThermodynamicQuantity tq, const DensityType dt, RectangularLattice< EnergyMomentumTensor > &lattice) override
 Prints the energy-momentum-tensor lattice in VTK format on a grid. More...
 
void thermodynamics_output (const GrandCanThermalizer &gct) override
 Printout of all thermodynamic quantities from the thermalizer class. More...
 
void fields_output (const std::string name1, const std::string name2, RectangularLattice< std::pair< ThreeVector, ThreeVector >> &lat) override
 Write fields in vtk output Fields are a pair of threevectors for example electric and magnetic field. More...
 
- Public Member Functions inherited from smash::OutputInterface
 OutputInterface (std::string name)
 Construct output interface. More...
 
virtual ~OutputInterface ()=0
 Pure virtual destructor to make class abstract and prevent its instantiation. More...
 
virtual void at_eventstart (const std::vector< Particles > &, int)
 Output launched at event start after initialization, when particles are generated but not yet propagated. More...
 
virtual void at_eventstart (const int, const ThermodynamicQuantity, const DensityType, RectangularLattice< DensityOnLattice >)
 Output launched at event start after initialization, when particles are generated but not yet propagated. More...
 
virtual void at_eventstart (const int, const ThermodynamicQuantity, const DensityType, RectangularLattice< EnergyMomentumTensor >)
 Output launched at event start after initialization, when particles are generated but not yet propagated. More...
 
virtual void at_eventend (const ThermodynamicQuantity)
 Output launched at event end. More...
 
virtual void at_eventend (const std::vector< Particles > &, const int)
 Output launched at event end. More...
 
virtual void at_interaction (const Action &, const double)
 Called whenever an action modified one or more particles. More...
 
virtual void at_intermediate_time (const std::vector< Particles > &, const std::unique_ptr< Clock > &, const DensityParameters &)
 Output launched after every N'th timestep. More...
 
virtual void thermodynamics_lattice_output (RectangularLattice< DensityOnLattice > &, const double)
 Output to write thermodynamics from the lattice. More...
 
virtual void thermodynamics_lattice_output (RectangularLattice< DensityOnLattice > &, const double, const std::vector< Particles > &, const DensityParameters &)
 Output to write thermodynamics from the lattice. More...
 
virtual void thermodynamics_lattice_output (const ThermodynamicQuantity, RectangularLattice< EnergyMomentumTensor > &, const double)
 Output to write energy-momentum tensor and related quantities from the lattice. More...
 
bool is_dilepton_output () const
 Get, whether this is the dilepton output? More...
 
bool is_photon_output () const
 Get, whether this is the photon output? More...
 
bool is_IC_output () const
 Get, whether this is the IC output? More...
 
const char * to_string (const ThermodynamicQuantity tq)
 Convert thermodynamic quantities to strings. More...
 
const char * to_string (const DensityType dens_type)
 Convert density types to strings. More...
 

Private Member Functions

void write (const Particles &particles)
 Write the given particles to the output. More...
 
std::string make_filename (const std::string &description, int counter)
 Make a file name given a description and a counter. More...
 
std::string make_varname (const ThermodynamicQuantity tq, const DensityType dens_type)
 Make a variable name given quantity and density type. More...
 
template<typename T >
void write_vtk_header (std::ofstream &file, RectangularLattice< T > &lat, const std::string &description)
 Write the VTK header. More...
 
template<typename T , typename F >
void write_vtk_scalar (std::ofstream &file, RectangularLattice< T > &lat, const std::string &varname, F &&function)
 Write a VTK scalar. More...
 
template<typename T , typename F >
void write_vtk_vector (std::ofstream &file, RectangularLattice< T > &lat, const std::string &varname, F &&function)
 Write a VTK vector. More...
 
std::pair< int, int > counter_key ()
 Create the key to access the vtk_output_counter_ map. More...
 

Private Attributes

const std::filesystem::path base_path_
 filesystem path for output More...
 
int current_event_ = 0
 Event number. More...
 
int current_ensemble_ = 0
 Ensemble number. More...
 
std::map< std::pair< int, int >, int > vtk_output_counter_ {}
 Counters to keep track of time steps per event and per ensemble. More...
 
int vtk_density_output_counter_ = 0
 Number of density lattice vtk output in current event. More...
 
int vtk_tmn_output_counter_ = 0
 Number of energy-momentum tensor lattice vtk output in current event. More...
 
int vtk_tmn_landau_output_counter_ = 0
 Number of Landau frame energy-momentum tensor vtk output in current event. More...
 
int vtk_v_landau_output_counter_ = 0
 Number of Landau rest frame velocity vtk output in current event. More...
 
int vtk_fluidization_counter_ = 0
 Number of fluidization output. More...
 
int vtk_fields_output_counter_ = 0
 Number of fields output in current event. More...
 
bool is_thermodynamics_output_
 Is the VTK output a thermodynamics output. More...
 
bool is_fields_output_
 Is the VTK output an output for fields. More...
 

Additional Inherited Members

- Protected Attributes inherited from smash::OutputInterface
const bool is_dilepton_output_
 Is this the dilepton output? More...
 
const bool is_photon_output_
 Is this the photon output? More...
 
const bool is_IC_output_
 Is this the IC output? More...
 

Constructor & Destructor Documentation

◆ VtkOutput()

smash::VtkOutput::VtkOutput ( const std::filesystem::path &  path,
const std::string &  name,
const OutputParameters out_par 
)

Create a new VTK output.

Parameters
pathPath to the output file.
nameName of the output.
out_parAdditional information on the configured output.

Definition at line 24 of file vtkoutput.cc.

26  : OutputInterface(name),
27  base_path_(std::move(path)),
28  is_thermodynamics_output_(name == "Thermodynamics"),
29  is_fields_output_(name == "Fields") {
30  if (out_par.part_extended) {
31  logg[LOutput].warn()
32  << "Creating VTK output: There is no extended VTK format.";
33  }
34 }
OutputInterface(std::string name)
Construct output interface.
bool is_fields_output_
Is the VTK output an output for fields.
Definition: vtkoutput.h:217
bool is_thermodynamics_output_
Is the VTK output a thermodynamics output.
Definition: vtkoutput.h:215
const std::filesystem::path base_path_
filesystem path for output
Definition: vtkoutput.h:189
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > & logg
An array that stores all pre-configured Logger objects.
Definition: logging.h:245
static constexpr int LOutput

◆ ~VtkOutput()

smash::VtkOutput::~VtkOutput ( )

Definition at line 36 of file vtkoutput.cc.

36 {}

Member Function Documentation

◆ at_eventstart()

void smash::VtkOutput::at_eventstart ( const Particles particles,
const EventLabel event_label,
const EventInfo event 
)
overridevirtual

Writes the initial particle information list of an event to the VTK output.

Parameters
particlesCurrent list of all particles.
event_labelNumbers of the current event and ensemble.
eventEvent info, see event_info

Reimplemented from smash::OutputInterface.

Definition at line 93 of file vtkoutput.cc.

95  {
101 
102  current_event_ = event_label.event_number;
103  current_ensemble_ = event_label.ensemble_number;
106  write(particles);
108  }
109 }
int vtk_density_output_counter_
Number of density lattice vtk output in current event.
Definition: vtkoutput.h:203
std::pair< int, int > counter_key()
Create the key to access the vtk_output_counter_ map.
Definition: vtkoutput.h:184
void write(const Particles &particles)
Write the given particles to the output.
Definition: vtkoutput.cc:128
int vtk_fluidization_counter_
Number of fluidization output.
Definition: vtkoutput.h:211
int current_event_
Event number.
Definition: vtkoutput.h:192
int current_ensemble_
Ensemble number.
Definition: vtkoutput.h:194
std::map< std::pair< int, int >, int > vtk_output_counter_
Counters to keep track of time steps per event and per ensemble.
Definition: vtkoutput.h:200
int vtk_tmn_landau_output_counter_
Number of Landau frame energy-momentum tensor vtk output in current event.
Definition: vtkoutput.h:207
int vtk_v_landau_output_counter_
Number of Landau rest frame velocity vtk output in current event.
Definition: vtkoutput.h:209
int vtk_tmn_output_counter_
Number of energy-momentum tensor lattice vtk output in current event.
Definition: vtkoutput.h:205
Here is the call graph for this function:

◆ at_eventend()

void smash::VtkOutput::at_eventend ( const Particles particles,
const EventLabel event_label,
const EventInfo event 
)
overridevirtual

Writes the final particle information list of an event to the VTK output.

This currently does not do anything, because it is not required for the VTK output.

Parameters
particlesUnused, needed since inherited.
event_labelUnused, needed since inherited.
[in]eventEvent info, see event_info

Reimplemented from smash::OutputInterface.

Definition at line 111 of file vtkoutput.cc.

113  {}

◆ at_intermediate_time()

void smash::VtkOutput::at_intermediate_time ( const Particles particles,
const std::unique_ptr< Clock > &  clock,
const DensityParameters dens_param,
const EventLabel event_label,
const EventInfo event 
)
overridevirtual

Writes out all current particles.

Parameters
particlesCurrent list of particles.
clockUnused, needed since inherited.
dens_paramUnused, needed since inherited.
event_labelNumbers of the current event and ensemble.
eventEvent info, see event_info

Reimplemented from smash::OutputInterface.

Definition at line 115 of file vtkoutput.cc.

119  {
120  current_event_ = event_label.event_number;
121  current_ensemble_ = event_label.ensemble_number;
123  write(particles);
125  }
126 }
Here is the call graph for this function:

◆ thermodynamics_output() [1/3]

void smash::VtkOutput::thermodynamics_output ( const ThermodynamicQuantity  tq,
const DensityType  dt,
RectangularLattice< DensityOnLattice > &  lattice 
)
overridevirtual

Prints the density lattice in VTK format on a grid.

Parameters
tqThe quantity whose density should be written, see ThermodynamicQuantity.
dtThe type of the density, see DensityType.
latticeThe lattice from which the quantity is taken.

Reimplemented from smash::OutputInterface.

Definition at line 269 of file vtkoutput.cc.

271  {
273  return;
274  }
275  std::ofstream file;
276  const std::string varname = make_varname(tq, dens_type);
277  file.open(make_filename(varname, vtk_density_output_counter_), std::ios::out);
278  write_vtk_header(file, lattice, varname);
279  write_vtk_scalar(file, lattice, varname,
280  [&](DensityOnLattice &node) { return node.rho(); });
282 }
void write_vtk_scalar(std::ofstream &file, RectangularLattice< T > &lat, const std::string &varname, F &&function)
Write a VTK scalar.
Definition: vtkoutput.cc:225
void write_vtk_header(std::ofstream &file, RectangularLattice< T > &lat, const std::string &description)
Write the VTK header.
Definition: vtkoutput.cc:208
std::string make_varname(const ThermodynamicQuantity tq, const DensityType dens_type)
Make a variable name given quantity and density type.
Definition: vtkoutput.cc:263
std::string make_filename(const std::string &description, int counter)
Make a file name given a description and a counter.
Definition: vtkoutput.cc:256
constexpr Section lattice
Section for the lattice.
Definition: input_keys.h:149
Here is the call graph for this function:

◆ thermodynamics_output() [2/3]

void smash::VtkOutput::thermodynamics_output ( const ThermodynamicQuantity  tq,
const DensityType  dt,
RectangularLattice< EnergyMomentumTensor > &  lattice 
)
overridevirtual

Prints the energy-momentum-tensor lattice in VTK format on a grid.

Parameters
tqThe quantity whose density should be written, see ThermodynamicQuantity.
dtThe type of the density, see DensityType
latticeThe lattice from which the quantity is taken.

Reimplemented from smash::OutputInterface.

Definition at line 284 of file vtkoutput.cc.

286  {
288  return;
289  }
290  std::ofstream file;
291  const std::string varname = make_varname(tq, dens_type);
292 
293  if (tq == ThermodynamicQuantity::Tmn) {
294  file.open(make_filename(varname, vtk_tmn_output_counter_++), std::ios::out);
295  write_vtk_header(file, Tmn_lattice, varname);
296  for (int i = 0; i < 4; i++) {
297  for (int j = i; j < 4; j++) {
298  write_vtk_scalar(file, Tmn_lattice,
299  varname + std::to_string(i) + std::to_string(j),
300  [&](EnergyMomentumTensor &node) {
301  return node[EnergyMomentumTensor::tmn_index(i, j)];
302  });
303  }
304  }
305  } else if (tq == ThermodynamicQuantity::TmnLandau) {
306  file.open(make_filename(varname, vtk_tmn_landau_output_counter_++),
307  std::ios::out);
308  write_vtk_header(file, Tmn_lattice, varname);
309  for (int i = 0; i < 4; i++) {
310  for (int j = i; j < 4; j++) {
311  write_vtk_scalar(file, Tmn_lattice,
312  varname + std::to_string(i) + std::to_string(j),
313  [&](EnergyMomentumTensor &node) {
314  const FourVector u = node.landau_frame_4velocity();
315  const EnergyMomentumTensor Tmn_L = node.boosted(u);
316  return Tmn_L[EnergyMomentumTensor::tmn_index(i, j)];
317  });
318  }
319  }
320  } else {
321  file.open(make_filename(varname, vtk_v_landau_output_counter_++),
322  std::ios::out);
323  write_vtk_header(file, Tmn_lattice, varname);
324  write_vtk_vector(file, Tmn_lattice, varname,
325  [&](EnergyMomentumTensor &node) {
326  const FourVector u = node.landau_frame_4velocity();
327  return -u.velocity();
328  });
329  }
330 }
static std::int8_t tmn_index(std::int8_t mu, std::int8_t nu)
Access the index of component .
void write_vtk_vector(std::ofstream &file, RectangularLattice< T > &lat, const std::string &varname, F &&function)
Write a VTK vector.
Definition: vtkoutput.cc:243
@ Tmn
Energy-momentum tensor in lab frame.
@ TmnLandau
Energy-momentum tensor in Landau rest frame.
std::string to_string(ThermodynamicQuantity quantity)
Convert a ThermodynamicQuantity enum value to its corresponding string.
Definition: stringify.cc:26
Here is the call graph for this function:

◆ thermodynamics_output() [3/3]

void smash::VtkOutput::thermodynamics_output ( const GrandCanThermalizer gct)
overridevirtual

Printout of all thermodynamic quantities from the thermalizer class.

Parameters
gctGrand-canonical thermalizer from which the quantities are taken.

Reimplemented from smash::OutputInterface.

Definition at line 353 of file vtkoutput.cc.

353  {
355  return;
356  }
357  std::ofstream file;
358  file.open(make_filename("fluidization_td", vtk_fluidization_counter_++),
359  std::ios::out);
360  write_vtk_header(file, gct.lattice(), "fluidization_td");
361  write_vtk_scalar(file, gct.lattice(), "e",
362  [&](ThermLatticeNode &node) { return node.e(); });
363  write_vtk_scalar(file, gct.lattice(), "p",
364  [&](ThermLatticeNode &node) { return node.p(); });
365  write_vtk_vector(file, gct.lattice(), "v",
366  [&](ThermLatticeNode &node) { return node.v(); });
367  write_vtk_scalar(file, gct.lattice(), "T",
368  [&](ThermLatticeNode &node) { return node.T(); });
369  write_vtk_scalar(file, gct.lattice(), "mub",
370  [&](ThermLatticeNode &node) { return node.mub(); });
371  write_vtk_scalar(file, gct.lattice(), "mus",
372  [&](ThermLatticeNode &node) { return node.mus(); });
373 }
Here is the call graph for this function:

◆ fields_output()

void smash::VtkOutput::fields_output ( const std::string  name1,
const std::string  name2,
RectangularLattice< std::pair< ThreeVector, ThreeVector >> &  lat 
)
overridevirtual

Write fields in vtk output Fields are a pair of threevectors for example electric and magnetic field.

Reimplemented from smash::OutputInterface.

Definition at line 332 of file vtkoutput.cc.

334  {
335  if (!is_fields_output_) {
336  return;
337  }
338  std::ofstream file1;
339  file1.open(make_filename(name1, vtk_fields_output_counter_), std::ios::out);
340  write_vtk_header(file1, lat, name1);
342  file1, lat, name1,
343  [&](std::pair<ThreeVector, ThreeVector> &node) { return node.first; });
344  std::ofstream file2;
345  file2.open(make_filename(name2, vtk_fields_output_counter_), std::ios::out);
346  write_vtk_header(file2, lat, name2);
348  file2, lat, name2,
349  [&](std::pair<ThreeVector, ThreeVector> &node) { return node.second; });
351 }
int vtk_fields_output_counter_
Number of fields output in current event.
Definition: vtkoutput.h:213
Here is the call graph for this function:

◆ write()

void smash::VtkOutput::write ( const Particles particles)
private

Write the given particles to the output.

Parameters
particlesThe particles.

Definition at line 128 of file vtkoutput.cc.

128  {
129  char filename[64];
130  snprintf(filename, sizeof(filename), "pos_ev%05i_ens%05i_tstep%05i.vtk",
133  FilePtr file_{std::fopen((base_path_ / filename).native().c_str(), "w")};
134 
135  /* Legacy VTK file format */
136  std::fprintf(file_.get(), "# vtk DataFile Version 2.0\n");
137  std::fprintf(file_.get(), "Generated from molecular-offset data %s\n",
138  SMASH_VERSION);
139  std::fprintf(file_.get(), "ASCII\n");
140 
141  /* Unstructured data sets are composed of points, lines, polygons, .. */
142  std::fprintf(file_.get(), "DATASET UNSTRUCTURED_GRID\n");
143  std::fprintf(file_.get(), "POINTS %zu double\n", particles.size());
144  for (const auto &p : particles) {
145  std::fprintf(file_.get(), "%g %g %g\n", p.position().x1(),
146  p.position().x2(), p.position().x3());
147  }
148  std::fprintf(file_.get(), "CELLS %zu %zu\n", particles.size(),
149  particles.size() * 2);
150  for (size_t point_index = 0; point_index < particles.size(); point_index++) {
151  std::fprintf(file_.get(), "1 %zu\n", point_index);
152  }
153  std::fprintf(file_.get(), "CELL_TYPES %zu\n", particles.size());
154  for (size_t point_index = 0; point_index < particles.size(); point_index++) {
155  std::fprintf(file_.get(), "1\n");
156  }
157  std::fprintf(file_.get(), "POINT_DATA %zu\n", particles.size());
158  std::fprintf(file_.get(), "SCALARS pdg_codes int 1\n");
159  std::fprintf(file_.get(), "LOOKUP_TABLE default\n");
160  for (const auto &p : particles) {
161  std::fprintf(file_.get(), "%s\n", p.pdgcode().string().c_str());
162  }
163  std::fprintf(file_.get(), "SCALARS is_formed int 1\n");
164  std::fprintf(file_.get(), "LOOKUP_TABLE default\n");
165  double current_time = particles.time();
166  for (const auto &p : particles) {
167  std::fprintf(file_.get(), "%s\n",
168  (p.formation_time() > current_time) ? "0" : "1");
169  }
170  std::fprintf(file_.get(), "SCALARS cross_section_scaling_factor double 1\n");
171  std::fprintf(file_.get(), "LOOKUP_TABLE default\n");
172  for (const auto &p : particles) {
173  std::fprintf(file_.get(), "%g\n", p.xsec_scaling_factor());
174  }
175  std::fprintf(file_.get(), "SCALARS mass double 1\n");
176  std::fprintf(file_.get(), "LOOKUP_TABLE default\n");
177  for (const auto &p : particles) {
178  std::fprintf(file_.get(), "%g\n", p.effective_mass());
179  }
180  std::fprintf(file_.get(), "SCALARS N_coll int 1\n");
181  std::fprintf(file_.get(), "LOOKUP_TABLE default\n");
182  for (const auto &p : particles) {
183  std::fprintf(file_.get(), "%i\n", p.get_history().collisions_per_particle);
184  }
185  std::fprintf(file_.get(), "SCALARS particle_ID int 1\n");
186  std::fprintf(file_.get(), "LOOKUP_TABLE default\n");
187  for (const auto &p : particles) {
188  std::fprintf(file_.get(), "%i\n", p.id());
189  }
190  std::fprintf(file_.get(), "SCALARS baryon_number int 1\n");
191  std::fprintf(file_.get(), "LOOKUP_TABLE default\n");
192  for (const auto &p : particles) {
193  std::fprintf(file_.get(), "%i\n", p.pdgcode().baryon_number());
194  }
195  std::fprintf(file_.get(), "SCALARS strangeness int 1\n");
196  std::fprintf(file_.get(), "LOOKUP_TABLE default\n");
197  for (const auto &p : particles) {
198  std::fprintf(file_.get(), "%i\n", p.pdgcode().strangeness());
199  }
200  std::fprintf(file_.get(), "VECTORS momentum double\n");
201  for (const auto &p : particles) {
202  std::fprintf(file_.get(), "%g %g %g\n", p.momentum().x1(),
203  p.momentum().x2(), p.momentum().x3());
204  }
205 }
constexpr int p
Proton.
std::unique_ptr< std::FILE, FileDeleter > FilePtr
A RAII type to replace std::FILE *.
Definition: file.h:61
FilePtr fopen(const std::filesystem::path &filename, const std::string &mode)
Open a file with given mode.
Definition: file.cc:14
Here is the call graph for this function:
Here is the caller graph for this function:

◆ make_filename()

std::string smash::VtkOutput::make_filename ( const std::string &  description,
int  counter 
)
private

Make a file name given a description and a counter.

Parameters
descriptionThe description.
counterThe counter enumerating the outputs.

Definition at line 256 of file vtkoutput.cc.

256  {
257  char suffix[22];
258  snprintf(suffix, sizeof(suffix), "_%05i_tstep%05i.vtk", current_event_,
259  counter);
260  return base_path_.string() + std::string("/") + descr + std::string(suffix);
261 }
Here is the caller graph for this function:

◆ make_varname()

std::string smash::VtkOutput::make_varname ( const ThermodynamicQuantity  tq,
const DensityType  dens_type 
)
private

Make a variable name given quantity and density type.

Parameters
tqThe quantity.
dens_typeThe density type.

Definition at line 263 of file vtkoutput.cc.

264  {
265  return std::string(to_string(dens_type)) + std::string("_") +
266  std::string(to_string(tq));
267 }
const char * to_string(const ThermodynamicQuantity tq)
Convert thermodynamic quantities to strings.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_vtk_header()

template<typename T >
void smash::VtkOutput::write_vtk_header ( std::ofstream &  file,
RectangularLattice< T > &  lat,
const std::string &  description 
)
private

Write the VTK header.

Parameters
fileOutput file.
latLattice corresponding to output.
descriptionDescription of the output.

Definition at line 208 of file vtkoutput.cc.

210  {
211  const auto dim = lattice.n_cells();
212  const auto cs = lattice.cell_sizes();
213  const auto orig = lattice.origin();
214  file << "# vtk DataFile Version 2.0\n"
215  << description << "\n"
216  << "ASCII\n"
217  << "DATASET STRUCTURED_POINTS\n"
218  << "DIMENSIONS " << dim[0] << " " << dim[1] << " " << dim[2] << "\n"
219  << "SPACING " << cs[0] << " " << cs[1] << " " << cs[2] << "\n"
220  << "ORIGIN " << orig[0] << " " << orig[1] << " " << orig[2] << "\n"
221  << "POINT_DATA " << lattice.size() << "\n";
222 }
Here is the caller graph for this function:

◆ write_vtk_scalar()

template<typename T , typename F >
void smash::VtkOutput::write_vtk_scalar ( std::ofstream &  file,
RectangularLattice< T > &  lat,
const std::string &  varname,
F &&  function 
)
private

Write a VTK scalar.

Parameters
fileOutput file.
latLattice corresponding to output.
varnameName of the output variable.
functionFunction that gets the scalar given a lattice node.

Definition at line 225 of file vtkoutput.cc.

227  {
228  file << "SCALARS " << varname << " double 1\n"
229  << "LOOKUP_TABLE default\n";
230  file << std::setprecision(3);
231  file << std::fixed;
232  const auto dim = lattice.n_cells();
233  lattice.iterate_sublattice({0, 0, 0}, dim, [&](T &node, int ix, int, int) {
234  const double f_from_node = get_quantity(node);
235  file << f_from_node << " ";
236  if (ix == dim[0] - 1) {
237  file << "\n";
238  }
239  });
240 }
Here is the caller graph for this function:

◆ write_vtk_vector()

template<typename T , typename F >
void smash::VtkOutput::write_vtk_vector ( std::ofstream &  file,
RectangularLattice< T > &  lat,
const std::string &  varname,
F &&  function 
)
private

Write a VTK vector.

Parameters
fileOutput file.
latLattice corresponding to output.
varnameName of the output variable.
functionFunction that gets the vector given a lattice node.

Definition at line 243 of file vtkoutput.cc.

245  {
246  file << "VECTORS " << varname << " double\n";
247  file << std::setprecision(3);
248  file << std::fixed;
249  const auto dim = lattice.n_cells();
250  lattice.iterate_sublattice({0, 0, 0}, dim, [&](T &node, int, int, int) {
251  const ThreeVector v = get_quantity(node);
252  file << v.x1() << " " << v.x2() << " " << v.x3() << "\n";
253  });
254 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ counter_key()

std::pair<int, int> smash::VtkOutput::counter_key ( )
inlineprivate

Create the key to access the vtk_output_counter_ map.

Returns
std::pair<int, int> The key to access the map.

Definition at line 184 of file vtkoutput.h.

184  {
186  }
Here is the caller graph for this function:

Member Data Documentation

◆ base_path_

const std::filesystem::path smash::VtkOutput::base_path_
private

filesystem path for output

Definition at line 189 of file vtkoutput.h.

◆ current_event_

int smash::VtkOutput::current_event_ = 0
private

Event number.

Definition at line 192 of file vtkoutput.h.

◆ current_ensemble_

int smash::VtkOutput::current_ensemble_ = 0
private

Ensemble number.

Definition at line 194 of file vtkoutput.h.

◆ vtk_output_counter_

std::map<std::pair<int, int>, int> smash::VtkOutput::vtk_output_counter_ {}
private

Counters to keep track of time steps per event and per ensemble.

The first pair index runs over events and the second one over ensembles, but this is encapsulated in the counter_key method which is used to change this map.

Definition at line 200 of file vtkoutput.h.

◆ vtk_density_output_counter_

int smash::VtkOutput::vtk_density_output_counter_ = 0
private

Number of density lattice vtk output in current event.

Definition at line 203 of file vtkoutput.h.

◆ vtk_tmn_output_counter_

int smash::VtkOutput::vtk_tmn_output_counter_ = 0
private

Number of energy-momentum tensor lattice vtk output in current event.

Definition at line 205 of file vtkoutput.h.

◆ vtk_tmn_landau_output_counter_

int smash::VtkOutput::vtk_tmn_landau_output_counter_ = 0
private

Number of Landau frame energy-momentum tensor vtk output in current event.

Definition at line 207 of file vtkoutput.h.

◆ vtk_v_landau_output_counter_

int smash::VtkOutput::vtk_v_landau_output_counter_ = 0
private

Number of Landau rest frame velocity vtk output in current event.

Definition at line 209 of file vtkoutput.h.

◆ vtk_fluidization_counter_

int smash::VtkOutput::vtk_fluidization_counter_ = 0
private

Number of fluidization output.

Definition at line 211 of file vtkoutput.h.

◆ vtk_fields_output_counter_

int smash::VtkOutput::vtk_fields_output_counter_ = 0
private

Number of fields output in current event.

Definition at line 213 of file vtkoutput.h.

◆ is_thermodynamics_output_

bool smash::VtkOutput::is_thermodynamics_output_
private

Is the VTK output a thermodynamics output.

Definition at line 215 of file vtkoutput.h.

◆ is_fields_output_

bool smash::VtkOutput::is_fields_output_
private

Is the VTK output an output for fields.

Definition at line 217 of file vtkoutput.h.


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