]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a test.
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 19 Aug 2021 23:19:34 +0000 (17:19 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Fri, 20 Aug 2021 00:18:52 +0000 (18:18 -0600)
tests/grid/dof_accessor_1d_01.cc [new file with mode: 0644]
tests/grid/dof_accessor_1d_01.output [new file with mode: 0644]

diff --git a/tests/grid/dof_accessor_1d_01.cc b/tests/grid/dof_accessor_1d_01.cc
new file mode 100644 (file)
index 0000000..de4a2a0
--- /dev/null
@@ -0,0 +1,76 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2018 - 2020 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.
+//
+// ---------------------------------------------------------------------
+
+
+
+// DoFHandler<1,spacedim>::face_iterator objects could not be
+// default-constructed
+
+#include <deal.II/base/logstream.h>
+
+#include <deal.II/dofs/dof_accessor.h>
+#include <deal.II/dofs/dof_handler.h>
+
+#include <deal.II/fe/fe_q.h>
+
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/tria_iterator.h>
+
+#include "../tests.h"
+
+
+
+template <int dim, int spacedim>
+void
+test()
+{
+  Triangulation<dim, spacedim> tria;
+  GridGenerator::hyper_cube(tria);
+  tria.refine_global(1);
+
+  FE_Q<dim, spacedim>       fe(1);
+  DoFHandler<dim, spacedim> dof_handler(tria);
+  dof_handler.distribute_dofs(fe);
+
+  // The following call used to fail in the default constructor of the
+  // face iterator:
+  typename DoFHandler<dim, spacedim>::face_iterator x;
+
+
+  for (const auto &cell : dof_handler.active_cell_iterators())
+    // And as a consequence, this also used to fail because it first
+    // constructs an array of iterators and then puts values into
+    // them:
+    for (const auto &face : cell->face_iterators())
+      ;
+
+  deallog << "OK" << std::endl;
+}
+
+
+int
+main()
+{
+  initlog();
+
+  test<1, 1>();
+  test<1, 2>();
+  test<1, 3>();
+  test<2, 2>();
+  test<2, 3>();
+  test<3, 3>();
+}
diff --git a/tests/grid/dof_accessor_1d_01.output b/tests/grid/dof_accessor_1d_01.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.