From: Wolfgang Bangerth Date: Fri, 1 Feb 2019 15:04:58 +0000 (-0700) Subject: Simplify some code. X-Git-Tag: v9.1.0-rc1~378^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F7674%2Fhead;p=dealii.git Simplify some code. --- 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()); }