]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Applied suggestions.
authorLuca Heltai <luca.heltai@sissa.it>
Tue, 3 Dec 2019 07:38:36 +0000 (08:38 +0100)
committerLuca Heltai <luca.heltai@sissa.it>
Tue, 3 Dec 2019 07:38:36 +0000 (08:38 +0100)
include/deal.II/particles/particle_handler.h
source/particles/particle_handler.cc

index 1ce0eabac3574460b2f77f59b191b0b92443430c..67fb4b5e0967e6824f1ae4ce2193bd1389c47f61 100644 (file)
 #define dealii_particles_particle_handler_h
 
 #include <deal.II/base/array_view.h>
-#include <deal.II/base/data_out_base.h>
+#include <deal.II/base/bounding_box.h>
 #include <deal.II/base/mpi.h>
 #include <deal.II/base/smartpointer.h>
 #include <deal.II/base/subscriptor.h>
-#include <deal.II/base/utilities.h>
 
 #include <deal.II/distributed/tria.h>
 
 #include <deal.II/fe/mapping.h>
 
-#include <deal.II/grid/filtered_iterator.h>
-#include <deal.II/grid/grid_tools.h>
-#include <deal.II/grid/grid_tools_cache.h>
-
 #include <deal.II/particles/particle.h>
 #include <deal.II/particles/particle_iterator.h>
 #include <deal.II/particles/property_pool.h>
@@ -227,7 +222,7 @@ namespace Particles
      * This function takes a list of positions and creates a set of particles
      * at these positions, which are then added to the local particle
      * collection. Note that this function currently uses
-     * GridTools::compute_point_locations, which assumes all positions are
+     * GridTools::compute_point_locations(), which assumes all positions are
      * within the local part of the triangulation. If one of them is not in the
      * local domain this function will throw an exception.
      */
@@ -242,11 +237,11 @@ namespace Particles
      * GridTools::distributed_compute_point_locations. Consequently, it can
      * require intense communications between the processors.
      *
-     * This function figures out what mpi process owns all points that do not
+     * This function figures out what mpi process owns the points that do not
      * fall within the locally owned part of the triangulation, it sends
      * to that process the points passed to this function on this process,
      * and receives the points that fall within the locally owned cells of
-     * the triangulation from whoever owns them.
+     * the triangulation from whoever received them as input.
      *
      * In order to keep track of what mpi process received what points, a map
      * from mpi process to IndexSet is returned by the function. This IndexSet
@@ -292,7 +287,7 @@ namespace Particles
       const std::vector<Point<spacedim>> &positions,
       const std::vector<std::vector<BoundingBox<spacedim>>>
         &                        global_bounding_boxes,
-      const std::vector<double> &properties = std::vector<double>());
+      const std::vector<double> &properties = {});
 
     /**
      * This function allows to register three additional functions that are
index 555ecd3bb9db8f7b5c550764942558f2f615b6aa..31364e4921fb026c27135e9f604d595bf4723d0c 100644 (file)
@@ -463,7 +463,7 @@ namespace Particles
     GridTools::Cache<dim, spacedim> cache(*triangulation, *mapping);
 
     // Gather the number of points per processor
-    auto n_particles_per_proc =
+    const auto n_particles_per_proc =
       Utilities::MPI::all_gather(triangulation->get_communicator(),
                                  positions.size());
 
@@ -478,37 +478,34 @@ namespace Particles
         particle_start_index += n_particles_per_proc[process];
       }
 
-    auto distributed_tuple =
+    const auto distributed_tuple =
       GridTools::distributed_compute_point_locations(cache,
                                                      positions,
                                                      global_bounding_boxes);
 
     // Finally create the particles
-    std::vector<typename Triangulation<dim, spacedim>::active_cell_iterator>
-      local_cells_containing_particles = std::get<0>(distributed_tuple);
+    const auto &local_cells_containing_particles =
+      std::get<0>(distributed_tuple);
 
     // The reference position of every particle in the local part of the
     // triangulation.
-    std::vector<std::vector<Point<dim>>> local_reference_positions =
-      std::get<1>(distributed_tuple);
+    const auto &local_reference_positions = std::get<1>(distributed_tuple);
     // The original index in the positions vector for each particle in the local
     // part of the triangulation
-    std::vector<std::vector<unsigned int>> origin_indices_of_local_particles =
+    const auto &original_indices_of_local_particles =
       std::get<2>(distributed_tuple);
     // The real spatial position of every particle in the local part of the
     // triangulation.
-    std::vector<std::vector<Point<spacedim>>> local_positions =
-      std::get<3>(distributed_tuple);
+    const auto &local_positions = std::get<3>(distributed_tuple);
     // The MPI process that inserted each particle
-    std::vector<std::vector<unsigned int>> calling_process_index =
-      std::get<4>(distributed_tuple);
+    const auto &calling_process_index = std::get<4>(distributed_tuple);
 
     // Create the multimap of local particles
     std::multimap<typename Triangulation<dim, spacedim>::active_cell_iterator,
                   Particle<dim, spacedim>>
       particles;
 
-    // Create the map of cpu to indices, indicating whom sent us what
+    // Create the map of cpu to indices, indicating who sent us what
     // point
     std::map<unsigned int, IndexSet> origin_process_to_local_particle_indices;
 
@@ -521,7 +518,7 @@ namespace Particles
              ++i_particle)
           {
             const auto &local_id_on_calling_process =
-              origin_indices_of_local_particles[i_cell][i_particle];
+              original_indices_of_local_particles[i_cell][i_particle];
             const auto &calling_process =
               calling_process_index[i_cell][i_particle];
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.