]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix particle duplication + tests
authorBruno Blais <blais.bruno@gmail.com>
Tue, 8 Jun 2021 17:05:21 +0000 (13:05 -0400)
committerBruno Blais <blais.bruno@gmail.com>
Tue, 8 Jun 2021 21:13:18 +0000 (17:13 -0400)
source/particles/particle_handler.cc
tests/particles/particle_handler_06.cc
tests/particles/particle_handler_14.cc
tests/particles/particle_handler_19.cc

index c820e18ef866f2db7d9f7299ae433c4e0700cb4f..e7158cc600d25aac0fea054ff8c5f11066126a8d 100644 (file)
@@ -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;
           }
 
index 83fa81748f852eb858c2f31c903694f4c0b12f28..516c34fce54aacd9a8be7ef77ab2bcfde1c4369d 100644 (file)
@@ -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<dim, spacedim>::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();
index bb0c0b4fb4b3149abc17bb5629e048886f2bdfcc..e2aef329177aa7ae52c07115e26cfb16ea188a05 100644 (file)
@@ -46,7 +46,12 @@ test()
                                               Point<dim>(),
                                               0);
 
-  particle_handler.insert_particle(particle, tr.begin_active());
+  typename Triangulation<dim, spacedim>::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
index 7c46f453b32d2c8f3aadaa69717a582758bdabba..6721a529bae9e4f5b9c2a18df2308d4910b7dcf4 100644 (file)
@@ -61,6 +61,9 @@ test()
       Utilities::MPI::this_mpi_process(tr.get_communicator()));
     typename Triangulation<dim, spacedim>::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();

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.