]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
In dof accessors, make sure that they point to the same DoFHandler object. Everything...
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 8 Aug 2005 17:26:51 +0000 (17:26 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 8 Aug 2005 17:26:51 +0000 (17:26 +0000)
git-svn-id: https://svn.dealii.org/trunk@11246 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/dofs/dof_accessor.h
deal.II/deal.II/include/dofs/dof_accessor.templates.h

index ec6998e4b65d7bb9ce645574b290becd3a5bd6cd..62927533caf703bf0a0cc70c157ea94ca2ba2c2d 100644 (file)
@@ -31,6 +31,7 @@ template <int dim>              class DoFObjectAccessor<1, dim>;
 template <int dim>              class DoFObjectAccessor<2, dim>;
 template <int dim>              class DoFObjectAccessor<3, dim>;
 
+template <int dim, typename Accessor> class TriaRawIterator;
 
 
 
@@ -146,13 +147,30 @@ class DoFAccessor
                                      * @ingroup Exceptions
                                      */
     DeclException0 (ExcNotActive);
+                                    /**
+                                     * Exception
+                                     * 
+                                     * @ingroup Exceptions
+                                     */
+    DeclException0 (ExcCantCompareIterators);
+
+  protected:    
+                                    /**
+                                     *  Compare for equality.            
+                                     */
+    bool operator == (const DoFAccessor &) const;
+       
+                                    /**
+                                     * Compare for inequality.
+                                     */
+    bool operator != (const DoFAccessor &) const;
 
   protected:
                                     /**
                                      * Store the address of the DoFHandler object
                                      * to be accessed.
                                      */
-    DoFHandler<dim> *dof_handler;  
+    DoFHandler<dim> *dof_handler;
 };
 
 
@@ -460,6 +478,25 @@ class DoFObjectAccessor : public DoFAccessor<dim>,
                                      * for the iterator classes.
                                      */
     void copy_from (const DoFObjectAccessor<celldim, dim> &a);
+
+  protected:    
+                                    /**
+                                     *  Compare for equality.            
+                                     */
+    bool operator == (const DoFObjectAccessor &) const;
+       
+                                    /**
+                                     * Compare for inequality.
+                                     */
+    bool operator != (const DoFObjectAccessor &) const;
+
+
+                                     /**
+                                      * Iterator classes need to be friends
+                                      * because they need to access operator==
+                                      * and operator!=.
+                                      */
+    template <int, typename> friend class TriaRawIterator;
 };
 
 
@@ -703,6 +740,25 @@ class DoFObjectAccessor<1, dim> :  public DoFAccessor<dim>,
                                      * for the iterator classes.
                                      */
     void copy_from (const DoFObjectAccessor<1,dim> &a);
+
+  protected:    
+                                    /**
+                                     *  Compare for equality.            
+                                     */
+    bool operator == (const DoFObjectAccessor<1,dim> &) const;
+       
+                                    /**
+                                     * Compare for inequality.
+                                     */
+    bool operator != (const DoFObjectAccessor<1,dim> &) const;
+
+
+                                     /**
+                                      * Iterator classes need to be friends
+                                      * because they need to access operator==
+                                      * and operator!=.
+                                      */
+    template <int, typename> friend class TriaRawIterator;
 };
 
 
@@ -905,6 +961,25 @@ class DoFObjectAccessor<2, dim> :  public DoFAccessor<dim>,
                                      * for the iterator classes.
                                      */
     void copy_from (const DoFObjectAccessor<2, dim> &a);
+
+  protected:    
+                                    /**
+                                     *  Compare for equality.            
+                                     */
+    bool operator == (const DoFObjectAccessor<2,dim> &) const;
+       
+                                    /**
+                                     * Compare for inequality.
+                                     */
+    bool operator != (const DoFObjectAccessor<2,dim> &) const;
+
+
+                                     /**
+                                      * Iterator classes need to be friends
+                                      * because they need to access operator==
+                                      * and operator!=.
+                                      */
+    template <int, typename> friend class TriaRawIterator;
 };
 
 
@@ -1115,6 +1190,25 @@ class DoFObjectAccessor<3, dim> :  public DoFAccessor<dim>,
                                      * for the iterator classes.
                                      */
     void copy_from (const DoFObjectAccessor<3, dim> &a);
