From: kronbichler Date: Mon, 8 Jul 2013 05:54:44 +0000 (+0000) Subject: Test case for parallel block vector X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0cfd307c5bc27699a881f3951c277a9ae962ca42;p=dealii-svn.git Test case for parallel block vector git-svn-id: https://svn.dealii.org/trunk@29951 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/mpi/constraint_matrix_set_zero_02.cc b/tests/mpi/constraint_matrix_set_zero_02.cc new file mode 100644 index 0000000000..2b1a2d3b2f --- /dev/null +++ b/tests/mpi/constraint_matrix_set_zero_02.cc @@ -0,0 +1,84 @@ +//--------------------------------------------------------------------------- +// $Id$ +// 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 distributed vectors + +#include "../tests.h" +#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); + + parallel::distributed::BlockVector v(2); + v.block(0).reinit(local_active[0], complete_index_set(numproc), MPI_COMM_WORLD); + v.block(1).reinit(local_active[1], complete_index_set(2*numproc), MPI_COMM_WORLD); + v.collect_sizes(); + + for (unsigned int i=0;i