Version: SMASH-1.7
oscaroutput.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_OSCAROUTPUT_H_
11 #define SRC_INCLUDE_OSCAROUTPUT_H_
12 
13 #include <memory>
14 #include <string>
15 
16 #include "file.h"
17 #include "forwarddeclarations.h"
18 #include "outputinterface.h"
19 #include "outputparameters.h"
20 
21 namespace smash {
22 
28 enum OscarOutputFormat {
33 };
34 
46  OscarTimesteps = 0x002,
53 };
54 
62 template <OscarOutputFormat Format, int Contents>
63 class OscarOutput : public OutputInterface {
64  public:
71  OscarOutput(const bf::path &path, const std::string &name);
72 
78  void at_eventstart(const Particles &particles,
79  const int event_number) override;
80 
89  void at_eventend(const Particles &particles, const int event_number,
90  double impact_parameter, bool empty_event) override;
91 
98  void at_interaction(const Action &action, const double density) override;
99 
107  void at_intermediate_time(const Particles &particles,
108  const std::unique_ptr<Clock> &clock,
109  const DensityParameters &dens_param) override;
110 
111  private:
116  void write_particledata(const ParticleData &data);
117 
123  void write(const Particles &particles);
124 
126  int current_event_ = 0;
127 
130 };
131 
145 std::unique_ptr<OutputInterface> create_oscar_output(
146  const std::string &format, const std::string &content, const bf::path &path,
147  const OutputParameters &out_par);
148 
149 // @}
150 
151 } // namespace smash
152 
153 #endif // SRC_INCLUDE_OSCAROUTPUT_H_
FormattingHelper< T > format(const T &value, const char *unit, int width=-1, int precision=-1)
Acts as a stream modifier for std::ostream to output an object with an optional suffix string and wit...
Definition: logging.h:317
store the state at the end of each event (at_eventend)
Definition: oscaroutput.h:50
A class to pre-calculate and store parameters relevant for density calculation.
Definition: density.h:106
void write_particledata(const ParticleData &data)
Write single particle information line to output.
Definition: oscaroutput.cc:700
A RAII type to replace std::FILE *.
Definition: file.h:73
void at_eventend(const Particles &particles, const int event_number, double impact_parameter, bool empty_event) override
Writes the final particle information of an event to the oscar output.
Definition: oscaroutput.cc:150
std::unique_ptr< OutputInterface > create_oscar_output(const std::string &format, const std::string &content, const bf::path &path, const OutputParameters &out_par)
Definition: oscaroutput.cc:765
store the state after N timesteps (after_Nth_timestep)
Definition: oscaroutput.h:46
OscarOutputFormat
Selector for the output format of OscarOutput.
Definition: oscaroutput.h:29
int current_event_
Keep track of event number.
Definition: oscaroutput.h:126
OscarOutput(const bf::path &path, const std::string &name)
Create oscar output.
Helper structure for Experiment to hold output options and parameters.
store the particles that are removed on the hypersurface
Definition: oscaroutput.h:52
Action is the base class for a generic process that takes a number of incoming particles and transfor...
Definition: action.h:34
OscarOutputContents
Flags for the Contents template parameter of OscarOutput.
Definition: oscaroutput.h:42
void at_eventstart(const Particles &particles, const int event_number) override
Writes the initial particle information of an event to the oscar output.
Definition: oscaroutput.cc:126
store the state at the start of each event (at_eventstart)
Definition: oscaroutput.h:48
void at_interaction(const Action &action, const double density) override
Writes a interaction prefix line and a line for every incoming and outgoing particle to the oscar out...
Definition: oscaroutput.cc:195
store interaction information (write_interaction)
Definition: oscaroutput.h:44
RenamingFilePtr file_
Full filepath of the output file.
Definition: oscaroutput.h:129
void at_intermediate_time(const Particles &particles, const std::unique_ptr< Clock > &clock, const DensityParameters &dens_param) override
Writes a prefix line then write out all current particles.
Definition: oscaroutput.cc:233
The Particles class abstracts the storage and manipulation of particles.
Definition: particles.h:33
void write(const Particles &particles)
Write the particle information of a list of particles to the output.
Definition: oscaroutput.cc:119
ParticleData contains the dynamic information of a certain particle.
Definition: particledata.h:52
Abstraction of generic output.
Definition: action.h:24