]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add one test.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 25 Aug 2011 02:35:27 +0000 (02:35 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 25 Aug 2011 02:35:27 +0000 (02:35 +0000)
git-svn-id: https://svn.dealii.org/trunk@24193 0785d39b-7218-0410-832d-ea1e28bc413d

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

diff --git a/tests/deal.II/normals_at_vertices_02.cc b/tests/deal.II/normals_at_vertices_02.cc
new file mode 100644 (file)
index 0000000..89c5e54
--- /dev/null
@@ -0,0 +1,67 @@
+//----------------------------  normals_at_vertices_02.cc  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2005, 2008, 2011 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.
+//
+//----------------------------  normals_at_vertices_02.cc  ---------------------------
+
+
+#include "../tests.h"
+#include <deal.II/base/quadrature_lib.h>
+#include <deal.II/base/logstream.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/tria_boundary.h>
+#include <deal.II/grid/tria_boundary_lib.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>
+
+
+
+
+int main ()
+{
+  std::ofstream logfile ("normals_at_vertices_02/output");
+  deallog << std::setprecision (3);
+  deallog << std::fixed;
+  deallog.attach(logfile);
+  deallog.depth_console (0);
+
+  HyperBallBoundary<3> boundary (Point<3>(1,0,0));
+
+  Triangulation<3> tria;
+  Boundary<3>::FaceVertexNormals normals;
+
+  GridGenerator::hyper_ball (tria, Point<3>(1,0,0), 3);
+
+  Triangulation<3>::active_cell_iterator cell=tria.begin_active();
+  for (; cell!=tria.end(); ++cell)
+    for (unsigned int face_no=0;
+        face_no<GeometryInfo<3>::faces_per_cell; ++face_no)
+      if (cell->at_boundary(face_no))
+       {
+         deallog << " Face" << face_no << std::endl;
+         Triangulation<3>::face_iterator face = cell->face(face_no);
+         boundary.get_normals_at_vertices(face, normals);
+         for (unsigned int v=0; v<GeometryInfo<3>::vertices_per_face; ++v)
+           {
+             deallog << "  vertex=" << face->vertex(v)
+                     << ",  normal=" << normals[v] << std::endl;
+
+                                              // note that we can't check
+                                              // here that the normal vector
+                                              // is, in fact, normalized,
+                                              // since the function does not
+                                              // actually guarantee that
+           }
+       }
+}
diff --git a/tests/deal.II/normals_at_vertices_02/cmp/generic b/tests/deal.II/normals_at_vertices_02/cmp/generic
new file mode 100644 (file)
index 0000000..15355a4
--- /dev/null
@@ -0,0 +1,31 @@
+
+DEAL:: Face4
+DEAL::  vertex=-0.732 -1.732 -1.732,  normal=-1.732 -1.732 -1.732
+DEAL::  vertex=2.732 -1.732 -1.732,  normal=1.732 -1.732 -1.732
+DEAL::  vertex=-0.732 1.732 -1.732,  normal=-1.732 1.732 -1.732
+DEAL::  vertex=2.732 1.732 -1.732,  normal=1.732 1.732 -1.732
+DEAL:: Face2
+DEAL::  vertex=2.732 -1.732 -1.732,  normal=1.732 -1.732 -1.732
+DEAL::  vertex=2.732 -1.732 1.732,  normal=1.732 -1.732 1.732
+DEAL::  vertex=2.732 1.732 -1.732,  normal=1.732 1.732 -1.732
+DEAL::  vertex=2.732 1.732 1.732,  normal=1.732 1.732 1.732
+DEAL:: Face2
+DEAL::  vertex=-0.732 -1.732 1.732,  normal=-1.732 -1.732 1.732
+DEAL::  vertex=-0.732 1.732 1.732,  normal=-1.732 1.732 1.732
+DEAL::  vertex=2.732 -1.732 1.732,  normal=1.732 -1.732 1.732
+DEAL::  vertex=2.732 1.732 1.732,  normal=1.732 1.732 1.732
+DEAL:: Face0
+DEAL::  vertex=-0.732 -1.732 -1.732,  normal=-1.732 -1.732 -1.732
+DEAL::  vertex=-0.732 1.732 -1.732,  normal=-1.732 1.732 -1.732
+DEAL::  vertex=-0.732 -1.732 1.732,  normal=-1.732 -1.732 1.732
+DEAL::  vertex=-0.732 1.732 1.732,  normal=-1.732 1.732 1.732
+DEAL:: Face2
+DEAL::  vertex=-0.732 -1.732 -1.732,  normal=-1.732 -1.732 -1.732
+DEAL::  vertex=-0.732 -1.732 1.732,  normal=-1.732 -1.732 1.732
+DEAL::  vertex=2.732 -1.732 -1.732,  normal=1.732 -1.732 -1.732
+DEAL::  vertex=2.732 -1.732 1.732,  normal=1.732 -1.732 1.732
+DEAL:: Face0
+DEAL::  vertex=-0.732 1.732 -1.732,  normal=-1.732 1.732 -1.732
+DEAL::  vertex=2.732 1.732 -1.732,  normal=1.732 1.732 -1.732
+DEAL::  vertex=-0.732 1.732 1.732,  normal=-1.732 1.732 1.732
+DEAL::  vertex=2.732 1.732 1.732,  normal=1.732 1.732 1.732

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.