From: bangerth Date: Sat, 30 Dec 2006 03:21:44 +0000 (+0000) Subject: Add a testcase that reproduces deal.II/grid_transform_3d, which presently exhibits... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26d0b891e9141c6d6c83cbfe334754f11cc94446;p=dealii-svn.git Add a testcase that reproduces deal.II/grid_transform_3d, which presently exhibits a problem I introduced with my changes to how coarsening works in 3d. git-svn-id: https://svn.dealii.org/trunk@14290 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/bits/tria_crash_01.cc b/tests/bits/tria_crash_01.cc new file mode 100644 index 0000000000..0cc81cd7db --- /dev/null +++ b/tests/bits/tria_crash_01.cc @@ -0,0 +1,87 @@ +//---------------------------- tria_crash_01.cc --------------------------- +// $Id: tria_crash_01.cc 12193 2006-01-27 15:57:34Z wolf $ +// Version: $Name$ +// +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 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. +// +//---------------------------- tria_crash_01.cc --------------------------- + +// a test that checks for a crash introduced in the triangulation class in the +// last few days when fixing refine_and_coarsen_3d + + +#include "../tests.h" +#include +#include +#include +#include +#include +#include + +#include +#include + + +bool predicate (const Point<3> &p, + const double diameter) +{ + return ((p[0]-.2)*(p[0]-.2) + (p[2]-p[1]/4)*(p[2]-p[1]/4) < diameter * diameter); +} + + +int main () +{ + std::ofstream logfile("tria_crash_01/output"); + deallog.attach(logfile); + deallog.depth_console(0); + + const unsigned int dim=3; + Point origin; + CylinderBoundary boundary; + Triangulation tria; + tria.set_boundary(0, boundary); + GridGenerator::cylinder(tria, 1, .7); + + deallog << "n_cells=" << tria.n_active_cells() << std::endl; + + tria.refine_global(2); + + deallog << "n_cells=" << tria.n_active_cells() << std::endl; + + // build up a map of vertex indices + // of boundary vertices to the new + // boundary points + std::map > new_points; + + Triangulation::active_cell_iterator cell=tria.begin_active(), + endc=tria.end(); + + for (cell=tria.begin_active(); cell!=endc; ++cell) + if (predicate(cell->center(), cell->diameter())) + cell->set_refine_flag (); + tria.execute_coarsening_and_refinement(); + + deallog << "n_cells=" << tria.n_active_cells() << std::endl; + + + for (cell=tria.begin_active(); cell!=endc; ++cell) + if (!predicate (cell->center(), cell->diameter())) + cell->set_coarsen_flag (); + + // make sure there really are no refinement + // flags set + tria.prepare_coarsening_and_refinement(); + for (cell=tria.begin_active(); cell!=endc; ++cell) + Assert (!cell->refine_flag_set(), ExcInternalError()); + + tria.execute_coarsening_and_refinement(); + + deallog << "n_cells=" << tria.n_active_cells() << std::endl; + + return 0; +} diff --git a/tests/bits/tria_crash_01/cmp/generic b/tests/bits/tria_crash_01/cmp/generic new file mode 100644 index 0000000000..f08e311b42 --- /dev/null +++ b/tests/bits/tria_crash_01/cmp/generic @@ -0,0 +1,37 @@ + +DEAL::Initial check +DEAL:: ok. +DEAL::Check 0 +DEAL:: ok. +DEAL::Check 1 +DEAL:: ok. +DEAL::Check 2 +DEAL:: ok. +DEAL::Check 1 +DEAL:: ok. +DEAL::Check 2 +DEAL:: ok. +DEAL::Initial check +DEAL:: ok. +DEAL::Check 0 +DEAL:: ok. +DEAL::Check 1 +DEAL:: ok. +DEAL::Check 2 +DEAL:: ok. +DEAL::Check 1 +DEAL:: ok. +DEAL::Check 2 +DEAL:: ok. +DEAL::Initial check +DEAL:: ok. +DEAL::Check 0 +DEAL:: ok. +DEAL::Check 1 +DEAL:: ok. +DEAL::Check 2 +DEAL:: ok. +DEAL::Check 1 +DEAL:: ok. +DEAL::Check 2 +DEAL:: ok.