From 48734aab4dbceb0e500a2d69e9b1fbb9baf12d68 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Tue, 5 Apr 2016 18:35:54 +0200 Subject: [PATCH] fix bug in ConeBoundary::get_normals_at_vertices --- source/grid/tria_boundary_lib.cc | 2 +- tests/bits/cone_03.cc | 71 ++++++++++++++++++++++++++++++++ tests/bits/cone_03.output | 33 +++++++++++++++ 3 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 tests/bits/cone_03.cc create mode 100644 tests/bits/cone_03.output diff --git a/source/grid/tria_boundary_lib.cc b/source/grid/tria_boundary_lib.cc index f31de3ad4c..268c7c169c 100644 --- a/source/grid/tria_boundary_lib.cc +++ b/source/grid/tria_boundary_lib.cc @@ -460,7 +460,7 @@ get_normals_at_vertices (const typename Triangulation::face_iterator &face, { const Tensor<1,dim> axis = x_1 - x_0; - for (unsigned int vertex = 0; vertex < GeometryInfo::vertices_per_cell; ++vertex) + for (unsigned int vertex = 0; vertex < GeometryInfo::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 index 0000000000..26fba6a1c6 --- /dev/null +++ b/tests/bits/cone_03.cc @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + + +template +void check () +{ + Triangulation triangulation; + GridGenerator::truncated_cone (triangulation); + Point p1, p2; + p1[0] = -1; + p2[0] = 1; + static const ConeBoundary boundary (1, 0.5, p1, p2); + triangulation.set_boundary (0, boundary); + + triangulation.refine_global (2); + + const typename Triangulation::active_cell_iterator cell=triangulation.begin_active(); + for (unsigned int face_no=0; face_no::faces_per_cell; ++face_no) + { + typename Triangulation::face_iterator face=cell->face(face_no); + typename Boundary::FaceVertexNormals normals; + boundary.get_normals_at_vertices(face, normals); + for (unsigned int v=0; v::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 index 0000000000..f3f494d223 --- /dev/null +++ b/tests/bits/cone_03.output @@ -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 -- 2.39.5