From edae0fd4022f3dece1eac633a27c7c955cf4a5cc Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 16 May 2011 14:23:08 +0000 Subject: [PATCH] New test that currently fails. git-svn-id: https://svn.dealii.org/trunk@23698 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/fe/cell_similarity_crash_01.cc | 80 +++++++++++++++++++ tests/fe/cell_similarity_crash_01/cmp/generic | 4 + 2 files changed, 84 insertions(+) create mode 100644 tests/fe/cell_similarity_crash_01.cc create mode 100644 tests/fe/cell_similarity_crash_01/cmp/generic diff --git a/tests/fe/cell_similarity_crash_01.cc b/tests/fe/cell_similarity_crash_01.cc new file mode 100644 index 0000000000..52c831e3a5 --- /dev/null +++ b/tests/fe/cell_similarity_crash_01.cc @@ -0,0 +1,80 @@ +//---------------------------------------------------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2009, 2011 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. +// +//---------------------------------------------------------------------- + + +// The FEValues class stores a copy of the current cell so that when we move +// on to the next cell we can compare the two for shape similarity and decide +// which parts of the data we need to re-compute. But this runs into trouble +// if the lifetime of FEValues object extends beyond a refinement or +// coarsening step in the triangulation since in that case the stored copy of +// the cell previously worked on may no longer be valid. The solution is to +// invalidate the stored cell once mesh refinement happens. + +#include "../tests.h" +#include +#include +#include +#include +#include +#include + +#include + + + +template +void test() +{ + Triangulation tr; + GridGenerator::hyper_cube(tr); + tr.refine_global (2); + + FE_Q fe(1); + DoFHandler dof(tr); + dof.distribute_dofs(fe); + + const QGauss quadrature(2); + FEValues fe_values (fe, quadrature, update_values); + + // initialize FEValues with the first cell + fe_values.reinit (dof.begin_active()); + + // then make this first cell invalid by + // coarsening it away + for (unsigned int c=0; c::max_children_per_cell; ++c) + tr.begin(1)->child(c)->set_coarsen_flag(); + tr.execute_coarsening_and_refinement (); + dof.distribute_dofs(fe); + + // initialize FEValues with what is now the + // first cell. this used to fail (see the + // reason given at the top) + fe_values.reinit (dof.begin_active()); + + deallog << "OK" << std::endl; +} + + +int main() +{ + std::ofstream logfile ("cell_similarity_01/output"); + deallog << std::setprecision (4); + + deallog.attach(logfile); + deallog.depth_console (0); + deallog.threshold_double(1.e-7); + + test<1>(); + test<2>(); + test<3>(); +} diff --git a/tests/fe/cell_similarity_crash_01/cmp/generic b/tests/fe/cell_similarity_crash_01/cmp/generic new file mode 100644 index 0000000000..fb71de2867 --- /dev/null +++ b/tests/fe/cell_similarity_crash_01/cmp/generic @@ -0,0 +1,4 @@ + +DEAL::OK +DEAL::OK +DEAL::OK -- 2.39.5