]> https://gitweb.dealii.org/ - dealii.git/commitdiff
ensure allocation of an even number of elements 3256/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sun, 16 Oct 2016 16:08:55 +0000 (18:08 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sun, 16 Oct 2016 18:34:08 +0000 (20:34 +0200)
include/deal.II/lac/vector_operations_internal.h

index 593256c0ebb83f9eb85cc327991605dc10ae1506..54167ff4d6d0ca7ab62f2e574eeb4100b57aacfe 100644 (file)
@@ -1146,7 +1146,9 @@ namespace internal
 
       if (n_chunks > threshold_array_allocate)
         {
-          large_array.resize(n_chunks);
+          // make sure we allocate an even number of elements,
+          // access to the new last element is needed in do_sum()
+          large_array.resize(2*((n_chunks+1)/2));
           array_ptr = &large_array[0];
         }
       else

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.