From 1aa7f623f84de547a288b563c8b5847e45b58a1c Mon Sep 17 00:00:00 2001 From: leicht Date: Thu, 28 Jun 2007 14:05:18 +0000 Subject: [PATCH] In 3D coarsening might delete children of lines which are still needed, if 6 or more cells share a common line. Create a failing test to document this. git-svn-id: https://svn.dealii.org/trunk@14822 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/fail/line_coarsening_3d.cc | 111 ++++++++++++++++++++++ tests/fail/line_coarsening_3d/cmp/generic | 0 2 files changed, 111 insertions(+) create mode 100644 tests/fail/line_coarsening_3d.cc create mode 100644 tests/fail/line_coarsening_3d/cmp/generic diff --git a/tests/fail/line_coarsening_3d.cc b/tests/fail/line_coarsening_3d.cc new file mode 100644 index 0000000000..df198b83b6 --- /dev/null +++ b/tests/fail/line_coarsening_3d.cc @@ -0,0 +1,111 @@ +//---------------------------- line_coarsening_3d.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2007 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. +// +//---------------------------- line_coarsening_3d.cc --------------------------- + + +#include "../tests.h" +#include +#include +#include +#include +#include + +#include +#include +#include + + +std::ofstream logfile("line_coarsening_3d/output"); + + +// create a triangulation of a cylinder, where the line along the axis is common +// to all cells, thus n_cells are neighboring at this line. in delete_children, +// this is not accounted for (for n_cells>5) and the child lines are deleted, +// although they are still needed. +void create_star_structured_cylinder (Triangulation<3> &coarse_grid, + const unsigned int n_cells) +{ + Assert(n_cells>1, ExcNotImplemented()); + + std::vector > points(2*(1+2*n_cells)); + points[0] = Point<3>(); + points[1] = Point<3>(1,0,0); + for (unsigned int i=0; i<2*n_cells-1; ++i) + { + points[2+i]=Point<3>(std::cos(deal_II_numbers::PI/n_cells*(i+1)), + std::sin(deal_II_numbers::PI/n_cells*(i+1)), + 0); + } + + for (unsigned int i=0; i<2*n_cells+1; ++i) + { + points[1+2*n_cells+i]=points[i]+Point<3>(0,0,-1); + } + + std::vector > cells(n_cells); + + for (unsigned int c=0; c tria; + create_star_structured_cylinder(tria,6); + // out of the six cells, refine the first and + // fourth + Triangulation<3>::active_cell_iterator cell=tria.begin_active(); + cell->set_refine_flag(); + ++cell; + ++cell; + ++cell; + cell->set_refine_flag(); + tria.execute_coarsening_and_refinement (); + // write grid to file + GridOut().write_ucd(tria,logfile); + // coarsen the first cell again + cell=tria.begin_active(1); + for (unsigned int c=0;c<8; ++c) + { + cell->set_coarsen_flag(); + ++cell; + } + tria.execute_coarsening_and_refinement (); + + GridOut().write_ucd(tria,logfile); +} + + +int main() +{ + deallog.attach(logfile); + deallog.depth_console(0); + check(); + return 0; +} + diff --git a/tests/fail/line_coarsening_3d/cmp/generic b/tests/fail/line_coarsening_3d/cmp/generic new file mode 100644 index 0000000000..e69de29bb2 -- 2.39.5