From: Rene Gassmoeller Date: Thu, 10 Jun 2021 15:21:49 +0000 (-0400) Subject: Add some reasonable asserts X-Git-Tag: v9.4.0-rc1~1236^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12434%2Fhead;p=dealii.git Add some reasonable asserts --- diff --git a/source/particles/particle_handler.cc b/source/particles/particle_handler.cc index 0ee9956db9..f8f824bcb5 100644 --- a/source/particles/particle_handler.cc +++ b/source/particles/particle_handler.cc @@ -464,7 +464,8 @@ namespace Particles const typename Triangulation::active_cell_iterator &cell) { Assert(triangulation != nullptr, ExcInternalError()); - Assert(particles.size() == triangulation->n_active_cells(),ExcInternalError()); + Assert(particles.size() == triangulation->n_active_cells(), + ExcInternalError()); Assert( cell->is_locally_owned(), ExcMessage( @@ -496,7 +497,8 @@ namespace Particles const ArrayView &properties) { Assert(triangulation != nullptr, ExcInternalError()); - Assert(particles.size() == triangulation->n_active_cells(),ExcInternalError()); + Assert(particles.size() == triangulation->n_active_cells(), + ExcInternalError()); Assert(cell.state() == IteratorState::valid, ExcInternalError()); Assert( cell->is_locally_owned(), @@ -1043,6 +1045,10 @@ namespace Particles void ParticleHandler::sort_particles_into_subdomains_and_cells() { + Assert(triangulation != nullptr, ExcInternalError()); + Assert(particles.size() == triangulation->n_active_cells(), + ExcInternalError()); + // TODO: The current algorithm only works for particles that are in // the local domain or in ghost cells, because it only knows the // subdomain_id of ghost cells, but not of artificial cells. This @@ -1425,6 +1431,10 @@ namespace Particles & send_cells, const bool build_cache) { + Assert(triangulation != nullptr, ExcInternalError()); + Assert(received_particles.size() == triangulation->n_active_cells(), + ExcInternalError()); + ghost_particles_cache.valid = build_cache; const auto parallel_triangulation = @@ -1714,10 +1724,6 @@ namespace Particles & particles_to_send, particle_container &updated_particles) { - const auto &neighbors = ghost_particles_cache.neighbors; - const auto &send_pointers = ghost_particles_cache.send_pointers; - const auto &recv_pointers = ghost_particles_cache.recv_pointers; - const auto parallel_triangulation = dynamic_cast *>( &*triangulation); @@ -1727,6 +1733,13 @@ namespace Particles "This function is only implemented for parallel::TriangulationBase " "objects.")); + Assert(updated_particles.size() == parallel_triangulation->n_active_cells(), + ExcInternalError()); + + const auto &neighbors = ghost_particles_cache.neighbors; + const auto &send_pointers = ghost_particles_cache.send_pointers; + const auto &recv_pointers = ghost_particles_cache.recv_pointers; + std::vector &send_data = ghost_particles_cache.send_data; // Fill data to send