First commit new electron Monte Carlo code
This commit is contained in:
@@ -0,0 +1,146 @@
|
|||||||
|
#ifndef PARTICLE_H
|
||||||
|
#define PARTICLE_H
|
||||||
|
|
||||||
|
#include "clist.H"
|
||||||
|
#include "blitz/array.h"
|
||||||
|
#include "blitz/tinyvec-et.h"
|
||||||
|
|
||||||
|
typedef species enum {electron, positron, proton, tritium, tritium2, helium, deuterium, dt};
|
||||||
|
|
||||||
|
using namespace blitz;
|
||||||
|
|
||||||
|
class particle
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
double m;
|
||||||
|
double q;
|
||||||
|
double id;
|
||||||
|
TinyVector<double,3> v,x;
|
||||||
|
species s;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/* 1. Konstruktor: Parameter explizit angegeben */
|
||||||
|
particle(double masse, double ladung, TinyVector<double,3> ort, TinyVector<double,3> geschwindigkeit, double nummer, species sp)
|
||||||
|
{
|
||||||
|
m = masse;
|
||||||
|
q = ladung;
|
||||||
|
x = ort;
|
||||||
|
v = geschwindigkeit;
|
||||||
|
id = nummer;
|
||||||
|
s = sp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 2. Konstruktor: Teilchen aus einem Array, wie es von prop() und array() geschrieben wird, herstellen */
|
||||||
|
particle(Array<double, 1> props);
|
||||||
|
|
||||||
|
|
||||||
|
particle(){}
|
||||||
|
|
||||||
|
virtual ~particle() { }
|
||||||
|
|
||||||
|
double masse() { return(m); }
|
||||||
|
double ladung() { return(q); }
|
||||||
|
TinyVector<double,3> ort() { return(x); }
|
||||||
|
TinyVector<double,3> geschwindigkeit() { return(v); }
|
||||||
|
double nummer() { return(id);}
|
||||||
|
double winkel() { return 42; }
|
||||||
|
TinyVector<double,3> xchange(TinyVector<double, 3> dx, int i, TinyVector<double, 3> xmin, TinyVector<double, 3> nx, TinyVector<double, 3> dvdt);
|
||||||
|
TinyVector<double,3> vchange(TinyVector<double, 3> dv, int i);
|
||||||
|
TinyVector<double, 3> xnew(TinyVector<double, 3> xneu) { return x = xneu; };
|
||||||
|
TinyVector<double, 3> vnew(TinyVector<double, 3> vneu);
|
||||||
|
|
||||||
|
void copyol(particle*);
|
||||||
|
Array<double,1> prop(Array<double,1>);
|
||||||
|
virtual Array<double,1> array(); // ********************** warum virtual???? ******************************
|
||||||
|
//void copyol(particle);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class particle_info : public particle {
|
||||||
|
|
||||||
|
private:
|
||||||
|
TinyVector<double,3> x0,p0;
|
||||||
|
double id;
|
||||||
|
double mue0;
|
||||||
|
|
||||||
|
public:
|
||||||
|
particle_info(TinyVector<double,3> anfangsort, TinyVector<double,3> anfangsimpuls, double nummer, double anfangswinkel ):particle()
|
||||||
|
{
|
||||||
|
x0 = anfangsort;
|
||||||
|
p0 = anfangsimpuls;
|
||||||
|
mue0 = anfangswinkel;
|
||||||
|
id = nummer;
|
||||||
|
}
|
||||||
|
|
||||||
|
particle_info() { }
|
||||||
|
~particle_info() { }
|
||||||
|
|
||||||
|
|
||||||
|
TinyVector<double,3> anfangsort() { return(x0); }
|
||||||
|
TinyVector<double,3> anfangsimpuls() { return(p0); }
|
||||||
|
double nummer() { return(id); }
|
||||||
|
double anfangswinkel() { return(mue0); }
|
||||||
|
// virtual void copyol(particle_info*);
|
||||||
|
|
||||||
|
Array<double,1> array () // *********************** auslagern in .cpp **************************
|
||||||
|
{
|
||||||
|
Array<double,1> teilchenprop;
|
||||||
|
TinyVector<int,1> temp;
|
||||||
|
temp=8;
|
||||||
|
teilchenprop.resize(temp);
|
||||||
|
|
||||||
|
x0 = this->anfangsort();
|
||||||
|
p0 = this->anfangsimpuls();
|
||||||
|
id = this->nummer();
|
||||||
|
mue0 = this->anfangswinkel();
|
||||||
|
|
||||||
|
teilchenprop(0) = x0(0);
|
||||||
|
teilchenprop(1) = x0(1);
|
||||||
|
teilchenprop(2) = x0(2);
|
||||||
|
teilchenprop(3) = p0(0);
|
||||||
|
teilchenprop(4) = p0(1);
|
||||||
|
teilchenprop(5) = p0(2);
|
||||||
|
teilchenprop(6) = id;
|
||||||
|
teilchenprop(7) = mue0;
|
||||||
|
|
||||||
|
return(teilchenprop);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
Reference in New Issue
Block a user