From 9dc46132c2cf39d62c622018149ee7fd2757f4e7 Mon Sep 17 00:00:00 2001 From: Simon Sticko Date: Sat, 9 Sep 2023 10:00:05 +0200 Subject: [PATCH] Fix address boundary error in FEInterfaceValues::get_update_flags() The function did not use the correct internal pointer in hp-mode. --- include/deal.II/fe/fe_interface_values.h | 5 +- tests/feinterface/fe_interface_values_16.cc | 68 +++++++++++++++++++ .../feinterface/fe_interface_values_16.output | 2 + 3 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 tests/feinterface/fe_interface_values_16.cc create mode 100644 tests/feinterface/fe_interface_values_16.output diff --git a/include/deal.II/fe/fe_interface_values.h b/include/deal.II/fe/fe_interface_values.h index bb40e4ef56..fde90abc77 100644 --- a/include/deal.II/fe/fe_interface_values.h +++ b/include/deal.II/fe/fe_interface_values.h @@ -2698,7 +2698,10 @@ template UpdateFlags FEInterfaceValues::get_update_flags() const { - return internal_fe_face_values->get_update_flags(); + if (has_hp_capabilities()) + return internal_hp_fe_face_values->get_update_flags(); + else + return internal_fe_face_values->get_update_flags(); } diff --git a/tests/feinterface/fe_interface_values_16.cc b/tests/feinterface/fe_interface_values_16.cc new file mode 100644 index 0000000000..dc0d3de440 --- /dev/null +++ b/tests/feinterface/fe_interface_values_16.cc @@ -0,0 +1,68 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2018 - 2023 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + + +#include + +#include +#include +#include + +#include "../tests.h" + + +/** + * Test that we can call get_update_flags() on FEInterfaceValues. Test added + * because this previously led to an address boundary error when using the hp + * capabilities. + */ +template +void +test() +{ + const MappingQ mapping(1); + const hp::MappingCollection mapping_collection(mapping); + + const FE_Q fe(1); + const hp::FECollection fe_collection(fe); + + const QGauss quadrature(fe.degree + 1); + const hp::QCollection q_collection(quadrature); + + const UpdateFlags update_flags = update_default; + + { + FEInterfaceValues fiv(mapping_collection, + fe_collection, + q_collection, + update_flags); + fiv.get_update_flags(); + } + { + FEInterfaceValues fiv(mapping, fe, quadrature, update_flags); + fiv.get_update_flags(); + } + + deallog << "OK" << std::endl; +} + + + +int +main() +{ + initlog(); + test<2>(); +} diff --git a/tests/feinterface/fe_interface_values_16.output b/tests/feinterface/fe_interface_values_16.output new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/feinterface/fe_interface_values_16.output @@ -0,0 +1,2 @@ + +DEAL::OK -- 2.39.5