From: heister Date: Mon, 5 Aug 2013 21:39:38 +0000 (+0000) Subject: add failing test X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2eb437870a7c214cce0fa4b2017dc269acde478c;p=dealii-svn.git add failing test git-svn-id: https://svn.dealii.org/trunk@30226 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/gla/vec_05.cc b/tests/gla/vec_05.cc new file mode 100644 index 0000000000..fee6b4ee23 --- /dev/null +++ b/tests/gla/vec_05.cc @@ -0,0 +1,108 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2004 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + + +// test reinit() + +#include "../tests.h" +#include +#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; + + // 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); + + typename LA::MPI::Vector v(local_active, MPI_COMM_WORLD); + typename LA::MPI::Vector g(local_active, local_relevant, MPI_COMM_WORLD); + + // set local values + v(myid*2)=myid*2.0; + v(myid*2+1)=myid*2.0+1.0; + + v.compress(VectorOperation::insert); + + g=v; + + IndexSet local_active_big(numproc*3); + local_active_big.add_range(myid*3,myid*3+3); + typename LA::MPI::Vector big(local_active_big, MPI_COMM_WORLD); + + typename LA::MPI::Vector x; + Assert(!x.has_ghost_elements(), ExcInternalError()); + Assert(x.size()==0, ExcInternalError()); + x.reinit(v); + Assert(!x.has_ghost_elements(), ExcInternalError()); + Assert(x.size()==v.size(), ExcInternalError()); + + x.reinit(big); + Assert(!x.has_ghost_elements(), ExcInternalError()); + Assert(x.size()==big.size(), ExcInternalError()); + + x.reinit(v); + Assert(!x.has_ghost_elements(), ExcInternalError()); + Assert(x.size()==v.size(), ExcInternalError()); + + x.reinit(g); + Assert(x.has_ghost_elements(), ExcInternalError()); + Assert(x.size()==g.size(), ExcInternalError()); + deallog << x(1) << std::endl; + + x.reinit(v); + Assert(!x.has_ghost_elements(), ExcInternalError()); + Assert(x.size()==v.size(), ExcInternalError()); + + // 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(); + } + +} diff --git a/tests/gla/vec_05/ncpu_2/cmp/generic b/tests/gla/vec_05/ncpu_2/cmp/generic new file mode 100644 index 0000000000..cfd1786731 --- /dev/null +++ b/tests/gla/vec_05/ncpu_2/cmp/generic @@ -0,0 +1,11 @@ + +DEAL:0:PETSc::numproc=2 +DEAL:0:PETSc::0.00000 +DEAL:0:PETSc::OK +DEAL:0:Trilinos::numproc=2 +DEAL:0:Trilinos::0.00000 +DEAL:0:Trilinos::OK + +DEAL:1:PETSc::0.00000 +DEAL:1:Trilinos::0.00000 + diff --git a/tests/gla/vec_05/ncpu_4/cmp/generic b/tests/gla/vec_05/ncpu_4/cmp/generic new file mode 100644 index 0000000000..548926a664 --- /dev/null +++ b/tests/gla/vec_05/ncpu_4/cmp/generic @@ -0,0 +1,19 @@ + +DEAL:0:PETSc::numproc=4 +DEAL:0:PETSc::0.00000 +DEAL:0:PETSc::OK +DEAL:0:Trilinos::numproc=4 +DEAL:0:Trilinos::0.00000 +DEAL:0:Trilinos::OK + +DEAL:1:PETSc::0.00000 +DEAL:1:Trilinos::0.00000 + + +DEAL:2:PETSc::0.00000 +DEAL:2:Trilinos::0.00000 + + +DEAL:3:PETSc::0.00000 +DEAL:3:Trilinos::0.00000 +