Fix compiler warnings

This commit is contained in:
2023-10-13 15:36:52 +02:00
parent 720f1815d2
commit ae7b437ac3
7 changed files with 99 additions and 108 deletions

View File

@@ -17,12 +17,10 @@
#include "Particle.hpp"
#include "constants.hpp"
#include "typedefs.hpp"
typedef std::vector<arma::vec::fixed<3>> sim_cols;
typedef std::vector<arma::vec::fixed<3>> sim_rows;
typedef std::vector<sim_cols> sim_arr;
#pragma omp declare reduction(+ : arma::vec : omp_out += omp_in) \
#pragma omp declare reduction(+ : vec_3d : omp_out += omp_in) \
initializer(omp_priv = omp_orig)
/** @brief A class that simulates a Penning trap.
@@ -36,10 +34,10 @@ private:
double V_0; ///< Applied potential
double d; ///< Characteristic dimension
std::vector<Particle> particles; ///< The particles in the Penning trap
arma::vec::fixed<3> *k_v;
arma::vec::fixed<3> *k_r;
std::function<arma::vec(int, double)> v_funcs[4];
std::function<arma::vec(int, double)> r_funcs[4];
sim_arr k_v;
sim_arr k_r;
std::function<vec_3d(int, double)> v_funcs[4];
std::function<vec_3d(int, double)> r_funcs[4];
public:
/** @brief Set B_0, V_0 and d.
@@ -58,33 +56,33 @@ public:
/** @brief Calculate E at point r
* */
arma::vec external_E_field(arma::vec r);
vec_3d external_E_field(vec_3d r);
/** @brief Calculate B at point r
* */
arma::vec external_B_field(arma::vec r);
vec_3d external_B_field(vec_3d r);
/** @brief Calculate the force between 2 particles.
*
* @details Calculate the force exhibited on particle p_i from
* particle p_j.
* */
arma::vec force_on_particle(int i, int j);
vec_3d force_on_particle(int i, int j);
/** @brief Calculate the total external force on a particle.
*
* @details Calculate the total amount of force that E and B exhibits
* on particle p_i.
* */
arma::vec total_force_external(int i);
vec_3d total_force_external(int i);
/** @brief Calculate the total force on a particle from other particles.
* */
arma::vec total_force_particles(int i);
vec_3d total_force_particles(unsigned int i);
/** @brief calculate the total force on a particle.
* */
arma::vec total_force(int i);
vec_3d total_force(int i);
/** @brief Go forward one timestep using the RK4 method
* */
@@ -94,8 +92,9 @@ public:
* */
void evolve_forward_euler(double dt, bool particle_interaction = true);
sim_arr simulate(double time, int steps, std::string method = "rk4",
bool particle_interaction = true);
sim_arr simulate(double time, unsigned int steps,
std::string method = "rk4",
bool particle_interaction = true);
void write_simulation_to_dir(std::string path, double time, int steps,
std::string method = "rk4",