]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
added BlockCompressedSimpleSparsityPattern::column_number()
authorheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 25 Sep 2012 15:58:31 +0000 (15:58 +0000)
committerheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 25 Sep 2012 15:58:31 +0000 (15:58 +0000)
git-svn-id: https://svn.dealii.org/trunk@26728 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/include/deal.II/lac/block_sparsity_pattern.h

index d935b2f6232b718821be9622a5bb15c2b499daad..0995a7e034378297650191e07d00f41535830db8 100644 (file)
@@ -81,6 +81,10 @@ DoFHandler, in particular removal of specializations.
 <h3>Specific improvements</h3>
 
 <ol>
+<li> New: Added BlockCompressedSimpleSparsityPattern::column_number().
+<br>
+(Timo Heister, 2012/09/25)
+
 <li> New: There is now a function hp::FECollection::n_blocks() in analogy to
 the existing function hp::FECollection::n_components().
 <br>
index bdd0d95d31583f6f8aa70b370ae035e5b3dc20b2..f20626e40db7bf58191ff0a94e5b9c6d134f3ccb 100644 (file)
@@ -957,6 +957,14 @@ class BlockCompressedSimpleSparsityPattern : public BlockSparsityPatternBase<Com
                                       */
     void reinit(const std::vector<IndexSet> & partitioning);
 
+    /**
+     * Access to column number field.
+     * Return the column number of
+     * the @p index th entry in row @p row.
+     */
+    unsigned int column_number (const unsigned int row,
+                                  const unsigned int index) const;
+
                                      /**
                                       * Allow the use of the reinit
                                       * functions of the base class as
@@ -1325,6 +1333,31 @@ BlockSparsityPatternBase<SparsityPatternBase>::n_block_rows () const
 }
 
 
+inline
+unsigned int
+BlockCompressedSimpleSparsityPattern::column_number (const unsigned int row,
+                              const unsigned int index) const
+{
+  // .first= ith block, .second = jth row in that block
+  const std::pair<unsigned int,unsigned int>
+    row_index = row_indices.global_to_local (row);
+
+  Assert(index<row_length(row), ExcIndexRange(index, 0, row_length(row)));
+
+  unsigned int c = 0;
+  for (unsigned int b=0; b<columns; ++b)
+    {
+      unsigned int rowlen = sub_objects[row_index.first][b]->row_length (row_index.second);
+      if (index<c+rowlen)
+          return c+sub_objects[row_index.first][b]->column_number(row_index.second, index-c);
+      c += rowlen;
+    }
+
+  Assert(false, ExcInternalError());
+  return 0;
+}
+
+
 inline
 void
 BlockSparsityPattern::reinit (

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.