From: Marc Fehling Date: Thu, 10 Mar 2022 05:04:26 +0000 (-0700) Subject: Reserve internal container with correct size. X-Git-Tag: v9.4.0-rc1~385^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a79542f2e7f6b62cd65683b2e2eb4aa60be4cda3;p=dealii.git Reserve internal container with correct size. --- 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