From 0307bf1063b1106a2a2b42a35d78bd8a3a800dbe Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 3 Oct 2017 15:39:39 -0600 Subject: [PATCH] Minor optimization of some memory allocation. --- include/deal.II/numerics/vector_tools.templates.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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>( -- 2.39.5