From: heister Date: Fri, 15 Feb 2013 23:16:44 +0000 (+0000) Subject: add test that disallows editing ghosted vectors (failing) X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19ee24d5ff336d4861cb16d167e2e018aa25cd8b;p=dealii-svn.git add test that disallows editing ghosted vectors (failing) git-svn-id: https://svn.dealii.org/trunk@28421 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/mpi/ghost_03.cc b/tests/mpi/ghost_03.cc new file mode 100644 index 0000000000..79e8bf433e --- /dev/null +++ b/tests/mpi/ghost_03.cc @@ -0,0 +1,101 @@ +//--------------------------------------------------------------------------- +// $Id: ghost_01.cc 28403 2013-02-15 05:23:40Z 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. +// +//--------------------------------------------------------------------------- + + +// Test that ghosted vectors are read-only (not working right now) + +#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); + + if (myid==0) + deallog << "numproc=" << numproc << std::endl; + + // each processor owns 2 indices and all + // are ghosting Element 1 (the second) + + IndexSet local_active(numproc*2); + local_active.add_range(myid*2,myid*2+2); + IndexSet local_relevant(numproc*2); + local_relevant.add_range(1,2); + + PETScWrappers::MPI::Vector vb(MPI_COMM_WORLD, local_active); + PETScWrappers::MPI::Vector v(MPI_COMM_WORLD, local_active, local_relevant); + + // set local values + vb(myid*2)=myid*2.0; + vb(myid*2+1)=myid*2.0+1.0; + + vb.compress(VectorOperation::insert); + vb*=2.0; + v=vb; + + deal_II_exceptions::disable_abort_on_exception(); + try + { + v(0)=1.0; + } + catch (...){} + try + { + v(0)*=2.0; + } + catch (...){} + try + { + v=2.0; + } + catch (...){} + try + { + v+=v; + } + catch (...){} + + // done + if (myid==0) + deallog << "OK" << std::endl; +} + + + +int main (int argc, char **argv) +{ + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv); + unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); + + deallog.push(Utilities::int_to_string(myid)); + + if (myid == 0) + { + std::ofstream logfile(output_file_for_mpi("ghost_03").c_str()); + deallog.attach(logfile); + deallog << std::setprecision(4); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + test(); + } + else + test(); +} diff --git a/tests/mpi/ghost_03/ncpu_10/cmp/generic b/tests/mpi/ghost_03/ncpu_10/cmp/generic new file mode 100644 index 0000000000..1d58fd3a1d --- /dev/null +++ b/tests/mpi/ghost_03/ncpu_10/cmp/generic @@ -0,0 +1,6 @@ + +DEAL:0::numproc=10 +DEAL:0::0:0.000 +DEAL:0::1:2.000 +DEAL:0::ghost: 2.000 +DEAL:0::OK diff --git a/tests/mpi/ghost_03/ncpu_4/cmp/generic b/tests/mpi/ghost_03/ncpu_4/cmp/generic new file mode 100644 index 0000000000..c727015a8d --- /dev/null +++ b/tests/mpi/ghost_03/ncpu_4/cmp/generic @@ -0,0 +1,4 @@ + +DEAL:0::numproc=4 +ExcGhostPresent +DEAL:0::OK