31 std::vector<std::pair<vec_3d, vec_3d>> tests;
36 tests.push_back(std::make_pair(
vec_3d{10., 0., 0.},
37 vec_3d{96.4852558, 0., 0.}));
39 tests.push_back(std::make_pair(
vec_3d{10., 0., 0.},
40 vec_3d{96.4852558, 0., 0.}));
42 tests.push_back(std::make_pair(
vec_3d{0., 10., 0.},
43 vec_3d{0., 96.4852558, 0.}));
45 tests.push_back(std::make_pair(
vec_3d{0., 0., 10.},
46 vec_3d{0., 0., -192.9705116}));
50 std::stringstream msg;
51 for (
size_t i = 0; i < tests.size(); i++) {
52 v = tests.at(i).first;
56 msg <<
"Testing the external E field at (" << std::setprecision(2)
57 << v(0) <<
"," << v(1) <<
"," << v(2) <<
").";
73 "Testing the external B field at (0,0,0)");
89 vec_3d expected{-1., 0., 0.};
92 "Testing the force on a particle at (0,0,0) from a "
93 "particle at (1,0,0).");
96 expected =
vec_3d{0, -.024, -.032};
99 "Testing the force on a particle at (0,0,0) from a "
100 "particle at (0,3,4).");
111 vec_3d expected{395.58954878, -270.15871624, -57.89115348};
114 "Testing the total external force on a particle at "
115 "(1,2,3) with velocity (3,4,5)");
127 vec_3d expected{0., 0., 0.};
130 "Testing the total force of all particles on particle 0 "
131 "with only a single particle");
140 expected =
vec_3d().fill(-3473.383325);
143 "Testing the total force of all particles on particle 0 "
144 "with 3 other particles.");
A class for simulating a Penning trap.
A class that holds attributes of a particle.
Test class for the Penning trap.
static void test_total_force_particles()
Test that the total force of all particles on a single particle returns expected results.
static void test_external_E_field()
Test that the external E field gives correct values.
static void test_external_B_field()
Test that the external B field gives correct values.
static void test_force_on_particle()
Test that the force between particles gives expected results.
static void test_total_force_external()
Test that the total external force returns expected results.
A class that simulates a Penning trap.
vec_3d external_E_field(vec_3d r)
Calculate E at point r.
vec_3d total_force_particles(unsigned int i)
Calculate the total force on a particle p_i from other particles.
void add_particle(Particle particle)
Add a particle to the system.
vec_3d force_on_particle(unsigned int i, unsigned int j)
Calculate the force between 2 particles.
vec_3d external_B_field(vec_3d r)
Calculate B at point r.
vec_3d total_force_external(unsigned int i)
Calculate the total external force on a particle.
arma::vec::fixed< 3 > vec_3d
Typedef for a fixed 3d arma vector.
Function prototypes and macros that are useful.
#define ASSERT(expr, msg)
A prettier assertion function.
bool close_to(arma::vec &a, arma::vec &b, double tol=1e-8)
Test if two armadillo vectors are close to each other.