From: Luca Heltai Date: Mon, 13 Jan 2020 20:06:22 +0000 (+0100) Subject: Apply suggestions from code review X-Git-Tag: v9.2.0-rc1~635^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=071ff3c2b33696cc9b4aeb1b9c4d914f96caccc2;p=dealii.git Apply suggestions from code review Co-Authored-By: Wolfgang Bangerth --- diff --git a/include/deal.II/particles/particle_handler.h b/include/deal.II/particles/particle_handler.h index ef402cbd38..59b361cd5e 100644 --- a/include/deal.II/particles/particle_handler.h +++ b/include/deal.II/particles/particle_handler.h @@ -304,9 +304,11 @@ namespace Particles * `input_vector[id*spacedim]`. * * If the argument @p displace_particles is set to false, then the new - * position is computed by setting it to the values contained in - * @p input_vector. By default, the particles are displaced of the - * amount contained in the @p input_vector. + * position taken from the values contained in + * @p input_vector, replacing the previously stored particle position. + * By default, the particles are displaced by the amount contained in the + * @p input_vector, i.e., the contents of the vector are considered + * *offsets* that are added to the previous position. * * After setting the new position, this function calls internally the method * sort_particles_into_subdomains_and_cells(). You should @@ -337,11 +339,11 @@ namespace Particles * @param [in] new_positions A vector of points of dimension * particle_handler.n_locally_owned_particles() * - * @param [in] displace_particles When true, this add the value of the - * vector of points to the + * @param [in] displace_particles When true, this function adds the value + * of the vector of points to the * current position of the particle, thus displacing them by the * amount given by the function. When false, the position of the - * particle is replaced by the value in the vector + * particle is replaced by the value in the vector. * * @authors Bruno Blais, Luca Heltai (2019) */ @@ -360,10 +362,10 @@ namespace Particles * @param [in] function A function that has n_components==spacedim that * describes either the displacement or the new position of the particles * - * @param [in] displace_particles When true, this add the results of the - * function to the current position of the particle, thus displacing them by - * the amount given by the function. When false, the position of the - * particle is is replaced by the value of the function + * @param [in] displace_particles When true, this function adds the results + * of the function to the current position of the particle, thus displacing + * them by the amount given by the function. When false, the position of the + * particle is replaced by the value of the function. * * @authors Bruno Blais, Luca Heltai (2019) */ @@ -787,7 +789,7 @@ namespace Particles get_next_free_particle_index() * spacedim); for (const auto &p : *this) { - auto & point = p.get_location(); + auto point = p.get_location(); const auto id = p.get_id(); if (add_to_output_vector) for (unsigned int i = 0; i < spacedim; ++i) diff --git a/source/particles/particle_handler.cc b/source/particles/particle_handler.cc index 06ee06ba5d..10cc945d00 100644 --- a/source/particles/particle_handler.cc +++ b/source/particles/particle_handler.cc @@ -779,7 +779,7 @@ namespace Particles function.vector_value(particle_location, new_position); if (displace_particles) for (unsigned int d = 0; d < spacedim; ++d) - particle_location[d] = particle_location[d] + new_position[d]; + particle_location[d] += new_position[d]; else for (unsigned int d = 0; d < spacedim; ++d) particle_location[d] = new_position[d];