]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Small modifications to accessors and iterators.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 12 Jul 2004 13:58:26 +0000 (13:58 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 12 Jul 2004 13:58:26 +0000 (13:58 +0000)
git-svn-id: https://svn.dealii.org/trunk@9506 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/sparse_matrix.h
deal.II/lac/include/lac/sparsity_pattern.h

index 991385d3788f52a902fb65be7bb455b675c5b9cd..578f0253be1149b1f6fce8f22d06863c894a97ec 100644 (file)
@@ -91,6 +91,11 @@ namespace internals
                   const unsigned int  row,
                   const unsigned int  index);
 
+                                         /**
+                                          * Constructor. Construct the end
+                                          * accessor for the given matrix.
+                                          */
+        Accessor (MatrixType         *matrix);
 
                                          /**
                                           * Copy constructor to get from a
@@ -220,6 +225,12 @@ namespace internals
                   const unsigned int  row,
                   const unsigned int  index);
         
+                                         /**
+                                          * Constructor. Construct the end
+                                          * accessor for the given matrix.
+                                          */
+        Accessor (MatrixType         *matrix);
+
                                          /**
                                           * Value of this matrix entry,
                                           * returned as a read- and writable
@@ -297,6 +308,12 @@ namespace internals
                   const unsigned int row,
                   const unsigned int index);
 
+                                         /**
+                                          * Constructor. Create the end
+                                          * iterator for the given matrix.
+                                          */
+        Iterator (MatrixType *matrix);
+        
                                          /**
                                           * Conversion constructor to get from
                                           * a non-const iterator to a const
@@ -1892,6 +1909,17 @@ namespace internals
 
 
 
+    template <typename number>
+    inline
+    Accessor<number,true>::
+    Accessor (const MatrixType *matrix)
+                    :
+                    SparsityPatternIterators::Accessor (&matrix->get_sparsity_pattern()),
+                    matrix (matrix)
+    {}
+    
+
+
     template <typename number>
     inline
     Accessor<number,true>::
@@ -2018,7 +2046,18 @@ namespace internals
                                                         row, index),
                     matrix (matrix)
     {}
-                    
+
+
+
+    template <typename number>
+    inline
+    Accessor<number,false>::
+    Accessor (MatrixType         *matrix)
+                    :
+                    SparsityPatternIterators::Accessor (&matrix->get_sparsity_pattern()),
+                    matrix (matrix)
+    {}
+    
 
 
     template <typename number>
@@ -2054,6 +2093,16 @@ namespace internals
 
 
 
+    template <typename number, bool Constness>
+    inline
+    Iterator<number, Constness>::
+    Iterator (MatrixType *matrix)
+                    :
+                    accessor(matrix)
+    {}
+
+
+
     template <typename number, bool Constness>
     inline
     Iterator<number, Constness>::
@@ -2162,7 +2211,7 @@ inline
 typename SparseMatrix<number>::const_iterator
 SparseMatrix<number>::end () const
 {
-  return const_iterator(this, m(), 0);
+  return const_iterator(this);
 }
 
 
index 08dfd70ccdcc7692f7b711af792b413920820000..419e5ffe85c71d61bfaac275f93fc01c2f06bee2 100644 (file)
@@ -63,23 +63,28 @@ namespace internals
                   const unsigned int     row,
                   const unsigned int     index);
 
+                                         /**
+                                          * Constructor. Construct the end
+                                          * accessor for the given sparsity
+                                          * pattern.
+                                          */
+        Accessor (const SparsityPattern *matrix);
+
                                          /**
                                           * Row number of the element
-                                          * represented by this
-                                          * object. This
+                                          * represented by this object. This
                                           * function can only be called for
-                                          * entries for which is_valid_entry() is
-                                          * true.
+                                          * entries for which is_valid_entry()
+                                          * is true.
                                           */
         unsigned int row () const;
 
                                          /**
                                           * Index in row of the element
-                                          * represented by this
-                                          * object. This
+                                          * represented by this object. This
                                           * function can only be called for
-                                          * entries for which is_valid_entry() is
-                                          * true.
+                                          * entries for which is_valid_entry()
+                                          * is true.
                                           */
         unsigned int index () const;
 
@@ -1575,6 +1580,16 @@ namespace internals
     {}
 
 
+    inline
+    Accessor::
+    Accessor (const SparsityPattern *sparsity_pattern)
+                    :
+                    sparsity_pattern(sparsity_pattern),
+                    a_row(sparsity_pattern->n_rows()),
+                    a_index(0)
+    {}
+
+
     inline
     unsigned int
     Accessor::row() const

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.