]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add test. 12674/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Wed, 18 Aug 2021 22:42:24 +0000 (16:42 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 18 Aug 2021 23:21:14 +0000 (17:21 -0600)
tests/grid/accessor_set_boundary_id.cc [new file with mode: 0644]
tests/grid/accessor_set_boundary_id.output [new file with mode: 0644]

diff --git a/tests/grid/accessor_set_boundary_id.cc b/tests/grid/accessor_set_boundary_id.cc
new file mode 100644 (file)
index 0000000..eaaa256
--- /dev/null
@@ -0,0 +1,65 @@
+// ---------------------------------------------------------------------
+//
+// 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.
+//
+// ---------------------------------------------------------------------
+
+
+
+// TriaAccessor<0,dim,spacedim>::set_boundary_id() and
+// TriaAccessor<0,dim,spacedim>::set_all_boundary_ids() were marked as
+// 'const', in contrast to the corresponding functions of faces of
+// higher-dimensional objects. This prevented us from writing loops
+// over all faces where the 'face' object was marked as 'const'.
+
+#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"
+
+
+
+template <int dim, int spacedim>
+void
+test()
+{
+  Triangulation<dim, spacedim> tria;
+  GridGenerator::hyper_cube(tria);
+
+  std::map<typename Triangulation<dim, spacedim>::face_iterator, int> mymap;
+
+  for (auto &cell : tria.active_cell_iterators())
+    for (const auto &face : cell->face_iterators())
+      {
+        face->set_all_boundary_ids(2);
+        if (face->at_boundary())
+          face->set_boundary_id(1);
+      }
+  deallog << "OK" << 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_set_boundary_id.output b/tests/grid/accessor_set_boundary_id.output
new file mode 100644 (file)
index 0000000..c9bdf33
--- /dev/null
@@ -0,0 +1,6 @@
+
+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.