]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Minor optimization of some memory allocation.
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 3 Oct 2017 21:39:39 +0000 (15:39 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 5 Oct 2017 17:13:47 +0000 (11:13 -0600)
include/deal.II/numerics/vector_tools.templates.h

index 9bccee6e312eeddc05d07563f878825d25a4ffbf..db5f59919c7d37c32739442ada3ffd7a499eea6d 100644 (file)
@@ -138,10 +138,10 @@ namespace VectorTools
               auto shifted_view = boost::make_iterator_range(
                                     std::begin(function_values[i]) + offset,
                                     std::begin(function_values[i]) + offset + dim);
-              std::vector<number> old_value;
+              std::vector<number> old_value(dim);
               std::copy(std::begin(shifted_view),
                         std::end(shifted_view),
-                        std::back_inserter(old_value));
+                        std::begin(old_value));
 
               // value[m] <- sum jacobian_transpose[m][n] * old_value[n]:
               TensorAccessors::contract<1, 2, 1, dim>(
@@ -167,10 +167,10 @@ namespace VectorTools
               auto shifted_view = boost::make_iterator_range(
                                     std::begin(function_values[i]) + offset,
                                     std::begin(function_values[i]) + offset + dim);
-              std::vector<number> old_value;
+              std::vector<number> old_value(dim);
               std::copy(std::begin(shifted_view),
                         std::end(shifted_view),
-                        std::back_inserter(old_value));
+                        std::begin(old_value));
 
               // value[m] <- sum inverse_jacobians[m][n] * old_value[n]:
               TensorAccessors::contract<1, 2, 1, dim>(

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.