]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
New tests
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 10 Sep 2006 16:59:05 +0000 (16:59 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 10 Sep 2006 16:59:05 +0000 (16:59 +0000)
git-svn-id: https://svn.dealii.org/trunk@13891 0785d39b-7218-0410-832d-ea1e28bc413d

tests/deal.II/Makefile
tests/deal.II/maximal_cell_diameter.cc [new file with mode: 0644]
tests/deal.II/maximal_cell_diameter/cmp/generic [new file with mode: 0644]
tests/deal.II/minimal_cell_diameter.cc [new file with mode: 0644]
tests/deal.II/minimal_cell_diameter/cmp/generic [new file with mode: 0644]

index 8a469d27bf3f26bc4f3a0e09e69a7c0b6e1aac43..dff4a91d40da60ce442eac36de5e450e85d1f989 100644 (file)
@@ -54,7 +54,9 @@ tests_x = block_matrices \
        interpolate_* \
        have_same_coarse_mesh_* \
        get_finest_common_cells_* \
-       project_*[0-9]
+       project_*[0-9] \
+       minimal_cell_diameter \
+       maximal_cell_diameter
 
 # from above list of regular expressions, generate the real set of
 # tests
diff --git a/tests/deal.II/maximal_cell_diameter.cc b/tests/deal.II/maximal_cell_diameter.cc
new file mode 100644 (file)
index 0000000..08816e7
--- /dev/null
@@ -0,0 +1,87 @@
+//----------------------------  maximal_cell_diameter.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 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.
+//
+//----------------------------  maximal_cell_diameter.cc  ---------------------------
+
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <grid/tria.h>
+#include <grid/grid_generator.h>
+#include <grid/grid_tools.h>
+#include <grid/grid_out.h>
+
+#include <fstream>
+
+
+std::ofstream logfile("maximal_cell_diameter/output");
+
+
+
+template <int dim>
+void test1 ()
+{
+                                  // test 1: hypercube
+  if (true)
+    {
+      Triangulation<dim> tria;
+      GridGenerator::hyper_cube(tria);
+
+      for (unsigned int i=0; i<2; ++i)
+       {
+         tria.refine_global(2);
+         deallog << dim << "d, "
+                 << "max diameter: "
+                 << GridTools::maximal_cell_diameter (tria)
+                 << std::endl;
+         Assert (GridTools::maximal_cell_diameter (tria)
+                 >=
+                 GridTools::minimal_cell_diameter (tria),
+                 ExcInternalError());
+       };
+    };
+
+                                  // test 2: hyperball
+  if (dim >= 2)
+    {
+      Triangulation<dim> tria;
+      GridGenerator::hyper_ball(tria, Point<dim>(), 1);
+
+      for (unsigned int i=0; i<2; ++i)
+       {
+         tria.refine_global(2);
+         deallog << dim << "d, "
+                 << "max diameter: "
+                 << GridTools::maximal_cell_diameter (tria)
+                 << std::endl;
+         Assert (GridTools::maximal_cell_diameter (tria)
+                 >=
+                 GridTools::minimal_cell_diameter (tria),
+                 ExcInternalError());
+       };
+    };
+}
+
+
+int main ()
+{
+  logfile.precision(4);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test1<1> ();
+  test1<2> ();
+  test1<3> ();
+
+  return 0;
+}
+
diff --git a/tests/deal.II/maximal_cell_diameter/cmp/generic b/tests/deal.II/maximal_cell_diameter/cmp/generic
new file mode 100644 (file)
index 0000000..5f04090
--- /dev/null
@@ -0,0 +1,11 @@
+
+DEAL::1d, max diameter: 0.2500
+DEAL::1d, max diameter: 0.06250
+DEAL::2d, max diameter: 0.3536
+DEAL::2d, max diameter: 0.08839
+DEAL::2d, max diameter: 0.4183
+DEAL::2d, max diameter: 0.1140
+DEAL::3d, max diameter: 0.4330
+DEAL::3d, max diameter: 0.1083
+DEAL::3d, max diameter: 0.4817
+DEAL::3d, max diameter: 0.1324
diff --git a/tests/deal.II/minimal_cell_diameter.cc b/tests/deal.II/minimal_cell_diameter.cc
new file mode 100644 (file)
index 0000000..717f2b5
--- /dev/null
@@ -0,0 +1,81 @@
+//----------------------------  minimal_cell_diameter.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 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.
+//
+//----------------------------  minimal_cell_diameter.cc  ---------------------------
+
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <grid/tria.h>
+#include <grid/grid_generator.h>
+#include <grid/grid_tools.h>
+#include <grid/grid_out.h>
+
+#include <fstream>
+
+
+std::ofstream logfile("minimal_cell_diameter/output");
+
+
+
+template <int dim>
+void test1 ()
+{
+                                  // test 1: hypercube
+  if (true)
+    {
+      Triangulation<dim> tria;
+      GridGenerator::hyper_cube(tria);
+
+      for (unsigned int i=0; i<2; ++i)
+       {
+         tria.refine_global(2);
+         deallog << dim << "d, "
+                 << "min diameter: "
+                 << GridTools::minimal_cell_diameter (tria)
+                 << std::endl;
+       };
+    };
+
+                                  // test 2: hyperball
+  if (dim >= 2)
+    {
+      Triangulation<dim> tria;
+      GridGenerator::hyper_ball(tria, Point<dim>(), 1);
+
+      for (unsigned int i=0; i<2; ++i)
+       {
+         tria.refine_global(2);
+         deallog << dim << "d, "
+                 << "min diameter: "
+                 << GridTools::minimal_cell_diameter (tria)
+                 << std::endl;
+       };
+    };
+}
+
+
+
+
+int main ()
+{
+  logfile.precision(4);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test1<1> ();
+  test1<2> ();
+  test1<3> ();
+
+  return 0;
+}
+
diff --git a/tests/deal.II/minimal_cell_diameter/cmp/generic b/tests/deal.II/minimal_cell_diameter/cmp/generic
new file mode 100644 (file)
index 0000000..8aa639d
--- /dev/null
@@ -0,0 +1,11 @@
+
+DEAL::1d, min diameter: 0.2500
+DEAL::1d, min diameter: 0.06250
+DEAL::2d, min diameter: 0.3536
+DEAL::2d, min diameter: 0.08839
+DEAL::2d, min diameter: 0.2071
+DEAL::2d, min diameter: 0.04752
+DEAL::3d, min diameter: 0.4330
+DEAL::3d, min diameter: 0.1083
+DEAL::3d, min diameter: 0.1830
+DEAL::3d, min diameter: 0.04575

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.