From: Wolfgang Bangerth Date: Thu, 6 Apr 2023 21:19:21 +0000 (-0600) Subject: Don't overallocate memory. X-Git-Tag: v9.5.0-rc1~368^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c237b4cc10280448736ba565229bcb99b253c640;p=dealii.git Don't overallocate memory. --- diff --git a/source/grid/grid_tools_cache.cc b/source/grid/grid_tools_cache.cc index 4caa9a671a..d6e873cad3 100644 --- a/source/grid/grid_tools_cache.cc +++ b/source/grid/grid_tools_cache.cc @@ -155,7 +155,12 @@ namespace GridTools BoundingBox, typename Triangulation::active_cell_iterator>> boxes; - boxes.reserve(tria->n_active_cells()); + if (const parallel::TriangulationBase *parallel_tria = + dynamic_cast *>( + &*tria)) + boxes.reserve(parallel_tria->n_locally_owned_active_cells()); + else + boxes.reserve(tria->n_active_cells()); for (const auto &cell : tria->active_cell_iterators() | IteratorFilters::LocallyOwnedCell()) boxes.emplace_back(mapping->get_bounding_box(cell), cell);