]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix FEFaceValues
authorAlexander Grayver <agrayver@erdw.ethz.ch>
Tue, 6 Nov 2018 14:19:16 +0000 (15:19 +0100)
committerAlexander Grayver <agrayver@erdw.ethz.ch>
Tue, 6 Nov 2018 14:19:16 +0000 (15:19 +0100)
source/fe/fe_nedelec_sz.cc
tests/fe/fe_nedelec_sz_face_values.cc [new file with mode: 0644]
tests/fe/fe_nedelec_sz_face_values.output [new file with mode: 0644]

index 54470ac551b6b97d779188f0dc9e083c09fe8565..b7832f3c23e35d1a5a6630e61956f2a38e5709be 100644 (file)
@@ -2093,12 +2093,15 @@ FE_NedelecSZ<dim, spacedim>::fill_fe_face_values(
     {
       // Now have all shape_grads stored on the reference cell.
       // Must now transform to the physical cell.
+      std::vector<Tensor<2, dim>> input(n_q_points);
       std::vector<Tensor<2, dim>> transformed_shape_grads(n_q_points);
       for (unsigned int dof = 0; dof < this->dofs_per_cell; ++dof)
         {
-          mapping.transform(make_array_view(fe_data.shape_grads[dof],
-                                            offset,
-                                            n_q_points),
+          for (unsigned int q = 0; q < n_q_points; ++q)
+            {
+              input[q] = fe_data.shape_grads[dof][offset + q];
+            }
+          mapping.transform(input,
                             mapping_covariant_gradient,
                             mapping_internal,
                             make_array_view(transformed_shape_grads));
diff --git a/tests/fe/fe_nedelec_sz_face_values.cc b/tests/fe/fe_nedelec_sz_face_values.cc
new file mode 100644 (file)
index 0000000..80ac565
--- /dev/null
@@ -0,0 +1,68 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 1998 - 2018 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.
+//
+// ---------------------------------------------------------------------
+//
+// By Alexander Grayver
+//
+// Fix bug with FEFaceValues initialization when used with FE_NedelecSZ
+
+#include <deal.II/base/quadrature_lib.h>
+
+#include <deal.II/dofs/dof_accessor.h>
+#include <deal.II/dofs/dof_handler.h>
+
+#include <deal.II/fe/fe_nedelec_sz.h>
+
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/tria.h>
+
+#include <iostream>
+#include <sstream>
+
+#include "../tests.h"
+
+using namespace dealii;
+
+template <int dim>
+void
+test(unsigned p)
+{
+  FE_NedelecSZ<dim>  fe(p);
+  Triangulation<dim> triangulation;
+
+  GridGenerator::hyper_cube(triangulation, -1., 1.);
+
+  DoFHandler<dim> dof_handler(triangulation);
+  dof_handler.distribute_dofs(fe);
+
+  QGauss<dim - 1>   quadrature(3);
+  FEFaceValues<dim> fe_face_values(fe,
+                                   quadrature,
+                                   update_values | update_gradients);
+  fe_face_values.reinit(dof_handler.begin_active(), 0);
+
+  deallog << "OK" << std::endl;
+}
+
+int
+main()
+{
+  initlog();
+
+  for (unsigned int p = 0; p < 3; ++p)
+    {
+      test<2>(p);
+      test<3>(p);
+    }
+}
diff --git a/tests/fe/fe_nedelec_sz_face_values.output b/tests/fe/fe_nedelec_sz_face_values.output
new file mode 100644 (file)
index 0000000..0aa61ff
--- /dev/null
@@ -0,0 +1,7 @@
+
+DEAL::OK
+DEAL::OK
+DEAL::OK
+DEAL::OK
+DEAL::OK
+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.