Version: SMASH-2.0
oscaroutput.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_OSCAROUTPUT_H_
11 #define SRC_INCLUDE_SMASH_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,
55 };
56 
64 template <OscarOutputFormat Format, int Contents>
65 class OscarOutput : public OutputInterface {
66  public:
73  OscarOutput(const bf::path &path, const std::string &name);
74 
81  void at_eventstart(const Particles &particles, const int event_number,
82  const EventInfo &event) override;
83 
90  void at_eventend(const Particles &particles, const int event_number,
91  const EventInfo &) override;
92 
99  void at_interaction(const Action &action, const double density) override;
100 
109  void at_intermediate_time(const Particles &particles,
110  const std::unique_ptr<Clock> &clock,
111  const DensityParameters &dens_param,
112  const EventInfo &event) override;
113 
114  private:
119  void write_particledata(const ParticleData &data);
120 
126  void write(const Particles &particles);
127 
129  int current_event_ = 0;
130 
133 };
134 
148 std::unique_ptr<OutputInterface> create_oscar_output(
149  const std::string &format, const std::string &content, const bf::path &path,
150  const OutputParameters &out_par);
151 
152 // @}
153 
154 } // namespace smash
155 
156 #endif // SRC_INCLUDE_SMASH_OSCAROUTPUT_H_
smash
Definition: action.h:24
smash::OscarOutput::at_interaction
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:198
smash::OscarOutput::at_intermediate_time
void at_intermediate_time(const Particles &particles, const std::unique_ptr< Clock > &clock, const DensityParameters &dens_param, const EventInfo &event) override
Writes a prefix line then write out all current particles.
Definition: oscaroutput.cc:236
outputparameters.h
smash::DensityParameters
A class to pre-calculate and store parameters relevant for density calculation.
Definition: density.h:108
smash::OscarOutputContents
OscarOutputContents
Flags for the Contents template parameter of OscarOutput.
Definition: oscaroutput.h:42
smash::ParticleData
Definition: particledata.h:52
smash::OscarTimesteps
store the state after N timesteps (after_Nth_timestep)
Definition: oscaroutput.h:46
smash::OscarFormat2013Extended
Definition: oscaroutput.h:31
smash::OscarOutput::write_particledata
void write_particledata(const ParticleData &data)
Write single particle information line to output.
Definition: oscaroutput.cc:705
smash::OscarOutput
Definition: oscaroutput.h:65
smash::EventInfo
Structure to contain custom data for output.
Definition: outputinterface.h:35
forwarddeclarations.h
outputinterface.h
smash::OutputParameters
Helper structure for Experiment to hold output options and parameters.
Definition: outputparameters.h:25
smash::format
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:307
smash::create_oscar_output
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:769
smash::OscarFormat1999
Definition: oscaroutput.h:32
smash::OutputInterface
Abstraction of generic output.
Definition: outputinterface.h:65
smash::OscarOutput::write
void write(const Particles &particles)
Write the particle information of a list of particles to the output.
Definition: oscaroutput.cc:119
smash::OscarOutput::OscarOutput
OscarOutput(const bf::path &path, const std::string &name)
Create oscar output.
smash::OscarOutput::file_
RenamingFilePtr file_
Full filepath of the output file.
Definition: oscaroutput.h:132
smash::OscarParticlesAtEventendIfNotEmpty
store the state at the end of each event if it is not empty (at_eventend)
Definition: oscaroutput.h:52
smash::OscarInteractions
store interaction information (write_interaction)
Definition: oscaroutput.h:44
smash::OscarAtEventstart
store the state at the start of each event (at_eventstart)
Definition: oscaroutput.h:48
smash::OscarOutputFormat
OscarOutputFormat
Selector for the output format of OscarOutput.
Definition: oscaroutput.h:29
smash::OscarFormat2013
Definition: oscaroutput.h:30
smash::Particles
Definition: particles.h:33
smash::OscarParticlesIC
store the particles that are removed on the hypersurface
Definition: oscaroutput.h:54
smash::Action
Definition: action.h:35
smash::RenamingFilePtr
A RAII type to replace std::FILE *.
Definition: file.h:73
file.h
smash::OscarParticlesAtEventend
store the state at the end of each event (at_eventend)
Definition: oscaroutput.h:50
smash::OscarOutput::at_eventend
void at_eventend(const Particles &particles, const int event_number, const EventInfo &) override
Writes the final particle information of an event to the oscar output.
Definition: oscaroutput.cc:151
smash::OscarOutput::current_event_
int current_event_
Keep track of event number.
Definition: oscaroutput.h:129
smash::OscarOutput::at_eventstart
void at_eventstart(const Particles &particles, const int event_number, const EventInfo &event) override
Writes the initial particle information of an event to the oscar output.
Definition: oscaroutput.cc:126