]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Clean up previous patch: Move implementation of functions out of the class declaratio...
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 12 Nov 2010 00:23:59 +0000 (00:23 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 12 Nov 2010 00:23:59 +0000 (00:23 +0000)
git-svn-id: https://svn.dealii.org/trunk@22702 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/grid/tria_accessor.h
deal.II/include/deal.II/grid/tria_accessor.templates.h

index 50c5d5dcc718c2a5e0c5cebb9cbb72a87fb91931..3f20ac219e9b3627f051bb0b68406cd368d53140 100644 (file)
@@ -1660,18 +1660,28 @@ class TriaAccessor<0, 1, spacedim>
     };
 
                                     /**
-                                     * Constructor. Should never be
-                                     * called and thus produces an
-                                     * error.
+                                     * Constructor.
+                                     *
+                                     * Since there is no mapping from
+                                     * vertices to cells, an accessor
+                                     * object for a point has no way
+                                     * to figure out whether it is at
+                                     * the boundary of the domain or
+                                     * not. Consequently, the second
+                                     * argument must be passed by the
+                                     * object that generates this
+                                     * accessor -- e.g. a 1d cell
+                                     * that can figure out whether
+                                     * its left or right vertex are
+                                     * at the boundary.
+                                     *
+                                     * The third argument is the
+                                     * global index of the vertex we
+                                     * point to.
                                      */
     TriaAccessor (const Triangulation<1,spacedim> * tria,
                  const VertexKind      vertex_kind,
-                 const unsigned int    vertex_index)
-                   :
-                   tria (tria),
-                   vertex_kind (vertex_kind),
-                   global_vertex_index (vertex_index)
-      {}
+                 const unsigned int    vertex_index);
 
                                     /**
                                      * Constructor. This constructor
@@ -1685,14 +1695,7 @@ class TriaAccessor<0, 1, spacedim>
     TriaAccessor (const Triangulation<1,spacedim> * =  0,
                  const int = 0,
                  const int = 0,
-                 const AccessorData * = 0)
-                   :
-                   tria (0),
-                   vertex_kind (interior_vertex),
-                   global_vertex_index (numbers::invalid_unsigned_int)
-      {
-       Assert (false, ExcInternalError());
-      }
+                 const AccessorData * = 0);
 
                                     /**
                                      * Constructor. Should never be
@@ -1700,14 +1703,7 @@ class TriaAccessor<0, 1, spacedim>
                                      * error.
                                      */
     template <int structdim2, int dim2, int spacedim2>
-    TriaAccessor (const TriaAccessor<structdim2,dim2,spacedim2> &)
-                   :
-                   tria (0),
-                   vertex_kind (interior_vertex),
-                   global_vertex_index (numbers::invalid_unsigned_int)
-      {
-       Assert(false, ExcImpossibleInDim(0));
-      }
+    TriaAccessor (const TriaAccessor<structdim2,dim2,spacedim2> &);
 
                                     /**
                                      * Constructor. Should never be
@@ -1715,14 +1711,7 @@ class TriaAccessor<0, 1, spacedim>
                                      * error.
                                      */
     template <int structdim2, int dim2, int spacedim2>
-    TriaAccessor (const InvalidAccessor<structdim2,dim2,spacedim2> &)
-                   :
-                   tria (0),
-                   vertex_kind (interior_vertex),
-                   global_vertex_index (numbers::invalid_unsigned_int)
-      {
-       Assert(false, ExcImpossibleInDim(0));
-      }
+    TriaAccessor (const InvalidAccessor<structdim2,dim2,spacedim2> &);
 
                                     /**
                                      *  Return the state of the
@@ -1733,30 +1722,21 @@ class TriaAccessor<0, 1, spacedim>
                                      *  and in particular equal to
                                      *  IteratorState::valid.
                                      */
-    static IteratorState::IteratorStates state ()
-      {
-       return IteratorState::valid;
-      }
+    static IteratorState::IteratorStates state ();
 
                                     /**
                                      * Level of this object. Vertices
                                      * have no level, so this
                                      * function always returns zero.
                                      */
