]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add ConeBoundary::normal_vector().
authoranne-glerum <a.c.glerum@uu.nl>
Tue, 30 May 2017 22:00:31 +0000 (16:00 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 30 May 2017 22:00:31 +0000 (16:00 -0600)
doc/news/changes/minor/20170530Glerum [new file with mode: 0644]
include/deal.II/grid/tria_boundary_lib.h
source/grid/tria_boundary_lib.cc

diff --git a/doc/news/changes/minor/20170530Glerum b/doc/news/changes/minor/20170530Glerum
new file mode 100644 (file)
index 0000000..8720012
--- /dev/null
@@ -0,0 +1,2 @@
+New: The ConeBoundary class now has a member function ConeBoundary::normal_vector().
+<br> (Anne Glerum, 2017/05/30)
index 8f3ba8a4f6aa24523bf88fdbddb0b784b47fe4d6..e05155b614f5727a1d7c7ca121daa5c812c60bec 100644 (file)
@@ -262,6 +262,18 @@ public:
   get_normals_at_vertices (const typename Triangulation<dim>::face_iterator &face,
                            typename Boundary<dim>::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<dim>::face_iterator &face,
+                 const Point<dim> &p) const;
+
+
 protected:
   /**
    * First radius of the (truncated) cone.
index 3af87cca63696ff77e5425ee2530bfdb52c8147e..62ee5755fa79c1f112e12fb28f2a8d5bae89b4fe 100644 (file)
@@ -475,6 +475,32 @@ get_normals_at_vertices (const typename Triangulation<dim>::face_iterator &face,
 }
 
 
+template <int dim>
+inline
+Tensor<1,dim>
+ConeBoundary<dim>::
+normal_vector (const typename Triangulation<dim>::face_iterator &,
+               const Point<dim> &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<dim>(), ExcNotImplemented());
+  for (unsigned int d=0; d<dim; ++d)
+    if (d != dim-1)  // don't test the last component of the vector
+      Assert (this->x_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 <int dim, int spacedim>

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.