]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a member function Manifold::get_direction_vector().
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 28 Feb 2016 17:52:34 +0000 (11:52 -0600)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 28 Feb 2016 19:01:54 +0000 (13:01 -0600)
include/deal.II/grid/manifold.h
source/grid/manifold.cc

index fb6606813669bf898fea7248e9b169d0c2d246d9..13582e91c6fc65a1144270f20df2a4774ae65caa 100644 (file)
@@ -336,6 +336,43 @@ public:
   get_new_point_on_cell (const typename Triangulation<dim,spacedim>::cell_iterator &cell) const;
 
   /// @}
+
+  /**
+   * @name Computing direction vectors
+   */
+  /// @{
+
+  /**
+   * Return a "direction" vector that, at $\mathbf x_1$, is tangential to
+   * the geodesic that connects two points $\mathbf x_1,\mathbf x_2$. The geodesic
+   * is the shortest line between these two points, where "shortest" is defined
+   * via a metric specific to a particular implementation of this class in a
+   * derived class. For example, in the case of a FlatManifold, the shortest
+   * line between two points is just the straight line, and in this case the
+   * direction vector is just the difference $\mathbf d=\mathbf x_2-\mathbf x_1$.
+   * On the other hand, for a manifold that describes a surface embedded in
+   * a higher dimensional space (e.g., the surface of a sphere), then the
+   * direction vector is tangential to the surface, and consequently may point in
+   * a different direction than the straight line that connects the two points.
+   *
+   * This function is used, among other cases, in computing normal vectors to
+   * faces or, more generally, surfaces such as the boundary. Since not all
+   * programs need this functionality, this function has a default
+   * implementation that just throws an exception. Consequently, derived
+   * classes only have to implement this function if the program that uses
+   * them does in fact call it directly or indirectly.
+   *
+   * @param x1 The first point that describes the geodesic, and the one
+   *   at which the "direction" is to be evaluated.
+   * @param x2 The second point that describes the geodesic.
+   * @return A "direction" vector tangential to the geodesic.
+   */
+  virtual
+  Tensor<1,spacedim>
+  get_tangent_vector (const Point<spacedim> &x1,
+                      const Point<spacedim> &x2) const;
+
+  /// @}
 };
 
 
index 57a8a5250fa1e51892d7989678d370a3bffb3871..31883b9b40e10e86e650308e3e290c3b4637f2f3 100644 (file)
@@ -167,6 +167,8 @@ get_new_point_on_quad (const Triangulation<1,1>::quad_iterator &) const
   return Point<1>();
 }
 
+
+
 template <>
 Point<2>
 Manifold<1,2>::
@@ -177,6 +179,7 @@ get_new_point_on_quad (const Triangulation<1,2>::quad_iterator &) const
 }
 
 
+
 template <>
 Point<3>
 Manifold<1,3>::
@@ -186,6 +189,8 @@ get_new_point_on_quad (const Triangulation<1,3>::quad_iterator &) const
   return Point<3>();
 }
 
+
+
 template <int dim, int spacedim>
 Point<spacedim>
 Manifold<dim, spacedim>::
@@ -195,6 +200,8 @@ get_new_point_on_hex (const typename Triangulation<dim, spacedim>::hex_iterator
   return Point<spacedim>();
 }
 
+
+
 template <>
 Point<3>
 Manifold<3,3>::
@@ -204,6 +211,16 @@ get_new_point_on_hex (const Triangulation<3, 3>::hex_iterator &hex) const
 }
 
 
+
+template <int dim, int spacedim>
+Tensor<1,spacedim>
+Manifold<dim,spacedim>::get_tangent_vector(const Point<spacedim> &,
+                                           const Point<spacedim> &) const
+{
+  Assert (false, ExcPureFunctionCalled());
+  return Tensor<1,spacedim>();
+}
+
 /* -------------------------- FlatManifold --------------------- */
 
 

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.