Version: SMASH-1.8
outputinterface.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2014-2019
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  is_IC_output_(name == "SMASH_IC") {}
45  virtual ~OutputInterface() = default;
46 
53  virtual void at_eventstart(const Particles &particles,
54  const int event_number) = 0;
55 
66  virtual void at_eventend(const Particles &particles, const int event_number,
67  double impact_parameter, bool empty_event) = 0;
68 
76  virtual void at_interaction(const Action &action, const double density) {
77  SMASH_UNUSED(action);
78  SMASH_UNUSED(density);
79  }
80 
87  virtual void at_intermediate_time(const Particles &particles,
88  const std::unique_ptr<Clock> &clock,
89  const DensityParameters &dens_param) {
90  SMASH_UNUSED(particles);
91  SMASH_UNUSED(clock);
92  SMASH_UNUSED(dens_param);
93  }
94 
103  virtual void thermodynamics_output(
104  const ThermodynamicQuantity tq, const DensityType dt,
106  SMASH_UNUSED(tq);
107  SMASH_UNUSED(dt);
108  SMASH_UNUSED(lattice);
109  }
110 
120  virtual void thermodynamics_output(
121  const ThermodynamicQuantity tq, const DensityType dt,
123  SMASH_UNUSED(tq);
124  SMASH_UNUSED(dt);
125  SMASH_UNUSED(lattice);
126  }
127 
135  virtual void thermodynamics_output(const GrandCanThermalizer &gct) {
136  SMASH_UNUSED(gct);
137  }
138 
140  bool is_dilepton_output() const { return is_dilepton_output_; }
141 
143  bool is_photon_output() const { return is_photon_output_; }
144 
146  bool is_IC_output() const { return is_IC_output_; }
147 
153  const char *to_string(const ThermodynamicQuantity tq) {
154  switch (tq) {
156  return "rho_eckart";
158  return "tmn";
160  return "tmn_landau";
162  return "v_landau";
164  return "j_QBS";
165  }
166  throw std::invalid_argument("Unknown thermodynamic quantity.");
167  }
168 
174  const char *to_string(const DensityType dens_type) {
175  switch (dens_type) {
176  case DensityType::Hadron:
177  return "hadron";
178  case DensityType::Baryon:
179  return "net_baryon";
181  return "net_baryonI3";
182  case DensityType::Pion:
183  return "pion";
185  return "tot_isospin3";
186  case DensityType::Charge:
187  return "charge";
189  return "strangeness";
190  case DensityType::None:
191  return "none";
192  }
193  throw std::invalid_argument("Unknown density type.");
194  }
195 
196  protected:
199 
201  const bool is_photon_output_;
202 
204  const bool is_IC_output_;
205 };
206 
207 } // namespace smash
208 
209 #endif // SRC_INCLUDE_OUTPUTINTERFACE_H_
smash::DensityType::Strangeness
smash
Definition: action.h:24
smash::OutputInterface::OutputInterface
OutputInterface(std::string name)
Construct output interface.
Definition: outputinterface.h:41
ThermodynamicQuantity::TmnLandau
ThermodynamicQuantity::LandauVelocity
smash::DensityParameters
A class to pre-calculate and store parameters relevant for density calculation.
Definition: density.h:107
smash::OutputInterface::is_IC_output
bool is_IC_output() const
Get, whether this is the IC output?
Definition: outputinterface.h:146
smash::OutputInterface::to_string
const char * to_string(const ThermodynamicQuantity tq)
Convert thermodynamic quantities to strings.
Definition: outputinterface.h:153
smash::DensityType::BaryonicIsospin
macros.h
energymomentumtensor.h
smash::OutputInterface::~OutputInterface
virtual ~OutputInterface()=default
smash::OutputInterface::is_photon_output
bool is_photon_output() const
Get, whether this is the photon output?
Definition: outputinterface.h:143
grandcan_thermalizer.h
smash::OutputInterface::is_photon_output_
const bool is_photon_output_
Is this the photon output?
Definition: outputinterface.h:201
forwarddeclarations.h
smash::OutputInterface::at_eventend
virtual void at_eventend(const Particles &particles, const int event_number, double impact_parameter, bool empty_event)=0
Output launched at event end.
lattice.h
smash::DensityType::Charge
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:76
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:35
density.h
smash::DensityType::Pion
smash::OutputInterface::is_dilepton_output_
const bool is_dilepton_output_
Is this the dilepton output?
Definition: outputinterface.h:198
smash::OutputInterface::is_dilepton_output
bool is_dilepton_output() const
Get, whether this is the dilepton output?
Definition: outputinterface.h:140
ThermodynamicQuantity::EckartDensity
smash::OutputInterface::at_eventstart
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...
SMASH_UNUSED
#define SMASH_UNUSED(x)
Mark as unused, silencing compiler warnings.
Definition: macros.h:24
smash::Particles
Definition: particles.h:33
smash::DensityType
DensityType
Allows to choose which kind of density to calculate.
Definition: density.h:35
smash::Action
Definition: action.h:35
ThermodynamicQuantity
ThermodynamicQuantity
Represents thermodynamic quantities that can be printed out.
Definition: forwarddeclarations.h:183
smash::DensityType::None
smash::DensityType::Isospin3_tot
ThermodynamicQuantity::j_QBS
smash::OutputInterface::at_intermediate_time
virtual void at_intermediate_time(const Particles &particles, const std::unique_ptr< Clock > &clock, const DensityParameters &dens_param)
Output launched after every N'th timestep.
Definition: outputinterface.h:87
smash::GrandCanThermalizer
The GrandCanThermalizer class implements the following functionality:
Definition: grandcan_thermalizer.h:217
smash::DensityType::Hadron
smash::DensityType::Baryon
smash::OutputInterface::is_IC_output_
const bool is_IC_output_
Is this the IC output?
Definition: outputinterface.h:204
smash::OutputInterface::to_string
const char * to_string(const DensityType dens_type)
Convert density types to strings.
Definition: outputinterface.h:174
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:103
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:135
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:120