]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
test for TriaAccessor<>::minimum_vertex_distance().
authorheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 25 Oct 2011 20:35:56 +0000 (20:35 +0000)
committerheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 25 Oct 2011 20:35:56 +0000 (20:35 +0000)
git-svn-id: https://svn.dealii.org/trunk@24676 0785d39b-7218-0410-832d-ea1e28bc413d

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

diff --git a/tests/deal.II/measure_et_al_02.cc b/tests/deal.II/measure_et_al_02.cc
new file mode 100644 (file)
index 0000000..d31ade0
--- /dev/null
@@ -0,0 +1,118 @@
+//----------------------------  measure_et_al.cc  ---------------------------
+//    $Id: measure_et_al.cc 23710 2011-05-17 04:50:10Z bangerth $
+//    Version: $Name$
+//
+//    Copyright (C) 2005, 2006, 2008, 2009, 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.
+//
+//----------------------------  measure_et_al.cc  ---------------------------
+
+// Computes diameter, extent_in_direction, and minimum_vertex_distance on a variety of cells
+
+#include "../tests.h"
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/tria_iterator.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/grid_generator.h>
+#include <fstream>
+#include <iomanip>
+
+#define PRECISION 5
+
+
+template<int dim>
+void create_triangulation(const unsigned int,
+                         Triangulation<dim> &)
+{
+  Assert(false, ExcNotImplemented());
+}
+
+
+template<>
+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.;
+       break;
+       }
+               case 2:
+      {
+       GridGenerator::hyper_cube(tria, 1., 3.);
+       Point<2> &v0=tria.begin_active()->vertex(0);
+       v0(0) = 0.;
+       Point<2> &v3=tria.begin_active()->vertex(3);
+       v3(0) = 4.;
+       break;
+      }
+      default:
+           Assert(false, ExcNotImplemented());
+    };
+}
+
+
+template<>
+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:
+               case 2:// like 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<3; ++case_no)
+    {
+      create_triangulation(case_no, tria);
+      deallog << "dim" << dim << ":case" << case_no << ":diameter="
+             << tria.begin_active()->diameter() << std::endl;
+      deallog << "dim" << dim << ":case" << case_no << ":extent_in_direction="
+             << tria.begin_active()->extent_in_direction(0) << std::endl;
+      deallog << "dim" << dim << ":case" << case_no << ":minimum_vertex_distance="
+             << tria.begin_active()->minimum_vertex_distance() << std::endl;
+      tria.clear();
+    }
+}
+
+
+int main()
+{
+  std::ofstream logfile ("measure_et_al_02/output");
+  deallog << std::setprecision (PRECISION);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test<2>();
+  test<3>();
+}
+
diff --git a/tests/deal.II/measure_et_al_02/cmp/generic b/tests/deal.II/measure_et_al_02/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.