Reworked logging model:
Added T+, T3+. Changes in logging hierarchie: Every species individually logs positions.
This commit is contained in:
@@ -10,43 +10,51 @@
|
||||
#define multiz_particle_logger_h
|
||||
|
||||
#include "particle_logger_base.h"
|
||||
#include "h5_file.hpp"
|
||||
|
||||
|
||||
class MultiZ_Particle_Logger : public Particle_Logger_Base {
|
||||
hid_t h5g_species;
|
||||
H5TB_Particle_Interface *h5tb;
|
||||
|
||||
int numberZBins;
|
||||
double *zLogValues;
|
||||
|
||||
public:
|
||||
MultiZ_Particle_Logger(species this_species, const int &numberZBins, double *zLogValues, hid_t *h5g_z) : Particle_Logger_Base(this_species) {
|
||||
MultiZ_Particle_Logger(species this_species, H5_File *h5_file, const int &numberZBins, double *zLogValues) : Particle_Logger_Base(this_species) {
|
||||
this->numberZBins = numberZBins;
|
||||
this->zLogValues = new double[numberZBins];
|
||||
for (int i = 0; i<numberZBins; i++) {
|
||||
this->zLogValues[i] = zLogValues[i];
|
||||
}
|
||||
create(h5g_z);
|
||||
create(h5_file, this_species);
|
||||
}
|
||||
~MultiZ_Particle_Logger() {
|
||||
delete[] zLogValues;
|
||||
}
|
||||
private:
|
||||
void create(hid_t *h5g_z);
|
||||
void create(H5_File *h5_file, species this_species);
|
||||
|
||||
public:
|
||||
void log(const Particle &logPart, const vec3 &oldLoc_m);
|
||||
};
|
||||
|
||||
|
||||
inline void MultiZ_Particle_Logger::create(hid_t *h5g_z) {
|
||||
std::string speciesName = get_species_string(get_species());
|
||||
inline void MultiZ_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);
|
||||
|
||||
if (numberZBins < 1) {
|
||||
std::stringstream ss;
|
||||
ss<<"MultiZ_Particle_Logger::create: numberZBins < 1.\n";
|
||||
}
|
||||
|
||||
h5tb = new H5TB_Particle_Interface[numberZBins];
|
||||
std::string table_name;
|
||||
for (int i = 0; i < numberZBins; i++) {
|
||||
h5tb[i] = H5TB_Particle_Interface(speciesName, &h5g_z[i]);
|
||||
table_name = std::to_string(zLogValues[i]);
|
||||
h5tb[i] = H5TB_Particle_Interface(table_name.c_str(), &h5g_species);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user