+
+  protected:    
+                                    /**
+                                     *  Compare for equality.            
+                                     */
+    bool operator == (const DoFObjectAccessor<3,dim> &) const;
+       
+                                    /**
+                                     * Compare for inequality.
+                                     */
+    bool operator != (const DoFObjectAccessor<3,dim> &) const;
+
+
+                                     /**
+                                      * Iterator classes need to be friends
+                                      * because they need to access operator==
+                                      * and operator!=.
+                                      */
+    template <int, typename> friend class TriaRawIterator;
 };
 
 
index 37ea1edcc8bd5f45b3b32d5a0f4d6f8ed624a0ad..982a7bcb255aaafbb01be3bc7c9c16bd8e0f4cbf 100644 (file)
@@ -86,6 +86,39 @@ DoFAccessor<dim>::operator = (const DoFAccessor<dim> &da)
 
 
 
+template <int dim>
+inline
+bool
+DoFAccessor<dim>::operator == (const DoFAccessor<dim> &a) const
+{
+  Assert (dof_handler == a.dof_handler, ExcCantCompareIterators());
+
+                                   // there is no real data to compare, except
+                                   // to make sure that the dof_handler
+                                   // objects in use are the same
+  return true;
+}
+
+
+
+template <int dim>
+inline
+bool
+DoFAccessor<dim>::operator != (const DoFAccessor<dim> &a) const
+{
+  Assert (dof_handler == a.dof_handler, ExcCantCompareIterators());
+
+                                   // there is no real data to compare, except
+                                   // to make sure that the dof_handler
+                                   // objects in use are the same. this is
+                                   // checked above, and apart from this there
+                                   // is no reason for us to believe that the
+                                   // two accessors are different
+  return false;
+}
+
+
+
 
 /*------------------------- Functions: DoFObjectAccessor<1,dim> -----------------------*/
 
@@ -336,6 +369,29 @@ DoFObjectAccessor<1,dim>::copy_from (const DoFObjectAccessor<1,dim> &a)
 }
 
 
+
+template <int dim>
+inline
+bool
+DoFObjectAccessor<1,dim>::operator == (const DoFObjectAccessor<1,dim> &a) const
+{
+  return (TriaObjectAccessor<1,dim>::operator == (a)
+          &&
+          DoFAccessor<dim>::operator == (a));
+}
+
+
+template <int dim>
+inline
+bool
+DoFObjectAccessor<1,dim>::operator != (const DoFObjectAccessor<1,dim> &a) const
+{
+  return (TriaObjectAccessor<1,dim>::operator != (a)
+          ||
+          DoFAccessor<dim>::operator != (a));
+}
+
+
 /*------------------------- Functions: DoFObjectAccessor<2,dim> -----------------------*/
 
 template <int dim>
@@ -580,6 +636,30 @@ DoFObjectAccessor<2,dim>::copy_from (const DoFObjectAccessor<2,dim> &a)
 }
 
 
+
+template <int dim>
+inline
+bool
+DoFObjectAccessor<2,dim>::operator == (const DoFObjectAccessor<2,dim> &a) const
+{
+  return (TriaObjectAccessor<2,dim>::operator == (a)
+          &&
+          DoFAccessor<dim>::operator == (a));
+}
+
+
+template <int dim>
+inline
+bool
+DoFObjectAccessor<2,dim>::operator != (const DoFObjectAccessor<2,dim> &a) const
+{
+  return (TriaObjectAccessor<2,dim>::operator != (a)
+          ||
+          DoFAccessor<dim>::operator != (a));
+}
+
+
+
 /*------------------------- Functions: DoFObjectAccessor<3,dim> -----------------------*/
 
 
@@ -848,6 +928,29 @@ void DoFObjectAccessor<3,dim>::copy_from (const DoFObjectAccessor<3,dim> &a)
 }
 
 
+
+template <int dim>
+inline
+bool
+DoFObjectAccessor<3,dim>::operator == (const DoFObjectAccessor<3,dim> &a) const
+{
+  return (TriaObjectAccessor<3,dim>::operator == (a)
+          &&
+          DoFAccessor<dim>::operator == (a));
+}
+
+
+template <int dim>
+inline
+bool
+DoFObjectAccessor<3,dim>::operator != (const DoFObjectAccessor<3,dim> &a) const
+{
+  return (TriaObjectAccessor<3,dim>::operator != (a)
+          ||
+          DoFAccessor<dim>::operator != (a));
+}
+
+
 /*------------------------- Functions: DoFCellAccessor -----------------------*/
 
 

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.