]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Doc update and security check.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 29 Apr 1998 12:07:55 +0000 (12:07 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 29 Apr 1998 12:07:55 +0000 (12:07 +0000)
git-svn-id: https://svn.dealii.org/trunk@222 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/dofs/dof_accessor.h
deal.II/deal.II/source/dofs/dof_accessor.cc

index ea259bf1e46e894f5a8a4ed15395598cc0e654f5..2b2679072c39d6c128c267cb2b0e3be4eba13743 100644 (file)
@@ -17,6 +17,25 @@ class dVector;
 
 /**
   Define the basis for accessors to the degrees of freedom.
+
+  Note that it is allowed to construct an object of which the
+  #dof_handler# pointer is a Null pointer. Such an object would
+  result in a strange kind of behaviour, though every reasonable
+  operating system should disallow access through that pointer.
+  The reason we do not check for the null pointer in the
+  constructor which gets passed the #DoFHandler# pointer is that
+  if we did we could not make dof iterators member of other classes
+  (like in the #FEValues# class) if we did not know about the
+  #DoFHandler# object to be used upon construction of that object.
+  Through the way this class is implemented here, we allow the
+  creation of a kind of virgin object which only gets useful if
+  assigned to from another object before first usage.
+
+  Opposite to construction, it is not possible to copy an object
+  which has an invalid dof handler pointer. This is to guarantee
+  that every iterator which is once assigned to is a valid
+  object. However, this assertion only holds in debug mode, when
+  the #Assert# macro is switched on.
   */
 template <int dim>
 class DoFAccessor {
@@ -38,8 +57,17 @@ class DoFAccessor {
                                      * Reset the DoF handler pointer.
                                      */
     void set_dof_handler (DoFHandler<dim> *dh) {
+      Assert (dh != 0, ExcInvalidObject());
       dof_handler = dh;
     };
+
+                                    /**
+                                     * Copy operator.
+                                     */
+    DoFAccessor<dim> & operator = (const DoFAccessor<dim> &da) {
+      set_dof_handler (da.dof_handler);
+      return *this;
+    };
     
                                     /**
                                      * Exception for child classes
index ca220cae1a0388cd48b4f9198224ba329ee38547..d64c87388149dcc896cbce84d248d9de5b99ee02 100644 (file)
@@ -268,14 +268,13 @@ DoFQuadAccessor<dim,BaseClass>::child (const unsigned int i) const {
 
 template <int dim, class BaseClass>
 void DoFQuadAccessor<dim,BaseClass>::copy_from (const DoFQuadAccessor<dim,BaseClass> &a) {
-  Assert (a.dof_handler != 0, ExcInvalidObject());
-
   BaseClass::copy_from (a);
   set_dof_handler (a.dof_handler);
 };
 
 
 
+
 /*------------------------- Functions: DoFCellAccessor -----------------------*/
 
 template <int 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.