Changes to Interaction Processor, making possible to add infinite Interactions for all kind of Particles
This commit is contained in:
+94
-48
@@ -9,11 +9,13 @@
|
||||
#ifndef logger_hpp
|
||||
#define logger_hpp
|
||||
|
||||
#include "electron.hpp"
|
||||
#include "particle.hpp"
|
||||
#include "katrin.hpp"
|
||||
|
||||
#include "hdf5.h"
|
||||
#include <unordered_map>
|
||||
|
||||
typedef struct logElectron {
|
||||
typedef struct logParticle {
|
||||
unsigned int Id;
|
||||
unsigned int parentId;
|
||||
double x_m;
|
||||
@@ -22,17 +24,16 @@ typedef struct logElectron {
|
||||
double vx_ms;
|
||||
double vy_ms;
|
||||
double vz_ms;
|
||||
} logElectron;
|
||||
} logParticle;
|
||||
|
||||
|
||||
// Base_Logger: Base_Class for all Logger: Reading Paramter and calculating z-Barrieres.
|
||||
class Base_Logger {
|
||||
public:
|
||||
Base_Logger();
|
||||
Base_Logger(Katrin *Kat);
|
||||
|
||||
protected:
|
||||
static const int numberZBins;
|
||||
static const double wgtsLength_m;
|
||||
|
||||
bool logging;
|
||||
std::vector<double> zLogValues;
|
||||
@@ -43,55 +44,17 @@ protected:
|
||||
std::string remove_catEnding (std::string inString);
|
||||
bool isFile(std::string fileName);
|
||||
bool isDir(std::string dirPath);
|
||||
|
||||
Katrin *Kat;
|
||||
};
|
||||
|
||||
// H5_Logger: Logging to HDF5 file format.
|
||||
class H5_Logger : private Base_Logger {
|
||||
|
||||
|
||||
public:
|
||||
H5_Logger();
|
||||
|
||||
|
||||
private:
|
||||
// File
|
||||
std::string outH5FName;
|
||||
hid_t outH5F;
|
||||
|
||||
void set_outH5FName();
|
||||
void create_outH5F();
|
||||
|
||||
// Groups
|
||||
hid_t particleH5G;
|
||||
hid_t *particle_zH5G;
|
||||
|
||||
void create_H5Gs();
|
||||
|
||||
// Electrons
|
||||
public:
|
||||
void test_log();
|
||||
void log_Electron(Electron *inElectron,blitz::TinyVector<double,3> oldLoc_m);
|
||||
private:
|
||||
static const size_t particle_electronH5TB_size;
|
||||
static const char *particle_electronH5TB_fieldNames[8];
|
||||
static const size_t particle_electronH5TB_offset[8];
|
||||
static const hid_t particle_electronH5TB_fieldTypes[8];
|
||||
static const hsize_t particle_electronH5TB_chunkSize;
|
||||
static const size_t particle_electronH5TB_sizes[8];
|
||||
|
||||
hid_t *particle_electronH5T;
|
||||
|
||||
void create_particle_electronH5TBs();
|
||||
|
||||
logElectron Electron_to_logElectron(Electron *inElectron);
|
||||
};
|
||||
|
||||
// ASCI_Logger: Log to ASCI-File. Only Electron Logger. Not very efficient.
|
||||
class ASCI_Logger : private Base_Logger {
|
||||
class ASCI_Logger : public Base_Logger {
|
||||
public:
|
||||
ASCI_Logger();
|
||||
ASCI_Logger(Katrin *Kat);
|
||||
|
||||
void log_Electron(Electron *inElectron,blitz::TinyVector<double,3> oldLoc_m);
|
||||
void log_Particle(Particle *inPart , vec3 oldLoc_m);
|
||||
private:
|
||||
std::string outdirName;
|
||||
std::ofstream *outStream;
|
||||
@@ -102,4 +65,87 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class ParticleH5TB_Properties {
|
||||
public:
|
||||
ParticleH5TB_Properties() {};
|
||||
protected:
|
||||
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];
|
||||
};
|
||||
|
||||
|
||||
class ParticleLogger : ParticleH5TB_Properties{
|
||||
public:
|
||||
ParticleLogger(species Species, hid_t *particle_zH5G, std::vector<double> zLogValues) {
|
||||
this->Species = Species;
|
||||
this->particle_zH5G = particle_zH5G;
|
||||
this->zLogValues = zLogValues;
|
||||
numberZBins = zLogValues.size();
|
||||
singleFile = (numberZBins == 1) ? true : false;
|
||||
stringstream ss;
|
||||
ss<<Species;
|
||||
speciesIdentifier = ss.str();
|
||||
create_particle_H5TBs();
|
||||
};
|
||||
private:
|
||||
void create_particle_H5TBs();
|
||||
|
||||
private:
|
||||
hid_t *particle_zH5G;
|
||||
std::vector<double> zLogValues;
|
||||
hid_t *particle_H5TB;
|
||||
species Species;
|
||||
|
||||
int numberZBins;
|
||||
bool singleFile;
|
||||
std::string speciesIdentifier;
|
||||
public:
|
||||
void log_Particle(const Particle &logPart, const vec3 &oldLoc_m);
|
||||
private:
|
||||
logParticle transformTo_logParticle(const Particle &logPart);
|
||||
public:
|
||||
species get_Species() const {return(Species);};
|
||||
private:
|
||||
void check_Species(const Particle &logPart);
|
||||
};
|
||||
|
||||
|
||||
typedef std::vector<ParticleLogger*> ParticleLoggerVec;
|
||||
|
||||
class H5_Logger : private Base_Logger {
|
||||
public:
|
||||
H5_Logger(Katrin *Kat) : Base_Logger(Kat) {
|
||||
create_outH5F();
|
||||
create_particleH5G();
|
||||
create_particle_zH5G();
|
||||
add_ParticleLogger(new ParticleLogger(electron, particle_zH5G,zLogValues));
|
||||
};
|
||||
|
||||
private:
|
||||
hid_t outH5F;
|
||||
hid_t particleH5G;
|
||||
hid_t *particle_zH5G;
|
||||
|
||||
ParticleLoggerVec ParticleLoggers;
|
||||
|
||||
private:
|
||||
void create_outH5F();
|
||||
std::string get_outH5F_fullPath();
|
||||
void create_particleH5G();
|
||||
void create_particle_zH5G();
|
||||
|
||||
public:
|
||||
void add_ParticleLogger(ParticleLogger* addParticleLogger);
|
||||
private:
|
||||
ParticleLoggerVec::iterator find_ParticleLogger (species findSpec);
|
||||
|
||||
public:
|
||||
void log_Particle(const Particle &logPart, vec3 oldLoc_m);
|
||||
};
|
||||
|
||||
|
||||
#endif /* logger_hpp */
|
||||
|
||||
Reference in New Issue
Block a user