############################################################
# $Id$
-# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
+# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors
############################################################
############################################################
libraries_o = $(lib-lac.o) \
$(lib-base.o)
-default: run-tests
+default: run-tests
############################################################
constraints_inhomogeneous \
constraint_graph_zero \
sparse_matrices matrices \
- block_sparsity_pattern_01 \
+ block_sparsity_pattern_* \
block_indices \
block_vector \
block_vector_* \
//----------------------------------------------------------------------
// $Id$
-// Version: $Name$
+// Version: $Name$
//
-// Copyright (C) 2006, 2008 by the deal.II authors
+// Copyright (C) 2006, 2008, 2010 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
//----------------------------------------------------------------------
-// Test reinit(BlockIndices...)
+// BlockSparsityPattern::copy_from only copied n_block_rows x
+// n_block_rows blocks, forgetting any additional columns there may
+// have been (or trying to copy columns that aren't there
#include "../tests.h"
int main()
{
- std::ofstream logfile("block_sparsity_pattern_01/output");
+ std::ofstream logfile("block_sparsity_pattern_02/output");
logfile.setf(std::ios::fixed);
deallog << std::setprecision(2);
deallog.attach(logfile);
deallog.depth_console(0);
deallog.threshold_double(1.e-10);
- BlockSparsityPattern sparsity;
std::vector<unsigned int> row_blocks(4);
row_blocks[0] = 4;
row_blocks[1] = 5;
col_blocks[0] = 2;
col_blocks[1] = 3;
col_blocks[2] = 2;
- BlockIndices rows(row_blocks);
- BlockIndices cols(col_blocks);
- std::vector<std::vector<unsigned int> >
- row_length(cols.size(),
- std::vector<unsigned int>(rows.total_size()));
- for (unsigned int jb=0;jb<row_length.size();++jb)
- for (unsigned int i=0;i<row_length[jb].size();++i)
- {
- const unsigned int d = col_blocks[jb]-1;
- row_length[jb][i] = (i+1) % d +1;
- }
-
- for (unsigned int j=0;j<row_length.size();++j)
- {
- for (unsigned int i=0;i<row_length[j].size();++i)
- deallog << ' ' << row_length[j][i];
- deallog << std::endl;
- }
-
- sparsity.reinit(rows, cols, row_length);
+ BlockCompressedSparsityPattern bcsp (row_blocks, col_blocks);
- for (unsigned int ib = 0;ib<rows.size();++ib)
- for (unsigned int i=0;i<rows.block_size(ib);++i)
- {
- const unsigned int ii = rows.local_to_global(ib,i);
- for (unsigned int jb = 0;jb<cols.size();++jb)
- for (unsigned int j=0;j<row_length[jb][ii];++j)
- sparsity.add(ii, cols.local_to_global(jb,j));
- }
-
- sparsity.print(logfile);
-
- return 0;
+ BlockSparsityPattern bsp;
+
+ // we used to access an invalid
+ // block number here
+ bsp.copy_from (bcsp);
+
+ deallog << "OK" << std::endl;
}