-    static int level ()
-      {
-       return 0;
-      }
+    static int level ();
 
                                     /**
                                      * Index of this object. Vertices
                                      * have no index, so this
                                      * function always returns -1.
                                      */
-    static int index ()
-      {
-       return -1;
-      }
+    static int index ();
 
                                     /**
                                      * @name Advancement of iterators
@@ -1772,11 +1752,7 @@ class TriaAccessor<0, 1, spacedim>
                                      *  you can't iterate over point
                                      *  iterators.
                                      */
-    void operator ++ ()
-      {
-       Assert (false, ExcNotImplemented());
-      }
-
+    void operator ++ () const;
 
                                     /**
                                      *  This operator moves the
@@ -1786,10 +1762,7 @@ class TriaAccessor<0, 1, spacedim>
                                      *  you can't iterate over point
                                      *  iterators.
                                      */
-    void operator -- ()
-      {
-       Assert (false, ExcNotImplemented());
-      }
+    void operator -- () const;
                                     /**
                                      * @}
                                      */
@@ -1798,11 +1771,7 @@ class TriaAccessor<0, 1, spacedim>
                                      *  Index of the parent. You
                                      *  can't do this for points.
                                      */
-    int parent_index () const
-      {
-       Assert (false, ExcNotImplemented());
-       return -1;
-      }
+    static int parent_index ();
 
                                     /**
                                      *  @name Accessing sub-objects
@@ -1828,11 +1797,7 @@ class TriaAccessor<0, 1, spacedim>
                                      *  @p DoFAccessor::vertex_dof_index
                                      *  functions.
                                      */
-    unsigned int vertex_index (const unsigned int i = 0) const
-      {
-       Assert(i==0, ExcIndexRange(i, 0, 1));
-       return global_vertex_index;
-      }
+    unsigned int vertex_index (const unsigned int i = 0) const;
 
                                     /**
                                      *  Return a reference to the
@@ -1842,12 +1807,7 @@ class TriaAccessor<0, 1, spacedim>
                                      *  object refers. Otherwise, it
                                      *  throws an exception.
                                      */
-    Point<spacedim> & vertex (const unsigned int i = 0) const
-      {
-       Assert(i==0, ExcIndexRange(i, 0, 1));
-       return const_cast<Point<spacedim> &> (this->tria->vertices[global_vertex_index]);
-      }
-
+    Point<spacedim> & vertex (const unsigned int i = 0) const;
 
                                     /**
                                      * Pointer to the @p ith line
@@ -1855,51 +1815,7 @@ class TriaAccessor<0, 1, spacedim>
                                      * point to an invalid object.
                                      */
     typename internal::Triangulation::Iterators<1,spacedim>::line_iterator
-    line (const unsigned int i) const
-      {
-       return typename internal::Triangulation::Iterators<1,spacedim>::line_iterator();
-      }
-
-                                    /**
-                                     * Return whether this point is
-                                     * at the boundary of the
-                                     * one-dimensional triangulation
-                                     * we deal with here.
-                                     */
-    bool at_boundary () const
-      {
-       return vertex_kind != interior_vertex;
-      }
-
-
-                                    /**
-                                     * Boundary indicator of this
-                                     * object. The convention for one
-                                     * dimensional triangulations is
-                                     * that left end vertices have
-                                     * boundary indicator zero, and
-                                     * right end vertices have
-                                     * boundary indicator one.
-                                     *
-                                     * If the return value is the special
-                                     * value 255, then this object is in the
-                                     * interior of the domain.
-                                     */
-    unsigned char boundary_indicator () const
-      {
-       switch (vertex_kind)
-         {
-           case left_vertex:
-                 return 0;
-           case right_vertex:
-                 return 1;
-           default:
-                 return 255;
-         }
-      }
-
-
-
+    static line (const unsigned int);
 
                                     /**
                                      * Line index of the @p ith
@@ -1910,23 +1826,15 @@ class TriaAccessor<0, 1, spacedim>
                                      * otherwise an exception
                                      * generated.
                                      */
