]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add simpler test.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 29 Oct 2008 22:49:41 +0000 (22:49 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 29 Oct 2008 22:49:41 +0000 (22:49 +0000)
git-svn-id: https://svn.dealii.org/trunk@17405 0785d39b-7218-0410-832d-ea1e28bc413d

15 files changed:
tests/deal.II/Makefile
tests/deal.II/number_cache/cmp/generic [deleted file]
tests/deal.II/number_cache_01.cc [new file with mode: 0644]
tests/deal.II/number_cache_01/1.in [moved from tests/deal.II/number_cache/1.in with 100% similarity]
tests/deal.II/number_cache_01/1.nc [moved from tests/deal.II/number_cache/1.nc with 100% similarity]
tests/deal.II/number_cache_01/2.in [moved from tests/deal.II/number_cache/2.in with 100% similarity]
tests/deal.II/number_cache_01/3.in [moved from tests/deal.II/number_cache/3.in with 100% similarity]
tests/deal.II/number_cache_01/4.in [moved from tests/deal.II/number_cache/4.in with 100% similarity]
tests/deal.II/number_cache_01/cmp/generic [new file with mode: 0644]
tests/deal.II/number_cache_01/evil_0.in [moved from tests/deal.II/number_cache/evil_0.in with 100% similarity]
tests/deal.II/number_cache_01/evil_1.in [moved from tests/deal.II/number_cache/evil_1.in with 100% similarity]
tests/deal.II/number_cache_01/evil_2.in [moved from tests/deal.II/number_cache/evil_2.in with 100% similarity]
tests/deal.II/number_cache_01/evil_3.in [moved from tests/deal.II/number_cache/evil_3.in with 100% similarity]
tests/deal.II/number_cache_01/evil_4.in [moved from tests/deal.II/number_cache/evil_4.in with 100% similarity]
tests/deal.II/number_cache_02.cc [new file with mode: 0644]

index d1b2f64881b379e4fbb317b61bff18935ccfa912..1c6deb6e6b697f25d6feb65a404f8f75abe489cb 100644 (file)
@@ -80,7 +80,7 @@ tests_x = block_matrices \
        rt_hessian \
        rt_covariant \
        coarsening_* \
-       number_cache
+       number_cache_*
 
 # from above list of regular expressions, generate the real set of
 # tests
diff --git a/tests/deal.II/number_cache/cmp/generic b/tests/deal.II/number_cache/cmp/generic
deleted file mode 100644 (file)
index 0ce9e3a..0000000
+++ /dev/null
@@ -1,301 +0,0 @@
-
-DEAL::Reading grid_in/2d.xda
-DEAL::  29037
-DEAL::  29037
-DEAL::  58529
-DEAL::  58529
-DEAL::  29037
-DEAL::  29037
-DEAL::  0
-DEAL::  0
-DEAL::  29037
-DEAL::  29037
-DEAL::  29037
-DEAL::  29037
-DEAL::  Refining...
-DEAL::  29070
-DEAL::  29081
-DEAL::  58603
-DEAL::  58633
-DEAL::  29070
-DEAL::  29081
-DEAL::  0
-DEAL::  0
-DEAL::  29026
-DEAL::  29037
-DEAL::  29026
-DEAL::  29037
-DEAL::  44
-DEAL::  44
-DEAL::  44
-DEAL::  44
-DEAL::Reading grid_in_3d/1.in
-DEAL::  16480
-DEAL::  16480
-DEAL::  54668
-DEAL::  54668
-DEAL::  52008
-DEAL::  52008
-DEAL::  16480
-DEAL::  16480
-DEAL::  16480
-DEAL::  16480
-DEAL::  16480
-DEAL::  16480
-DEAL::  Refining...
-DEAL::  16557
-DEAL::  16568
-DEAL::  55050
-DEAL::  55142
-DEAL::  52308
-DEAL::  52364
-DEAL::  16557
-DEAL::  16568
-DEAL::  16469
-DEAL::  16480
-DEAL::  16469
-DEAL::  16480
-DEAL::  88
-DEAL::  88
-DEAL::  88
-DEAL::  88
-DEAL::Reading grid_in_3d/2.in
-DEAL::  360
-DEAL::  360
-DEAL::  1390
-DEAL::  1390
-DEAL::  1218
-DEAL::  1218
-DEAL::  360
-DEAL::  360
-DEAL::  360
-DEAL::  360
-DEAL::  360
-DEAL::  360
-DEAL::  Refining...
-DEAL::  437
-DEAL::  448
-DEAL::  1732
-DEAL::  1808
-DEAL::  1500
-DEAL::  1550
-DEAL::  437
-DEAL::  448
-DEAL::  349
-DEAL::  360
-DEAL::  349
-DEAL::  360
-DEAL::  88
-DEAL::  88
-DEAL::  88
-DEAL::  88
-DEAL::Reading grid_in_3d/3.in
-DEAL::  2
-DEAL::  2
-DEAL::  20
-DEAL::  20
-DEAL::  11
-DEAL::  11
-DEAL::  2
-DEAL::  2
-DEAL::  2
-DEAL::  2
-DEAL::  2
-DEAL::  2
-DEAL::  Refining...
-DEAL::  9
-DEAL::  10
-DEAL::  62
-DEAL::  74
-DEAL::  41
-DEAL::  47
-DEAL::  9
-DEAL::  10
-DEAL::  1
-DEAL::  2
-DEAL::  1
-DEAL::  2
-DEAL::  8
-DEAL::  8
-DEAL::  8
-DEAL::  8
-DEAL::Reading grid_in_3d/4.in
-DEAL::  13824
-DEAL::  13824
-DEAL::  44210
-DEAL::  44210
-DEAL::  42816
-DEAL::  42816
-DEAL::  13824
-DEAL::  13824
-DEAL::  13824
-DEAL::  13824
-DEAL::  13824
-DEAL::  13824
-DEAL::  Refining...
-DEAL::  13901
-DEAL::  13912
-DEAL::  44578
-DEAL::  44664
-DEAL::  43110
-DEAL::  43164
-DEAL::  13901
-DEAL::  13912
-DEAL::  13813
-DEAL::  13824
-DEAL::  13813
-DEAL::  13824
-DEAL::  88
-DEAL::  88
-DEAL::  88
-DEAL::  88
-DEAL::Reading grid_in_3d/evil_0.in
-DEAL::  10
-DEAL::  10
-DEAL::  80
-DEAL::  80
-DEAL::  50
-DEAL::  50
-DEAL::  10
-DEAL::  10
-DEAL::  10
-DEAL::  10
-DEAL::  10
-DEAL::  10
-DEAL::  Refining...
-DEAL::  38
-DEAL::  42
-DEAL::  224
-DEAL::  260
-DEAL::  161
-DEAL::  182
-DEAL::  38
-DEAL::  42
-DEAL::  6
-DEAL::  10
-DEAL::  6
-DEAL::  10
-DEAL::  32
-DEAL::  32
-DEAL::  32
-DEAL::  32
-DEAL::Reading grid_in_3d/evil_1.in
-DEAL::  10
-DEAL::  10
-DEAL::  80
-DEAL::  80
-DEAL::  50
-DEAL::  50
-DEAL::  10
-DEAL::  10
-DEAL::  10
-DEAL::  10
-DEAL::  10
-DEAL::  10
-DEAL::  Refining...
-DEAL::  38
-DEAL::  42
-DEAL::  224
-DEAL::  260
-DEAL::  161
-DEAL::  182
-DEAL::  38
-DEAL::  42
-DEAL::  6
-DEAL::  10
-DEAL::  6
-DEAL::  10
-DEAL::  32
-DEAL::  32
-DEAL::  32
-DEAL::  32
-DEAL::Reading grid_in_3d/evil_2.in
-DEAL::  10
-DEAL::  10
-DEAL::  80
-DEAL::  80
-DEAL::  50
-DEAL::  50
-DEAL::  10
-DEAL::  10
-DEAL::  10
-DEAL::  10
-DEAL::  10
-DEAL::  10
-DEAL::  Refining...
-DEAL::  38
-DEAL::  42
-DEAL::  224
-DEAL::  260
-DEAL::  161
-DEAL::  182
-DEAL::  38
-DEAL::  42
-DEAL::  6
-DEAL::  10
-DEAL::  6
-DEAL::  10
-DEAL::  32
-DEAL::  32
-DEAL::  32
-DEAL::  32
-DEAL::Reading grid_in_3d/evil_3.in
-DEAL::  10
-DEAL::  10
-DEAL::  80
-DEAL::  80
-DEAL::  50
-DEAL::  50
-DEAL::  10
-DEAL::  10
-DEAL::  10
-DEAL::  10
-DEAL::  10
-DEAL::  10
-DEAL::  Refining...
-DEAL::  38
-DEAL::  42
-DEAL::  224
-DEAL::  260
-DEAL::  161
-DEAL::  182
-DEAL::  38
-DEAL::  42
-DEAL::  6
-DEAL::  10
-DEAL::  6
-DEAL::  10
-DEAL::  32
-DEAL::  32
-DEAL::  32
-DEAL::  32
-DEAL::Reading grid_in_3d/evil_4.in
-DEAL::  10
-DEAL::  10
-DEAL::  80
-DEAL::  80
-DEAL::  50
-DEAL::  50
-DEAL::  10
-DEAL::  10
-DEAL::  10
-DEAL::  10
-DEAL::  10
-DEAL::  10
-DEAL::  Refining...
-DEAL::  38
-DEAL::  42
-DEAL::  224
-DEAL::  260
-DEAL::  161
-DEAL::  182
-DEAL::  38
-DEAL::  42
-DEAL::  6
-DEAL::  10
-DEAL::  6
-DEAL::  10
-DEAL::  32
-DEAL::  32
-DEAL::  32
-DEAL::  32
diff --git a/tests/deal.II/number_cache_01.cc b/tests/deal.II/number_cache_01.cc
new file mode 100644 (file)
index 0000000..343e4da
--- /dev/null
@@ -0,0 +1,106 @@
+//----------------------------  number_cache_01.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 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.
+//
+//----------------------------  number_cache_01.cc  ---------------------------
+
+
+// test that we correctly compute the number of lines, quads, hexes, etc and
+// store them in the number cache of the Triangulation class. use a simple
+// grid for this
+
+#include "../tests.h"
+#include <dofs/dof_handler.h>
+#include <grid/tria.h>
+#include <grid/tria_boundary.h>
+#include <grid/tria_boundary_lib.h>
+#include <grid/tria_accessor.h>
+#include <grid/tria_iterator.h>
+#include <grid/grid_out.h>
+#include <grid/grid_in.h>
+#include <grid/grid_generator.h>
+#include <base/logstream.h>
+
+#include <fstream>
+#include <iomanip>
+
+std::ofstream logfile("number_cache_01/output");
+
+
+
+template <int dim>
+void output (const Triangulation<dim> &tria)
+{
+  
+  deallog << "  " << tria.n_active_cells() << std::endl;
+  deallog << "  " << tria.n_cells() << std::endl;
+  deallog << "  " << tria.n_active_lines() << std::endl;
+  deallog << "  " << tria.n_lines() << std::endl;
+  deallog << "  " << tria.n_active_quads() << std::endl;
+  deallog << "  " << tria.n_quads() << std::endl;
+  deallog << "  " << tria.n_active_hexs() << std::endl;
+  deallog << "  " << tria.n_hexs() << std::endl;
+
+  for (unsigned int i=0; i<tria.n_levels(); ++i)
+    {
+      deallog << "  " << tria.n_active_cells(i) << std::endl;
+      deallog << "  " << tria.n_cells(i) << std::endl;
+      if (dim == 1)
+       {
+         deallog << "  " << tria.n_active_lines(i) << std::endl;
+         deallog << "  " << tria.n_lines(i) << std::endl;
+       }
+      
+      if (dim == 2)
+       {
+         deallog << "  " << tria.n_active_quads(i) << std::endl;
+         deallog << "  " << tria.n_quads(i) << std::endl;
+       }
+      
+      if (dim == 3)
+       {
+         deallog << "  " << tria.n_active_hexs(i) << std::endl;
+         deallog << "  " << tria.n_hexs(i) << std::endl;
+       }
+    }
+}
+
+
+template <int dim>
+void test ()
+{
+  deallog << dim << "d" << std::endl;
+  
+  Triangulation<dim> tria;
+  GridGenerator::hyper_cube (tria);
+  
+  output (tria);
+
+  deallog << "Refining..." << std::endl;
+
+  tria.begin_active()->set_refine_flag ();
+  tria.execute_coarsening_and_refinement ();
+
+  output (tria);
+}
+
+
+int main ()
+{
+  deallog << std::setprecision (2);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test<1> ();
+  test<2> ();
+  test<3> ();
+}
+
diff --git a/tests/deal.II/number_cache_01/cmp/generic b/tests/deal.II/number_cache_01/cmp/generic
new file mode 100644 (file)
index 0000000..b2a4130
--- /dev/null
@@ -0,0 +1,91 @@
+
+DEAL::1d
+DEAL::  1
+DEAL::  1
+DEAL::  1
+DEAL::  1
+DEAL::  0
+DEAL::  0
+DEAL::  0
+DEAL::  0
+DEAL::  1
+DEAL::  1
+DEAL::  1
+DEAL::  1
+DEAL::Refining...
+DEAL::  2
+DEAL::  3
+DEAL::  2
+DEAL::  3
+DEAL::  0
+DEAL::  0
+DEAL::  0
+DEAL::  0
+DEAL::  0
+DEAL::  1
+DEAL::  0
+DEAL::  1
+DEAL::  2
+DEAL::  2
+DEAL::  2
+DEAL::  2
+DEAL::2d
+DEAL::  1
+DEAL::  1
+DEAL::  4
+DEAL::  4
+DEAL::  1
+DEAL::  1
+DEAL::  0
+DEAL::  0
+DEAL::  1
+DEAL::  1
+DEAL::  1
+DEAL::  1
+DEAL::Refining...
+DEAL::  4
+DEAL::  5
+DEAL::  12
+DEAL::  16
+DEAL::  4
+DEAL::  5
+DEAL::  0
+DEAL::  0
+DEAL::  0
+DEAL::  1
+DEAL::  0
+DEAL::  1
+DEAL::  4
+DEAL::  4
+DEAL::  4
+DEAL::  4
+DEAL::3d
+DEAL::  1
+DEAL::  1
+DEAL::  12
+DEAL::  12
+DEAL::  6
+DEAL::  6
+DEAL::  1
+DEAL::  1
+DEAL::  1
+DEAL::  1
+DEAL::  1
+DEAL::  1
+DEAL::Refining...
+DEAL::  8
+DEAL::  9
+DEAL::  54
+DEAL::  66
+DEAL::  36
+DEAL::  42
+DEAL::  8
+DEAL::  9
+DEAL::  0
+DEAL::  1
+DEAL::  0
+DEAL::  1
+DEAL::  8
+DEAL::  8
+DEAL::  8
+DEAL::  8
diff --git a/tests/deal.II/number_cache_02.cc b/tests/deal.II/number_cache_02.cc
new file mode 100644 (file)
index 0000000..2cfcaa1
--- /dev/null
@@ -0,0 +1,133 @@
+//----------------------------  number_cache_02.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 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.
+//
+//----------------------------  number_cache_02.cc  ---------------------------
+
+
+// test that we correctly compute the number of lines, quads, hexes, etc and
+// store them in the number cache of the Triangulation class. use the meshes
+// from grid_in (2d) and grid_in_3d (3d) for this
+
+#include "../tests.h"
+#include <dofs/dof_handler.h>
+#include <grid/tria.h>
+#include <grid/tria_boundary.h>
+#include <grid/tria_boundary_lib.h>
+#include <grid/tria_accessor.h>
+#include <grid/tria_iterator.h>
+#include <grid/grid_out.h>
+#include <grid/grid_in.h>
+#include <grid/grid_generator.h>
+#include <base/logstream.h>
+
+#include <fstream>
+#include <iomanip>
+
+std::ofstream logfile("number_cache_02/output");
+
+
+
+template <int dim>
+void output (const Triangulation<dim> &tria)
+{
+  
+  deallog << "  " << tria.n_active_cells() << std::endl;
+  deallog << "  " << tria.n_cells() << std::endl;
+  deallog << "  " << tria.n_active_lines() << std::endl;
+  deallog << "  " << tria.n_lines() << std::endl;
+  deallog << "  " << tria.n_active_quads() << std::endl;
+  deallog << "  " << tria.n_quads() << std::endl;
+  deallog << "  " << tria.n_active_hexs() << std::endl;
+  deallog << "  " << tria.n_hexs() << std::endl;
+
+  for (unsigned int i=0; i<tria.n_levels(); ++i)
+    {
+      deallog << "  " << tria.n_active_cells(i) << std::endl;
+      deallog << "  " << tria.n_cells(i) << std::endl;
+      if (dim == 1)
+       {
+         deallog << "  " << tria.n_active_lines(i) << std::endl;
+         deallog << "  " << tria.n_lines(i) << std::endl;
+       }
+      
+      if (dim == 2)
+       {
+         deallog << "  " << tria.n_active_quads(i) << std::endl;
+         deallog << "  " << tria.n_quads(i) << std::endl;
+       }
+      
+      if (dim == 3)
+       {
+         deallog << "  " << tria.n_active_hexs(i) << std::endl;
+         deallog << "  " << tria.n_hexs(i) << std::endl;
+       }
+    }
+}
+
+
+template <int dim>
+void test (const char *filename)
+{
+  deallog << "Reading " << filename << std::endl;
+  
+  Triangulation<dim> tria;
+  GridIn<dim> gi;
+  gi.attach_triangulation (tria);
+  std::ifstream in (filename);
+
+  try
+    {
+      gi.read_xda (in);
+    }
+  catch (std::exception &exc)
+    {
+      deallog << "  caught exception:" << std::endl
+             << exc.what()
+             << std::endl;
+      return;
+    }
+
+  output (tria);
+  
+                                  // now refine a few cells and output again
+  deallog << "  Refining..." << std::endl;
+  typename Triangulation<dim>::active_cell_iterator
+    cell = tria.begin_active();
+  for (unsigned int i=0; i<=std::min (tria.n_active_cells() / 3,
+                                     10U); ++i, ++cell)
+    cell->set_refine_flag ();
+  tria.execute_coarsening_and_refinement ();
+
+  output (tria);
+}
+
+
+int main ()
+{
+  deallog << std::setprecision (2);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test<2> ("grid_in/2d.xda");
+  
+  test<3> ("grid_in_3d/1.in");
+  test<3> ("grid_in_3d/2.in");
+  test<3> ("grid_in_3d/3.in");
+  test<3> ("grid_in_3d/4.in");
+
+  test<3> ("grid_in_3d/evil_0.in");
+  test<3> ("grid_in_3d/evil_1.in");
+  test<3> ("grid_in_3d/evil_2.in");
+  test<3> ("grid_in_3d/evil_3.in");
+  test<3> ("grid_in_3d/evil_4.in");
+}
+

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.