diff --git a/docs/100_particles.gif b/docs/100_particles.gif
index 337c6e5..53eb275 100644
Binary files a/docs/100_particles.gif and b/docs/100_particles.gif differ
diff --git a/docs/Particle_8cpp_source.html b/docs/Particle_8cpp_source.html
index 13c1950..cac8cb5 100644
--- a/docs/Particle_8cpp_source.html
+++ b/docs/Particle_8cpp_source.html
@@ -105,8 +105,8 @@ $(document).ready(function(){initNavTree('Particle_8cpp_source.html',''); initRe
- 16 arma::vec::fixed<3> r_vec,
- 17 arma::vec::fixed<3> v_vec)
+
+
@@ -120,6 +120,7 @@ $(document).ready(function(){initNavTree('Particle_8cpp_source.html',''); initRe
+arma::vec::fixed< 3 > vec_3d
Typedef for a fixed 3d arma vector.
diff --git a/docs/Particle_8hpp_source.html b/docs/Particle_8hpp_source.html
index f3339f5..98ff655 100644
--- a/docs/Particle_8hpp_source.html
+++ b/docs/Particle_8hpp_source.html
@@ -128,7 +128,7 @@ $(document).ready(function(){initNavTree('Particle_8hpp_source.html',''); initRe
-A class that simulates a Penning trap.
+A class that simulates a Penning trap.
Useful typedefs for cleaner code.
arma::vec::fixed< 3 > vec_3d
Typedef for a fixed 3d arma vector.
diff --git a/docs/PenningTrap_8cpp.html b/docs/PenningTrap_8cpp.html
index 5817ff6..81ea9db 100644
--- a/docs/PenningTrap_8cpp.html
+++ b/docs/PenningTrap_8cpp.html
@@ -105,9 +105,6 @@ $(document).ready(function(){initNavTree('PenningTrap_8cpp.html',''); initResiza
The implementation of the PenningTrap class.
More...
#include "PenningTrap.hpp "
-
#include "constants.hpp "
-
#include "typedefs.hpp "
-
#include "utils.hpp "
Go to the source code of this file.
diff --git a/docs/PenningTrap_8cpp_source.html b/docs/PenningTrap_8cpp_source.html
index 282e5c2..fab32cb 100644
--- a/docs/PenningTrap_8cpp_source.html
+++ b/docs/PenningTrap_8cpp_source.html
@@ -103,310 +103,336 @@ $(document).ready(function(){initNavTree('PenningTrap_8cpp_source.html',''); ini
Go to the documentation of this file.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
28 std::function<
double (
double )> V_0,
double d,
double t)
-
-
-
-
32 for (
size_t j = 0; j < i; j++) {
-
33 r =
vec_3d ().randn() * .1 * this->
d ;
-
34 v =
vec_3d ().randn() * .1 * this->
d ;
-
-
-
-
-
-
40 std::function<
double (
double )> V_0,
double d,
double t)
-
-
-
-
-
-
-
-
-
-
50 return .5 * dt * this->
k_v [0][j];
-
-
52 return .5 * dt * this->k_v[1][j];
-
-
54 return dt * this->k_v[2][j];
-
-
56 return (dt / 6.) * (this->k_v[0][j].eval() + this->k_v[1][j].eval() +
-
57 this->k_v[2][j].eval() + this->k_v[3][j].eval());
-
-
59 std::cout <<
"Not valid!" << std::endl;
-
-
-
-
-
-
-
-
-
68 return .5 * dt * this->
k_r [0][j];
-
-
70 return .5 * dt * this->k_r[1][j];
-
-
72 return dt * this->k_r[2][j];
-
-
74 return (dt / 6.) * (this->k_r[0][j].eval() + this->k_r[1][j].eval() +
-
75 this->k_r[2][j].eval() + this->k_r[3][j].eval());
-
-
77 std::cout <<
"Not valid!" << std::endl;
-
-
-
-
-
-
-
84 this->particles.push_back(particle);
-
-
-
-
-
-
90 double f = this->
V_0 (this->
t ) / (this->
d * this->
d );
+
+
+
+
+
+
+
+
+
+
+
+
25 std::function<
double (
double )> V_0,
double d,
double t)
+
+
+
+
29 for (
size_t j = 0; j < i; j++) {
+
30 r =
vec_3d ().randn() * .1 * this->
d ;
+
31 v =
vec_3d ().randn() * .1 * this->
d ;
+
+
+
+
+
+
37 std::function<
double (
double )> V_0,
double d,
double t)
+
+
+
+
+
+
+
+
+
+
47 return .5 * dt * this->
k_v [0][j];
+
+
49 return .5 * dt * this->k_v[1][j];
+
+
51 return dt * this->k_v[2][j];
+
+
53 return (dt / 6.) * (this->k_v[0][j] + 2. * this->k_v[1][j] +
+
54 2. * this->k_v[2][j] + this->k_v[3][j]);
+
+
56 std::cout <<
"Not valid!" << std::endl;
+
+
+
+
+
+
+
+
+
65 return .5 * dt * this->
k_r [0][j];
+
+
67 return .5 * dt * this->k_r[1][j];
+
+
69 return dt * this->k_r[2][j];
+
+
71 return (dt / 6.) * (this->k_r[0][j] + 2. * this->k_r[1][j] +
+
72 2. * this->k_r[2][j] + this->k_r[3][j]);
+
+
74 std::cout <<
"Not valid!" << std::endl;
+
+
+
+
+
+
+
81 this->particles.push_back(particle);
+
+
+
+
+
+
87 double f = this->
V_0 (this->
t ) / (this->
d * this->
d );
+
+
+
-
-
-
-
-
-
97 return vec_3d {0., 0., this->B_0};
-
-
-
-
-
-
-
-
-
-
107 double norm = arma::norm(res, 2);
-
-
-
-
111 return vec_3d (res * p_j.
q / (norm * norm * norm));
-
-
-
-
-
-
-
118 if (arma::norm(p.
r_vec ) > this->d) {
-
119 return vec_3d {0., 0., 0.};
-
-
-
-
-
124 arma::cross(p.
v_vec , this->external_B_field(p.
r_vec )));
-
-
-
+
+
+
94 return vec_3d {0., 0., this->B_0};
+
+
+
+
+
+
100 vec_3d res = this->particles[i].r_vec - this->particles[j].r_vec;
+
+
+
103 double norm = arma::norm(res, 2);
+
+
105 return vec_3d (res * this->particles[j].q / (norm * norm * norm));
+
+
+
+
+
+
+
112 if (arma::norm(p.
r_vec ) > this->d) {
+
113 return vec_3d {0., 0., 0.};
+
+
+
+
+
118 arma::cross(p.
v_vec , this->external_B_field(p.
r_vec )));
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
135 for (
size_t j = 0; j < this->particles.size(); j++) {
-
-
-
+
129 for (
size_t j = 0; j < this->particles.size(); j++) {
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
142 if (arma::norm(this->particles[i].r_vec) > this->
d ) {
+
143 return vec_3d {0., 0., 0.};
+
+
+
+
+
+
-
-
+
151 std::vector<Particle> original_particles = this->
particles ;
+
152 std::vector<Particle> tmp_particles = this->
particles ;
-
154 std::vector<Particle> original_particles = this->
particles ;
-
155 std::vector<Particle> tmp_particles = this->
particles ;
-
-
-
158 if (particle_interaction) {
-
+
+
155 if (particle_interaction) {
+
+
+
+
-
-
-
-
-
165 size_t size = this->particles.size();
+
+
162 size_t size = this->particles.size();
+
+
+
-
-
-
-
170 for (
size_t i = 0; i < 4; i++) {
-
171 #pragma omp parallel for
-
172 for (
size_t j = 0; j < this->particles.size(); j++) {
-
173 this->
k_v [i][j] = (this->*force)(j) / this->particles[j].m;
-
174 this->
k_r [i][j] = this->particles[j].v_vec;
-
-
-
-
178 p->
v_vec = original_particles[j].v_vec + this->
v_func (i, j, dt);
-
179 p->
r_vec = original_particles[j].r_vec + this->
r_func (i, j, dt);
-
-
181 this->particles = tmp_particles;
-
-
-
-
-
-
-
188 std::vector<Particle> new_state = this->
particles ;
-
-
-
-
-
193 if (particle_interaction) {
-
+
167 for (
size_t i = 0; i < 4; i++) {
+
168 #pragma omp parallel for
+
169 for (
size_t j = 0; j < this->particles.size(); j++) {
+
170 this->
k_v [i][j] = (this->*force)(j) / this->particles[j].m;
+
171 this->
k_r [i][j] = this->particles[j].v_vec;
+
+
+
+
175 p->
v_vec = original_particles[j].v_vec + this->
v_func (i, j, dt);
+
176 p->
r_vec = original_particles[j].r_vec + this->
r_func (i, j, dt);
+
+
178 this->particles.swap(tmp_particles);
+
+
+
+
+
+
+
185 size_t size = this->particles.size();
+
+
+
+
+
190 if (particle_interaction) {
+
+
+
+
-
-
-
-
-
200 #pragma omp parallel for private(p)
-
201 for (
size_t i = 0; i < this->particles.size(); i++) {
-
-
203 p->
v_vec += dt * (this->*force)(i) / p->
m ;
-
204 p->
r_vec += dt * this->particles[i].v_vec;
-
-
-
207 this->particles = new_state;
-
-
-
-
-
212 std::string method,
bool particle_interaction)
-
-
214 double dt = time / (double)steps;
-
-
+
+
197 #pragma omp parallel for
+
198 for (
size_t i = 0; i < size; i++) {
+
199 force_res[i] = (this->*force)(i);
+
+
+
202 #pragma omp parallel for private(p)
+
203 for (
size_t i = 0; i < size; i++) {
+
204 p = &this->particles[i];
+
+
206 p->
v_vec += dt * force_res[i] / p->
m ;
+
+
+
+
+
+
+
+
214 bool particle_interaction)
+
+
216 double dt = time / (double)steps;
-
-
219 if (method ==
"rk4" ) {
-
-
-
222 else if (method ==
"euler" ) {
-
-
-
-
226 std::cout <<
"Not a valid method!" << std::endl;
-
-
-
-
230 for (
size_t j = 0; j < steps; j++) {
-
231 for (
size_t i = 0; i < this->particles.size(); i++) {
-
232 res[i][j] = this->particles[i].r_vec;
-
-
234 (this->*func)(dt, particle_interaction);
-
-
-
-
-
-
-
241 int steps, std::string method,
-
242 bool particle_interaction)
-
-
244 if (path.back() !=
'/' ) {
-
-
-
247 if (
mkpath (path, 0777) != 0) {
-
248 std::cout <<
"Hello" << std::endl;
-
-
-
-
252 sim_arr res = this->
simulate (time, steps, method, particle_interaction);
-
-
-
-
256 #pragma omp parallel for private(ofile)
-
257 for (
size_t i = 0; i < this->particles.size(); i++) {
-
258 ofile.open(path +
"particle_" + std::to_string(i) +
".txt" );
-
259 for (
vec_3d &vec : res[i]) {
-
260 ofile << vec(0) <<
"," << vec(1) <<
"," << vec(2) <<
"\n" ;
-
-
-
-
-
-
-
-
268 sim_arr res = this->
simulate (time, steps, method, particle_interaction);
-
-
270 int particles_left = 0;
-
-
272 for (
Particle p : this->particles) {
-
273 if (arma::norm(p.r_vec) < this->d) {
-
-
-
-
-
278 return (
double ) particles_left / (double) this->particles.size();
+
218 unsigned int size = this->particles.size();
+
+
+
+
+
+
224 if (method ==
"rk4" ) {
+
+
+
227 else if (method ==
"euler" ) {
+
+
+
+
231 std::cout <<
"Not a valid method!" << std::endl;
+
+
+
+
235 for (
size_t j = 0; j < steps; j++) {
+
236 for (
size_t i = 0; i < size; i++) {
+
237 res.r_vecs[i][j] = this->particles[i].r_vec;
+
238 res.v_vecs[i][j] = this->particles[i].v_vec;
+
+
240 (this->*func)(dt, particle_interaction);
+
+
+
+
+
+
+
+
+
249 bool particle_interaction)
+
+
251 if (path.back() !=
'/' ) {
+
+
+
254 if (
mkpath (path, 0777) != 0) {
+
255 std::cout <<
"Hello" << std::endl;
+
+
+
+
+
260 this->
simulate (time, steps, method, particle_interaction);
+
+
+
+
264 #pragma omp parallel for private(ofile)
+
265 for (
size_t i = 0; i < this->particles.size(); i++) {
+
266 ofile.open(path +
"particle_" + std::to_string(i) +
"_r.txt" );
+
267 for (
vec_3d &vec : res.r_vecs[i]) {
+
268 ofile << vec(0) <<
"," << vec(1) <<
"," << vec(2) <<
"\n" ;
+
+
+
271 ofile.open(path +
"particle_" + std::to_string(i) +
"_v.txt" );
+
272 for (
vec_3d &vec : res.v_vecs[i]) {
+
+
+
+
+
+
+
+
+
283 bool particle_interaction)
+
+
+
286 this->
simulate (time, steps, method, particle_interaction);
+
+
288 int particles_left = 0;
+
+
290 for (
Particle p : this->particles) {
+
291 if (arma::norm(p.r_vec) < this->d) {
+
+
+
+
+
296 return (
double )particles_left / (double)this->particles.size();
+
+
+
299 vec_3d PenningTrap::get_r(
int i)
+
+
301 return this->particles[i].r_vec;
+
+
+
304 double PenningTrap::get_t()
+
+
+
A class for simulating a Penning trap.
A class that holds attributes of a particle.
-
A class that simulates a Penning trap.
-
std::vector< Particle > particles
The particles in the Penning trap.
-
double fraction_of_particles_left(double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)
Simulate and calculate what fraction of particles are still left inside the Penning trap after the si...
-
double B_0
Magnetic field strength.
-
vec_3d external_E_field(vec_3d r)
Calculate E at point r.
-
vec_3d total_force(unsigned int i)
calculate the total force on a particle p_i.
-
-
void evolve_RK4(double dt, bool particle_interaction=true)
Go forward one timestep using the RK4 method.
-
vec_3d r_func(unsigned int i, unsigned int j, double dt)
Helper for evolve_RK4 when calculating values.
-
vec_3d total_force_particles(unsigned int i)
Calculate the total force on a particle p_i from other particles.
-
sim_arr simulate(double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)
Simulate the particle system inside the Penning trap over a certain amount of time.
-
double d
Characteristic dimension.
-
void add_particle(Particle particle)
Add a particle to the system.
-
-
vec_3d force_on_particle(unsigned int i, unsigned int j)
Calculate the force between 2 particles.
-
std::function< double(double)> V_0
Applied potential.
-
void evolve_forward_euler(double dt, bool particle_interaction=true)
Go forward one timestep using the forward Euler method.
-
void write_simulation_to_dir(std::string path, double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)
Simulate and write the displacement of all particles to files.
-
vec_3d external_B_field(vec_3d r)
Calculate B at point r.
-
PenningTrap(double B_0=T, std::function< double(double)> V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)
Constructor for the PenningTrap class.
-
vec_3d total_force_external(unsigned int i)
Calculate the total external force on a particle.
-
-
vec_3d v_func(unsigned int i, unsigned int j, double dt)
Helper for evolve_RK4 when calculating values.
-
+
A class that simulates a Penning trap.
+
std::vector< Particle > particles
The particles in the Penning trap.
+
double fraction_of_particles_left(double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)
Simulate and calculate what fraction of particles are still left inside the Penning trap after the si...
+
double B_0
Magnetic field strength.
+
vec_3d external_E_field(vec_3d r)
Calculate E at point r.
+
vec_3d total_force(unsigned int i)
calculate the total force on a particle p_i.
+
+
void evolve_RK4(double dt, bool particle_interaction=true)
Go forward one timestep using the RK4 method.
+
vec_3d r_func(unsigned int i, unsigned int j, double dt)
Helper for evolve_RK4 when calculating values.
+
vec_3d total_force_particles(unsigned int i)
Calculate the total force on a particle p_i from other particles.
+
double d
Characteristic dimension.
+
void add_particle(Particle particle)
Add a particle to the system.
+
+
vec_3d force_on_particle(unsigned int i, unsigned int j)
Calculate the force between 2 particles.
+
std::function< double(double)> V_0
Applied potential.
+
void evolve_forward_euler(double dt, bool particle_interaction=true)
Go forward one timestep using the forward Euler method.
+
void write_simulation_to_dir(std::string path, double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)
Simulate and write the displacement of all particles to files.
+
vec_3d external_B_field(vec_3d r)
Calculate B at point r.
+
simulation_t simulate(double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)
Simulate the particle system inside the Penning trap over a certain amount of time.
+
PenningTrap(double B_0=T, std::function< double(double)> V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)
Constructor for the PenningTrap class.
+
vec_3d total_force_external(unsigned int i)
Calculate the total external force on a particle.
+
+
vec_3d v_func(unsigned int i, unsigned int j, double dt)
Helper for evolve_RK4 when calculating values.
#define K_E
Coulomb constant. unit: .
-
Useful typedefs for cleaner code.
+
Typedef for PenningTrap::simulation return value.
std::vector< arma::vec::fixed< 3 > > sim_cols
Typedef for the column of the result vector from simulating particles.
arma::vec::fixed< 3 > vec_3d
Typedef for a fixed 3d arma vector.
std::vector< sim_cols > sim_arr
Typedef for the result of the simulate method.
-
Function prototypes and macros that are useful.
-
bool mkpath(std::string path, int mode=0777)
Make path given.
+
bool mkpath(std::string path, int mode=0777)
Make path given.
+
std::string scientific_format(double d, int width=20, int prec=10)
Turns a double into a string written in scientific format.
diff --git a/docs/PenningTrap_8hpp.html b/docs/PenningTrap_8hpp.html
index 5f6ee45..7632939 100644
--- a/docs/PenningTrap_8hpp.html
+++ b/docs/PenningTrap_8hpp.html
@@ -111,6 +111,7 @@ $(document).ready(function(){initNavTree('PenningTrap_8hpp.html',''); initResiza
#include "Particle.hpp "
#include "constants.hpp "
#include "typedefs.hpp "
+#include "utils.hpp "
Go to the source code of this file.
diff --git a/docs/PenningTrap_8hpp_source.html b/docs/PenningTrap_8hpp_source.html
index dfdddbe..cc866c3 100644
--- a/docs/PenningTrap_8hpp_source.html
+++ b/docs/PenningTrap_8hpp_source.html
@@ -111,105 +111,111 @@ $(document).ready(function(){initNavTree('PenningTrap_8hpp_source.html',''); ini
-
- 22 #pragma omp declare reduction(+ : vec_3d : omp_out += omp_in) \
- 23 initializer(omp_priv = omp_orig)
-
-
-
-
- 33 std::function<double(
double )>
V_0 ;
-
-
-
-
-
-
- 52 vec_3d v_func (
unsigned int i,
unsigned int j,
double dt);
-
- 64 vec_3d r_func (
unsigned int i,
unsigned int j,
double dt);
-
-
-
-
- 76 std::function<
double (
double )>
V_0 =
- 77 [](
double t ) {
return 25. *
V / 1000.; },
- 78 double d = 500.,
double t = 0.);
-
-
- 89 unsigned int i,
double B_0 =
T ,
- 90 std::function<
double (
double )>
V_0 =
- 91 [](
double t ) {
return 25. *
V / 1000.; },
- 92 double d = 500.,
double t = 0.);
-
-
-
- 104 std::function<
double (
double )>
V_0 =
- 105 [](
double t ) {
return 25. *
V / 1000.; },
- 106 double d = 500.,
double t = 0.);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 174 void evolve_RK4 (
double dt,
bool particle_interaction =
true );
-
-
-
-
- 192 std::string method =
"rk4" ,
- 193 bool particle_interaction =
true );
-
-
- 204 unsigned int steps, std::string method =
"rk4" ,
- 205 bool particle_interaction =
true );
-
-
- 218 std::string method =
"rk4" ,
- 219 bool particle_interaction =
true );
-
-
-
+
+
+ 23 #pragma omp declare reduction(+ : vec_3d : omp_out += omp_in) \
+ 24 initializer(omp_priv = omp_orig)
+
+
+
+
+ 34 std::function<double(
double )>
V_0 ;
+
+
+
+
+
+
+ 53 vec_3d v_func (
unsigned int i,
unsigned int j,
double dt);
+
+ 65 vec_3d r_func (
unsigned int i,
unsigned int j,
double dt);
+
+
+
+
+ 77 std::function<
double (
double )>
V_0 =
+ 78 [](
double t ) {
return 25. *
V / 1000.; },
+ 79 double d = 500.,
double t = 0.);
+
+
+ 90 unsigned int i,
double B_0 =
T ,
+ 91 std::function<
double (
double )>
V_0 =
+ 92 [](
double t ) {
return 25. *
V / 1000.; },
+ 93 double d = 500.,
double t = 0.);
+
+
+
+ 105 std::function<
double (
double )>
V_0 =
+ 106 [](
double t ) {
return 25. *
V / 1000.; },
+ 107 double d = 500.,
double t = 0.);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 175 void evolve_RK4 (
double dt,
bool particle_interaction =
true );
+
+
+
+
+ 195 std::string method =
"rk4" ,
+ 196 bool particle_interaction =
true );
+
+
+ 207 unsigned int steps, std::string method =
"rk4" ,
+ 208 bool particle_interaction =
true );
+
+
+ 221 std::string method =
"rk4" ,
+ 222 bool particle_interaction =
true );
+
+
+
+
+
+
A class that holds the properties of a particle.
A class that holds attributes of a particle.
-A class that simulates a Penning trap.
-std::vector< Particle > particles
The particles in the Penning trap.
-double fraction_of_particles_left(double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)
Simulate and calculate what fraction of particles are still left inside the Penning trap after the si...
-double B_0
Magnetic field strength.
-vec_3d external_E_field(vec_3d r)
Calculate E at point r.
-vec_3d total_force(unsigned int i)
calculate the total force on a particle p_i.
-
-void evolve_RK4(double dt, bool particle_interaction=true)
Go forward one timestep using the RK4 method.
-vec_3d r_func(unsigned int i, unsigned int j, double dt)
Helper for evolve_RK4 when calculating values.
-vec_3d total_force_particles(unsigned int i)
Calculate the total force on a particle p_i from other particles.
-sim_arr simulate(double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)
Simulate the particle system inside the Penning trap over a certain amount of time.
-double d
Characteristic dimension.
-void add_particle(Particle particle)
Add a particle to the system.
-
-vec_3d force_on_particle(unsigned int i, unsigned int j)
Calculate the force between 2 particles.
-std::function< double(double)> V_0
Applied potential.
-void evolve_forward_euler(double dt, bool particle_interaction=true)
Go forward one timestep using the forward Euler method.
-void write_simulation_to_dir(std::string path, double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)
Simulate and write the displacement of all particles to files.
-vec_3d external_B_field(vec_3d r)
Calculate B at point r.
-vec_3d total_force_external(unsigned int i)
Calculate the total external force on a particle.
-
-vec_3d v_func(unsigned int i, unsigned int j, double dt)
Helper for evolve_RK4 when calculating values.
+A class that simulates a Penning trap.
+std::vector< Particle > particles
The particles in the Penning trap.
+double fraction_of_particles_left(double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)
Simulate and calculate what fraction of particles are still left inside the Penning trap after the si...
+double B_0
Magnetic field strength.
+vec_3d external_E_field(vec_3d r)
Calculate E at point r.
+vec_3d total_force(unsigned int i)
calculate the total force on a particle p_i.
+
+void evolve_RK4(double dt, bool particle_interaction=true)
Go forward one timestep using the RK4 method.
+vec_3d r_func(unsigned int i, unsigned int j, double dt)
Helper for evolve_RK4 when calculating values.
+vec_3d total_force_particles(unsigned int i)
Calculate the total force on a particle p_i from other particles.
+double d
Characteristic dimension.
+void add_particle(Particle particle)
Add a particle to the system.
+
+vec_3d force_on_particle(unsigned int i, unsigned int j)
Calculate the force between 2 particles.
+std::function< double(double)> V_0
Applied potential.
+void evolve_forward_euler(double dt, bool particle_interaction=true)
Go forward one timestep using the forward Euler method.
+void write_simulation_to_dir(std::string path, double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)
Simulate and write the displacement of all particles to files.
+vec_3d external_B_field(vec_3d r)
Calculate B at point r.
+simulation_t simulate(double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)
Simulate the particle system inside the Penning trap over a certain amount of time.
+vec_3d total_force_external(unsigned int i)
Calculate the total external force on a particle.
+
+vec_3d v_func(unsigned int i, unsigned int j, double dt)
Helper for evolve_RK4 when calculating values.
+Typedef for PenningTrap::simulation return value.
Useful typedefs for cleaner code.
arma::vec::fixed< 3 > vec_3d
Typedef for a fixed 3d arma vector.
std::vector< sim_cols > sim_arr
Typedef for the result of the simulate method.
+Function prototypes and macros that are useful.
diff --git a/docs/animate__100__particles_8py_source.html b/docs/animate__100__particles_8py_source.html
index af734ca..0475106 100644
--- a/docs/animate__100__particles_8py_source.html
+++ b/docs/animate__100__particles_8py_source.html
@@ -5,7 +5,7 @@
-Penning Trap Simulation: src/animate_100_particles.py Source File
+Penning Trap Simulation: src/scripts/animate_100_particles.py Source File
@@ -177,7 +177,7 @@ $(document).ready(function(){initNavTree('animate__100__particles_8py_source.htm
- src animate_100_particles.py
+ src scripts animate_100_particles.py
diff --git a/docs/annotated.html b/docs/annotated.html
index fdee9b2..323b2f9 100644
--- a/docs/annotated.html
+++ b/docs/annotated.html
@@ -105,7 +105,8 @@ $(document).ready(function(){initNavTree('annotated.html',''); initResizable();
diff --git a/docs/annotated_dup.js b/docs/annotated_dup.js
index 574cc6b..c52b935 100644
--- a/docs/annotated_dup.js
+++ b/docs/annotated_dup.js
@@ -2,5 +2,6 @@ var annotated_dup =
[
[ "Particle", "classParticle.html", "classParticle" ],
[ "PenningTrap", "classPenningTrap.html", "classPenningTrap" ],
- [ "PenningTrapTest", "classPenningTrapTest.html", null ]
+ [ "PenningTrapTest", "classPenningTrapTest.html", null ],
+ [ "simulation", "structsimulation.html", null ]
];
\ No newline at end of file
diff --git a/docs/classPenningTrap-members.html b/docs/classPenningTrap-members.html
index 859c052..973ffb0 100644
--- a/docs/classPenningTrap-members.html
+++ b/docs/classPenningTrap-members.html
@@ -113,6 +113,8 @@ $(document).ready(function(){initNavTree('classPenningTrap.html',''); initResiza
external_E_field (vec_3d r)PenningTrap
force_on_particle (unsigned int i, unsigned int j)PenningTrap
fraction_of_particles_left (double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)PenningTrap
+ get_r (int i) (defined in PenningTrap )PenningTrap
+ get_t () (defined in PenningTrap )PenningTrap
k_r PenningTrap private
k_v PenningTrap private
particles PenningTrap private
@@ -120,7 +122,7 @@ $(document).ready(function(){initNavTree('classPenningTrap.html',''); initResiza
PenningTrap (unsigned int i, double B_0=T, std::function< double(double)> V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)PenningTrap
PenningTrap (std::vector< Particle > particles, double B_0=T, std::function< double(double)> V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)PenningTrap
r_func (unsigned int i, unsigned int j, double dt)PenningTrap private
- simulate (double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)PenningTrap
+ simulate (double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)PenningTrap
t PenningTrap private
total_force (unsigned int i)PenningTrap
total_force_external (unsigned int i)PenningTrap
diff --git a/docs/classPenningTrap.html b/docs/classPenningTrap.html
index 9afb617..f5952a9 100644
--- a/docs/classPenningTrap.html
+++ b/docs/classPenningTrap.html
@@ -150,15 +150,19 @@ Public Member Functions
void evolve_forward_euler (double dt, bool particle_interaction=true)
Go forward one timestep using the forward Euler method.
-sim_arr simulate (double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)
- Simulate the particle system inside the Penning trap over a certain amount of time.
-
+simulation_t simulate (double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)
+ Simulate the particle system inside the Penning trap over a certain amount of time.
+
void write_simulation_to_dir (std::string path, double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)
Simulate and write the displacement of all particles to files.
double fraction_of_particles_left (double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)
Simulate and calculate what fraction of particles are still left inside the Penning trap after the simulation.
+vec_3d get_r (int i)
+
+double get_t ()
+
@@ -195,7 +199,7 @@ Private Attributes
A class that simulates a Penning trap.
This class simulates a Penning trap. It can take in a number of particles and simulate how they would behave inside a Penning trap.
-
Definition at line 30 of file PenningTrap.hpp .
+
Definition at line 31 of file PenningTrap.hpp .
◆ PenningTrap() [1/3]
@@ -246,7 +250,7 @@ Private Attributes
-Definition at line 18 of file PenningTrap.cpp .
+Definition at line 15 of file PenningTrap.cpp .
@@ -306,7 +310,7 @@ Private Attributes
-Definition at line 27 of file PenningTrap.cpp .
+Definition at line 24 of file PenningTrap.cpp .
@@ -366,7 +370,7 @@ Private Attributes
-Definition at line 39 of file PenningTrap.cpp .
+Definition at line 36 of file PenningTrap.cpp .
@@ -395,7 +399,7 @@ Private Attributes
-Definition at line 82 of file PenningTrap.cpp .
+Definition at line 79 of file PenningTrap.cpp .
@@ -434,7 +438,7 @@ Private Attributes
-Definition at line 186 of file PenningTrap.cpp .
+Definition at line 183 of file PenningTrap.cpp .
@@ -473,7 +477,7 @@ Private Attributes
-Definition at line 151 of file PenningTrap.cpp .
+Definition at line 148 of file PenningTrap.cpp .
@@ -502,7 +506,7 @@ Private Attributes
Returns vec_3d
-Definition at line 95 of file PenningTrap.cpp .
+Definition at line 92 of file PenningTrap.cpp .
@@ -531,7 +535,7 @@ Private Attributes
Returns vec_3d
-Definition at line 87 of file PenningTrap.cpp .
+Definition at line 84 of file PenningTrap.cpp .
@@ -572,7 +576,7 @@ Private Attributes
Returns vec_3d
-Definition at line 100 of file PenningTrap.cpp .
+Definition at line 97 of file PenningTrap.cpp .
@@ -626,7 +630,46 @@ Private Attributes
Returns double
-Definition at line 266 of file PenningTrap.cpp .
+Definition at line 281 of file PenningTrap.cpp .
+
+
+
+
+◆ get_r()
+
+
+
+
+
+ vec_3d PenningTrap::get_r
+ (
+ int
+ i )
+
+
+
+
+
+
+◆ get_t()
+
+
+
+
+
+ double PenningTrap::get_t
+ (
+ )
+
+
+
+
@@ -676,24 +719,24 @@ Private Attributes
i Index i for \(k_{r,i,j}\)
j Index j for \(k_{r,i,j}\)
- dt the step length (delta time)
+ dt The step length (delta time)
Returns vec_3d
-Definition at line 64 of file PenningTrap.cpp .
+Definition at line 61 of file PenningTrap.cpp .
-
-◆ simulate()
+
+◆ simulate()
- sim_arr PenningTrap::simulate
+ simulation_t PenningTrap::simulate
(
double
time ,
@@ -730,12 +773,13 @@ Private Attributes
time The time to simulate in microseconds
steps The amount of steps for the whole simulation
method The method to use when moving forward a timestep
- particle_interaction Turn particle interactions on/off
+ particle_interaction Turn particle interactions on/off
+
Returns simulation_t
-
Definition at line 211 of file PenningTrap.cpp .
+
Definition at line 212 of file PenningTrap.cpp .
@@ -764,7 +808,7 @@ Private Attributes
Returns vec_3d
-Definition at line 146 of file PenningTrap.cpp .
+Definition at line 140 of file PenningTrap.cpp .
@@ -794,7 +838,7 @@ Private Attributes
Returns vec_3d
-Definition at line 114 of file PenningTrap.cpp .
+Definition at line 108 of file PenningTrap.cpp .
@@ -823,7 +867,7 @@ Private Attributes
Returns vec_3d
-Definition at line 129 of file PenningTrap.cpp .
+Definition at line 123 of file PenningTrap.cpp .
@@ -879,7 +923,7 @@ Private Attributes
Returns vec_3d
-Definition at line 46 of file PenningTrap.cpp .
+Definition at line 43 of file PenningTrap.cpp .
@@ -939,7 +983,7 @@ Private Attributes
-Definition at line 240 of file PenningTrap.cpp .
+Definition at line 246 of file PenningTrap.cpp .
@@ -966,7 +1010,7 @@ Private Attributes
Magnetic field strength.
-Definition at line 32 of file PenningTrap.hpp .
+Definition at line 33 of file PenningTrap.hpp .
@@ -992,7 +1036,7 @@ Private Attributes
Characteristic dimension.
-Definition at line 34 of file PenningTrap.hpp .
+Definition at line 35 of file PenningTrap.hpp .
@@ -1017,7 +1061,7 @@ Private Attributes
A 2D vector containing all \(k_{i,j}\) where \(j\) is the index of a particle
-
Definition at line 39 of file PenningTrap.hpp .
+
Definition at line 40 of file PenningTrap.hpp .
@@ -1042,7 +1086,7 @@ Private Attributes
A 2D vector containing all \(k_{i,j}\) where \(j\) is the index of a particle
-
Definition at line 37 of file PenningTrap.hpp .
+
Definition at line 38 of file PenningTrap.hpp .
@@ -1068,7 +1112,7 @@ Private Attributes
The particles in the Penning trap.
-Definition at line 36 of file PenningTrap.hpp .
+Definition at line 37 of file PenningTrap.hpp .
@@ -1094,7 +1138,7 @@ Private Attributes
Current time.
-Definition at line 35 of file PenningTrap.hpp .
+Definition at line 36 of file PenningTrap.hpp .
@@ -1120,7 +1164,7 @@ Private Attributes
Applied potential.
-Definition at line 33 of file PenningTrap.hpp .
+Definition at line 34 of file PenningTrap.hpp .
diff --git a/docs/classPenningTrap.js b/docs/classPenningTrap.js
index 0fd7f36..c3edebd 100644
--- a/docs/classPenningTrap.js
+++ b/docs/classPenningTrap.js
@@ -11,7 +11,7 @@ var classPenningTrap =
[ "force_on_particle", "classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce", null ],
[ "fraction_of_particles_left", "classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b", null ],
[ "r_func", "classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648", null ],
- [ "simulate", "classPenningTrap.html#a5331837e6dd7bce807a99edd2ba7e854", null ],
+ [ "simulate", "classPenningTrap.html#ae09ef9cfa7e4ed1c108c8576405b3599", null ],
[ "total_force", "classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8", null ],
[ "total_force_external", "classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56", null ],
[ "total_force_particles", "classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b", null ],
diff --git a/docs/classPenningTrapTest-members.html b/docs/classPenningTrapTest-members.html
index 1b1f2e1..6a01a89 100644
--- a/docs/classPenningTrapTest-members.html
+++ b/docs/classPenningTrapTest-members.html
@@ -104,11 +104,11 @@ $(document).ready(function(){initNavTree('classPenningTrapTest.html',''); initRe
This is the complete list of members for PenningTrapTest , including all inherited members.
diff --git a/docs/classPenningTrapTest.html b/docs/classPenningTrapTest.html
index 8eda947..b058407 100644
--- a/docs/classPenningTrapTest.html
+++ b/docs/classPenningTrapTest.html
@@ -104,23 +104,32 @@ $(document).ready(function(){initNavTree('classPenningTrapTest.html',''); initRe
+
+
Test class for the Penning trap.
+ More...
-
-
Definition at line 20 of file test_suite.cpp .
+
Test class for the Penning trap.
+
+
Definition at line 22 of file test_suite.cpp .
◆ test_external_B_field()
@@ -145,7 +154,9 @@ Static Public Member Functions
@@ -172,7 +183,9 @@ Static Public Member Functions
@@ -199,7 +212,9 @@ Static Public Member Functions
@@ -226,7 +241,9 @@ Static Public Member Functions
@@ -253,7 +270,9 @@ Static Public Member Functions
-
Definition at line 108 of file test_suite.cpp .
+
Test that the total force of all particles on a single particle returns expected results.
+
+
Definition at line 121 of file test_suite.cpp .
diff --git a/docs/classes.html b/docs/classes.html
index 7b8f02e..11e3ca3 100644
--- a/docs/classes.html
+++ b/docs/classes.html
@@ -101,11 +101,14 @@ $(document).ready(function(){initNavTree('classes.html',''); initResizable(); })
diff --git a/docs/dir_634e799a3947388232110823971192a8.html b/docs/dir_634e799a3947388232110823971192a8.html
new file mode 100644
index 0000000..95b55e3
--- /dev/null
+++ b/docs/dir_634e799a3947388232110823971192a8.html
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+Penning Trap Simulation: src/scripts Directory Reference
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Penning Trap Simulation
+
+ Simulate particle behavior inside a Penning Trap
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+
+
+
+
+
+file animate_100_particles.py [code]
+
+file plot_2_particles.py [code]
+
+file plot_3d.py [code]
+
+file plot_particles_left.py [code]
+
+file plot_phase_space.py [code]
+
+file plot_relative_error.py [code]
+
+file plot_single_particle.py [code]
+
+
+
+
+
+
+
+
diff --git a/docs/dir_634e799a3947388232110823971192a8.js b/docs/dir_634e799a3947388232110823971192a8.js
new file mode 100644
index 0000000..f6030ae
--- /dev/null
+++ b/docs/dir_634e799a3947388232110823971192a8.js
@@ -0,0 +1,10 @@
+var dir_634e799a3947388232110823971192a8 =
+[
+ [ "animate_100_particles.py", "animate__100__particles_8py_source.html", null ],
+ [ "plot_2_particles.py", "plot__2__particles_8py_source.html", null ],
+ [ "plot_3d.py", "plot__3d_8py_source.html", null ],
+ [ "plot_particles_left.py", "plot__particles__left_8py_source.html", null ],
+ [ "plot_phase_space.py", "plot__phase__space_8py_source.html", null ],
+ [ "plot_relative_error.py", "plot__relative__error_8py_source.html", null ],
+ [ "plot_single_particle.py", "plot__single__particle_8py_source.html", null ]
+];
\ No newline at end of file
diff --git a/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.html b/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.html
index 4313bbd..a595b88 100644
--- a/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.html
+++ b/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.html
@@ -102,10 +102,13 @@ $(document).ready(function(){initNavTree('dir_68267d1309a1af8e8297ef4c3efbcdba.h
-file animate_100_particles.py [code]
-
file main.cpp [code]
The main program for this project.
@@ -115,8 +118,6 @@ Files
file PenningTrap.cpp [code]
The implementation of the PenningTrap class.
-file plot_particles_left.py [code]
-
file test_suite.cpp [code]
The test suite for the project.
diff --git a/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.js b/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.js
index 64ce7a5..b85a8c3 100644
--- a/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.js
+++ b/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.js
@@ -1,10 +1,9 @@
var dir_68267d1309a1af8e8297ef4c3efbcdba =
[
- [ "animate_100_particles.py", "animate__100__particles_8py_source.html", null ],
- [ "main.cpp", "main_8cpp.html", null ],
+ [ "scripts", "dir_634e799a3947388232110823971192a8.html", "dir_634e799a3947388232110823971192a8" ],
+ [ "main.cpp", "main_8cpp.html", "main_8cpp" ],
[ "Particle.cpp", "Particle_8cpp.html", null ],
[ "PenningTrap.cpp", "PenningTrap_8cpp.html", null ],
- [ "plot_particles_left.py", "plot__particles__left_8py_source.html", null ],
[ "test_suite.cpp", "test__suite_8cpp.html", "test__suite_8cpp" ],
[ "utils.cpp", "utils_8cpp.html", "utils_8cpp" ]
];
\ No newline at end of file
diff --git a/docs/files.html b/docs/files.html
index e842a47..0176ee4 100644
--- a/docs/files.html
+++ b/docs/files.html
@@ -102,7 +102,7 @@ $(document).ready(function(){initNavTree('files.html',''); initResizable(); });
Here is a list of all documented files with brief descriptions:
-
[detail level 1 2 ]
+[detail level 1 2 3 ]
diff --git a/docs/functions.html b/docs/functions.html
index a2f04ea..cc1a7e4 100644
--- a/docs/functions.html
+++ b/docs/functions.html
@@ -98,33 +98,92 @@ $(document).ready(function(){initNavTree('functions.html',''); initResizable();
-
Here is a list of all documented class members with links to the class documentation for each member:
+Here is a list of all documented class members with links to the class documentation for each member:
+
+ - a -
+
+
+ - b -
+
+
+ - d -
+
+
+ - e -
+
+
+ - f -
+
+
+ - k -
+
+
+ - m -
+
+
+ - p -
+
+
+ - q -
+
+
+ - r -
+
+
+ - s -
+
+
+ - t -
+
+
+ - v -
+
+
+ - w -
diff --git a/docs/functions_func.html b/docs/functions_func.html
index 1182b1d..5d4f949 100644
--- a/docs/functions_func.html
+++ b/docs/functions_func.html
@@ -109,7 +109,12 @@ $(document).ready(function(){initNavTree('functions_func.html',''); initResizabl
Particle() : Particle
PenningTrap() : PenningTrap
r_func() : PenningTrap
-simulate() : PenningTrap
+simulate() : PenningTrap
+test_external_B_field() : PenningTrapTest
+test_external_E_field() : PenningTrapTest
+test_force_on_particle() : PenningTrapTest
+test_total_force_external() : PenningTrapTest
+test_total_force_particles() : PenningTrapTest
total_force() : PenningTrap
total_force_external() : PenningTrap
total_force_particles() : PenningTrap
diff --git a/docs/globals.html b/docs/globals.html
index 19a9638..66911fb 100644
--- a/docs/globals.html
+++ b/docs/globals.html
@@ -100,16 +100,25 @@ $(document).ready(function(){initNavTree('globals.html',''); initResizable(); })
Here is a list of all documented file members with links to the documentation:
diff --git a/docs/globals_type.html b/docs/globals_type.html
index b7735cc..775a687 100644
--- a/docs/globals_type.html
+++ b/docs/globals_type.html
@@ -102,6 +102,7 @@ $(document).ready(function(){initNavTree('globals_type.html',''); initResizable(
sim_arr : typedefs.hpp
sim_cols : typedefs.hpp
sim_rows : typedefs.hpp
+simulation_t : typedefs.hpp
vec_3d : typedefs.hpp
diff --git a/docs/globals_vars.html b/docs/globals_vars.html
new file mode 100644
index 0000000..2c80e49
--- /dev/null
+++ b/docs/globals_vars.html
@@ -0,0 +1,114 @@
+
+
+
+
+
+
+
+Penning Trap Simulation: File Members
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Penning Trap Simulation
+
+ Simulate particle behavior inside a Penning Trap
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/index.html b/docs/index.html
index 29ac7fb..b9d7673 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -104,7 +104,65 @@ $(document).ready(function(){initNavTree('index.html',''); initResizable(); });
-
+ Repo
+
Documentation
+
+Requirements
+
+Operating systems
+
+Linux
+Has been tested on Fedora 38
+Will most likely work on other Linux distributions
+
+
+MacOS
+Might work, but hasn't been tested
+
+
+Windows
+Will most likely not work
+
+
+
+
+Libraries
+
+
+Compiling
+
Compiling is as easy as running this command while being inside the src directory:
+
+Running programs
+
+C++ binaries
+
To run main or test_suite , just run this command while being inside src:
+
+Python scripts
+
+Install libraries
+
Before running the scripts, make sure that all libraries are installed. Using pip, you can install all requirements like this:
+
pip install -r requirements.txt
+
This recursively install all the packages that are listed in requirements.txt .
+
+Running scripts
+
For the Python scripts, run them from the src directory like this:
+
python scripts/<script-name>
+
If you have any problems running the scripts, you might have to run this instead:
+
python3 scripts/<script-name>
+
Credits
The Doxygen theme used here is doxygen-awesome-css .
diff --git a/docs/main_8cpp.html b/docs/main_8cpp.html
index b83f224..c7ad43a 100644
--- a/docs/main_8cpp.html
+++ b/docs/main_8cpp.html
@@ -109,10 +109,10 @@ $(document).ready(function(){initNavTree('main_8cpp.html',''); initResizable();
The main program for this project.
More...
#include <cmath>
+
#include <complex>
#include <fstream>
#include <omp.h>
#include <string>
-
#include <sys/stat.h>
#include <vector>
#include "PenningTrap.hpp "
#include "utils.hpp "
@@ -123,7 +123,7 @@ $(document).ready(function(){initNavTree('main_8cpp.html',''); initResizable();
Macros
#define PARTICLES 100
-
#define N 10000
+
#define N 40000
#define CHARGE 1.
@@ -132,15 +132,23 @@ Macros
+vec_3d analytical_solution_particle_1 (double t)
+ The analytical solution for particle p1.
+
void simulate_single_particle ()
+ Simulate a single particle over the period of 50 \( \mu s \).
void simulate_two_particles ()
+ Simulate 2 particles over the period of 50 \( \mu s \) with and without particle interactions.
void simulate_single_particle_with_different_steps ()
+ Simulate a single particle over 50 \( \mu s \) using different amount of steps and different methods.
void simulate_100_particles ()
+ Simulate 100 particles over 50 \( \mu s \).
void simulate_100_particles_with_time_potential ()
+ Simulate 100 particles over 500 \( \mu s \) using a time dependent potential.
int main ()
@@ -149,9 +157,11 @@ Functions
Variables
Particle p1 (CHARGE, MASS, vec_3d {20., 0., 20.}, vec_3d {0., 25., 0.})
+ Particle 1.
Particle p2 (CHARGE, MASS, vec_3d {25., 25., 0.}, vec_3d {0., 40., 5.})
+ Particle 2.
@@ -203,7 +213,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
- #define N 10000
+ #define N 40000
@@ -229,6 +239,35 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
+
+
◆ analytical_solution_particle_1()
+
+
+
+
+
+ vec_3d analytical_solution_particle_1
+ (
+ double
+ t )
+
+
+
+
+
+
The analytical solution for particle p1.
+
Parameters
+
+
+
+
Returns vec_3d
+
+
Definition at line 38 of file main.cpp .
+
+
+
◆ main()
@@ -244,7 +283,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
@@ -263,7 +302,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
-
Definition at line 77 of file main.cpp .
+
Simulate 100 particles over 50 \( \mu s \).
+
+
Definition at line 131 of file main.cpp .
@@ -282,7 +323,10 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
-
Definition at line 91 of file main.cpp .
+
Simulate 100 particles over 500 \( \mu s \) using a time dependent potential.
+
The simulation sweeps over different frequencies in [0.2, 2.5] MHz.
+
+
Definition at line 146 of file main.cpp .
@@ -301,7 +345,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
-
Definition at line 31 of file main.cpp .
+
Simulate a single particle over the period of 50 \( \mu s \).
+
+
Definition at line 55 of file main.cpp .
@@ -320,7 +366,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
-
Definition at line 55 of file main.cpp .
+
Simulate a single particle over 50 \( \mu s \) using different amount of steps and different methods.
+
+
Definition at line 88 of file main.cpp .
@@ -339,7 +387,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
-
Definition at line 42 of file main.cpp .
+
Simulate 2 particles over the period of 50 \( \mu s \) with and without particle interactions.
+
+
Definition at line 70 of file main.cpp .
diff --git a/docs/main_8cpp.js b/docs/main_8cpp.js
new file mode 100644
index 0000000..8b2b87e
--- /dev/null
+++ b/docs/main_8cpp.js
@@ -0,0 +1,11 @@
+var main_8cpp =
+[
+ [ "analytical_solution_particle_1", "main_8cpp.html#a6451833d72816ef393087956c766125b", null ],
+ [ "simulate_100_particles", "main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513", null ],
+ [ "simulate_100_particles_with_time_potential", "main_8cpp.html#a330668384dc073980ba11116309bacc5", null ],
+ [ "simulate_single_particle", "main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6", null ],
+ [ "simulate_single_particle_with_different_steps", "main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2", null ],
+ [ "simulate_two_particles", "main_8cpp.html#a783789519f97c6430081171cacb0ffb1", null ],
+ [ "p1", "main_8cpp.html#a87da4ef9f2cd753579484824310467b8", null ],
+ [ "p2", "main_8cpp.html#a90f661586eb3c318fdca6f95ebc4fc46", null ]
+];
\ No newline at end of file
diff --git a/docs/main_8cpp_source.html b/docs/main_8cpp_source.html
index d437689..276eed1 100644
--- a/docs/main_8cpp_source.html
+++ b/docs/main_8cpp_source.html
@@ -103,148 +103,205 @@ $(document).ready(function(){initNavTree('main_8cpp_source.html',''); initResiza
Go to the documentation of this file.
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
-
-
31 void simulate_single_particle()
-
-
33 DEBUG (
"Inside single particle sim" );
-
-
-
-
-
38 DEBUG (
"Write to dir" );
-
39 trap.write_simulation_to_dir(
"output/simulate_single_particle" , time, N);
-
-
-
42 void simulate_two_particles()
-
-
44 PenningTrap trap_no_interaction(std::vector<Particle>{p1, p2});
-
45 PenningTrap trap_with_interaction(std::vector<Particle>{p1, p2});
-
-
-
-
-
50 "output/simulate_2_particles/no_interaction" , time, N,
"rk4" ,
false );
-
51 trap_with_interaction.write_simulation_to_dir(
-
52 "output/simulate_2_particles/with_interaction" , time, N);
-
-
-
55 void simulate_single_particle_with_different_steps()
+
+
+
+
+
+
+
40 double w_0 =
T / MASS;
+
41 double w_z2 = (50. *
V / 1000.) / (MASS * 500. * 500.);
+
42 double w_p = (w_0 + std::sqrt(w_0 * w_0 - 2. * w_z2)) / 2.;
+
43 double w_n = (w_0 - std::sqrt(w_0 * w_0 - 2. * w_z2)) / 2.;
+
44 double A_p = (25. + w_n * 20.) / (w_n - w_p);
+
45 double A_n = -(25. + w_p * 20.) / (w_n - w_p);
+
46 std::complex<double> f =
+
47 A_p * std::exp(std::complex<double>(0., -w_p * t)) +
+
48 A_n * std::exp(std::complex<double>(0., -w_n * t));
+
49 vec_3d res{std::real(f), std::imag(f), 20. * std::cos(std::sqrt(w_z2) * t)};
+
+
+
+
-
-
+
+
-
60 for (
int i = 0; i < 4; i++) {
-
61 int steps = 4000 * (i + 1);
-
-
-
64 std::to_string(steps) +
"_steps" ,
-
65 time, steps,
"rk4" ,
false );
-
-
-
68 for (
int i = 0; i < 4; i++) {
-
69 int steps = 4000 * (i + 1);
-
-
-
72 std::to_string(steps) +
"_steps" ,
-
73 time, steps,
"euler" ,
false );
-
-
-
-
77 void simulate_100_particles()
-
-
-
-
81 return 25. *
V / 1000. *
-
82 (1. + .4 * std::cos(1.5 * t));
-
-
-
-
-
-
-
-
-
91 void simulate_100_particles_with_time_potential()
-
-
93 double amplitudes[]{.1, .4, .7};
-
-
95 double freq_start = .2;
-
96 double freq_end = 2.5;
-
97 double freq_increment = .02;
-
98 size_t freq_iterations = (size_t) ((freq_end - freq_start) / freq_increment);
-
-
100 std::string path =
"output/time_dependent_potential/" ;
-
-
-
-
-
105 for (
double f : amplitudes) {
-
106 ofile.open(path +
"f_" + std::to_string(f) +
".txt" );
-
107 #pragma omp parallel for ordered schedule(static, 1)
-
108 for (
size_t i=0; i < freq_iterations; i++) {
-
109 double freq = freq_start + i*freq_increment;
-
-
111 [f, freq](
double t) {
-
112 return (25. *
V / 1000.) *
-
113 (1. + f * std::cos(freq * t));
-
-
-
-
-
118 ofile << freq <<
"," << res <<
"\n" ;
-
-
-
-
-
-
-
-
-
127 simulate_single_particle();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
80 "output/simulate_2_particles/no_interaction" , time, N,
"rk4" ,
false );
+
81 trap_with_interaction.write_simulation_to_dir(
+
82 "output/simulate_2_particles/with_interaction" , time, N);
+
+
+
+
+
+
+
+
+
+
95 std::string path =
"output/relative_error/RK4/" ;
+
+
97 for (
int i = 0; i < 4; i++) {
+
98 int steps = 4000 * std::pow(2, i);
+
99 double dt = time / (double)steps;
+
100 ofile.open(path + std::to_string(steps) +
"_steps.txt" );
+
+
102 simulation_t res = trap.simulate(time, steps,
"rk4" ,
false );
+
103 for (
int i = 0; i < steps; i++) {
+
104 ofile << arma::norm(res.r_vecs[0][i] -
+
+
+
+
+
+
+
+
112 path =
"output/relative_error/euler/" ;
+
+
114 for (
int i = 0; i < 4; i++) {
+
115 int steps = 4000 * std::pow(2, i);
+
116 double dt = time / (double)steps;
+
117 ofile.open(path + std::to_string(steps) +
"_steps.txt" );
+
+
119 simulation_t res = trap.simulate(time, steps,
"euler" ,
false );
+
120 for (
int i = 0; i < steps; i++) {
+
121 ofile << arma::norm(res.r_vecs[0][i] -
+
+
+
+
+
+
-
129 simulate_two_particles();
-
-
131 simulate_single_particle_with_different_steps();
-
-
133 double start = omp_get_wtime();
+
+
+
-
+
-
137 simulate_100_particles_with_time_potential();
-
-
139 double end = omp_get_wtime();
-
-
141 std::cout <<
"Time: " << end - start <<
" seconds" << std::endl;
-
-
-
+
+
+
+
+
+
+
+
150 double amplitudes[]{.1, .4, .7};
+
+
152 double freq_start = .2;
+
153 double freq_end = 2.5;
+
154 double freq_increment = .02;
+
155 size_t freq_iterations = (size_t)((freq_end - freq_start) / freq_increment);
+
+
157 double res[4][freq_iterations];
+
+
159 std::string path =
"output/time_dependent_potential/" ;
+
+
+
+
+
164 double freq = freq_start;
+
165 for (
size_t i = 0; i < freq_iterations; i++) {
+
+
167 freq += freq_increment;
+
+
+
170 #pragma omp parallel for collapse(2) num_threads(4)
+
171 for (
size_t i = 0; i < 3; i++) {
+
172 for (
size_t j = 0; j < freq_iterations; j++) {
+
+
+
+
176 [](
double f,
double r,
double t) {
+
177 return (25. *
V / 1000.) * (1. + f * std::cos(r * t));
+
+
179 amplitudes[i], res[0][j], std::placeholders::_1),
+
+
+
+
+
+
+
186 ofile.open(path +
"res.txt" );
+
187 for (
size_t i = 0; i < freq_iterations; i++) {
+
188 ofile << res[0][i] <<
"," << res[1][i] <<
"," << res[2][i] <<
","
+
189 << res[3][i] <<
"\n" ;
+
+
+
+
+
+
+
196 double t0 = omp_get_wtime();
+
+
+
+
+
+
+
+
204 double t1 = omp_get_wtime();
+
+
+
+
+
+
210 double end = omp_get_wtime();
+
+
212 std::cout <<
"Time: " << (end - t1) <<
" seconds" << std::endl;
+
+
+
A class for simulating a Penning trap.
A class that holds attributes of a particle.
-
A class that simulates a Penning trap.
-
double fraction_of_particles_left(double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)
Simulate and calculate what fraction of particles are still left inside the Penning trap after the si...
-
void write_simulation_to_dir(std::string path, double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)
Simulate and write the displacement of all particles to files.
+
A class that simulates a Penning trap.
+
double fraction_of_particles_left(double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)
Simulate and calculate what fraction of particles are still left inside the Penning trap after the si...
+
void write_simulation_to_dir(std::string path, double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)
Simulate and write the displacement of all particles to files.
+
void simulate_100_particles()
Simulate 100 particles over 50 .
+
void simulate_100_particles_with_time_potential()
Simulate 100 particles over 500 using a time dependent potential.
+
vec_3d analytical_solution_particle_1(double t)
The analytical solution for particle p1.
+
void simulate_two_particles()
Simulate 2 particles over the period of 50 with and without particle interactions.
+
Particle p1(CHARGE, MASS, vec_3d{20., 0., 20.}, vec_3d{0., 25., 0.})
Particle 1.
+
void simulate_single_particle()
Simulate a single particle over the period of 50 .
+
Particle p2(CHARGE, MASS, vec_3d{25., 25., 0.}, vec_3d{0., 40., 5.})
Particle 2.
+
void simulate_single_particle_with_different_steps()
Simulate a single particle over 50 using different amount of steps and different methods.
+
Typedef for PenningTrap::simulation return value.
arma::vec::fixed< 3 > vec_3d
Typedef for a fixed 3d arma vector.
Function prototypes and macros that are useful.
-
bool mkpath(std::string path, int mode=0777)
Make path given.
-
#define DEBUG(msg)
Writes a debug message.
+
bool mkpath(std::string path, int mode=0777)
Make path given.
diff --git a/docs/menudata.js b/docs/menudata.js
index 74c1d7b..84356c6 100644
--- a/docs/menudata.js
+++ b/docs/menudata.js
@@ -29,7 +29,21 @@ var menudata={children:[
{text:"Class List",url:"annotated.html"},
{text:"Class Index",url:"classes.html"},
{text:"Class Members",url:"functions.html",children:[
-{text:"All",url:"functions.html"},
+{text:"All",url:"functions.html",children:[
+{text:"a",url:"functions.html#index_a"},
+{text:"b",url:"functions.html#index_b"},
+{text:"d",url:"functions.html#index_d"},
+{text:"e",url:"functions.html#index_e"},
+{text:"f",url:"functions.html#index_f"},
+{text:"k",url:"functions.html#index_k"},
+{text:"m",url:"functions.html#index_m"},
+{text:"p",url:"functions.html#index_p"},
+{text:"q",url:"functions.html#index_q"},
+{text:"r",url:"functions.html#index_r"},
+{text:"s",url:"functions.html#index_s"},
+{text:"t",url:"functions.html#index_t"},
+{text:"v",url:"functions.html#index_v"},
+{text:"w",url:"functions.html#index_w"}]},
{text:"Functions",url:"functions_func.html"},
{text:"Variables",url:"functions_vars.html"},
{text:"Related Functions",url:"functions_rela.html"}]}]},
@@ -38,5 +52,6 @@ var menudata={children:[
{text:"File Members",url:"globals.html",children:[
{text:"All",url:"globals.html"},
{text:"Functions",url:"globals_func.html"},
+{text:"Variables",url:"globals_vars.html"},
{text:"Typedefs",url:"globals_type.html"},
{text:"Macros",url:"globals_defs.html"}]}]}]}
diff --git a/docs/navtreedata.js b/docs/navtreedata.js
index 9640812..6156c4d 100644
--- a/docs/navtreedata.js
+++ b/docs/navtreedata.js
@@ -25,7 +25,19 @@
var NAVTREE =
[
[ "Penning Trap Simulation", "index.html", [
- [ "Credits", "index.html#autotoc_md1", null ],
+ [ "Requirements", "index.html#autotoc_md1", [
+ [ "Operating systems", "index.html#autotoc_md2", null ],
+ [ "Libraries", "index.html#autotoc_md3", null ]
+ ] ],
+ [ "Compiling", "index.html#autotoc_md4", null ],
+ [ "Running programs", "index.html#autotoc_md5", [
+ [ "C++ binaries", "index.html#autotoc_md6", null ],
+ [ "Python scripts", "index.html#autotoc_md7", [
+ [ "Install libraries", "index.html#autotoc_md8", null ],
+ [ "Running scripts", "index.html#autotoc_md9", null ]
+ ] ]
+ ] ],
+ [ "Credits", "index.html#autotoc_md10", null ],
[ "Bug List", "bug.html", null ],
[ "Classes", "annotated.html", [
[ "Class List", "annotated.html", "annotated_dup" ],
@@ -42,6 +54,7 @@ var NAVTREE =
[ "File Members", "globals.html", [
[ "All", "globals.html", null ],
[ "Functions", "globals_func.html", null ],
+ [ "Variables", "globals_vars.html", null ],
[ "Typedefs", "globals_type.html", null ],
[ "Macros", "globals_defs.html", null ]
] ]
diff --git a/docs/navtreeindex0.js b/docs/navtreeindex0.js
index 16caa0e..d727fc6 100644
--- a/docs/navtreeindex0.js
+++ b/docs/navtreeindex0.js
@@ -1,95 +1,121 @@
var NAVTREEINDEX0 =
{
-"Particle_8cpp.html":[3,0,1,2],
-"Particle_8cpp_source.html":[3,0,1,2],
-"Particle_8hpp.html":[3,0,0,1],
-"Particle_8hpp_source.html":[3,0,0,1],
-"PenningTrap_8cpp.html":[3,0,1,3],
-"PenningTrap_8cpp_source.html":[3,0,1,3],
-"PenningTrap_8hpp.html":[3,0,0,2],
-"PenningTrap_8hpp_source.html":[3,0,0,2],
-"animate__100__particles_8py_source.html":[3,0,1,0],
-"annotated.html":[2,0],
-"bug.html":[1],
-"classParticle.html":[2,0,0],
-"classParticle.html#a566dcc1de4bdc01251776948798ea8e1":[2,0,0,3],
-"classParticle.html#a7af9f8d1fef63dd7643b06629ac7bef4":[2,0,0,0],
-"classParticle.html#a879692772803d6ab65fa4993b54aea6e":[2,0,0,5],
-"classParticle.html#aa797d319549dc2a0beb06cdbfd430232":[2,0,0,1],
-"classParticle.html#aedcc7e1bc53b0e2b1a4a07c9a1b47563":[2,0,0,2],
-"classParticle.html#af9497cd8f2dcad0fad54f571ddb383e6":[2,0,0,4],
-"classPenningTrap.html":[2,0,1],
-"classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f":[2,0,1,21],
-"classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b":[2,0,1,9],
-"classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716":[2,0,1,17],
-"classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9":[2,0,1,7],
-"classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8":[2,0,1,12],
-"classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640":[2,0,1,19],
-"classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e":[2,0,1,5],
-"classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648":[2,0,1,10],
-"classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b":[2,0,1,14],
-"classPenningTrap.html#a5331837e6dd7bce807a99edd2ba7e854":[2,0,1,11],
-"classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2":[2,0,1,18],
-"classPenningTrap.html#a67139e04ef69c0bcffde8f30f67cbf73":[2,0,1,2],
-"classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8":[2,0,1,3],
-"classPenningTrap.html#a763700316b502d5900e587c1f61e6bf1":[2,0,1,1],
-"classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e":[2,0,1,22],
-"classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce":[2,0,1,8],
-"classPenningTrap.html#aaf105828121c4a33cc2b217453c20317":[2,0,1,23],
-"classPenningTrap.html#ab9ea97a406534bbe621a95215144875e":[2,0,1,4],
-"classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57":[2,0,1,16],
-"classPenningTrap.html#acbf065c9c125682329ad82a8d166554c":[2,0,1,6],
-"classPenningTrap.html#ae670d7de621acdb343b01af098086f63":[2,0,1,0],
-"classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56":[2,0,1,13],
-"classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4":[2,0,1,20],
-"classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e":[2,0,1,15],
-"classPenningTrapTest.html":[2,0,2],
-"classes.html":[2,1],
-"constants_8hpp.html":[3,0,0,0],
-"constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5":[3,0,0,0,1],
-"constants_8hpp.html#a4e451456ad7e9276ed0afa42826e7ccb":[3,0,0,0,0],
-"constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb":[3,0,0,0,2],
-"constants_8hpp_source.html":[3,0,0,0],
-"dir_68267d1309a1af8e8297ef4c3efbcdba.html":[3,0,1],
-"dir_d44c64559bbebec7f509842c48db8b23.html":[3,0,0],
-"files.html":[3,0],
-"functions.html":[2,2,0],
-"functions_func.html":[2,2,1],
-"functions_rela.html":[2,2,3],
-"functions_vars.html":[2,2,2],
-"globals.html":[3,1,0],
-"globals_defs.html":[3,1,3],
-"globals_func.html":[3,1,1],
-"globals_type.html":[3,1,2],
+"Particle_8cpp.html":[6,0,1,2],
+"Particle_8cpp_source.html":[6,0,1,2],
+"Particle_8hpp.html":[6,0,0,1],
+"Particle_8hpp_source.html":[6,0,0,1],
+"PenningTrap_8cpp.html":[6,0,1,3],
+"PenningTrap_8cpp_source.html":[6,0,1,3],
+"PenningTrap_8hpp.html":[6,0,0,2],
+"PenningTrap_8hpp_source.html":[6,0,0,2],
+"animate__100__particles_8py_source.html":[6,0,1,0,0],
+"annotated.html":[5,0],
+"bug.html":[4],
+"classParticle.html":[5,0,0],
+"classParticle.html#a566dcc1de4bdc01251776948798ea8e1":[5,0,0,3],
+"classParticle.html#a7af9f8d1fef63dd7643b06629ac7bef4":[5,0,0,0],
+"classParticle.html#a879692772803d6ab65fa4993b54aea6e":[5,0,0,5],
+"classParticle.html#aa797d319549dc2a0beb06cdbfd430232":[5,0,0,1],
+"classParticle.html#aedcc7e1bc53b0e2b1a4a07c9a1b47563":[5,0,0,2],
+"classParticle.html#af9497cd8f2dcad0fad54f571ddb383e6":[5,0,0,4],
+"classPenningTrap.html":[5,0,1],
+"classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f":[5,0,1,21],
+"classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b":[5,0,1,9],
+"classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716":[5,0,1,17],
+"classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9":[5,0,1,7],
+"classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8":[5,0,1,12],
+"classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640":[5,0,1,19],
+"classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e":[5,0,1,5],
+"classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648":[5,0,1,10],
+"classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b":[5,0,1,14],
+"classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2":[5,0,1,18],
+"classPenningTrap.html#a67139e04ef69c0bcffde8f30f67cbf73":[5,0,1,2],
+"classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8":[5,0,1,3],
+"classPenningTrap.html#a763700316b502d5900e587c1f61e6bf1":[5,0,1,1],
+"classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e":[5,0,1,22],
+"classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce":[5,0,1,8],
+"classPenningTrap.html#aaf105828121c4a33cc2b217453c20317":[5,0,1,23],
+"classPenningTrap.html#ab9ea97a406534bbe621a95215144875e":[5,0,1,4],
+"classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57":[5,0,1,16],
+"classPenningTrap.html#acbf065c9c125682329ad82a8d166554c":[5,0,1,6],
+"classPenningTrap.html#ae09ef9cfa7e4ed1c108c8576405b3599":[5,0,1,11],
+"classPenningTrap.html#ae670d7de621acdb343b01af098086f63":[5,0,1,0],
+"classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56":[5,0,1,13],
+"classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4":[5,0,1,20],
+"classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e":[5,0,1,15],
+"classPenningTrapTest.html":[5,0,2],
+"classes.html":[5,1],
+"constants_8hpp.html":[6,0,0,0],
+"constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5":[6,0,0,0,1],
+"constants_8hpp.html#a4e451456ad7e9276ed0afa42826e7ccb":[6,0,0,0,0],
+"constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb":[6,0,0,0,2],
+"constants_8hpp_source.html":[6,0,0,0],
+"dir_634e799a3947388232110823971192a8.html":[6,0,1,0],
+"dir_68267d1309a1af8e8297ef4c3efbcdba.html":[6,0,1],
+"dir_d44c64559bbebec7f509842c48db8b23.html":[6,0,0],
+"files.html":[6,0],
+"functions.html":[5,2,0],
+"functions_func.html":[5,2,1],
+"functions_rela.html":[5,2,3],
+"functions_vars.html":[5,2,2],
+"globals.html":[6,1,0],
+"globals_defs.html":[6,1,4],
+"globals_func.html":[6,1,1],
+"globals_type.html":[6,1,3],
+"globals_vars.html":[6,1,2],
"index.html":[],
"index.html#autotoc_md1":[0],
-"main_8cpp.html":[3,0,1,1],
-"main_8cpp_source.html":[3,0,1,1],
+"index.html#autotoc_md10":[3],
+"index.html#autotoc_md2":[0,0],
+"index.html#autotoc_md3":[0,1],
+"index.html#autotoc_md4":[1],
+"index.html#autotoc_md5":[2],
+"index.html#autotoc_md6":[2,0],
+"index.html#autotoc_md7":[2,1],
+"index.html#autotoc_md8":[2,1,0],
+"index.html#autotoc_md9":[2,1,1],
+"main_8cpp.html":[6,0,1,1],
+"main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513":[6,0,1,1,1],
+"main_8cpp.html#a330668384dc073980ba11116309bacc5":[6,0,1,1,2],
+"main_8cpp.html#a6451833d72816ef393087956c766125b":[6,0,1,1,0],
+"main_8cpp.html#a783789519f97c6430081171cacb0ffb1":[6,0,1,1,5],
+"main_8cpp.html#a87da4ef9f2cd753579484824310467b8":[6,0,1,1,6],
+"main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6":[6,0,1,1,3],
+"main_8cpp.html#a90f661586eb3c318fdca6f95ebc4fc46":[6,0,1,1,7],
+"main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2":[6,0,1,1,4],
+"main_8cpp_source.html":[6,0,1,1],
"pages.html":[],
-"plot__particles__left_8py_source.html":[3,0,1,4],
-"test__suite_8cpp.html":[3,0,1,5],
-"test__suite_8cpp_source.html":[3,0,1,5],
-"typedefs_8hpp.html":[3,0,0,3],
-"typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23":[3,0,0,3,1],
-"typedefs_8hpp.html#a8502989b1b361725834fc185bd575f66":[3,0,0,3,2],
-"typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df":[3,0,0,3,3],
-"typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af":[3,0,0,3,0],
-"typedefs_8hpp_source.html":[3,0,0,3],
-"utils_8cpp.html":[3,0,1,6],
-"utils_8cpp.html#a58565270b643b24e3132f38c653e0199":[3,0,1,6,3],
-"utils_8cpp.html#a5d2e1e032fd19614f2fbb58149a7b02a":[3,0,1,6,0],
-"utils_8cpp.html#acd2a9c7a7d5a7fe9163be8c4cc110746":[3,0,1,6,4],
-"utils_8cpp.html#acf13f4e492199cb7231bfa646dbd08de":[3,0,1,6,2],
-"utils_8cpp.html#aff5e07c3c1d321709b0cc38e999f427b":[3,0,1,6,1],
-"utils_8cpp_source.html":[3,0,1,6],
-"utils_8hpp.html":[3,0,0,4],
-"utils_8hpp.html#a0c95c4791692b06f8811905a76dbd772":[3,0,0,4,3],
-"utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38":[3,0,0,4,4],
-"utils_8hpp.html#a60dca3177fb9cb5256609adc7af55168":[3,0,0,4,0],
-"utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa":[3,0,0,4,5],
-"utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9":[3,0,0,4,1],
-"utils_8hpp.html#ad54b96a1074f9df4dc892a41d115b72d":[3,0,0,4,6],
-"utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384":[3,0,0,4,7],
-"utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b":[3,0,0,4,2],
-"utils_8hpp_source.html":[3,0,0,4]
+"plot__2__particles_8py_source.html":[6,0,1,0,1],
+"plot__3d_8py_source.html":[6,0,1,0,2],
+"plot__particles__left_8py_source.html":[6,0,1,0,3],
+"plot__phase__space_8py_source.html":[6,0,1,0,4],
+"plot__relative__error_8py_source.html":[6,0,1,0,5],
+"plot__single__particle_8py_source.html":[6,0,1,0,6],
+"structsimulation.html":[5,0,3],
+"test__suite_8cpp.html":[6,0,1,4],
+"test__suite_8cpp_source.html":[6,0,1,4],
+"typedefs_8hpp.html":[6,0,0,3],
+"typedefs_8hpp.html#a784799c37b5e4fb8bf4f6368e004dec6":[6,0,0,3,4],
+"typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23":[6,0,0,3,2],
+"typedefs_8hpp.html#a8502989b1b361725834fc185bd575f66":[6,0,0,3,3],
+"typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df":[6,0,0,3,5],
+"typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af":[6,0,0,3,1],
+"typedefs_8hpp_source.html":[6,0,0,3],
+"utils_8cpp.html":[6,0,1,5],
+"utils_8cpp.html#a58565270b643b24e3132f38c653e0199":[6,0,1,5,3],
+"utils_8cpp.html#a6be6f938bcbb235ebb6a2ed9d08411b2":[6,0,1,5,0],
+"utils_8cpp.html#acd2a9c7a7d5a7fe9163be8c4cc110746":[6,0,1,5,4],
+"utils_8cpp.html#acf13f4e492199cb7231bfa646dbd08de":[6,0,1,5,2],
+"utils_8cpp.html#aff5e07c3c1d321709b0cc38e999f427b":[6,0,1,5,1],
+"utils_8cpp_source.html":[6,0,1,5],
+"utils_8hpp.html":[6,0,0,4],
+"utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38":[6,0,0,4,4],
+"utils_8hpp.html#a60dca3177fb9cb5256609adc7af55168":[6,0,0,4,0],
+"utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa":[6,0,0,4,5],
+"utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9":[6,0,0,4,1],
+"utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9":[6,0,0,4,3],
+"utils_8hpp.html#ad54b96a1074f9df4dc892a41d115b72d":[6,0,0,4,6],
+"utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384":[6,0,0,4,7],
+"utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b":[6,0,0,4,2],
+"utils_8hpp_source.html":[6,0,0,4]
};
diff --git a/docs/plot__2__particles_8py_source.html b/docs/plot__2__particles_8py_source.html
new file mode 100644
index 0000000..648387a
--- /dev/null
+++ b/docs/plot__2__particles_8py_source.html
@@ -0,0 +1,153 @@
+
+
+
+
+
+
+
+Penning Trap Simulation: src/scripts/plot_2_particles.py Source File
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Penning Trap Simulation
+
+ Simulate particle behavior inside a Penning Trap
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+
+
+
+
1 import matplotlib.pyplot
as plt
+
+
+
+
+
6 "output/simulate_2_particles/no_interaction/particle_0_r.txt" ,
+
7 "output/simulate_2_particles/no_interaction/particle_1_r.txt" ,
+
8 "output/simulate_2_particles/with_interaction/particle_0_r.txt" ,
+
9 "output/simulate_2_particles/with_interaction/particle_1_r.txt"
+
+
+
12 "particle 1 no interaction" ,
+
13 "particle 2 no interaction" ,
+
14 "particle 1 with interaction" ,
+
15 "particle 2 with interaction" ,
+
+
+
+
+
+
+
+
23 for label, color, file
in zip(labels, colors, files):
+
+
+
26 t = np.linspace(0, 50, len(lines))
+
27 r = np.array([list(map(float, line.strip().split(
"," )))
for line
in lines])
+
28 plt.plot(r[:,0], r[:,1], label=label, color=color)
+
+
30 plt.xlabel(
r"x $(\mu m)$" )
+
31 plt.ylabel(
r"y $(\mu m)$" )
+
32 plt.title(
r"2 particles with and without interactions." )
+
+
+
35 plt.savefig(
"../latex/images/plot_2_particles_xy.pdf" )
+
+
+
38 if __name__ ==
"__main__" :
+
+
+
+
+
+
+
diff --git a/docs/plot__3d_8py_source.html b/docs/plot__3d_8py_source.html
new file mode 100644
index 0000000..d297968
--- /dev/null
+++ b/docs/plot__3d_8py_source.html
@@ -0,0 +1,154 @@
+
+
+
+
+
+
+
+Penning Trap Simulation: src/scripts/plot_3d.py Source File
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Penning Trap Simulation
+
+ Simulate particle behavior inside a Penning Trap
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+
+
+
+
1 import matplotlib.pyplot
as plt
+
+
+
+
+
6 "output/simulate_2_particles/no_interaction/particle_0_r.txt" ,
+
7 "output/simulate_2_particles/no_interaction/particle_1_r.txt" ,
+
8 "output/simulate_2_particles/with_interaction/particle_0_r.txt" ,
+
9 "output/simulate_2_particles/with_interaction/particle_1_r.txt"
+
+
+
12 "particle 1 no interaction" ,
+
13 "particle 2 no interaction" ,
+
14 "particle 1 with interaction" ,
+
15 "particle 2 with interaction" ,
+
+
+
+
+
+
+
+
23 ax = plt.figure().add_subplot(projection=
"3d" )
+
24 for label, color, file
in zip(labels, colors, files):
+
+
+
27 t = np.linspace(0, 50, len(lines))
+
28 r = np.array([list(map(float, line.strip().split(
"," )))
for line
in lines])
+
29 ax.plot(r[:,0], r[:,1], r[:,2], label=label, color=color)
+
+
31 ax.set_xlabel(
r"x $(\mu m)$" )
+
32 ax.set_ylabel(
r"y $(\mu m)$" )
+
33 ax.set_zlabel(
r"z $(\mu m)$" )
+
34 plt.title(
r"2 particles with and without interactions." )
+
+
36 plt.savefig(
"../latex/images/3d_plot.pdf" )
+
+
+
39 if __name__ ==
"__main__" :
+
+
+
+
+
+
+
diff --git a/docs/plot__particles__left_8py_source.html b/docs/plot__particles__left_8py_source.html
index c9ab258..33e15f0 100644
--- a/docs/plot__particles__left_8py_source.html
+++ b/docs/plot__particles__left_8py_source.html
@@ -5,7 +5,7 @@
-Penning Trap Simulation: src/plot_particles_left.py Source File
+Penning Trap Simulation: src/scripts/plot_particles_left.py Source File
@@ -104,42 +104,39 @@ $(document).ready(function(){initNavTree('plot__particles__left_8py_source.html'
1 import matplotlib.pyplot
as plt
-
-
5 "output/time_dependent_potential/f_0.100000.txt" ,
-
6 "output/time_dependent_potential/f_0.400000.txt" ,
-
7 "output/time_dependent_potential/f_0.700000.txt" ,
-
-
-
-
-
-
-
-
15 with open(files[i])
as f:
-
-
-
-
-
20 a,b = line.strip().split(
"," )
-
-
-
23 plt.plot(x,y,label=f
"amplitude: {vals[i]}" )
-
-
25 plt.xlabel(
r"$\omega_V$" )
-
26 plt.ylabel(
r"Fraction of particles left" )
-
27 plt.title(
r"The fraction of particles left in the Penning trap "
-
28 "after 500 microseconds for different amplitudes and frequencies" )
-
-
-
-
32 if __name__ ==
"__main__" :
-
+
4 with open(
"output/time_dependent_potential/res.txt" )
as f:
+
+
+
+
+
+
+
11 l = line.strip().split(
"," )
+
+
13 y1.append(float(l[1]))
+
14 y2.append(float(l[2]))
+
15 y3.append(float(l[3]))
+
+
17 plt.plot(x,y1,label=f
"amplitude: 0.1" )
+
18 plt.plot(x,y2,label=f
"amplitude: 0.4" )
+
19 plt.plot(x,y3,label=f
"amplitude: 0.7" )
+
+
21 plt.xlabel(
r"$\omega_V$ (MHz)" )
+
22 plt.ylabel(
r"Fraction of particles left" )
+
23 plt.title(
r"The fraction of particles left in the Penning trap "
+
24 "after 500 microseconds for different amplitudes and frequencies" )
+
+
+
27 plt.savefig(
"../latex/images/particles_left.pdf" )
+
+
29 if __name__ ==
"__main__" :
+
diff --git a/docs/plot__phase__space_8py_source.html b/docs/plot__phase__space_8py_source.html
new file mode 100644
index 0000000..c746ef7
--- /dev/null
+++ b/docs/plot__phase__space_8py_source.html
@@ -0,0 +1,167 @@
+
+
+
+
+
+
+
+Penning Trap Simulation: src/scripts/plot_phase_space.py Source File
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Penning Trap Simulation
+
+ Simulate particle behavior inside a Penning Trap
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+
+
+
+
1 import matplotlib.pyplot
as plt
+
+
+
+
+
6 "output/simulate_2_particles/no_interaction/" ,
+
7 "output/simulate_2_particles/with_interaction/" ,
+
+
+
10 "particles without interaction" ,
+
11 "particles with interaction"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
31 fig1, axs1 = plt.subplots(2,1)
+
32 fig2, axs2 = plt.subplots(2,1)
+
33 for i, (dir, title)
in enumerate(zip(directories, titles)):
+
34 for label, color, file
in zip(labels, colors, files):
+
35 with open(dir+file)
as f:
+
+
37 t = np.linspace(0, 50, len(lines))
+
38 r = np.array([list(map(float, line.strip().split(
"," )))
for line
in lines])
+
39 axs1[i].plot(t, r[:,0], label=label, color=color)
+
40 axs2[i].plot(t, r[:,2], label=label, color=color)
+
+
42 axs1[i].set(xlabel=
r"t $(\mu s)$" , ylabel =
r"z $(\mu m)$" )
+
+
+
45 axs1[i].set_title(title)
+
+
+
48 fig1.savefig(
"../latex/images/phase_space_2_particles_x.pdf" )
+
49 fig2.savefig(
"../latex/images/phase_space_2_particles_z.pdf" )
+
+
+
52 if __name__ ==
"__main__" :
+
+
+
+
+
+
+
diff --git a/docs/plot__relative__error_8py_source.html b/docs/plot__relative__error_8py_source.html
new file mode 100644
index 0000000..8628d31
--- /dev/null
+++ b/docs/plot__relative__error_8py_source.html
@@ -0,0 +1,165 @@
+
+
+
+
+
+
+
+Penning Trap Simulation: src/scripts/plot_relative_error.py Source File
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Penning Trap Simulation
+
+ Simulate particle behavior inside a Penning Trap
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+
+
+
+
1 import matplotlib.pyplot
as plt
+
+
+
+
+
6 "output/relative_error/RK4/" ,
+
7 "output/relative_error/euler/" ,
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
22 "Relative error for the RK4 method" ,
+
23 "Relative error for the forward Euler method"
+
+
+
+
+
+
29 fig1, axs1 = plt.subplots(2,1)
+
30 for i, (dir, title)
in enumerate(list(zip(directories, titles))):
+
+
32 for label, file
in zip(labels, files):
+
33 with open(dir+file)
as f:
+
+
35 t = np.linspace(0, 50, len(lines))
+
36 r = np.array([float(line.strip())
for line
in lines])
+
37 max_err.append(max(r))
+
38 axs1[i].plot(t, r, label=label)
+
+
40 axs1[i].set(xlabel=
r"t $(\mu s)$" , ylabel =
r"relative_error $(\mu m)$" )
+
+
42 axs1[i].set_title(title)
+
+
44 conv_rate = 1/3 * sum([np.log2(max_err[i+1]/max_err[i])/np.log2(.5)
for i
in range(3)])
+
45 print(f
"{methods[i]}: {conv_rate}" )
+
+
47 fig1.savefig(
"../latex/images/phase_space_2_particles_x.pdf" )
+
+
+
50 if __name__ ==
"__main__" :
+
+
+
+
+
+
+
diff --git a/docs/plot__single__particle_8py_source.html b/docs/plot__single__particle_8py_source.html
new file mode 100644
index 0000000..d5eff34
--- /dev/null
+++ b/docs/plot__single__particle_8py_source.html
@@ -0,0 +1,144 @@
+
+
+
+
+
+
+
+Penning Trap Simulation: src/scripts/plot_single_particle.py Source File
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Penning Trap Simulation
+
+ Simulate particle behavior inside a Penning Trap
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+
+
+
+
1 import matplotlib.pyplot
as plt
+
+
+
+
5 V_0 = 25.*9.64852558 * 10**4
+
+
+
8 w_z = np.sqrt((2.*V_0)/(m*d*d))
+
9 return 20.*np.cos(w_z*t)
+
+
+
12 filename =
"output/simulate_single_particle/particle_0_r.txt"
+
+
14 with open(filename)
as f:
+
+
16 t = np.linspace(0, 50, len(lines))
+
17 r = np.array([list(map(float, line.strip().split(
"," )))
for line
in lines])
+
+
19 plt.plot(t, r[:, 2], label=
"approximation" )
+
20 plt.plot(t, z(t), label=
"analytical" )
+
21 plt.xlabel(
r"time $(\mu s)$" )
+
22 plt.ylabel(
r"z $(\mu m)$" )
+
23 plt.title(
r"Movement of a single particle in the x direction" )
+
+
+
+
+
+
29 if __name__ ==
"__main__" :
+
+
+
+
+
+
+
diff --git a/docs/search/all_1.js b/docs/search/all_1.js
index 4fc815a..027119f 100644
--- a/docs/search/all_1.js
+++ b/docs/search/all_1.js
@@ -1,6 +1,6 @@
var searchData=
[
['add_5fparticle_0',['add_particle',['../classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8',1,'PenningTrap']]],
- ['arma_5fvector_5fclose_5fto_1',['arma_vector_close_to',['../utils_8hpp.html#a0c95c4791692b06f8811905a76dbd772',1,'arma_vector_close_to(arma::vec &a, arma::vec &b, double tol=1e-8): utils.cpp'],['../utils_8cpp.html#a5d2e1e032fd19614f2fbb58149a7b02a',1,'arma_vector_close_to(arma::vec &a, arma::vec &b, double tol): utils.cpp']]],
+ ['analytical_5fsolution_5fparticle_5f1_1',['analytical_solution_particle_1',['../main_8cpp.html#a6451833d72816ef393087956c766125b',1,'main.cpp']]],
['assert_2',['ASSERT',['../utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9',1,'utils.hpp']]]
];
diff --git a/docs/search/all_3.js b/docs/search/all_3.js
index 0648f09..f292435 100644
--- a/docs/search/all_3.js
+++ b/docs/search/all_3.js
@@ -1,4 +1,5 @@
var searchData=
[
- ['constants_2ehpp_0',['constants.hpp',['../constants_8hpp.html',1,'']]]
+ ['close_5fto_0',['close_to',['../utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9',1,'close_to(arma::vec &a, arma::vec &b, double tol=1e-8): utils.cpp'],['../utils_8cpp.html#a6be6f938bcbb235ebb6a2ed9d08411b2',1,'close_to(arma::vec &a, arma::vec &b, double tol): utils.cpp']]],
+ ['constants_2ehpp_1',['constants.hpp',['../constants_8hpp.html',1,'']]]
];
diff --git a/docs/search/all_9.js b/docs/search/all_9.js
index 962dfef..a9cb3b3 100644
--- a/docs/search/all_9.js
+++ b/docs/search/all_9.js
@@ -1,12 +1,14 @@
var searchData=
[
- ['particle_0',['Particle',['../classParticle.html',1,'Particle'],['../classParticle.html#a7af9f8d1fef63dd7643b06629ac7bef4',1,'Particle::Particle()']]],
- ['particle_2ecpp_1',['Particle.cpp',['../Particle_8cpp.html',1,'']]],
- ['particle_2ehpp_2',['Particle.hpp',['../Particle_8hpp.html',1,'']]],
- ['particles_3',['particles',['../classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f',1,'PenningTrap']]],
- ['penning_20trap_20simulation_4',['Penning trap simulation',['../index.html',1,'']]],
- ['penningtrap_5',['PenningTrap',['../classPenningTrap.html',1,'PenningTrap'],['../classParticle.html#aa797d319549dc2a0beb06cdbfd430232',1,'Particle::PenningTrap()'],['../classPenningTrap.html#ae670d7de621acdb343b01af098086f63',1,'PenningTrap::PenningTrap(double B_0=T, std::function< double(double)> V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)'],['../classPenningTrap.html#a763700316b502d5900e587c1f61e6bf1',1,'PenningTrap::PenningTrap(unsigned int i, double B_0=T, std::function< double(double)> V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)'],['../classPenningTrap.html#a67139e04ef69c0bcffde8f30f67cbf73',1,'PenningTrap::PenningTrap(std::vector< Particle > particles, double B_0=T, std::function< double(double)> V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)']]],
- ['penningtrap_2ecpp_6',['PenningTrap.cpp',['../PenningTrap_8cpp.html',1,'']]],
- ['penningtrap_2ehpp_7',['PenningTrap.hpp',['../PenningTrap_8hpp.html',1,'']]],
- ['penningtraptest_8',['PenningTrapTest',['../classPenningTrapTest.html',1,'']]]
+ ['p1_0',['p1',['../main_8cpp.html#a87da4ef9f2cd753579484824310467b8',1,'main.cpp']]],
+ ['p2_1',['p2',['../main_8cpp.html#a90f661586eb3c318fdca6f95ebc4fc46',1,'main.cpp']]],
+ ['particle_2',['Particle',['../classParticle.html',1,'Particle'],['../classParticle.html#a7af9f8d1fef63dd7643b06629ac7bef4',1,'Particle::Particle()']]],
+ ['particle_2ecpp_3',['Particle.cpp',['../Particle_8cpp.html',1,'']]],
+ ['particle_2ehpp_4',['Particle.hpp',['../Particle_8hpp.html',1,'']]],
+ ['particles_5',['particles',['../classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f',1,'PenningTrap']]],
+ ['penning_20trap_20simulation_6',['Penning trap simulation',['../index.html',1,'']]],
+ ['penningtrap_7',['PenningTrap',['../classPenningTrap.html',1,'PenningTrap'],['../classParticle.html#aa797d319549dc2a0beb06cdbfd430232',1,'Particle::PenningTrap()'],['../classPenningTrap.html#ae670d7de621acdb343b01af098086f63',1,'PenningTrap::PenningTrap(double B_0=T, std::function< double(double)> V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)'],['../classPenningTrap.html#a763700316b502d5900e587c1f61e6bf1',1,'PenningTrap::PenningTrap(unsigned int i, double B_0=T, std::function< double(double)> V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)'],['../classPenningTrap.html#a67139e04ef69c0bcffde8f30f67cbf73',1,'PenningTrap::PenningTrap(std::vector< Particle > particles, double B_0=T, std::function< double(double)> V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)']]],
+ ['penningtrap_2ecpp_8',['PenningTrap.cpp',['../PenningTrap_8cpp.html',1,'']]],
+ ['penningtrap_2ehpp_9',['PenningTrap.hpp',['../PenningTrap_8hpp.html',1,'']]],
+ ['penningtraptest_10',['PenningTrapTest',['../classPenningTrapTest.html',1,'']]]
];
diff --git a/docs/search/all_c.js b/docs/search/all_c.js
index f0c09d2..86b3940 100644
--- a/docs/search/all_c.js
+++ b/docs/search/all_c.js
@@ -4,5 +4,12 @@ var searchData=
['sim_5farr_1',['sim_arr',['../typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af',1,'typedefs.hpp']]],
['sim_5fcols_2',['sim_cols',['../typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23',1,'typedefs.hpp']]],
['sim_5frows_3',['sim_rows',['../typedefs_8hpp.html#a8502989b1b361725834fc185bd575f66',1,'typedefs.hpp']]],
- ['simulate_4',['simulate',['../classPenningTrap.html#a5331837e6dd7bce807a99edd2ba7e854',1,'PenningTrap']]]
+ ['simulate_4',['simulate',['../classPenningTrap.html#ae09ef9cfa7e4ed1c108c8576405b3599',1,'PenningTrap']]],
+ ['simulate_5f100_5fparticles_5',['simulate_100_particles',['../main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513',1,'main.cpp']]],
+ ['simulate_5f100_5fparticles_5fwith_5ftime_5fpotential_6',['simulate_100_particles_with_time_potential',['../main_8cpp.html#a330668384dc073980ba11116309bacc5',1,'main.cpp']]],
+ ['simulate_5fsingle_5fparticle_7',['simulate_single_particle',['../main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6',1,'main.cpp']]],
+ ['simulate_5fsingle_5fparticle_5fwith_5fdifferent_5fsteps_8',['simulate_single_particle_with_different_steps',['../main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2',1,'main.cpp']]],
+ ['simulate_5ftwo_5fparticles_9',['simulate_two_particles',['../main_8cpp.html#a783789519f97c6430081171cacb0ffb1',1,'main.cpp']]],
+ ['simulation_10',['simulation',['../structsimulation.html',1,'']]],
+ ['simulation_5ft_11',['simulation_t',['../typedefs_8hpp.html#a784799c37b5e4fb8bf4f6368e004dec6',1,'typedefs.hpp']]]
];
diff --git a/docs/search/all_d.js b/docs/search/all_d.js
index c04457d..d8c5a50 100644
--- a/docs/search/all_d.js
+++ b/docs/search/all_d.js
@@ -2,9 +2,14 @@ var searchData=
[
['t_0',['t',['../classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e',1,'PenningTrap']]],
['t_1',['T',['../constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5',1,'constants.hpp']]],
- ['test_5fsuite_2ecpp_2',['test_suite.cpp',['../test__suite_8cpp.html',1,'']]],
- ['total_5fforce_3',['total_force',['../classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8',1,'PenningTrap']]],
- ['total_5fforce_5fexternal_4',['total_force_external',['../classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56',1,'PenningTrap']]],
- ['total_5fforce_5fparticles_5',['total_force_particles',['../classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b',1,'PenningTrap']]],
- ['typedefs_2ehpp_6',['typedefs.hpp',['../typedefs_8hpp.html',1,'']]]
+ ['test_5fexternal_5fb_5ffield_2',['test_external_B_field',['../classPenningTrapTest.html#acb806e49a688424588e0c501bc57a230',1,'PenningTrapTest']]],
+ ['test_5fexternal_5fe_5ffield_3',['test_external_E_field',['../classPenningTrapTest.html#a542996d72c713636b95e0aa9118f7901',1,'PenningTrapTest']]],
+ ['test_5fforce_5fon_5fparticle_4',['test_force_on_particle',['../classPenningTrapTest.html#addf81fa5692d8146cce5571ccdc5999b',1,'PenningTrapTest']]],
+ ['test_5fsuite_2ecpp_5',['test_suite.cpp',['../test__suite_8cpp.html',1,'']]],
+ ['test_5ftotal_5fforce_5fexternal_6',['test_total_force_external',['../classPenningTrapTest.html#ae104e04dcd21ac63281c908132fdf255',1,'PenningTrapTest']]],
+ ['test_5ftotal_5fforce_5fparticles_7',['test_total_force_particles',['../classPenningTrapTest.html#a0ee2bbf5e26c115164208b89c5a29e3d',1,'PenningTrapTest']]],
+ ['total_5fforce_8',['total_force',['../classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8',1,'PenningTrap']]],
+ ['total_5fforce_5fexternal_9',['total_force_external',['../classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56',1,'PenningTrap']]],
+ ['total_5fforce_5fparticles_10',['total_force_particles',['../classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b',1,'PenningTrap']]],
+ ['typedefs_2ehpp_11',['typedefs.hpp',['../typedefs_8hpp.html',1,'']]]
];
diff --git a/docs/search/classes_1.js b/docs/search/classes_1.js
new file mode 100644
index 0000000..0a5cda5
--- /dev/null
+++ b/docs/search/classes_1.js
@@ -0,0 +1,4 @@
+var searchData=
+[
+ ['simulation_0',['simulation',['../structsimulation.html',1,'']]]
+];
diff --git a/docs/search/functions_0.js b/docs/search/functions_0.js
index 72dba03..2162ba3 100644
--- a/docs/search/functions_0.js
+++ b/docs/search/functions_0.js
@@ -1,5 +1,5 @@
var searchData=
[
['add_5fparticle_0',['add_particle',['../classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8',1,'PenningTrap']]],
- ['arma_5fvector_5fclose_5fto_1',['arma_vector_close_to',['../utils_8hpp.html#a0c95c4791692b06f8811905a76dbd772',1,'arma_vector_close_to(arma::vec &a, arma::vec &b, double tol=1e-8): utils.cpp'],['../utils_8cpp.html#a5d2e1e032fd19614f2fbb58149a7b02a',1,'arma_vector_close_to(arma::vec &a, arma::vec &b, double tol): utils.cpp']]]
+ ['analytical_5fsolution_5fparticle_5f1_1',['analytical_solution_particle_1',['../main_8cpp.html#a6451833d72816ef393087956c766125b',1,'main.cpp']]]
];
diff --git a/docs/search/functions_1.js b/docs/search/functions_1.js
index c4c479f..ff2dfc6 100644
--- a/docs/search/functions_1.js
+++ b/docs/search/functions_1.js
@@ -1,7 +1,4 @@
var searchData=
[
- ['evolve_5fforward_5feuler_0',['evolve_forward_euler',['../classPenningTrap.html#ab9ea97a406534bbe621a95215144875e',1,'PenningTrap']]],
- ['evolve_5frk4_1',['evolve_RK4',['../classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e',1,'PenningTrap']]],
- ['external_5fb_5ffield_2',['external_B_field',['../classPenningTrap.html#acbf065c9c125682329ad82a8d166554c',1,'PenningTrap']]],
- ['external_5fe_5ffield_3',['external_E_field',['../classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9',1,'PenningTrap']]]
+ ['close_5fto_0',['close_to',['../utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9',1,'close_to(arma::vec &a, arma::vec &b, double tol=1e-8): utils.cpp'],['../utils_8cpp.html#a6be6f938bcbb235ebb6a2ed9d08411b2',1,'close_to(arma::vec &a, arma::vec &b, double tol): utils.cpp']]]
];
diff --git a/docs/search/functions_2.js b/docs/search/functions_2.js
index d1d9acc..c4c479f 100644
--- a/docs/search/functions_2.js
+++ b/docs/search/functions_2.js
@@ -1,5 +1,7 @@
var searchData=
[
- ['force_5fon_5fparticle_0',['force_on_particle',['../classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce',1,'PenningTrap']]],
- ['fraction_5fof_5fparticles_5fleft_1',['fraction_of_particles_left',['../classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b',1,'PenningTrap']]]
+ ['evolve_5fforward_5feuler_0',['evolve_forward_euler',['../classPenningTrap.html#ab9ea97a406534bbe621a95215144875e',1,'PenningTrap']]],
+ ['evolve_5frk4_1',['evolve_RK4',['../classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e',1,'PenningTrap']]],
+ ['external_5fb_5ffield_2',['external_B_field',['../classPenningTrap.html#acbf065c9c125682329ad82a8d166554c',1,'PenningTrap']]],
+ ['external_5fe_5ffield_3',['external_E_field',['../classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9',1,'PenningTrap']]]
];
diff --git a/docs/search/functions_3.js b/docs/search/functions_3.js
index ffb26d6..d1d9acc 100644
--- a/docs/search/functions_3.js
+++ b/docs/search/functions_3.js
@@ -1,5 +1,5 @@
var searchData=
[
- ['m_5fassert_0',['m_assert',['../utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38',1,'m_assert(bool expr, std::string expr_str, std::string func, std::string file, int line, std::string msg): utils.cpp'],['../utils_8cpp.html#aff5e07c3c1d321709b0cc38e999f427b',1,'m_assert(bool expr, std::string expr_str, std::string f, std::string file, int line, std::string msg): utils.cpp']]],
- ['mkpath_1',['mkpath',['../utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa',1,'mkpath(std::string path, int mode=0777): utils.cpp'],['../utils_8cpp.html#acf13f4e492199cb7231bfa646dbd08de',1,'mkpath(std::string path, int mode): utils.cpp']]]
+ ['force_5fon_5fparticle_0',['force_on_particle',['../classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce',1,'PenningTrap']]],
+ ['fraction_5fof_5fparticles_5fleft_1',['fraction_of_particles_left',['../classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b',1,'PenningTrap']]]
];
diff --git a/docs/search/functions_4.js b/docs/search/functions_4.js
index 852716e..ffb26d6 100644
--- a/docs/search/functions_4.js
+++ b/docs/search/functions_4.js
@@ -1,5 +1,5 @@
var searchData=
[
- ['particle_0',['Particle',['../classParticle.html#a7af9f8d1fef63dd7643b06629ac7bef4',1,'Particle']]],
- ['penningtrap_1',['PenningTrap',['../classPenningTrap.html#ae670d7de621acdb343b01af098086f63',1,'PenningTrap::PenningTrap(double B_0=T, std::function< double(double)> V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)'],['../classPenningTrap.html#a763700316b502d5900e587c1f61e6bf1',1,'PenningTrap::PenningTrap(unsigned int i, double B_0=T, std::function< double(double)> V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)'],['../classPenningTrap.html#a67139e04ef69c0bcffde8f30f67cbf73',1,'PenningTrap::PenningTrap(std::vector< Particle > particles, double B_0=T, std::function< double(double)> V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)']]]
+ ['m_5fassert_0',['m_assert',['../utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38',1,'m_assert(bool expr, std::string expr_str, std::string func, std::string file, int line, std::string msg): utils.cpp'],['../utils_8cpp.html#aff5e07c3c1d321709b0cc38e999f427b',1,'m_assert(bool expr, std::string expr_str, std::string f, std::string file, int line, std::string msg): utils.cpp']]],
+ ['mkpath_1',['mkpath',['../utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa',1,'mkpath(std::string path, int mode=0777): utils.cpp'],['../utils_8cpp.html#acf13f4e492199cb7231bfa646dbd08de',1,'mkpath(std::string path, int mode): utils.cpp']]]
];
diff --git a/docs/search/functions_5.js b/docs/search/functions_5.js
index 07b3041..852716e 100644
--- a/docs/search/functions_5.js
+++ b/docs/search/functions_5.js
@@ -1,4 +1,5 @@
var searchData=
[
- ['r_5ffunc_0',['r_func',['../classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648',1,'PenningTrap']]]
+ ['particle_0',['Particle',['../classParticle.html#a7af9f8d1fef63dd7643b06629ac7bef4',1,'Particle']]],
+ ['penningtrap_1',['PenningTrap',['../classPenningTrap.html#ae670d7de621acdb343b01af098086f63',1,'PenningTrap::PenningTrap(double B_0=T, std::function< double(double)> V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)'],['../classPenningTrap.html#a763700316b502d5900e587c1f61e6bf1',1,'PenningTrap::PenningTrap(unsigned int i, double B_0=T, std::function< double(double)> V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)'],['../classPenningTrap.html#a67139e04ef69c0bcffde8f30f67cbf73',1,'PenningTrap::PenningTrap(std::vector< Particle > particles, double B_0=T, std::function< double(double)> V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)']]]
];
diff --git a/docs/search/functions_6.js b/docs/search/functions_6.js
index a7b65b4..07b3041 100644
--- a/docs/search/functions_6.js
+++ b/docs/search/functions_6.js
@@ -1,5 +1,4 @@
var searchData=
[
- ['scientific_5fformat_0',['scientific_format',['../utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384',1,'scientific_format(double d, int width=20, int prec=10): utils.cpp'],['../utils_8hpp.html#ad54b96a1074f9df4dc892a41d115b72d',1,'scientific_format(const std::vector< double > &v, int width=20, int prec=10): utils.cpp'],['../utils_8cpp.html#acd2a9c7a7d5a7fe9163be8c4cc110746',1,'scientific_format(double d, int width, int prec): utils.cpp'],['../utils_8cpp.html#a58565270b643b24e3132f38c653e0199',1,'scientific_format(const std::vector< double > &v, int width, int prec): utils.cpp']]],
- ['simulate_1',['simulate',['../classPenningTrap.html#a5331837e6dd7bce807a99edd2ba7e854',1,'PenningTrap']]]
+ ['r_5ffunc_0',['r_func',['../classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648',1,'PenningTrap']]]
];
diff --git a/docs/search/functions_7.js b/docs/search/functions_7.js
index 73e1881..d253bda 100644
--- a/docs/search/functions_7.js
+++ b/docs/search/functions_7.js
@@ -1,6 +1,10 @@
var searchData=
[
- ['total_5fforce_0',['total_force',['../classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8',1,'PenningTrap']]],
- ['total_5fforce_5fexternal_1',['total_force_external',['../classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56',1,'PenningTrap']]],
- ['total_5fforce_5fparticles_2',['total_force_particles',['../classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b',1,'PenningTrap']]]
+ ['scientific_5fformat_0',['scientific_format',['../utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384',1,'scientific_format(double d, int width=20, int prec=10): utils.cpp'],['../utils_8hpp.html#ad54b96a1074f9df4dc892a41d115b72d',1,'scientific_format(const std::vector< double > &v, int width=20, int prec=10): utils.cpp'],['../utils_8cpp.html#acd2a9c7a7d5a7fe9163be8c4cc110746',1,'scientific_format(double d, int width, int prec): utils.cpp'],['../utils_8cpp.html#a58565270b643b24e3132f38c653e0199',1,'scientific_format(const std::vector< double > &v, int width, int prec): utils.cpp']]],
+ ['simulate_1',['simulate',['../classPenningTrap.html#ae09ef9cfa7e4ed1c108c8576405b3599',1,'PenningTrap']]],
+ ['simulate_5f100_5fparticles_2',['simulate_100_particles',['../main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513',1,'main.cpp']]],
+ ['simulate_5f100_5fparticles_5fwith_5ftime_5fpotential_3',['simulate_100_particles_with_time_potential',['../main_8cpp.html#a330668384dc073980ba11116309bacc5',1,'main.cpp']]],
+ ['simulate_5fsingle_5fparticle_4',['simulate_single_particle',['../main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6',1,'main.cpp']]],
+ ['simulate_5fsingle_5fparticle_5fwith_5fdifferent_5fsteps_5',['simulate_single_particle_with_different_steps',['../main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2',1,'main.cpp']]],
+ ['simulate_5ftwo_5fparticles_6',['simulate_two_particles',['../main_8cpp.html#a783789519f97c6430081171cacb0ffb1',1,'main.cpp']]]
];
diff --git a/docs/search/functions_8.js b/docs/search/functions_8.js
index 8d7b6ff..d230e8d 100644
--- a/docs/search/functions_8.js
+++ b/docs/search/functions_8.js
@@ -1,4 +1,11 @@
var searchData=
[
- ['v_5ffunc_0',['v_func',['../classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e',1,'PenningTrap']]]
+ ['test_5fexternal_5fb_5ffield_0',['test_external_B_field',['../classPenningTrapTest.html#acb806e49a688424588e0c501bc57a230',1,'PenningTrapTest']]],
+ ['test_5fexternal_5fe_5ffield_1',['test_external_E_field',['../classPenningTrapTest.html#a542996d72c713636b95e0aa9118f7901',1,'PenningTrapTest']]],
+ ['test_5fforce_5fon_5fparticle_2',['test_force_on_particle',['../classPenningTrapTest.html#addf81fa5692d8146cce5571ccdc5999b',1,'PenningTrapTest']]],
+ ['test_5ftotal_5fforce_5fexternal_3',['test_total_force_external',['../classPenningTrapTest.html#ae104e04dcd21ac63281c908132fdf255',1,'PenningTrapTest']]],
+ ['test_5ftotal_5fforce_5fparticles_4',['test_total_force_particles',['../classPenningTrapTest.html#a0ee2bbf5e26c115164208b89c5a29e3d',1,'PenningTrapTest']]],
+ ['total_5fforce_5',['total_force',['../classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8',1,'PenningTrap']]],
+ ['total_5fforce_5fexternal_6',['total_force_external',['../classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56',1,'PenningTrap']]],
+ ['total_5fforce_5fparticles_7',['total_force_particles',['../classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b',1,'PenningTrap']]]
];
diff --git a/docs/search/functions_9.js b/docs/search/functions_9.js
index 1b9fc74..8d7b6ff 100644
--- a/docs/search/functions_9.js
+++ b/docs/search/functions_9.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['write_5fsimulation_5fto_5fdir_0',['write_simulation_to_dir',['../classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57',1,'PenningTrap']]]
+ ['v_5ffunc_0',['v_func',['../classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e',1,'PenningTrap']]]
];
diff --git a/docs/search/functions_a.js b/docs/search/functions_a.js
new file mode 100644
index 0000000..1b9fc74
--- /dev/null
+++ b/docs/search/functions_a.js
@@ -0,0 +1,4 @@
+var searchData=
+[
+ ['write_5fsimulation_5fto_5fdir_0',['write_simulation_to_dir',['../classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57',1,'PenningTrap']]]
+];
diff --git a/docs/search/searchdata.js b/docs/search/searchdata.js
index 4d47bbf..a67f3d1 100644
--- a/docs/search/searchdata.js
+++ b/docs/search/searchdata.js
@@ -1,9 +1,9 @@
var indexSectionsWithContent =
{
0: "_abcdefkmpqrstuvw",
- 1: "p",
+ 1: "ps",
2: "cmptu",
- 3: "aefmprstvw",
+ 3: "acefmprstvw",
4: "bdkmpqrtv",
5: "sv",
6: "p",
diff --git a/docs/search/typedefs_0.js b/docs/search/typedefs_0.js
index e79ff95..75b98c8 100644
--- a/docs/search/typedefs_0.js
+++ b/docs/search/typedefs_0.js
@@ -2,5 +2,6 @@ var searchData=
[
['sim_5farr_0',['sim_arr',['../typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af',1,'typedefs.hpp']]],
['sim_5fcols_1',['sim_cols',['../typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23',1,'typedefs.hpp']]],
- ['sim_5frows_2',['sim_rows',['../typedefs_8hpp.html#a8502989b1b361725834fc185bd575f66',1,'typedefs.hpp']]]
+ ['sim_5frows_2',['sim_rows',['../typedefs_8hpp.html#a8502989b1b361725834fc185bd575f66',1,'typedefs.hpp']]],
+ ['simulation_5ft_3',['simulation_t',['../typedefs_8hpp.html#a784799c37b5e4fb8bf4f6368e004dec6',1,'typedefs.hpp']]]
];
diff --git a/docs/search/variables_4.js b/docs/search/variables_4.js
index c9f603d..89df031 100644
--- a/docs/search/variables_4.js
+++ b/docs/search/variables_4.js
@@ -1,4 +1,6 @@
var searchData=
[
- ['particles_0',['particles',['../classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f',1,'PenningTrap']]]
+ ['p1_0',['p1',['../main_8cpp.html#a87da4ef9f2cd753579484824310467b8',1,'main.cpp']]],
+ ['p2_1',['p2',['../main_8cpp.html#a90f661586eb3c318fdca6f95ebc4fc46',1,'main.cpp']]],
+ ['particles_2',['particles',['../classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f',1,'PenningTrap']]]
];
diff --git a/docs/structsimulation-members.html b/docs/structsimulation-members.html
new file mode 100644
index 0000000..e81bad3
--- /dev/null
+++ b/docs/structsimulation-members.html
@@ -0,0 +1,118 @@
+
+
+
+
+
+
+
+Penning Trap Simulation: Member List
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Penning Trap Simulation
+
+ Simulate particle behavior inside a Penning Trap
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+
+
+
+
+
This is the complete list of members for simulation , including all inherited members.
+
+
+
+
+
+
diff --git a/docs/structsimulation.html b/docs/structsimulation.html
new file mode 100644
index 0000000..ea17361
--- /dev/null
+++ b/docs/structsimulation.html
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+Penning Trap Simulation: simulation Struct Reference
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Penning Trap Simulation
+
+ Simulate particle behavior inside a Penning Trap
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+
+
+
+
+
Typedef for PenningTrap::simulation return value.
+ More...
+
+
#include <typedefs.hpp >
+
+
+
Typedef for PenningTrap::simulation return value.
+
+
Definition at line 40 of file typedefs.hpp .
+
+
+
◆ r_vecs
+
+
+
+
◆ v_vecs
+
+
+
The documentation for this struct was generated from the following file:
+
+
+
+
+
+
diff --git a/docs/test__suite_8cpp.html b/docs/test__suite_8cpp.html
index 7c69921..ccc234d 100644
--- a/docs/test__suite_8cpp.html
+++ b/docs/test__suite_8cpp.html
@@ -107,17 +107,18 @@ $(document).ready(function(){initNavTree('test__suite_8cpp.html',''); initResiza
The test suite for the project.
More...
-#include "PenningTrap.hpp "
-
#include "utils.hpp "
-
#include <iomanip>
+
#include <iomanip>
#include <sstream>
#include <string>
+
#include "PenningTrap.hpp "
+
#include "utils.hpp "
Go to the source code of this file.
diff --git a/docs/test__suite_8cpp_source.html b/docs/test__suite_8cpp_source.html
index b317c82..5341d26 100644
--- a/docs/test__suite_8cpp_source.html
+++ b/docs/test__suite_8cpp_source.html
@@ -102,151 +102,157 @@ $(document).ready(function(){initNavTree('test__suite_8cpp_source.html',''); ini
Go to the documentation of this file.
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
22 static void test_external_E_field()
-
-
-
-
-
27 std::vector<std::pair<arma::vec, arma::vec>> tests;
-
-
-
30 std::make_pair(arma::vec{0., 0., 0.}, arma::vec{0., 0., 0.}));
-
-
32 tests.push_back(std::make_pair(arma::vec{10., 0., 0.},
-
33 arma::vec{96.4852558, 0., 0.}));
-
-
35 tests.push_back(std::make_pair(arma::vec{10., 0., 0.},
-
36 arma::vec{96.4852558, 0., 0.}));
-
-
38 tests.push_back(std::make_pair(arma::vec{0., 10., 0.},
-
39 arma::vec{0., 96.4852558, 0.}));
-
-
41 tests.push_back(std::make_pair(arma::vec{0., 0., 10.},
-
42 arma::vec{0., 0., -192.9705116}));
-
-
-
-
46 std::stringstream msg;
-
47 for (
size_t i = 0; i < tests.size(); i++) {
-
48 v = tests.at(i).first;
-
-
-
-
52 msg <<
"Testing the external E field at (" << std::setprecision(2)
-
53 << v(0) <<
"," << v(1) <<
"," << v(2) <<
")." ;
+
+
+
+
+
+
+
+
31 std::vector<std::pair<vec_3d, vec_3d>> tests;
+
+
+
+
+
36 tests.push_back(std::make_pair(
vec_3d {10., 0., 0.},
+
37 vec_3d {96.4852558, 0., 0.}));
+
+
39 tests.push_back(std::make_pair(
vec_3d {10., 0., 0.},
+
40 vec_3d {96.4852558, 0., 0.}));
+
+
42 tests.push_back(std::make_pair(
vec_3d {0., 10., 0.},
+
43 vec_3d {0., 96.4852558, 0.}));
+
+
45 tests.push_back(std::make_pair(
vec_3d {0., 0., 10.},
+
46 vec_3d {0., 0., -192.9705116}));
+
+
+
+
50 std::stringstream msg;
+
51 for (
size_t i = 0; i < tests.size(); i++) {
+
52 v = tests.at(i).first;
+
-
-
-
+
+
56 msg <<
"Testing the external E field at (" << std::setprecision(2)
+
57 << v(0) <<
"," << v(1) <<
"," << v(2) <<
")." ;
-
59 static void test_external_B_field()
-
-
-
-
-
64 arma::vec expected{0., 0.,
T };
-
-
-
67 "Testing the external B field at (0,0,0)" );
-
-
-
70 static void test_force_on_particle()
-
-
-
73 arma::vec v{0., 0., 0.};
-
-
-
-
-
-
-
-
81 arma::vec expected{-1., 0., 0.};
-
-
-
84 "Testing the force on a particle at (0,0,0) from a "
-
85 "particle at (1,0,0)." );
-
-
-
88 expected = arma::vec{0, -.024, -.032};
-
-
-
91 "Testing the force on a particle at (0,0,0) from a "
-
92 "particle at (0,3,4)." );
-
+
+
+
+
+
+
+
+
+
+
+
+
+
73 "Testing the external B field at (0,0,0)" );
+
+
+
+
+
+
+
+
+
+
+
+
+
+
89 vec_3d expected{-1., 0., 0.};
+
+
+
92 "Testing the force on a particle at (0,0,0) from a "
+
93 "particle at (1,0,0)." );
-
95 static void test_total_force_external()
-
-
-
-
99 Particle (1., 40., arma::vec{1., 2., 3.}, arma::vec{3., 4., 5.}));
-
-
101 arma::vec expected{395.58954878, -270.15871624, -57.89115348};
-
-
-
104 "Testing the total external force on a particle at "
-
105 "(1,2,3) with velocity (3,4,5)" );
-
-
-
108 static void test_total_force_particles()
-
-
-
-
112 Particle (1., 40., arma::vec{0., 0., 0.}, arma::vec{0., 0., 0.}));
-
-
114 arma::vec expected{0., 0., 0.};
-
-
-
117 "Testing the total force of all particles on particle 0 "
-
118 "with only a single particle" );
-
-
-
121 Particle (1., 40., arma::vec{1., 0., 0.}, arma::vec{0., 0., 0.}));
-
-
123 Particle (1., 40., arma::vec{0., 1., 0.}, arma::vec{0., 0., 0.}));
+
+
96 expected =
vec_3d {0, -.024, -.032};
+
+
+
99 "Testing the force on a particle at (0,0,0) from a "
+
100 "particle at (0,3,4)." );
+
+
+
+
+
+
+
+
+
111 vec_3d expected{395.58954878, -270.15871624, -57.89115348};
+
+
+
114 "Testing the total external force on a particle at "
+
115 "(1,2,3) with velocity (3,4,5)" );
+
+
+
+
+
-
125 Particle (1., 40., arma::vec{0., 0., 1.}, arma::vec{0., 0., 0.}));
+
-
127 expected = arma::vec(3, arma::fill::value(-3473.383325));
-
-
+
127 vec_3d expected{0., 0., 0.};
+
+
130 "Testing the total force of all particles on particle 0 "
-
131 "with 3 other particles." );
-
-
-
-
-
-
137 PenningTrapTest::test_external_E_field();
-
138 PenningTrapTest::test_external_B_field();
-
139 PenningTrapTest::test_force_on_particle();
-
140 PenningTrapTest::test_total_force_external();
-
141 PenningTrapTest::test_total_force_particles();
-
-
+
131 "with only a single particle" );
+
+
+
+
+
+
+
+
+
140 expected =
vec_3d ().fill(-3473.383325);
+
+
+
143 "Testing the total force of all particles on particle 0 "
+
144 "with 3 other particles." );
+
+
+
+
+
+
+
+
+
+
+
+
A class for simulating a Penning trap.
A class that holds attributes of a particle.
-
-
A class that simulates a Penning trap.
-
vec_3d external_E_field(vec_3d r)
Calculate E at point r.
-
vec_3d total_force_particles(unsigned int i)
Calculate the total force on a particle p_i from other particles.
-
void add_particle(Particle particle)
Add a particle to the system.
-
vec_3d force_on_particle(unsigned int i, unsigned int j)
Calculate the force between 2 particles.
-
vec_3d external_B_field(vec_3d r)
Calculate B at point r.
-
vec_3d total_force_external(unsigned int i)
Calculate the total external force on a particle.
+
Test class for the Penning trap.
+
static void test_total_force_particles()
Test that the total force of all particles on a single particle returns expected results.
+
static void test_external_E_field()
Test that the external E field gives correct values.
+
static void test_external_B_field()
Test that the external B field gives correct values.
+
static void test_force_on_particle()
Test that the force between particles gives expected results.
+
static void test_total_force_external()
Test that the total external force returns expected results.
+
A class that simulates a Penning trap.
+
vec_3d external_E_field(vec_3d r)
Calculate E at point r.
+
vec_3d total_force_particles(unsigned int i)
Calculate the total force on a particle p_i from other particles.
+
void add_particle(Particle particle)
Add a particle to the system.
+
vec_3d force_on_particle(unsigned int i, unsigned int j)
Calculate the force between 2 particles.
+
vec_3d external_B_field(vec_3d r)
Calculate B at point r.
+
vec_3d total_force_external(unsigned int i)
Calculate the total external force on a particle.
+
arma::vec::fixed< 3 > vec_3d
Typedef for a fixed 3d arma vector.
Function prototypes and macros that are useful.
-
bool arma_vector_close_to(arma::vec &a, arma::vec &b, double tol=1e-8)
Test if two armadillo vectors are close to each other.
-
#define ASSERT(expr, msg)
A prettier assertion function.
+
#define ASSERT(expr, msg)
A prettier assertion function.
+
bool close_to(arma::vec &a, arma::vec &b, double tol=1e-8)
Test if two armadillo vectors are close to each other.
diff --git a/docs/typedefs_8hpp.html b/docs/typedefs_8hpp.html
index 1f2eedb..1225a91 100644
--- a/docs/typedefs_8hpp.html
+++ b/docs/typedefs_8hpp.html
@@ -99,6 +99,7 @@ $(document).ready(function(){initNavTree('typedefs_8hpp.html',''); initResizable
@@ -106,11 +107,17 @@ $(document).ready(function(){initNavTree('typedefs_8hpp.html',''); initResizable
Useful typedefs for cleaner code.
More...
-#include <vector>
-
#include <armadillo>
+
#include <armadillo>
+#include <vector>
Go to the source code of this file.
typedef std::vector< arma::vec::fixed< 3 > > sim_cols
@@ -125,6 +132,10 @@ Typedefs
typedef arma::vec::fixed< 3 > vec_3d
Typedef for a fixed 3d arma vector.
+
+typedef struct simulation simulation_t
+ Typedef for PenningTrap::simulation return value.
+
Useful typedefs for cleaner code.
diff --git a/docs/typedefs_8hpp.js b/docs/typedefs_8hpp.js
index d014844..ddf845a 100644
--- a/docs/typedefs_8hpp.js
+++ b/docs/typedefs_8hpp.js
@@ -1,7 +1,9 @@
var typedefs_8hpp =
[
+ [ "simulation", "structsimulation.html", null ],
[ "sim_arr", "typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af", null ],
[ "sim_cols", "typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23", null ],
[ "sim_rows", "typedefs_8hpp.html#a8502989b1b361725834fc185bd575f66", null ],
+ [ "simulation_t", "typedefs_8hpp.html#a784799c37b5e4fb8bf4f6368e004dec6", null ],
[ "vec_3d", "typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df", null ]
];
\ No newline at end of file
diff --git a/docs/typedefs_8hpp_source.html b/docs/typedefs_8hpp_source.html
index 475ff07..b7cf904 100644
--- a/docs/typedefs_8hpp_source.html
+++ b/docs/typedefs_8hpp_source.html
@@ -105,8 +105,8 @@ $(document).ready(function(){initNavTree('typedefs_8hpp_source.html',''); initRe
-
-
+
+
24 typedef std::vector<arma::vec::fixed<3>>
sim_cols ;
@@ -116,7 +116,14 @@ $(document).ready(function(){initNavTree('typedefs_8hpp_source.html',''); initRe
-
+
+
+
+
+
+
+
Typedef for PenningTrap::simulation return value.
+
struct simulation simulation_t
Typedef for PenningTrap::simulation return value.
std::vector< arma::vec::fixed< 3 > > sim_cols
Typedef for the column of the result vector from simulating particles.
std::vector< arma::vec::fixed< 3 > > sim_rows
Typedef for the row of the result vector from simulating particles.
arma::vec::fixed< 3 > vec_3d
Typedef for a fixed 3d arma vector.
diff --git a/docs/utils_8cpp.html b/docs/utils_8cpp.html
index 9401b51..f76d7e7 100644
--- a/docs/utils_8cpp.html
+++ b/docs/utils_8cpp.html
@@ -106,8 +106,7 @@ $(document).ready(function(){initNavTree('utils_8cpp.html',''); initResizable();
Implementation of the utils.
More...
-
#include <sys/stat.h>
-
#include "utils.hpp "
+
Go to the source code of this file.
@@ -122,9 +121,9 @@ Functions
void m_assert (bool expr, std::string expr_str, std::string f, std::string file, int line, std::string msg)
Test an expression, confirm that test is ok, or abort execution.
-bool arma_vector_close_to (arma::vec &a, arma::vec &b, double tol)
- Test if two armadillo vectors are close to each other.
-
+bool close_to (arma::vec &a, arma::vec &b, double tol)
+ Test if two armadillo vectors are close to each other.
+
bool mkpath (std::string path, int mode)
Make path given.
@@ -139,14 +138,14 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
Definition in file utils.cpp .
-
-◆ arma_vector_close_to()
+
+◆ close_to()
- bool arma_vector_close_to
+ bool close_to
(
arma::vec &
a ,
@@ -183,7 +182,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
Returns bool
-Definition at line 62 of file utils.cpp .
+Definition at line 60 of file utils.cpp .
@@ -251,7 +250,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
-Definition at line 43 of file utils.cpp .
+Definition at line 41 of file utils.cpp .
@@ -290,9 +289,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
-
Returns bool
+
Returns bool Success/Fail
-
Definition at line 76 of file utils.cpp .
+
Definition at line 74 of file utils.cpp .
@@ -340,7 +339,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
Returns std::string
-Definition at line 24 of file utils.cpp .
+Definition at line 22 of file utils.cpp .
@@ -388,7 +387,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
Returns std::string
-Definition at line 17 of file utils.cpp .
+Definition at line 15 of file utils.cpp .
diff --git a/docs/utils_8cpp.js b/docs/utils_8cpp.js
index 362b36a..a2d8610 100644
--- a/docs/utils_8cpp.js
+++ b/docs/utils_8cpp.js
@@ -1,6 +1,6 @@
var utils_8cpp =
[
- [ "arma_vector_close_to", "utils_8cpp.html#a5d2e1e032fd19614f2fbb58149a7b02a", null ],
+ [ "close_to", "utils_8cpp.html#a6be6f938bcbb235ebb6a2ed9d08411b2", null ],
[ "m_assert", "utils_8cpp.html#aff5e07c3c1d321709b0cc38e999f427b", null ],
[ "mkpath", "utils_8cpp.html#acf13f4e492199cb7231bfa646dbd08de", null ],
[ "scientific_format", "utils_8cpp.html#a58565270b643b24e3132f38c653e0199", null ],
diff --git a/docs/utils_8cpp_source.html b/docs/utils_8cpp_source.html
index 5ed9571..24a0002 100644
--- a/docs/utils_8cpp_source.html
+++ b/docs/utils_8cpp_source.html
@@ -102,97 +102,95 @@ $(document).ready(function(){initNavTree('utils_8cpp_source.html',''); initResiz
Go to the documentation of this file.
-
+
-
-
-
-
-
-
20 ss << std::setw(width) << std::setprecision(prec) << std::scientific << d;
-
-
-
-
-
-
-
27 for (
double elem : v) {
-
-
-
-
-
-
33 static void print_message(std::string msg)
-
-
-
36 std::cout <<
"message: " << msg <<
"\n\n" ;
-
-
-
-
-
-
-
43 void m_assert (
bool expr, std::string expr_str, std::string f, std::string file,
-
44 int line, std::string msg)
-
-
46 std::string new_assert(f.size() + (expr ? 4 : 6),
'-' );
-
47 std::cout <<
"\x1B[36m" << new_assert <<
"\033[0m\n" ;
-
48 std::cout << f <<
": " ;
-
-
50 std::cout <<
"\x1B[32mOK\033[0m\n" ;
-
-
-
-
54 std::cout <<
"\x1B[31mFAIL\033[0m\n" ;
-
-
56 std::cout << file <<
" " << line <<
": Assertion \"" << expr_str
-
-
-
-
-
-
-
-
64 if (a.n_elem != b.n_elem) {
-
-
-
-
68 for (
size_t i = 0; i < a.n_elem; i++) {
-
69 if (std::abs(a(i) - b(i)) >= tol) {
-
-
-
-
-
-
-
76 bool mkpath (std::string path,
int mode)
-
-
-
79 std::string::size_type pos = -1;
-
-
-
82 if (path.back() !=
'/' ) {
-
-
-
-
-
87 pos = path.find(
'/' , pos);
-
88 if (pos != std::string::npos) {
-
89 cur_dir = path.substr(0, pos);
-
90 if (mkdir(cur_dir.c_str(), mode) != 0 && stat(cur_dir.c_str(), &buf) != 0) {
-
-
-
-
-
-
-
-
-
-
bool arma_vector_close_to(arma::vec &a, arma::vec &b, double tol)
Test if two armadillo vectors are close to each other.
-
std::string scientific_format(double d, int width, int prec)
Turns a double into a string written in scientific format.
-
bool mkpath(std::string path, int mode)
Make path given.
-
void m_assert(bool expr, std::string expr_str, std::string f, std::string file, int line, std::string msg)
Test an expression, confirm that test is ok, or abort execution.
+
+
+
+
18 ss << std::setw(width) << std::setprecision(prec) << std::scientific << d;
+
+
+
+
+
+
+
25 for (
double elem : v) {
+
+
+
+
+
+
31 static void print_message(std::string msg)
+
+
+
34 std::cout <<
"message: " << msg <<
"\n\n" ;
+
+
+
+
+
+
+
41 void m_assert (
bool expr, std::string expr_str, std::string f, std::string file,
+
42 int line, std::string msg)
+
+
44 std::string new_assert(f.size() + (expr ? 4 : 6),
'-' );
+
45 std::cout <<
"\x1B[36m" << new_assert <<
"\033[0m\n" ;
+
46 std::cout << f <<
": " ;
+
+
48 std::cout <<
"\x1B[32mOK\033[0m\n" ;
+
+
+
+
52 std::cout <<
"\x1B[31mFAIL\033[0m\n" ;
+
+
54 std::cout << file <<
" " << line <<
": Assertion \"" << expr_str
+
+
+
+
+
+
60 bool close_to (arma::vec &a, arma::vec &b,
double tol)
+
+
62 if (a.n_elem != b.n_elem) {
+
+
+
+
66 for (
size_t i = 0; i < a.n_elem; i++) {
+
67 if (std::abs(a(i) - b(i)) >= tol) {
+
+
+
+
+
+
+
74 bool mkpath (std::string path,
int mode)
+
+
+
77 std::string::size_type pos = -1;
+
+
+
80 if (path.back() !=
'/' ) {
+
+
+
+
+
85 pos = path.find(
'/' , pos);
+
86 if (pos != std::string::npos) {
+
87 cur_dir = path.substr(0, pos);
+
88 if (mkdir(cur_dir.c_str(), mode) != 0 && stat(cur_dir.c_str(), &buf) != 0) {
+
+
+
+
+
+
+
+
+
+
bool close_to(arma::vec &a, arma::vec &b, double tol)
Test if two armadillo vectors are close to each other.
+
std::string scientific_format(double d, int width, int prec)
Turns a double into a string written in scientific format.
+
bool mkpath(std::string path, int mode)
Make path given.
+
void m_assert(bool expr, std::string expr_str, std::string f, std::string file, int line, std::string msg)
Test an expression, confirm that test is ok, or abort execution.
Function prototypes and macros that are useful.
diff --git a/docs/utils_8hpp.html b/docs/utils_8hpp.html
index 2866ae0..129e846 100644
--- a/docs/utils_8hpp.html
+++ b/docs/utils_8hpp.html
@@ -111,6 +111,7 @@ $(document).ready(function(){initNavTree('utils_8hpp.html',''); initResizable();
#include <iomanip>
#include <sstream>
#include <string>
+#include <sys/stat.h>
#include <vector>
Go to the source code of this file.
@@ -124,7 +125,7 @@ Macros
A prettier assertion function.
#define __METHOD_NAME__ methodName(__PRETTY_FUNCTION__)
- Get the name of the current method/function.
+ Get the name of the current method/function without the return type.
void m_assert (bool expr, std::string expr_str, std::string func, std::string file, int line, std::string msg)
Test an expression, confirm that test is ok, or abort execution.
-bool arma_vector_close_to (arma::vec &a, arma::vec &b, double tol=1e-8)
- Test if two armadillo vectors are close to each other.
-
+bool close_to (arma::vec &a, arma::vec &b, double tol=1e-8)
+ Test if two armadillo vectors are close to each other.
+
bool mkpath (std::string path, int mode=0777)
Make path given.
@@ -168,9 +169,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
-
Get the name of the current method/function.
+
Get the name of the current method/function without the return type.
-
Definition at line 51 of file utils.hpp .
+
Definition at line 52 of file utils.hpp .
@@ -201,13 +202,13 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
Value:
__LINE__, msg)
-
void m_assert(bool expr, std::string expr_str, std::string func, std::string file, int line, std::string msg)
Test an expression, confirm that test is ok, or abort execution.
-
#define __METHOD_NAME__
Get the name of the current method/function.
+
void m_assert(bool expr, std::string expr_str, std::string func, std::string file, int line, std::string msg)
Test an expression, confirm that test is ok, or abort execution.
+
#define __METHOD_NAME__
Get the name of the current method/function without the return type.
A prettier assertion function.
This macro calls the m_assert function which is a more informative assertion function than the regular assert function from cassert.
-
Definition at line 45 of file utils.hpp .
+
Definition at line 46 of file utils.hpp .
@@ -230,19 +231,19 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
Writes a debug message.
This macro writes a debug message that includes the filename, line number, and a custom message. The function is wrapped in an ifdef that checks if DBG is defined, so one can choose to display the debug messages by adding the -DDBG flag when compiling.
-Definition at line 36 of file utils.hpp .
+Definition at line 37 of file utils.hpp .
-
-◆ arma_vector_close_to()
+
+◆ close_to()
- bool arma_vector_close_to
+ bool close_to
(
arma::vec &
a ,
@@ -279,7 +280,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
Returns bool
-Definition at line 62 of file utils.cpp .
+Definition at line 60 of file utils.cpp .
@@ -347,7 +348,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
-Definition at line 43 of file utils.cpp .
+Definition at line 41 of file utils.cpp .
@@ -386,9 +387,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
-
Returns bool
+
Returns bool Success/Fail
-
Definition at line 76 of file utils.cpp .
+
Definition at line 74 of file utils.cpp .
@@ -436,7 +437,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
Returns std::string
-Definition at line 24 of file utils.cpp .
+Definition at line 22 of file utils.cpp .
@@ -484,7 +485,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
Returns std::string
-Definition at line 17 of file utils.cpp .
+Definition at line 15 of file utils.cpp .
diff --git a/docs/utils_8hpp.js b/docs/utils_8hpp.js
index 68951df..35bac4e 100644
--- a/docs/utils_8hpp.js
+++ b/docs/utils_8hpp.js
@@ -3,7 +3,7 @@ var utils_8hpp =
[ "__METHOD_NAME__", "utils_8hpp.html#a60dca3177fb9cb5256609adc7af55168", null ],
[ "ASSERT", "utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9", null ],
[ "DEBUG", "utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b", null ],
- [ "arma_vector_close_to", "utils_8hpp.html#a0c95c4791692b06f8811905a76dbd772", null ],
+ [ "close_to", "utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9", null ],
[ "m_assert", "utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38", null ],
[ "mkpath", "utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa", null ],
[ "scientific_format", "utils_8hpp.html#ad54b96a1074f9df4dc892a41d115b72d", null ],
diff --git a/docs/utils_8hpp_source.html b/docs/utils_8hpp_source.html
index 1c7052d..23a5d44 100644
--- a/docs/utils_8hpp_source.html
+++ b/docs/utils_8hpp_source.html
@@ -109,57 +109,58 @@ $(document).ready(function(){initNavTree('utils_8hpp_source.html',''); initResiz
-
-
-
- 33 #define DEBUG(msg) std::cout << __FILE__ << " " << __LINE__ << ": " \
-
-
-
-
-
- 45 #define ASSERT(expr, msg) m_assert(expr, #expr, __METHOD_NAME__, __FILE__, \
-
-
- 51 #define __METHOD_NAME__ methodName(__PRETTY_FUNCTION__)
-
+
+
+
+
+ 34 #define DEBUG(msg) std::cout << __FILE__ << " " << __LINE__ << ": " \
+
+
+
+
+
+ 46 #define ASSERT(expr, msg) m_assert(expr, #expr, __METHOD_NAME__, __FILE__, \
+
+
+ 52 #define __METHOD_NAME__ methodName(__PRETTY_FUNCTION__)
-
-
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
+
+ 114 bool close_to (arma::vec &a, arma::vec &b,
double tol=1e-8);
- 126 static inline std::string methodName(
const std::string& pretty_function)
-
- 128 size_t colons = pretty_function.find(
"::" );
- 129 size_t begin = pretty_function.substr(0,colons).rfind(
" " ) + 1;
- 130 size_t end = pretty_function.rfind(
"(" ) - begin;
-
- 132 return pretty_function.substr(begin,end) +
"()" ;
-
-
+
+ 127 static inline std::string methodName(
const std::string& pretty_function)
+
+ 129 size_t colons = pretty_function.find(
"::" );
+ 130 size_t begin = pretty_function.substr(0,colons).rfind(
" " ) + 1;
+ 131 size_t end = pretty_function.rfind(
"(" ) - begin;
+
+ 133 return pretty_function.substr(begin,end) +
"()" ;
+
- 146 bool mkpath (std::string path,
int mode = 0777);
-
-
-bool arma_vector_close_to(arma::vec &a, arma::vec &b, double tol=1e-8)
Test if two armadillo vectors are close to each other.
-void m_assert(bool expr, std::string expr_str, std::string func, std::string file, int line, std::string msg)
Test an expression, confirm that test is ok, or abort execution.
-bool mkpath(std::string path, int mode=0777)
Make path given.
-std::string scientific_format(double d, int width=20, int prec=10)
Turns a double into a string written in scientific format.
+
+ 147 bool mkpath (std::string path,
int mode = 0777);
+
+
+void m_assert(bool expr, std::string expr_str, std::string func, std::string file, int line, std::string msg)
Test an expression, confirm that test is ok, or abort execution.
+bool mkpath(std::string path, int mode=0777)
Make path given.
+bool close_to(arma::vec &a, arma::vec &b, double tol=1e-8)
Test if two armadillo vectors are close to each other.
+std::string scientific_format(double d, int width=20, int prec=10)
Turns a double into a string written in scientific format.