]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make dVector look more like vector<double> classes.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 4 May 1998 08:34:50 +0000 (08:34 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 4 May 1998 08:34:50 +0000 (08:34 +0000)
git-svn-id: https://svn.dealii.org/trunk@234 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/dvector.h

index 2d954ce251fb59f554751aeb104c9a2fe6414021..6eb44dc1d677303f38ad76ed7068b5535f440cc3 100644 (file)
@@ -152,6 +152,33 @@ class dVector : public VectorBase
                                      *             INLINE
                                      */
     unsigned int n () const;
+
+                                    /**
+                                     * Make the #dVector# class a bit like the
+                                     * #vector<># class of the C++ standard
+                                     * library by returning iterators to
+                                     * the start and end of the elements of this
+                                     * vector.
+                                     */
+    double * begin ();
+
+                                    /**
+                                     * Return constant iterator to the start of
+                                     * the vectors.
+                                     */
+    const double * begin () const;
+
+                                    /**
+                                     * Return an iterator pointing to the
+                                     * element past the end of the array.
+                                     */
+    double * end ();
+
+                                    /**
+                                     * Return a constant iterator pointing to
+                                     * the element past the end of the array.
+                                     */
+    const double * end () const;  
                                     //@}
     
     
@@ -366,12 +393,44 @@ inline unsigned int dVector::n () const
   return dim;
 }
 
+
+
+inline
+double * dVector::begin () {
+  return &val[0];
+};
+
+
+
+inline
+const double * dVector::begin () const {
+  return &val[0];
+};
+
+
+
+inline
+double * dVector::end () {
+  return &val[dim];
+};
+
+
+
+inline
+const double * dVector::end () const {
+  return &val[dim];
+};
+
+
+
 inline double dVector::operator() (const unsigned int i) const
 {
   Assert (i<dim, ExcInvalidIndex(i,dim));
   return val[i];
 }
 
+
+
 inline double& dVector::operator() (const unsigned int i)
 {
   Assert (i<dim, ExcInvalidIndex(i,dim));
@@ -379,3 +438,4 @@ inline double& dVector::operator() (const unsigned int i)
 }
 
 #endif
+

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.