]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Split the test into 3, one for each dimension. The 1d and 2d cases now work, the...
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 27 Dec 2006 17:29:08 +0000 (17:29 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 27 Dec 2006 17:29:08 +0000 (17:29 +0000)
git-svn-id: https://svn.dealii.org/trunk@14277 0785d39b-7218-0410-832d-ea1e28bc413d

tests/bits/Makefile
tests/bits/refine_and_coarsen_1d.cc [moved from tests/bits/refine_and_coarsen.cc with 86% similarity]
tests/bits/refine_and_coarsen_1d/cmp/generic [new file with mode: 0644]
tests/bits/refine_and_coarsen_2d.cc [new file with mode: 0644]
tests/bits/refine_and_coarsen_2d/cmp/generic [new file with mode: 0644]
tests/bits/refine_and_coarsen_3d.cc [new file with mode: 0644]
tests/bits/refine_and_coarsen_3d/cmp/generic [moved from tests/bits/refine_and_coarsen/cmp/generic with 100% similarity]

index 4b8e16ce35bfe5011e67be4643e8e8a851099f16..a04d9c6b0b0eba5d00e935c9220e4d7aba92317a 100644 (file)
@@ -83,7 +83,7 @@ tests_x = grid_generator_?? \
          face_interpolation \
          subface_interpolation \
          face_orientation_crash \
-         refine_and_coarsen
+         refine_and_coarsen_*
 
 # tests for the hp branch:
 #        fe_collection_*
similarity index 86%
rename from tests/bits/refine_and_coarsen.cc
rename to tests/bits/refine_and_coarsen_1d.cc
index 46b868f264ccf741d33a9e83008ad9a6120ed307..554729a3ec6d18b3ded47b8c0bb26e9647ae15f5 100644 (file)
@@ -1,5 +1,5 @@
-//----------------------------  refine_and_coarsen.cc  ---------------------------
-//    $Id: refine_and_coarsen.cc 11749 2005-11-09 19:11:20Z wolf $
+//----------------------------  refine_and_coarsen_1d.cc  ---------------------------
+//    $Id: refine_and_coarsen_1d.cc 11749 2005-11-09 19:11:20Z wolf $
 //    Version: $Name$ 
 //
 //    Copyright (C) 2006 by the deal.II authors
@@ -9,7 +9,7 @@
 //    to the file deal.II/doc/license.html for the  text  and
 //    further information on this license.
 //
-//----------------------------  refine_and_coarsen.cc  ---------------------------
+//----------------------------  refine_and_coarsen_1d.cc  ---------------------------
 
 
 // check that if we take an locally refined mesh, refine it globally once,
@@ -74,14 +74,12 @@ void check ()
 
 int main () 
 {
-  std::ofstream logfile("refine_and_coarsen/output");
+  std::ofstream logfile("refine_and_coarsen_1d/output");
   deallog.attach(logfile);
   deallog.depth_console(0);
   deallog.threshold_double(1.e-10);
 
   check<1> ();
-  check<2> ();
-  check<3> ();
 }
 
   
diff --git a/tests/bits/refine_and_coarsen_1d/cmp/generic b/tests/bits/refine_and_coarsen_1d/cmp/generic
new file mode 100644 (file)
index 0000000..f3ec0fd
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::5
+DEAL::5 5
diff --git a/tests/bits/refine_and_coarsen_2d.cc b/tests/bits/refine_and_coarsen_2d.cc
new file mode 100644 (file)
index 0000000..ceefe79
--- /dev/null
@@ -0,0 +1,86 @@
+//----------------------------  refine_and_coarsen_2d.cc  ---------------------------
+//    $Id: refine_and_coarsen_2d.cc 11749 2005-11-09 19:11:20Z wolf $
+//    Version: $Name$ 
+//
+//    Copyright (C) 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.
+//
+//----------------------------  refine_and_coarsen_2d.cc  ---------------------------
+
+
+// check that if we take an locally refined mesh, refine it globally once,
+// then coarsen it globally again, that we get the same mesh
+
+#include "../tests.h"
+
+#include <base/logstream.h>
+#include <base/quadrature_lib.h>
+#include <grid/tria.h>
+#include <grid/tria_accessor.h>
+#include <grid/tria_iterator.h>
+#include <grid/grid_generator.h>
+
+#include <fstream>
+
+
+
+template <int dim>
+void check ()
+{
+  Triangulation<dim> tria;
+  GridGenerator::hyper_cube (tria);
+  tria.refine_global (2);
+  tria.begin_active()->set_refine_flag();
+  tria.execute_coarsening_and_refinement ();
+
+                                  // store which cells we have here
+  std::vector<typename Triangulation<dim>::active_cell_iterator> cells;
+  for (typename Triangulation<dim>::active_cell_iterator cell=tria.begin_active();
+       cell != tria.end(); ++cell)
+    cells.push_back (cell);
+
+  const unsigned int n_cells = tria.n_active_cells();
+  deallog << n_cells << std::endl;
+
+                                  // refine the mesh globally, then coarsen
+                                  // it again globally
+  tria.refine_global (1);
+
+  for (typename Triangulation<dim>::active_cell_iterator cell=tria.begin_active();
+       cell != tria.end(); ++cell)
+    cell->set_coarsen_flag ();
+  tria.execute_coarsening_and_refinement ();
+
+
+                                  // verify that we get the same cells again
+  deallog << n_cells << ' ' << tria.n_active_cells()
+         << std::endl;
+  
+  Assert (tria.n_active_cells() == n_cells,
+         ExcInternalError());
+
+  unsigned int index = 0;
+  for (typename Triangulation<dim>::active_cell_iterator cell=tria.begin_active();
+       cell != tria.end(); ++cell, ++index)
+    Assert (cells[index] == cell,
+           ExcInternalError());
+
+}
+
+
+int main () 
+{
+  std::ofstream logfile("refine_and_coarsen_2d/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  check<2> ();
+}
+
+  
+  
diff --git a/tests/bits/refine_and_coarsen_2d/cmp/generic b/tests/bits/refine_and_coarsen_2d/cmp/generic
new file mode 100644 (file)
index 0000000..a04060f
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::19
+DEAL::19 19
diff --git a/tests/bits/refine_and_coarsen_3d.cc b/tests/bits/refine_and_coarsen_3d.cc
new file mode 100644 (file)
index 0000000..744ed26
--- /dev/null
@@ -0,0 +1,86 @@
+//----------------------------  refine_and_coarsen_3d.cc  ---------------------------
+//    $Id: refine_and_coarsen_3d.cc 11749 2005-11-09 19:11:20Z wolf $
+//    Version: $Name$ 
+//
+//    Copyright (C) 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.
+//
+//----------------------------  refine_and_coarsen_3d.cc  ---------------------------
+
+
+// check that if we take an locally refined mesh, refine it globally once,
+// then coarsen it globally again, that we get the same mesh
+
+#include "../tests.h"
+
+#include <base/logstream.h>
+#include <base/quadrature_lib.h>
+#include <grid/tria.h>
+#include <grid/tria_accessor.h>
+#include <grid/tria_iterator.h>
+#include <grid/grid_generator.h>
+
+#include <fstream>
+
+
+
+template <int dim>
+void check ()
+{
+  Triangulation<dim> tria;
+  GridGenerator::hyper_cube (tria);
+  tria.refine_global (2);
+  tria.begin_active()->set_refine_flag();
+  tria.execute_coarsening_and_refinement ();
+
+                                  // store which cells we have here
+  std::vector<typename Triangulation<dim>::active_cell_iterator> cells;
+  for (typename Triangulation<dim>::active_cell_iterator cell=tria.begin_active();
+       cell != tria.end(); ++cell)
+    cells.push_back (cell);
+
+  const unsigned int n_cells = tria.n_active_cells();
+  deallog << n_cells << std::endl;
+
+                                  // refine the mesh globally, then coarsen
+                                  // it again globally
+  tria.refine_global (1);
+
+  for (typename Triangulation<dim>::active_cell_iterator cell=tria.begin_active();
+       cell != tria.end(); ++cell)
+    cell->set_coarsen_flag ();
+  tria.execute_coarsening_and_refinement ();
+
+
+                                  // verify that we get the same cells again
+  deallog << n_cells << ' ' << tria.n_active_cells()
+         << std::endl;
+  
+  Assert (tria.n_active_cells() == n_cells,
+         ExcInternalError());
+
+  unsigned int index = 0;
+  for (typename Triangulation<dim>::active_cell_iterator cell=tria.begin_active();
+       cell != tria.end(); ++cell, ++index)
+    Assert (cells[index] == cell,
+           ExcInternalError());
+
+}
+
+
+int main () 
+{
+  std::ofstream logfile("refine_and_coarsen_3d/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  check<3> ();
+}
+
+  
+  

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.