]> https://gitweb.dealii.org/ - dealii.git/commitdiff
New get_intermediate_points_on_line function. Needed for MappingQ class.
authorRalf Hartmann <Ralf.Hartmann@dlr.de>
Tue, 9 Jan 2001 14:44:31 +0000 (14:44 +0000)
committerRalf Hartmann <Ralf.Hartmann@dlr.de>
Tue, 9 Jan 2001 14:44:31 +0000 (14:44 +0000)
git-svn-id: https://svn.dealii.org/trunk@3623 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/grid/tria_boundary.h
deal.II/deal.II/include/grid/tria_boundary_lib.h
deal.II/deal.II/source/grid/tria_boundary.cc
deal.II/deal.II/source/grid/tria_boundary_lib.cc

index b7d4f137bbfdb25c3a7bb7f690e036f502b21b7a..c7115e2eb3348515d54d6947c7432e38cb4e59ad 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -65,7 +65,7 @@
  *   @ref{HyperBallBoundary} creating a hyperball with given radius
  *   around a given center point.
  *
- *   @author Wolfgang Bangerth, 1999
+ *   @author Wolfgang Bangerth, 1999, Ralf Hartmann, 2001
  */
 template <int dim>
 class Boundary : public Subscriptor
@@ -115,6 +115,30 @@ class Boundary : public Subscriptor
     virtual Point<dim>
     get_new_point_on_quad (const typename Triangulation<dim>::quad_iterator &quad) const;
 
+                                    /**
+                                     * Return intermediate points
+                                     * on the boundary line.
+                                     *
+                                     * The number of points requested
+                                     * is given by the size of the
+                                     * vector @p{points}. It is the
+                                     * task of the derived classes to
+                                     * arrange the points in
+                                     * approximately equal distances.
+                                     *
+                                     * This function is needed by the
+                                     * @p{MappingQ} class. As this
+                                     * function is not needed for Q1
+                                     * mappings, it is not made pure
+                                     * virtual, to avoid the need to
+                                     * overload it.  The default
+                                     * implementation throws an error
+                                     * in any case, however.
+                                     */
+    virtual void
+    get_intermediate_points_on_line (const typename Triangulation<dim>::line_iterator &line,
+                                    vector<Point<dim> > &points) const;
+    
                                     /**
                                      * Exception.
                                      */
@@ -132,6 +156,8 @@ class Boundary : public Subscriptor
  *   placing new points in the middle of old ones, it rather assumes that the
  *   boundary of the domain is given by the polygon/polyhedron defined by the
  *   boundary of the initial coarse triangulation.