-    unsigned int line_index (const unsigned int i) const
-      {
-       Assert(false, ExcImpossibleInDim(0));
-       return numbers::invalid_unsigned_int;
-      }
-
+    static unsigned int line_index (const unsigned int i);
 
                                     /**
                                      * Pointer to the @p ith quad
                                      * bounding this object.
                                      */
+    static
     typename internal::Triangulation::Iterators<1,spacedim>::quad_iterator
-    quad (const unsigned int i) const
-      {
-       return typename internal::Triangulation::Iterators<1,spacedim>::quad_iterator();
-      }
-
+    quad (const unsigned int i);
 
                                     /**
                                      * Quad index of the @p ith
@@ -1937,15 +1845,36 @@ class TriaAccessor<0, 1, spacedim>
                                      * otherwise an exception
                                      * generated.
                                      */
-    unsigned int quad_index (const unsigned int i) const
-      {
-       Assert(false, ExcImpossibleInDim(0));
-       return numbers::invalid_unsigned_int;
-      }
+    static unsigned int quad_index (const unsigned int i);
+
                                     /**
                                      * @}
                                      */
 
+
+                                    /**
+                                     * Return whether this point is
+                                     * at the boundary of the
+                                     * one-dimensional triangulation
+                                     * we deal with here.
+                                     */
+    bool at_boundary () const;
+
+                                    /**
+                                     * Boundary indicator of this
+                                     * object. The convention for one
+                                     * dimensional triangulations is
+                                     * that left end vertices have
+                                     * boundary indicator zero, and
+                                     * right end vertices have
+                                     * boundary indicator one.
+                                     *
+                                     * If the return value is the special
+                                     * value 255, then this object is in the
+                                     * interior of the domain.
+                                     */
+    unsigned char boundary_indicator () const;
+
                                     /**
                                      *  @name Orientation of sub-objects
                                      */
@@ -1956,35 +1885,22 @@ class TriaAccessor<0, 1, spacedim>
                                      /**
                                      * @brief Always return false
                                       */
-    bool face_orientation (const unsigned int face) const
-      {
-       return false;
-      }
+    static bool face_orientation (const unsigned int face);
 
                                      /**
                                      * @brief Always return false
                                       */
-    bool face_flip (const unsigned int face) const
-      {
-       return false;
-      }
+    static bool face_flip (const unsigned int face);
 
                                      /**
                                      * @brief Always return false
                                       */
-    bool face_rotation (const unsigned int face) const
-      {
-       return false;
-      }
-
+    static bool face_rotation (const unsigned int face);
 
                                      /**
                                      * @brief Always return false
                                       */
-    bool line_orientation (const unsigned int line) const
-      {
-       return false;
-      }
+    static bool line_orientation (const unsigned int line);
 
                                     /**
                                      * @}
@@ -2001,120 +1917,101 @@ class TriaAccessor<0, 1, spacedim>
                                      *  Test whether the object has
                                      *  children. Always false.
                                      */
-    bool has_children () const
-      {
-       return false;
-      }
-
+    static bool has_children ();
 
                                     /**
                                      * Return the number of immediate
                                      * children of this object.This
                                      * is always zero in dimension 0.
                                      */
-    unsigned int n_children() const
-      {
-       return 0;
-      }
+    static unsigned int n_children();
 
                                     /**
                                      * Compute and return the number
                                      * of active descendants of this
                                      * objects. Always zero.
                                      */
-    unsigned int number_of_children () const
-      {
-       return 0;
-      }
+    static unsigned int number_of_children ();
 
                                     /**
                                      * Return the number of times
                                      * that this object is
                                      * refined. Always 0.
                                      */
