From: anne-glerum Date: Tue, 30 May 2017 22:00:31 +0000 (-0600) Subject: Add ConeBoundary::normal_vector(). X-Git-Tag: v9.0.0-rc1~1547^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ac10e6331646ed42c978c1c5deed2d88108eb43;p=dealii.git Add ConeBoundary::normal_vector(). --- diff --git a/doc/news/changes/minor/20170530Glerum b/doc/news/changes/minor/20170530Glerum new file mode 100644 index 0000000000..87200120cf --- /dev/null +++ b/doc/news/changes/minor/20170530Glerum @@ -0,0 +1,2 @@ +New: The ConeBoundary class now has a member function ConeBoundary::normal_vector(). +
(Anne Glerum, 2017/05/30) diff --git a/include/deal.II/grid/tria_boundary_lib.h b/include/deal.II/grid/tria_boundary_lib.h index 8f3ba8a4f6..e05155b614 100644 --- a/include/deal.II/grid/tria_boundary_lib.h +++ b/include/deal.II/grid/tria_boundary_lib.h @@ -262,6 +262,18 @@ public: get_normals_at_vertices (const typename Triangulation::face_iterator &face, typename Boundary::FaceVertexNormals &face_vertex_normals) const; + /** + * Implementation of the function declared in the base class. + * + * Refer to the general documentation of this class and the documentation of + * the base class. + */ + virtual + Tensor<1,dim> + normal_vector (const typename Triangulation::face_iterator &face, + const Point &p) const; + + protected: /** * First radius of the (truncated) cone. diff --git a/source/grid/tria_boundary_lib.cc b/source/grid/tria_boundary_lib.cc index 3af87cca63..62ee5755fa 100644 --- a/source/grid/tria_boundary_lib.cc +++ b/source/grid/tria_boundary_lib.cc @@ -475,6 +475,32 @@ get_normals_at_vertices (const typename Triangulation::face_iterator &face, } +template +inline +Tensor<1,dim> +ConeBoundary:: +normal_vector (const typename Triangulation::face_iterator &, + const Point &p) const +{ +// TODO only for cone opening along z-axis + Assert (dim == 3, ExcNotImplemented()); + Assert (this->radius_0 == 0., ExcNotImplemented()); + Assert (this->x_0 == Point(), ExcNotImplemented()); + for (unsigned int d=0; dx_1[d] == 0., ExcNotImplemented()); + + const double c_squared = (this->radius_1 / this->x_1[dim-1])*(this->radius_1 / this->x_1[dim-1]); + Tensor<1,dim> normal = p; + normal[0] *= -2.0/c_squared; + normal[1] *= -2.0/c_squared; + normal[dim-1] *= 2.0; + + return normal/normal.norm(); +} + + + //======================================================================// template