+ *
+ *   @author Wolfgang Bangerth, 1998, Ralf Hartmann, 2001
  */
 template <int dim>
 class StraightBoundary : public Boundary<dim> {
@@ -160,6 +186,22 @@ class StraightBoundary : public Boundary<dim> {
                                      */
     virtual Point<dim>
     get_new_point_on_quad (const typename Triangulation<dim>::quad_iterator &quad) const;
+
+                                    /**
+                                     * Gives @p{n=points.size()}
+                                     * points that splits the
+                                     * p{StraightBoundary} line into
+                                     * p{n+1} partitions of equal
+                                     * lengths.
+                                     *
+                                     * Refer to the general documentation of
+                                     * this class and the documentation of the
+                                     * base class.
+                                     */
+    virtual void
+    get_intermediate_points_on_line (const typename Triangulation<dim>::line_iterator &line,
+                                    vector<Point<dim> > &points) const;
+
 };
 
 
index b647a406e38ee46f838fa74c4e771015e3337209..fc95dca43f95f1005e06592682606b2b53b5d583 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -30,7 +30,7 @@
  *   @ref{Boundary}, which would seem natural, since this way we can use the
  *   @ref{StraightBoundary}@p{<dim>::in_between(neighbors)} function.
  *
- * @author Wolfgang Bangerth, 1998
+ *   @author Wolfgang Bangerth, 1998, Ralf Hartmann, 2001
  */
 template <int dim>
 class HyperBallBoundary : public StraightBoundary<dim>
@@ -58,6 +58,17 @@ class HyperBallBoundary : public StraightBoundary<dim>
     virtual Point<dim>
     get_new_point_on_quad (const typename Triangulation<dim>::quad_iterator &quad) const;
 
+                                    /**
+                                     * Refer to the general documentation of
+                                     * this class and the documentation of the
+                                     * base class.
+                                     *
+                                     * Only implemented for @p{dim=2}.
+                                     */
+    virtual void
+    get_intermediate_points_on_line (const typename Triangulation<dim>::line_iterator &line,
+                                    vector<Point<dim> > &points) const;
+
                                     /**
                                      * Return the center of the ball.
                                      */
index 8fa2eff1cfc97b28d49bbd38ae62d2401f3cc1f7..d2b6b96df5c9914e4b69e297ad2c07d1fe787970 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -33,6 +33,16 @@ Boundary<dim>::get_new_point_on_quad (const typename Triangulation<dim>::quad_it
 };
 
 
+template <int dim>
+void
+Boundary<dim>::get_intermediate_points_on_line (
+  const typename Triangulation<dim>::line_iterator &,
+  vector<Point<dim> > &) const
+{
+  Assert (false, ExcPureVirtualFunctionCalled());
+};
+
+
 template <int dim>
 Point<dim>
 StraightBoundary<dim>::get_new_point_on_line (const typename Triangulation<dim>::line_iterator &line) const 
@@ -70,6 +80,21 @@ StraightBoundary<dim>::get_new_point_on_quad (const typename Triangulation<dim>:
 #endif
 
 
+template <int dim>
+void
+StraightBoundary<dim>::get_intermediate_points_on_line (
+  const typename Triangulation<dim>::line_iterator &line,
+  vector<Point<dim> > &points) const
+{
+  const unsigned int n=points.size();
+  Assert(n>0, ExcInternalError());
+  const double part=1./(n+1);
+  double position=part;
+  for (unsigned int i=0; i<n; ++i, position+=part)
+    points[i]=(1-position)*line->vertex(0) + position*line->vertex(1);
+};
+
+
 // explicit instantiations
 template class Boundary<deal_II_dimension>;
 template class StraightBoundary<deal_II_dimension>;
index 67eff897c54f62a4a872ee87485c4c7506227a17..10cb013b41cd161497077641d3009297ba1ba4e4 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -74,6 +74,44 @@ get_new_point_on_quad (const typename Triangulation<dim>::quad_iterator &quad) c
 };
 
 
+template <>
+void
+HyperBallBoundary<2>::get_intermediate_points_on_line (
+  const Triangulation<2>::line_iterator &line,
+  vector<Point<2> > &points) const
+{
+  const unsigned int n=points.size();
+  Assert(n>0, ExcInternalError());
+  if (n==1)
+    points[0]=get_new_point_on_line(line);
+  else
+    {
+      Point<2> v0=line->vertex(0)-center,
+              v1=line->vertex(1)-center;
+      double alpha0=atan(v0(1)/v0(0)),
+            alpha1=atan(v1(1)/v1(0));
+      double dalpha=(alpha1-alpha0)/(n+1);
+      double alpha=alpha0+dalpha;
+
+      for (unsigned int i=0; i<n; ++i, alpha+=dalpha)
+       {
+         points[i](0)=radius*cos(alpha)+center(0);
+         points[i](1)=radius*sin(alpha)+center(1);
+       }
+    }
+}
+
+
+
+template <int dim>
+void
+HyperBallBoundary<dim>::get_intermediate_points_on_line (
+  const typename Triangulation<dim>::line_iterator &,
+  vector<Point<dim> > &) const
+{
+  Assert(false, ExcNotImplemented());
+}
+
 
 template <int dim>
 Point<dim>

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.