#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>
* 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.
*/
* 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
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
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());
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;
++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];