63 lines
1.2 KiB
C++
63 lines
1.2 KiB
C++
//
|
|
// h5tb_particle_interface.hpp
|
|
// mc_electron
|
|
//
|
|
// Created by Christian Reiling on 19.05.19.
|
|
// Copyright © 2019 Christian Reiling. All rights reserved.
|
|
//
|
|
|
|
#ifndef h5tb_particle_interface_hpp
|
|
#define h5tb_particle_interface_hpp
|
|
|
|
#include "hdf5.h"
|
|
#include "hdf5_hl.h"
|
|
|
|
#include "particle.hpp"
|
|
|
|
typedef struct loggerParticle {
|
|
unsigned int Id;
|
|
unsigned int parentId;
|
|
double x_m;
|
|
double y_m;
|
|
double z_m;
|
|
double vx_ms;
|
|
double vy_ms;
|
|
double vz_ms;
|
|
} logParticle;
|
|
|
|
|
|
class H5TB_Particle_Interface {
|
|
static const size_t size;
|
|
static const char *fieldNames[8];
|
|
static const size_t offset[8];
|
|
static const hid_t fieldTypes[8];
|
|
static const hsize_t chunkSize;
|
|
static const size_t sizes[8];
|
|
|
|
int buffer_size = 145;
|
|
loggerParticle buffer[145];
|
|
int buffer_count = 0;
|
|
|
|
std::string table_name;
|
|
hid_t *loc_id;
|
|
|
|
public:
|
|
H5TB_Particle_Interface() {};
|
|
~H5TB_Particle_Interface();
|
|
H5TB_Particle_Interface(const std::string &table_name, hid_t *loc_id) {
|
|
this->table_name = table_name;
|
|
this->loc_id = loc_id;
|
|
create();
|
|
}
|
|
private:
|
|
void create();
|
|
|
|
public:
|
|
void write(const Particle &logPart);
|
|
private:
|
|
loggerParticle transform(const Particle &logPart);
|
|
};
|
|
|
|
|
|
#endif /* h5tb_particle_interface_hpp */
|