]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add a testcase that reproduces deal.II/grid_transform_3d, which presently exhibits...
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 30 Dec 2006 03:21:44 +0000 (03:21 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 30 Dec 2006 03:21:44 +0000 (03:21 +0000)
git-svn-id: https://svn.dealii.org/trunk@14290 0785d39b-7218-0410-832d-ea1e28bc413d

tests/bits/tria_crash_01.cc [new file with mode: 0644]
tests/bits/tria_crash_01/cmp/generic [new file with mode: 0644]

diff --git a/tests/bits/tria_crash_01.cc b/tests/bits/tria_crash_01.cc
new file mode 100644 (file)
index 0000000..0cc81cd
--- /dev/null
@@ -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 <base/logstream.h>
+#include <grid/tria.h>
+#include <grid/tria_accessor.h>
+#include <grid/tria_boundary_lib.h>
+#include <grid/grid_generator.h>
+#include <grid/grid_out.h>
+
+#include <fstream>
+#include <iostream>
+
+
+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<dim> origin;
+  CylinderBoundary<dim> boundary;
+  Triangulation<dim> 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<unsigned int,Point<dim> > new_points;
+  
+  Triangulation<dim>::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 (file)
index 0000000..f08e311
--- /dev/null
@@ -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.

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.