]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add test case and changelog entry
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 19 May 2018 18:21:15 +0000 (20:21 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 19 May 2018 18:25:49 +0000 (20:25 +0200)
doc/news/changes/minor/20180519DanielArndt [new file with mode: 0644]
tests/hp/flux_sparsity_02.cc [new file with mode: 0644]
tests/hp/flux_sparsity_02.output [new file with mode: 0644]

diff --git a/doc/news/changes/minor/20180519DanielArndt b/doc/news/changes/minor/20180519DanielArndt
new file mode 100644 (file)
index 0000000..6471744
--- /dev/null
@@ -0,0 +1,5 @@
+Fixed: DoFTools::make_flux_sparsity_pattern was accessing invalid dof indices
+in case neighboring cells were not using FiniteElement objects with the same
+number of degrees of freedom. This is fixed now.
+<br>
+(Daniel Arndt, 2018/05/19)
diff --git a/tests/hp/flux_sparsity_02.cc b/tests/hp/flux_sparsity_02.cc
new file mode 100644 (file)
index 0000000..f9757fa
--- /dev/null
@@ -0,0 +1,101 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 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 at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+// A second test that checks make_flux_sparsity_pattern
+// with scalar valued hp objects.
+
+#include "../tests.h"
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/grid_refinement.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/tria_iterator.h>
+#include <deal.II/dofs/dof_accessor.h>
+#include <deal.II/dofs/dof_renumbering.h>
+#include <deal.II/dofs/dof_tools.h>
+#include <deal.II/fe/fe_dgq.h>
+#include <deal.II/hp/fe_values.h>
+#include <deal.II/hp/dof_handler.h>
+#include <deal.II/hp/fe_collection.h>
+#include <deal.II/lac/dynamic_sparsity_pattern.h>
+#include <iostream>
+#include <vector>
+
+
+
+template <int dim>
+void
+check ()
+{
+  Triangulation<dim>   triangulation;
+  std::vector<unsigned int> subdivisions(dim, 1U);
+  subdivisions[0] = 2;
+  Point<dim> p1,p2;
+  switch (dim)
+    {
+    case 2:
+      p1[0] = p1[1] = 0.0;
+      p2[0] = 2.0;
+      p2[1] = 1.0;
+      break;
+    case 3:
+      p1[0] = p1[1] = p1[2] = 0.0;
+      p2[0] = 2.0;
+      p2[1] = p2[2] = 1.0;
+      break;
+    default:
+      Assert(false, ExcNotImplemented());
+    }
+
+  GridGenerator::subdivided_hyper_rectangle (triangulation,
+                                             subdivisions,
+                                             p1, p2);
+
+  // Create FE Collection and insert two FE objects
+  // DGQ0 and DGQ1
+  hp::FECollection<dim> fe_collection;
+  fe_collection.push_back(FE_DGQ<dim>(0));
+  fe_collection.push_back(FE_DGQ<dim>(1));
+
+  hp::DoFHandler<dim> dof_handler(triangulation);
+  dof_handler.begin_active()->set_active_fe_index(1);
+  dof_handler.distribute_dofs(fe_collection);
+
+  DynamicSparsityPattern dsp(dof_handler.n_dofs(),
+                             dof_handler.n_dofs());
+
+  DoFTools::make_flux_sparsity_pattern (dof_handler, dsp);
+  dsp.compress();
+
+  // Print sparsity pattern, we expect that all dofs couple with each other.
+  dsp.print(deallog.get_file_stream());
+}
+
+
+
+int main()
+{
+  initlog();
+
+  deallog.push ("2d");
+  check<2> ();
+  deallog.pop ();
+  deallog.push ("3d");
+  check<3> ();
+  deallog.pop ();
+}
+
+
+
diff --git a/tests/hp/flux_sparsity_02.output b/tests/hp/flux_sparsity_02.output
new file mode 100644 (file)
index 0000000..26fea0c
--- /dev/null
@@ -0,0 +1,15 @@
+
+[0,0,1,2,3,4]
+[1,0,1,2,3,4]
+[2,0,1,2,3,4]
+[3,0,1,2,3,4]
+[4,0,1,2,3,4]
+[0,0,1,2,3,4,5,6,7,8]
+[1,0,1,2,3,4,5,6,7,8]
+[2,0,1,2,3,4,5,6,7,8]
+[3,0,1,2,3,4,5,6,7,8]
+[4,0,1,2,3,4,5,6,7,8]
+[5,0,1,2,3,4,5,6,7,8]
+[6,0,1,2,3,4,5,6,7,8]
+[7,0,1,2,3,4,5,6,7,8]
+[8,0,1,2,3,4,5,6,7,8]

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.