From ef435191721bb46838bdcdfd7aeadb95b010df63 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 19 Jul 2013 19:24:22 +0000 Subject: [PATCH] New test. git-svn-id: https://svn.dealii.org/trunk@30065 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/deal.II/tria_last.cc | 76 +++++++++++++++++++++++++++++ tests/deal.II/tria_last/cmp/generic | 4 ++ 2 files changed, 80 insertions(+) create mode 100644 tests/deal.II/tria_last.cc create mode 100644 tests/deal.II/tria_last/cmp/generic diff --git a/tests/deal.II/tria_last.cc b/tests/deal.II/tria_last.cc new file mode 100644 index 0000000000..053ca4d5bb --- /dev/null +++ b/tests/deal.II/tria_last.cc @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +std::ofstream logfile("tria_last/output"); + + + +template +void test () +{ + Triangulation tria; + GridGenerator::hyper_cube(tria); + tria.refine_global(3); + for (unsigned int i=0; i<2; ++i) + { + for (typename Triangulation::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 index 0000000000..96b5f06da1 --- /dev/null +++ b/tests/deal.II/tria_last/cmp/generic @@ -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 -- 2.39.5