]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
New test.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 11 May 2010 12:29:32 +0000 (12:29 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 11 May 2010 12:29:32 +0000 (12:29 +0000)
git-svn-id: https://svn.dealii.org/trunk@21118 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 6d2d3b7ac2ee25d6aa95ad399ecfae75dac9a72d..53a5037840bc7c9d636ad2d1608768165feb3a8b 100644 (file)
@@ -1,6 +1,6 @@
 ############################################################
 # $Id$
-# Copyright (C) 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
+# Copyright (C) 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors
 ############################################################
 
 ############################################################
@@ -17,7 +17,7 @@ libraries = $(lib-deal2-1d.g) \
             $(lib-lac.g)  \
             $(lib-base.g)
 
-default: run-tests 
+default: run-tests
 
 ############################################################
 
@@ -46,6 +46,7 @@ tests_x = block_info block_matrices \
        grid_transform_3d \
        grid_hyper_* \
        measure_et_al \
+       extent_in_direction \
        normals_at_vertices \
        intergrid_constraints \
        intergrid_map \
diff --git a/tests/deal.II/extent_in_direction.cc b/tests/deal.II/extent_in_direction.cc
new file mode 100644 (file)
index 0000000..86910e7
--- /dev/null
@@ -0,0 +1,117 @@
+//----------------------------  extent_in_direction.cc  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2010 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.
+//
+//----------------------------  extent_in_direction.cc  ---------------------------
+
+// test TriaAccessor::extent_in_direction
+
+#include "../tests.h"
+#include <grid/tria.h>
+#include <grid/tria_iterator.h>
+#include <grid/tria_accessor.h>
+#include <grid/grid_generator.h>
+#include <fstream>
+#include <iomanip>
+
+#define PRECISION 5
+
+
+void create_triangulation(const unsigned int case_no,
+                         Triangulation<1> &tria)
+{
+  switch (case_no)
+    {
+      case 0:
+           GridGenerator::hyper_cube(tria, 1., 3.);
+           break;
+      case 1:
+           GridGenerator::hyper_cube(tria, 1., 4.);
+           break;
+      default:
+           Assert(false, ExcNotImplemented());
+    };
+}
+
+
+void create_triangulation(const unsigned int case_no,
+                         Triangulation<2> &tria)
+{
+  switch (case_no)
+    {
+      case 0:
+           GridGenerator::hyper_cube(tria, 1., 3.);
+           break;
+      case 1:
+      {
+       GridGenerator::hyper_cube(tria, 1., 3.);
+       Point<2> &v0=tria.begin_active()->vertex(0);
+       v0(0) = 0.;
+       Point<2> &v2=tria.begin_active()->vertex(3);
+       v2(0) = 5.;
+       v2(1) = 4.;
+       break;
+      }
+      default:
+           Assert(false, ExcNotImplemented());
+    };
+}
+
+
+void create_triangulation(const unsigned int case_no,
+                         Triangulation<3> &tria)
+{
+  switch (case_no)
+    {
+      case 0:
+           GridGenerator::hyper_cube(tria, 1., 3.);
+           break;
+      case 1:
+      {
+       GridGenerator::hyper_cube(tria, 1., 3.);
+       Point<3> &v0=tria.begin_active()->vertex(0);
+       v0(0) = 0.;
+       break;
+      }
+      default:
+           Assert(false, ExcNotImplemented());
+    };
+}
+
+
+template<int dim>
+void test()
+{
+  Triangulation<dim> tria;
+  for (unsigned int case_no=0; case_no<2; ++case_no)
+    {
+      create_triangulation(case_no, tria);
+      deallog << "dim " << dim << ", case " << case_no << ": ";
+      for (unsigned int i=0; i<dim; ++i)
+       deallog << tria.begin_active()->extent_in_direction(i) << ' ';
+      deallog << std::endl;
+      tria.clear();
+    }
+}
+
+
+int main()
+{
+  std::ofstream logfile ("extent_in_direction/output");
+  deallog << std::setprecision (PRECISION);
+  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/extent_in_direction/cmp/generic b/tests/deal.II/extent_in_direction/cmp/generic
new file mode 100644 (file)
index 0000000..e4863e2
--- /dev/null
@@ -0,0 +1,13 @@
+
+DEAL::dim2:case0:measure=4.0000
+DEAL::dim2:case0:center=2.0000 2.0000
+DEAL::dim2:case0:barycenter=2.0000 2.0000
+DEAL::dim2:case1:measure=8.0000
+DEAL::dim2:case1:center=2.2500 2.2500
+DEAL::dim2:case1:barycenter=2.3750 2.2917
+DEAL::dim3:case0:measure=8.0000
+DEAL::dim3:case0:center=2.0000 2.0000 2.0000
+DEAL::dim3:case0:barycenter=2.0000 2.0000 2.0000
+DEAL::dim3:case1:measure=9.0000
+DEAL::dim3:case1:center=1.8750 2.0000 2.0000
+DEAL::dim3:case1:barycenter=1.8642 1.9630 1.9630

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.