From: Wolfgang Bangerth Date: Tue, 14 Jul 2009 02:32:45 +0000 (+0000) Subject: Also test the case where a cell is not fixable. X-Git-Tag: v8.0.0~7483 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2be7b690f9d166c0b103812d7b4fb7c2f2a8de65;p=dealii.git Also test the case where a cell is not fixable. git-svn-id: https://svn.dealii.org/trunk@19077 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/bits/distorted_cells_05.cc b/tests/bits/distorted_cells_05.cc new file mode 100644 index 0000000000..04788f11de --- /dev/null +++ b/tests/bits/distorted_cells_05.cc @@ -0,0 +1,124 @@ +//---------------------------- distorted_cells_05.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2003, 2004, 2005, 2009 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. +// +//---------------------------- distorted_cells_05.cc --------------------------- + + +// like _04, except that this time the cell really can't be fixed up +// because we move the node from the bottom face all the way above the +// top face + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +template +class MyBoundary : public Boundary +{ + virtual Point + get_new_point_on_line (const typename Triangulation::line_iterator &line) const + { + deallog << "Finding point between " + << line->vertex(0) << " and " + << line->vertex(1) << std::endl; + + // in 2d, find a point that + // lies on the opposite side + // of the quad. in 3d, choose + // the midpoint of the edge + if (dim == 2) + return Point(0,1.25); + else + return (line->vertex(0) + line->vertex(1)) / 2; + } + + virtual Point + get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) const + { + deallog << "Finding point between " + << quad->vertex(0) << " and " + << quad->vertex(1) << " and " + << quad->vertex(2) << " and " + << quad->vertex(3) << std::endl; + + return Point(0,0,1.25); + } +}; + + + +template +void check () +{ + MyBoundary my_boundary; + + // create a single square/cube + Triangulation coarse_grid; + GridGenerator::hyper_cube (coarse_grid, -1, 1); + + // set bottom face to use MyBoundary + for (unsigned int f=0; f::faces_per_cell; ++f) + if (coarse_grid.begin_active()->face(f)->center()[dim-1] == -1) + coarse_grid.begin_active()->face(f)->set_boundary_indicator (1); + coarse_grid.set_boundary (1, my_boundary); + + // now try to refine this one + // cell. we should get an exception + try + { + coarse_grid.begin_active()->set_refine_flag (); + coarse_grid.execute_coarsening_and_refinement (); + } + catch (typename Triangulation::DistortedCellList &dcv) + { + typename Triangulation::DistortedCellList + subset = GridTools::fix_up_distorted_child_cells (dcv, + coarse_grid); + Assert (subset.distorted_cells.size() == 1, + ExcInternalError()); + } + + Assert (coarse_grid.n_levels() == 2, ExcInternalError()); + Assert (coarse_grid.n_active_cells() == 1< (); + check<3> (); +} + + + diff --git a/tests/bits/distorted_cells_05/2d b/tests/bits/distorted_cells_05/2d new file mode 100644 index 0000000000..1a53889d21 --- /dev/null +++ b/tests/bits/distorted_cells_05/2d @@ -0,0 +1,6 @@ +4 1 0 0 0 +1 0 0 0 +2 1 0 0 +3 0 1 0 +4 1 1 0 +1 0 quad 1 2 3 4 diff --git a/tests/bits/distorted_cells_05/3d b/tests/bits/distorted_cells_05/3d new file mode 100644 index 0000000000..dd37099c80 --- /dev/null +++ b/tests/bits/distorted_cells_05/3d @@ -0,0 +1,10 @@ +8 1 0 0 0 +1 0 0 0 +2 1 0 0 +3 0 1 0 +4 1 1 0 +5 0 0 1 +6 1 0 1 +7 0 1 1 +8 1 1 1 +1 0 hex 1 2 3 4 5 6 7 8 diff --git a/tests/bits/distorted_cells_05/cmp/generic b/tests/bits/distorted_cells_05/cmp/generic new file mode 100644 index 0000000000..238219b884 --- /dev/null +++ b/tests/bits/distorted_cells_05/cmp/generic @@ -0,0 +1,223 @@ + +DEAL::Finding point between -1.00000 -1.00000 and 1.00000 -1.00000 +-1.00000 -1.00000 1 0 +0.00000 1.25000 1 0 +0.00000 0.281250 1 0 +-1.00000 0.00000 1 0 +-1.00000 -1.00000 1 0 + + +0.00000 1.25000 1 0 +1.00000 -1.00000 1 0 +1.00000 0.00000 1 0 +0.00000 0.281250 1 0 +0.00000 1.25000 1 0 + + +-1.00000 0.00000 1 0 +0.00000 0.281250 1 0 +0.00000 1.00000 1 0 +-1.00000 1.00000 1 0 +-1.00000 0.00000 1 0 + + +0.00000 0.281250 1 0 +1.00000 0.00000 1 0 +1.00000 1.00000 1 0 +0.00000 1.00000 1 0 +0.00000 0.281250 1 0 + + +DEAL::Finding point between -1.00000 -1.00000 -1.00000 and 1.00000 -1.00000 -1.00000 and -1.00000 1.00000 -1.00000 and 1.00000 1.00000 -1.00000 +-1.00000 -1.00000 -1.00000 1 0 +0.00000 -1.00000 -1.00000 1 0 +0.00000 -1.00000 0.00000 1 0 +-1.00000 -1.00000 0.00000 1 0 +-1.00000 -1.00000 -1.00000 1 0 + +-1.00000 0.00000 -1.00000 1 0 +0.00000 0.00000 1.25000 1 0 +0.00000 0.00000 0.187500 1 0 +-1.00000 0.00000 0.00000 1 0 +-1.00000 0.00000 -1.00000 1 0 + +-1.00000 -1.00000 -1.00000 1 0 +-1.00000 0.00000 -1.00000 1 0 + +0.00000 -1.00000 -1.00000 1 0 +0.00000 0.00000 1.25000 1 0 + +0.00000 -1.00000 0.00000 1 0 +0.00000 0.00000 0.187500 1 0 + +-1.00000 -1.00000 0.00000 1 0 +-1.00000 0.00000 0.00000 1 0 + +0.00000 -1.00000 -1.00000 1 0 +1.00000 -1.00000 -1.00000 1 0 +1.00000 -1.00000 0.00000 1 0 +0.00000 -1.00000 0.00000 1 0 +0.00000 -1.00000 -1.00000 1 0 + +0.00000 0.00000 1.25000 1 0 +1.00000 0.00000 -1.00000 1 0 +1.00000 0.00000 0.00000 1 0 +0.00000 0.00000 0.187500 1 0 +0.00000 0.00000 1.25000 1 0 + +0.00000 -1.00000 -1.00000 1 0 +0.00000 0.00000 1.25000 1 0 + +1.00000 -1.00000 -1.00000 1 0 +1.00000 0.00000 -1.00000 1 0 + +1.00000 -1.00000 0.00000 1 0 +1.00000 0.00000 0.00000 1 0 + +0.00000 -1.00000 0.00000 1 0 +0.00000 0.00000 0.187500 1 0 + +-1.00000 0.00000 -1.00000 1 0 +0.00000 0.00000 1.25000 1 0 +0.00000 0.00000 0.187500 1 0 +-1.00000 0.00000 0.00000 1 0 +-1.00000 0.00000 -1.00000 1 0 + +-1.00000 1.00000 -1.00000 1 0 +0.00000 1.00000 -1.00000 1 0 +0.00000 1.00000 0.00000 1 0 +-1.00000 1.00000 0.00000 1 0 +-1.00000 1.00000 -1.00000 1 0 + +-1.00000 0.00000 -1.00000 1 0 +-1.00000 1.00000 -1.00000 1 0 + +0.00000 0.00000 1.25000 1 0 +0.00000 1.00000 -1.00000 1 0 + +0.00000 0.00000 0.187500 1 0 +0.00000 1.00000 0.00000 1 0 + +-1.00000 0.00000 0.00000 1 0 +-1.00000 1.00000 0.00000 1 0 + +0.00000 0.00000 1.25000 1 0 +1.00000 0.00000 -1.00000 1 0 +1.00000 0.00000 0.00000 1 0 +0.00000 0.00000 0.187500 1 0 +0.00000 0.00000 1.25000 1 0 + +0.00000 1.00000 -1.00000 1 0 +1.00000 1.00000 -1.00000 1 0 +1.00000 1.00000 0.00000 1 0 +0.00000 1.00000 0.00000 1 0 +0.00000 1.00000 -1.00000 1 0 + +0.00000 0.00000 1.25000 1 0 +0.00000 1.00000 -1.00000 1 0 + +1.00000 0.00000 -1.00000 1 0 +1.00000 1.00000 -1.00000 1 0 + +1.00000 0.00000 0.00000 1 0 +1.00000 1.00000 0.00000 1 0 + +0.00000 0.00000 0.187500 1 0 +0.00000 1.00000 0.00000 1 0 + +-1.00000 -1.00000 0.00000 1 0 +0.00000 -1.00000 0.00000 1 0 +0.00000 -1.00000 1.00000 1 0 +-1.00000 -1.00000 1.00000 1 0 +-1.00000 -1.00000 0.00000 1 0 + +-1.00000 0.00000 0.00000 1 0 +0.00000 0.00000 0.187500 1 0 +0.00000 0.00000 1.00000 1 0 +-1.00000 0.00000 1.00000 1 0 +-1.00000 0.00000 0.00000 1 0 + +-1.00000 -1.00000 0.00000 1 0 +-1.00000 0.00000 0.00000 1 0 + +0.00000 -1.00000 0.00000 1 0 +0.00000 0.00000 0.187500 1 0 + +0.00000 -1.00000 1.00000 1 0 +0.00000 0.00000 1.00000 1 0 + +-1.00000 -1.00000 1.00000 1 0 +-1.00000 0.00000 1.00000 1 0 + +0.00000 -1.00000 0.00000 1 0 +1.00000 -1.00000 0.00000 1 0 +1.00000 -1.00000 1.00000 1 0 +0.00000 -1.00000 1.00000 1 0 +0.00000 -1.00000 0.00000 1 0 + +0.00000 0.00000 0.187500 1 0 +1.00000 0.00000 0.00000 1 0 +1.00000 0.00000 1.00000 1 0 +0.00000 0.00000 1.00000 1 0 +0.00000 0.00000 0.187500 1 0 + +0.00000 -1.00000 0.00000 1 0 +0.00000 0.00000 0.187500 1 0 + +1.00000 -1.00000 0.00000 1 0 +1.00000 0.00000 0.00000 1 0 + +1.00000 -1.00000 1.00000 1 0 +1.00000 0.00000 1.00000 1 0 + +0.00000 -1.00000 1.00000 1 0 +0.00000 0.00000 1.00000 1 0 + +-1.00000 0.00000 0.00000 1 0 +0.00000 0.00000 0.187500 1 0 +0.00000 0.00000 1.00000 1 0 +-1.00000 0.00000 1.00000 1 0 +-1.00000 0.00000 0.00000 1 0 + +-1.00000 1.00000 0.00000 1 0 +0.00000 1.00000 0.00000 1 0 +0.00000 1.00000 1.00000 1 0 +-1.00000 1.00000 1.00000 1 0 +-1.00000 1.00000 0.00000 1 0 + +-1.00000 0.00000 0.00000 1 0 +-1.00000 1.00000 0.00000 1 0 + +0.00000 0.00000 0.187500 1 0 +0.00000 1.00000 0.00000 1 0 + +0.00000 0.00000 1.00000 1 0 +0.00000 1.00000 1.00000 1 0 + +-1.00000 0.00000 1.00000 1 0 +-1.00000 1.00000 1.00000 1 0 + +0.00000 0.00000 0.187500 1 0 +1.00000 0.00000 0.00000 1 0 +1.00000 0.00000 1.00000 1 0 +0.00000 0.00000 1.00000 1 0 +0.00000 0.00000 0.187500 1 0 + +0.00000 1.00000 0.00000 1 0 +1.00000 1.00000 0.00000 1 0 +1.00000 1.00000 1.00000 1 0 +0.00000 1.00000 1.00000 1 0 +0.00000 1.00000 0.00000 1 0 + +0.00000 0.00000 0.187500 1 0 +0.00000 1.00000 0.00000 1 0 + +1.00000 0.00000 0.00000 1 0 +1.00000 1.00000 0.00000 1 0 + +1.00000 0.00000 1.00000 1 0 +1.00000 1.00000 1.00000 1 0 + +0.00000 0.00000 1.00000 1 0 +0.00000 1.00000 1.00000 1 0 +