]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Rename variables in AlignedVector::reserve().
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 5 Apr 2021 21:26:59 +0000 (15:26 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 6 Apr 2021 02:14:56 +0000 (20:14 -0600)
include/deal.II/base/aligned_vector.h

index 454697162d40ef51e5b13547ffcf4b7269933ef1..978f6e19b118d76b59842754873815e341511e91 100644 (file)
@@ -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<T>::resize(const size_type size_in, const T &init)
 
 template <class T>
 inline void
-AlignedVector<T>::reserve(const size_type size_alloc)
+AlignedVector<T>::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<T>::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<T>(elements.get(),
                                                elements.get() + old_size,
                                                new_data.get());
@@ -927,7 +927,7 @@ AlignedVector<T>::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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.