cpp and h files added#
This commit is contained in:
@@ -0,0 +1,30 @@
|
|||||||
|
//
|
||||||
|
// katrin.cpp
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Christian Reiling on 13.09.18.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include "blitz/array.h"
|
||||||
|
#include "blitz/tinyvec2.h"
|
||||||
|
#include <math.h>
|
||||||
|
#include "particle.h"
|
||||||
|
#include "parameter.h"
|
||||||
|
#include "katrin.h"
|
||||||
|
|
||||||
|
TinyVector<double,3> katrin::magneticfield(TinyVector<double,3>)
|
||||||
|
{
|
||||||
|
return((0,0,BFeld));
|
||||||
|
}
|
||||||
|
|
||||||
|
double katrin::tritiumdichte(TinyVector<double,3>)
|
||||||
|
{
|
||||||
|
return(starttritiumdichte);
|
||||||
|
}
|
||||||
|
TinyVector<double,3> electricfield(TinyVector<double,3>)
|
||||||
|
{
|
||||||
|
return((0,0,0));
|
||||||
|
}
|
||||||
|
|
||||||
@@ -9,12 +9,12 @@
|
|||||||
#define katrin_h
|
#define katrin_h
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "blitz/array.h"
|
#include "blitz/array.h"
|
||||||
#include "blitz/tinyvec-et.h"
|
#include "blitz/tinyvec2.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "particle.H"
|
#include "particle.h"
|
||||||
#include "parameter.H"
|
#include "parameter.h"
|
||||||
|
|
||||||
class katrin: public parameter
|
class katrin: public Parameter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
katrin(){};
|
katrin(){};
|
||||||
@@ -22,7 +22,7 @@ public:
|
|||||||
TinyVector<double,3> magneticfield(TinyVector<double,3>);
|
TinyVector<double,3> magneticfield(TinyVector<double,3>);
|
||||||
double tritiumdichte(TinyVector<double,3>);
|
double tritiumdichte(TinyVector<double,3>);
|
||||||
TinyVector<double,3> electricfield(TinyVector<double,3>);
|
TinyVector<double,3> electricfield(TinyVector<double,3>);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* katrin_h */
|
#endif /* katrin_h */
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
//
|
||||||
|
// main.cpp
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Christian Reiling on 13.09.18.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include "blitz/array.h"
|
||||||
|
#include "blitz/tinyvec2.h"
|
||||||
|
#include <math.h>
|
||||||
|
#include "particle.h"
|
||||||
|
#include "parameter.h"
|
||||||
|
#include "simulation.h"
|
||||||
|
#include "katrin.h"
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
Simulation sim;
|
||||||
|
sim.init();
|
||||||
|
}
|
||||||
@@ -15,14 +15,11 @@ public:
|
|||||||
Parameter()
|
Parameter()
|
||||||
{
|
{
|
||||||
beschissenegrosseganzzahl = (int)value("beschissenegrosseganzzahl");
|
beschissenegrosseganzzahl = (int)value("beschissenegrosseganzzahl");
|
||||||
|
|
||||||
totalparticles = value("totalparticles");
|
totalparticles = value("totalparticles");
|
||||||
|
|
||||||
dt = value("dt");
|
dt = value("dt");
|
||||||
|
BFeld = value("BFeld");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double value(char *str, char* ext = "cat")
|
double value(char *str, char* ext = "cat")
|
||||||
{
|
{
|
||||||
double temp;
|
double temp;
|
||||||
@@ -65,16 +62,18 @@ public:
|
|||||||
}
|
}
|
||||||
fclose(fcat);
|
fclose(fcat);
|
||||||
fprintf(stderr,"variable %s not found\n",str);
|
fprintf(stderr,"variable %s not found\n",str);
|
||||||
exit(1);
|
|
||||||
|
|
||||||
|
exit(1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
long int totalparticles;
|
long int totalparticles;
|
||||||
double dt;
|
double dt;
|
||||||
|
double BFeld;
|
||||||
|
double starttritiumdichte;
|
||||||
|
int beschissenegrosseganzzahl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
#ifndef PARTICLE_H
|
#ifndef PARTICLE_H
|
||||||
#define PARTICLE_H
|
#define PARTICLE_H
|
||||||
|
|
||||||
#include "clist.H"
|
|
||||||
#include "blitz/array.h"
|
#include "blitz/array.h"
|
||||||
#include "blitz/tinyvec-et.h"
|
#include "blitz/tinyvec2.h"
|
||||||
|
|
||||||
typedef species enum {electron, positron, proton, tritium, tritium2, helium, deuterium, dt};
|
typedef enum species{electron, positron, proton, tritium, tritium2, helium, deuterium, dt}species;
|
||||||
|
|
||||||
using namespace blitz;
|
using namespace blitz;
|
||||||
|
|
||||||
@@ -14,7 +13,7 @@ class particle
|
|||||||
private:
|
private:
|
||||||
double m;
|
double m;
|
||||||
double q;
|
double q;
|
||||||
double id;
|
long int id;
|
||||||
TinyVector<double,3> v,x;
|
TinyVector<double,3> v,x;
|
||||||
species s;
|
species s;
|
||||||
|
|
||||||
@@ -109,38 +108,4 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class particle_mitmue : public particle { private:
|
|
||||||
double mue;
|
|
||||||
public:
|
|
||||||
particle_mitmue(double masse, double ladung, TinyVector<double,3> ort, TinyVector<double,3> geschwindigkeit, double nummer, double winkel):particle(masse, ladung, ort, geschwindigkeit, nummer)
|
|
||||||
{
|
|
||||||
mue = winkel;
|
|
||||||
}
|
|
||||||
particle_mitmue() { }
|
|
||||||
~particle_mitmue() { }
|
|
||||||
|
|
||||||
double winkel() { return(mue); }
|
|
||||||
double muenew(double mueneu);
|
|
||||||
void copyol(particle_mitmue* teilchen)
|
|
||||||
{
|
|
||||||
particle::copyol( teilchen);
|
|
||||||
mue = teilchen->winkel();
|
|
||||||
}
|
|
||||||
|
|
||||||
Array<double,1> array () // *********************** auslagern in .cpp **************************
|
|
||||||
{
|
|
||||||
Array<double,1> teilchenprop;
|
|
||||||
TinyVector<int,1> temp;
|
|
||||||
temp=10;
|
|
||||||
teilchenprop.resize(temp);
|
|
||||||
|
|
||||||
particle::prop(teilchenprop);
|
|
||||||
mue = this->winkel();
|
|
||||||
teilchenprop(9)=mue;
|
|
||||||
|
|
||||||
return(teilchenprop);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
//
|
||||||
|
// simulation.cpp
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Christian Reiling on 13.09.18.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include "blitz/array.h"
|
||||||
|
#include "blitz/tinyvec2.h"
|
||||||
|
#include <math.h>
|
||||||
|
#include "particle.h"
|
||||||
|
#include "parameter.h"
|
||||||
|
#include "simulation.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void init(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#ifndef SIMULATION_H
|
#ifndef SIMULATION_H
|
||||||
#define SIMULATION_H
|
#define SIMULATION_H
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "blitz/array.h"
|
#include "blitz/array.h"
|
||||||
#include "blitz/tinyvec-et.h"
|
#include "blitz/tinyvec2.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "particle.H"
|
#include "particle.h"
|
||||||
#include "parameter.H"
|
#include "parameter.h"
|
||||||
|
|
||||||
using namespace blitz;
|
using namespace blitz;
|
||||||
|
|
||||||
@@ -19,8 +19,8 @@ public:
|
|||||||
~Simulation(){};
|
~Simulation(){};
|
||||||
|
|
||||||
|
|
||||||
virtual void init(void) = 0;
|
void init(void);
|
||||||
virtual void inject;
|
void inject();
|
||||||
|
|
||||||
void output(void);
|
void output(void);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user