From: Bruno Blais Date: Tue, 8 Jun 2021 17:05:21 +0000 (-0400) Subject: Fix particle duplication + tests X-Git-Tag: v9.4.0-rc1~1248^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5ab44718ce1f058b2623bb04004ad9243c6aaf9;p=dealii.git Fix particle duplication + tests --- diff --git a/source/particles/particle_handler.cc b/source/particles/particle_handler.cc index c820e18ef8..e7158cc600 100644 --- a/source/particles/particle_handler.cc +++ b/source/particles/particle_handler.cc @@ -468,6 +468,10 @@ namespace Particles { Assert(triangulation != nullptr, ExcInternalError()); Assert(cell.state() == IteratorState::valid, ExcInternalError()); + Assert( + cell->is_locally_owned(), + ExcMessage( + "You can't insert particles in a cell that is not locally owned.")); if (particles.size() == 0) particles.resize(triangulation->n_active_cells()); @@ -1070,11 +1074,6 @@ namespace Particles // not locally owned cells have to be resorted or transferred. if (cell->is_locally_owned() == false) { - for (unsigned int i = 0; i < n_pic; ++i) - { - particles_out_of_cell.push_back( - particle_iterator(particles, *property_pool, cell, i)); - } continue; } diff --git a/tests/particles/particle_handler_06.cc b/tests/particles/particle_handler_06.cc index 83fa81748f..516c34fce5 100644 --- a/tests/particles/particle_handler_06.cc +++ b/tests/particles/particle_handler_06.cc @@ -58,10 +58,13 @@ test() reference_position, Utilities::MPI::this_mpi_process(tr.get_communicator())); - // We give a random cell hint to check that sorting and + // We give a local random cell hint to check that sorting and // transferring ghost particles works. typename Triangulation::active_cell_iterator cell = tr.begin_active(); + while (!cell->is_locally_owned()) + ++cell; + particle_handler.insert_particle(particle, cell); particle_handler.sort_particles_into_subdomains_and_cells(); diff --git a/tests/particles/particle_handler_14.cc b/tests/particles/particle_handler_14.cc index bb0c0b4fb4..e2aef32917 100644 --- a/tests/particles/particle_handler_14.cc +++ b/tests/particles/particle_handler_14.cc @@ -46,7 +46,12 @@ test() Point(), 0); - particle_handler.insert_particle(particle, tr.begin_active()); + typename Triangulation::active_cell_iterator cell = + tr.begin_active(); + while (!cell->is_locally_owned()) + ++cell; + + particle_handler.insert_particle(particle, cell); particle_handler.update_cached_numbers(); // initiate data transfer diff --git a/tests/particles/particle_handler_19.cc b/tests/particles/particle_handler_19.cc index 7c46f453b3..6721a529ba 100644 --- a/tests/particles/particle_handler_19.cc +++ b/tests/particles/particle_handler_19.cc @@ -61,6 +61,9 @@ test() Utilities::MPI::this_mpi_process(tr.get_communicator())); typename Triangulation::active_cell_iterator cell = tr.begin_active(); + while (!cell->is_locally_owned()) + ++cell; + particle_handler.insert_particle(particle, cell); particle_handler.sort_particles_into_subdomains_and_cells();