-    unsigned int max_refinement_depth () const
-      {
-       return 0;
-      }
+    static unsigned int max_refinement_depth ();
 
                                     /**
                                      * @brief Return an invalid object
                                      */
+    static
     TriaIterator<InvalidAccessor<0,1,spacedim> >
-    child (const unsigned int) const
-      {
-       return TriaIterator<InvalidAccessor<0,1,spacedim> >();
-      }
+    child (const unsigned int);
 
                                     /**
                                      * @brief Return an invalid object
                                      */
+    static
     TriaIterator<InvalidAccessor<0,1,spacedim> >
-    isotropic_child (const unsigned int) const
-      {
-       return TriaIterator<InvalidAccessor<0,1,spacedim> >();
-      }
+    isotropic_child (const unsigned int);
 
                                     /**
                                      * Always return no refinement.
                                      */
-    RefinementCase<0> refinement_case () const
-      {
-       return RefinementCase<0>(RefinementPossibilities<0>::no_refinement);
-      }
-
+    static
+    RefinementCase<0> refinement_case ();
 
                                     /**
                                      * @brief Returns -1
                                      */
-    int child_index (const unsigned int i) const
-      {
-       return -1;
-      }
-
+    static
+    int child_index (const unsigned int i);
 
                                     /**
                                      * @brief Returns -1
                                      */
-    int isotropic_child_index (const unsigned int i) const
-      {
-       return -1;
-      }
+    static
+    int isotropic_child_index (const unsigned int i);
 
                                     /**
                                      * @brief Do nothing and throw and error
                                      */
-    inline
+    static
     void
-    set_boundary_indicator (const unsigned char) const
-      {
-       Assert(false,
-              ExcMessage ("The boundary indicator of vertices is determined by their "
-                          "location within a triangulation and can not be set explicitly"));
-      }
+    set_boundary_indicator (const unsigned char);
 
                                     /**
                                      * @brief Do nothing and throw and error
                                      */
-    void set_all_boundary_indicators (const unsigned char) const
-      {
-       Assert(false,
-              ExcMessage ("The boundary indicator of vertices is determined by their "
-                          "location within a triangulation and can not be set explicitly"));
-      }
+    static
+    void set_all_boundary_indicators (const unsigned char);
 
                                     /**
                                      * Return whether the vertex
                                      * pointed to here is used.
                                      */
-    bool used () const
-      {
-       return tria->vertex_used(global_vertex_index);
-      }
+    bool used () const;
 
   protected:
+                                    /**
+                                     * Pointer to the triangulation
+                                     * we operate on.
+                                     */
     const Triangulation<1,spacedim> * tria;
+
+                                    /**
+                                     * Whether this is a left end,
+                                     * right end, or interior
+                                     * vertex. This information is
+                                     * provided by the cell at the
+                                     * time of creation.
+                                     */
     const VertexKind      vertex_kind;
+
+                                    /**
+                                     * The global vertex index of the
+                                     * vertex this object corresponds
+                                     * to.
+                                     */
     const unsigned int    global_vertex_index;
 };
 
index d8cf88b9eb686fc95a6b678200ffd2c9d7c719c2..3adbf37c228e6c6e54168e5a9a8c1b5ce3a162d7 100644 (file)
@@ -1960,6 +1960,354 @@ is_translation_of (const TriaIterator<TriaAccessor<structdim,dim,spacedim> > &o)
 }
 
 
