]> https://gitweb.dealii.org/ - dealii.git/commitdiff
New test that currently fails.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 16 May 2011 14:23:08 +0000 (14:23 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 16 May 2011 14:23:08 +0000 (14:23 +0000)
git-svn-id: https://svn.dealii.org/trunk@23698 0785d39b-7218-0410-832d-ea1e28bc413d

tests/fe/cell_similarity_crash_01.cc [new file with mode: 0644]
tests/fe/cell_similarity_crash_01/cmp/generic [new file with mode: 0644]

diff --git a/tests/fe/cell_similarity_crash_01.cc b/tests/fe/cell_similarity_crash_01.cc
new file mode 100644 (file)
index 0000000..52c831e
--- /dev/null
@@ -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 <base/logstream.h>
+#include <base/quadrature_lib.h>
+#include <grid/grid_generator.h>
+#include <dofs/dof_handler.h>
+#include <fe/fe_values.h>
+#include <fe/fe_q.h>
+
+#include <fstream>
+
+
+
+template <int dim>
+void test()
+{
+  Triangulation<dim> tr;
+  GridGenerator::hyper_cube(tr);
+  tr.refine_global (2);
+
+  FE_Q<dim> fe(1);
+  DoFHandler<dim> dof(tr);
+  dof.distribute_dofs(fe);
+
+  const QGauss<dim> quadrature(2);
+  FEValues<dim> 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<GeometryInfo<dim>::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 (file)
index 0000000..fb71de2
--- /dev/null
@@ -0,0 +1,4 @@
+
+DEAL::OK
+DEAL::OK
+DEAL::OK

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.