From f1efb0669188ad8dbf81288ade617e58ef297bae Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Mon, 8 Jul 2013 05:54:44 +0000 Subject: [PATCH] Test case for parallel block vector git-svn-id: https://svn.dealii.org/trunk@29951 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/mpi/constraint_matrix_set_zero_02.cc | 84 +++++++++++++++++++ .../ncpu_1/cmp/generic | 31 +++++++ .../ncpu_2/cmp/generic | 63 ++++++++++++++ 3 files changed, 178 insertions(+) create mode 100644 tests/mpi/constraint_matrix_set_zero_02.cc create mode 100644 tests/mpi/constraint_matrix_set_zero_02/ncpu_1/cmp/generic create mode 100644 tests/mpi/constraint_matrix_set_zero_02/ncpu_2/cmp/generic 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