From: Peter Munch Date: Sat, 1 May 2021 10:03:36 +0000 (+0200) Subject: Rename ParticleHandler::locally_relevant_ids() to locally_owned_particles() X-Git-Tag: v9.3.0-rc1~150^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c1fb0a9ffbb9729dd56d896af9b60d818ab9368;p=dealii.git Rename ParticleHandler::locally_relevant_ids() to locally_owned_particles() --- diff --git a/doc/news/changes/incompatibilities/20210501Munch b/doc/news/changes/incompatibilities/20210501Munch new file mode 100644 index 0000000000..87e26369dd --- /dev/null +++ b/doc/news/changes/incompatibilities/20210501Munch @@ -0,0 +1,4 @@ +Renamed: The function ParticleHandler::locally_relevant_ids() has been deprecated. +Please use the new function ParticleHandler::locally_owned_particle_ids() instead. +
+(Peter Munch, 2021/05/01) diff --git a/examples/step-70/step-70.cc b/examples/step-70/step-70.cc index 8ddfb1f216..d5a2aced9b 100644 --- a/examples/step-70/step-70.cc +++ b/examples/step-70/step-70.cc @@ -1062,7 +1062,7 @@ namespace Step70 // successive vector elements (this is what the IndexSet::tensor_priduct() // function does). locally_owned_tracer_particle_coordinates = - tracer_particle_handler.locally_relevant_ids().tensor_product( + tracer_particle_handler.locally_owned_particle_ids().tensor_product( complete_index_set(spacedim)); // At the beginning of the simulation, all particles are in their original @@ -1865,7 +1865,7 @@ namespace Step70 tracer_particle_velocities *= time_step; locally_relevant_tracer_particle_coordinates = - tracer_particle_handler.locally_relevant_ids().tensor_product( + tracer_particle_handler.locally_owned_particle_ids().tensor_product( complete_index_set(spacedim)); relevant_tracer_particle_displacements.reinit( diff --git a/include/deal.II/particles/particle_handler.h b/include/deal.II/particles/particle_handler.h index 267dfe30af..87f8c1e444 100644 --- a/include/deal.II/particles/particle_handler.h +++ b/include/deal.II/particles/particle_handler.h @@ -444,10 +444,10 @@ namespace Particles * * The vector @p input_vector should have read access to the indices * created by extracting the locally relevant ids with - * locally_relevant_ids(), and taking its tensor + * locally_owned_particle_ids(), and taking its tensor * product with the index set representing the range `[0, spacedim)`, i.e.: * @code - * IndexSet ids = particle_handler.locally_relevant_ids(). + * IndexSet ids = particle_handler.locally_owned_particle_ids(). * tensor_product(complete_index_set(spacedim)); * @endcode * @@ -497,7 +497,7 @@ namespace Particles * get_particle_positions() function, and then modify the resulting vector. * * @param [in] new_positions A vector of points of dimension - * particle_handler.n_locally_owned_particles() + * particle_handler.n_locally_owned_particle_ids() * * @param [in] displace_particles When true, this function adds the value * of the vector of points to the @@ -641,7 +641,7 @@ namespace Particles * triangulation. */ types::particle_index - n_locally_owned_particles() const; + n_locally_owned_particle_ids() const; /** * Return the next free particle index in the global set @@ -651,6 +651,27 @@ namespace Particles types::particle_index get_next_free_particle_index() const; + /** + * Extract an IndexSet with global dimensions equal to + * get_next_free_particle_index(), containing the locally owned + * particle indices. + * + * This function can be used to construct distributed vectors and matrices + * to manipulate particles using linear algebra operations. + * + * Notice that it is the user's responsibility to guarantee that particle + * indices are unique, and no check is performed to verify that this is the + * case, nor that the union of all IndexSet objects on each mpi process is + * complete. + * + * @return An IndexSet of size get_next_free_particle_index(), containing + * n_locally_owned_particle() indices. + * + * @deprecated Use locally_owned_particle_ids() instead. + */ + DEAL_II_DEPRECATED IndexSet + locally_relevant_ids() const; + /** * Extract an IndexSet with global dimensions equal to * get_next_free_particle_index(), containing the locally owned @@ -668,7 +689,7 @@ namespace Particles * n_locally_owned_particle() indices. */ IndexSet - locally_relevant_ids() const; + locally_owned_particle_ids() const; /** * Return the number of properties each particle has. @@ -1146,6 +1167,15 @@ namespace Particles output_vector.compress(VectorOperation::insert); } + + + template + inline IndexSet + ParticleHandler::locally_relevant_ids() const + { + return this->locally_owned_particle_ids(); + } + } // namespace Particles DEAL_II_NAMESPACE_CLOSE diff --git a/include/deal.II/particles/utilities.h b/include/deal.II/particles/utilities.h index 3b60163226..b6721504a8 100644 --- a/include/deal.II/particles/utilities.h +++ b/include/deal.II/particles/utilities.h @@ -191,7 +191,7 @@ namespace Particles OutputVectorType & interpolated_field, const ComponentMask &field_comps = ComponentMask()) { - if (particle_handler.n_locally_owned_particles() == 0) + if (particle_handler.n_locally_owned_particle_ids() == 0) { interpolated_field.compress(VectorOperation::add); return; // nothing else to do here diff --git a/source/particles/data_out.cc b/source/particles/data_out.cc index 9c016d5f06..b3de658979 100644 --- a/source/particles/data_out.cc +++ b/source/particles/data_out.cc @@ -40,7 +40,7 @@ namespace Particles "belong to a single vector or tensor.")); if ((data_component_names.size() > 0) && - (particles.n_locally_owned_particles() > 0)) + (particles.n_locally_owned_particle_ids() > 0)) { Assert( particles.begin()->has_properties(), @@ -75,7 +75,7 @@ namespace Particles const unsigned int n_property_components = data_component_names.size(); const unsigned int n_data_components = dataset_names.size(); - patches.resize(particles.n_locally_owned_particles()); + patches.resize(particles.n_locally_owned_particle_ids()); auto particle = particles.begin(); for (unsigned int i = 0; particle != particles.end(); ++particle, ++i) diff --git a/source/particles/particle_handler.cc b/source/particles/particle_handler.cc index 514ba68a18..db3be26395 100644 --- a/source/particles/particle_handler.cc +++ b/source/particles/particle_handler.cc @@ -767,7 +767,7 @@ namespace Particles template types::particle_index - ParticleHandler::n_locally_owned_particles() const + ParticleHandler::n_locally_owned_particle_ids() const { return particles.size(); } @@ -794,7 +794,7 @@ namespace Particles template IndexSet - ParticleHandler::locally_relevant_ids() const + ParticleHandler::locally_owned_particle_ids() const { IndexSet set(get_next_free_particle_index()); for (const auto &p : *this) @@ -812,7 +812,7 @@ namespace Particles const bool add_to_output_vector) { // There should be one point per particle to gather - AssertDimension(positions.size(), n_locally_owned_particles()); + AssertDimension(positions.size(), n_locally_owned_particle_ids()); unsigned int i = 0; for (auto it = begin(); it != end(); ++it, ++i) @@ -833,7 +833,7 @@ namespace Particles const bool displace_particles) { // There should be one point per particle to fix the new position - AssertDimension(new_positions.size(), n_locally_owned_particles()); + AssertDimension(new_positions.size(), n_locally_owned_particle_ids()); unsigned int i = 0; for (auto it = begin(); it != end(); ++it, ++i) @@ -929,7 +929,7 @@ namespace Particles // processes around (with an invalid cell). std::vector particles_out_of_cell; - particles_out_of_cell.reserve(n_locally_owned_particles()); + particles_out_of_cell.reserve(n_locally_owned_particle_ids()); // Now update the reference locations of the moved particles std::vector> real_locations; diff --git a/source/particles/utilities.cc b/source/particles/utilities.cc index c90a04079f..b8d32727b6 100644 --- a/source/particles/utilities.cc +++ b/source/particles/utilities.cc @@ -36,7 +36,7 @@ namespace Particles const AffineConstraints & constraints, const ComponentMask & space_comps) { - if (particle_handler.n_locally_owned_particles() == 0) + if (particle_handler.n_locally_owned_particle_ids() == 0) return; // nothing to do here const auto &tria = space_dh.get_triangulation(); @@ -119,7 +119,7 @@ namespace Particles const AffineConstraints &constraints, const ComponentMask & space_comps) { - if (particle_handler.n_locally_owned_particles() == 0) + if (particle_handler.n_locally_owned_particle_ids() == 0) { matrix.compress(VectorOperation::add); return; // nothing else to do here diff --git a/tests/particles/extract_index_set_01.cc b/tests/particles/extract_index_set_01.cc index d341cee3b7..4ec1b119c9 100644 --- a/tests/particles/extract_index_set_01.cc +++ b/tests/particles/extract_index_set_01.cc @@ -13,7 +13,7 @@ // // --------------------------------------------------------------------- -// Test ParticleHandler::locally_relevant_ids(). +// Test ParticleHandler::locally_owned_particle_ids(). #include #include @@ -63,7 +63,7 @@ test() auto cpu_to_index = particle_handler.insert_global_particles(points, global_bounding_boxes); - const auto set = particle_handler.locally_relevant_ids(); + const auto set = particle_handler.locally_owned_particle_ids(); deallog << "Local set: "; set.print(deallog); deallog << std::endl; diff --git a/tests/particles/interpolate_on_particle_01.cc b/tests/particles/interpolate_on_particle_01.cc index 1a49db8ce0..837e77b370 100644 --- a/tests/particles/interpolate_on_particle_01.cc +++ b/tests/particles/interpolate_on_particle_01.cc @@ -78,7 +78,7 @@ test() << particle_handler.n_global_particles() << std::endl; const auto n_local_particles_dofs = - particle_handler.n_locally_owned_particles() * n_comps; + particle_handler.n_locally_owned_particle_ids() * n_comps; auto particle_sizes = Utilities::MPI::all_gather(MPI_COMM_WORLD, n_local_particles_dofs); diff --git a/tests/particles/particle_interpolation_01.cc b/tests/particles/particle_interpolation_01.cc index abc6bd26f1..0d950ca732 100644 --- a/tests/particles/particle_interpolation_01.cc +++ b/tests/particles/particle_interpolation_01.cc @@ -99,7 +99,7 @@ test() space_dh, particle_handler, dsp, constraints, space_mask); const auto n_local_particles_dofs = - particle_handler.n_locally_owned_particles() * n_comps; + particle_handler.n_locally_owned_particle_ids() * n_comps; auto particle_sizes = Utilities::MPI::all_gather(MPI_COMM_WORLD, n_local_particles_dofs); diff --git a/tests/particles/particle_interpolation_02.cc b/tests/particles/particle_interpolation_02.cc index 5cacdff221..f06433a15f 100644 --- a/tests/particles/particle_interpolation_02.cc +++ b/tests/particles/particle_interpolation_02.cc @@ -103,7 +103,7 @@ test() space_dh, particle_handler, dsp, constraints, space_mask); const auto n_local_particles_dofs = - particle_handler.n_locally_owned_particles() * n_comps; + particle_handler.n_locally_owned_particle_ids() * n_comps; auto particle_sizes = Utilities::MPI::all_gather(MPI_COMM_WORLD, n_local_particles_dofs); diff --git a/tests/particles/particle_interpolation_03.cc b/tests/particles/particle_interpolation_03.cc index b3edfb11ce..b89d95bb2b 100644 --- a/tests/particles/particle_interpolation_03.cc +++ b/tests/particles/particle_interpolation_03.cc @@ -102,7 +102,7 @@ test() space_dh, particle_handler, dsp, constraints, space_mask); const auto n_local_particles_dofs = - particle_handler.n_locally_owned_particles() * n_comps; + particle_handler.n_locally_owned_particle_ids() * n_comps; auto particle_sizes = Utilities::MPI::all_gather(MPI_COMM_WORLD, n_local_particles_dofs); diff --git a/tests/particles/particle_interpolation_04.cc b/tests/particles/particle_interpolation_04.cc index 886e848890..c1f4a263b5 100644 --- a/tests/particles/particle_interpolation_04.cc +++ b/tests/particles/particle_interpolation_04.cc @@ -97,7 +97,7 @@ test() space_dh, particle_handler, dsp, constraints, space_mask); const auto n_local_particles_dofs = - particle_handler.n_locally_owned_particles() * n_comps; + particle_handler.n_locally_owned_particle_ids() * n_comps; auto particle_sizes = Utilities::MPI::all_gather(MPI_COMM_WORLD, n_local_particles_dofs); diff --git a/tests/particles/particle_interpolation_05.cc b/tests/particles/particle_interpolation_05.cc index 15c2c382f6..ca1ad396f2 100644 --- a/tests/particles/particle_interpolation_05.cc +++ b/tests/particles/particle_interpolation_05.cc @@ -99,7 +99,7 @@ test() space_dh, particle_handler, dsp, constraints, space_mask); const auto n_local_particles_dofs = - particle_handler.n_locally_owned_particles() * n_comps; + particle_handler.n_locally_owned_particle_ids() * n_comps; auto particle_sizes = Utilities::MPI::all_gather(MPI_COMM_WORLD, n_local_particles_dofs); diff --git a/tests/particles/set_particle_positions_01.cc b/tests/particles/set_particle_positions_01.cc index 03393d7220..7bec57ff5f 100644 --- a/tests/particles/set_particle_positions_01.cc +++ b/tests/particles/set_particle_positions_01.cc @@ -65,7 +65,7 @@ test() auto cpu_to_index = particle_handler.insert_global_particles(points, global_bounding_boxes); - const auto set = particle_handler.locally_relevant_ids().tensor_product( + const auto set = particle_handler.locally_owned_particle_ids().tensor_product( complete_index_set(spacedim)); TrilinosWrappers::MPI::Vector vector(set, MPI_COMM_WORLD); @@ -81,8 +81,9 @@ test() // Make sure we have a new index set - const auto new_set = particle_handler.locally_relevant_ids().tensor_product( - complete_index_set(spacedim)); + const auto new_set = + particle_handler.locally_owned_particle_ids().tensor_product( + complete_index_set(spacedim)); TrilinosWrappers::MPI::Vector new_vector(new_set, MPI_COMM_WORLD); diff --git a/tests/particles/set_particle_positions_02.cc b/tests/particles/set_particle_positions_02.cc index ae6853c9f7..c307a18d16 100644 --- a/tests/particles/set_particle_positions_02.cc +++ b/tests/particles/set_particle_positions_02.cc @@ -72,10 +72,10 @@ test() Tensor<1, spacedim> displacement; displacement[0] = 0.1; std::vector> new_particle_positions( - particle_handler.n_locally_owned_particles()); + particle_handler.n_locally_owned_particle_ids()); std::vector> old_particle_positions( - particle_handler.n_locally_owned_particles()); + particle_handler.n_locally_owned_particle_ids()); particle_handler.get_particle_positions(old_particle_positions); for (unsigned int i = 0; i < old_particle_positions.size(); ++i)