]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add asserts where useful
authorRene Gassmoeller <rene.gassmoeller@mailbox.org>
Thu, 10 Jun 2021 15:14:22 +0000 (11:14 -0400)
committerRene Gassmoeller <rene.gassmoeller@mailbox.org>
Thu, 10 Jun 2021 15:14:44 +0000 (11:14 -0400)
source/particles/particle_handler.cc

index 97e9e50e88ec8a36a5d0273bffadfd7aa0281a25..0ee9956db9e1390584f50b58303ca8b957bdcc61 100644 (file)
@@ -464,6 +464,7 @@ namespace Particles
     const typename Triangulation<dim, spacedim>::active_cell_iterator &cell)
   {
     Assert(triangulation != nullptr, ExcInternalError());
+    Assert(particles.size() == triangulation->n_active_cells(),ExcInternalError());
     Assert(
       cell->is_locally_owned(),
       ExcMessage(
@@ -495,6 +496,7 @@ namespace Particles
     const ArrayView<const double> &properties)
   {
     Assert(triangulation != nullptr, ExcInternalError());
+    Assert(particles.size() == triangulation->n_active_cells(),ExcInternalError());
     Assert(cell.state() == IteratorState::valid, ExcInternalError());
     Assert(
       cell->is_locally_owned(),
@@ -529,8 +531,6 @@ namespace Particles
       typename Triangulation<dim, spacedim>::active_cell_iterator,
       Particle<dim, spacedim>> &new_particles)
   {
-    Assert(triangulation != nullptr, ExcInternalError());
-
     for (const auto &cell_and_particle : new_particles)
       insert_particle(cell_and_particle.second, cell_and_particle.first);
 

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.