From: heister Date: Wed, 5 Jun 2013 23:04:43 +0000 (+0000) Subject: add failing test X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c47718735e77367cc1db3de74a858aa8e4b9edf;p=dealii-svn.git add failing test git-svn-id: https://svn.dealii.org/branches/branch_unify_linear_algebra@29775 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/gla/mat_02.cc b/tests/gla/mat_02.cc new file mode 100644 index 0000000000..9c3f08a744 --- /dev/null +++ b/tests/gla/mat_02.cc @@ -0,0 +1,101 @@ +//--------------------------------------------------------------------------- +// $Id: ghost_01.cc 28440 2013-02-17 14:35:08Z heister $ +// Version: $Name$ +// +// Copyright (C) 2004, 2005, 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. +// +//--------------------------------------------------------------------------- + + +// create LA::MPI::SparseMatrix where one CPU has no DoFs + +// this is a bug in PETScWrappers right now! + +#include "../tests.h" +#include +#include +#include +#include +#include +#include + +#include "gla.h" + +template +void test () +{ + unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); + unsigned int numproc = Utilities::MPI::n_mpi_processes (MPI_COMM_WORLD); + + if (myid==0) + deallog << "numproc=" << numproc << std::endl; + + IndexSet local_active(10); + if (myid==0) + local_active.add_range(0,10); + IndexSet local_relevant= local_active; + if (myid==1) + local_relevant.add_range(5,10); + + CompressedSimpleSparsityPattern csp (local_relevant); + + for (unsigned int i=0;i<10;++i) + if (local_relevant.is_element(i)) + csp.add(i,i); + + if (myid==0) + csp.add(0,1); + + typename LA::MPI::SparseMatrix mat; + mat.reinit (local_active, local_active, csp, MPI_COMM_WORLD); + + Assert(mat.n()==10, ExcInternalError()); + Assert(mat.m()==10, ExcInternalError()); + + mat.set(0,0,0.1); + mat.set(1,1,0.1); + + mat.compress(VectorOperation::insert); + + mat.add(0,1,1.0); + + mat.compress(VectorOperation::add); + + // check local values + if (myid==0) + { + deallog << "1,1 : " << mat(1,1) << std::endl; + deallog << "0,1 : " << mat(0,1) << std::endl; + } + + // done + if (myid==0) + deallog << "OK" << std::endl; +} + + + +int main (int argc, char **argv) +{ + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); + MPILogInitAll log(__FILE__); + { + deallog.push("PETSc"); + test(); + deallog.pop(); + deallog.push("Trilinos"); + test(); + deallog.pop(); + } + + // compile, don't run + //if (myid==9999) + // test(); + + +} diff --git a/tests/gla/mat_02/ncpu_2/cmp/generic b/tests/gla/mat_02/ncpu_2/cmp/generic new file mode 100644 index 0000000000..88d363c606 --- /dev/null +++ b/tests/gla/mat_02/ncpu_2/cmp/generic @@ -0,0 +1,11 @@ + +DEAL:0:PETSc::numproc=4 +DEAL:0:PETSc::0: 0 +DEAL:0:PETSc::1: 1.000 +DEAL:0:PETSc::0,1 : 4.000 +DEAL:0:PETSc::OK +DEAL:0:Trilinos::numproc=4 +DEAL:0:Trilinos::0: 0 +DEAL:0:Trilinos::1: 1.000 +DEAL:0:Trilinos::0,1 : 4.000 +DEAL:0:Trilinos::OK