diff --git a/docs/100_particles.gif b/docs/100_particles.gif index 3dde053..337c6e5 100644 Binary files a/docs/100_particles.gif and b/docs/100_particles.gif differ diff --git a/docs/Particle_8cpp.html b/docs/Particle_8cpp.html index 98aaf8d..b3fd0e9 100644 --- a/docs/Particle_8cpp.html +++ b/docs/Particle_8cpp.html @@ -113,7 +113,7 @@ $(document).ready(function(){initNavTree('Particle_8cpp.html',''); initResizable
Janita Ovidie Sandtrøen Willumsen (janitaws)
Version
0.1
-
Bug:
No known bugs
+
Bug:
No known bugs

Definition in file Particle.cpp.

diff --git a/docs/Particle_8cpp_source.html b/docs/Particle_8cpp_source.html index 2eaf72e..13c1950 100644 --- a/docs/Particle_8cpp_source.html +++ b/docs/Particle_8cpp_source.html @@ -102,24 +102,24 @@ $(document).ready(function(){initNavTree('Particle_8cpp_source.html',''); initRe
Go to the documentation of this file.
1
-
14#include "Particle.hpp"
-
15
-
16Particle::Particle(double q, double m,
-
17 arma::vec::fixed<3> r_vec,
-
18 arma::vec::fixed<3> v_vec)
-
19{
-
20 // Giving the particle its properties
-
21 this->q = q;
-
22 this->m = m;
-
23 this->r_vec = r_vec;
-
24 this->v_vec = v_vec;
-
25}
+
13#include "Particle.hpp"
+
14
+
15Particle::Particle(double q, double m,
+
16 arma::vec::fixed<3> r_vec,
+
17 arma::vec::fixed<3> v_vec)
+
18{
+
19 // Giving the particle its properties
+
20 this->q = q;
+
21 this->m = m;
+
22 this->r_vec = r_vec;
+
23 this->v_vec = v_vec;
+
24}
A class that holds the properties of a particle.
-
Particle(double q, double m, arma::vec::fixed< 3 > r_vec, arma::vec::fixed< 3 > v_vec)
Initialize the particle.
Definition: Particle.cpp:16
-
arma::vec::fixed< 3 > v_vec
velocity
Definition: Particle.hpp:24
-
double q
Charge.
Definition: Particle.hpp:21
-
arma::vec::fixed< 3 > r_vec
position
Definition: Particle.hpp:23
-
double m
Mass.
Definition: Particle.hpp:22
+
double q
Charge.
Definition: Particle.hpp:23
+
Particle(double q, double m, vec_3d r_vec, vec_3d v_vec)
Initialize the particle.
Definition: Particle.cpp:15
+
vec_3d v_vec
velocity
Definition: Particle.hpp:26
+
double m
Mass.
Definition: Particle.hpp:24
+
vec_3d r_vec
position
Definition: Particle.hpp:25
diff --git a/docs/Particle_8hpp.html b/docs/Particle_8hpp.html index 3516260..00fc0e2 100644 --- a/docs/Particle_8hpp.html +++ b/docs/Particle_8hpp.html @@ -107,6 +107,7 @@ $(document).ready(function(){initNavTree('Particle_8hpp.html',''); initResizable

A class that holds the properties of a particle. More...

#include <armadillo>
+#include "typedefs.hpp"

Go to the source code of this file.

diff --git a/docs/Particle_8hpp_source.html b/docs/Particle_8hpp_source.html index dbb28de..f3339f5 100644 --- a/docs/Particle_8hpp_source.html +++ b/docs/Particle_8hpp_source.html @@ -107,28 +107,30 @@ $(document).ready(function(){initNavTree('Particle_8hpp_source.html',''); initRe
14
15#include <armadillo>
16
-
19class Particle {
-
20private:
-
21 double q;
-
22 double m;
-
23 arma::vec::fixed<3> r_vec;
-
24 arma::vec::fixed<3> v_vec;
-
25
-
26public:
-
32 Particle(double q, double m,
-
33 arma::vec::fixed<3> r_vec,
-
34 arma::vec::fixed<3> v_vec);
-
35
-
38 friend class PenningTrap;
-
39};
+
17#include "typedefs.hpp"
+
18
+
21class Particle {
+
22private:
+
23 double q;
+
24 double m;
+
25 vec_3d r_vec;
+
26 vec_3d v_vec;
+
27
+
28public:
+
39 Particle(double q, double m, vec_3d r_vec, vec_3d v_vec);
40
-
41#endif
-
Particle
A class that holds attributes of a particle.
Definition: Particle.hpp:19
-
Particle::v_vec
arma::vec::fixed< 3 > v_vec
velocity
Definition: Particle.hpp:24
-
Particle::q
double q
Charge.
Definition: Particle.hpp:21
-
Particle::r_vec
arma::vec::fixed< 3 > r_vec
position
Definition: Particle.hpp:23
-
Particle::m
double m
Mass.
Definition: Particle.hpp:22
-
PenningTrap
A class that simulates a Penning trap.
Definition: PenningTrap.hpp:29
+
43 friend class PenningTrap;
+
44};
+
45
+
46#endif
+
Particle
A class that holds attributes of a particle.
Definition: Particle.hpp:21
+
Particle::q
double q
Charge.
Definition: Particle.hpp:23
+
Particle::v_vec
vec_3d v_vec
velocity
Definition: Particle.hpp:26
+
Particle::m
double m
Mass.
Definition: Particle.hpp:24
+
Particle::r_vec
vec_3d r_vec
position
Definition: Particle.hpp:25
+
PenningTrap
A class that simulates a Penning trap.
Definition: PenningTrap.hpp:30
+
typedefs.hpp
Useful typedefs for cleaner code.
+
vec_3d
arma::vec::fixed< 3 > vec_3d
Typedef for a fixed 3d arma vector.
Definition: typedefs.hpp:36
diff --git a/docs/PenningTrap_8cpp.html b/docs/PenningTrap_8cpp.html index 62355e1..5817ff6 100644 --- a/docs/PenningTrap_8cpp.html +++ b/docs/PenningTrap_8cpp.html @@ -106,6 +106,7 @@ $(document).ready(function(){initNavTree('PenningTrap_8cpp.html',''); initResiza More...

#include "PenningTrap.hpp"
#include "constants.hpp"
+#include "typedefs.hpp"
#include "utils.hpp"

Go to the source code of this file.

@@ -115,10 +116,7 @@ $(document).ready(function(){initNavTree('PenningTrap_8cpp.html',''); initResiza
Janita Ovidie Sandtrøen Willumsen (janitaws)
Version
0.1
-
Bug:
No known bugs
-
Todo:

Implement evolve_RK4

-

Implement evolve_forward_euler

-
+
Bug:
No known bugs

Definition in file PenningTrap.cpp.

diff --git a/docs/PenningTrap_8cpp_source.html b/docs/PenningTrap_8cpp_source.html index 993de8e..282e5c2 100644 --- a/docs/PenningTrap_8cpp_source.html +++ b/docs/PenningTrap_8cpp_source.html @@ -102,205 +102,311 @@ $(document).ready(function(){initNavTree('PenningTrap_8cpp_source.html',''); ini
Go to the documentation of this file.
1
-
16#include "PenningTrap.hpp"
-
17#include "constants.hpp"
-
18#include "utils.hpp"
-
19
-
20PenningTrap::PenningTrap(double B_0, double V_0, double d)
-
21{
-
22 this->B_0 = B_0;
-
23 this->V_0 = V_0;
-
24 this->d = d;
+
13#include "PenningTrap.hpp"
+
14#include "constants.hpp"
+
15#include "typedefs.hpp"
+
16#include "utils.hpp"
+
17
+
18PenningTrap::PenningTrap(double B_0, std::function<double(double)> V_0,
+
19 double d, double t)
+
20{
+
21 this->B_0 = B_0;
+
22 this->V_0 = V_0;
+
23 this->d = d;
+
24 this->t = t;
25}
26
- -
28{
-
29 this->particles.push_back(particle);
-
30}
-
31
-
32arma::vec PenningTrap::external_E_field(arma::vec r)
-
33{
-
34 arma::vec::fixed<3> res;
-
35 double f = this->V_0 / (this->d * this->d);
-
36 res(0) = r(0);
-
37 res(1) = r(1);
-
38 res(2) = -2. * r(2);
-
39
-
40 return f * res;
-
41}
-
42
-
43arma::vec PenningTrap::external_B_field(arma::vec r)
-
44{
-
45 arma::vec::fixed<3> res{0., 0., this->B_0};
-
46
-
47 return res;
-
48}
-
49
-
50arma::vec PenningTrap::force_on_particle(int i, int j)
-
51{
-
52 // Calculate the difference between the particles' position
-
53 arma::vec::fixed<3> res =
-
54 this->particles.at(i).r_vec - this->particles.at(j).r_vec;
-
55
-
56 // Get the distance between the particles
-
57 double norm = arma::norm(res);
-
58
-
59 // Multiply res with p_j's charge divided by the norm cubed
-
60 res *= this->particles.at(j).q / (norm * norm * norm);
-
61
-
62 return res;
-
63}
-
64
- -
66{
-
67 Particle p = this->particles.at(i);
-
68
-
69 arma::vec::fixed<3> B = this->external_B_field(p.r_vec);
-
70
-
71 arma::vec::fixed<3> v_cross_B{p.v_vec(1) * B(2) - p.v_vec(2) * B(1),
-
72 p.v_vec(2) * B(0) - p.v_vec(0) * B(2),
-
73 p.v_vec(0) * B(1) - p.v_vec(1) * B(0)};
-
74
-
75 arma::vec force = p.q * (this->external_E_field(p.r_vec) + v_cross_B);
-
76
-
77 return force;
-
78}
-
79
- -
81{
-
82 Particle p = this->particles.at(i);
-
83
-
84 arma::vec res(3);
-
85
-
86 for (int j = 0; j < this->particles.size(); j++) {
-
87 if (i == j) {
-
88 continue;
-
89 }
-
90
-
91 res += this->force_on_particle(i, j);
-
92 }
-
93
-
94 res *= K_E * (p.q / p.m);
-
95
-
96 return res;
-
97}
-
98
- -
100{
-
101 return this->total_force_external(i) - this->total_force_particles(i);
-
102}
-
103
- -
105{
-
106 std::vector<Particle> tmp_particles = this->particles;
-
107
-
108 arma::vec::fixed<3> *k_v = new arma::vec::fixed<3>[this->particles.size()*4];
-
109 arma::vec::fixed<3> *k_r = new arma::vec::fixed<3>[this->particles.size()*4];
+
27PenningTrap::PenningTrap(unsigned int i, double B_0,
+
28 std::function<double(double)> V_0, double d, double t)
+
29 : PenningTrap::PenningTrap(B_0, V_0, d)
+
30{
+
31 vec_3d r, v;
+
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;
+
35 this->add_particle(Particle(1., 40., r, v));
+
36 }
+
37}
+
38
+
39PenningTrap::PenningTrap(std::vector<Particle> particles, double B_0,
+
40 std::function<double(double)> V_0, double d, double t)
+
41 : PenningTrap::PenningTrap(B_0, V_0, d)
+
42{
+
43 this->particles = particles;
+
44}
+
45
+
46vec_3d PenningTrap::v_func(unsigned int i, unsigned int j, double dt)
+
47{
+
48 switch (i) {
+
49 case 0:
+
50 return .5 * dt * this->k_v[0][j];
+
51 case 1:
+
52 return .5 * dt * this->k_v[1][j];
+
53 case 2:
+
54 return dt * this->k_v[2][j];
+
55 case 3:
+
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());
+
58 default:
+
59 std::cout << "Not valid!" << std::endl;
+
60 abort();
+
61 }
+
62}
+
63
+
64vec_3d PenningTrap::r_func(unsigned int i, unsigned int j, double dt)
+
65{
+
66 switch (i) {
+
67 case 0:
+
68 return .5 * dt * this->k_r[0][j];
+
69 case 1:
+
70 return .5 * dt * this->k_r[1][j];
+
71 case 2:
+
72 return dt * this->k_r[2][j];
+
73 case 3:
+
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());
+
76 default:
+
77 std::cout << "Not valid!" << std::endl;
+
78 abort();
+
79 }
+
80}
+
81
+ +
83{
+
84 this->particles.push_back(particle);
+
85}
+
86
+ +
88{
+
89 r(2) *= -2.;
+
90 double f = this->V_0(this->t) / (this->d * this->d);
+
91
+
92 return f * r;
+
93}
+
94
+ +
96{
+
97 return vec_3d{0., 0., this->B_0};
+
98}
+
99
+
100vec_3d PenningTrap::force_on_particle(unsigned int i, unsigned int j)
+
101{
+
102 Particle p_j = this->particles[j];
+
103 // Calculate the difference between the particles' position
+
104 vec_3d res = this->particles[i].r_vec - p_j.r_vec;
+
105
+
106 // Get the distance between the particles
+
107 double norm = arma::norm(res, 2);
+
108
+
109 // Multiply res with p_j's charge divided by the norm cubed
110
-
111 int size = this->particles.size();
-
112
-
113 for (int i=0; i<size; i++) {
-
114 k_v[i] = this->total_force(i)/this->particles.at(i).m;
-
115 k_r[i] = this->particles.at(i).v_vec;
-
116 }
+
111 return vec_3d(res * p_j.q / (norm * norm * norm));
+
112}
+
113
+ +
115{
+
116 Particle p = this->particles[i];
117
-
118 for (int i=0; i<size; i++) {
-
119 Particle *p = &this->particles.at(i);
-
120
-
121 p->v_vec = tmp_particles.at(i).v_vec + (dt/2)*k_v[i];
-
122 p->r_vec = tmp_particles.at(i).r_vec + (dt/2)*k_r[i];
-
123 }
-
124
+
118 if (arma::norm(p.r_vec) > this->d) {
+
119 return vec_3d{0., 0., 0.};
+
120 }
+
121
+
122 vec_3d force =
+
123 p.q * (this->external_E_field(p.r_vec) +
+
124 arma::cross(p.v_vec, this->external_B_field(p.r_vec)));
125
-
126 for (int i=0; i<size; i++) {
-
127 k_v[1*size + i] = this->total_force(i)/this->particles.at(i).m;
-
128 k_r[1*size + i] = this->particles.at(i).v_vec;
-
129 }
-
130
-
131 for (int i=0; i<size; i++) {
-
132 Particle *p = &this->particles.at(i);
-
133
-
134 p->v_vec = tmp_particles.at(i).v_vec + (dt/2)*k_v[1*size + i];
-
135 p->r_vec = tmp_particles.at(i).r_vec + (dt/2)*k_r[1*size + i];
-
136 }
-
137
-
138 for (int i=0; i<size; i++) {
-
139 k_v[2*size + i] = this->total_force(i)/this->particles.at(i).m;
-
140 k_r[2*size + i] = this->particles.at(i).v_vec;
+
126 return force;
+
127}
+
128
+ +
130{
+
131 Particle p = this->particles[i];
+
132
+
133 vec_3d res;
+
134
+
135 for (size_t j = 0; j < this->particles.size(); j++) {
+
136 if (i == j) {
+
137 continue;
+
138 }
+
139
+
140 res += this->force_on_particle(i, j);
141 }
142
-
143 for (int i=0; i<size; i++) {
-
144 Particle *p = &this->particles.at(i);
+
143 return vec_3d(res * K_E * (p.q / p.m));
+
144}
145
-
146 p->v_vec = tmp_particles.at(i).v_vec + dt*k_v[2*size + i];
-
147 p->r_vec = tmp_particles.at(i).r_vec + dt*k_r[2*size + i];
-
148 }
-
149
+ +
147{
+
148 return this->total_force_external(i) - this->total_force_particles(i);
+
149}
150
-
151 for (int i=0; i<size; i++) {
-
152 k_v[3*size + i] = this->total_force(i)/this->particles.at(i).m;
-
153 k_r[3*size + i] = this->particles.at(i).v_vec;
-
154 }
-
155
-
156 for (int i=0; i<size; i++) {
-
157 Particle *p = &this->particles.at(i);
-
158
-
159 p->v_vec = tmp_particles.at(i).v_vec + dt*(k_v[i] + k_v[size + i] + k_v[2*size + i] + k_v[3*size + i])/6;
-
160 p->r_vec = tmp_particles.at(i).r_vec + dt*(k_r[i] + k_r[size + i] + k_r[2*size + i] + k_r[3*size + i])/6;
-
161 }
-
162
-
163 delete [] k_v;
-
164 delete [] k_r;
-
165}
+
151void PenningTrap::evolve_RK4(double dt, bool particle_interaction)
+
152{
+
153
+
154 std::vector<Particle> original_particles = this->particles;
+
155 std::vector<Particle> tmp_particles = this->particles;
+
156
+
157 vec_3d (PenningTrap::*force)(unsigned int);
+
158 if (particle_interaction) {
+ +
160 }
+
161 else {
+ +
163 }
+
164
+
165 size_t size = this->particles.size();
166
- -
168{
-
169 std::vector<Particle> new_state = this->particles;
-
170
-
171 Particle *p;
-
172
-
173#pragma omp parallel for private(p)
-
174 for (int i = 0; i < this->particles.size(); i++) {
-
175 p = &new_state.at(i);
-
176 p->v_vec += dt * this->total_force(i) / new_state.at(i).m;
-
177 p->r_vec += dt * this->particles.at(i).v_vec;
-
178 }
-
179
-
180 this->particles = new_state;
-
181}
-
182
-
183arma::vec PenningTrap::get_particle(int i)
-
184{
-
185 return this->particles.at(i).r_vec;
-
186}
-
187
-
188double PenningTrap::get_d()
-
189{
-
190 return this->d;
-
191}
+
167 this->k_v = sim_arr(4, sim_cols(size));
+
168 this->k_r = sim_arr(4, sim_cols(size));
+
169
+
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;
+
175
+
176 Particle *p = &tmp_particles[j];
+
177
+
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);
+
180 }
+
181 this->particles = tmp_particles;
+
182 }
+
183 this->t += dt;
+
184}
+
185
+
186void PenningTrap::evolve_forward_euler(double dt, bool particle_interaction)
+
187{
+
188 std::vector<Particle> new_state = this->particles;
+
189
+
190 Particle *p;
+
191
+
192 vec_3d (PenningTrap::*force)(unsigned int);
+
193 if (particle_interaction) {
+ +
195 }
+
196 else {
+ +
198 }
+
199
+
200#pragma omp parallel for private(p)
+
201 for (size_t i = 0; i < this->particles.size(); i++) {
+
202 p = &new_state[i];
+
203 p->v_vec += dt * (this->*force)(i) / p->m;
+
204 p->r_vec += dt * this->particles[i].v_vec;
+
205 }
+
206
+
207 this->particles = new_state;
+
208 this->t += dt;
+
209}
+
210
+
211sim_arr PenningTrap::simulate(double time, unsigned int steps,
+
212 std::string method, bool particle_interaction)
+
213{
+
214 double dt = time / (double)steps;
+
215
+
216 sim_arr res(this->particles.size(), sim_cols(steps));
+
217
+
218 void (PenningTrap::*func)(double, bool);
+
219 if (method == "rk4") {
+ +
221 }
+
222 else if (method == "euler") {
+ +
224 }
+
225 else {
+
226 std::cout << "Not a valid method!" << std::endl;
+
227 abort();
+
228 }
+
229
+
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;
+
233 }
+
234 (this->*func)(dt, particle_interaction);
+
235 }
+
236
+
237 return res;
+
238}
+
239
+
240void PenningTrap::write_simulation_to_dir(std::string path, double time,
+
241 int steps, std::string method,
+
242 bool particle_interaction)
+
243{
+
244 if (path.back() != '/') {
+
245 path += '/';
+
246 }
+
247 if (mkpath(path, 0777) != 0) {
+
248 std::cout << "Hello" << std::endl;
+
249 return;
+
250 }
+
251
+
252 sim_arr res = this->simulate(time, steps, method, particle_interaction);
+
253
+
254 std::ofstream ofile;
+
255
+
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";
+
261 }
+
262 ofile.close();
+
263 }
+
264}
+
265
+
266double PenningTrap::fraction_of_particles_left(double time, unsigned int steps, std::string method, bool particle_interaction)
+
267{
+
268 sim_arr res = this->simulate(time, steps, method, particle_interaction);
+
269
+
270 int particles_left = 0;
+
271
+
272 for (Particle p : this->particles) {
+
273 if (arma::norm(p.r_vec) < this->d) {
+
274 particles_left++;
+
275 }
+
276 }
+
277
+
278 return (double) particles_left / (double) this->particles.size();
+
279}
+
280
A class for simulating a Penning trap.
-
A class that holds attributes of a particle.
Definition: Particle.hpp:19
-
arma::vec::fixed< 3 > v_vec
velocity
Definition: Particle.hpp:24
-
double q
Charge.
Definition: Particle.hpp:21
-
arma::vec::fixed< 3 > r_vec
position
Definition: Particle.hpp:23
-
double m
Mass.
Definition: Particle.hpp:22
-
std::vector< Particle > particles
The particles in the Penning trap.
Definition: PenningTrap.hpp:34
-
arma::vec total_force_external(int i)
Calculate the total external force on a particle.
Definition: PenningTrap.cpp:65
-
double B_0
Magnetic field strength.
Definition: PenningTrap.hpp:31
-
arma::vec total_force_particles(int i)
Calculate the total force on a particle from other particles.
Definition: PenningTrap.cpp:80
-
arma::vec external_B_field(arma::vec r)
Calculate B at point r.
Definition: PenningTrap.cpp:43
-
arma::vec force_on_particle(int i, int j)
Calculate the force between 2 particles.
Definition: PenningTrap.cpp:50
-
void evolve_forward_euler(double dt)
Go forward one timestep using the forward Euler method.
-
double d
Characteristic dimension.
Definition: PenningTrap.hpp:33
-
void add_particle(Particle particle)
Add a particle to the system.
Definition: PenningTrap.cpp:27
-
double V_0
Applied potential.
Definition: PenningTrap.hpp:32
-
PenningTrap(double B_0=T, double V_0=25.*V/1000., double d=500.)
Set B_0, V_0 and d.
Definition: PenningTrap.cpp:20
-
arma::vec total_force(int i)
calculate the total force on a particle.
Definition: PenningTrap.cpp:99
-
arma::vec external_E_field(arma::vec r)
Calculate E at point r.
Definition: PenningTrap.cpp:32
-
void evolve_RK4(double dt)
Go forward one timestep using the RK4 method.
+
A class that holds attributes of a particle.
Definition: Particle.hpp:21
+
double q
Charge.
Definition: Particle.hpp:23
+
vec_3d v_vec
velocity
Definition: Particle.hpp:26
+
double m
Mass.
Definition: Particle.hpp:24
+
vec_3d r_vec
position
Definition: Particle.hpp:25
+
A class that simulates a Penning trap.
Definition: PenningTrap.hpp:30
+
std::vector< Particle > particles
The particles in the Penning trap.
Definition: PenningTrap.hpp:36
+
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.
Definition: PenningTrap.hpp:32
+
vec_3d external_E_field(vec_3d r)
Calculate E at point r.
Definition: PenningTrap.cpp:87
+
vec_3d total_force(unsigned int i)
calculate the total force on a particle p_i.
+
sim_arr k_r
Definition: PenningTrap.hpp:39
+
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.
Definition: PenningTrap.cpp:64
+
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.
Definition: PenningTrap.hpp:34
+
void add_particle(Particle particle)
Add a particle to the system.
Definition: PenningTrap.cpp:82
+
double t
Current time.
Definition: PenningTrap.hpp:35
+
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.
Definition: PenningTrap.hpp:33
+
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.
Definition: PenningTrap.cpp:95
+
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.
Definition: PenningTrap.cpp:18
+
vec_3d total_force_external(unsigned int i)
Calculate the total external force on a particle.
+
sim_arr k_v
Definition: PenningTrap.hpp:37
+
vec_3d v_func(unsigned int i, unsigned int j, double dt)
Helper for evolve_RK4 when calculating values.
Definition: PenningTrap.cpp:46
Library of constants.
#define K_E
Coulomb constant. unit: .
Definition: constants.hpp:15
+
Useful typedefs for cleaner code.
+
std::vector< arma::vec::fixed< 3 > > sim_cols
Typedef for the column of the result vector from simulating particles.
Definition: typedefs.hpp:24
+
arma::vec::fixed< 3 > vec_3d
Typedef for a fixed 3d arma vector.
Definition: typedefs.hpp:36
+
std::vector< sim_cols > sim_arr
Typedef for the result of the simulate method.
Definition: typedefs.hpp:32
Function prototypes and macros that are useful.
+
bool mkpath(std::string path, int mode=0777)
Make path given.
Definition: utils.cpp:76
diff --git a/docs/PenningTrap_8hpp.html b/docs/PenningTrap_8hpp.html index 306bc89..5f6ee45 100644 --- a/docs/PenningTrap_8hpp.html +++ b/docs/PenningTrap_8hpp.html @@ -110,6 +110,7 @@ $(document).ready(function(){initNavTree('PenningTrap_8hpp.html',''); initResiza #include <omp.h>
#include "Particle.hpp"
#include "constants.hpp"
+#include "typedefs.hpp"

Go to the source code of this file.

diff --git a/docs/PenningTrap_8hpp_source.html b/docs/PenningTrap_8hpp_source.html index 02b2aed..dfdddbe 100644 --- a/docs/PenningTrap_8hpp_source.html +++ b/docs/PenningTrap_8hpp_source.html @@ -110,63 +110,106 @@ $(document).ready(function(){initNavTree('PenningTrap_8hpp_source.html',''); ini
17
18#include "Particle.hpp"
19#include "constants.hpp"
-
20
-
21#pragma omp declare reduction( + : arma::vec : omp_out += omp_in ) \
-
22 initializer( omp_priv = omp_orig )
-
23
-
29class PenningTrap {
-
30private:
-
31 double B_0;
-
32 double V_0;
-
33 double d;
-
34 std::vector<Particle> particles;
-
35
-
36public:
-
39 PenningTrap(double B_0 = T, double V_0 = 25.*V/1000., double d = 500.);
-
40
-
43 void add_particle(Particle particle);
-
44
-
47 arma::vec external_E_field(arma::vec r);
-
48
-
51 arma::vec external_B_field(arma::vec r);
-
52
-
58 arma::vec force_on_particle(int i, int j);
-
59
-
65 arma::vec total_force_external(int i);
-
66
-
69 arma::vec total_force_particles(int i);
-
70
-
73 arma::vec total_force(int i);
-
74
-
77 void evolve_RK4(double dt);
-
78
-
81 void evolve_forward_euler(double dt);
-
82
-
83 arma::vec get_particle(int i);
-
84
-
85 double get_d();
-
86};
-
87
-
88#endif
+
20#include "typedefs.hpp"
+
21
+
22#pragma omp declare reduction(+ : vec_3d : omp_out += omp_in) \
+
23 initializer(omp_priv = omp_orig)
+
24
+
30class PenningTrap {
+
31private:
+
32 double B_0;
+
33 std::function<double(double)> V_0;
+
34 double d;
+
35 double t;
+
36 std::vector<Particle> particles;
+
37 sim_arr k_v;
+
39 sim_arr k_r;
+
41
+
52 vec_3d v_func(unsigned int i, unsigned int j, double dt);
+
53
+
64 vec_3d r_func(unsigned int i, unsigned int j, double dt);
+
65
+
66public:
+
74 PenningTrap(
+
75 double B_0 = T,
+
76 std::function<double(double)> V_0 =
+
77 [](double t) { return 25. * V / 1000.; },
+
78 double d = 500., double t = 0.);
+
79
+
88 PenningTrap(
+
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.);
+
93
+
102 PenningTrap(
+
103 std::vector<Particle> particles, double B_0 = T,
+
104 std::function<double(double)> V_0 =
+
105 [](double t) { return 25. * V / 1000.; },
+
106 double d = 500., double t = 0.);
+
107
+
112 void add_particle(Particle particle);
+
113
+
120 vec_3d external_E_field(vec_3d r);
+
121
+
128 vec_3d external_B_field(vec_3d r);
+
129
+
140 vec_3d force_on_particle(unsigned int i, unsigned int j);
+
141
+
151 vec_3d total_force_external(unsigned int i);
+
152
+
159 vec_3d total_force_particles(unsigned int i);
+
160
+
167 vec_3d total_force(unsigned int i);
+
168
+
174 void evolve_RK4(double dt, bool particle_interaction = true);
+
175
+
181 void evolve_forward_euler(double dt, bool particle_interaction = true);
+
182
+
191 sim_arr simulate(double time, unsigned int steps,
+
192 std::string method = "rk4",
+
193 bool particle_interaction = true);
+
194
+
203 void write_simulation_to_dir(std::string path, double time,
+
204 unsigned int steps, std::string method = "rk4",
+
205 bool particle_interaction = true);
+
206
+
217 double fraction_of_particles_left(double time, unsigned int steps,
+
218 std::string method = "rk4",
+
219 bool particle_interaction = true);
+
220};
+
221
+
222#endif
Particle.hpp
A class that holds the properties of a particle.
-
Particle
A class that holds attributes of a particle.
Definition: Particle.hpp:19
-
PenningTrap
A class that simulates a Penning trap.
Definition: PenningTrap.hpp:29
-
PenningTrap::particles
std::vector< Particle > particles
The particles in the Penning trap.
Definition: PenningTrap.hpp:34
-
PenningTrap::total_force_external
arma::vec total_force_external(int i)
Calculate the total external force on a particle.
Definition: PenningTrap.cpp:65
-
PenningTrap::B_0
double B_0
Magnetic field strength.
Definition: PenningTrap.hpp:31
-
PenningTrap::total_force_particles
arma::vec total_force_particles(int i)
Calculate the total force on a particle from other particles.
Definition: PenningTrap.cpp:80
-
PenningTrap::external_B_field
arma::vec external_B_field(arma::vec r)
Calculate B at point r.
Definition: PenningTrap.cpp:43
-
PenningTrap::force_on_particle
arma::vec force_on_particle(int i, int j)
Calculate the force between 2 particles.
Definition: PenningTrap.cpp:50
-
PenningTrap::evolve_forward_euler
void evolve_forward_euler(double dt)
Go forward one timestep using the forward Euler method.
Definition: PenningTrap.cpp:167
-
PenningTrap::d
double d
Characteristic dimension.
Definition: PenningTrap.hpp:33
-
PenningTrap::add_particle
void add_particle(Particle particle)
Add a particle to the system.
Definition: PenningTrap.cpp:27
-
PenningTrap::V_0
double V_0
Applied potential.
Definition: PenningTrap.hpp:32
-
PenningTrap::total_force
arma::vec total_force(int i)
calculate the total force on a particle.
Definition: PenningTrap.cpp:99
-
PenningTrap::external_E_field
arma::vec external_E_field(arma::vec r)
Calculate E at point r.
Definition: PenningTrap.cpp:32
-
PenningTrap::evolve_RK4
void evolve_RK4(double dt)
Go forward one timestep using the RK4 method.
Definition: PenningTrap.cpp:104
+
Particle
A class that holds attributes of a particle.
Definition: Particle.hpp:21
+
PenningTrap
A class that simulates a Penning trap.
Definition: PenningTrap.hpp:30
+
PenningTrap::particles
std::vector< Particle > particles
The particles in the Penning trap.
Definition: PenningTrap.hpp:36
+
PenningTrap::fraction_of_particles_left
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...
Definition: PenningTrap.cpp:266
+
PenningTrap::B_0
double B_0
Magnetic field strength.
Definition: PenningTrap.hpp:32
+
PenningTrap::external_E_field
vec_3d external_E_field(vec_3d r)
Calculate E at point r.
Definition: PenningTrap.cpp:87
+
PenningTrap::total_force
vec_3d total_force(unsigned int i)
calculate the total force on a particle p_i.
Definition: PenningTrap.cpp:146
+
PenningTrap::k_r
sim_arr k_r
Definition: PenningTrap.hpp:39
+
PenningTrap::evolve_RK4
void evolve_RK4(double dt, bool particle_interaction=true)
Go forward one timestep using the RK4 method.
Definition: PenningTrap.cpp:151
+
PenningTrap::r_func
vec_3d r_func(unsigned int i, unsigned int j, double dt)
Helper for evolve_RK4 when calculating values.
Definition: PenningTrap.cpp:64
+
PenningTrap::total_force_particles
vec_3d total_force_particles(unsigned int i)
Calculate the total force on a particle p_i from other particles.
Definition: PenningTrap.cpp:129
+
PenningTrap::simulate
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.
Definition: PenningTrap.cpp:211
+
PenningTrap::d
double d
Characteristic dimension.
Definition: PenningTrap.hpp:34
+
PenningTrap::add_particle
void add_particle(Particle particle)
Add a particle to the system.
Definition: PenningTrap.cpp:82
+
PenningTrap::t
double t
Current time.
Definition: PenningTrap.hpp:35
+
PenningTrap::force_on_particle
vec_3d force_on_particle(unsigned int i, unsigned int j)
Calculate the force between 2 particles.
Definition: PenningTrap.cpp:100
+
PenningTrap::V_0
std::function< double(double)> V_0
Applied potential.
Definition: PenningTrap.hpp:33
+
PenningTrap::evolve_forward_euler
void evolve_forward_euler(double dt, bool particle_interaction=true)
Go forward one timestep using the forward Euler method.
Definition: PenningTrap.cpp:186
+
PenningTrap::write_simulation_to_dir
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.
Definition: PenningTrap.cpp:240
+
PenningTrap::external_B_field
vec_3d external_B_field(vec_3d r)
Calculate B at point r.
Definition: PenningTrap.cpp:95
+
PenningTrap::total_force_external
vec_3d total_force_external(unsigned int i)
Calculate the total external force on a particle.
Definition: PenningTrap.cpp:114
+
PenningTrap::k_v
sim_arr k_v
Definition: PenningTrap.hpp:37
+
PenningTrap::v_func
vec_3d v_func(unsigned int i, unsigned int j, double dt)
Helper for evolve_RK4 when calculating values.
Definition: PenningTrap.cpp:46
constants.hpp
Library of constants.
T
#define T
1 Tesla. unit:
Definition: constants.hpp:17
V
#define V
1 Volt. unit:
Definition: constants.hpp:19
+
typedefs.hpp
Useful typedefs for cleaner code.
+
vec_3d
arma::vec::fixed< 3 > vec_3d
Typedef for a fixed 3d arma vector.
Definition: typedefs.hpp:36
+
sim_arr
std::vector< sim_cols > sim_arr
Typedef for the result of the simulate method.
Definition: typedefs.hpp:32
diff --git a/docs/animate__100__particles_8py_source.html b/docs/animate__100__particles_8py_source.html index 80feb43..af734ca 100644 --- a/docs/animate__100__particles_8py_source.html +++ b/docs/animate__100__particles_8py_source.html @@ -103,68 +103,75 @@ $(document).ready(function(){initNavTree('animate__100__particles_8py_source.htm
1import matplotlib.pyplot as plt
2import numpy as np
-
3from mpl_toolkits.mplot3d import Axes3D
-
4from matplotlib import animation
+
3from matplotlib import animation
+
4from mpl_toolkits.mplot3d import Axes3D
5
-
6def get_data(files):
-
7 res = []
-
8 for file in files:
-
9 arr = [[], [], []]
-
10 with open(file, encoding="utf8") as f:
-
11 lines = f.readlines()
-
12
-
13 for line in lines:
-
14 xi,yi,zi = map(float, line.strip().split(","))
-
15 arr[0].append(xi)
-
16 arr[1].append(yi)
-
17 arr[2].append(zi)
-
18 res.append(arr)
-
19
-
20 return np.array(res)
-
21
-
22def update(num, lines, arr):
-
23 for line, a in zip(lines, arr):
-
24 line.set_data(a[:2, num])
-
25 line.set_3d_properties(a[2, num])
-
26
-
27
+
6
+
7def get_data(files):
+
8 res = []
+
9 for file in files:
+
10 arr = [[], [], []]
+
11 with open(file, encoding="utf8") as f:
+
12 lines = f.readlines()
+
13
+
14 for line in lines:
+
15 xi, yi, zi = map(float, line.strip().split(","))
+
16 arr[0].append(xi)
+
17 arr[1].append(yi)
+
18 arr[2].append(zi)
+
19 res.append(arr)
+
20
+
21 return np.array(res)
+
22
+
23
+
24def update(num, lines, arr):
+
25 for line, a in zip(lines, arr):
+
26 line.set_data(a[:2, num - 1 : num])
+
27 line.set_3d_properties(a[2, num])
28
-
29def animate():
-
30 plt.style.use("dark_background")
-
31 fig = plt.figure()
-
32 ax = fig.add_subplot(projection="3d")
-
33
+
29
+
30def animate():
+
31 plt.style.use("dark_background")
+
32 fig = plt.figure()
+
33 ax = fig.add_subplot(projection="3d")
34
-
35 arr = get_data([f"output/p{i}_RK4.txt" for i in range(100)])
+
35 arr = get_data([f"output/simulate_100_particles/particle_{i}.txt" for i in range(100)])
36
-
37 arr = arr[:,:,::10]
+
37 arr = arr[:, :, ::10]
38
39 N = len(arr[0][0])
40
-
41 lines = [ax.plot(*a[:,1], "o")[0] for a in arr]
+
41 lines = [ax.plot(*a[:, 1], "o")[0] for a in arr]
42
-
43 ax.set_xlim3d([-500.0, 500.0])
-
44 ax.set_xlabel('X')
-
45
-
46 ax.set_ylim3d([-500.0, 500.0])
-
47 ax.set_ylabel('Y')
-
48
-
49 ax.set_zlim3d([-500.0, 500.0])
-
50 ax.set_zlabel('Z')
-
51
-
52 ani = animation.FuncAnimation(fig, update, N, fargs=(lines, arr),
-
53 interval=1,
-
54 blit=False)
+
43 ax.set_title("100 particles inside a Penning trap")
+
44 plt.figtext(
+
45 0.5,
+
46 0.01,
+
47 "100 randomly generated particles "
+
48 "evolving over a time of 50 microseconds.",
+
49 fontsize=12,
+
50 horizontalalignment="center",
+
51 )
+
52
+
53 ax.set_xlim3d([-500.0, 500.0])
+
54 ax.set_xlabel("X (micrometers)")
55
-
56
-
57 ani.save("100_particles.gif", writer=animation.FFMpegFileWriter(fps=30))
-
58 plt.show()
-
59
-
60
-
61if __name__ == "__main__":
-
62 animate()
-
63
-
64
+
56 ax.set_ylim3d([-500.0, 500.0])
+
57 ax.set_ylabel("Y (micrometers)")
+
58
+
59 ax.set_zlim3d([-500.0, 500.0])
+
60 ax.set_zlabel("Z (micrometers)")
+
61
+
62 ani = animation.FuncAnimation(
+
63 fig, update, N, fargs=(lines, arr), interval=1, blit=False
+
64 )
+
65
+
66 # ani.save("../images/100_particles.gif", writer=animation.FFMpegFileWriter(fps=50))
+
67 plt.show()
+
68
+
69
+
70if __name__ == "__main__":
+
71 animate()
diff --git a/docs/bug.html b/docs/bug.html index bbcbbea..8ed5241 100644 --- a/docs/bug.html +++ b/docs/bug.html @@ -105,21 +105,23 @@ $(document).ready(function(){initNavTree('bug.html',''); initResizable(); });
File constants.hpp
No known bugs
File main.cpp
-
No known bugs
+
No known bugs
File Particle.cpp
-
No known bugs
+
No known bugs
File Particle.hpp
No known bugs
File PenningTrap.cpp
-
No known bugs
+
No known bugs
File PenningTrap.hpp
No known bugs
File test_suite.cpp
-
No known bugs
-
File utils.cpp
No known bugs
+
File typedefs.hpp
+
No known bugs
+
File utils.cpp
+
No known bugs
File utils.hpp
-
No known bugs
+
No known bugs
diff --git a/docs/classParticle-members.html b/docs/classParticle-members.html index 02f2b23..b3fc92b 100644 --- a/docs/classParticle-members.html +++ b/docs/classParticle-members.html @@ -105,11 +105,11 @@ $(document).ready(function(){initNavTree('classParticle.html',''); initResizable

This is the complete list of members for Particle, including all inherited members.

- + - - + +
mParticleprivate
Particle(double q, double m, arma::vec::fixed< 3 > r_vec, arma::vec::fixed< 3 > v_vec)Particle
Particle(double q, double m, vec_3d r_vec, vec_3d v_vec)Particle
PenningTrapParticlefriend
qParticleprivate
r_vecParticleprivate
v_vecParticleprivate
r_vecParticleprivate
v_vecParticleprivate
diff --git a/docs/classParticle.html b/docs/classParticle.html index 997eb37..271a213 100644 --- a/docs/classParticle.html +++ b/docs/classParticle.html @@ -114,9 +114,9 @@ $(document).ready(function(){initNavTree('classParticle.html',''); initResizable - - - + + +

Public Member Functions

 Particle (double q, double m, arma::vec::fixed< 3 > r_vec, arma::vec::fixed< 3 > v_vec)
 Initialize the particle.
 
 Particle (double q, double m, vec_3d r_vec, vec_3d v_vec)
 Initialize the particle.
 
@@ -126,12 +126,12 @@ Private Attributes - - - - - - + + + + + +

Private Attributes

double m
 Mass.
 
arma::vec::fixed< 3 > r_vec
 position
 
arma::vec::fixed< 3 > v_vec
 velocity
 
vec_3d r_vec
 position
 
vec_3d v_vec
 velocity
 
@@ -142,10 +142,10 @@ Friends

Detailed Description

A class that holds attributes of a particle.

-

Definition at line 19 of file Particle.hpp.

+

Definition at line 21 of file Particle.hpp.

Constructor & Destructor Documentation

- -

◆ Particle()

+ +

◆ Particle()

@@ -165,13 +165,13 @@ Friends
- + - + @@ -183,9 +183,18 @@ Friends

Initialize the particle.

-

Initialize the particle with a charge, mass, position and velocity.

+

Initialize the particle with a charge, mass, position and velocity.

+
Parameters
+

Friends

arma::vec::fixed< 3 > vec_3d  r_vec,
arma::vec::fixed< 3 > vec_3d  v_vec 
+ + + + +
qThe charge of the particle
mThe mass of the particle
r_vecThe initial position of the particle
v_vecThe initial velocity of the particle
+ + -

Definition at line 16 of file Particle.cpp.

+

Definition at line 15 of file Particle.cpp.

@@ -212,7 +221,7 @@ Friends

Make private attributes available for PenningTrap.

-

Definition at line 38 of file Particle.hpp.

+

Definition at line 43 of file Particle.hpp.

@@ -239,7 +248,7 @@ Friends

Mass.

-

Definition at line 22 of file Particle.hpp.

+

Definition at line 24 of file Particle.hpp.

@@ -265,12 +274,12 @@ Friends

Charge.

-

Definition at line 21 of file Particle.hpp.

+

Definition at line 23 of file Particle.hpp.

- -

◆ r_vec

+ +

◆ r_vec

@@ -279,7 +288,7 @@ Friends - +
arma::vec::fixed<3> Particle::r_vecvec_3d Particle::r_vec
@@ -291,12 +300,12 @@ Friends

position

-

Definition at line 23 of file Particle.hpp.

+

Definition at line 25 of file Particle.hpp.

- -

◆ v_vec

+ +

◆ v_vec

@@ -305,7 +314,7 @@ Friends - +
arma::vec::fixed<3> Particle::v_vecvec_3d Particle::v_vec
@@ -317,7 +326,7 @@ Friends

velocity

-

Definition at line 24 of file Particle.hpp.

+

Definition at line 26 of file Particle.hpp.

diff --git a/docs/classParticle.js b/docs/classParticle.js index 113132c..71255c1 100644 --- a/docs/classParticle.js +++ b/docs/classParticle.js @@ -1,9 +1,9 @@ var classParticle = [ - [ "Particle", "classParticle.html#a00e108823877a25513ccae7cac011b4c", null ], + [ "Particle", "classParticle.html#a7af9f8d1fef63dd7643b06629ac7bef4", null ], [ "PenningTrap", "classParticle.html#aa797d319549dc2a0beb06cdbfd430232", null ], [ "m", "classParticle.html#aedcc7e1bc53b0e2b1a4a07c9a1b47563", null ], [ "q", "classParticle.html#a566dcc1de4bdc01251776948798ea8e1", null ], - [ "r_vec", "classParticle.html#acf1a0f3c978b06d76df5bb4279594467", null ], - [ "v_vec", "classParticle.html#a4a5d22c7aeca66f67d083f270cba25df", null ] + [ "r_vec", "classParticle.html#af9497cd8f2dcad0fad54f571ddb383e6", null ], + [ "v_vec", "classParticle.html#a879692772803d6ab65fa4993b54aea6e", null ] ]; \ No newline at end of file diff --git a/docs/classPenningTrap-members.html b/docs/classPenningTrap-members.html index 5a26d52..859c052 100644 --- a/docs/classPenningTrap-members.html +++ b/docs/classPenningTrap-members.html @@ -107,19 +107,27 @@ $(document).ready(function(){initNavTree('classPenningTrap.html',''); initResiza add_particle(Particle particle)PenningTrap B_0PenningTrapprivate dPenningTrapprivate - evolve_forward_euler(double dt)PenningTrap - evolve_RK4(double dt)PenningTrap - external_B_field(arma::vec r)PenningTrap - external_E_field(arma::vec r)PenningTrap - force_on_particle(int i, int j)PenningTrap - get_d() (defined in PenningTrap)PenningTrap - get_particle(int i) (defined in PenningTrap)PenningTrap - particlesPenningTrapprivate - PenningTrap(double B_0=T, double V_0=25.*V/1000., double d=500.)PenningTrap - total_force(int i)PenningTrap - total_force_external(int i)PenningTrap - total_force_particles(int i)PenningTrap - V_0PenningTrapprivate + evolve_forward_euler(double dt, bool particle_interaction=true)PenningTrap + evolve_RK4(double dt, bool particle_interaction=true)PenningTrap + external_B_field(vec_3d r)PenningTrap + 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 + k_rPenningTrapprivate + k_vPenningTrapprivate + particlesPenningTrapprivate + PenningTrap(double B_0=T, std::function< double(double)> V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)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.)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)PenningTrapprivate + simulate(double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)PenningTrap + tPenningTrapprivate + total_force(unsigned int i)PenningTrap + total_force_external(unsigned int i)PenningTrap + total_force_particles(unsigned int i)PenningTrap + V_0PenningTrapprivate + v_func(unsigned int i, unsigned int j, double dt)PenningTrapprivate + write_simulation_to_dir(std::string path, double time, unsigned int steps, std::string method="rk4", bool particle_interaction=true)PenningTrap diff --git a/docs/classPenningTrap.html b/docs/classPenningTrap.html index af62e25..9afb617 100644 --- a/docs/classPenningTrap.html +++ b/docs/classPenningTrap.html @@ -100,6 +100,7 @@ $(document).ready(function(){initNavTree('classPenningTrap.html',''); initResiza
Public Member Functions | +Private Member Functions | Private Attributes | List of all members
PenningTrap Class Reference
@@ -113,64 +114,91 @@ $(document).ready(function(){initNavTree('classPenningTrap.html',''); initResiza - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

 PenningTrap (double B_0=T, double V_0=25.*V/1000., double d=500.)
 Set B_0, V_0 and d.
 
 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.
 
 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.)
 Constructor for the PenningTrap class.
 
 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.)
 Constructor for the PenningTrap class.
 
void add_particle (Particle particle)
 Add a particle to the system.
 
arma::vec external_E_field (arma::vec r)
 Calculate E at point r.
 
arma::vec external_B_field (arma::vec r)
 Calculate B at point r.
 
arma::vec force_on_particle (int i, int j)
 Calculate the force between 2 particles.
 
arma::vec total_force_external (int i)
 Calculate the total external force on a particle.
 
arma::vec total_force_particles (int i)
 Calculate the total force on a particle from other particles.
 
arma::vec total_force (int i)
 calculate the total force on a particle.
 
void evolve_RK4 (double dt)
 Go forward one timestep using the RK4 method.
 
void evolve_forward_euler (double dt)
 Go forward one timestep using the forward Euler method.
 
arma::vec get_particle (int i)
 
double get_d ()
 
vec_3d external_E_field (vec_3d r)
 Calculate E at point r.
 
vec_3d external_B_field (vec_3d r)
 Calculate B at point r.
 
vec_3d force_on_particle (unsigned int i, unsigned int j)
 Calculate the force between 2 particles.
 
vec_3d total_force_external (unsigned int i)
 Calculate the total external force on a particle.
 
vec_3d total_force_particles (unsigned int i)
 Calculate the total force on a particle p_i from other particles.
 
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.
 
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.
 
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.
 
+ + + + + + +

+Private Member Functions

vec_3d v_func (unsigned int i, unsigned int j, double dt)
 Helper for evolve_RK4 when calculating \(k_{v,i,j}\) values.
 
vec_3d r_func (unsigned int i, unsigned int j, double dt)
 Helper for evolve_RK4 when calculating \(k_{r,i,j}\) values.
 
- - - + + + + + + + + + +

Private Attributes

double B_0
 Magnetic field strength.
 
double V_0
 Applied potential.
 
std::function< double(double)> V_0
 Applied potential.
 
double d
 Characteristic dimension.
 
double t
 Current time.
 
std::vector< Particleparticles
 The particles in the Penning trap.
 
sim_arr k_v
 
sim_arr k_r
 

Detailed Description

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 29 of file PenningTrap.hpp.

+

Definition at line 30 of file PenningTrap.hpp.

Constructor & Destructor Documentation

- -

◆ PenningTrap()

+ +

◆ PenningTrap() [1/3]

@@ -184,14 +212,20 @@ Private Attributes - double  - V_0 = 25.*V/1000., + std::function< double(double)>  + V_0 = [](double t) { return 25. * V / 1000.; }, double  - d = 500.  + d = 500., + + + + + double  + t = 0.  @@ -201,9 +235,138 @@ Private Attributes
-

Set B_0, V_0 and d.

+

Constructor for the PenningTrap class.

+
Parameters
+ + + + + +
B_0The magnetic field strength
V_0The time dependent applied potential
dThe characteristic dimension
tThe starting time
+
+
-

Definition at line 20 of file PenningTrap.cpp.

+

Definition at line 18 of file PenningTrap.cpp.

+ +
+
+ +

◆ PenningTrap() [2/3]

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
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. 
)
+
+ +

Constructor for the PenningTrap class.

+
Parameters
+ + + + + + +
iThe number of particles to generate
B_0The magnetic field strength
V_0The time dependent applied potential
dThe characteristic dimension
tThe starting time
+
+
+ +

Definition at line 27 of file PenningTrap.cpp.

+ +
+
+ +

◆ PenningTrap() [3/3]

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PenningTrap::PenningTrap (std::vector< Particleparticles,
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.

+
Parameters
+ + + + + + +
particlesThe starting particles
B_0The magnetic field strength
V_0The time dependent applied potential
dThe characteristic dimension
tThe starting time
+
+
+ +

Definition at line 39 of file PenningTrap.cpp.

@@ -225,13 +388,19 @@ Private Attributes

Add a particle to the system.

+
Parameters
+ + +
particleThe particle to add to the Penning trap
+
+
-

Definition at line 27 of file PenningTrap.cpp.

+

Definition at line 82 of file PenningTrap.cpp.

- -

◆ evolve_forward_euler()

+ +

◆ evolve_forward_euler()

@@ -240,20 +409,37 @@ Private Attributes void PenningTrap::evolve_forward_euler ( double  - dt) + dt, + + + + bool  + particle_interaction = true  + + + + ) +

Go forward one timestep using the forward Euler method.

+
Parameters
+ + + +
dtThe step length
particle_interactionTurn particle interactions on/off
+
+
-

Definition at line 167 of file PenningTrap.cpp.

+

Definition at line 186 of file PenningTrap.cpp.

- -

◆ evolve_RK4()

+ +

◆ evolve_RK4()

@@ -262,28 +448,45 @@ Private Attributes void PenningTrap::evolve_RK4 ( double  - dt) + dt, + + + + bool  + particle_interaction = true  + + + + ) +

Go forward one timestep using the RK4 method.

+
Parameters
+ + + +
dtThe step length
particle_interactionTurn particle interactions on/off
+
+
-

Definition at line 104 of file PenningTrap.cpp.

+

Definition at line 151 of file PenningTrap.cpp.

- -

◆ external_B_field()

+ +

◆ external_B_field()

- + - + @@ -291,21 +494,28 @@ Private Attributes

Calculate B at point r.

+
Parameters
+
arma::vec PenningTrap::external_B_field vec_3d PenningTrap::external_B_field (arma::vec vec_3d  r)
+ +
rThe position where we want to calculate the B field
+ + +
Returns
vec_3d
-

Definition at line 43 of file PenningTrap.cpp.

+

Definition at line 95 of file PenningTrap.cpp.

- -

◆ external_E_field()

+ +

◆ external_E_field()

- + - + @@ -313,27 +523,34 @@ Private Attributes

Calculate E at point r.

+
Parameters
+
arma::vec PenningTrap::external_E_field vec_3d PenningTrap::external_E_field (arma::vec vec_3d  r)
+ +
rThe position where we want to calculate the E field
+ + +
Returns
vec_3d
-

Definition at line 32 of file PenningTrap.cpp.

+

Definition at line 87 of file PenningTrap.cpp.

- -

◆ force_on_particle()

+ +

◆ force_on_particle()

- + - + - + @@ -345,83 +562,222 @@ Private Attributes

Calculate the force between 2 particles.

-

Calculate the force exhibited on particle p_i from particle p_j.

+

Calculate the force exhibited on particle p_i from particle p_j.

+
Parameters
+
arma::vec PenningTrap::force_on_particle vec_3d PenningTrap::force_on_particle (int unsigned int  i,
int unsigned int  j 
+ + +
iThe index of particle p_i
jThe index of particle p_j
+ + +
Returns
vec_3d
-

Definition at line 50 of file PenningTrap.cpp.

+

Definition at line 100 of file PenningTrap.cpp.

- -

◆ get_d()

+ +

◆ fraction_of_particles_left()

- + - + + + + + + + + + + + + + + + + + + + + + + + +
double PenningTrap::get_d double PenningTrap::fraction_of_particles_left ()double time,
unsigned int steps,
std::string method = "rk4",
bool particle_interaction = true 
)
-

Definition at line 188 of file PenningTrap.cpp.

+

Simulate and calculate what fraction of particles are still left inside the Penning trap after the simulation.

+
Parameters
+ + + + + +
timeThe time to simulate in microseconds
stepsThe amount of steps for the whole simulation
methodThe method to use when moving forward a timestep
particle_interactionTurn particle interactions on/off
+
+
+
Returns
double
+ +

Definition at line 266 of file PenningTrap.cpp.

- -

◆ get_particle()

+ +

◆ r_func()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
vec_3d PenningTrap::r_func (unsigned int i,
unsigned int j,
double dt 
)
+
+private
+
+ +

Helper for evolve_RK4 when calculating \(k_{r,i,j}\) values.

+

Something

+
Parameters
+ + + + +
iIndex i for \(k_{r,i,j}\)
jIndex j for \(k_{r,i,j}\)
dtthe step length (delta time)
+
+
+
Returns
vec_3d
+ +

Definition at line 64 of file PenningTrap.cpp.

+ +
+
+ +

◆ simulate()

- + - + + + + + + + + + + + + + + + + + + + + + + + + + + +
arma::vec PenningTrap::get_particle sim_arr PenningTrap::simulate (int 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.

+
Parameters
+ + + + + +
timeThe time to simulate in microseconds
stepsThe amount of steps for the whole simulation
methodThe method to use when moving forward a timestep
particle_interactionTurn particle interactions on/off
+
+
+ +

Definition at line 211 of file PenningTrap.cpp.

+ +
+
+ +

◆ total_force()

+ +
+
+ + + + +
vec_3d PenningTrap::total_force (unsigned int  i)
-

Definition at line 183 of file PenningTrap.cpp.

+

calculate the total force on a particle p_i.

+
Parameters
+ + +
iThe index of particle p_i
+
+
+
Returns
vec_3d
+ +

Definition at line 146 of file PenningTrap.cpp.

- -

◆ total_force()

+ +

◆ total_force_external()

- + - - - - -
arma::vec PenningTrap::total_force vec_3d PenningTrap::total_force_external (int i)
-
- -

calculate the total force on a particle.

- -

Definition at line 99 of file PenningTrap.cpp.

- -
-
- -

◆ total_force_external()

- -
-
- - - - - + @@ -429,31 +785,161 @@ Private Attributes

Calculate the total external force on a particle.

-

Calculate the total amount of force that E and B exhibits on particle p_i.

+

Calculate the total amount of force that E and B exhibits on particle p_i.

+
Parameters
+
arma::vec PenningTrap::total_force_external (int unsigned int  i)
+ +
iThe index of particle p_i
+ + +
Returns
vec_3d
-

Definition at line 65 of file PenningTrap.cpp.

+

Definition at line 114 of file PenningTrap.cpp.

- -

◆ total_force_particles()

+ +

◆ total_force_particles()

- + - +
arma::vec PenningTrap::total_force_particles vec_3d PenningTrap::total_force_particles (int unsigned int  i)
-

Calculate the total force on a particle from other particles.

+

Calculate the total force on a particle p_i from other particles.

+
Parameters
+ + +
iThe index of particle p_i
+
+
+
Returns
vec_3d
-

Definition at line 80 of file PenningTrap.cpp.

+

Definition at line 129 of file PenningTrap.cpp.

+ +
+
+ +

◆ v_func()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
vec_3d PenningTrap::v_func (unsigned int i,
unsigned int j,
double dt 
)
+
+private
+
+ +

Helper for evolve_RK4 when calculating \(k_{v,i,j}\) values.

+

Something

+
Parameters
+ + + + +
iIndex i for \(k_{v,i,j}\)
jIndex j for \(k_{v,i,j}\)
dtthe step length (delta time)
+
+
+
Returns
vec_3d
+ +

Definition at line 46 of file PenningTrap.cpp.

+ +
+
+ +

◆ write_simulation_to_dir()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void PenningTrap::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.

+
Parameters
+ + + + + + +
pathThe directory to save the data
timeThe time to simulate in microseconds
stepsThe amount of steps for the whole simulation
methodThe method to use when moving forward a timestep
particle_interactionTurn particle interactions on/off
+
+
+ +

Definition at line 240 of file PenningTrap.cpp.

@@ -480,7 +966,7 @@ Private Attributes

Magnetic field strength.

-

Definition at line 31 of file PenningTrap.hpp.

+

Definition at line 32 of file PenningTrap.hpp.

@@ -506,7 +992,57 @@ Private Attributes

Characteristic dimension.

-

Definition at line 33 of file PenningTrap.hpp.

+

Definition at line 34 of file PenningTrap.hpp.

+ + + + +

◆ k_r

+ +
+
+ + + + + +
+ + + + +
sim_arr PenningTrap::k_r
+
+private
+
+

A 2D vector containing all \(k_{i,j}\) where \(j\) is the index of a particle

+ +

Definition at line 39 of file PenningTrap.hpp.

+ +
+
+ +

◆ k_v

+ +
+
+ + + + + +
+ + + + +
sim_arr PenningTrap::k_v
+
+private
+
+

A 2D vector containing all \(k_{i,j}\) where \(j\) is the index of a particle

+ +

Definition at line 37 of file PenningTrap.hpp.

@@ -532,12 +1068,12 @@ Private Attributes

The particles in the Penning trap.

-

Definition at line 34 of file PenningTrap.hpp.

+

Definition at line 36 of file PenningTrap.hpp.

- -

◆ V_0

+ +

◆ t

@@ -546,7 +1082,33 @@ Private Attributes - + + +
double PenningTrap::V_0double PenningTrap::t
+ + +private + + +
+ +

Current time.

+ +

Definition at line 35 of file PenningTrap.hpp.

+ +
+
+ +

◆ V_0

+ +
+
+ + + @@ -558,7 +1120,7 @@ Private Attributes

Applied potential.

-

Definition at line 32 of file PenningTrap.hpp.

+

Definition at line 33 of file PenningTrap.hpp.

diff --git a/docs/classPenningTrap.js b/docs/classPenningTrap.js index 743d3ea..0fd7f36 100644 --- a/docs/classPenningTrap.js +++ b/docs/classPenningTrap.js @@ -1,17 +1,27 @@ var classPenningTrap = [ - [ "PenningTrap", "classPenningTrap.html#a81add5063bd5f29d77f0b5c299c6c560", null ], + [ "PenningTrap", "classPenningTrap.html#ae670d7de621acdb343b01af098086f63", null ], + [ "PenningTrap", "classPenningTrap.html#a763700316b502d5900e587c1f61e6bf1", null ], + [ "PenningTrap", "classPenningTrap.html#a67139e04ef69c0bcffde8f30f67cbf73", null ], [ "add_particle", "classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8", null ], - [ "evolve_forward_euler", "classPenningTrap.html#a56544b6f4befb42984e9650cf2a40965", null ], - [ "evolve_RK4", "classPenningTrap.html#ab891b839c40eeb38d8a2a636c70090a9", null ], - [ "external_B_field", "classPenningTrap.html#a2a3e7f480ba52e9f24d4c50c3981a784", null ], - [ "external_E_field", "classPenningTrap.html#a978a2e2026a4b5308d5184712f81704b", null ], - [ "force_on_particle", "classPenningTrap.html#a4790f41e4fbc6ede4991aa7bbda92182", null ], - [ "total_force", "classPenningTrap.html#a83cc7a04dae009ed8e75453c38fdf8be", null ], - [ "total_force_external", "classPenningTrap.html#a045adb85e97a8e0c38fb36d2fd74eeee", null ], - [ "total_force_particles", "classPenningTrap.html#a135db7d991d9b88b00fde4edee71f78d", null ], + [ "evolve_forward_euler", "classPenningTrap.html#ab9ea97a406534bbe621a95215144875e", null ], + [ "evolve_RK4", "classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e", null ], + [ "external_B_field", "classPenningTrap.html#acbf065c9c125682329ad82a8d166554c", null ], + [ "external_E_field", "classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9", null ], + [ "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 ], + [ "total_force", "classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8", null ], + [ "total_force_external", "classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56", null ], + [ "total_force_particles", "classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b", null ], + [ "v_func", "classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e", null ], + [ "write_simulation_to_dir", "classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57", null ], [ "B_0", "classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716", null ], [ "d", "classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2", null ], + [ "k_r", "classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640", null ], + [ "k_v", "classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4", null ], [ "particles", "classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f", null ], - [ "V_0", "classPenningTrap.html#a715329844d75ec4c04f8391421fb4e89", null ] + [ "t", "classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e", null ], + [ "V_0", "classPenningTrap.html#aaf105828121c4a33cc2b217453c20317", null ] ]; \ No newline at end of file diff --git a/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.html b/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.html index 81efd6b..4313bbd 100644 --- a/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.html +++ b/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.html @@ -115,6 +115,8 @@ Files + + diff --git a/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.js b/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.js index 13a8a58..64ce7a5 100644 --- a/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.js +++ b/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.js @@ -4,6 +4,7 @@ var dir_68267d1309a1af8e8297ef4c3efbcdba = [ "main.cpp", "main_8cpp.html", null ], [ "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/dir_d44c64559bbebec7f509842c48db8b23.html b/docs/dir_d44c64559bbebec7f509842c48db8b23.html index 21e883c..289eee3 100644 --- a/docs/dir_d44c64559bbebec7f509842c48db8b23.html +++ b/docs/dir_d44c64559bbebec7f509842c48db8b23.html @@ -113,6 +113,9 @@ Files + + + diff --git a/docs/dir_d44c64559bbebec7f509842c48db8b23.js b/docs/dir_d44c64559bbebec7f509842c48db8b23.js index 48feb88..192eaa8 100644 --- a/docs/dir_d44c64559bbebec7f509842c48db8b23.js +++ b/docs/dir_d44c64559bbebec7f509842c48db8b23.js @@ -3,5 +3,6 @@ var dir_d44c64559bbebec7f509842c48db8b23 = [ "constants.hpp", "constants_8hpp.html", "constants_8hpp" ], [ "Particle.hpp", "Particle_8hpp.html", "Particle_8hpp" ], [ "PenningTrap.hpp", "PenningTrap_8hpp.html", "PenningTrap_8hpp" ], + [ "typedefs.hpp", "typedefs_8hpp.html", "typedefs_8hpp" ], [ "utils.hpp", "utils_8hpp.html", "utils_8hpp" ] ]; \ No newline at end of file diff --git a/docs/files.html b/docs/files.html index b07cc8d..e842a47 100644 --- a/docs/files.html +++ b/docs/files.html @@ -107,14 +107,16 @@ $(document).ready(function(){initNavTree('files.html',''); initResizable(); }); - - - - - - - - + + + + + + + + + +
+ + +
std::function<double(double)> PenningTrap::V_0
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.
 
file  PenningTrap.hpp [code]
 A class for simulating a Penning trap.
 
file  typedefs.hpp [code]
 Useful typedefs for cleaner code.
 
file  utils.hpp [code]
 Function prototypes and macros that are useful.
 
 constants.hppLibrary of constants
 Particle.hppA class that holds the properties of a particle
 PenningTrap.hppA class for simulating a Penning trap
 utils.hppFunction prototypes and macros that are useful
  src
 animate_100_particles.py
 main.cppThe main program for this project
 Particle.cppThe implementation of the Particle class
 PenningTrap.cppThe implementation of the PenningTrap class
 test_suite.cppThe test suite for the project
 utils.cppImplementation of the utils
 typedefs.hppUseful typedefs for cleaner code
 utils.hppFunction prototypes and macros that are useful
  src
 animate_100_particles.py
 main.cppThe main program for this project
 Particle.cppThe implementation of the Particle class
 PenningTrap.cppThe implementation of the PenningTrap class
 plot_particles_left.py
 test_suite.cppThe test suite for the project
 utils.cppImplementation of the utils
diff --git a/docs/functions.html b/docs/functions.html index eb473bb..a2f04ea 100644 --- a/docs/functions.html +++ b/docs/functions.html @@ -102,22 +102,30 @@ $(document).ready(function(){initNavTree('functions.html',''); initResizable();
  • add_particle() : PenningTrap
  • B_0 : PenningTrap
  • d : PenningTrap
  • -
  • evolve_forward_euler() : PenningTrap
  • -
  • evolve_RK4() : PenningTrap
  • -
  • external_B_field() : PenningTrap
  • -
  • external_E_field() : PenningTrap
  • -
  • force_on_particle() : PenningTrap
  • +
  • evolve_forward_euler() : PenningTrap
  • +
  • evolve_RK4() : PenningTrap
  • +
  • external_B_field() : PenningTrap
  • +
  • external_E_field() : PenningTrap
  • +
  • force_on_particle() : PenningTrap
  • +
  • fraction_of_particles_left() : PenningTrap
  • +
  • k_r : PenningTrap
  • +
  • k_v : PenningTrap
  • m : Particle
  • -
  • Particle() : Particle
  • +
  • Particle() : Particle
  • particles : PenningTrap
  • -
  • PenningTrap : Particle, PenningTrap
  • +
  • PenningTrap : Particle, PenningTrap
  • q : Particle
  • -
  • r_vec : Particle
  • -
  • total_force() : PenningTrap
  • -
  • total_force_external() : PenningTrap
  • -
  • total_force_particles() : PenningTrap
  • -
  • V_0 : PenningTrap
  • -
  • v_vec : Particle
  • +
  • r_func() : PenningTrap
  • +
  • r_vec : Particle
  • +
  • simulate() : PenningTrap
  • +
  • t : PenningTrap
  • +
  • total_force() : PenningTrap
  • +
  • total_force_external() : PenningTrap
  • +
  • total_force_particles() : PenningTrap
  • +
  • V_0 : PenningTrap
  • +
  • v_func() : PenningTrap
  • +
  • v_vec : Particle
  • +
  • write_simulation_to_dir() : PenningTrap
  • diff --git a/docs/functions_func.html b/docs/functions_func.html index 4a36dd3..1182b1d 100644 --- a/docs/functions_func.html +++ b/docs/functions_func.html @@ -100,16 +100,21 @@ $(document).ready(function(){initNavTree('functions_func.html',''); initResizabl
     
    diff --git a/docs/functions_vars.html b/docs/functions_vars.html index 8c0729a..3ca2e5b 100644 --- a/docs/functions_vars.html +++ b/docs/functions_vars.html @@ -101,12 +101,15 @@ $(document).ready(function(){initNavTree('functions_vars.html',''); initResizabl   diff --git a/docs/globals.html b/docs/globals.html index 9107eef..19a9638 100644 --- a/docs/globals.html +++ b/docs/globals.html @@ -99,14 +99,20 @@ $(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_defs.html b/docs/globals_defs.html index 332fce0..c7eb483 100644 --- a/docs/globals_defs.html +++ b/docs/globals_defs.html @@ -99,6 +99,7 @@ $(document).ready(function(){initNavTree('globals_defs.html',''); initResizable(
     
    diff --git a/docs/globals_type.html b/docs/globals_type.html new file mode 100644 index 0000000..b7735cc --- /dev/null +++ b/docs/globals_type.html @@ -0,0 +1,116 @@ + + + + + + + +Penning Trap Simulation: File Members + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Penning Trap Simulation +
    +
    Simulate particle behavior inside a Penning Trap
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    +
    +
    + + + + diff --git a/docs/main_8cpp.html b/docs/main_8cpp.html index 5e67722..b83f224 100644 --- a/docs/main_8cpp.html +++ b/docs/main_8cpp.html @@ -100,17 +100,22 @@ $(document).ready(function(){initNavTree('main_8cpp.html',''); initResizable();
    Macros | -Functions
    +Functions | +Variables
    main.cpp File Reference

    The main program for this project. More...

    -
    #include <fstream>
    +
    #include <cmath>
    +#include <fstream>
    #include <omp.h>
    +#include <string>
    #include <sys/stat.h>
    +#include <vector>
    #include "PenningTrap.hpp"
    +#include "utils.hpp"

    Go to the source code of this file.

    @@ -127,10 +132,27 @@ Macros
    + + + + + + + + +

    Functions

    void simulate_single_particle ()
     
    void simulate_two_particles ()
     
    void simulate_single_particle_with_different_steps ()
     
    void simulate_100_particles ()
     
    void simulate_100_particles_with_time_potential ()
     
    int main ()
     
    + + + + +

    +Variables

    +Particle p1 (CHARGE, MASS, vec_3d{20., 0., 20.}, vec_3d{0., 25., 0.})
     
    +Particle p2 (CHARGE, MASS, vec_3d{25., 25., 0.}, vec_3d{0., 40., 5.})
     

    Detailed Description

    The main program for this project.

    @@ -138,7 +160,7 @@ Functions
    Janita Ovidie Sandtrøen Willumsen (janitaws)
    Version
    0.1
    -
    Bug:
    No known bugs
    +
    Bug:
    No known bugs

    Definition in file main.cpp.

    Macro Definition Documentation

    @@ -154,7 +176,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
    -

    Definition at line 21 of file main.cpp.

    +

    Definition at line 25 of file main.cpp.

    @@ -170,7 +192,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
    -

    Definition at line 22 of file main.cpp.

    +

    Definition at line 26 of file main.cpp.

    @@ -186,7 +208,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
    -

    Definition at line 20 of file main.cpp.

    +

    Definition at line 24 of file main.cpp.

    @@ -202,7 +224,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
    -

    Definition at line 19 of file main.cpp.

    +

    Definition at line 23 of file main.cpp.

    @@ -222,7 +244,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
    -

    Definition at line 77 of file main.cpp.

    +

    Definition at line 124 of file main.cpp.

    @@ -241,7 +263,83 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
    -

    Definition at line 24 of file main.cpp.

    +

    Definition at line 77 of file main.cpp.

    + +
    + + +

    ◆ simulate_100_particles_with_time_potential()

    + +
    +
    + + + + + + + +
    void simulate_100_particles_with_time_potential ()
    +
    + +

    Definition at line 91 of file main.cpp.

    + +
    +
    + +

    ◆ simulate_single_particle()

    + +
    +
    + + + + + + + +
    void simulate_single_particle ()
    +
    + +

    Definition at line 31 of file main.cpp.

    + +
    +
    + +

    ◆ simulate_single_particle_with_different_steps()

    + +
    +
    + + + + + + + +
    void simulate_single_particle_with_different_steps ()
    +
    + +

    Definition at line 55 of file main.cpp.

    + +
    +
    + +

    ◆ simulate_two_particles()

    + +
    +
    + + + + + + + +
    void simulate_two_particles ()
    +
    + +

    Definition at line 42 of file main.cpp.

    diff --git a/docs/main_8cpp_source.html b/docs/main_8cpp_source.html index 5542b5a..d437689 100644 --- a/docs/main_8cpp_source.html +++ b/docs/main_8cpp_source.html @@ -102,87 +102,149 @@ $(document).ready(function(){initNavTree('main_8cpp_source.html',''); initResiza
    Go to the documentation of this file.
    1
    -
    13#include <fstream>
    -
    14#include <omp.h>
    -
    15#include <sys/stat.h>
    -
    16
    -
    17#include "PenningTrap.hpp"
    -
    18
    -
    19#define PARTICLES 100
    -
    20#define N 10000
    -
    21#define CHARGE 1.
    -
    22#define MASS 40. // unit: amu
    -
    23
    -
    24void simulate_100_particles()
    -
    25{
    -
    26 PenningTrap trap;
    +
    13#include <cmath>
    +
    14#include <fstream>
    +
    15#include <omp.h>
    +
    16#include <string>
    +
    17#include <sys/stat.h>
    +
    18#include <vector>
    +
    19
    +
    20#include "PenningTrap.hpp"
    +
    21#include "utils.hpp"
    +
    22
    +
    23#define PARTICLES 100
    +
    24#define N 10000
    +
    25#define CHARGE 1.
    +
    26#define MASS 40. // unit: amu
    27
    -
    28 // Add particles inside trap
    -
    29 for (int i = 0; i < PARTICLES; i++) {
    -
    30 arma::vec r = arma::vec(3).randn() * 0.1 *
    -
    31 trap.get_d(); // random initial position
    -
    32 arma::vec v = arma::vec(3).randn() * 0.1 *
    -
    33 trap.get_d(); // random initial velocity
    -
    34 trap.add_particle(Particle(CHARGE, MASS, r, v));
    -
    35 }
    -
    36
    -
    37 double time = 50.; // microseconds
    -
    38 double dt = time / (double)N;
    -
    39
    -
    40 auto res = new arma::vec::fixed<3>[PARTICLES][N];
    +
    28Particle p1(CHARGE, MASS, vec_3d{20., 0., 20.}, vec_3d{0., 25., 0.});
    +
    29Particle p2(CHARGE, MASS, vec_3d{25., 25., 0.}, vec_3d{0., 40., 5.});
    +
    30
    +
    31void simulate_single_particle()
    +
    32{
    +
    33 DEBUG("Inside single particle sim");
    +
    34 PenningTrap trap(std::vector<Particle>{p1});
    +
    35
    +
    36 double time = 50.; // microseconds
    +
    37
    +
    38 DEBUG("Write to dir");
    +
    39 trap.write_simulation_to_dir("output/simulate_single_particle", time, N);
    +
    40}
    41
    -
    42 int counter = 0;
    -
    43
    -
    44 // Get the path of all particles
    -
    45 for (int j = 0; j < N; j++) {
    -
    46#pragma omp parallel for
    -
    47 for (int i = 0; i < PARTICLES; i++) {
    -
    48 res[i][j] = trap.get_particle(i);
    -
    49 }
    -
    50 trap.evolve_RK4(dt);
    -
    51 }
    -
    52
    -
    53 std::cout << counter << std::endl;
    +
    42void simulate_two_particles()
    +
    43{
    +
    44 PenningTrap trap_no_interaction(std::vector<Particle>{p1, p2});
    +
    45 PenningTrap trap_with_interaction(std::vector<Particle>{p1, p2});
    +
    46
    +
    47 double time = 50.; // microseconds
    +
    48
    +
    49 trap_no_interaction.write_simulation_to_dir(
    +
    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);
    +
    53}
    54
    -
    55 arma::vec::fixed<3> *cur_row;
    -
    56 arma::vec::fixed<3> cur_elem;
    +
    55void simulate_single_particle_with_different_steps()
    +
    56{
    57
    -
    58 mkdir("output", 0777);
    -
    59 mkdir("output/simulate_100_particles", 0777);
    -
    60
    -
    61 std::ofstream ofile;
    -
    62
    -
    63// Write particle paths to file
    -
    64#pragma omp parallel for private(cur_row, cur_elem, ofile)
    -
    65 for (int i = 0; i < PARTICLES; i++) {
    -
    66 cur_row = res[i];
    -
    67 ofile.open("output/simulate_100_particles/p" + std::to_string(i) + ".txt");
    -
    68 for (int j = 0; j < N; j++) {
    -
    69 cur_elem = cur_row[j];
    -
    70 ofile << cur_elem(0) << "," << cur_elem(1) << "," << cur_elem(2)
    -
    71 << "\n";
    -
    72 }
    -
    73 ofile.close();
    +
    58 double time = 50; // microseconds
    +
    59
    +
    60 for (int i = 0; i < 4; i++) {
    +
    61 int steps = 4000 * (i + 1);
    +
    62 PenningTrap trap(std::vector<Particle>{p1});
    +
    63 trap.write_simulation_to_dir("output/N_steps/RK4/" +
    +
    64 std::to_string(steps) + "_steps",
    +
    65 time, steps, "rk4", false);
    +
    66 }
    +
    67
    +
    68 for (int i = 0; i < 4; i++) {
    +
    69 int steps = 4000 * (i + 1);
    +
    70 PenningTrap trap(std::vector<Particle>{p1});
    +
    71 trap.write_simulation_to_dir("output/N_steps/euler/" +
    +
    72 std::to_string(steps) + "_steps",
    +
    73 time, steps, "euler", false);
    74 }
    75}
    76
    -
    77int main()
    +
    77void simulate_100_particles()
    78{
    -
    79 double start = omp_get_wtime();
    -
    80
    -
    81 simulate_100_particles();
    -
    82
    -
    83 double end = omp_get_wtime();
    -
    84
    -
    85 std::cout << "Time: " << end - start << " seconds" << std::endl;
    -
    86
    -
    87 return 0;
    -
    88}
    +
    79 PenningTrap trap((unsigned)100, T,
    +
    80 [](double t) {
    +
    81 return 25. * V / 1000. *
    +
    82 (1. + .4 * std::cos(1.5 * t));
    +
    83 },
    +
    84 500., 0);
    +
    85
    +
    86 double time = 500.; // microseconds
    +
    87
    +
    88 trap.write_simulation_to_dir("output/simulate_100_particles", time, N*5);
    +
    89}
    +
    90
    +
    91void simulate_100_particles_with_time_potential()
    +
    92{
    +
    93 double amplitudes[]{.1, .4, .7};
    +
    94
    +
    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);
    +
    99
    +
    100 std::string path = "output/time_dependent_potential/";
    +
    101 mkpath(path);
    +
    102
    +
    103 std::ofstream ofile;
    +
    104
    +
    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;
    +
    110 PenningTrap trap((unsigned)100, T,
    +
    111 [f, freq](double t) {
    +
    112 return (25. * V / 1000.) *
    +
    113 (1. + f * std::cos(freq * t));
    +
    114 },
    +
    115 500., 0.);
    +
    116 double res = trap.fraction_of_particles_left(500., 40000, "rk4", true);
    +
    117 #pragma omp ordered
    +
    118 ofile << freq << "," << res << "\n";
    +
    119 }
    +
    120 ofile.close();
    +
    121 }
    +
    122}
    +
    123
    +
    124int main()
    +
    125{
    +
    126
    +
    127 simulate_single_particle();
    +
    128
    +
    129 simulate_two_particles();
    +
    130
    +
    131 simulate_single_particle_with_different_steps();
    +
    132
    +
    133 double start = omp_get_wtime();
    +
    134
    +
    135 //simulate_100_particles();
    +
    136
    +
    137 simulate_100_particles_with_time_potential();
    +
    138
    +
    139 double end = omp_get_wtime();
    +
    140
    +
    141 std::cout << "Time: " << end - start << " seconds" << std::endl;
    +
    142
    +
    143 return 0;
    +
    144}
    A class for simulating a Penning trap.
    -
    A class that holds attributes of a particle.
    Definition: Particle.hpp:19
    -
    A class that simulates a Penning trap.
    Definition: PenningTrap.hpp:29
    -
    void add_particle(Particle particle)
    Add a particle to the system.
    Definition: PenningTrap.cpp:27
    -
    void evolve_RK4(double dt)
    Go forward one timestep using the RK4 method.
    +
    A class that holds attributes of a particle.
    Definition: Particle.hpp:21
    +
    A class that simulates a Penning trap.
    Definition: PenningTrap.hpp:30
    +
    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.
    +
    #define T
    1 Tesla. unit:
    Definition: constants.hpp:17
    +
    #define V
    1 Volt. unit:
    Definition: constants.hpp:19
    +
    arma::vec::fixed< 3 > vec_3d
    Typedef for a fixed 3d arma vector.
    Definition: typedefs.hpp:36
    +
    Function prototypes and macros that are useful.
    +
    bool mkpath(std::string path, int mode=0777)
    Make path given.
    Definition: utils.cpp:76
    +
    #define DEBUG(msg)
    Writes a debug message.
    Definition: utils.hpp:36
    diff --git a/docs/menudata.js b/docs/menudata.js index 88ec31f..74c1d7b 100644 --- a/docs/menudata.js +++ b/docs/menudata.js @@ -38,4 +38,5 @@ var menudata={children:[ {text:"File Members",url:"globals.html",children:[ {text:"All",url:"globals.html"}, {text:"Functions",url:"globals_func.html"}, +{text:"Typedefs",url:"globals_type.html"}, {text:"Macros",url:"globals_defs.html"}]}]}]} diff --git a/docs/navtreedata.js b/docs/navtreedata.js index 10ee5ad..9640812 100644 --- a/docs/navtreedata.js +++ b/docs/navtreedata.js @@ -27,7 +27,6 @@ var NAVTREE = [ "Penning Trap Simulation", "index.html", [ [ "Credits", "index.html#autotoc_md1", null ], [ "Bug List", "bug.html", null ], - [ "Todo List", "todo.html", null ], [ "Classes", "annotated.html", [ [ "Class List", "annotated.html", "annotated_dup" ], [ "Class Index", "classes.html", null ], @@ -43,6 +42,7 @@ var NAVTREE = [ "File Members", "globals.html", [ [ "All", "globals.html", null ], [ "Functions", "globals_func.html", null ], + [ "Typedefs", "globals_type.html", null ], [ "Macros", "globals_defs.html", null ] ] ] ] ] diff --git a/docs/navtreeindex0.js b/docs/navtreeindex0.js index 27aef05..16caa0e 100644 --- a/docs/navtreeindex0.js +++ b/docs/navtreeindex0.js @@ -1,75 +1,95 @@ var NAVTREEINDEX0 = { -"Particle_8cpp.html":[4,0,1,2], -"Particle_8cpp_source.html":[4,0,1,2], -"Particle_8hpp.html":[4,0,0,1], -"Particle_8hpp_source.html":[4,0,0,1], -"PenningTrap_8cpp.html":[4,0,1,3], -"PenningTrap_8cpp_source.html":[4,0,1,3], -"PenningTrap_8hpp.html":[4,0,0,2], -"PenningTrap_8hpp_source.html":[4,0,0,2], -"animate__100__particles_8py_source.html":[4,0,1,0], -"annotated.html":[3,0], +"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":[3,0,0], -"classParticle.html#a00e108823877a25513ccae7cac011b4c":[3,0,0,0], -"classParticle.html#a4a5d22c7aeca66f67d083f270cba25df":[3,0,0,5], -"classParticle.html#a566dcc1de4bdc01251776948798ea8e1":[3,0,0,3], -"classParticle.html#aa797d319549dc2a0beb06cdbfd430232":[3,0,0,1], -"classParticle.html#acf1a0f3c978b06d76df5bb4279594467":[3,0,0,4], -"classParticle.html#aedcc7e1bc53b0e2b1a4a07c9a1b47563":[3,0,0,2], -"classPenningTrap.html":[3,0,1], -"classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f":[3,0,1,12], -"classPenningTrap.html#a045adb85e97a8e0c38fb36d2fd74eeee":[3,0,1,8], -"classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716":[3,0,1,10], -"classPenningTrap.html#a135db7d991d9b88b00fde4edee71f78d":[3,0,1,9], -"classPenningTrap.html#a2a3e7f480ba52e9f24d4c50c3981a784":[3,0,1,4], -"classPenningTrap.html#a4790f41e4fbc6ede4991aa7bbda92182":[3,0,1,6], -"classPenningTrap.html#a56544b6f4befb42984e9650cf2a40965":[3,0,1,2], -"classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2":[3,0,1,11], -"classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8":[3,0,1,1], -"classPenningTrap.html#a715329844d75ec4c04f8391421fb4e89":[3,0,1,13], -"classPenningTrap.html#a81add5063bd5f29d77f0b5c299c6c560":[3,0,1,0], -"classPenningTrap.html#a83cc7a04dae009ed8e75453c38fdf8be":[3,0,1,7], -"classPenningTrap.html#a978a2e2026a4b5308d5184712f81704b":[3,0,1,5], -"classPenningTrap.html#ab891b839c40eeb38d8a2a636c70090a9":[3,0,1,3], -"classPenningTrapTest.html":[3,0,2], -"classes.html":[3,1], -"constants_8hpp.html":[4,0,0,0], -"constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5":[4,0,0,0,1], -"constants_8hpp.html#a4e451456ad7e9276ed0afa42826e7ccb":[4,0,0,0,0], -"constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb":[4,0,0,0,2], -"constants_8hpp_source.html":[4,0,0,0], -"dir_68267d1309a1af8e8297ef4c3efbcdba.html":[4,0,1], -"dir_d44c64559bbebec7f509842c48db8b23.html":[4,0,0], -"files.html":[4,0], -"functions.html":[3,2,0], -"functions_func.html":[3,2,1], -"functions_rela.html":[3,2,3], -"functions_vars.html":[3,2,2], -"globals.html":[4,1,0], -"globals_defs.html":[4,1,2], -"globals_func.html":[4,1,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], "index.html":[], "index.html#autotoc_md1":[0], -"main_8cpp.html":[4,0,1,1], -"main_8cpp_source.html":[4,0,1,1], +"main_8cpp.html":[3,0,1,1], +"main_8cpp_source.html":[3,0,1,1], "pages.html":[], -"test__suite_8cpp.html":[4,0,1,4], -"test__suite_8cpp_source.html":[4,0,1,4], -"todo.html":[2], -"utils_8cpp.html":[4,0,1,5], -"utils_8cpp.html#a58565270b643b24e3132f38c653e0199":[4,0,1,5,2], -"utils_8cpp.html#a5d2e1e032fd19614f2fbb58149a7b02a":[4,0,1,5,0], -"utils_8cpp.html#acd2a9c7a7d5a7fe9163be8c4cc110746":[4,0,1,5,3], -"utils_8cpp.html#aff5e07c3c1d321709b0cc38e999f427b":[4,0,1,5,1], -"utils_8cpp_source.html":[4,0,1,5], -"utils_8hpp.html":[4,0,0,3], -"utils_8hpp.html#a0c95c4791692b06f8811905a76dbd772":[4,0,0,3,2], -"utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38":[4,0,0,3,3], -"utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9":[4,0,0,3,0], -"utils_8hpp.html#ad54b96a1074f9df4dc892a41d115b72d":[4,0,0,3,4], -"utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384":[4,0,0,3,5], -"utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b":[4,0,0,3,1], -"utils_8hpp_source.html":[4,0,0,3] +"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] }; diff --git a/docs/pages.html b/docs/pages.html index eb4abe8..a84d908 100644 --- a/docs/pages.html +++ b/docs/pages.html @@ -104,7 +104,6 @@ $(document).ready(function(){initNavTree('pages.html',''); initResizable(); });
    Here is a list of all related documentation pages:
    -
     Bug List
     Todo List
    diff --git a/docs/plot__particles__left_8py_source.html b/docs/plot__particles__left_8py_source.html new file mode 100644 index 0000000..c9ab258 --- /dev/null +++ b/docs/plot__particles__left_8py_source.html @@ -0,0 +1,147 @@ + + + + + + + +Penning Trap Simulation: src/plot_particles_left.py Source File + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Penning Trap Simulation +
    +
    Simulate particle behavior inside a Penning Trap
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    +
    plot_particles_left.py
    +
    +
    +
    1import matplotlib.pyplot as plt
    +
    2
    +
    3def main():
    +
    4 files = [
    +
    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",
    +
    8 ]
    +
    9 vals = [
    +
    10 .1,
    +
    11 .4,
    +
    12 .7
    +
    13 ]
    +
    14 for i in range(3):
    +
    15 with open(files[i]) as f:
    +
    16 lines = f.readlines()
    +
    17 x = []
    +
    18 y = []
    +
    19 for line in lines:
    +
    20 a,b = line.strip().split(",")
    +
    21 x.append(float(a))
    +
    22 y.append(float(b))
    +
    23 plt.plot(x,y,label=f"amplitude: {vals[i]}")
    +
    24
    +
    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")
    +
    29 plt.legend()
    +
    30 plt.show()
    +
    31
    +
    32if __name__ == "__main__":
    +
    33 main()
    +
    +
    + + + + diff --git a/docs/search/all_0.js b/docs/search/all_0.js index 4fc815a..1e5c227 100644 --- a/docs/search/all_0.js +++ b/docs/search/all_0.js @@ -1,6 +1,4 @@ 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']]], - ['assert_2',['ASSERT',['../utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9',1,'utils.hpp']]] + ['_5f_5fmethod_5fname_5f_5f_0',['__METHOD_NAME__',['../utils_8hpp.html#a60dca3177fb9cb5256609adc7af55168',1,'utils.hpp']]] ]; diff --git a/docs/search/all_1.js b/docs/search/all_1.js index 80ed042..4fc815a 100644 --- a/docs/search/all_1.js +++ b/docs/search/all_1.js @@ -1,5 +1,6 @@ var searchData= [ - ['b_5f0_0',['B_0',['../classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716',1,'PenningTrap']]], - ['bug_20list_1',['Bug List',['../bug.html',1,'']]] + ['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']]], + ['assert_2',['ASSERT',['../utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9',1,'utils.hpp']]] ]; diff --git a/docs/search/all_10.js b/docs/search/all_10.js new file mode 100644 index 0000000..1b9fc74 --- /dev/null +++ b/docs/search/all_10.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/all_2.js b/docs/search/all_2.js index 0648f09..80ed042 100644 --- a/docs/search/all_2.js +++ b/docs/search/all_2.js @@ -1,4 +1,5 @@ var searchData= [ - ['constants_2ehpp_0',['constants.hpp',['../constants_8hpp.html',1,'']]] + ['b_5f0_0',['B_0',['../classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716',1,'PenningTrap']]], + ['bug_20list_1',['Bug List',['../bug.html',1,'']]] ]; diff --git a/docs/search/all_3.js b/docs/search/all_3.js index e50dce3..0648f09 100644 --- a/docs/search/all_3.js +++ b/docs/search/all_3.js @@ -1,5 +1,4 @@ var searchData= [ - ['d_0',['d',['../classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2',1,'PenningTrap']]], - ['debug_1',['DEBUG',['../utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b',1,'utils.hpp']]] + ['constants_2ehpp_0',['constants.hpp',['../constants_8hpp.html',1,'']]] ]; diff --git a/docs/search/all_4.js b/docs/search/all_4.js index c031fe4..e50dce3 100644 --- a/docs/search/all_4.js +++ b/docs/search/all_4.js @@ -1,7 +1,5 @@ var searchData= [ - ['evolve_5fforward_5feuler_0',['evolve_forward_euler',['../classPenningTrap.html#a56544b6f4befb42984e9650cf2a40965',1,'PenningTrap']]], - ['evolve_5frk4_1',['evolve_RK4',['../classPenningTrap.html#ab891b839c40eeb38d8a2a636c70090a9',1,'PenningTrap']]], - ['external_5fb_5ffield_2',['external_B_field',['../classPenningTrap.html#a2a3e7f480ba52e9f24d4c50c3981a784',1,'PenningTrap']]], - ['external_5fe_5ffield_3',['external_E_field',['../classPenningTrap.html#a978a2e2026a4b5308d5184712f81704b',1,'PenningTrap']]] + ['d_0',['d',['../classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2',1,'PenningTrap']]], + ['debug_1',['DEBUG',['../utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b',1,'utils.hpp']]] ]; diff --git a/docs/search/all_5.js b/docs/search/all_5.js index ccf47d2..c4c479f 100644 --- a/docs/search/all_5.js +++ b/docs/search/all_5.js @@ -1,4 +1,7 @@ var searchData= [ - ['force_5fon_5fparticle_0',['force_on_particle',['../classPenningTrap.html#a4790f41e4fbc6ede4991aa7bbda92182',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/all_6.js b/docs/search/all_6.js index cb8673f..d1d9acc 100644 --- a/docs/search/all_6.js +++ b/docs/search/all_6.js @@ -1,4 +1,5 @@ var searchData= [ - ['k_5fe_0',['K_E',['../constants_8hpp.html#a4e451456ad7e9276ed0afa42826e7ccb',1,'constants.hpp']]] + ['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/all_7.js b/docs/search/all_7.js index 959abdd..6af262e 100644 --- a/docs/search/all_7.js +++ b/docs/search/all_7.js @@ -1,6 +1,6 @@ var searchData= [ - ['m_0',['m',['../classParticle.html#aedcc7e1bc53b0e2b1a4a07c9a1b47563',1,'Particle']]], - ['m_5fassert_1',['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']]], - ['main_2ecpp_2',['main.cpp',['../main_8cpp.html',1,'']]] + ['k_5fe_0',['K_E',['../constants_8hpp.html#a4e451456ad7e9276ed0afa42826e7ccb',1,'constants.hpp']]], + ['k_5fr_1',['k_r',['../classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640',1,'PenningTrap']]], + ['k_5fv_2',['k_v',['../classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4',1,'PenningTrap']]] ]; diff --git a/docs/search/all_8.js b/docs/search/all_8.js index 3ec818e..d86b301 100644 --- a/docs/search/all_8.js +++ b/docs/search/all_8.js @@ -1,12 +1,7 @@ var searchData= [ - ['particle_0',['Particle',['../classParticle.html',1,'Particle'],['../classParticle.html#a00e108823877a25513ccae7cac011b4c',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#a81add5063bd5f29d77f0b5c299c6c560',1,'PenningTrap::PenningTrap()']]], - ['penningtrap_2ecpp_6',['PenningTrap.cpp',['../PenningTrap_8cpp.html',1,'']]], - ['penningtrap_2ehpp_7',['PenningTrap.hpp',['../PenningTrap_8hpp.html',1,'']]], - ['penningtraptest_8',['PenningTrapTest',['../classPenningTrapTest.html',1,'']]] + ['m_0',['m',['../classParticle.html#aedcc7e1bc53b0e2b1a4a07c9a1b47563',1,'Particle']]], + ['m_5fassert_1',['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']]], + ['main_2ecpp_2',['main.cpp',['../main_8cpp.html',1,'']]], + ['mkpath_3',['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/all_9.js b/docs/search/all_9.js index a43f9bc..962dfef 100644 --- a/docs/search/all_9.js +++ b/docs/search/all_9.js @@ -1,4 +1,12 @@ var searchData= [ - ['q_0',['q',['../classParticle.html#a566dcc1de4bdc01251776948798ea8e1',1,'Particle']]] + ['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,'']]] ]; diff --git a/docs/search/all_a.js b/docs/search/all_a.js index b78ca6a..a43f9bc 100644 --- a/docs/search/all_a.js +++ b/docs/search/all_a.js @@ -1,4 +1,4 @@ var searchData= [ - ['r_5fvec_0',['r_vec',['../classParticle.html#acf1a0f3c978b06d76df5bb4279594467',1,'Particle']]] + ['q_0',['q',['../classParticle.html#a566dcc1de4bdc01251776948798ea8e1',1,'Particle']]] ]; diff --git a/docs/search/all_b.js b/docs/search/all_b.js index bf61385..fb8b113 100644 --- a/docs/search/all_b.js +++ b/docs/search/all_b.js @@ -1,4 +1,5 @@ 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']]] + ['r_5ffunc_0',['r_func',['../classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648',1,'PenningTrap']]], + ['r_5fvec_1',['r_vec',['../classParticle.html#af9497cd8f2dcad0fad54f571ddb383e6',1,'Particle']]] ]; diff --git a/docs/search/all_c.js b/docs/search/all_c.js index 89cf6c6..f0c09d2 100644 --- a/docs/search/all_c.js +++ b/docs/search/all_c.js @@ -1,9 +1,8 @@ var searchData= [ - ['t_0',['T',['../constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5',1,'constants.hpp']]], - ['test_5fsuite_2ecpp_1',['test_suite.cpp',['../test__suite_8cpp.html',1,'']]], - ['todo_20list_2',['Todo List',['../todo.html',1,'']]], - ['total_5fforce_3',['total_force',['../classPenningTrap.html#a83cc7a04dae009ed8e75453c38fdf8be',1,'PenningTrap']]], - ['total_5fforce_5fexternal_4',['total_force_external',['../classPenningTrap.html#a045adb85e97a8e0c38fb36d2fd74eeee',1,'PenningTrap']]], - ['total_5fforce_5fparticles_5',['total_force_particles',['../classPenningTrap.html#a135db7d991d9b88b00fde4edee71f78d',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']]], + ['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']]] ]; diff --git a/docs/search/all_d.js b/docs/search/all_d.js index cd921db..c04457d 100644 --- a/docs/search/all_d.js +++ b/docs/search/all_d.js @@ -1,5 +1,10 @@ var searchData= [ - ['utils_2ecpp_0',['utils.cpp',['../utils_8cpp.html',1,'']]], - ['utils_2ehpp_1',['utils.hpp',['../utils_8hpp.html',1,'']]] + ['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,'']]] ]; diff --git a/docs/search/all_e.js b/docs/search/all_e.js index b447fa7..cd921db 100644 --- a/docs/search/all_e.js +++ b/docs/search/all_e.js @@ -1,6 +1,5 @@ var searchData= [ - ['v_0',['V',['../constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb',1,'constants.hpp']]], - ['v_5f0_1',['V_0',['../classPenningTrap.html#a715329844d75ec4c04f8391421fb4e89',1,'PenningTrap']]], - ['v_5fvec_2',['v_vec',['../classParticle.html#a4a5d22c7aeca66f67d083f270cba25df',1,'Particle']]] + ['utils_2ecpp_0',['utils.cpp',['../utils_8cpp.html',1,'']]], + ['utils_2ehpp_1',['utils.hpp',['../utils_8hpp.html',1,'']]] ]; diff --git a/docs/search/all_f.js b/docs/search/all_f.js new file mode 100644 index 0000000..bb9c0eb --- /dev/null +++ b/docs/search/all_f.js @@ -0,0 +1,8 @@ +var searchData= +[ + ['v_0',['V',['../constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb',1,'constants.hpp']]], + ['v_5f0_1',['V_0',['../classPenningTrap.html#aaf105828121c4a33cc2b217453c20317',1,'PenningTrap']]], + ['v_5ffunc_2',['v_func',['../classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e',1,'PenningTrap']]], + ['v_5fvec_3',['v_vec',['../classParticle.html#a879692772803d6ab65fa4993b54aea6e',1,'Particle']]], + ['vec_5f3d_4',['vec_3d',['../typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df',1,'typedefs.hpp']]] +]; diff --git a/docs/search/defines_0.js b/docs/search/defines_0.js index 97ce9d9..1e5c227 100644 --- a/docs/search/defines_0.js +++ b/docs/search/defines_0.js @@ -1,4 +1,4 @@ var searchData= [ - ['assert_0',['ASSERT',['../utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9',1,'utils.hpp']]] + ['_5f_5fmethod_5fname_5f_5f_0',['__METHOD_NAME__',['../utils_8hpp.html#a60dca3177fb9cb5256609adc7af55168',1,'utils.hpp']]] ]; diff --git a/docs/search/defines_1.js b/docs/search/defines_1.js index c6466cb..97ce9d9 100644 --- a/docs/search/defines_1.js +++ b/docs/search/defines_1.js @@ -1,4 +1,4 @@ var searchData= [ - ['debug_0',['DEBUG',['../utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b',1,'utils.hpp']]] + ['assert_0',['ASSERT',['../utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9',1,'utils.hpp']]] ]; diff --git a/docs/search/defines_2.js b/docs/search/defines_2.js index cb8673f..c6466cb 100644 --- a/docs/search/defines_2.js +++ b/docs/search/defines_2.js @@ -1,4 +1,4 @@ var searchData= [ - ['k_5fe_0',['K_E',['../constants_8hpp.html#a4e451456ad7e9276ed0afa42826e7ccb',1,'constants.hpp']]] + ['debug_0',['DEBUG',['../utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b',1,'utils.hpp']]] ]; diff --git a/docs/search/defines_3.js b/docs/search/defines_3.js index 6eef01f..cb8673f 100644 --- a/docs/search/defines_3.js +++ b/docs/search/defines_3.js @@ -1,4 +1,4 @@ var searchData= [ - ['t_0',['T',['../constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5',1,'constants.hpp']]] + ['k_5fe_0',['K_E',['../constants_8hpp.html#a4e451456ad7e9276ed0afa42826e7ccb',1,'constants.hpp']]] ]; diff --git a/docs/search/defines_4.js b/docs/search/defines_4.js index 06f433f..6eef01f 100644 --- a/docs/search/defines_4.js +++ b/docs/search/defines_4.js @@ -1,4 +1,4 @@ var searchData= [ - ['v_0',['V',['../constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb',1,'constants.hpp']]] + ['t_0',['T',['../constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5',1,'constants.hpp']]] ]; diff --git a/docs/search/defines_5.js b/docs/search/defines_5.js new file mode 100644 index 0000000..06f433f --- /dev/null +++ b/docs/search/defines_5.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['v_0',['V',['../constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb',1,'constants.hpp']]] +]; diff --git a/docs/search/files_3.js b/docs/search/files_3.js index 1ca9264..5e3fea9 100644 --- a/docs/search/files_3.js +++ b/docs/search/files_3.js @@ -1,4 +1,5 @@ var searchData= [ - ['test_5fsuite_2ecpp_0',['test_suite.cpp',['../test__suite_8cpp.html',1,'']]] + ['test_5fsuite_2ecpp_0',['test_suite.cpp',['../test__suite_8cpp.html',1,'']]], + ['typedefs_2ehpp_1',['typedefs.hpp',['../typedefs_8hpp.html',1,'']]] ]; diff --git a/docs/search/functions_1.js b/docs/search/functions_1.js index c031fe4..c4c479f 100644 --- a/docs/search/functions_1.js +++ b/docs/search/functions_1.js @@ -1,7 +1,7 @@ var searchData= [ - ['evolve_5fforward_5feuler_0',['evolve_forward_euler',['../classPenningTrap.html#a56544b6f4befb42984e9650cf2a40965',1,'PenningTrap']]], - ['evolve_5frk4_1',['evolve_RK4',['../classPenningTrap.html#ab891b839c40eeb38d8a2a636c70090a9',1,'PenningTrap']]], - ['external_5fb_5ffield_2',['external_B_field',['../classPenningTrap.html#a2a3e7f480ba52e9f24d4c50c3981a784',1,'PenningTrap']]], - ['external_5fe_5ffield_3',['external_E_field',['../classPenningTrap.html#a978a2e2026a4b5308d5184712f81704b',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_2.js b/docs/search/functions_2.js index ccf47d2..d1d9acc 100644 --- a/docs/search/functions_2.js +++ b/docs/search/functions_2.js @@ -1,4 +1,5 @@ var searchData= [ - ['force_5fon_5fparticle_0',['force_on_particle',['../classPenningTrap.html#a4790f41e4fbc6ede4991aa7bbda92182',1,'PenningTrap']]] + ['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_3.js b/docs/search/functions_3.js index 30ce46b..ffb26d6 100644 --- a/docs/search/functions_3.js +++ b/docs/search/functions_3.js @@ -1,4 +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']]] + ['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_4.js b/docs/search/functions_4.js index 2dc79c5..852716e 100644 --- a/docs/search/functions_4.js +++ b/docs/search/functions_4.js @@ -1,5 +1,5 @@ var searchData= [ - ['particle_0',['Particle',['../classParticle.html#a00e108823877a25513ccae7cac011b4c',1,'Particle']]], - ['penningtrap_1',['PenningTrap',['../classPenningTrap.html#a81add5063bd5f29d77f0b5c299c6c560',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_5.js b/docs/search/functions_5.js index bf61385..07b3041 100644 --- a/docs/search/functions_5.js +++ b/docs/search/functions_5.js @@ -1,4 +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']]] + ['r_5ffunc_0',['r_func',['../classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648',1,'PenningTrap']]] ]; diff --git a/docs/search/functions_6.js b/docs/search/functions_6.js index 83f26c2..a7b65b4 100644 --- a/docs/search/functions_6.js +++ b/docs/search/functions_6.js @@ -1,6 +1,5 @@ var searchData= [ - ['total_5fforce_0',['total_force',['../classPenningTrap.html#a83cc7a04dae009ed8e75453c38fdf8be',1,'PenningTrap']]], - ['total_5fforce_5fexternal_1',['total_force_external',['../classPenningTrap.html#a045adb85e97a8e0c38fb36d2fd74eeee',1,'PenningTrap']]], - ['total_5fforce_5fparticles_2',['total_force_particles',['../classPenningTrap.html#a135db7d991d9b88b00fde4edee71f78d',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#a5331837e6dd7bce807a99edd2ba7e854',1,'PenningTrap']]] ]; diff --git a/docs/search/functions_7.js b/docs/search/functions_7.js new file mode 100644 index 0000000..73e1881 --- /dev/null +++ b/docs/search/functions_7.js @@ -0,0 +1,6 @@ +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']]] +]; diff --git a/docs/search/functions_8.js b/docs/search/functions_8.js new file mode 100644 index 0000000..8d7b6ff --- /dev/null +++ b/docs/search/functions_8.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['v_5ffunc_0',['v_func',['../classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e',1,'PenningTrap']]] +]; diff --git a/docs/search/functions_9.js b/docs/search/functions_9.js new file mode 100644 index 0000000..1b9fc74 --- /dev/null +++ b/docs/search/functions_9.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 906104d..4d47bbf 100644 --- a/docs/search/searchdata.js +++ b/docs/search/searchdata.js @@ -1,13 +1,14 @@ var indexSectionsWithContent = { - 0: "abcdefkmpqrstuv", + 0: "_abcdefkmpqrstuvw", 1: "p", 2: "cmptu", - 3: "aefmpst", - 4: "bdmpqrv", - 5: "p", - 6: "adktv", - 7: "bpt" + 3: "aefmprstvw", + 4: "bdkmpqrtv", + 5: "sv", + 6: "p", + 7: "_adktv", + 8: "bp" }; var indexSectionNames = @@ -17,9 +18,10 @@ var indexSectionNames = 2: "files", 3: "functions", 4: "variables", - 5: "related", - 6: "defines", - 7: "pages" + 5: "typedefs", + 6: "related", + 7: "defines", + 8: "pages" }; var indexSectionLabels = @@ -29,8 +31,9 @@ var indexSectionLabels = 2: "Files", 3: "Functions", 4: "Variables", - 5: "Friends", - 6: "Macros", - 7: "Pages" + 5: "Typedefs", + 6: "Friends", + 7: "Macros", + 8: "Pages" }; diff --git a/docs/search/typedefs_0.js b/docs/search/typedefs_0.js new file mode 100644 index 0000000..e79ff95 --- /dev/null +++ b/docs/search/typedefs_0.js @@ -0,0 +1,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']]] +]; diff --git a/docs/search/typedefs_1.js b/docs/search/typedefs_1.js new file mode 100644 index 0000000..fe88abf --- /dev/null +++ b/docs/search/typedefs_1.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['vec_5f3d_0',['vec_3d',['../typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df',1,'typedefs.hpp']]] +]; diff --git a/docs/search/variables_2.js b/docs/search/variables_2.js index 8411aec..7ff6c24 100644 --- a/docs/search/variables_2.js +++ b/docs/search/variables_2.js @@ -1,4 +1,5 @@ var searchData= [ - ['m_0',['m',['../classParticle.html#aedcc7e1bc53b0e2b1a4a07c9a1b47563',1,'Particle']]] + ['k_5fr_0',['k_r',['../classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640',1,'PenningTrap']]], + ['k_5fv_1',['k_v',['../classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4',1,'PenningTrap']]] ]; diff --git a/docs/search/variables_3.js b/docs/search/variables_3.js index c9f603d..8411aec 100644 --- a/docs/search/variables_3.js +++ b/docs/search/variables_3.js @@ -1,4 +1,4 @@ var searchData= [ - ['particles_0',['particles',['../classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f',1,'PenningTrap']]] + ['m_0',['m',['../classParticle.html#aedcc7e1bc53b0e2b1a4a07c9a1b47563',1,'Particle']]] ]; diff --git a/docs/search/variables_4.js b/docs/search/variables_4.js index a43f9bc..c9f603d 100644 --- a/docs/search/variables_4.js +++ b/docs/search/variables_4.js @@ -1,4 +1,4 @@ var searchData= [ - ['q_0',['q',['../classParticle.html#a566dcc1de4bdc01251776948798ea8e1',1,'Particle']]] + ['particles_0',['particles',['../classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f',1,'PenningTrap']]] ]; diff --git a/docs/search/variables_5.js b/docs/search/variables_5.js index b78ca6a..a43f9bc 100644 --- a/docs/search/variables_5.js +++ b/docs/search/variables_5.js @@ -1,4 +1,4 @@ var searchData= [ - ['r_5fvec_0',['r_vec',['../classParticle.html#acf1a0f3c978b06d76df5bb4279594467',1,'Particle']]] + ['q_0',['q',['../classParticle.html#a566dcc1de4bdc01251776948798ea8e1',1,'Particle']]] ]; diff --git a/docs/search/variables_6.js b/docs/search/variables_6.js index 01f3a29..fa44d82 100644 --- a/docs/search/variables_6.js +++ b/docs/search/variables_6.js @@ -1,5 +1,4 @@ var searchData= [ - ['v_5f0_0',['V_0',['../classPenningTrap.html#a715329844d75ec4c04f8391421fb4e89',1,'PenningTrap']]], - ['v_5fvec_1',['v_vec',['../classParticle.html#a4a5d22c7aeca66f67d083f270cba25df',1,'Particle']]] + ['r_5fvec_0',['r_vec',['../classParticle.html#af9497cd8f2dcad0fad54f571ddb383e6',1,'Particle']]] ]; diff --git a/docs/search/variables_7.js b/docs/search/variables_7.js new file mode 100644 index 0000000..c7c5d99 --- /dev/null +++ b/docs/search/variables_7.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['t_0',['t',['../classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e',1,'PenningTrap']]] +]; diff --git a/docs/search/variables_8.js b/docs/search/variables_8.js new file mode 100644 index 0000000..601b41d --- /dev/null +++ b/docs/search/variables_8.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['v_5f0_0',['V_0',['../classPenningTrap.html#aaf105828121c4a33cc2b217453c20317',1,'PenningTrap']]], + ['v_5fvec_1',['v_vec',['../classParticle.html#a879692772803d6ab65fa4993b54aea6e',1,'Particle']]] +]; diff --git a/docs/test__suite_8cpp.html b/docs/test__suite_8cpp.html index 787939b..7c69921 100644 --- a/docs/test__suite_8cpp.html +++ b/docs/test__suite_8cpp.html @@ -131,7 +131,7 @@ Functions
    Janita Ovidie Sandtrøen Willumsen (janitaws)
    Version
    0.1
    -
    Bug:
    No known bugs
    +
    Bug:
    No known bugs

    Definition in file test_suite.cpp.

    Function Documentation

    diff --git a/docs/test__suite_8cpp_source.html b/docs/test__suite_8cpp_source.html index 3fab92c..b317c82 100644 --- a/docs/test__suite_8cpp_source.html +++ b/docs/test__suite_8cpp_source.html @@ -136,9 +136,9 @@ $(document).ready(function(){initNavTree('test__suite_8cpp_source.html',''); ini
    44 arma::vec result;
    45 arma::vec v;
    46 std::stringstream msg;
    -
    47 for (int i = 0; i < tests.size(); i++) {
    +
    47 for (size_t i = 0; i < tests.size(); i++) {
    48 v = tests.at(i).first;
    -
    49 result = trap.external_E_field(v);
    +
    49 result = trap.external_E_field(v);
    50
    51 msg.str("");
    52 msg << "Testing the external E field at (" << std::setprecision(2)
    @@ -154,7 +154,7 @@ $(document).ready(function(){initNavTree('test__suite_8cpp_source.html',''); ini
    62 // on position.
    63 PenningTrap trap;
    64 arma::vec expected{0., 0., T};
    -
    65 arma::vec result = trap.external_B_field(arma::vec{0., 0., 0.});
    +
    65 arma::vec result = trap.external_B_field(arma::vec{0., 0., 0.});
    66 ASSERT(arma_vector_close_to(expected, result),
    67 "Testing the external B field at (0,0,0)");
    68 }
    @@ -171,14 +171,14 @@ $(document).ready(function(){initNavTree('test__suite_8cpp_source.html',''); ini
    79
    80 // Test p0 and p1
    81 arma::vec expected{-1., 0., 0.};
    -
    82 arma::vec result = trap.force_on_particle(0, 1);
    +
    82 arma::vec result = trap.force_on_particle(0, 1);
    83 ASSERT(arma_vector_close_to(expected, result),
    84 "Testing the force on a particle at (0,0,0) from a "
    85 "particle at (1,0,0).");
    86
    87 // Test p0 and p2
    88 expected = arma::vec{0, -.024, -.032};
    -
    89 result = trap.force_on_particle(0, 2);
    +
    89 result = trap.force_on_particle(0, 2);
    90 ASSERT(arma_vector_close_to(expected, result),
    91 "Testing the force on a particle at (0,0,0) from a "
    92 "particle at (0,3,4).");
    @@ -191,7 +191,7 @@ $(document).ready(function(){initNavTree('test__suite_8cpp_source.html',''); ini
    99 Particle(1., 40., arma::vec{1., 2., 3.}, arma::vec{3., 4., 5.}));
    100
    101 arma::vec expected{395.58954878, -270.15871624, -57.89115348};
    -
    102 arma::vec result = trap.total_force_external(0);
    +
    102 arma::vec result = trap.total_force_external(0);
    103 ASSERT(arma_vector_close_to(expected, result),
    104 "Testing the total external force on a particle at "
    105 "(1,2,3) with velocity (3,4,5)");
    @@ -204,7 +204,7 @@ $(document).ready(function(){initNavTree('test__suite_8cpp_source.html',''); ini
    112 Particle(1., 40., arma::vec{0., 0., 0.}, arma::vec{0., 0., 0.}));
    113
    114 arma::vec expected{0., 0., 0.};
    -
    115 arma::vec result = trap.total_force_particles(0);
    +
    115 arma::vec result = trap.total_force_particles(0);
    116 ASSERT(arma_vector_close_to(expected, result),
    117 "Testing the total force of all particles on particle 0 "
    118 "with only a single particle");
    @@ -217,7 +217,7 @@ $(document).ready(function(){initNavTree('test__suite_8cpp_source.html',''); ini
    125 Particle(1., 40., arma::vec{0., 0., 1.}, arma::vec{0., 0., 0.}));
    126
    127 expected = arma::vec(3, arma::fill::value(-3473.383325));
    -
    128 result = trap.total_force_particles(0);
    +
    128 result = trap.total_force_particles(0);
    129 ASSERT(arma_vector_close_to(expected, result),
    130 "Testing the total force of all particles on particle 0 "
    131 "with 3 other particles.");
    @@ -234,18 +234,18 @@ $(document).ready(function(){initNavTree('test__suite_8cpp_source.html',''); ini
    142 return 0;
    143}
    PenningTrap.hpp
    A class for simulating a Penning trap.
    -
    Particle
    A class that holds attributes of a particle.
    Definition: Particle.hpp:19
    +
    Particle
    A class that holds attributes of a particle.
    Definition: Particle.hpp:21
    PenningTrapTest
    Definition: test_suite.cpp:20
    -
    PenningTrap
    A class that simulates a Penning trap.
    Definition: PenningTrap.hpp:29
    -
    PenningTrap::total_force_external
    arma::vec total_force_external(int i)
    Calculate the total external force on a particle.
    Definition: PenningTrap.cpp:65
    -
    PenningTrap::total_force_particles
    arma::vec total_force_particles(int i)
    Calculate the total force on a particle from other particles.
    Definition: PenningTrap.cpp:80
    -
    PenningTrap::external_B_field
    arma::vec external_B_field(arma::vec r)
    Calculate B at point r.
    Definition: PenningTrap.cpp:43
    -
    PenningTrap::force_on_particle
    arma::vec force_on_particle(int i, int j)
    Calculate the force between 2 particles.
    Definition: PenningTrap.cpp:50
    -
    PenningTrap::add_particle
    void add_particle(Particle particle)
    Add a particle to the system.
    Definition: PenningTrap.cpp:27
    -
    PenningTrap::external_E_field
    arma::vec external_E_field(arma::vec r)
    Calculate E at point r.
    Definition: PenningTrap.cpp:32
    +
    PenningTrap
    A class that simulates a Penning trap.
    Definition: PenningTrap.hpp:30
    +
    PenningTrap::external_E_field
    vec_3d external_E_field(vec_3d r)
    Calculate E at point r.
    Definition: PenningTrap.cpp:87
    +
    PenningTrap::total_force_particles
    vec_3d total_force_particles(unsigned int i)
    Calculate the total force on a particle p_i from other particles.
    Definition: PenningTrap.cpp:129
    +
    PenningTrap::add_particle
    void add_particle(Particle particle)
    Add a particle to the system.
    Definition: PenningTrap.cpp:82
    +
    PenningTrap::force_on_particle
    vec_3d force_on_particle(unsigned int i, unsigned int j)
    Calculate the force between 2 particles.
    Definition: PenningTrap.cpp:100
    +
    PenningTrap::external_B_field
    vec_3d external_B_field(vec_3d r)
    Calculate B at point r.
    Definition: PenningTrap.cpp:95
    +
    PenningTrap::total_force_external
    vec_3d total_force_external(unsigned int i)
    Calculate the total external force on a particle.
    Definition: PenningTrap.cpp:114
    T
    #define T
    1 Tesla. unit:
    Definition: constants.hpp:17
    utils.hpp
    Function prototypes and macros that are useful.
    -
    arma_vector_close_to
    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.
    Definition: utils.cpp:59
    +
    arma_vector_close_to
    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.
    Definition: utils.cpp:62
    ASSERT
    #define ASSERT(expr, msg)
    A prettier assertion function.
    Definition: utils.hpp:45
    diff --git a/docs/typedefs_8hpp.html b/docs/typedefs_8hpp.html new file mode 100644 index 0000000..1f2eedb --- /dev/null +++ b/docs/typedefs_8hpp.html @@ -0,0 +1,222 @@ + + + + + + + +Penning Trap Simulation: include/typedefs.hpp File Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Penning Trap Simulation +
    +
    Simulate particle behavior inside a Penning Trap
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    typedefs.hpp File Reference
    +
    +
    + +

    Useful typedefs for cleaner code. +More...

    +
    #include <vector>
    +#include <armadillo>
    +
    +

    Go to the source code of this file.

    + + + + + + + + + + + + + + +

    +Typedefs

    typedef std::vector< arma::vec::fixed< 3 > > sim_cols
     Typedef for the column of the result vector from simulating particles.
     
    typedef std::vector< arma::vec::fixed< 3 > > sim_rows
     Typedef for the row of the result vector from simulating particles.
     
    typedef std::vector< sim_colssim_arr
     Typedef for the result of the simulate method.
     
    typedef arma::vec::fixed< 3 > vec_3d
     Typedef for a fixed 3d arma vector.
     
    +

    Detailed Description

    +

    Useful typedefs for cleaner code.

    +
    Author
    Cory Alexander Balaton (coryab)
    +
    +Janita Ovidie Sandtrøen Willumsen (janitaws)
    +
    Version
    1.0
    +

    These typedefs make the code more readable and easy to follow along.

    +
    Bug:
    No known bugs
    + +

    Definition in file typedefs.hpp.

    +

    Typedef Documentation

    + +

    ◆ sim_arr

    + +
    +
    + + + + +
    typedef std::vector<sim_cols> sim_arr
    +
    + +

    Typedef for the result of the simulate method.

    + +

    Definition at line 32 of file typedefs.hpp.

    + +
    +
    + +

    ◆ sim_cols

    + +
    +
    + + + + +
    typedef std::vector<arma::vec::fixed<3> > sim_cols
    +
    + +

    Typedef for the column of the result vector from simulating particles.

    + +

    Definition at line 24 of file typedefs.hpp.

    + +
    +
    + +

    ◆ sim_rows

    + +
    +
    + + + + +
    typedef std::vector<arma::vec::fixed<3> > sim_rows
    +
    + +

    Typedef for the row of the result vector from simulating particles.

    + +

    Definition at line 28 of file typedefs.hpp.

    + +
    +
    + +

    ◆ vec_3d

    + +
    +
    + + + + +
    typedef arma::vec::fixed<3> vec_3d
    +
    + +

    Typedef for a fixed 3d arma vector.

    + +

    Definition at line 36 of file typedefs.hpp.

    + +
    +
    +
    +
    + + + + diff --git a/docs/typedefs_8hpp.js b/docs/typedefs_8hpp.js new file mode 100644 index 0000000..d014844 --- /dev/null +++ b/docs/typedefs_8hpp.js @@ -0,0 +1,7 @@ +var typedefs_8hpp = +[ + [ "sim_arr", "typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af", null ], + [ "sim_cols", "typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23", null ], + [ "sim_rows", "typedefs_8hpp.html#a8502989b1b361725834fc185bd575f66", 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 new file mode 100644 index 0000000..475ff07 --- /dev/null +++ b/docs/typedefs_8hpp_source.html @@ -0,0 +1,134 @@ + + + + + + + +Penning Trap Simulation: include/typedefs.hpp Source File + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Penning Trap Simulation +
    +
    Simulate particle behavior inside a Penning Trap
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    +
    typedefs.hpp
    +
    +
    +Go to the documentation of this file.
    1
    +
    15#ifndef __TYPEDEFS__
    +
    16#define __TYPEDEFS__
    +
    17
    +
    18#include <vector>
    +
    19#include <armadillo>
    +
    20
    +
    24typedef std::vector<arma::vec::fixed<3>> sim_cols;
    +
    25
    +
    28typedef std::vector<arma::vec::fixed<3>> sim_rows;
    +
    29
    +
    32typedef std::vector<sim_cols> sim_arr;
    +
    33
    +
    36typedef arma::vec::fixed<3> vec_3d;
    +
    37
    +
    38#endif
    +
    std::vector< arma::vec::fixed< 3 > > sim_cols
    Typedef for the column of the result vector from simulating particles.
    Definition: typedefs.hpp:24
    +
    std::vector< arma::vec::fixed< 3 > > sim_rows
    Typedef for the row of the result vector from simulating particles.
    Definition: typedefs.hpp:28
    +
    arma::vec::fixed< 3 > vec_3d
    Typedef for a fixed 3d arma vector.
    Definition: typedefs.hpp:36
    +
    std::vector< sim_cols > sim_arr
    Typedef for the result of the simulate method.
    Definition: typedefs.hpp:32
    +
    +
    + + + + diff --git a/docs/utils_8cpp.html b/docs/utils_8cpp.html index c2ffd2e..9401b51 100644 --- a/docs/utils_8cpp.html +++ b/docs/utils_8cpp.html @@ -106,7 +106,8 @@ $(document).ready(function(){initNavTree('utils_8cpp.html',''); initResizable();

    Implementation of the utils. More...

    -
    #include "utils.hpp"
    +
    #include <sys/stat.h>
    +#include "utils.hpp"

    Go to the source code of this file.

    @@ -124,6 +125,9 @@ Functions + + +
    bool arma_vector_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.
     

    Detailed Description

    Implementation of the utils.

    @@ -131,7 +135,7 @@ Functions
    Janita Ovidie Sandtrøen Willumsen (janitaws)
    Version
    1.0
    -
    Bug:
    No known bugs
    +
    Bug:
    No known bugs

    Definition in file utils.cpp.

    Function Documentation

    @@ -177,9 +181,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws) -
    Returns
    Boolean
    +
    Returns
    bool
    -

    Definition at line 59 of file utils.cpp.

    +

    Definition at line 62 of file utils.cpp.

    @@ -247,7 +251,48 @@ Janita Ovidie Sandtrøen Willumsen (janitaws) -

    Definition at line 40 of file utils.cpp.

    +

    Definition at line 43 of file utils.cpp.

    + + + + +

    ◆ mkpath()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    bool mkpath (std::string path,
    int mode = 0777 
    )
    +
    + +

    Make path given.

    +

    This tries to be the equivalent to "mkdir -p" and creates a new directory whenever it needs to.

    +
    Parameters
    + + + +
    pathThe path to be created
    modeThe mode/permissions for all the new directories
    +
    +
    +
    Returns
    bool
    + +

    Definition at line 76 of file utils.cpp.

    @@ -284,6 +329,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)

    Turns a vector of doubles into a string written in scientific format.

    +

    The code is stolen from https://github.com/anderkve/FYS3150.

    Parameters
    @@ -292,9 +338,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
    vThe vector to stringify
    -
    Returns
    String
    +
    Returns
    std::string
    -

    Definition at line 21 of file utils.cpp.

    +

    Definition at line 24 of file utils.cpp.

    @@ -331,7 +377,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)

    Turns a double into a string written in scientific format.

    -

    Code stolen from https://github.com/anderkve/FYS3150 Header: https://github.com/anderkve/FYS3150/blob/master/code_examples/compilation_linking/example_1/include/utils.hpp Source: https://github.com/anderkve/FYS3150/blob/master/code_examples/compilation_linking/example_1/src/utils.cpp

    +

    The code is stolen from https://github.com/anderkve/FYS3150.

    Parameters
    @@ -340,9 +386,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
    dThe number to stringify
    -
    Returns
    String
    +
    Returns
    std::string
    -

    Definition at line 14 of file utils.cpp.

    +

    Definition at line 17 of file utils.cpp.

    diff --git a/docs/utils_8cpp.js b/docs/utils_8cpp.js index 36c50fa..362b36a 100644 --- a/docs/utils_8cpp.js +++ b/docs/utils_8cpp.js @@ -2,6 +2,7 @@ var utils_8cpp = [ [ "arma_vector_close_to", "utils_8cpp.html#a5d2e1e032fd19614f2fbb58149a7b02a", null ], [ "m_assert", "utils_8cpp.html#aff5e07c3c1d321709b0cc38e999f427b", null ], + [ "mkpath", "utils_8cpp.html#acf13f4e492199cb7231bfa646dbd08de", null ], [ "scientific_format", "utils_8cpp.html#a58565270b643b24e3132f38c653e0199", null ], [ "scientific_format", "utils_8cpp.html#acd2a9c7a7d5a7fe9163be8c4cc110746", null ] ]; \ No newline at end of file diff --git a/docs/utils_8cpp_source.html b/docs/utils_8cpp_source.html index 069cd7c..5ed9571 100644 --- a/docs/utils_8cpp_source.html +++ b/docs/utils_8cpp_source.html @@ -102,69 +102,97 @@ $(document).ready(function(){initNavTree('utils_8cpp_source.html',''); initResiz
    Go to the documentation of this file.
    1
    -
    12#include "utils.hpp"
    -
    13
    -
    14std::string scientific_format(double d, int width, int prec)
    -
    15{
    -
    16 std::stringstream ss;
    -
    17 ss << std::setw(width) << std::setprecision(prec) << std::scientific << d;
    -
    18 return ss.str();
    -
    19}
    -
    20
    -
    21std::string scientific_format(const std::vector<double> &v, int width, int prec)
    -
    22{
    -
    23 std::stringstream ss;
    -
    24 for (double elem : v) {
    -
    25 ss << scientific_format(elem, width, prec);
    -
    26 }
    -
    27 return ss.str();
    -
    28}
    -
    29
    -
    30static void print_message(std::string msg)
    -
    31{
    -
    32 if (msg.size() > 0) {
    -
    33 std::cout << "message: " << msg << "\n\n";
    -
    34 }
    -
    35 else {
    -
    36 std::cout << "\n";
    +
    13#include <sys/stat.h>
    +
    14
    +
    15#include "utils.hpp"
    +
    16
    +
    17std::string scientific_format(double d, int width, int prec)
    +
    18{
    +
    19 std::stringstream ss;
    +
    20 ss << std::setw(width) << std::setprecision(prec) << std::scientific << d;
    +
    21 return ss.str();
    +
    22}
    +
    23
    +
    24std::string scientific_format(const std::vector<double> &v, int width, int prec)
    +
    25{
    +
    26 std::stringstream ss;
    +
    27 for (double elem : v) {
    +
    28 ss << scientific_format(elem, width, prec);
    +
    29 }
    +
    30 return ss.str();
    +
    31}
    +
    32
    +
    33static void print_message(std::string msg)
    +
    34{
    +
    35 if (msg.size() > 0) {
    +
    36 std::cout << "message: " << msg << "\n\n";
    37 }
    -
    38}
    -
    39
    -
    40void m_assert(bool expr, std::string expr_str, std::string f, std::string file,
    -
    41 int line, std::string msg)
    -
    42{
    -
    43 std::string new_assert(f.size() + (expr ? 4 : 6), '-');
    -
    44 std::cout << "\x1B[36m" << new_assert << "\033[0m\n";
    -
    45 std::cout << f << ": ";
    -
    46 if (expr) {
    -
    47 std::cout << "\x1B[32mOK\033[0m\n";
    -
    48 print_message(msg);
    -
    49 }
    -
    50 else {
    -
    51 std::cout << "\x1B[31mFAIL\033[0m\n";
    -
    52 print_message(msg);
    -
    53 std::cout << file << " " << line << ": Assertion \"" << expr_str
    -
    54 << "\" Failed\n\n";
    -
    55 abort();
    -
    56 }
    -
    57}
    -
    58
    -
    59bool arma_vector_close_to(arma::vec &a, arma::vec &b, double tol)
    -
    60{
    -
    61 if (a.n_elem != b.n_elem) {
    -
    62 return false;
    -
    63 }
    -
    64
    -
    65 for (int i = 0; i < a.n_elem; i++) {
    -
    66 if (std::abs(a(i) - b(i)) >= tol) {
    -
    67 return false;
    -
    68 }
    -
    69 }
    -
    70 return true;
    -
    71}
    -
    bool arma_vector_close_to(arma::vec &a, arma::vec &b, double tol)
    Test if two armadillo vectors are close to each other.
    Definition: utils.cpp:59
    -
    std::string scientific_format(double d, int width, int prec)
    Turns a double into a string written in scientific format.
    Definition: utils.cpp:14
    -
    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.
    Definition: utils.cpp:40
    +
    38 else {
    +
    39 std::cout << "\n";
    +
    40 }
    +
    41}
    +
    42
    +
    43void m_assert(bool expr, std::string expr_str, std::string f, std::string file,
    +
    44 int line, std::string msg)
    +
    45{
    +
    46 std::string new_assert(f.size() + (expr ? 4 : 6), '-');
    +
    47 std::cout << "\x1B[36m" << new_assert << "\033[0m\n";
    +
    48 std::cout << f << ": ";
    +
    49 if (expr) {
    +
    50 std::cout << "\x1B[32mOK\033[0m\n";
    +
    51 print_message(msg);
    +
    52 }
    +
    53 else {
    +
    54 std::cout << "\x1B[31mFAIL\033[0m\n";
    +
    55 print_message(msg);
    +
    56 std::cout << file << " " << line << ": Assertion \"" << expr_str
    +
    57 << "\" Failed\n\n";
    +
    58 abort();
    +
    59 }
    +
    60}
    +
    61
    +
    62bool arma_vector_close_to(arma::vec &a, arma::vec &b, double tol)
    +
    63{
    +
    64 if (a.n_elem != b.n_elem) {
    +
    65 return false;
    +
    66 }
    +
    67
    +
    68 for (size_t i = 0; i < a.n_elem; i++) {
    +
    69 if (std::abs(a(i) - b(i)) >= tol) {
    +
    70 return false;
    +
    71 }
    +
    72 }
    +
    73 return true;
    +
    74}
    +
    75
    +
    76bool mkpath(std::string path, int mode)
    +
    77{
    +
    78 std::string cur_dir;
    +
    79 std::string::size_type pos = -1;
    +
    80 struct stat buf;
    +
    81
    +
    82 if (path.back() != '/') {
    +
    83 path += '/';
    +
    84 }
    +
    85 while (true) {
    +
    86 pos++;
    +
    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) {
    +
    91 return -1;
    +
    92 }
    +
    93 }
    +
    94 else {
    +
    95 break;
    +
    96 }
    +
    97 }
    +
    98 return 0;
    +
    99}
    +
    bool arma_vector_close_to(arma::vec &a, arma::vec &b, double tol)
    Test if two armadillo vectors are close to each other.
    Definition: utils.cpp:62
    +
    std::string scientific_format(double d, int width, int prec)
    Turns a double into a string written in scientific format.
    Definition: utils.cpp:17
    +
    bool mkpath(std::string path, int mode)
    Make path given.
    Definition: utils.cpp:76
    +
    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.
    Definition: utils.cpp:43
    Function prototypes and macros that are useful.
    diff --git a/docs/utils_8hpp.html b/docs/utils_8hpp.html index dea4601..2866ae0 100644 --- a/docs/utils_8hpp.html +++ b/docs/utils_8hpp.html @@ -124,6 +124,7 @@ Macros  A prettier assertion function.
      #define __METHOD_NAME__   methodName(__PRETTY_FUNCTION__) + Get the name of the current method/function.
      + + +

    @@ -140,6 +141,9 @@ Functions

    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 mkpath (std::string path, int mode=0777)
     Make path given.
     

    Detailed Description

    Function prototypes and macros that are useful.

    @@ -148,7 +152,7 @@ Functions Janita Ovidie Sandtrøen Willumsen (janitaws)
    Version
    1.0

    These utility function are mainly for convenience and aren't directly related to the project.

    -
    Bug:
    No known bugs
    +
    Bug:
    No known bugs

    Definition in file utils.hpp.

    Macro Definition Documentation

    @@ -164,7 +168,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
    -

    Definition at line 48 of file utils.hpp.

    +

    Get the name of the current method/function.

    + +

    Definition at line 51 of file utils.hpp.

    @@ -193,9 +199,10 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
    -Value:
    m_assert(expr, #expr, __METHOD_NAME__, __FILE__, \
    +Value:
    m_assert(expr, #expr, __METHOD_NAME__, __FILE__, \
    __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.
    Definition: utils.cpp:40
    +
    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.
    Definition: utils.cpp:43
    +
    #define __METHOD_NAME__
    Get the name of the current method/function.
    Definition: utils.hpp:51

    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.

    @@ -270,9 +277,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws) -
    Returns
    Boolean
    +
    Returns
    bool
    -

    Definition at line 59 of file utils.cpp.

    +

    Definition at line 62 of file utils.cpp.

    @@ -340,7 +347,48 @@ Janita Ovidie Sandtrøen Willumsen (janitaws) -

    Definition at line 40 of file utils.cpp.

    +

    Definition at line 43 of file utils.cpp.

    + + + + +

    ◆ mkpath()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    bool mkpath (std::string path,
    int mode = 0777 
    )
    +
    + +

    Make path given.

    +

    This tries to be the equivalent to "mkdir -p" and creates a new directory whenever it needs to.

    +
    Parameters
    + + + +
    pathThe path to be created
    modeThe mode/permissions for all the new directories
    +
    +
    +
    Returns
    bool
    + +

    Definition at line 76 of file utils.cpp.

    @@ -377,6 +425,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)

    Turns a vector of doubles into a string written in scientific format.

    +

    The code is stolen from https://github.com/anderkve/FYS3150.

    Parameters
    @@ -385,9 +434,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
    vThe vector to stringify
    -
    Returns
    String
    +
    Returns
    std::string
    -

    Definition at line 21 of file utils.cpp.

    +

    Definition at line 24 of file utils.cpp.

    @@ -424,7 +473,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)

    Turns a double into a string written in scientific format.

    -

    Code stolen from https://github.com/anderkve/FYS3150 Header: https://github.com/anderkve/FYS3150/blob/master/code_examples/compilation_linking/example_1/include/utils.hpp Source: https://github.com/anderkve/FYS3150/blob/master/code_examples/compilation_linking/example_1/src/utils.cpp

    +

    The code is stolen from https://github.com/anderkve/FYS3150.

    Parameters
    @@ -433,9 +482,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
    dThe number to stringify
    -
    Returns
    String
    +
    Returns
    std::string
    -

    Definition at line 14 of file utils.cpp.

    +

    Definition at line 17 of file utils.cpp.

    diff --git a/docs/utils_8hpp.js b/docs/utils_8hpp.js index 34c7b36..68951df 100644 --- a/docs/utils_8hpp.js +++ b/docs/utils_8hpp.js @@ -1,9 +1,11 @@ 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 ], [ "m_assert", "utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38", null ], + [ "mkpath", "utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa", null ], [ "scientific_format", "utils_8hpp.html#ad54b96a1074f9df4dc892a41d115b72d", null ], [ "scientific_format", "utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384", null ] ]; \ No newline at end of file diff --git a/docs/utils_8hpp_source.html b/docs/utils_8hpp_source.html index 33ddc52..1c7052d 100644 --- a/docs/utils_8hpp_source.html +++ b/docs/utils_8hpp_source.html @@ -121,39 +121,45 @@ $(document).ready(function(){initNavTree('utils_8hpp_source.html',''); initResiz
    45#define ASSERT(expr, msg) m_assert(expr, #expr, __METHOD_NAME__, __FILE__, \
    46 __LINE__, msg)
    47
    -
    48#define __METHOD_NAME__ methodName(__PRETTY_FUNCTION__)
    -
    49
    -
    50
    +
    51#define __METHOD_NAME__ methodName(__PRETTY_FUNCTION__)
    +
    52
    +
    53
    64std::string scientific_format(double d, int width=20, int prec=10);
    65
    -
    74std::string scientific_format(const std::vector<double>& v,
    -
    75 int width=20,
    -
    76 int prec=10);
    -
    77
    -
    90void m_assert(bool expr,
    -
    91 std::string expr_str,
    -
    92 std::string func,
    -
    93 std::string file,
    -
    94 int line,
    -
    95 std::string msg);
    -
    96
    -
    97
    -
    109bool arma_vector_close_to(arma::vec &a, arma::vec &b, double tol=1e-8);
    -
    110
    -
    111
    -
    112static inline std::string methodName(const std::string& prettyFunction)
    -
    113{
    -
    114 size_t colons = prettyFunction.find("::");
    -
    115 size_t begin = prettyFunction.substr(0,colons).rfind(" ") + 1;
    -
    116 size_t end = prettyFunction.rfind("(") - begin;
    -
    117
    -
    118 return prettyFunction.substr(begin,end) + "()";
    -
    119}
    -
    120
    -
    121#endif
    -
    arma_vector_close_to
    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.
    Definition: utils.cpp:59
    -
    m_assert
    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.
    Definition: utils.cpp:40
    -
    scientific_format
    std::string scientific_format(double d, int width=20, int prec=10)
    Turns a double into a string written in scientific format.
    Definition: utils.cpp:14
    +
    66
    +
    77std::string scientific_format(const std::vector<double>& v,
    +
    78 int width=20,
    +
    79 int prec=10);
    +
    80
    +
    81
    +
    94void m_assert(bool expr,
    +
    95 std::string expr_str,
    +
    96 std::string func,
    +
    97 std::string file,
    +
    98 int line,
    +
    99 std::string msg);
    +
    100
    +
    101
    +
    113bool arma_vector_close_to(arma::vec &a, arma::vec &b, double tol=1e-8);
    +
    114
    +
    115
    +
    126static inline std::string methodName(const std::string& pretty_function)
    +
    127{
    +
    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;
    +
    131
    +
    132 return pretty_function.substr(begin,end) + "()";
    +
    133}
    +
    134
    +
    135
    +
    146bool mkpath(std::string path, int mode = 0777);
    +
    147
    +
    148#endif
    +
    arma_vector_close_to
    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.
    Definition: utils.cpp:62
    +
    m_assert
    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.
    Definition: utils.cpp:43
    +
    mkpath
    bool mkpath(std::string path, int mode=0777)
    Make path given.
    Definition: utils.cpp:76
    +
    scientific_format
    std::string scientific_format(double d, int width=20, int prec=10)
    Turns a double into a string written in scientific format.
    Definition: utils.cpp:17
    diff --git a/man_pages/man3/Particle.3 b/man_pages/man3/Particle.3 index f37639d..ebff781 100644 --- a/man_pages/man3/Particle.3 +++ b/man_pages/man3/Particle.3 @@ -1,4 +1,4 @@ -.TH "Particle" 3 "Sun Oct 8 2023" "Penning Trap Simulation" \" -*- nroff -*- +.TH "Particle" 3 "Sat Oct 14 2023" "Penning Trap Simulation" \" -*- nroff -*- .ad l .nh .SH NAME @@ -13,7 +13,7 @@ Particle \- A class that holds attributes of a particle\&. .in +1c .ti -1c -.RI "\fBParticle\fP (double \fBq\fP, double \fBm\fP, arma::vec::fixed< 3 > \fBr_vec\fP, arma::vec::fixed< 3 > \fBv_vec\fP)" +.RI "\fBParticle\fP (double \fBq\fP, double \fBm\fP, \fBvec_3d\fP \fBr_vec\fP, \fBvec_3d\fP \fBv_vec\fP)" .br .RI "Initialize the particle\&. " .in -1c @@ -29,11 +29,11 @@ Particle \- A class that holds attributes of a particle\&. .br .RI "Mass\&. " .ti -1c -.RI "arma::vec::fixed< 3 > \fBr_vec\fP" +.RI "\fBvec_3d\fP \fBr_vec\fP" .br .RI "position " .ti -1c -.RI "arma::vec::fixed< 3 > \fBv_vec\fP" +.RI "\fBvec_3d\fP \fBv_vec\fP" .br .RI "velocity " .in -1c @@ -49,15 +49,28 @@ Particle \- A class that holds attributes of a particle\&. .PP A class that holds attributes of a particle\&. .PP -Definition at line \fB19\fP of file \fBParticle\&.hpp\fP\&. +Definition at line \fB21\fP of file \fBParticle\&.hpp\fP\&. .SH "Constructor & Destructor Documentation" .PP -.SS "Particle::Particle (double q, double m, arma::vec::fixed< 3 > r_vec, arma::vec::fixed< 3 > v_vec)" +.SS "Particle::Particle (double q, double m, \fBvec_3d\fP r_vec, \fBvec_3d\fP v_vec)" .PP -Initialize the particle\&. Initialize the particle with a charge, mass, position and velocity\&. +Initialize the particle\&. Initialize the particle with a charge, mass, position and velocity\&. .PP -Definition at line \fB16\fP of file \fBParticle\&.cpp\fP\&. +\fBParameters\fP +.RS 4 +\fIq\fP The charge of the particle +.br +\fIm\fP The mass of the particle +.br +\fIr_vec\fP The initial position of the particle +.br +\fIv_vec\fP The initial velocity of the particle +.RE +.PP + +.PP +Definition at line \fB15\fP of file \fBParticle\&.cpp\fP\&. .SH "Friends And Related Function Documentation" .PP .SS "friend class \fBPenningTrap\fP\fC [friend]\fP" @@ -65,7 +78,7 @@ Definition at line \fB16\fP of file \fBParticle\&.cpp\fP\&. .PP Make private attributes available for \fBPenningTrap\fP\&. .PP -Definition at line \fB38\fP of file \fBParticle\&.hpp\fP\&. +Definition at line \fB43\fP of file \fBParticle\&.hpp\fP\&. .SH "Member Data Documentation" .PP .SS "double Particle::m\fC [private]\fP" @@ -73,25 +86,25 @@ Definition at line \fB38\fP of file \fBParticle\&.hpp\fP\&. .PP Mass\&. .PP -Definition at line \fB22\fP of file \fBParticle\&.hpp\fP\&. +Definition at line \fB24\fP of file \fBParticle\&.hpp\fP\&. .SS "double Particle::q\fC [private]\fP" .PP Charge\&. .PP -Definition at line \fB21\fP of file \fBParticle\&.hpp\fP\&. -.SS "arma::vec::fixed<3> Particle::r_vec\fC [private]\fP" +Definition at line \fB23\fP of file \fBParticle\&.hpp\fP\&. +.SS "\fBvec_3d\fP Particle::r_vec\fC [private]\fP" .PP position .PP -Definition at line \fB23\fP of file \fBParticle\&.hpp\fP\&. -.SS "arma::vec::fixed<3> Particle::v_vec\fC [private]\fP" +Definition at line \fB25\fP of file \fBParticle\&.hpp\fP\&. +.SS "\fBvec_3d\fP Particle::v_vec\fC [private]\fP" .PP velocity .PP -Definition at line \fB24\fP of file \fBParticle\&.hpp\fP\&. +Definition at line \fB26\fP of file \fBParticle\&.hpp\fP\&. .SH "Author" .PP diff --git a/man_pages/man3/Particle.cpp.3 b/man_pages/man3/Particle.cpp.3 index 7a93b45..904c7a4 100644 --- a/man_pages/man3/Particle.cpp.3 +++ b/man_pages/man3/Particle.cpp.3 @@ -1,4 +1,4 @@ -.TH "src/Particle.cpp" 3 "Sun Oct 8 2023" "Penning Trap Simulation" \" -*- nroff -*- +.TH "src/Particle.cpp" 3 "Sat Oct 14 2023" "Penning Trap Simulation" \" -*- nroff -*- .ad l .nh .SH NAME @@ -31,7 +31,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws) .PP \fBBug\fP .RS 4 -No known bugs +No known bugs .RE .PP diff --git a/man_pages/man3/Particle.hpp.3 b/man_pages/man3/Particle.hpp.3 index abb26a7..2033d14 100644 --- a/man_pages/man3/Particle.hpp.3 +++ b/man_pages/man3/Particle.hpp.3 @@ -1,4 +1,4 @@ -.TH "include/Particle.hpp" 3 "Sun Oct 8 2023" "Penning Trap Simulation" \" -*- nroff -*- +.TH "include/Particle.hpp" 3 "Sat Oct 14 2023" "Penning Trap Simulation" \" -*- nroff -*- .ad l .nh .SH NAME @@ -9,6 +9,8 @@ include/Particle.hpp \- A class that holds the properties of a particle\&. .PP \fC#include \fP .br +\fC#include 'typedefs\&.hpp'\fP +.br .SS "Classes" diff --git a/man_pages/man3/PenningTrap.3 b/man_pages/man3/PenningTrap.3 index 2087bb5..51cca93 100644 --- a/man_pages/man3/PenningTrap.3 +++ b/man_pages/man3/PenningTrap.3 @@ -1,4 +1,4 @@ -.TH "PenningTrap" 3 "Sun Oct 8 2023" "Penning Trap Simulation" \" -*- nroff -*- +.TH "PenningTrap" 3 "Sat Oct 14 2023" "Penning Trap Simulation" \" -*- nroff -*- .ad l .nh .SH NAME @@ -13,51 +13,77 @@ PenningTrap \- A class that simulates a Penning trap\&. .in +1c .ti -1c -.RI "\fBPenningTrap\fP (double \fBB_0\fP=\fBT\fP, double \fBV_0\fP=25\&.*\fBV\fP/1000\&., double \fBd\fP=500\&.)" +.RI "\fBPenningTrap\fP (double \fBB_0\fP=\fBT\fP, std::function< double(double)> \fBV_0\fP=[](double \fBt\fP) { return 25\&. *\fBV\fP/1000\&.;}, double \fBd\fP=500\&., double \fBt\fP=0\&.)" .br -.RI "Set B_0, V_0 and d\&. " +.RI "Constructor for the \fBPenningTrap\fP class\&. " +.ti -1c +.RI "\fBPenningTrap\fP (unsigned int i, double \fBB_0\fP=\fBT\fP, std::function< double(double)> \fBV_0\fP=[](double \fBt\fP) { return 25\&. *\fBV\fP/1000\&.;}, double \fBd\fP=500\&., double \fBt\fP=0\&.)" +.br +.RI "Constructor for the \fBPenningTrap\fP class\&. " +.ti -1c +.RI "\fBPenningTrap\fP (std::vector< \fBParticle\fP > \fBparticles\fP, double \fBB_0\fP=\fBT\fP, std::function< double(double)> \fBV_0\fP=[](double \fBt\fP) { return 25\&. *\fBV\fP/1000\&.;}, double \fBd\fP=500\&., double \fBt\fP=0\&.)" +.br +.RI "Constructor for the \fBPenningTrap\fP class\&. " .ti -1c .RI "void \fBadd_particle\fP (\fBParticle\fP particle)" .br .RI "Add a particle to the system\&. " .ti -1c -.RI "arma::vec \fBexternal_E_field\fP (arma::vec r)" +.RI "\fBvec_3d\fP \fBexternal_E_field\fP (\fBvec_3d\fP r)" .br .RI "Calculate E at point r\&. " .ti -1c -.RI "arma::vec \fBexternal_B_field\fP (arma::vec r)" +.RI "\fBvec_3d\fP \fBexternal_B_field\fP (\fBvec_3d\fP r)" .br .RI "Calculate B at point r\&. " .ti -1c -.RI "arma::vec \fBforce_on_particle\fP (int i, int j)" +.RI "\fBvec_3d\fP \fBforce_on_particle\fP (unsigned int i, unsigned int j)" .br .RI "Calculate the force between 2 particles\&. " .ti -1c -.RI "arma::vec \fBtotal_force_external\fP (int i)" +.RI "\fBvec_3d\fP \fBtotal_force_external\fP (unsigned int i)" .br .RI "Calculate the total external force on a particle\&. " .ti -1c -.RI "arma::vec \fBtotal_force_particles\fP (int i)" +.RI "\fBvec_3d\fP \fBtotal_force_particles\fP (unsigned int i)" .br -.RI "Calculate the total force on a particle from other particles\&. " +.RI "Calculate the total force on a particle p_i from other particles\&. " .ti -1c -.RI "arma::vec \fBtotal_force\fP (int i)" +.RI "\fBvec_3d\fP \fBtotal_force\fP (unsigned int i)" .br -.RI "calculate the total force on a particle\&. " +.RI "calculate the total force on a particle p_i\&. " .ti -1c -.RI "void \fBevolve_RK4\fP (double dt)" +.RI "void \fBevolve_RK4\fP (double dt, bool particle_interaction=true)" .br .RI "Go forward one timestep using the RK4 method\&. " .ti -1c -.RI "void \fBevolve_forward_euler\fP (double dt)" +.RI "void \fBevolve_forward_euler\fP (double dt, bool particle_interaction=true)" .br .RI "Go forward one timestep using the forward Euler method\&. " .ti -1c -.RI "arma::vec \fBget_particle\fP (int i)" +.RI "\fBsim_arr\fP \fBsimulate\fP (double time, unsigned int steps, std::string method='rk4', bool particle_interaction=true)" .br +.RI "Simulate the particle system inside the Penning trap over a certain amount of time\&. " .ti -1c -.RI "double \fBget_d\fP ()" +.RI "void \fBwrite_simulation_to_dir\fP (std::string path, double time, unsigned int steps, std::string method='rk4', bool particle_interaction=true)" .br +.RI "Simulate and write the displacement of all particles to files\&. " +.ti -1c +.RI "double \fBfraction_of_particles_left\fP (double time, unsigned int steps, std::string method='rk4', bool particle_interaction=true)" +.br +.RI "Simulate and calculate what fraction of particles are still left inside the Penning trap after the simulation\&. " +.in -1c +.SS "Private Member Functions" + +.in +1c +.ti -1c +.RI "\fBvec_3d\fP \fBv_func\fP (unsigned int i, unsigned int j, double dt)" +.br +.RI "Helper for evolve_RK4 when calculating $k_{v,i,j}$ values\&. " +.ti -1c +.RI "\fBvec_3d\fP \fBr_func\fP (unsigned int i, unsigned int j, double dt)" +.br +.RI "Helper for evolve_RK4 when calculating $k_{r,i,j}$ values\&. " .in -1c .SS "Private Attributes" @@ -67,7 +93,7 @@ PenningTrap \- A class that simulates a Penning trap\&. .br .RI "Magnetic field strength\&. " .ti -1c -.RI "double \fBV_0\fP" +.RI "std::function< double(double)> \fBV_0\fP" .br .RI "Applied potential\&. " .ti -1c @@ -75,9 +101,19 @@ PenningTrap \- A class that simulates a Penning trap\&. .br .RI "Characteristic dimension\&. " .ti -1c +.RI "double \fBt\fP" +.br +.RI "Current time\&. " +.ti -1c .RI "std::vector< \fBParticle\fP > \fBparticles\fP" .br .RI "The particles in the Penning trap\&. " +.ti -1c +.RI "\fBsim_arr\fP \fBk_v\fP" +.br +.ti -1c +.RI "\fBsim_arr\fP \fBk_r\fP" +.br .in -1c .SH "Detailed Description" .PP @@ -85,15 +121,70 @@ 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\&. .PP -Definition at line \fB29\fP of file \fBPenningTrap\&.hpp\fP\&. +Definition at line \fB30\fP of file \fBPenningTrap\&.hpp\fP\&. .SH "Constructor & Destructor Documentation" .PP -.SS "PenningTrap::PenningTrap (double B_0 = \fC\fBT\fP\fP, double V_0 = \fC25\&.*\fBV\fP/1000\&.\fP, double d = \fC500\&.\fP)" +.SS "PenningTrap::PenningTrap (double B_0 = \fC\fBT\fP\fP, std::function< double(double)> V_0 = \fC[](double \fBt\fP) { return 25\&. * \fBV\fP / 1000\&.; }\fP, double d = \fC500\&.\fP, double t = \fC0\&.\fP)" .PP -Set B_0, V_0 and d\&. +Constructor for the \fBPenningTrap\fP class\&. .PP -Definition at line \fB20\fP of file \fBPenningTrap\&.cpp\fP\&. +\fBParameters\fP +.RS 4 +\fIB_0\fP The magnetic field strength +.br +\fIV_0\fP The time dependent applied potential +.br +\fId\fP The characteristic dimension +.br +\fIt\fP The starting time +.RE +.PP + +.PP +Definition at line \fB18\fP of file \fBPenningTrap\&.cpp\fP\&. +.SS "PenningTrap::PenningTrap (unsigned int i, double B_0 = \fC\fBT\fP\fP, std::function< double(double)> V_0 = \fC[](double \fBt\fP) { return 25\&. * \fBV\fP / 1000\&.; }\fP, double d = \fC500\&.\fP, double t = \fC0\&.\fP)" + +.PP +Constructor for the \fBPenningTrap\fP class\&. +.PP +\fBParameters\fP +.RS 4 +\fIi\fP The number of particles to generate +.br +\fIB_0\fP The magnetic field strength +.br +\fIV_0\fP The time dependent applied potential +.br +\fId\fP The characteristic dimension +.br +\fIt\fP The starting time +.RE +.PP + +.PP +Definition at line \fB27\fP of file \fBPenningTrap\&.cpp\fP\&. +.SS "PenningTrap::PenningTrap (std::vector< \fBParticle\fP > particles, double B_0 = \fC\fBT\fP\fP, std::function< double(double)> V_0 = \fC[](double \fBt\fP) { return 25\&. * \fBV\fP / 1000\&.; }\fP, double d = \fC500\&.\fP, double t = \fC0\&.\fP)" + +.PP +Constructor for the \fBPenningTrap\fP class\&. +.PP +\fBParameters\fP +.RS 4 +\fIparticles\fP The starting particles +.br +\fIB_0\fP The magnetic field strength +.br +\fIV_0\fP The time dependent applied potential +.br +\fId\fP The characteristic dimension +.br +\fIt\fP The starting time +.RE +.PP + +.PP +Definition at line \fB39\fP of file \fBPenningTrap\&.cpp\fP\&. .SH "Member Function Documentation" .PP .SS "void PenningTrap::add_particle (\fBParticle\fP particle)" @@ -101,63 +192,262 @@ Definition at line \fB20\fP of file \fBPenningTrap\&.cpp\fP\&. .PP Add a particle to the system\&. .PP -Definition at line \fB27\fP of file \fBPenningTrap\&.cpp\fP\&. -.SS "void PenningTrap::evolve_forward_euler (double dt)" +\fBParameters\fP +.RS 4 +\fIparticle\fP The particle to add to the Penning trap +.RE +.PP + +.PP +Definition at line \fB82\fP of file \fBPenningTrap\&.cpp\fP\&. +.SS "void PenningTrap::evolve_forward_euler (double dt, bool particle_interaction = \fCtrue\fP)" .PP Go forward one timestep using the forward Euler method\&. .PP -Definition at line \fB167\fP of file \fBPenningTrap\&.cpp\fP\&. -.SS "void PenningTrap::evolve_RK4 (double dt)" +\fBParameters\fP +.RS 4 +\fIdt\fP The step length +.br +\fIparticle_interaction\fP Turn particle interactions on/off +.RE +.PP + +.PP +Definition at line \fB186\fP of file \fBPenningTrap\&.cpp\fP\&. +.SS "void PenningTrap::evolve_RK4 (double dt, bool particle_interaction = \fCtrue\fP)" .PP Go forward one timestep using the RK4 method\&. .PP -Definition at line \fB104\fP of file \fBPenningTrap\&.cpp\fP\&. -.SS "arma::vec PenningTrap::external_B_field (arma::vec r)" +\fBParameters\fP +.RS 4 +\fIdt\fP The step length +.br +\fIparticle_interaction\fP Turn particle interactions on/off +.RE +.PP + +.PP +Definition at line \fB151\fP of file \fBPenningTrap\&.cpp\fP\&. +.SS "\fBvec_3d\fP PenningTrap::external_B_field (\fBvec_3d\fP r)" .PP Calculate B at point r\&. .PP -Definition at line \fB43\fP of file \fBPenningTrap\&.cpp\fP\&. -.SS "arma::vec PenningTrap::external_E_field (arma::vec r)" +\fBParameters\fP +.RS 4 +\fIr\fP The position where we want to calculate the B field +.RE +.PP +\fBReturns\fP +.RS 4 +vec_3d +.RE +.PP + +.PP +Definition at line \fB95\fP of file \fBPenningTrap\&.cpp\fP\&. +.SS "\fBvec_3d\fP PenningTrap::external_E_field (\fBvec_3d\fP r)" .PP Calculate E at point r\&. .PP -Definition at line \fB32\fP of file \fBPenningTrap\&.cpp\fP\&. -.SS "arma::vec PenningTrap::force_on_particle (int i, int j)" +\fBParameters\fP +.RS 4 +\fIr\fP The position where we want to calculate the E field +.RE +.PP +\fBReturns\fP +.RS 4 +vec_3d +.RE +.PP .PP -Calculate the force between 2 particles\&. Calculate the force exhibited on particle p_i from particle p_j\&. -.PP -Definition at line \fB50\fP of file \fBPenningTrap\&.cpp\fP\&. -.SS "double PenningTrap::get_d ()" +Definition at line \fB87\fP of file \fBPenningTrap\&.cpp\fP\&. +.SS "\fBvec_3d\fP PenningTrap::force_on_particle (unsigned int i, unsigned int j)" .PP -Definition at line \fB188\fP of file \fBPenningTrap\&.cpp\fP\&. -.SS "arma::vec PenningTrap::get_particle (int i)" +Calculate the force between 2 particles\&. Calculate the force exhibited on particle p_i from particle p_j\&. +.PP +\fBParameters\fP +.RS 4 +\fIi\fP The index of particle p_i +.br +\fIj\fP The index of particle p_j +.RE +.PP +\fBReturns\fP +.RS 4 +vec_3d +.RE +.PP .PP -Definition at line \fB183\fP of file \fBPenningTrap\&.cpp\fP\&. -.SS "arma::vec PenningTrap::total_force (int i)" +Definition at line \fB100\fP of file \fBPenningTrap\&.cpp\fP\&. +.SS "double PenningTrap::fraction_of_particles_left (double time, unsigned int steps, std::string method = \fC'rk4'\fP, bool particle_interaction = \fCtrue\fP)" .PP -calculate the total force on a particle\&. +Simulate and calculate what fraction of particles are still left inside the Penning trap after the simulation\&. +.PP +\fBParameters\fP +.RS 4 +\fItime\fP The time to simulate in microseconds +.br +\fIsteps\fP The amount of steps for the whole simulation +.br +\fImethod\fP The method to use when moving forward a timestep +.br +\fIparticle_interaction\fP Turn particle interactions on/off +.RE +.PP +\fBReturns\fP +.RS 4 +double +.RE .PP -Definition at line \fB99\fP of file \fBPenningTrap\&.cpp\fP\&. -.SS "arma::vec PenningTrap::total_force_external (int i)" .PP -Calculate the total external force on a particle\&. Calculate the total amount of force that E and B exhibits on particle p_i\&. -.PP -Definition at line \fB65\fP of file \fBPenningTrap\&.cpp\fP\&. -.SS "arma::vec PenningTrap::total_force_particles (int i)" +Definition at line \fB266\fP of file \fBPenningTrap\&.cpp\fP\&. +.SS "\fBvec_3d\fP PenningTrap::r_func (unsigned int i, unsigned int j, double dt)\fC [private]\fP" .PP -Calculate the total force on a particle from other particles\&. +Helper for evolve_RK4 when calculating $k_{r,i,j}$ values\&. Something .PP -Definition at line \fB80\fP of file \fBPenningTrap\&.cpp\fP\&. +\fBParameters\fP +.RS 4 +\fIi\fP Index i for $k_{r,i,j}$ +.br +\fIj\fP Index j for $k_{r,i,j}$ +.br +\fIdt\fP the step length (delta time) +.RE +.PP +\fBReturns\fP +.RS 4 +vec_3d +.RE +.PP + +.PP +Definition at line \fB64\fP of file \fBPenningTrap\&.cpp\fP\&. +.SS "\fBsim_arr\fP PenningTrap::simulate (double time, unsigned int steps, std::string method = \fC'rk4'\fP, bool particle_interaction = \fCtrue\fP)" + +.PP +Simulate the particle system inside the Penning trap over a certain amount of time\&. +.PP +\fBParameters\fP +.RS 4 +\fItime\fP The time to simulate in microseconds +.br +\fIsteps\fP The amount of steps for the whole simulation +.br +\fImethod\fP The method to use when moving forward a timestep +.br +\fIparticle_interaction\fP Turn particle interactions on/off +.RE +.PP + +.PP +Definition at line \fB211\fP of file \fBPenningTrap\&.cpp\fP\&. +.SS "\fBvec_3d\fP PenningTrap::total_force (unsigned int i)" + +.PP +calculate the total force on a particle p_i\&. +.PP +\fBParameters\fP +.RS 4 +\fIi\fP The index of particle p_i +.RE +.PP +\fBReturns\fP +.RS 4 +vec_3d +.RE +.PP + +.PP +Definition at line \fB146\fP of file \fBPenningTrap\&.cpp\fP\&. +.SS "\fBvec_3d\fP PenningTrap::total_force_external (unsigned int i)" + +.PP +Calculate the total external force on a particle\&. Calculate the total amount of force that E and B exhibits on particle p_i\&. +.PP +\fBParameters\fP +.RS 4 +\fIi\fP The index of particle p_i +.RE +.PP +\fBReturns\fP +.RS 4 +vec_3d +.RE +.PP + +.PP +Definition at line \fB114\fP of file \fBPenningTrap\&.cpp\fP\&. +.SS "\fBvec_3d\fP PenningTrap::total_force_particles (unsigned int i)" + +.PP +Calculate the total force on a particle p_i from other particles\&. +.PP +\fBParameters\fP +.RS 4 +\fIi\fP The index of particle p_i +.RE +.PP +\fBReturns\fP +.RS 4 +vec_3d +.RE +.PP + +.PP +Definition at line \fB129\fP of file \fBPenningTrap\&.cpp\fP\&. +.SS "\fBvec_3d\fP PenningTrap::v_func (unsigned int i, unsigned int j, double dt)\fC [private]\fP" + +.PP +Helper for evolve_RK4 when calculating $k_{v,i,j}$ values\&. Something +.PP +\fBParameters\fP +.RS 4 +\fIi\fP Index i for $k_{v,i,j}$ +.br +\fIj\fP Index j for $k_{v,i,j}$ +.br +\fIdt\fP the step length (delta time) +.RE +.PP +\fBReturns\fP +.RS 4 +vec_3d +.RE +.PP + +.PP +Definition at line \fB46\fP of file \fBPenningTrap\&.cpp\fP\&. +.SS "void PenningTrap::write_simulation_to_dir (std::string path, double time, unsigned int steps, std::string method = \fC'rk4'\fP, bool particle_interaction = \fCtrue\fP)" + +.PP +Simulate and write the displacement of all particles to files\&. +.PP +\fBParameters\fP +.RS 4 +\fIpath\fP The directory to save the data +.br +\fItime\fP The time to simulate in microseconds +.br +\fIsteps\fP The amount of steps for the whole simulation +.br +\fImethod\fP The method to use when moving forward a timestep +.br +\fIparticle_interaction\fP Turn particle interactions on/off +.RE +.PP + +.PP +Definition at line \fB240\fP of file \fBPenningTrap\&.cpp\fP\&. .SH "Member Data Documentation" .PP .SS "double PenningTrap::B_0\fC [private]\fP" @@ -165,25 +455,39 @@ Definition at line \fB80\fP of file \fBPenningTrap\&.cpp\fP\&. .PP Magnetic field strength\&. .PP -Definition at line \fB31\fP of file \fBPenningTrap\&.hpp\fP\&. +Definition at line \fB32\fP of file \fBPenningTrap\&.hpp\fP\&. .SS "double PenningTrap::d\fC [private]\fP" .PP Characteristic dimension\&. .PP -Definition at line \fB33\fP of file \fBPenningTrap\&.hpp\fP\&. +Definition at line \fB34\fP of file \fBPenningTrap\&.hpp\fP\&. +.SS "\fBsim_arr\fP PenningTrap::k_r\fC [private]\fP" +A 2D vector containing all $k_{i,j}$ where $j$ is the index of a particle +.PP +Definition at line \fB39\fP of file \fBPenningTrap\&.hpp\fP\&. +.SS "\fBsim_arr\fP PenningTrap::k_v\fC [private]\fP" +A 2D vector containing all $k_{i,j}$ where $j$ is the index of a particle +.PP +Definition at line \fB37\fP of file \fBPenningTrap\&.hpp\fP\&. .SS "std::vector<\fBParticle\fP> PenningTrap::particles\fC [private]\fP" .PP The particles in the Penning trap\&. .PP -Definition at line \fB34\fP of file \fBPenningTrap\&.hpp\fP\&. -.SS "double PenningTrap::V_0\fC [private]\fP" +Definition at line \fB36\fP of file \fBPenningTrap\&.hpp\fP\&. +.SS "double PenningTrap::t\fC [private]\fP" + +.PP +Current time\&. +.PP +Definition at line \fB35\fP of file \fBPenningTrap\&.hpp\fP\&. +.SS "std::function PenningTrap::V_0\fC [private]\fP" .PP Applied potential\&. .PP -Definition at line \fB32\fP of file \fBPenningTrap\&.hpp\fP\&. +Definition at line \fB33\fP of file \fBPenningTrap\&.hpp\fP\&. .SH "Author" .PP diff --git a/man_pages/man3/PenningTrap.cpp.3 b/man_pages/man3/PenningTrap.cpp.3 index f850299..d080d97 100644 --- a/man_pages/man3/PenningTrap.cpp.3 +++ b/man_pages/man3/PenningTrap.cpp.3 @@ -1,4 +1,4 @@ -.TH "src/PenningTrap.cpp" 3 "Sun Oct 8 2023" "Penning Trap Simulation" \" -*- nroff -*- +.TH "src/PenningTrap.cpp" 3 "Sat Oct 14 2023" "Penning Trap Simulation" \" -*- nroff -*- .ad l .nh .SH NAME @@ -11,6 +11,8 @@ src/PenningTrap.cpp \- The implementation of the \fBPenningTrap\fP class\&. .br \fC#include 'constants\&.hpp'\fP .br +\fC#include 'typedefs\&.hpp'\fP +.br \fC#include 'utils\&.hpp'\fP .br @@ -35,15 +37,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws) .PP \fBBug\fP .RS 4 -No known bugs -.RE -.PP -.PP -\fBTodo\fP -.RS 4 -Implement evolve_RK4 -.PP -Implement evolve_forward_euler +No known bugs .RE .PP diff --git a/man_pages/man3/PenningTrap.hpp.3 b/man_pages/man3/PenningTrap.hpp.3 index c16a94b..15d155f 100644 --- a/man_pages/man3/PenningTrap.hpp.3 +++ b/man_pages/man3/PenningTrap.hpp.3 @@ -1,4 +1,4 @@ -.TH "include/PenningTrap.hpp" 3 "Sun Oct 8 2023" "Penning Trap Simulation" \" -*- nroff -*- +.TH "include/PenningTrap.hpp" 3 "Sat Oct 14 2023" "Penning Trap Simulation" \" -*- nroff -*- .ad l .nh .SH NAME @@ -15,6 +15,8 @@ include/PenningTrap.hpp \- A class for simulating a Penning trap\&. .br \fC#include 'constants\&.hpp'\fP .br +\fC#include 'typedefs\&.hpp'\fP +.br .SS "Classes" diff --git a/man_pages/man3/PenningTrapTest.3 b/man_pages/man3/PenningTrapTest.3 index 07c0b75..3bbe27c 100644 --- a/man_pages/man3/PenningTrapTest.3 +++ b/man_pages/man3/PenningTrapTest.3 @@ -1,4 +1,4 @@ -.TH "PenningTrapTest" 3 "Sun Oct 8 2023" "Penning Trap Simulation" \" -*- nroff -*- +.TH "PenningTrapTest" 3 "Sat Oct 14 2023" "Penning Trap Simulation" \" -*- nroff -*- .ad l .nh .SH NAME diff --git a/man_pages/man3/bug.3 b/man_pages/man3/bug.3 index f93d6e3..d21bde1 100644 --- a/man_pages/man3/bug.3 +++ b/man_pages/man3/bug.3 @@ -1,4 +1,4 @@ -.TH "bug" 3 "Sun Oct 8 2023" "Penning Trap Simulation" \" -*- nroff -*- +.TH "bug" 3 "Sat Oct 14 2023" "Penning Trap Simulation" \" -*- nroff -*- .ad l .nh .SH NAME @@ -10,15 +10,17 @@ No known bugs .IP "\fBFile \fBmain\&.cpp\fP \fP" 1c No known bugs .IP "\fBFile \fBParticle\&.cpp\fP \fP" 1c -No known bugs +No known bugs .IP "\fBFile \fBParticle\&.hpp\fP \fP" 1c No known bugs .IP "\fBFile \fBPenningTrap\&.cpp\fP \fP" 1c -No known bugs +No known bugs .IP "\fBFile \fBPenningTrap\&.hpp\fP \fP" 1c No known bugs .IP "\fBFile \fBtest_suite\&.cpp\fP \fP" 1c No known bugs +.IP "\fBFile \fBtypedefs\&.hpp\fP \fP" 1c +No known bugs .IP "\fBFile \fButils\&.cpp\fP \fP" 1c No known bugs .IP "\fBFile \fButils\&.hpp\fP \fP" 1c diff --git a/man_pages/man3/constants.hpp.3 b/man_pages/man3/constants.hpp.3 index ed6ff65..b1d978f 100644 --- a/man_pages/man3/constants.hpp.3 +++ b/man_pages/man3/constants.hpp.3 @@ -1,4 +1,4 @@ -.TH "include/constants.hpp" 3 "Sun Oct 8 2023" "Penning Trap Simulation" \" -*- nroff -*- +.TH "include/constants.hpp" 3 "Sat Oct 14 2023" "Penning Trap Simulation" \" -*- nroff -*- .ad l .nh .SH NAME diff --git a/man_pages/man3/main.cpp.3 b/man_pages/man3/main.cpp.3 index e02bbe4..23983a7 100644 --- a/man_pages/man3/main.cpp.3 +++ b/man_pages/man3/main.cpp.3 @@ -1,4 +1,4 @@ -.TH "src/main.cpp" 3 "Sun Oct 8 2023" "Penning Trap Simulation" \" -*- nroff -*- +.TH "src/main.cpp" 3 "Sat Oct 14 2023" "Penning Trap Simulation" \" -*- nroff -*- .ad l .nh .SH NAME @@ -7,14 +7,22 @@ src/main.cpp \- The main program for this project\&. .SH SYNOPSIS .br .PP +\fC#include \fP +.br \fC#include \fP .br \fC#include \fP .br +\fC#include \fP +.br \fC#include \fP .br +\fC#include \fP +.br \fC#include 'PenningTrap\&.hpp'\fP .br +\fC#include 'utils\&.hpp'\fP +.br .SS "Macros" @@ -36,12 +44,34 @@ src/main.cpp \- The main program for this project\&. .in +1c .ti -1c +.RI "void \fBsimulate_single_particle\fP ()" +.br +.ti -1c +.RI "void \fBsimulate_two_particles\fP ()" +.br +.ti -1c +.RI "void \fBsimulate_single_particle_with_different_steps\fP ()" +.br +.ti -1c .RI "void \fBsimulate_100_particles\fP ()" .br .ti -1c +.RI "void \fBsimulate_100_particles_with_time_potential\fP ()" +.br +.ti -1c .RI "int \fBmain\fP ()" .br .in -1c +.SS "Variables" + +.in +1c +.ti -1c +.RI "\fBParticle\fP \fBp1\fP (CHARGE, MASS, \fBvec_3d\fP{20\&., 0\&., 20\&.}, \fBvec_3d\fP{0\&., 25\&., 0\&.})" +.br +.ti -1c +.RI "\fBParticle\fP \fBp2\fP (CHARGE, MASS, \fBvec_3d\fP{25\&., 25\&., 0\&.}, \fBvec_3d\fP{0\&., 40\&., 5\&.})" +.br +.in -1c .SH "Detailed Description" .PP The main program for this project\&. @@ -74,29 +104,45 @@ Definition in file \fBmain\&.cpp\fP\&. .SS "#define CHARGE 1\&." .PP -Definition at line \fB21\fP of file \fBmain\&.cpp\fP\&. +Definition at line \fB25\fP of file \fBmain\&.cpp\fP\&. .SS "#define MASS 40\&." .PP -Definition at line \fB22\fP of file \fBmain\&.cpp\fP\&. +Definition at line \fB26\fP of file \fBmain\&.cpp\fP\&. .SS "#define N 10000" .PP -Definition at line \fB20\fP of file \fBmain\&.cpp\fP\&. +Definition at line \fB24\fP of file \fBmain\&.cpp\fP\&. .SS "#define PARTICLES 100" .PP -Definition at line \fB19\fP of file \fBmain\&.cpp\fP\&. +Definition at line \fB23\fP of file \fBmain\&.cpp\fP\&. .SH "Function Documentation" .PP .SS "int main ()" .PP -Definition at line \fB77\fP of file \fBmain\&.cpp\fP\&. +Definition at line \fB124\fP of file \fBmain\&.cpp\fP\&. .SS "void simulate_100_particles ()" .PP -Definition at line \fB24\fP of file \fBmain\&.cpp\fP\&. +Definition at line \fB77\fP of file \fBmain\&.cpp\fP\&. +.SS "void simulate_100_particles_with_time_potential ()" + +.PP +Definition at line \fB91\fP of file \fBmain\&.cpp\fP\&. +.SS "void simulate_single_particle ()" + +.PP +Definition at line \fB31\fP of file \fBmain\&.cpp\fP\&. +.SS "void simulate_single_particle_with_different_steps ()" + +.PP +Definition at line \fB55\fP of file \fBmain\&.cpp\fP\&. +.SS "void simulate_two_particles ()" + +.PP +Definition at line \fB42\fP of file \fBmain\&.cpp\fP\&. .SH "Author" .PP Generated automatically by Doxygen for Penning Trap Simulation from the source code\&. diff --git a/man_pages/man3/test_suite.cpp.3 b/man_pages/man3/test_suite.cpp.3 index fa522ef..c185469 100644 --- a/man_pages/man3/test_suite.cpp.3 +++ b/man_pages/man3/test_suite.cpp.3 @@ -1,4 +1,4 @@ -.TH "src/test_suite.cpp" 3 "Sun Oct 8 2023" "Penning Trap Simulation" \" -*- nroff -*- +.TH "src/test_suite.cpp" 3 "Sat Oct 14 2023" "Penning Trap Simulation" \" -*- nroff -*- .ad l .nh .SH NAME diff --git a/man_pages/man3/todo.3 b/man_pages/man3/todo.3 index a66e064..ef888e2 100644 --- a/man_pages/man3/todo.3 +++ b/man_pages/man3/todo.3 @@ -1,4 +1,4 @@ -.TH "todo" 3 "Sun Oct 8 2023" "Penning Trap Simulation" \" -*- nroff -*- +.TH "todo" 3 "Sat Oct 14 2023" "Penning Trap Simulation" \" -*- nroff -*- .ad l .nh .SH NAME diff --git a/man_pages/man3/typedefs.hpp.3 b/man_pages/man3/typedefs.hpp.3 new file mode 100644 index 0000000..1933ad3 --- /dev/null +++ b/man_pages/man3/typedefs.hpp.3 @@ -0,0 +1,92 @@ +.TH "include/typedefs.hpp" 3 "Sat Oct 14 2023" "Penning Trap Simulation" \" -*- nroff -*- +.ad l +.nh +.SH NAME +include/typedefs.hpp \- Useful typedefs for cleaner code\&. + +.SH SYNOPSIS +.br +.PP +\fC#include \fP +.br +\fC#include \fP +.br + +.SS "Typedefs" + +.in +1c +.ti -1c +.RI "typedef std::vector< arma::vec::fixed< 3 > > \fBsim_cols\fP" +.br +.RI "Typedef for the column of the result vector from simulating particles\&. " +.ti -1c +.RI "typedef std::vector< arma::vec::fixed< 3 > > \fBsim_rows\fP" +.br +.RI "Typedef for the row of the result vector from simulating particles\&. " +.ti -1c +.RI "typedef std::vector< \fBsim_cols\fP > \fBsim_arr\fP" +.br +.RI "Typedef for the result of the simulate method\&. " +.ti -1c +.RI "typedef arma::vec::fixed< 3 > \fBvec_3d\fP" +.br +.RI "Typedef for a fixed 3d arma vector\&. " +.in -1c +.SH "Detailed Description" +.PP +Useful typedefs for cleaner code\&. + + +.PP +\fBAuthor\fP +.RS 4 +Cory Alexander Balaton (coryab) +.PP +Janita Ovidie Sandtrøen Willumsen (janitaws) +.RE +.PP +\fBVersion\fP +.RS 4 +1\&.0 +.RE +.PP +.PP +These typedefs make the code more readable and easy to follow along\&. +.PP +\fBBug\fP +.RS 4 +No known bugs +.RE +.PP + +.PP +Definition in file \fBtypedefs\&.hpp\fP\&. +.SH "Typedef Documentation" +.PP +.SS "typedef std::vector<\fBsim_cols\fP> \fBsim_arr\fP" + +.PP +Typedef for the result of the simulate method\&. +.PP +Definition at line \fB32\fP of file \fBtypedefs\&.hpp\fP\&. +.SS "typedef std::vector > \fBsim_cols\fP" + +.PP +Typedef for the column of the result vector from simulating particles\&. +.PP +Definition at line \fB24\fP of file \fBtypedefs\&.hpp\fP\&. +.SS "typedef std::vector > \fBsim_rows\fP" + +.PP +Typedef for the row of the result vector from simulating particles\&. +.PP +Definition at line \fB28\fP of file \fBtypedefs\&.hpp\fP\&. +.SS "typedef arma::vec::fixed<3> \fBvec_3d\fP" + +.PP +Typedef for a fixed 3d arma vector\&. +.PP +Definition at line \fB36\fP of file \fBtypedefs\&.hpp\fP\&. +.SH "Author" +.PP +Generated automatically by Doxygen for Penning Trap Simulation from the source code\&. diff --git a/man_pages/man3/utils.cpp.3 b/man_pages/man3/utils.cpp.3 index 3d60a86..335b5f5 100644 --- a/man_pages/man3/utils.cpp.3 +++ b/man_pages/man3/utils.cpp.3 @@ -1,4 +1,4 @@ -.TH "src/utils.cpp" 3 "Sun Oct 8 2023" "Penning Trap Simulation" \" -*- nroff -*- +.TH "src/utils.cpp" 3 "Sat Oct 14 2023" "Penning Trap Simulation" \" -*- nroff -*- .ad l .nh .SH NAME @@ -7,6 +7,8 @@ src/utils.cpp \- Implementation of the utils\&. .SH SYNOPSIS .br .PP +\fC#include \fP +.br \fC#include 'utils\&.hpp'\fP .br @@ -29,6 +31,10 @@ src/utils.cpp \- Implementation of the utils\&. .RI "bool \fBarma_vector_close_to\fP (arma::vec &a, arma::vec &b, double tol)" .br .RI "Test if two armadillo vectors are close to each other\&. " +.ti -1c +.RI "bool \fBmkpath\fP (std::string path, int mode)" +.br +.RI "Make path given\&. " .in -1c .SH "Detailed Description" .PP @@ -75,12 +81,12 @@ Test if two armadillo vectors are close to each other\&. This function takes in .PP \fBReturns\fP .RS 4 -Boolean +bool .RE .PP .PP -Definition at line \fB59\fP of file \fButils\&.cpp\fP\&. +Definition at line \fB62\fP of file \fButils\&.cpp\fP\&. .SS "void m_assert (bool expr, std::string expr_str, std::string func, std::string file, int line, std::string msg)" .PP @@ -103,11 +109,31 @@ Test an expression, confirm that test is ok, or abort execution\&. This function .PP .PP -Definition at line \fB40\fP of file \fButils\&.cpp\fP\&. +Definition at line \fB43\fP of file \fButils\&.cpp\fP\&. +.SS "bool mkpath (std::string path, int mode = \fC0777\fP)" + +.PP +Make path given\&. This tries to be the equivalent to 'mkdir -p' and creates a new directory whenever it needs to\&. +.PP +\fBParameters\fP +.RS 4 +\fIpath\fP The path to be created +.br +\fImode\fP The mode/permissions for all the new directories +.RE +.PP +\fBReturns\fP +.RS 4 +bool +.RE +.PP + +.PP +Definition at line \fB76\fP of file \fButils\&.cpp\fP\&. .SS "std::string scientific_format (const std::vector< double > & v, int width = \fC20\fP, int prec = \fC10\fP)" .PP -Turns a vector of doubles into a string written in scientific format\&. +Turns a vector of doubles into a string written in scientific format\&. The code is stolen from https://github.com/anderkve/FYS3150\&. .PP \fBParameters\fP .RS 4 @@ -120,16 +146,16 @@ Turns a vector of doubles into a string written in scientific format\&. .PP \fBReturns\fP .RS 4 -String +std::string .RE .PP .PP -Definition at line \fB21\fP of file \fButils\&.cpp\fP\&. +Definition at line \fB24\fP of file \fButils\&.cpp\fP\&. .SS "std::string scientific_format (double d, int width = \fC20\fP, int prec = \fC10\fP)" .PP -Turns a double into a string written in scientific format\&. Code stolen from https://github.com/anderkve/FYS3150 Header: https://github.com/anderkve/FYS3150/blob/master/code_examples/compilation_linking/example_1/include/utils.hpp Source: https://github.com/anderkve/FYS3150/blob/master/code_examples/compilation_linking/example_1/src/utils.cpp +Turns a double into a string written in scientific format\&. The code is stolen from https://github.com/anderkve/FYS3150\&. .PP \fBParameters\fP .RS 4 @@ -142,12 +168,12 @@ Turns a double into a string written in scientific format\&. Code stolen from ht .PP \fBReturns\fP .RS 4 -String +std::string .RE .PP .PP -Definition at line \fB14\fP of file \fButils\&.cpp\fP\&. +Definition at line \fB17\fP of file \fButils\&.cpp\fP\&. .SH "Author" .PP Generated automatically by Doxygen for Penning Trap Simulation from the source code\&. diff --git a/man_pages/man3/utils.hpp.3 b/man_pages/man3/utils.hpp.3 index a67beb7..3f934d0 100644 --- a/man_pages/man3/utils.hpp.3 +++ b/man_pages/man3/utils.hpp.3 @@ -1,4 +1,4 @@ -.TH "include/utils.hpp" 3 "Sun Oct 8 2023" "Penning Trap Simulation" \" -*- nroff -*- +.TH "include/utils.hpp" 3 "Sat Oct 14 2023" "Penning Trap Simulation" \" -*- nroff -*- .ad l .nh .SH NAME @@ -32,6 +32,7 @@ include/utils.hpp \- Function prototypes and macros that are useful\&. .ti -1c .RI "#define \fB__METHOD_NAME__\fP methodName(__PRETTY_FUNCTION__)" .br +.RI "Get the name of the current method/function\&. " .in -1c .SS "Functions" @@ -52,6 +53,10 @@ include/utils.hpp \- Function prototypes and macros that are useful\&. .RI "bool \fBarma_vector_close_to\fP (arma::vec &a, arma::vec &b, double tol=1e\-8)" .br .RI "Test if two armadillo vectors are close to each other\&. " +.ti -1c +.RI "bool \fBmkpath\fP (std::string path, int mode=0777)" +.br +.RI "Make path given\&. " .in -1c .SH "Detailed Description" .PP @@ -87,7 +92,9 @@ Definition in file \fButils\&.hpp\fP\&. .SS "#define __METHOD_NAME__ methodName(__PRETTY_FUNCTION__)" .PP -Definition at line \fB48\fP of file \fButils\&.hpp\fP\&. +Get the name of the current method/function\&. +.PP +Definition at line \fB51\fP of file \fButils\&.hpp\fP\&. .SS "#define ASSERT(expr, msg)" \fBValue:\fP.PP .nf @@ -123,12 +130,12 @@ Test if two armadillo vectors are close to each other\&. This function takes in .PP \fBReturns\fP .RS 4 -Boolean +bool .RE .PP .PP -Definition at line \fB59\fP of file \fButils\&.cpp\fP\&. +Definition at line \fB62\fP of file \fButils\&.cpp\fP\&. .SS "void m_assert (bool expr, std::string expr_str, std::string func, std::string file, int line, std::string msg)" .PP @@ -151,11 +158,31 @@ Test an expression, confirm that test is ok, or abort execution\&. This function .PP .PP -Definition at line \fB40\fP of file \fButils\&.cpp\fP\&. +Definition at line \fB43\fP of file \fButils\&.cpp\fP\&. +.SS "bool mkpath (std::string path, int mode = \fC0777\fP)" + +.PP +Make path given\&. This tries to be the equivalent to 'mkdir -p' and creates a new directory whenever it needs to\&. +.PP +\fBParameters\fP +.RS 4 +\fIpath\fP The path to be created +.br +\fImode\fP The mode/permissions for all the new directories +.RE +.PP +\fBReturns\fP +.RS 4 +bool +.RE +.PP + +.PP +Definition at line \fB76\fP of file \fButils\&.cpp\fP\&. .SS "std::string scientific_format (const std::vector< double > & v, int width = \fC20\fP, int prec = \fC10\fP)" .PP -Turns a vector of doubles into a string written in scientific format\&. +Turns a vector of doubles into a string written in scientific format\&. The code is stolen from https://github.com/anderkve/FYS3150\&. .PP \fBParameters\fP .RS 4 @@ -168,16 +195,16 @@ Turns a vector of doubles into a string written in scientific format\&. .PP \fBReturns\fP .RS 4 -String +std::string .RE .PP .PP -Definition at line \fB21\fP of file \fButils\&.cpp\fP\&. +Definition at line \fB24\fP of file \fButils\&.cpp\fP\&. .SS "std::string scientific_format (double d, int width = \fC20\fP, int prec = \fC10\fP)" .PP -Turns a double into a string written in scientific format\&. Code stolen from https://github.com/anderkve/FYS3150 Header: https://github.com/anderkve/FYS3150/blob/master/code_examples/compilation_linking/example_1/include/utils.hpp Source: https://github.com/anderkve/FYS3150/blob/master/code_examples/compilation_linking/example_1/src/utils.cpp +Turns a double into a string written in scientific format\&. The code is stolen from https://github.com/anderkve/FYS3150\&. .PP \fBParameters\fP .RS 4 @@ -190,12 +217,12 @@ Turns a double into a string written in scientific format\&. Code stolen from ht .PP \fBReturns\fP .RS 4 -String +std::string .RE .PP .PP -Definition at line \fB14\fP of file \fButils\&.cpp\fP\&. +Definition at line \fB17\fP of file \fButils\&.cpp\fP\&. .SH "Author" .PP Generated automatically by Doxygen for Penning Trap Simulation from the source code\&.