Restructuring Code. Removed some small classes which provided only 1 function, like parameter. Now each class calls it own parameters and stores them as static const.
Merged function containers. Added HDF5 output and reworked Logger class into Base class and 2 derived classes ASCI_Logger and H5_Logger
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
#define functions_hpp
|
||||
|
||||
|
||||
#include "constants.hpp"
|
||||
#include <iostream>
|
||||
|
||||
#include <blitz/array.h>
|
||||
#include <blitz/tinyvec2.h>
|
||||
@@ -20,16 +20,37 @@
|
||||
typedef blitz::TinyVector<double,3> vec3;
|
||||
|
||||
|
||||
double get_vecAbs(vec3 vec);
|
||||
// Custom Error Type
|
||||
struct MyException : public std::exception
|
||||
{
|
||||
std::string s;
|
||||
MyException(std::string errorMessage) : s(errorMessage) {}
|
||||
~MyException() throw () {}
|
||||
const char* what() const throw() { return s.c_str(); }
|
||||
};
|
||||
|
||||
// Read Parameters from file
|
||||
double getParameter(std::string parName);
|
||||
|
||||
//String Manipulations for Read in from files
|
||||
std::string getEnv (std::string envName); // string version of C function getenv.
|
||||
void makePath (std::string &path); // append '/' if necessary to path.
|
||||
bool checkIgnoreLine(std::string lineFromFile); // true if line is empty or starts with #
|
||||
void removeLeadingWhites(std::string &lineFromFile);
|
||||
void replaceDelimiter(std::string &lineFromFile); // replaces delimiter (';'',''=') with whitespace
|
||||
|
||||
// Calculate Kinematic Relations
|
||||
double get_Speed_from_Ekin_eV(double Ekin_eV, double mass_eV);
|
||||
double get_gamma_from_Ekin_eV(double Ekin_eV, double mass_eV);
|
||||
double get_beta_from_gamma(double gamma);
|
||||
double get_Ekin_eV_from_speed(double Speed, double mass_eV);
|
||||
double get_gamma_from_beta(double beta);
|
||||
|
||||
vec3 get_Newdirection(vec3 oldDir, double theta,double phi);
|
||||
// Operations on 3 dimensional Vectors
|
||||
double get_vecAbs(vec3 vec);
|
||||
vec3 get_Newdirection(vec3 oldDir, double theta,double phi); // Calculates new Direction after Interaction with (theta, phi)
|
||||
|
||||
// Functions for Random Sampling
|
||||
vec3 roll_uniform_direction(ranlib::Uniform<double> *rngUni);
|
||||
double roll_MBEnergy(double Temp_K,double mass_eV,ranlib::NormalUnit<double> *rngNormal);
|
||||
double doRejectionMethod(double pdf(double), double xmin, double xmax, double pmax, ranlib::Uniform<double> *rngUni);
|
||||
|
||||
Reference in New Issue
Block a user