]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Allow creation of local block vectors without an Epetra_Map.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 21 Sep 2008 04:38:09 +0000 (04:38 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 21 Sep 2008 04:38:09 +0000 (04:38 +0000)
git-svn-id: https://svn.dealii.org/trunk@16877 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 2df3861da418e09e733b22b7023897ff3d2eb37a..30ca2aec75ec79dabe8c5b98b1d415650ac971df 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2004, 2005, 2006, 2007 by the deal.II authors
+//    Copyright (C) 2008 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -541,6 +541,21 @@ namespace TrilinosWrappers
       void reinit (const std::vector<Epetra_Map> &input_maps,
                   const bool                     fast = false);
 
+                                         /**
+                                          * Reinitialize the BlockVector to
+                                          * contain as many blocks as there
+                                          * are elements in the first
+                                          * argument, and with the respective
+                                          * sizes. Since no distribution map
+                                          * is given, all vectors are local
+                                          * vectors.
+                                          *
+                                          * If <tt>fast==false</tt>, the vector
+                                          * is filled with zeros.
+                                          */
+      void reinit (const std::vector<unsigned int> &N,
+                  const bool                       fast=false);
+      
                                          /**
                                           * Reinit the function
                                           * according to a distributed
index e7e9eb3be18f9da82f60faf15819aa19b84948eb..27f52188f431e93c0f66c78b9b088b403a6bad31 100644 (file)
@@ -85,7 +85,7 @@ namespace TrilinosWrappers
     BlockVector::reinit (const std::vector<Epetra_Map> &input_maps,
                         const bool                     fast)
     {
-      unsigned int no_blocks = input_maps.size();
+      const unsigned int no_blocks = input_maps.size();
       std::vector<unsigned int> block_sizes (no_blocks);
 
       for (unsigned int i=0; i<no_blocks; ++i)
@@ -194,6 +194,23 @@ namespace TrilinosWrappers
 
 
 
+  void
+  BlockVector::reinit (const std::vector<unsigned int> &block_sizes,
+                      const bool                       /*fast*/)
+  {
+    this->block_indices.reinit (block_sizes);
+    if (components.size() != n_blocks())
+      components.resize(n_blocks());
+
+    for (unsigned int i=0; i<n_blocks(); ++i)
+//TODO: use the 'fast' argument here...      
+      components[i].reinit(block_sizes[i]);
+
+    collect_sizes();      
+  }
+    
+
+
   void
   BlockVector::reinit (const MPI::BlockVector &v)
   {

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.