]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add end iterators for each level.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 26 Aug 1998 08:26:09 +0000 (08:26 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 26 Aug 1998 08:26:09 +0000 (08:26 +0000)
git-svn-id: https://svn.dealii.org/trunk@521 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/dofs/dof_handler.h
deal.II/deal.II/include/grid/tria.h
deal.II/deal.II/source/dofs/dof_handler.cc
deal.II/deal.II/source/grid/tria.cc

index 50233197a2d8477b84521c75100693a1a02280ad..c8937443c59f50529ab73e8849177aa41e68c7ba 100644 (file)
@@ -811,6 +811,30 @@ class DoFHandler : public DoFDimensionInfo<dim> {
                                      */
     raw_cell_iterator    end () const;
 
+                                    /**
+                                     * Return an iterator which is the first
+                                     * iterator not on level. If #level# is
+                                     * the last level, then this returns
+                                     * #end()#.
+                                     */
+    cell_iterator        end (const unsigned int level) const;
+    
+                                    /**
+                                     * Return a raw iterator which is the first
+                                     * iterator not on level. If #level# is
+                                     * the last level, then this returns
+                                     * #end()#.
+                                     */
+    raw_cell_iterator    end_raw (const unsigned int level) const;
+
+                                    /**
+                                     * Return an active iterator which is the
+                                     * first iterator not on level. If #level#
+                                     * is the last level, then this returns
+                                     * #end()#.
+                                     */
+    active_cell_iterator end_active (const unsigned int level) const;
+
                                     /**
                                      *  Return an iterator pointing to the
                                      *  last cell, used or not.
@@ -912,6 +936,30 @@ class DoFHandler : public DoFDimensionInfo<dim> {
                                      */
     raw_face_iterator    end_face () const;
 
+                                    /**
+                                     * Return an iterator which is the first
+                                     * iterator not on level. If #level# is
+                                     * the last level, then this returns
+                                     * #end()#.
+                                     */
+    face_iterator        end_face (const unsigned int level) const;
+    
+                                    /**
+                                     * Return a raw iterator which is the first
+                                     * iterator not on level. If #level# is
+                                     * the last level, then this returns
+                                     * #end()#.
+                                     */
+    raw_face_iterator    end_raw_face (const unsigned int level) const;
+
+                                    /**
+                                     * Return an active iterator which is the
+                                     * first iterator not on level. If #level#
+                                     * is the last level, then this returns
+                                     * #end()#.
+                                     */
+    active_face_iterator end_active_face (const unsigned int level) const;
+
                                     /**
                                      *  Return an iterator pointing to the
                                      *  last face, used or not.
@@ -1006,6 +1054,31 @@ class DoFHandler : public DoFDimensionInfo<dim> {
     raw_line_iterator
     end_line () const;
 
+                                    /**
+                                     * Return an iterator which is the first
+                                     * iterator not on level. If #level# is
+                                     * the last level, then this returns
+                                     * #end()#.
+                                     */
+    line_iterator        end_line (const unsigned int level) const;
+    
+                                    /**
+                                     * Return a raw iterator which is the first
+                                     * iterator not on level. If #level# is
+                                     * the last level, then this returns
+                                     * #end()#.
+                                     */
+    raw_line_iterator    end_raw_line (const unsigned int level) const;
+
+                                    /**
+                                     * Return an active iterator which is the
+                                     * first iterator not on level. If #level#
+                                     * is the last level, then this returns
+                                     * #end()#.
+                                     */
+    active_line_iterator end_active_line (const unsigned int level) const;
+
+
                                     /**
                                      *  Return an iterator pointing to the
                                      *  last line, used or not.
@@ -1088,6 +1161,31 @@ class DoFHandler : public DoFDimensionInfo<dim> {
     raw_quad_iterator
     end_quad () const;
 
+                                    /**
+                                     * Return an iterator which is the first
+                                     * iterator not on level. If #level# is
+                                     * the last level, then this returns
+                                     * #end()#.
+                                     */
+    quad_iterator        end_quad (const unsigned int level) const;
+    
+                                    /**
+                                     * Return a raw iterator which is the first
+                                     * iterator not on level. If #level# is
+                                     * the last level, then this returns
+                                     * #end()#.
+                                     */
+    raw_quad_iterator    end_raw_quad (const unsigned int level) const;
+
+                                    /**
+                                     * Return an active iterator which is the
+                                     * first iterator not on level. If #level#
+                                     * is the last level, then this returns
+                                     * #end()#.
+                                     */
+    active_quad_iterator end_active_quad (const unsigned int level) const;
+
+
                                     /**
                                      *  Return an iterator pointing to the
                                      *  last quad, used or not.
index fd660175b23805c44bb7d7fe8c192de2e154844b..4c4c8202cbe11974f2027bfebac91fbf8b3fa0b0 100644 (file)
@@ -24,6 +24,7 @@ template <int dim, class Accessor> class TriaIterator;
 template <int dim, class Accessor> class TriaActiveIterator;
 
 template <int dim> class DoFHandler;
+template <int dim> class MGDoFHandler;
 
 template <int dim> struct CellData;
 struct SubCellData;
@@ -267,9 +268,7 @@ class TriaDimensionInfo<2> {
  *     template <int dim>
  *     int Triangulation<dim>::n_cells (const int level) const {
  *        cell_iterator cell = begin (level),
- *                      endc = (level == levels.size()-1 ?
- *                              cell_iterator(end()) :
- *                              begin (level+1));
+ *                      endc = end(level);
  *        int n=0;
  *        for (; cell!=endc; ++cell)
  *          ++n;
@@ -1527,6 +1526,7 @@ class Triangulation : public TriaDimensionInfo<dim> {
     void load_user_flags_quad (const vector<bool> &v);
                                     /*@}*/
 
+                                    /* ------------------------------------ */
     
                                     /**
                                      *  @name Cell iterator functions
@@ -1572,6 +1572,31 @@ class Triangulation : public TriaDimensionInfo<dim> {
                                      */
     raw_cell_iterator    end () const;
 
+                                    /**
+                                     * Return an iterator which is the first
+                                     * iterator not on level. If #level# is
+                                     * the last level, then this returns
+                                     * #end()#.
+                                     */
+    cell_iterator        end (const unsigned int level) const;
+    
+                                    /**
+                                     * Return a raw iterator which is the first
+                                     * iterator not on level. If #level# is
+                                     * the last level, then this returns
+                                     * #end()#.
+                                     */
+    raw_cell_iterator    end_raw (const unsigned int level) const;
+
+                                    /**
+                                     * Return an active iterator which is the
+                                     * first iterator not on level. If #level#
+                                     * is the last level, then this returns
+                                     * #end()#.
+                                     */
+    active_cell_iterator end_active (const unsigned int level) const;
+
+    
                                     /**
                                      *  Return an iterator pointing to the
                                      *  last cell, used or not.
@@ -1674,6 +1699,30 @@ class Triangulation : public TriaDimensionInfo<dim> {
                                      */
     raw_face_iterator    end_face () const;
 
+                                    /**
+                                     * Return an iterator which is the first
+                                     * iterator not on level. If #level# is
+                                     * the last level, then this returns
+                                     * #end()#.
+                                     */
+    face_iterator        end_face (const unsigned int level) const;
+    
+                                    /**
+                                     * Return a raw iterator which is the first
+                                     * iterator not on level. If #level# is
+                                     * the last level, then this returns
+                                     * #end()#.
+                                     */
+    raw_face_iterator    end_raw_face (const unsigned int level) const;
+
+                                    /**
+                                     * Return an active iterator which is the
+                                     * first iterator not on level. If #level#
+                                     * is the last level, then this returns
+                                     * #end()#.
+                                     */
+    active_face_iterator end_active_face (const unsigned int level) const;
+
                                     /**
                                      *  Return an iterator pointing to the
                                      *  last face, used or not.
@@ -1768,6 +1817,30 @@ class Triangulation : public TriaDimensionInfo<dim> {
     raw_line_iterator
     end_line () const;
 
+                                    /**
+                                     * Return an iterator which is the first
+                                     * iterator not on level. If #level# is
+                                     * the last level, then this returns
+                                     * #end()#.
+                                     */
+    line_iterator        end_line (const unsigned int level) const;
+    
+                                    /**
+                                     * Return a raw iterator which is the first
+                                     * iterator not on level. If #level# is
+                                     * the last level, then this returns
+                                     * #end()#.
+                                     */
+    raw_line_iterator    end_raw_line (const unsigned int level) const;
+
+                                    /**
+                                     * Return an active iterator which is the
+                                     * first iterator not on level. If #level#
+                                     * is the last level, then this returns
+                                     * #end()#.
+                                     */
+    active_line_iterator end_active_line (const unsigned int level) const;
+
                                     /**
                                      *  Return an iterator pointing to the
                                      *  last line, used or not.
@@ -1850,6 +1923,30 @@ class Triangulation : public TriaDimensionInfo<dim> {
     raw_quad_iterator
     end_quad () const;
 
+                                    /**
+                                     * Return an iterator which is the first
+                                     * iterator not on level. If #level# is
+                                     * the last level, then this returns
+                                     * #end()#.
+                                     */
+    quad_iterator        end_quad (const unsigned int level) const;
+    
+                                    /**
+                                     * Return a raw iterator which is the first
+                                     * iterator not on level. If #level# is
+                                     * the last level, then this returns
+                                     * #end()#.
+                                     */
+    raw_quad_iterator    end_raw_quad (const unsigned int level) const;
+
+                                    /**
+                                     * Return an active iterator which is the
+                                     * first iterator not on level. If #level#
+                                     * is the last level, then this returns
+                                     * #end()#.
+                                     */
+    active_quad_iterator end_active_quad (const unsigned int level) const;
+
                                     /**
                                      *  Return an iterator pointing to the
                                      *  last quad, used or not.
@@ -2018,7 +2115,7 @@ class Triangulation : public TriaDimensionInfo<dim> {
                                      * rather than by returning a pre-stored
                                      * value. It is therefore often better
                                      * to rewrite lines like
-                                     * #for (i=0; i<tria.n_cells(); ++i) ...#
+                                     * #for (i=0; i<tria.n_cells() const; ++i) ...#
                                      * by
                                      * #const unsigned int n=tria.n_cells();#
                                      * #for (i=0; i<n; ++i) ...#.
@@ -2294,6 +2391,7 @@ class Triangulation : public TriaDimensionInfo<dim> {
     friend class TriaRawIterator<2,CellAccessor<2> >;
 
     friend class DoFHandler<dim>;
+    friend class MGDoFHandler<dim>;
 };
 
 
index 1ff01dda017269a4697552c9a4f80b6c39f423e4..b03c4367b8ce5a7dea09c80898dfa982a3340a48 100644 (file)
@@ -545,6 +545,127 @@ DoFHandler<dim>::end_quad () const {
 
 
 
+template <int dim>
+typename DoFDimensionInfo<dim>::raw_cell_iterator
+DoFHandler<dim>::end_raw (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         end() :
+         begin_raw (level+1));
+};
+
+
+
+template <int dim>
+typename DoFDimensionInfo<dim>::cell_iterator
+DoFHandler<dim>::end (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         cell_iterator(end()) :
+         begin (level+1));
+};
+
+
+
+template <int dim>
+typename DoFDimensionInfo<dim>::active_cell_iterator
+DoFHandler<dim>::end_active (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         active_cell_iterator(end()) :
+         begin_active (level+1));
+};
+
+
+
+template <int dim>
+typename DoFDimensionInfo<dim>::raw_face_iterator
+DoFHandler<dim>::end_raw_face (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         end_face() :
+         begin_raw_face (level+1));
+};
+
+
+
+template <int dim>
+typename DoFDimensionInfo<dim>::face_iterator
+DoFHandler<dim>::end_face (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         face_iterator(end_face()) :
+         begin_face (level+1));
+};
+
+
+
+template <int dim>
+typename DoFDimensionInfo<dim>::active_face_iterator
+DoFHandler<dim>::end_active_face (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         active_face_iterator(end_face()) :
+         begin_active_face (level+1));
+};
+
+
+
+template <int dim>
+typename DoFDimensionInfo<dim>::raw_line_iterator
+DoFHandler<dim>::end_raw_line (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         end_line() :
+         begin_raw_line (level+1));
+};
+
+
+
+template <int dim>
+typename DoFDimensionInfo<dim>::line_iterator
+DoFHandler<dim>::end_line (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         line_iterator(end_line()) :
+         begin_line (level+1));
+};
+
+
+
+template <int dim>
+typename DoFDimensionInfo<dim>::active_line_iterator
+DoFHandler<dim>::end_active_line (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         active_line_iterator(end_line()) :
+         begin_active_line (level+1));
+};
+
+
+
+
+template <int dim>
+typename DoFDimensionInfo<dim>::raw_quad_iterator
+DoFHandler<dim>::end_raw_quad (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         end_quad() :
+         begin_raw_quad (level+1));
+};
+
+
+
+template <int dim>
+typename DoFDimensionInfo<dim>::quad_iterator
+DoFHandler<dim>::end_quad (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         quad_iterator(end_quad()) :
+         begin_quad (level+1));
+};
+
+
+
+template <int dim>
+typename DoFDimensionInfo<dim>::active_quad_iterator
+DoFHandler<dim>::end_active_quad (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         active_quad_iterator(end_quad()) :
+         begin_active_quad (level+1));
+};
+
+
+
 template <int dim>
 typename DoFHandler<dim>::raw_line_iterator
 DoFHandler<dim>::last_raw_line (const unsigned int level) const {
index 39e0011e3b7776d942044d5b6c015ba09501566f..1f35a3111a5f6224105c709e9d4606482a60aeaa 100644 (file)
@@ -62,6 +62,7 @@ Triangulation<1>::begin (const unsigned int level) const {
 };
 
 
+
 template <>
 TriaDimensionInfo<1>::raw_cell_iterator
 Triangulation<1>::end () const {
@@ -81,7 +82,6 @@ Triangulation<2>::begin (const unsigned int level) const {
 
 
 
-
 template <>
 TriaDimensionInfo<2>::raw_cell_iterator
 Triangulation<2>::end () const {
@@ -1457,7 +1457,6 @@ Triangulation<dim>::begin_active_quad (unsigned int level) const {
 };
 
 
-
 template <int dim>
 typename TriaDimensionInfo<dim>::raw_line_iterator
 Triangulation<dim>::end_line () const {
@@ -1624,6 +1623,128 @@ Triangulation<dim>::last_active_quad () const {
 
 
 
+template <int dim>
+typename TriaDimensionInfo<dim>::raw_cell_iterator
+Triangulation<dim>::end_raw (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         end() :
+         begin_raw (level+1));
+};
+
+
+
+template <int dim>
+typename TriaDimensionInfo<dim>::cell_iterator
+Triangulation<dim>::end (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         cell_iterator(end()) :
+         begin (level+1));
+};
+
+
+
+template <int dim>
+typename TriaDimensionInfo<dim>::active_cell_iterator
+Triangulation<dim>::end_active (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         active_cell_iterator(end()) :
+         begin_active (level+1));
+};
+
+
+
+template <int dim>
+typename TriaDimensionInfo<dim>::raw_face_iterator
+Triangulation<dim>::end_raw_face (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         end_face() :
+         begin_raw_face (level+1));
+};
+
+
+
+template <int dim>
+typename TriaDimensionInfo<dim>::face_iterator
+Triangulation<dim>::end_face (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         face_iterator(end_face()) :
+         begin_face (level+1));
+};
+
+
+
+template <int dim>
+typename TriaDimensionInfo<dim>::active_face_iterator
+Triangulation<dim>::end_active_face (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         active_face_iterator(end_face()) :
+         begin_active_face (level+1));
+};
+
+
+
+template <int dim>
+typename TriaDimensionInfo<dim>::raw_line_iterator
+Triangulation<dim>::end_raw_line (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         end_line() :
+         begin_raw_line (level+1));
+};
+
+
+
+template <int dim>
+typename TriaDimensionInfo<dim>::line_iterator
+Triangulation<dim>::end_line (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         line_iterator(end_line()) :
+         begin_line (level+1));
+};
+
+
+
+template <int dim>
+typename TriaDimensionInfo<dim>::active_line_iterator
+Triangulation<dim>::end_active_line (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         active_line_iterator(end_line()) :
+         begin_active_line (level+1));
+};
+
+
+
+
+template <int dim>
+typename TriaDimensionInfo<dim>::raw_quad_iterator
+Triangulation<dim>::end_raw_quad (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         end_quad() :
+         begin_raw_quad (level+1));
+};
+
+
+
+template <int dim>
+typename TriaDimensionInfo<dim>::quad_iterator
+Triangulation<dim>::end_quad (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         quad_iterator(end_quad()) :
+         begin_quad (level+1));
+};
+
+
+
+template <int dim>
+typename TriaDimensionInfo<dim>::active_quad_iterator
+Triangulation<dim>::end_active_quad (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         active_quad_iterator(end_quad()) :
+         begin_active_quad (level+1));
+};
+
+
+
+
 
 
 

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.