]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix address boundary error in FEInterfaceValues::get_update_flags() 15977/head
authorSimon Sticko <simon@sticko.se>
Sat, 9 Sep 2023 08:00:05 +0000 (10:00 +0200)
committerSimon Sticko <simon@sticko.se>
Sat, 9 Sep 2023 08:10:47 +0000 (10:10 +0200)
The function did not use the correct internal pointer in hp-mode.

include/deal.II/fe/fe_interface_values.h
tests/feinterface/fe_interface_values_16.cc [new file with mode: 0644]
tests/feinterface/fe_interface_values_16.output [new file with mode: 0644]

index bb40e4ef56a89ec21383a10be2416e7cf5d2f0c2..fde90abc77632e86148a8fb5610fda1311e828b7 100644 (file)
@@ -2698,7 +2698,10 @@ template <int dim, int spacedim>
 UpdateFlags
 FEInterfaceValues<dim, spacedim>::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 (file)
index 0000000..dc0d3de
--- /dev/null
@@ -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 <deal.II/base/quadrature_lib.h>
+
+#include <deal.II/fe/fe_interface_values.h>
+#include <deal.II/fe/fe_q.h>
+#include <deal.II/fe/mapping_q.h>
+
+#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 <int dim>
+void
+test()
+{
+  const MappingQ<dim>              mapping(1);
+  const hp::MappingCollection<dim> mapping_collection(mapping);
+
+  const FE_Q<dim>             fe(1);
+  const hp::FECollection<dim> fe_collection(fe);
+
+  const QGauss<dim - 1>          quadrature(fe.degree + 1);
+  const hp::QCollection<dim - 1> q_collection(quadrature);
+
+  const UpdateFlags update_flags = update_default;
+
+  {
+    FEInterfaceValues<dim> fiv(mapping_collection,
+                               fe_collection,
+                               q_collection,
+                               update_flags);
+    fiv.get_update_flags();
+  }
+  {
+    FEInterfaceValues<dim> 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 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.