From 9a45ef08532b62dee54bd74b1848e90a3dfe574f Mon Sep 17 00:00:00 2001 From: David Wells Date: Wed, 19 May 2021 13:00:24 -0400 Subject: [PATCH] Fix some GCC11 warnings. --- source/fe/fe_nedelec.cc | 15 ++++++++------- source/fe/fe_nedelec_sz.cc | 17 +++++++++-------- 2 files changed, 17 insertions(+), 15 deletions(-) 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; } -- 2.39.5