]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a test that currently fails inside Triangulation<dim>::prepare_coarsening_and_ref...
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 17 Aug 2008 22:12:36 +0000 (22:12 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 17 Aug 2008 22:12:36 +0000 (22:12 +0000)
git-svn-id: https://svn.dealii.org/trunk@16581 0785d39b-7218-0410-832d-ea1e28bc413d

tests/fail/mesh_smoothing.cc [new file with mode: 0644]

diff --git a/tests/fail/mesh_smoothing.cc b/tests/fail/mesh_smoothing.cc
new file mode 100644 (file)
index 0000000..9157872
--- /dev/null
@@ -0,0 +1,133 @@
+//----------------------------  mesh_smoothing.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2006, 2007, 2008 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.
+//
+//----------------------------  mesh_smoothing.cc  ---------------------------
+
+
+// something went wrong with smoothing a mesh when a particular set of
+// cells were set to be refined. found in step-31
+
+char logname[] = "mesh_smoothing/output";
+
+
+#include "../tests.h"
+
+
+#include <base/logstream.h>
+#include <grid/tria.h>
+#include <grid/grid_generator.h>
+#include <grid/tria_accessor.h>
+#include <grid/tria_iterator.h>
+
+#include <fstream>
+#include <iostream>
+
+#include <fe/fe_q.h>
+#include <grid/grid_out.h>
+#include <dofs/dof_constraints.h>
+#include <grid/grid_refinement.h>
+#include <numerics/error_estimator.h>
+
+#include <complex>
+
+                                // Finally, this is as in previous
+                                // programs:
+using namespace dealii;
+
+
+void test ()
+{
+  Triangulation<2> triangulation (Triangulation<2>::maximum_smoothing);
+  GridGenerator::hyper_cube (triangulation);
+  triangulation.refine_global (3);
+
+  const char *refinement_flags[]
+    = 
+    {
+         "1010222211110211222222220211211111111111111111111111111111111111",
+         "1212111111111111111111111111111111111111222222222222222211111111111111111101102201110210012211112001111111111111111111111111111111111111",
+         "1111111111111111111111111111111111111111111111111121111111111111111111111111111111111111111111111111111211111111111111111111111111021121222222221112112022222222021222011111111102102021111111111111110210102222111102121111111111211111222201012021111111111111",
+         "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110112211111111112111110222222222222022202211212222210111111111111111121111111111221101111202221210222222222022222222220011222211111111222111111111111111112212111111112222000111111111111111111111112210022222021222221011220211111111111111111122111122220120222220212220011111111111",
+         "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111121111111111111111111111111111111111211111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100110011111111111111111111100010100000000000000001101010100000101000001101111100001000000011010000000011111111111111111010000000000001111111111111111111111111111111111111111110001100111111111111111111100000000000001111111111111111000001010010000000000000010100100100111100000101111111100100000000000101000001010000000011111111000101111111111110110010111111110000000011111111111111111111110011111111111110000000000000000001111100001111101000001111000010000010000011111111111111111100111100000000001000001111111101001111111100000100000000001111010111110000000111111111",
+         "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101111111111111111111111110111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110011001111101111111111111110001010000000000000000110111010000010100000111111110000100000001101000000000111111111111111101000000000000111111111100011001110000000000000000001010010000000000000011100100100111100000101111111110100000000000101000001010000000011111111000001111111111110110000111111110000000011111111111111111111110011111111111110000000000000000001111100001111101000001111000010000010000011111111111111111100111100000100001100001111111101001111111100000100000000001111010111110000000111111111"
+    };
+  const unsigned int n_refinement_steps = sizeof(refinement_flags) /
+                                         sizeof(refinement_flags[0]);
+
+  for (unsigned int i=0; i<n_refinement_steps; ++i)
+    {
+      Assert (triangulation.n_active_cells() ==
+             std::strlen(refinement_flags[i]),
+             ExcInternalError());
+
+                                      // set refinement flags from
+                                      // the string above
+      unsigned int index = 0;
+      for (Triangulation<2>::active_cell_iterator
+            cell = triangulation.begin_active();
+          cell != triangulation.end(); ++cell, ++index)
+       if (refinement_flags[i][index] == '2')
+         cell->set_refine_flag();
+       else if (refinement_flags[i][index] == '1')
+         cell->set_coarsen_flag();
+
+      triangulation.prepare_coarsening_and_refinement ();
+      triangulation.execute_coarsening_and_refinement ();
+
+      deallog << triangulation.n_active_cells()
+             << " (on "
+             << triangulation.n_levels()
+             << " levels)"
+             << std::endl;
+    }
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile(logname);
+  logfile.precision (3);
+  
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+  try
+    {
+      test();
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    }
+
+  return 0;
+}

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.