Version: SMASH-2.0.2
outputinterface.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_OUTPUTINTERFACE_H_
11 #define SRC_INCLUDE_SMASH_OUTPUTINTERFACE_H_
12 
13 #include <memory>
14 #include <string>
15 
16 #include "density.h"
17 #include "energymomentumtensor.h"
18 #include "forwarddeclarations.h"
19 #include "grandcan_thermalizer.h"
20 #include "lattice.h"
21 #include "macros.h"
22 
23 namespace smash {
24 static constexpr int LOutput = LogArea::Output::id;
25 
36 struct EventInfo {
40  double modus_length;
42  double current_time;
48  double total_energy;
53 };
54 
67  public:
72  explicit OutputInterface(std::string name)
73  : is_dilepton_output_(name == "Dileptons"),
74  is_photon_output_(name == "Photons"),
75  is_IC_output_(name == "SMASH_IC") {}
76  virtual ~OutputInterface() = default;
77 
85  virtual void at_eventstart(const Particles &particles, const int event_number,
86  const EventInfo &info) = 0;
87 
95  virtual void at_eventend(const Particles &particles, const int event_number,
96  const EventInfo &info) = 0;
97 
105  virtual void at_interaction(const Action &action, const double density) {
106  SMASH_UNUSED(action);
107  SMASH_UNUSED(density);
108  }
109 
117  virtual void at_intermediate_time(const Particles &particles,
118  const std::unique_ptr<Clock> &clock,
119  const DensityParameters &dens_param,
120  const EventInfo &info) {
121  SMASH_UNUSED(particles);
122  SMASH_UNUSED(clock);
123  SMASH_UNUSED(dens_param);
124  SMASH_UNUSED(info);
125  }
126 
135  virtual void thermodynamics_output(
136  const ThermodynamicQuantity tq, const DensityType dt,
138  SMASH_UNUSED(tq);
139  SMASH_UNUSED(dt);
140  SMASH_UNUSED(lattice);
141  }
142 
152  virtual void thermodynamics_output(
153  const ThermodynamicQuantity tq, const DensityType dt,
155  SMASH_UNUSED(tq);
156  SMASH_UNUSED(dt);
157  SMASH_UNUSED(lattice);
158  }
159 
167  virtual void thermodynamics_output(const GrandCanThermalizer &gct) {
168  SMASH_UNUSED(gct);
169  }
170 
172  bool is_dilepton_output() const { return is_dilepton_output_; }
173 
175  bool is_photon_output() const { return is_photon_output_; }
176 
178  bool is_IC_output() const { return is_IC_output_; }
179 
185  const char *to_string(const ThermodynamicQuantity tq) {
186  switch (tq) {
188  return "rho_eckart";
190  return "tmn";
192  return "tmn_landau";
194  return "v_landau";
196  return "j_QBS";
197  }
198  throw std::invalid_argument("Unknown thermodynamic quantity.");
199  }
200 
206  const char *to_string(const DensityType dens_type) {
207  switch (dens_type) {
208  case DensityType::Hadron:
209  return "hadron";
210  case DensityType::Baryon:
211  return "net_baryon";
213  return "net_baryonI3";
214  case DensityType::Pion:
215  return "pion";
217  return "tot_isospin3";
218  case DensityType::Charge:
219  return "charge";
221  return "strangeness";
222  case DensityType::None:
223  return "none";
224  }
225  throw std::invalid_argument("Unknown density type.");
226  }
227 
228  protected:
231 
233  const bool is_photon_output_;
234 
236  const bool is_IC_output_;
237 };
238 
239 } // namespace smash
240 
241 #endif // SRC_INCLUDE_SMASH_OUTPUTINTERFACE_H_
smash::DensityType::Strangeness
@ Strangeness
smash
Definition: action.h:24
smash::OutputInterface::OutputInterface
OutputInterface(std::string name)
Construct output interface.
Definition: outputinterface.h:72
ThermodynamicQuantity::TmnLandau
@ TmnLandau
ThermodynamicQuantity::LandauVelocity
@ LandauVelocity
smash::LOutput
static constexpr int LOutput
Definition: outputinterface.h:24
smash::DensityParameters
A class to pre-calculate and store parameters relevant for density calculation.
Definition: density.h:108
smash::OutputInterface::is_IC_output
bool is_IC_output() const
Get, whether this is the IC output?
Definition: outputinterface.h:178
smash::OutputInterface::to_string
const char * to_string(const ThermodynamicQuantity tq)
Convert thermodynamic quantities to strings.
Definition: outputinterface.h:185
smash::DensityType::BaryonicIsospin
@ BaryonicIsospin
macros.h
energymomentumtensor.h
smash::OutputInterface::~OutputInterface
virtual ~OutputInterface()=default
smash::EventInfo::test_particles
int test_particles
Testparticle number, see Testparticles in General.
Definition: outputinterface.h:50
smash::EventInfo
Structure to contain custom data for output.
Definition: outputinterface.h:36
smash::OutputInterface::is_photon_output
bool is_photon_output() const
Get, whether this is the photon output?
Definition: outputinterface.h:175
grandcan_thermalizer.h
smash::EventInfo::current_time
double current_time
Time in fm/c.
Definition: outputinterface.h:42
smash::OutputInterface::is_photon_output_
const bool is_photon_output_
Is this the photon output?
Definition: outputinterface.h:233
smash::OutputInterface::at_eventend
virtual void at_eventend(const Particles &particles, const int event_number, const EventInfo &info)=0
Output launched at event end.
forwarddeclarations.h
lattice.h
smash::DensityType::Charge
@ Charge
smash::OutputInterface::at_eventstart
virtual void at_eventstart(const Particles &particles, const int event_number, const EventInfo &info)=0
Output launched at event start after initialization, when particles are generated but not yet propaga...
smash::OutputInterface::at_interaction
virtual void at_interaction(const Action &action, const double density)
Called whenever an action modified one or more particles.
Definition: outputinterface.h:105
smash::EventInfo::total_kinetic_energy
double total_kinetic_energy
Sum of kinetic energies of all particles.
Definition: outputinterface.h:44
smash::OutputInterface::at_intermediate_time
virtual void at_intermediate_time(const Particles &particles, const std::unique_ptr< Clock > &clock, const DensityParameters &dens_param, const EventInfo &info)
Output launched after every N'th timestep.
Definition: outputinterface.h:117
smash::RectangularLattice
A container class to hold all the arrays on the lattice and access them.
Definition: lattice.h:47
ThermodynamicQuantity::Tmn
@ Tmn
smash::OutputInterface
Abstraction of generic output.
Definition: outputinterface.h:66
density.h
smash::DensityType::Pion
@ Pion
smash::OutputInterface::is_dilepton_output_
const bool is_dilepton_output_
Is this the dilepton output?
Definition: outputinterface.h:230
smash::EventInfo::total_mean_field_energy
double total_mean_field_energy
Total energy in the mean field.
Definition: outputinterface.h:46
smash::OutputInterface::is_dilepton_output
bool is_dilepton_output() const
Get, whether this is the dilepton output?
Definition: outputinterface.h:172
ThermodynamicQuantity::EckartDensity
@ EckartDensity
SMASH_UNUSED
#define SMASH_UNUSED(x)
Mark as unused, silencing compiler warnings.
Definition: macros.h:24
smash::EventInfo::total_energy
double total_energy
Kinetic + mean field energy.
Definition: outputinterface.h:48
smash::Particles
Definition: particles.h:33
smash::DensityType
DensityType
Allows to choose which kind of density to calculate.
Definition: density.h:36
smash::EventInfo::empty_event
bool empty_event
True if no collisions happened.
Definition: outputinterface.h:52
smash::Action
Definition: action.h:35
ThermodynamicQuantity
ThermodynamicQuantity
Represents thermodynamic quantities that can be printed out.
Definition: forwarddeclarations.h:186
smash::DensityType::None
@ None
smash::EventInfo::modus_length
double modus_length
Box length in case of box simulation, otherwise dummy.
Definition: outputinterface.h:40
smash::DensityType::Isospin3_tot
@ Isospin3_tot
ThermodynamicQuantity::j_QBS
@ j_QBS
smash::EventInfo::impact_parameter
double impact_parameter
Impact parameter for collider modus, otherwise dummy.
Definition: outputinterface.h:38
smash::GrandCanThermalizer
The GrandCanThermalizer class implements the following functionality:
Definition: grandcan_thermalizer.h:227
smash::DensityType::Hadron
@ Hadron
smash::DensityType::Baryon
@ Baryon
smash::OutputInterface::is_IC_output_
const bool is_IC_output_
Is this the IC output?
Definition: outputinterface.h:236
smash::OutputInterface::to_string
const char * to_string(const DensityType dens_type)
Convert density types to strings.
Definition: outputinterface.h:206
smash::OutputInterface::thermodynamics_output
virtual void thermodynamics_output(const ThermodynamicQuantity tq, const DensityType dt, RectangularLattice< DensityOnLattice > &lattice)
Output to write thermodynamics from the lattice.
Definition: outputinterface.h:135
smash::OutputInterface::thermodynamics_output
virtual void thermodynamics_output(const GrandCanThermalizer &gct)
Output to write energy-momentum tensor and related quantities from the thermalizer class.
Definition: outputinterface.h:167
smash::OutputInterface::thermodynamics_output
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.
Definition: outputinterface.h:152