Files
katrin-plasma/src/mc_electron/particle.cpp
T
Christian ac83bae061 Major changes:
- Moved to array operations for main loops.
- Changed to setting pointers to operator only once before loop.
- Changed Population Containers
- Added Recombination
- Added Inelastic Scattering Kinematics
- Reworked Elastic Scattering Cross Section
- Reworked Elastic Scattering Kinematics
- Reworked organisation of different particle species and corresponding operators
2019-05-27 13:46:59 +02:00

92 lines
1.6 KiB
C++

//
// particle.cpp
// mc_electron
//
// Created by Christian Reiling on 20.09.18.
// Copyright © 2018 Christian Reiling. All rights reserved.
//
#include "particle.hpp"
using namespace std;
std::string get_species_string(const species &spec) {
string res;
switch (spec) {
case electron:
res = "e-";
break;
case tritiumI:
res = "T+";
break;
case tritium2I:
res = "T2+";
break;
case tritium2:
res = "T2";
break;
default:
stringstream ss;
ss<<"get_species_string: Species not defined\n";
throw MyException(ss.str());
}
return (res);
}
double get_species_mass(const species &spec) {
double res;
switch (spec) {
case electron:
res = me_eV;
break;
case tritiumI:
res = mT_eV;
break;
case tritium2I:
res = mT2_eV;
break;
case tritium2:
res = mT2_eV;
break;
default:
stringstream ss;
ss<<"get_species_mass: Species not defined\n";
throw MyException(ss.str());
}
return (res);
}
ostream& operator<<(ostream& os, const species& spec) {
os<<get_species_string(spec);
return (os);
}
ostream& operator<<(ostream& os, const Particle& partOut) {
os
<< partOut.Id << ";"
<<partOut.parentId << ";"
<<partOut.s << ";"
<<partOut.m_eV << ";"
<< partOut.Z << ";"
<< partOut.x_m[0] << ";"
<< partOut.x_m[1] << ";"
<< partOut.x_m[2] << ";"
<< partOut.v_ms[0] << ";"
<< partOut.v_ms[1] << ";"
<< partOut.v_ms[2] ;
return os;
}
Particle::Particle(double mass_eV, double charge_e,vec3 loc_m, vec3 speed_ms, double idnum, double parentIdnum, species spec) {
m_eV = mass_eV;
Z = charge_e;
x_m = loc_m;
v_ms = speed_ms;
Id = idnum;
parentId = parentIdnum;
s = spec;
}