Version: SMASH-2.0
smash::BinaryOutputInitialConditions Class Reference

#include <binaryoutput.h>

Writes the particles when crossing the hypersurface to the binary file.

This class writes each particle to the binary output at the time of crossing the hypersurface. This time corresponds to the proper time of the hypersruface, which is - if not specified differently in the configuration - the passing time of the two nuclei.

Details of the output format can be found on the wiki in the User Guide section, look for Output: Initial Conditions.

Definition at line 256 of file binaryoutput.h.

Inheritance diagram for smash::BinaryOutputInitialConditions:
[legend]
Collaboration diagram for smash::BinaryOutputInitialConditions:
[legend]

Public Member Functions

 BinaryOutputInitialConditions (const bf::path &path, std::string name, const OutputParameters &out_par)
 Create binary initial conditions particle output. More...
 
void at_eventstart (const Particles &, const int, const EventInfo &) override
 Writes the initial particle information of an event to the binary output. More...
 
void at_eventend (const Particles &particles, const int event_number, const EventInfo &event) override
 Writes the final particle information of an event to the binary output. More...
 
void at_interaction (const Action &action, const double) override
 Writes particles that are removed when crossing the hypersurface to the output. More...
 
- Public Member Functions inherited from smash::OutputInterface
 OutputInterface (std::string name)
 Construct output interface. More...
 
virtual ~OutputInterface ()=default
 
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. More...
 
virtual void thermodynamics_output (const ThermodynamicQuantity tq, const DensityType dt, RectangularLattice< DensityOnLattice > &lattice)
 Output to write thermodynamics from the lattice. More...
 
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. More...
 
virtual void thermodynamics_output (const GrandCanThermalizer &gct)
 Output to write energy-momentum tensor and related quantities from the thermalizer class. More...
 
bool is_dilepton_output () const
 Get, whether this is the dilepton output? More...
 
bool is_photon_output () const
 Get, whether this is the photon output? More...
 
bool is_IC_output () const
 Get, whether this is the IC output? More...
 
const char * to_string (const ThermodynamicQuantity tq)
 Convert thermodynamic quantities to strings. More...
 
const char * to_string (const DensityType dens_type)
 Convert density types to strings. More...
 

Additional Inherited Members

- Protected Member Functions inherited from smash::BinaryOutputBase
 BinaryOutputBase (const bf::path &path, const std::string &mode, const std::string &name, bool extended_format)
 Create binary output base. More...
 
void write (const char c)
 Write byte to binary output. More...
 
void write (const std::string &s)
 Write string to binary output. More...
 
void write (const double x)
 Write double to binary output. More...
 
void write (const FourVector &v)
 Write four-vector to binary output. More...
 
void write (const std::int32_t x)
 Write integer (32 bit) to binary output. More...
 
void write (const std::uint32_t x)
 Write unsigned integer (32 bit) to binary output. More...
 
void write (const std::uint16_t x)
 Write unsigned integer (16 bit) to binary output. More...
 
void write (const size_t x)
 Write a std::size_t to binary output. More...
 
void write (const Particles &particles)
 Write particle data of each particle in particles to binary output. More...
 
void write (const ParticleList &particles)
 Write each particle data entry to binary output. More...
 
void write_particledata (const ParticleData &p)
 Write particle data to binary output. More...
 
- Protected Attributes inherited from smash::BinaryOutputBase
RenamingFilePtr file_
 Binary particles output file path. More...
 
- Protected Attributes inherited from smash::OutputInterface
const bool is_dilepton_output_
 Is this the dilepton output? More...
 
const bool is_photon_output_
 Is this the photon output? More...
 
const bool is_IC_output_
 Is this the IC output? More...
 

Constructor & Destructor Documentation

◆ BinaryOutputInitialConditions()

smash::BinaryOutputInitialConditions::BinaryOutputInitialConditions ( const bf::path &  path,
std::string  name,
const OutputParameters out_par 
)

Create binary initial conditions particle output.

Parameters
[in]pathOutput path.
[in]nameName of the ouput.
[in]out_parA structure containing the parameters of the output.

Definition at line 306 of file binaryoutput.cc.

308  : BinaryOutputBase(path / "SMASH_IC.bin", "wb", name, out_par.ic_extended) {
309 }

Member Function Documentation

◆ at_eventstart()

void smash::BinaryOutputInitialConditions::at_eventstart ( const Particles ,
const int  ,
const EventInfo  
)
overridevirtual

Writes the initial particle information of an event to the binary output.

Function unused for IC output. Needed since inherited.

Implements smash::OutputInterface.

Definition at line 311 of file binaryoutput.cc.

312  {}

◆ at_eventend()

void smash::BinaryOutputInitialConditions::at_eventend ( const Particles particles,
const int  event_number,
const EventInfo event 
)
overridevirtual

Writes the final particle information of an event to the binary output.

Parameters
[in]particlesCurrent list of particles.
[in]event_numberNumber of event.
[in]eventEvent info, see event_info

Implements smash::OutputInterface.

Definition at line 314 of file binaryoutput.cc.

316  {
317  // Event end line
318  const char fchar = 'f';
319  std::fwrite(&fchar, sizeof(char), 1, file_.get());
320  write(event_number);
321  write(event.impact_parameter);
322  const char empty = event.empty_event;
323  write(empty);
324 
325  // Flush to disk
326  std::fflush(file_.get());
327 
328  // If the runtime is too short some particles might not yet have
329  // reached the hypersurface. Warning is printed.
330  if (particles.size() != 0) {
332  "End time might be too small for initial conditions output. "
333  "Hypersurface has not yet been crossed by ",
334  particles.size(), " particle(s).");
335  }
336 }
Here is the call graph for this function:

◆ at_interaction()

void smash::BinaryOutputInitialConditions::at_interaction ( const Action action,
const double   
)
overridevirtual

Writes particles that are removed when crossing the hypersurface to the output.

Note that the particle information is written as a particle block, not as an interaction block.

Parameters
[in]actionAction that holds the information of the interaction.

Reimplemented from smash::OutputInterface.

Definition at line 338 of file binaryoutput.cc.

339  {
340  if (action.get_type() == ProcessType::HyperSurfaceCrossing) {
341  const char pchar = 'p';
342  std::fwrite(&pchar, sizeof(char), 1, file_.get());
343  write(action.incoming_particles().size());
344  write(action.incoming_particles());
345  }
346 }
Here is the call graph for this function:

The documentation for this class was generated from the following files:
smash::BinaryOutputBase::BinaryOutputBase
BinaryOutputBase(const bf::path &path, const std::string &mode, const std::string &name, bool extended_format)
Create binary output base.
Definition: binaryoutput.cc:134
smash::logg
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > logg
An array that stores all pre-configured Logger objects.
Definition: logging.cc:39
smash::RenamingFilePtr::get
FILE * get()
Get the underlying FILE* pointer.
Definition: file.cc:27
smash::BinaryOutputBase::file_
RenamingFilePtr file_
Binary particles output file path.
Definition: binaryoutput.h:115
smash::BinaryOutputBase::write
void write(const char c)
Write byte to binary output.
Definition: binaryoutput.cc:147
smash::ProcessType::HyperSurfaceCrossing
Hypersurface crossing Particles are removed from the evolution and printed to a separate output to se...