From c08769422a8c0775fde64452a9ef57d345fc3892 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 1 Feb 2019 08:04:58 -0700 Subject: [PATCH] Simplify some code. --- include/deal.II/base/tensor_function.templates.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/include/deal.II/base/tensor_function.templates.h b/include/deal.II/base/tensor_function.templates.h index d760d22070..11c2f54cb7 100644 --- a/include/deal.II/base/tensor_function.templates.h +++ b/include/deal.II/base/tensor_function.templates.h @@ -123,9 +123,8 @@ template typename TensorFunction::gradient_type ConstantTensorFunction::gradient(const Point &) const { - static const Tensor zero{}; - - return zero; + // Return a zero (=default initialized) tensor + return {}; } @@ -140,10 +139,10 @@ ConstantTensorFunction::gradient_list( Assert(gradients.size() == points.size(), ExcDimensionMismatch(gradients.size(), points.size())); - static const Tensor zero{}; - - for (unsigned int i = 0; i < gradients.size(); ++i) - gradients[i] = zero; + // Return an array of zero tensors. + std::fill(gradients.begin(), + gradients.end(), + typename TensorFunction::gradient_type()); } -- 2.39.5