]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a testcase. 7458/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 20 Nov 2018 15:58:30 +0000 (08:58 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 20 Nov 2018 16:22:28 +0000 (09:22 -0700)
tests/grid/accessor_01.cc [new file with mode: 0644]
tests/grid/accessor_01.output [new file with mode: 0644]

diff --git a/tests/grid/accessor_01.cc b/tests/grid/accessor_01.cc
new file mode 100644 (file)
index 0000000..b340738
--- /dev/null
@@ -0,0 +1,71 @@
+// ---------------------------------------------------------------------
+//
+// 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.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+
+// TriaAccessor<0,dim,spacedim> and TriaAccessor<0,1,spacedim> lacked
+// get_triangulation() member functions because they are not derived
+// from TriaAccessorBase. This led to awkward follow-up errors in
+// strange places when using them in certain contexts.
+
+#include <deal.II/base/logstream.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"
+
+using namespace dealii;
+
+
+template <int dim, int spacedim>
+void
+test()
+{
+  Triangulation<dim, spacedim> tria;
+  GridGenerator::hyper_cube(tria);
+  tria.refine_global(1);
+
+  std::map<typename Triangulation<dim, spacedim>::face_iterator, double> mymap;
+
+  for (auto cell : tria.active_cell_iterators())
+    {
+      for (unsigned int i = 0; i < GeometryInfo<dim>::faces_per_cell; ++i)
+        {
+          if (mymap.find(cell->face(i)) == mymap.end())
+            {
+              mymap[cell->face(i)] = cell->index();
+            }
+        }
+    }
+
+  for (auto it : mymap)
+    deallog << it.first << ": " << it.second << std::endl;
+}
+
+
+int
+main()
+{
+  initlog();
+
+  test<1, 1>();
+  test<1, 2>();
+  test<2, 2>();
+  test<2, 3>();
+  test<3, 3>();
+}
diff --git a/tests/grid/accessor_01.output b/tests/grid/accessor_01.output
new file mode 100644 (file)
index 0000000..1929c09
--- /dev/null
@@ -0,0 +1,67 @@
+
+DEAL::0: 0.00000
+DEAL::1: 1.00000
+DEAL::2: 0.00000
+DEAL::0: 0.00000
+DEAL::1: 1.00000
+DEAL::2: 0.00000
+DEAL::4: 0.00000
+DEAL::5: 1.00000
+DEAL::6: 0.00000
+DEAL::7: 2.00000
+DEAL::8: 1.00000
+DEAL::9: 3.00000
+DEAL::10: 2.00000
+DEAL::11: 3.00000
+DEAL::12: 0.00000
+DEAL::13: 2.00000
+DEAL::14: 0.00000
+DEAL::15: 1.00000
+DEAL::4: 0.00000
+DEAL::5: 1.00000
+DEAL::6: 0.00000
+DEAL::7: 2.00000
+DEAL::8: 1.00000
+DEAL::9: 3.00000
+DEAL::10: 2.00000
+DEAL::11: 3.00000
+DEAL::12: 0.00000
+DEAL::13: 2.00000
+DEAL::14: 0.00000
+DEAL::15: 1.00000
+DEAL::6: 0.00000
+DEAL::7: 4.00000
+DEAL::8: 1.00000
+DEAL::9: 5.00000
+DEAL::10: 0.00000
+DEAL::11: 1.00000
+DEAL::12: 2.00000
+DEAL::13: 3.00000
+DEAL::14: 0.00000
+DEAL::15: 2.00000
+DEAL::16: 4.00000
+DEAL::17: 6.00000
+DEAL::18: 1.00000
+DEAL::19: 3.00000
+DEAL::20: 5.00000
+DEAL::21: 7.00000
+DEAL::22: 2.00000
+DEAL::23: 6.00000
+DEAL::24: 3.00000
+DEAL::25: 7.00000
+DEAL::26: 4.00000
+DEAL::27: 5.00000
+DEAL::28: 6.00000
+DEAL::29: 7.00000
+DEAL::30: 3.00000
+DEAL::31: 2.00000
+DEAL::32: 1.00000
+DEAL::33: 0.00000
+DEAL::34: 5.00000
+DEAL::35: 1.00000
+DEAL::36: 4.00000
+DEAL::37: 0.00000
+DEAL::38: 6.00000
+DEAL::39: 4.00000
+DEAL::40: 2.00000
+DEAL::41: 0.00000

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.