diff --git a/src/mc_electron/parameter.h b/src/mc_electron/parameter.h new file mode 100644 index 0000000..e118379 --- /dev/null +++ b/src/mc_electron/parameter.h @@ -0,0 +1,81 @@ +#ifndef PARAMETER_H +#define PARAMETER_H + +#include + +using namespace blitz; +using namespace std; + + +class Parameter +{ +public: + + virtual ~Parameter(){}; + Parameter() + { + beschissenegrosseganzzahl = (int)value("beschissenegrosseganzzahl"); + + totalparticles = value("totalparticles"); + + dt = value("dt"); + + } + + + double value(char *str, char* ext = "cat") + { + double temp; + char dummy[256]; + char fname[256],*pname; + FILE *fcat; + + if (getenv("poub") == NULL) + { + fprintf(stderr,"Environment variable %s not defined.\n","poub"); + exit(1); + } + strcpy(fname, getenv("poub")); + pname = getenv("pname"); + if (pname == NULL) + { + fprintf(stderr,"Environment variable %s not defined.\n","pname"); + exit(1); + } + if (!ext) + { + ext = "cat"; + } + sprintf(fname,"%s/%s.%s",getenv("poub"),getenv("pname"), ext); + if (!(fcat = fopen(fname, "r"))) + { + fprintf(stderr,"value: cannot open file %s\n",fname); + exit(1); + } + while (!feof(fcat)) + { + // fscanf(fcat, "'%s%*[^']'%F%*[^']",dummy,&temp); 1 + fscanf(fcat, "%s = %lf", dummy, &temp); + // if (strncmp(dummy, str,strlen(str)) == 0) { + if (strcmp(dummy, str) == 0) + { + fclose(fcat); + return(temp); + } + } + fclose(fcat); + fprintf(stderr,"variable %s not found\n",str); + exit(1); + + return 0; + } + + +protected: + + long int totalparticles; + double dt; +}; + + +#endif diff --git a/src/mc_electron/simulation.h b/src/mc_electron/simulation.h index e69de29..0cc2c2d 100644 --- a/src/mc_electron/simulation.h +++ b/src/mc_electron/simulation.h @@ -0,0 +1,37 @@ +#ifndef SIMULATION_H +#define SIMULATION_H +#include +#include "blitz/array.h" +#include "blitz/tinyvec-et.h" +#include +#include "particle.H" +#include "parameter.H" + +using namespace blitz; + + + +class Simulation: public Parameter +{ +public: + + Simulation(); + ~Simulation(){}; + + + virtual void init(void) = 0; + virtual void inject; + + void output(void); + + void doit(void); + + +protected: + + double zeit; + double id; + int zeitschritt; +}; + +#endif