From a79542f2e7f6b62cd65683b2e2eb4aa60be4cda3 Mon Sep 17 00:00:00 2001 From: Marc Fehling Date: Wed, 9 Mar 2022 22:04:26 -0700 Subject: [PATCH] Reserve internal container with correct size. --- source/distributed/tria.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/source/distributed/tria.cc b/source/distributed/tria.cc index 39f76f1e9f..257c0ccac2 100644 --- a/source/distributed/tria.cc +++ b/source/distributed/tria.cc @@ -4041,13 +4041,10 @@ namespace parallel static_cast(parallel_forest->local_num_quadrants), ExcInternalError()); - // Allocate the space for the weights. In fact we do not know yet, how - // many cells we own after the refinement (only p4est knows that - // at this point). We simply reserve n_active_cells space and if many - // more cells are refined than coarsened than additional reallocation - // will be done inside get_cell_weights_recursively. + // Allocate the space for the weights. We reserve an integer for each + // locally owned quadrant on the already refined p4est object. std::vector weights; - weights.reserve(this->n_active_cells()); + weights.reserve(this->local_cell_relations.size()); // Iterate over p4est and Triangulation relations // to find refined/coarsened/kept -- 2.39.5