From: David Wells Date: Sat, 16 Oct 2021 18:32:53 +0000 (-0400) Subject: Use some more std::arrays. X-Git-Tag: v9.4.0-rc1~932^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=474e23bd6755e4dd4b929e39fe4394c8ed36b7d5;p=dealii.git Use some more std::arrays. Incredibly, on my machine with max optimizations, valgrind complains about unknown instructions with std::vector but does not with std::array. --- diff --git a/source/grid/grid_generator.cc b/source/grid/grid_generator.cc index c15c2a6352..a494186787 100644 --- a/source/grid/grid_generator.cc +++ b/source/grid/grid_generator.cc @@ -2564,7 +2564,7 @@ namespace GridGenerator } // calculate deltas and validate input - std::vector> delta(dim); + std::array, dim> delta; for (unsigned int i = 0; i < dim; ++i) { Assert(repetitions[i] >= 1, ExcInvalidRepetitions(repetitions[i])); @@ -3077,8 +3077,8 @@ namespace GridGenerator Assert(spacing.size() == dim, ExcInvalidRepetitionsDimension(dim)); - std::vector repetitions(dim); - double delta = std::numeric_limits::max(); + std::array repetitions; + double delta = std::numeric_limits::max(); for (unsigned int i = 0; i < dim; ++i) { repetitions[i] = spacing[i].size(); @@ -3192,8 +3192,8 @@ namespace GridGenerator // are >= 1, and calculate deltas // convert repetitions from double // to int by taking the ceiling. - std::vector> delta(dim); - unsigned int repetitions[dim]; + std::array, dim> delta; + std::array repetitions; for (unsigned int i = 0; i < dim; ++i) { Assert(holes[i] >= 1,