From 17504b1e07c6e47627bc43f26095bf3a29a94a6c Mon Sep 17 00:00:00 2001 From: bangerth Date: Sun, 21 Sep 2008 04:38:09 +0000 Subject: [PATCH] Allow creation of local block vectors without an Epetra_Map. git-svn-id: https://svn.dealii.org/trunk@16877 0785d39b-7218-0410-832d-ea1e28bc413d --- .../lac/include/lac/trilinos_block_vector.h | 17 ++++++++++++++++- deal.II/lac/source/trilinos_block_vector.cc | 19 ++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/deal.II/lac/include/lac/trilinos_block_vector.h b/deal.II/lac/include/lac/trilinos_block_vector.h index 2df3861da4..30ca2aec75 100644 --- a/deal.II/lac/include/lac/trilinos_block_vector.h +++ b/deal.II/lac/include/lac/trilinos_block_vector.h @@ -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 &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 fast==false, the vector + * is filled with zeros. + */ + void reinit (const std::vector &N, + const bool fast=false); + /** * Reinit the function * according to a distributed diff --git a/deal.II/lac/source/trilinos_block_vector.cc b/deal.II/lac/source/trilinos_block_vector.cc index e7e9eb3be1..27f52188f4 100644 --- a/deal.II/lac/source/trilinos_block_vector.cc +++ b/deal.II/lac/source/trilinos_block_vector.cc @@ -85,7 +85,7 @@ namespace TrilinosWrappers BlockVector::reinit (const std::vector &input_maps, const bool fast) { - unsigned int no_blocks = input_maps.size(); + const unsigned int no_blocks = input_maps.size(); std::vector block_sizes (no_blocks); for (unsigned int i=0; i &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