Version: SMASH-3.1
outputinterface.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2014-2023
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 #include <utility>
16 #include <vector>
17 
18 #include "density.h"
19 #include "energymomentumtensor.h"
20 #include "forwarddeclarations.h"
21 #include "grandcan_thermalizer.h"
22 #include "lattice.h"
23 #include "macros.h"
24 
25 namespace smash {
26 static constexpr int LOutput = LogArea::Output::id;
27 
38 struct EventInfo {
42  double modus_length;
44  double current_time;
50  double total_energy;
59 };
60 
89  public:
94  explicit OutputInterface(std::string name)
95  : is_dilepton_output_(name == "Dileptons"),
96  is_photon_output_(name == "Photons"),
97  is_IC_output_(name == "SMASH_IC") {}
102  virtual ~OutputInterface() = 0;
103 
108  virtual void at_eventstart(const Particles &, const int, const EventInfo &) {}
109 
114  virtual void at_eventstart(const std::vector<Particles> &, int) {}
115 
120  virtual void at_eventstart(const int, const ThermodynamicQuantity,
121  const DensityType,
123 
128  virtual void at_eventstart(const int, const ThermodynamicQuantity,
129  const DensityType,
131 
136  virtual void at_eventend(const int, const ThermodynamicQuantity,
137  const DensityType) {}
138 
143  virtual void at_eventend(const ThermodynamicQuantity) {}
144 
149  virtual void at_eventend(const Particles &, const int, const EventInfo &) {}
154  virtual void at_eventend(const std::vector<Particles> &, const int) {}
155 
159  virtual void at_interaction(const Action &, const double) {}
160 
164  virtual void at_intermediate_time(const Particles &,
165  const std::unique_ptr<Clock> &,
166  const DensityParameters &,
167  const EventInfo &) {}
171  virtual void at_intermediate_time(const std::vector<Particles> &,
172  const std::unique_ptr<Clock> &,
173  const DensityParameters &) {}
174 
180  const DensityType,
182 
187  virtual void thermodynamics_output(
188  const ThermodynamicQuantity, const DensityType,
190 
196  RectangularLattice<DensityOnLattice> &, const double) {}
197 
203  RectangularLattice<DensityOnLattice> &, const double,
204  const std::vector<Particles> &, const DensityParameters &) {}
205 
212  const double) {}
213 
220 
225  virtual void fields_output(
226  const std::string, const std::string,
227  RectangularLattice<std::pair<ThreeVector, ThreeVector>> &) {}
228 
230  bool is_dilepton_output() const { return is_dilepton_output_; }
231 
233  bool is_photon_output() const { return is_photon_output_; }
234 
236  bool is_IC_output() const { return is_IC_output_; }
237 
243  const char *to_string(const ThermodynamicQuantity tq) {
244  switch (tq) {
246  return "rho_eckart";
248  return "tmn";
250  return "tmn_landau";
252  return "v_landau";
254  return "j_QBS";
255  }
256  throw std::invalid_argument("Unknown thermodynamic quantity.");
257  }
258 
264  const char *to_string(const DensityType dens_type) {
265  switch (dens_type) {
266  case DensityType::Hadron:
267  return "hadron";
268  case DensityType::Baryon:
269  return "net_baryon";
271  return "net_baryonI3";
272  case DensityType::Pion:
273  return "pion";
275  return "tot_isospin3";
276  case DensityType::Charge:
277  return "charge";
279  return "strangeness";
280  case DensityType::None:
281  return "none";
282  }
283  throw std::invalid_argument("Unknown density type.");
284  }
285 
286  protected:
289 
291  const bool is_photon_output_;
292 
294  const bool is_IC_output_;
295 };
296 
297 inline OutputInterface::~OutputInterface() = default;
298 
299 } // namespace smash
300 
301 #endif // SRC_INCLUDE_SMASH_OUTPUTINTERFACE_H_
Action is the base class for a generic process that takes a number of incoming particles and transfor...
Definition: action.h:35
A class to pre-calculate and store parameters relevant for density calculation.
Definition: density.h:108
The GrandCanThermalizer class implements the following functionality:
Abstraction of generic output.
virtual void at_eventstart(const std::vector< Particles > &, int)
Output launched at event start after initialization, when particles are generated but not yet propaga...
const bool is_photon_output_
Is this the photon output?
bool is_photon_output() const
Get, whether this is the photon output?
virtual void thermodynamics_lattice_output(RectangularLattice< DensityOnLattice > &, const double, const std::vector< Particles > &, const DensityParameters &)
Output to write thermodynamics from the lattice.
const bool is_dilepton_output_
Is this the dilepton output?
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 propaga...
virtual void at_interaction(const Action &, const double)
Called whenever an action modified one or more particles.
virtual void at_eventend(const ThermodynamicQuantity)
Output launched at event end.
virtual void at_eventend(const std::vector< Particles > &, const int)
Output launched at event end.
const bool is_IC_output_
Is this the IC output?
OutputInterface(std::string name)
Construct output interface.
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 propaga...
virtual void thermodynamics_lattice_output(RectangularLattice< DensityOnLattice > &, const double)
Output to write thermodynamics from the lattice.
const char * to_string(const DensityType dens_type)
Convert density types to strings.
const char * to_string(const ThermodynamicQuantity tq)
Convert thermodynamic quantities to strings.
virtual void at_intermediate_time(const std::vector< Particles > &, const std::unique_ptr< Clock > &, const DensityParameters &)
Output launched after every N'th timestep.
virtual void thermodynamics_output(const GrandCanThermalizer &)
Output to write energy-momentum tensor and related quantities from the thermalizer class.
virtual void at_eventend(const Particles &, const int, const EventInfo &)
Output launched at event end.
virtual void at_intermediate_time(const Particles &, const std::unique_ptr< Clock > &, const DensityParameters &, const EventInfo &)
Output launched after every N'th time-step.
virtual ~OutputInterface()=0
Pure virtual destructor to make class abstract and prevent its instantiation.
virtual void fields_output(const std::string, const std::string, RectangularLattice< std::pair< ThreeVector, ThreeVector >> &)
Write fields in vtk output Fields are a pair of threevectors for example electric and magnetic field.
bool is_dilepton_output() const
Get, whether this is the dilepton output?
virtual void thermodynamics_lattice_output(const ThermodynamicQuantity, RectangularLattice< EnergyMomentumTensor > &, const double)
Output to write energy-momentum tensor and related quantities from the lattice.
virtual void at_eventend(const int, const ThermodynamicQuantity, const DensityType)
Output launched at event end.
virtual void thermodynamics_output(const ThermodynamicQuantity, const DensityType, RectangularLattice< DensityOnLattice > &)
Output to write thermodynamics from the lattice.
bool is_IC_output() const
Get, whether this is the IC output?
virtual void thermodynamics_output(const ThermodynamicQuantity, const DensityType, RectangularLattice< EnergyMomentumTensor > &)
Output to write energy-momentum tensor and related quantities from the lattice.
virtual void at_eventstart(const Particles &, const int, const EventInfo &)
Output launched at event start after initialization, when particles are generated but not yet propaga...
The Particles class abstracts the storage and manipulation of particles.
Definition: particles.h:33
A container class to hold all the arrays on the lattice and access them.
Definition: lattice.h:47
ThermodynamicQuantity
Represents thermodynamic quantities that can be printed out See user guide description for more infor...
@ EckartDensity
Density in the Eckart frame.
@ Tmn
Energy-momentum tensor in lab frame.
@ LandauVelocity
Velocity of the Landau rest frame.
@ j_QBS
Electric (Q), baryonic (B) and strange (S) currents.
@ TmnLandau
Energy-momentum tensor in Landau rest frame.
Definition: action.h:24
static constexpr int LOutput
DensityType
Allows to choose which kind of density to calculate.
Definition: density.h:36
Structure to contain custom data for output.
double total_kinetic_energy
Sum of kinetic energies of all particles.
bool empty_event
True if no collisions happened.
double modus_length
Box length in case of box simulation, otherwise dummy.
double total_energy
Kinetic + mean field energy.
int n_ensembles
Number of ensembles.
double total_mean_field_energy
Total energy in the mean field.
bool impose_kinematic_cut_for_SMASH_IC
Whether or not kinematic cuts are employed for SMASH IC.
double impact_parameter
Impact parameter for collider modus, otherwise dummy.
double current_time
Time in fm.
int test_particles
Testparticle number, see Testparticles in General.