Version: SMASH-2.0
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 
35 struct EventInfo {
39  double modus_length;
41  double current_time;
47  double total_energy;
52 };
53 
66  public:
71  explicit OutputInterface(std::string name)
72  : is_dilepton_output_(name == "Dileptons"),
73  is_photon_output_(name == "Photons"),
74  is_IC_output_(name == "SMASH_IC") {}
75  virtual ~OutputInterface() = default;
76 
84  virtual void at_eventstart(const Particles &particles, const int event_number,
85  const EventInfo &info) = 0;
86 
94  virtual void at_eventend(const Particles &particles, const int event_number,
95  const EventInfo &info) = 0;
96 
104  virtual void at_interaction(const Action &action, const double density) {
105  SMASH_UNUSED(action);
106  SMASH_UNUSED(density);
107  }
108 
116  virtual void at_intermediate_time(const Particles &particles,
117  const std::unique_ptr<Clock> &clock,
118  const DensityParameters &dens_param,
119  const EventInfo &info) {
120  SMASH_UNUSED(particles);
121  SMASH_UNUSED(clock);
122  SMASH_UNUSED(dens_param);
123  SMASH_UNUSED(info);
124  }
125 
134  virtual void thermodynamics_output(
135  const ThermodynamicQuantity tq, const DensityType dt,
137  SMASH_UNUSED(tq);
138  SMASH_UNUSED(dt);
139  SMASH_UNUSED(lattice);
140  }
141 
151  virtual void thermodynamics_output(
152  const ThermodynamicQuantity tq, const DensityType dt,
154  SMASH_UNUSED(tq);
155  SMASH_UNUSED(dt);
156  SMASH_UNUSED(lattice);
157  }
158 
166  virtual void thermodynamics_output(const GrandCanThermalizer &gct) {
167  SMASH_UNUSED(gct);
168  }
169 
171  bool is_dilepton_output() const { return is_dilepton_output_; }
172 
174  bool is_photon_output() const { return is_photon_output_; }
175 
177  bool is_IC_output() const { return is_IC_output_; }
178 
184  const char *to_string(const ThermodynamicQuantity tq) {
185  switch (tq) {
187  return "rho_eckart";
189  return "tmn";
191  return "tmn_landau";
193  return "v_landau";
195  return "j_QBS";
196  }
197  throw std::invalid_argument("Unknown thermodynamic quantity.");
198  }
199 
205  const char *to_string(const DensityType dens_type) {
206  switch (dens_type) {
207  case DensityType::Hadron:
208  return "hadron";
209  case DensityType::Baryon:
210  return "net_baryon";
212  return "net_baryonI3";
213  case DensityType::Pion:
214  return "pion";
216  return "tot_isospin3";
217  case DensityType::Charge:
218  return "charge";
220  return "strangeness";
221  case DensityType::None:
222  return "none";
223  }
224  throw std::invalid_argument("Unknown density type.");
225  }
226 
227  protected:
230 
232  const bool is_photon_output_;
233 
235  const bool is_IC_output_;
236 };
237 
238 } // namespace smash
239 
240 #endif // SRC_INCLUDE_SMASH_OUTPUTINTERFACE_H_
smash::DensityType::Strangeness
smash
Definition: action.h:24
smash::OutputInterface::OutputInterface
OutputInterface(std::string name)
Construct output interface.
Definition: outputinterface.h:71
ThermodynamicQuantity::TmnLandau
ThermodynamicQuantity::LandauVelocity
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:177
smash::OutputInterface::to_string
const char * to_string(const ThermodynamicQuantity tq)
Convert thermodynamic quantities to strings.
Definition: outputinterface.h:184
smash::DensityType::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:49
smash::EventInfo
Structure to contain custom data for output.
Definition: outputinterface.h:35
smash::OutputInterface::is_photon_output
bool is_photon_output() const
Get, whether this is the photon output?
Definition: outputinterface.h:174
grandcan_thermalizer.h
smash::EventInfo::current_time
double current_time
Time in fm/c.
Definition: outputinterface.h:41
smash::OutputInterface::is_photon_output_
const bool is_photon_output_
Is this the photon output?
Definition: outputinterface.h:232
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
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:104
smash::EventInfo::total_kinetic_energy
double total_kinetic_energy
Sum of kinetic energies of all particles.
Definition: outputinterface.h:43
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:116
smash::RectangularLattice
A container class to hold all the arrays on the lattice and access them.
Definition: lattice.h:47
ThermodynamicQuantity::Tmn
smash::OutputInterface
Abstraction of generic output.
Definition: outputinterface.h:65
density.h
smash::DensityType::Pion
smash::OutputInterface::is_dilepton_output_
const bool is_dilepton_output_
Is this the dilepton output?
Definition: outputinterface.h:229
smash::EventInfo::total_mean_field_energy
double total_mean_field_energy
Total energy in the mean field.
Definition: outputinterface.h:45
smash::OutputInterface::is_dilepton_output
bool is_dilepton_output() const
Get, whether this is the dilepton output?
Definition: outputinterface.h:171
ThermodynamicQuantity::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:47
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:51
smash::Action
Definition: action.h:35
ThermodynamicQuantity
ThermodynamicQuantity
Represents thermodynamic quantities that can be printed out.
Definition: forwarddeclarations.h:186
smash::DensityType::None
smash::EventInfo::modus_length
double modus_length
Box length in case of box simulation, otherwise dummy.
Definition: outputinterface.h:39
smash::DensityType::Isospin3_tot
ThermodynamicQuantity::j_QBS
smash::EventInfo::impact_parameter
double impact_parameter
Impact parameter for collider modus, otherwise dummy.
Definition: outputinterface.h:37
smash::GrandCanThermalizer
The GrandCanThermalizer class implements the following functionality:
Definition: grandcan_thermalizer.h:227
smash::DensityType::Hadron
smash::DensityType::Baryon
smash::OutputInterface::is_IC_output_
const bool is_IC_output_
Is this the IC output?
Definition: outputinterface.h:235
smash::OutputInterface::to_string
const char * to_string(const DensityType dens_type)
Convert density types to strings.
Definition: outputinterface.h:205
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:134
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:166
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:151