]> https://gitweb.dealii.org/ - dealii.git/commitdiff
New test.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 19 Jul 2013 19:24:22 +0000 (19:24 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 19 Jul 2013 19:24:22 +0000 (19:24 +0000)
git-svn-id: https://svn.dealii.org/trunk@30065 0785d39b-7218-0410-832d-ea1e28bc413d

tests/deal.II/tria_last.cc [new file with mode: 0644]
tests/deal.II/tria_last/cmp/generic [new file with mode: 0644]

diff --git a/tests/deal.II/tria_last.cc b/tests/deal.II/tria_last.cc
new file mode 100644 (file)
index 0000000..053ca4d
--- /dev/null
@@ -0,0 +1,76 @@
+// ---------------------------------------------------------------------
+// $Id$
+//
+// Copyright (C) 1998 - 2013 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.
+//
+// ---------------------------------------------------------------------
+
+
+// when we coarsen away a whole level, the level data structures
+// remain but contains only unused cells. make sure that tria.last()
+// and tria.last_active() still produce something sensible in that
+// case
+
+#include "../tests.h"
+#include <deal.II/grid/tria_boundary.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/tria_iterator.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/grid_out.h>
+#include <deal.II/base/logstream.h>
+#include <cmath>
+#include <cstdlib>
+
+#include <fstream>
+#include <iomanip>
+#include <cstdio>
+
+std::ofstream logfile("tria_last/output");
+
+
+
+template <int dim>
+void test ()
+{
+  Triangulation<dim> tria;
+  GridGenerator::hyper_cube(tria);
+  tria.refine_global(3);
+  for (unsigned int i=0; i<2; ++i)
+    {
+      for (typename Triangulation<dim>::active_cell_iterator
+            cell = tria.begin_active(2); cell != tria.end(); ++cell)
+       cell->set_coarsen_flag ();
+      tria.execute_coarsening_and_refinement ();
+    }
+
+  deallog << tria.n_levels() << ' ' << tria.n_global_levels() << ' '
+         << tria.last() << ' '
+         << tria.last_active()
+         << std::endl;
+}
+
+
+int main ()
+{
+  deallog << std::setprecision(2);
+  logfile << std::setprecision(2);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test<1>();
+  test<2>();
+  test<3>();
+
+  return 0;
+}
diff --git a/tests/deal.II/tria_last/cmp/generic b/tests/deal.II/tria_last/cmp/generic
new file mode 100644 (file)
index 0000000..96b5f06
--- /dev/null
@@ -0,0 +1,4 @@
+
+DEAL::2 2 1.1 1.1
+DEAL::2 2 1.3 1.3
+DEAL::2 2 1.7 1.7

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.