--- /dev/null
+Renamed: The function ParticleHandler::locally_relevant_ids() has been deprecated.
+Please use the new function ParticleHandler::locally_owned_particle_ids() instead.
+<br>
+(Peter Munch, 2021/05/01)
// 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
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(
*
* 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
*
* 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
* 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
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
* n_locally_owned_particle() indices.
*/
IndexSet
- locally_relevant_ids() const;
+ locally_owned_particle_ids() const;
/**
* Return the number of properties each particle has.
output_vector.compress(VectorOperation::insert);
}
+
+
+ template <int dim, int spacedim>
+ inline IndexSet
+ ParticleHandler<dim, spacedim>::locally_relevant_ids() const
+ {
+ return this->locally_owned_particle_ids();
+ }
+
} // namespace Particles
DEAL_II_NAMESPACE_CLOSE
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
"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(),
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)
template <int dim, int spacedim>
types::particle_index
- ParticleHandler<dim, spacedim>::n_locally_owned_particles() const
+ ParticleHandler<dim, spacedim>::n_locally_owned_particle_ids() const
{
return particles.size();
}
template <int dim, int spacedim>
IndexSet
- ParticleHandler<dim, spacedim>::locally_relevant_ids() const
+ ParticleHandler<dim, spacedim>::locally_owned_particle_ids() const
{
IndexSet set(get_next_free_particle_index());
for (const auto &p : *this)
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)
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)
// processes around (with an invalid cell).
std::vector<particle_iterator> 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<Point<spacedim>> real_locations;
const AffineConstraints<number> & 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();
const AffineConstraints<typename MatrixType::value_type> &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
//
// ---------------------------------------------------------------------
-// Test ParticleHandler::locally_relevant_ids().
+// Test ParticleHandler::locally_owned_particle_ids().
#include <deal.II/base/mpi.h>
#include <deal.II/base/utilities.h>
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;
<< 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);
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);
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);
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);
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);
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);
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);
// 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);
Tensor<1, spacedim> displacement;
displacement[0] = 0.1;
std::vector<Point<spacedim>> new_particle_positions(
- particle_handler.n_locally_owned_particles());
+ particle_handler.n_locally_owned_particle_ids());
std::vector<Point<spacedim>> 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)