]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
provide a simpler constructor for ComressedBlockSparsityPattern
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 28 Jan 2007 06:38:12 +0000 (06:38 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 28 Jan 2007 06:38:12 +0000 (06:38 +0000)
git-svn-id: https://svn.dealii.org/trunk@14390 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/block_sparsity_pattern.h
deal.II/lac/source/block_sparsity_pattern.cc

index dcb66eb51156bf7fd2942efa142ab624283f58d0..b582e58c482d239b6b5cd82998526125a913269f 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -562,6 +562,21 @@ class CompressedBlockSparsityPattern : public BlockSparsityPatternBase<Compresse
                                      */
     CompressedBlockSparsityPattern (const unsigned int n_rows,
                                    const unsigned int n_columns);
+
+                                    /**
+                                     * Initialize the pattern with
+                                     * two BlockIndices for the block
+                                     * structures of matrix rows and
+                                     * columns. This function is
+                                     * equivalent to calling the
+                                     * previous constructor with the
+                                     * length of the two index vector
+                                     * and then entering the index
+                                     * values.
+                                     */
+    CompressedBlockSparsityPattern (const std::vector<unsigned int>& row_block_sizes,
+                                   const std::vector<unsigned int>& col_block_sizes);
+    
 };
 
 
index 0a43712a309391dc1acaf90712628c8eb8a764f5..7ce640d011b3a8533d219181a5e7739e26897d3d 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -387,6 +387,20 @@ CompressedBlockSparsityPattern (const unsigned int n_rows,
 {}
 
 
+CompressedBlockSparsityPattern::
+CompressedBlockSparsityPattern (const std::vector<unsigned int>& row_indices,
+                               const std::vector<unsigned int>& col_indices)
+               :
+               BlockSparsityPatternBase<CompressedSparsityPattern>(row_indices.size(),
+                                                                   col_indices.size())
+{
+  for (unsigned int i=0;i<row_indices.size();++i)
+    for (unsigned int j=0;j<col_indices.size();++j)
+      this->block(i,j).reinit(row_indices[i],col_indices[j]);
+  this->collect_sizes();
+}
+
+
 // Remark: The explicit instantiations for "BlockSparsityPatternBase" were moved
 // to the top of this source file. The reason is a slightly buggy version
 // of the Apple gcc v.3.3.

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.