From: Wolfgang Bangerth Date: Mon, 5 Apr 2021 21:26:59 +0000 (-0600) Subject: Rename variables in AlignedVector::reserve(). X-Git-Tag: v9.3.0-rc1~238^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=971a564736c71e8ebdcbe493ff3d6c2ac9d38d3e;p=dealii.git Rename variables in AlignedVector::reserve(). --- diff --git a/include/deal.II/base/aligned_vector.h b/include/deal.II/base/aligned_vector.h index 454697162d..978f6e19b1 100644 --- a/include/deal.II/base/aligned_vector.h +++ b/include/deal.II/base/aligned_vector.h @@ -185,7 +185,7 @@ public: * destructor at the old location). */ void - reserve(const size_type size_alloc); + reserve(const size_type new_allocated_size); /** * Releases all previously allocated memory and leaves the vector in a state @@ -890,18 +890,18 @@ AlignedVector::resize(const size_type size_in, const T &init) template inline void -AlignedVector::reserve(const size_type size_alloc) +AlignedVector::reserve(const size_type new_allocated_size) { - const size_type old_size = used_elements_end - elements.get(); - const size_type allocated_size = allocated_elements_end - elements.get(); - if (size_alloc > allocated_size) + const size_type old_size = used_elements_end - elements.get(); + const size_type old_allocated_size = allocated_elements_end - elements.get(); + if (new_allocated_size > old_allocated_size) { // if we continuously increase the size of the vector, we might be // reallocating a lot of times. therefore, try to increase the size more // aggressively - size_type new_size = size_alloc; - if (size_alloc < (2 * allocated_size)) - new_size = 2 * allocated_size; + size_type new_size = new_allocated_size; + if (new_allocated_size < (2 * old_allocated_size)) + new_size = 2 * old_allocated_size; const size_type size_actual_allocate = new_size * sizeof(T); @@ -915,7 +915,7 @@ AlignedVector::reserve(const size_type size_alloc) }); // copy whatever elements we need to retain - if (size_alloc > 0) + if (new_allocated_size > 0) dealii::internal::AlignedVectorMove(elements.get(), elements.get() + old_size, new_data.get()); @@ -927,7 +927,7 @@ AlignedVector::reserve(const size_type size_alloc) used_elements_end = elements.get() + old_size; allocated_elements_end = elements.get() + new_size; } - else if (size_alloc == 0) + else if (new_allocated_size == 0) clear(); else // size_alloc < allocated_size {} // nothing to do here