From: Timo Heister Date: Tue, 25 Sep 2012 17:52:19 +0000 (+0000) Subject: add test for X-Git-Tag: v8.0.0~2041 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b98e28be8db6b47be36de3e2344f32670f0e56b9;p=dealii.git add test for git-svn-id: https://svn.dealii.org/trunk@26734 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/mpi/distribute_sp_02.cc b/tests/mpi/distribute_sp_02.cc new file mode 100644 index 0000000000..cb06cd4bdf --- /dev/null +++ b/tests/mpi/distribute_sp_02.cc @@ -0,0 +1,169 @@ +//--------------------------------------------------------------------------- +// $Id: distribute_sp_01.cc 24425 2011-09-26 13:53:32Z bangerth $ +// Version: $Name$ +// +// Copyright (C) 2009, 2010 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 SparsityTools::distribute_sparsity_pattern for BlockCompressedSimpleSP + +#include "../tests.h" +#include +#include + +#include +#include +#include +#include + +#include + + +void test_mpi() +{ + Assert( Utilities::System::job_supports_mpi(), ExcInternalError()); + + unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); + const unsigned int numprocs = Utilities::MPI::n_mpi_processes (MPI_COMM_WORLD); + + if (myid==0) + deallog << "Running on " << numprocs << " CPU(s)." << std::endl; + + unsigned int num_local=10; + unsigned int n=numprocs*num_local; + std::vector rows_per_cpu; + for (unsigned int i=0;i0) + locally_rel.add_range((myid-1)*num_local, (myid+0)*num_local); + if (myid partitioning; + partitioning.push_back(locally_rel); + + BlockCompressedSimpleSparsityPattern csp(partitioning); + + for (unsigned int i=0;i(csp, + rows_per_cpu, + MPI_COMM_WORLD, + locally_rel); +/* { + std::ofstream f((std::string("after")+Utilities::int_to_string(myid)).c_str()); + csp.print(f); + }*/ + + // checking... + for (unsigned int r=0;r(csp, + rows_per_cpu, + MPI_COMM_WORLD, + locally_rel); + + if (myid==0) + { + deallog << "blocks: " << csp.n_block_rows() << "x" << csp.n_block_cols() << std::endl; + deallog << "size: " << csp.n_rows() << "x" << csp.n_cols() << std::endl; + } + + // checking... + for (unsigned int r=0;r