]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
add SparsityPattern::row_position
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 26 Sep 2011 15:06:23 +0000 (15:06 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 26 Sep 2011 15:06:23 +0000 (15:06 +0000)
git-svn-id: https://svn.dealii.org/trunk@24428 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/include/deal.II/lac/sparsity_pattern.h
deal.II/source/lac/sparsity_pattern.cc

index 6ddd79ea74d87cb4bc91eebd01a1bf8ffd3d228c..de6bdb9ecc8a2f54ac7e76d2e3d4f87fe41f5bfd 100644 (file)
@@ -324,6 +324,14 @@ and DoF handlers embedded in higher dimensional space have been added.
 <h3>Specific improvements</h3>
 
 <ol>
+
+<li> New: SparsityPattern::row_position() finds a column index in a row and returns
+its "local" index or numbers::invalid_unsigned_int.
+<br>
+(Guido Kanschat, 2011/09/26)
+
+<li> New: There is now a function GridTools::volume() computing the volume
+
 <li> New: The function Utilities::MPI::sum
 function can be used to compute the sum of values over a number of
 MPI processes without having to deal with the underlying MPI functions.
index 16b404d94994d56ffce889bd5df9d291d1c009f5..79310ada6f32fccb2092abf01136f6485d8c7c29 100644 (file)
@@ -366,8 +366,8 @@ class SparsityPattern : public Subscriptor
     static const unsigned int invalid_entry = numbers::invalid_unsigned_int;
 
 /**
- * @name Functions generating and
- * filling a SparsityPattern.
+ * @name Construction and setup
+ * Constructors, destructor; functions initializing, copying and filling an object.
  */
 // @{
                                     /**
@@ -1124,6 +1124,19 @@ class SparsityPattern : public Subscriptor
     bool exists (const unsigned int i,
                  const unsigned int j) const;
 
+                                    /**
+                                     * The index of a global matrix
+                                     * entry in its row.
+                                     *
+                                     * This function is analogous to
+                                     * operator(), but it computes
+                                     * the index not with respect to
+                                     * the total field, but only with
+                                     * respect to the row <tt>j</tt>.
+                                     */
+    unsigned int row_position(const unsigned int i,
+                             const unsigned int j) const;
+    
                                     /**
                                      * Access to column number field.
                                      * Return the column number of
@@ -1256,7 +1269,6 @@ class SparsityPattern : public Subscriptor
 // @{
                                      /**
                                      * @deprecated
-                                     *
                                      * This function is deprecated. Use
                                      * SparsityTools::partition instead.
                                      *
@@ -1320,7 +1332,7 @@ class SparsityPattern : public Subscriptor
 
 
                                     /**
-                                     * This is kind of an expert mode. Get
+                                     * @deprecated This is kind of an expert mode. Get
                                      * access to the rowstart array, but
                                      * read-only.
                                      *
@@ -1377,8 +1389,8 @@ class SparsityPattern : public Subscriptor
     inline const unsigned int * get_column_numbers () const;
     
     BOOST_SERIALIZATION_SPLIT_MEMBER()
-
                                     /** @addtogroup Exceptions
+                                     * @name Exceptions
                                      * @{ */
                                     /**
                                      * You tried to add an element to
index d1d09ed4a9c14fbf18968012a27116156c0a2def..5a113cd699dede1a9cef8184a9beb6139e30bb8b 100644 (file)
@@ -794,8 +794,7 @@ SparsityPattern::add_entries (const unsigned int row,
 
 
 bool
-SparsityPattern::exists (const unsigned int i,
-                        const unsigned int j) const
+SparsityPattern::exists (const unsigned int i, const unsigned int j) const
 {
   Assert ((rowstart!=0) && (colnums!=0), ExcEmptyObject());
   Assert (i<rows, ExcIndexRange(i,0,rows));
@@ -811,6 +810,23 @@ SparsityPattern::exists (const unsigned int i,
 
 
 
+unsigned int
+SparsityPattern::row_position (const unsigned int i, const unsigned int j) const
+{
+  Assert ((rowstart!=0) && (colnums!=0), ExcEmptyObject());
+  Assert (i<rows, ExcIndexRange(i,0,rows));
+  Assert (j<cols, ExcIndexRange(j,0,cols));
+
+  for (unsigned int k=rowstart[i]; k<rowstart[i+1]; k++)
+    {
+                                      // entry exists
+      if (colnums[k] == j) return k-rowstart[i];
+    }
+  return numbers::invalid_unsigned_int;
+}
+
+
+
 std::pair<unsigned int, unsigned int>
 SparsityPattern::matrix_position (const unsigned int global_index) 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.