From: David Wells Date: Wed, 19 May 2021 17:00:24 +0000 (-0400) Subject: Fix some GCC11 warnings. X-Git-Tag: v9.3.0-rc1~30^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a45ef08532b62dee54bd74b1848e90a3dfe574f;p=dealii.git Fix some GCC11 warnings. --- diff --git a/source/fe/fe_nedelec.cc b/source/fe/fe_nedelec.cc index 687aa2139a..8677b5dbad 100644 --- a/source/fe/fe_nedelec.cc +++ b/source/fe/fe_nedelec.cc @@ -2060,20 +2060,21 @@ template std::vector FE_Nedelec::get_dpo_vector(const unsigned int degree, bool dg) { - std::vector dpo(dim + 1); + std::vector dpo; if (dg) { + dpo.resize(dim + 1); dpo[dim] = PolynomialsNedelec::n_polynomials(degree); } else { - dpo[0] = 0; - dpo[1] = degree + 1; - dpo[2] = 2 * degree * (degree + 1); - - if (dim == 3) - dpo[3] = 3 * degree * degree * (degree + 1); + dpo.push_back(0); + dpo.push_back(degree + 1); + if (dim > 1) + dpo.push_back(2 * degree * (degree + 1)); + if (dim > 2) + dpo.push_back(3 * degree * degree * (degree + 1)); } return dpo; diff --git a/source/fe/fe_nedelec_sz.cc b/source/fe/fe_nedelec_sz.cc index 96d8751457..32e141c341 100644 --- a/source/fe/fe_nedelec_sz.cc +++ b/source/fe/fe_nedelec_sz.cc @@ -2240,14 +2240,15 @@ FE_NedelecSZ::get_dpo_vector(const unsigned int degree) // 1 = edge // 2 = face (which is a cell in 2D) // 3 = cell - std::vector dpo(dim + 1); - dpo[0] = 0; - dpo[1] = degree + 1; - dpo[2] = 2 * degree * (degree + 1); - if (dim == 3) - { - dpo[3] = 3 * degree * degree * (degree + 1); - } + std::vector dpo; + + dpo.push_back(0); + dpo.push_back(degree + 1); + if (dim > 1) + dpo.push_back(2 * degree * (degree + 1)); + if (dim > 2) + dpo.push_back(3 * degree * degree * (degree + 1)); + return dpo; }