From: Wolfgang Bangerth Date: Tue, 3 Oct 2017 21:39:39 +0000 (-0600) Subject: Minor optimization of some memory allocation. X-Git-Tag: v9.0.0-rc1~993^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0307bf1063b1106a2a2b42a35d78bd8a3a800dbe;p=dealii.git Minor optimization of some memory allocation. --- diff --git a/include/deal.II/numerics/vector_tools.templates.h b/include/deal.II/numerics/vector_tools.templates.h index 9bccee6e31..db5f59919c 100644 --- a/include/deal.II/numerics/vector_tools.templates.h +++ b/include/deal.II/numerics/vector_tools.templates.h @@ -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 old_value; + std::vector 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 old_value; + std::vector 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>(