From: bangerth Date: Wed, 27 Dec 2006 17:29:08 +0000 (+0000) Subject: Split the test into 3, one for each dimension. The 1d and 2d cases now work, the... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=318bcc660e6307790d9e09680130a1f33e2b4c34;p=dealii-svn.git Split the test into 3, one for each dimension. The 1d and 2d cases now work, the 3d case still fails. git-svn-id: https://svn.dealii.org/trunk@14277 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/bits/Makefile b/tests/bits/Makefile index 4b8e16ce35..a04d9c6b0b 100644 --- a/tests/bits/Makefile +++ b/tests/bits/Makefile @@ -83,7 +83,7 @@ tests_x = grid_generator_?? \ face_interpolation \ subface_interpolation \ face_orientation_crash \ - refine_and_coarsen + refine_and_coarsen_* # tests for the hp branch: # fe_collection_* diff --git a/tests/bits/refine_and_coarsen.cc b/tests/bits/refine_and_coarsen_1d.cc similarity index 86% rename from tests/bits/refine_and_coarsen.cc rename to tests/bits/refine_and_coarsen_1d.cc index 46b868f264..554729a3ec 100644 --- a/tests/bits/refine_and_coarsen.cc +++ b/tests/bits/refine_and_coarsen_1d.cc @@ -1,5 +1,5 @@ -//---------------------------- refine_and_coarsen.cc --------------------------- -// $Id: refine_and_coarsen.cc 11749 2005-11-09 19:11:20Z wolf $ +//---------------------------- refine_and_coarsen_1d.cc --------------------------- +// $Id: refine_and_coarsen_1d.cc 11749 2005-11-09 19:11:20Z wolf $ // Version: $Name$ // // Copyright (C) 2006 by the deal.II authors @@ -9,7 +9,7 @@ // to the file deal.II/doc/license.html for the text and // further information on this license. // -//---------------------------- refine_and_coarsen.cc --------------------------- +//---------------------------- refine_and_coarsen_1d.cc --------------------------- // check that if we take an locally refined mesh, refine it globally once, @@ -74,14 +74,12 @@ void check () int main () { - std::ofstream logfile("refine_and_coarsen/output"); + std::ofstream logfile("refine_and_coarsen_1d/output"); deallog.attach(logfile); deallog.depth_console(0); deallog.threshold_double(1.e-10); check<1> (); - check<2> (); - check<3> (); } diff --git a/tests/bits/refine_and_coarsen_1d/cmp/generic b/tests/bits/refine_and_coarsen_1d/cmp/generic new file mode 100644 index 0000000000..f3ec0fd883 --- /dev/null +++ b/tests/bits/refine_and_coarsen_1d/cmp/generic @@ -0,0 +1,3 @@ + +DEAL::5 +DEAL::5 5 diff --git a/tests/bits/refine_and_coarsen_2d.cc b/tests/bits/refine_and_coarsen_2d.cc new file mode 100644 index 0000000000..ceefe7947a --- /dev/null +++ b/tests/bits/refine_and_coarsen_2d.cc @@ -0,0 +1,86 @@ +//---------------------------- refine_and_coarsen_2d.cc --------------------------- +// $Id: refine_and_coarsen_2d.cc 11749 2005-11-09 19:11:20Z wolf $ +// Version: $Name$ +// +// Copyright (C) 2006 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- refine_and_coarsen_2d.cc --------------------------- + + +// check that if we take an locally refined mesh, refine it globally once, +// then coarsen it globally again, that we get the same mesh + +#include "../tests.h" + +#include +#include +#include +#include +#include +#include + +#include + + + +template +void check () +{ + Triangulation tria; + GridGenerator::hyper_cube (tria); + tria.refine_global (2); + tria.begin_active()->set_refine_flag(); + tria.execute_coarsening_and_refinement (); + + // store which cells we have here + std::vector::active_cell_iterator> cells; + for (typename Triangulation::active_cell_iterator cell=tria.begin_active(); + cell != tria.end(); ++cell) + cells.push_back (cell); + + const unsigned int n_cells = tria.n_active_cells(); + deallog << n_cells << std::endl; + + // refine the mesh globally, then coarsen + // it again globally + tria.refine_global (1); + + for (typename Triangulation::active_cell_iterator cell=tria.begin_active(); + cell != tria.end(); ++cell) + cell->set_coarsen_flag (); + tria.execute_coarsening_and_refinement (); + + + // verify that we get the same cells again + deallog << n_cells << ' ' << tria.n_active_cells() + << std::endl; + + Assert (tria.n_active_cells() == n_cells, + ExcInternalError()); + + unsigned int index = 0; + for (typename Triangulation::active_cell_iterator cell=tria.begin_active(); + cell != tria.end(); ++cell, ++index) + Assert (cells[index] == cell, + ExcInternalError()); + +} + + +int main () +{ + std::ofstream logfile("refine_and_coarsen_2d/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + check<2> (); +} + + + diff --git a/tests/bits/refine_and_coarsen_2d/cmp/generic b/tests/bits/refine_and_coarsen_2d/cmp/generic new file mode 100644 index 0000000000..a04060f662 --- /dev/null +++ b/tests/bits/refine_and_coarsen_2d/cmp/generic @@ -0,0 +1,3 @@ + +DEAL::19 +DEAL::19 19 diff --git a/tests/bits/refine_and_coarsen_3d.cc b/tests/bits/refine_and_coarsen_3d.cc new file mode 100644 index 0000000000..744ed26b0b --- /dev/null +++ b/tests/bits/refine_and_coarsen_3d.cc @@ -0,0 +1,86 @@ +//---------------------------- refine_and_coarsen_3d.cc --------------------------- +// $Id: refine_and_coarsen_3d.cc 11749 2005-11-09 19:11:20Z wolf $ +// Version: $Name$ +// +// Copyright (C) 2006 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- refine_and_coarsen_3d.cc --------------------------- + + +// check that if we take an locally refined mesh, refine it globally once, +// then coarsen it globally again, that we get the same mesh + +#include "../tests.h" + +#include +#include +#include +#include +#include +#include + +#include + + + +template +void check () +{ + Triangulation tria; + GridGenerator::hyper_cube (tria); + tria.refine_global (2); + tria.begin_active()->set_refine_flag(); + tria.execute_coarsening_and_refinement (); + + // store which cells we have here + std::vector::active_cell_iterator> cells; + for (typename Triangulation::active_cell_iterator cell=tria.begin_active(); + cell != tria.end(); ++cell) + cells.push_back (cell); + + const unsigned int n_cells = tria.n_active_cells(); + deallog << n_cells << std::endl; + + // refine the mesh globally, then coarsen + // it again globally + tria.refine_global (1); + + for (typename Triangulation::active_cell_iterator cell=tria.begin_active(); + cell != tria.end(); ++cell) + cell->set_coarsen_flag (); + tria.execute_coarsening_and_refinement (); + + + // verify that we get the same cells again + deallog << n_cells << ' ' << tria.n_active_cells() + << std::endl; + + Assert (tria.n_active_cells() == n_cells, + ExcInternalError()); + + unsigned int index = 0; + for (typename Triangulation::active_cell_iterator cell=tria.begin_active(); + cell != tria.end(); ++cell, ++index) + Assert (cells[index] == cell, + ExcInternalError()); + +} + + +int main () +{ + std::ofstream logfile("refine_and_coarsen_3d/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + check<3> (); +} + + + diff --git a/tests/bits/refine_and_coarsen/cmp/generic b/tests/bits/refine_and_coarsen_3d/cmp/generic similarity index 100% rename from tests/bits/refine_and_coarsen/cmp/generic rename to tests/bits/refine_and_coarsen_3d/cmp/generic