From: Timo Heister Date: Sun, 7 Jul 2013 15:31:15 +0000 (+0000) Subject: add test that documents bug in ConstraintMatrix::set_zero X-Git-Tag: v8.0.0~181 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7bd88ddf3b2fe36575e11392799c403f26b59ce;p=dealii.git add test that documents bug in ConstraintMatrix::set_zero git-svn-id: https://svn.dealii.org/trunk@29939 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/mpi/constraint_matrix_set_zero_01.cc b/tests/mpi/constraint_matrix_set_zero_01.cc new file mode 100644 index 0000000000..a90946cd2a --- /dev/null +++ b/tests/mpi/constraint_matrix_set_zero_01.cc @@ -0,0 +1,80 @@ +//--------------------------------------------------------------------------- +// $Id: constraint_matrix_condense_01.cc 29076 2013-03-27 15:08:37Z heister $ +// Version: $Name$ +// +// Copyright (C) 2013 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//--------------------------------------------------------------------------- + + +// check ConstraintMatrix::set_zero(Vector) for parallel vectors. +// this documents a bug introduced in r29678 for block vectors. + +#include "../tests.h" +#include +#include +#include +#include +#include +#include + +#include + + +void test () +{ + unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); + unsigned int numproc = Utilities::MPI::n_mpi_processes (MPI_COMM_WORLD); + + std::vector local_active(2); + + // block 0: + local_active[0].set_size(numproc); + local_active[0].add_range(myid,myid+1); + + // block 1: + local_active[1].set_size(2*numproc); + local_active[1].add_range(myid*2,myid*2+2); + + PETScWrappers::MPI::BlockVector v(local_active, MPI_COMM_WORLD); + + for (unsigned int i=0;i