From 2dc09a3aab7d749daff42bea372da1f641e7aeb0 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 4 May 1998 08:34:50 +0000 Subject: [PATCH] Make dVector look more like vector classes. git-svn-id: https://svn.dealii.org/trunk@234 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/dvector.h | 60 +++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/deal.II/lac/include/lac/dvector.h b/deal.II/lac/include/lac/dvector.h index 2d954ce251..6eb44dc1d6 100644 --- a/deal.II/lac/include/lac/dvector.h +++ b/deal.II/lac/include/lac/dvector.h @@ -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