Version: SMASH-1.5
outputinterface.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2014-2018
4  * SMASH Team
5  *
6  * GNU General Public License (GPLv3 or later)
7  *
8  */
9 
10 #ifndef SRC_INCLUDE_OUTPUTINTERFACE_H_
11 #define SRC_INCLUDE_OUTPUTINTERFACE_H_
12 
13 #include <string>
14 
15 #include "density.h"
16 #include "energymomentumtensor.h"
17 #include "forwarddeclarations.h"
18 #include "grandcan_thermalizer.h"
19 #include "lattice.h"
20 #include "macros.h"
21 
22 namespace smash {
23 
36  public:
41  explicit OutputInterface(std::string name)
42  : is_dilepton_output_(name == "Dileptons"),
43  is_photon_output_(name == "Photons") {}
44  virtual ~OutputInterface() = default;
45 
52  virtual void at_eventstart(const Particles &particles,
53  const int event_number) = 0;
54 
63  virtual void at_eventend(const Particles &particles, const int event_number,
64  double impact_parameter) = 0;
65 
73  virtual void at_interaction(const Action &action, const double density) {
74  SMASH_UNUSED(action);
75  SMASH_UNUSED(density);
76  }
77 
84  virtual void at_intermediate_time(const Particles &particles,
85  const Clock &clock,
86  const DensityParameters &dens_param) {
87  SMASH_UNUSED(particles);
88  SMASH_UNUSED(clock);
89  SMASH_UNUSED(dens_param);
90  }
91 
100  virtual void thermodynamics_output(
101  const ThermodynamicQuantity tq, const DensityType dt,
103  SMASH_UNUSED(tq);
104  SMASH_UNUSED(dt);
105  SMASH_UNUSED(lattice);
106  }
107 
117  virtual void thermodynamics_output(
118  const ThermodynamicQuantity tq, const DensityType dt,
120  SMASH_UNUSED(tq);
121  SMASH_UNUSED(dt);
122  SMASH_UNUSED(lattice);
123  }
124 
132  virtual void thermodynamics_output(const GrandCanThermalizer &gct) {
133  SMASH_UNUSED(gct);
134  }
135 
137  bool is_dilepton_output() const { return is_dilepton_output_; }
138 
140  bool is_photon_output() const { return is_photon_output_; }
141 
147  const char *to_string(const ThermodynamicQuantity tq) {
148  switch (tq) {
150  return "rho_eckart";
152  return "tmn";
154  return "tmn_landau";
156  return "v_landau";
157  }
158  throw std::invalid_argument("Unknown thermodynamic quantity.");
159  }
160 
166  const char *to_string(const DensityType dens_type) {
167  switch (dens_type) {
168  case DensityType::Hadron:
169  return "hadron";
170  case DensityType::Baryon:
171  return "net_baryon";
173  return "net_baryonI3";
174  case DensityType::Pion:
175  return "pion";
176  case DensityType::None:
177  return "none";
178  }
179  throw std::invalid_argument("Unknown density type.");
180  }
181 
182  protected:
185 
187  const bool is_photon_output_;
188 };
189 
190 } // namespace smash
191 
192 #endif // SRC_INCLUDE_OUTPUTINTERFACE_H_
#define SMASH_UNUSED(x)
Mark as unused, silencing compiler warnings.
Definition: macros.h:24
A class to pre-calculate and store parameters relevant for density calculation.
Definition: density.h:103
const char * to_string(const DensityType dens_type)
Convert density types to strings.
virtual void at_eventstart(const Particles &particles, const int event_number)=0
Output launched at event start after initialization, when particles are generated but not yet propaga...
const bool is_dilepton_output_
Is this the dilepton output?
virtual void thermodynamics_output(const GrandCanThermalizer &gct)
Output to write energy-momentum tensor and related quantities from the thermalizer class...
virtual void at_intermediate_time(const Particles &particles, const Clock &clock, const DensityParameters &dens_param)
Output launched after every N&#39;th timestep.
bool is_dilepton_output() const
Get, whether this is the dilepton output?
A container class to hold all the arrays on the lattice and access them.
Definition: lattice.h:46
virtual void at_interaction(const Action &action, const double density)
Called whenever an action modified one or more particles.
const bool is_photon_output_
Is this the photon output?
ThermodynamicQuantity
Represents thermodynamic quantities that can be printed out.
bool is_photon_output() const
Get, whether this is the photon output?
The GrandCanThermalizer class implements the following functionality:
virtual void thermodynamics_output(const ThermodynamicQuantity tq, const DensityType dt, RectangularLattice< DensityOnLattice > &lattice)
Output to write thermodynamics from the lattice.
Clock tracks the time in the simulation.
Definition: clock.h:75
Action is the base class for a generic process that takes a number of incoming particles and transfor...
Definition: action.h:34
const char * to_string(const ThermodynamicQuantity tq)
Convert thermodynamic quantities to strings.
The Particles class abstracts the storage and manipulation of particles.
Definition: particles.h:33
virtual void thermodynamics_output(const ThermodynamicQuantity tq, const DensityType dt, RectangularLattice< EnergyMomentumTensor > &lattice)
Output to write energy-momentum tensor and related quantities from the lattice.
DensityType
Allows to choose which kind of density to calculate.
Definition: density.h:34
OutputInterface(std::string name)
Construct output interface.
virtual ~OutputInterface()=default
virtual void at_eventend(const Particles &particles, const int event_number, double impact_parameter)=0
Output launched at event end.
Abstraction of generic output.
Definition: action.h:24