+/*------------------------ Functions: TriaAccessor<0,1,spacedim> -----------------------*/
+
+template <int spacedim>
+inline
+TriaAccessor<0, 1, spacedim>::
+TriaAccessor (const Triangulation<1,spacedim> * tria,
+             const VertexKind      vertex_kind,
+             const unsigned int    vertex_index)
+               :
+               tria (tria),
+               vertex_kind (vertex_kind),
+               global_vertex_index (vertex_index)
+{}
+
+
+
+template <int spacedim>
+inline
+TriaAccessor<0, 1, spacedim>::
+TriaAccessor (const Triangulation<1,spacedim> *,
+             const int,
+             const int,
+             const AccessorData *)
+               :
+               tria (0),
+               vertex_kind (interior_vertex),
+               global_vertex_index (numbers::invalid_unsigned_int)
+{
+  Assert (false, ExcInternalError());
+}
+
+
+
+template <int spacedim>
+template <int structdim2, int dim2, int spacedim2>
+inline
+TriaAccessor<0, 1, spacedim>::
+TriaAccessor (const TriaAccessor<structdim2,dim2,spacedim2> &)
+               :
+               tria (0),
+               vertex_kind (interior_vertex),
+               global_vertex_index (numbers::invalid_unsigned_int)
+{
+  Assert(false, ExcImpossibleInDim(0));
+}
+
+
+
+template <int spacedim>
+template <int structdim2, int dim2, int spacedim2>
+inline
+TriaAccessor<0, 1, spacedim>::
+TriaAccessor (const InvalidAccessor<structdim2,dim2,spacedim2> &)
+               :
+               tria (0),
+               vertex_kind (interior_vertex),
+               global_vertex_index (numbers::invalid_unsigned_int)
+{
+  Assert(false, ExcImpossibleInDim(0));
+}
+
+
+
+template <int spacedim>
+inline
+IteratorState::IteratorStates
+TriaAccessor<0, 1, spacedim>::state ()
+{
+  return IteratorState::valid;
+}
+
+
+template <int spacedim>
+inline
+int
+TriaAccessor<0, 1, spacedim>::level ()
+{
+  return 0;
+}
+
+
+
+template <int spacedim>
+inline
+int
+TriaAccessor<0, 1, spacedim>::index ()
+{
+  return -1;
+}
+
+
+
+template <int spacedim>
+inline
+void
+TriaAccessor<0, 1, spacedim>::operator ++ () const
+{
+  Assert (false, ExcNotImplemented());
+}
+
+
+template <int spacedim>
+inline
+void
+TriaAccessor<0, 1, spacedim>::operator -- () const
+{
+  Assert (false, ExcNotImplemented());
+}
+
+
+
+template <int spacedim>
+inline
+int
+TriaAccessor<0, 1, spacedim>::parent_index ()
+{
+  return -1;
+}
+
+
+template <int spacedim>
+inline
+unsigned int
+TriaAccessor<0, 1, spacedim>::vertex_index (const unsigned int i) const
+{
+  Assert(i==0, ExcIndexRange(i, 0, 1));
+  return global_vertex_index;
+}
+
+
+
+template <int spacedim>
+inline
+Point<spacedim> &
+TriaAccessor<0, 1, spacedim>::vertex (const unsigned int i) const
+{
+  Assert(i==0, ExcIndexRange(i, 0, 1));
+  return const_cast<Point<spacedim> &> (this->tria->vertices[global_vertex_index]);
+}
+
+
+template <int spacedim>
+inline
+typename internal::Triangulation::Iterators<1,spacedim>::line_iterator
+TriaAccessor<0, 1, spacedim>::line (const unsigned int)
+{
+  return typename internal::Triangulation::Iterators<1,spacedim>::line_iterator();
+}
+
+
+template <int spacedim>
+inline
+unsigned int
+TriaAccessor<0, 1, spacedim>::line_index (const unsigned int)
+{
+  Assert(false, ExcImpossibleInDim(0));
+  return numbers::invalid_unsigned_int;
+}
+
+
+template <int spacedim>
+inline
+typename internal::Triangulation::Iterators<1,spacedim>::quad_iterator
+TriaAccessor<0, 1, spacedim>::quad (const unsigned int)
+{
+  return typename internal::Triangulation::Iterators<1,spacedim>::quad_iterator();
+}
+
+
+
+template <int spacedim>
+inline
+unsigned int
+TriaAccessor<0, 1, spacedim>::quad_index (const unsigned int)
+{
+  Assert(false, ExcImpossibleInDim(0));
+  return numbers::invalid_unsigned_int;
+}
+
+
+template <int spacedim>
+inline
+bool
+TriaAccessor<0, 1, spacedim>::at_boundary () const
+{
+  return vertex_kind != interior_vertex;
+}
+
+
+template <int spacedim>
+inline
+unsigned char
+TriaAccessor<0, 1, spacedim>::boundary_indicator () const
+{
+  switch (vertex_kind)
+    {
+      case left_vertex:
+           return 0;
+      case right_vertex:
+           return 1;
+      default:
+           return 255;
+    }
+
+}
+
+
+template <int spacedim>
+inline
+bool TriaAccessor<0, 1, spacedim>::face_orientation (const unsigned int face)
+{
+  return false;
+}
+
+
+
+template <int spacedim>
+inline
+bool TriaAccessor<0, 1, spacedim>::face_flip (const unsigned int face)
+{
+  return false;
+}
+
+
+
+template <int spacedim>
+inline
+bool TriaAccessor<0, 1, spacedim>::face_rotation (const unsigned int face)
+{
+  return false;
+}
+
+
+
+template <int spacedim>
+inline
+bool TriaAccessor<0, 1, spacedim>::line_orientation (const unsigned int line)
+{
+  return false;
+}
+
+
+
+template <int spacedim>
+inline
+bool TriaAccessor<0, 1, spacedim>::has_children ()
+{
+  return false;
+}
+
+
+
+template <int spacedim>
+inline
+unsigned int TriaAccessor<0, 1, spacedim>::n_children()
+{
+  return 0;
+}
+
+
+
+template <int spacedim>
+inline
+unsigned int TriaAccessor<0, 1, spacedim>::number_of_children ()
+{
+  return 0;
+}
+
+
+
+template <int spacedim>
+inline
+unsigned int TriaAccessor<0, 1, spacedim>::max_refinement_depth ()
+{
+  return 0;
+}
+
+
+template <int spacedim>
+inline
+TriaIterator<InvalidAccessor<0,1,spacedim> >
+TriaAccessor<0, 1, spacedim>::child (const unsigned int)
+{
+  return TriaIterator<InvalidAccessor<0,1,spacedim> >();
+}
+
+
+template <int spacedim>
+inline
+TriaIterator<InvalidAccessor<0,1,spacedim> >
+TriaAccessor<0, 1, spacedim>::isotropic_child (const unsigned int)
+{
+  return TriaIterator<InvalidAccessor<0,1,spacedim> >();
+}
+
+
+template <int spacedim>
+inline
+RefinementCase<0> TriaAccessor<0, 1, spacedim>::refinement_case ()
+{
+  return RefinementCase<0>(RefinementPossibilities<0>::no_refinement);
+}
+
+template <int spacedim>
+inline
+int TriaAccessor<0, 1, spacedim>::child_index (const unsigned int i)
+{
+  return -1;
+}
+
+
+template <int spacedim>
+inline
+int TriaAccessor<0, 1, spacedim>::isotropic_child_index (const unsigned int)
+{
+  return -1;
+}
+
+
+template <int spacedim>
+inline
+void
+TriaAccessor<0, 1, spacedim>::set_boundary_indicator (const unsigned char)
+{
+  Assert(false,
+        ExcMessage ("The boundary indicator of vertices is determined by their "
+                    "location within a triangulation and can not be set explicitly"));
+}
+
+
+
+template <int spacedim>
+inline
+void TriaAccessor<0, 1, spacedim>::set_all_boundary_indicators (const unsigned char)
+{
+  Assert(false,
+        ExcMessage ("The boundary indicator of vertices is determined by their "
+                    "location within a triangulation and can not be set explicitly"));
+}
+
+
+
+template <int spacedim>
+inline
+bool TriaAccessor<0, 1, spacedim>::used () const
+{
+  return tria->vertex_used(global_vertex_index);
+}
 
 /*------------------------ Functions: CellAccessor<dim,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.