]> https://gitweb.dealii.org/ - dealii.git/commitdiff
fix bug in ConeBoundary::get_normals_at_vertices 2464/head
authorTimo Heister <timo.heister@gmail.com>
Tue, 5 Apr 2016 16:35:54 +0000 (18:35 +0200)
committerTimo Heister <timo.heister@gmail.com>
Tue, 5 Apr 2016 16:36:33 +0000 (18:36 +0200)
source/grid/tria_boundary_lib.cc
tests/bits/cone_03.cc [new file with mode: 0644]
tests/bits/cone_03.output [new file with mode: 0644]

index f31de3ad4c53ac779d3646b9c581aafbf02e3186..268c7c169ccdbab4468b84c443ab50be980ad997 100644 (file)
@@ -460,7 +460,7 @@ get_normals_at_vertices (const typename Triangulation<dim>::face_iterator &face,
 {
   const Tensor<1,dim> axis = x_1 - x_0;
 
-  for (unsigned int vertex = 0; vertex < GeometryInfo<dim>::vertices_per_cell; ++vertex)
+  for (unsigned int vertex = 0; vertex < GeometryInfo<dim>::vertices_per_face; ++vertex)
     {
       // Compute the orthogonal projection of the vertex onto the axis of the
       // cone.
diff --git a/tests/bits/cone_03.cc b/tests/bits/cone_03.cc
new file mode 100644 (file)
index 0000000..26fba6a
--- /dev/null
@@ -0,0 +1,71 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2003 - 2015 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+
+// check ConeBoundary
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/base/quadrature_lib.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/tria_boundary_lib.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/tria_iterator.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/grid_out.h>
+#include <deal.II/dofs/dof_handler.h>
+#include <deal.II/fe/fe_q.h>
+#include <deal.II/fe/fe_values.h>
+#include <deal.II/fe/mapping_c1.h>
+
+#include <fstream>
+
+
+
+template <int dim>
+void check ()
+{
+  Triangulation<dim> triangulation;
+  GridGenerator::truncated_cone (triangulation);
+  Point<dim> p1, p2;
+  p1[0] = -1;
+  p2[0] = 1;
+  static const ConeBoundary<dim> boundary (1, 0.5, p1, p2);
+  triangulation.set_boundary (0, boundary);
+
+  triangulation.refine_global (2);
+
+  const typename Triangulation<dim>::active_cell_iterator cell=triangulation.begin_active();
+  for (unsigned int face_no=0; face_no<GeometryInfo<dim>::faces_per_cell; ++face_no)
+    {
+      typename Triangulation<dim>::face_iterator face=cell->face(face_no);
+      typename Boundary<dim>::FaceVertexNormals normals;
+      boundary.get_normals_at_vertices(face, normals);
+      for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_face; ++v)
+        {
+          deallog << normals[v] << std::endl;
+        }
+    }
+}
+
+
+int main ()
+{
+  initlog();
+
+  check<2> ();
+  check<3> ();
+}
diff --git a/tests/bits/cone_03.output b/tests/bits/cone_03.output
new file mode 100644 (file)
index 0000000..f3f494d
--- /dev/null
@@ -0,0 +1,33 @@
+
+DEAL::0.00000 -1.00000
+DEAL::0.00000 -1.00000
+DEAL::0.00000 -1.00000
+DEAL::0.00000 -1.00000
+DEAL::0.00000 -1.00000
+DEAL::0.00000 -1.00000
+DEAL::0.00000 -1.00000
+DEAL::0.00000 -1.00000
+DEAL::0.00000 0.00000 -1.00000
+DEAL::0.00000 -0.382683 -0.923880
+DEAL::0.00000 0.00000 -1.00000
+DEAL::0.00000 -0.382683 -0.923880
+DEAL::0.00000 0.382683 -0.923880
+DEAL::0.00000 0.00000 -1.00000
+DEAL::0.00000 0.382683 -0.923880
+DEAL::0.00000 0.00000 -1.00000
+DEAL::0.00000 0.00000 -1.00000
+DEAL::0.00000 0.00000 -1.00000
+DEAL::0.00000 0.382683 -0.923880
+DEAL::0.00000 0.382683 -0.923880
+DEAL::0.00000 -0.382683 -0.923880
+DEAL::0.00000 -0.382683 -0.923880
+DEAL::0.00000 0.00000 -1.00000
+DEAL::0.00000 0.00000 -1.00000
+DEAL::0.00000 0.00000 -1.00000
+DEAL::0.00000 0.382683 -0.923880
+DEAL::0.00000 -0.382683 -0.923880
+DEAL::0.00000 0.00000 -1.00000
+DEAL::0.00000 0.00000 -1.00000
+DEAL::0.00000 0.382683 -0.923880
+DEAL::0.00000 -0.382683 -0.923880
+DEAL::0.00000 0.00000 -1.00000

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.