Files
katrin-plasma/src/mc_electron/sf_particle_logger.h
T
Christian fb20c896eb Minor Changes
Time Calculation changed to based on 1e11 with 100%CD
2019-11-05 11:12:00 +01:00

54 lines
1.2 KiB
C++

//
// sf_particle_logger.h
// mc_electron
//
// Created by Christian Reiling on 19.05.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef sf_particle_logger_h
#define sf_particle_logger_h
#include "particle_logger_base.h"
#include "h5_file.hpp"
class SF_Particle_Logger : public Particle_Logger_Base {
hid_t h5g_species;
H5TB_Particle_Interface h5tb;
public:
SF_Particle_Logger(species this_species, H5_File *h5_file) : Particle_Logger_Base(this_species) {
create(h5_file, this_species);
}
private:
void create(H5_File *h5_file, species this_species);
public:
void log(const Particle &logPart, const vec3 &oldLoc_m);
void flush();
};
inline void SF_Particle_Logger::create(H5_File *h5_file, species this_species) {
std::stringstream ss;
ss<<h5_file->get_h5g_particles_path()<<"/"<<get_species_string(this_species);
h5g_species = H5Gcreate(*h5_file->get_h5f(), ss.str().c_str(), H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
h5tb = H5TB_Particle_Interface("all", &h5g_species);
}
inline void SF_Particle_Logger::log(const Particle &logPart, const vec3 &oldLoc_m) {
if (!logging) {
return;
}
h5tb.write(logPart);
}
inline void SF_Particle_Logger::flush() {
h5tb.flush();
}
#endif /* sf_particle_logger_h */