From: heister Date: Sun, 17 Feb 2013 14:16:47 +0000 (+0000) Subject: fix vector being a ghosted vectors by accident X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5f6f1fe199c1be979f630a516bce4e819175e4c;p=dealii-svn.git fix vector being a ghosted vectors by accident git-svn-id: https://svn.dealii.org/trunk@28439 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/lac/petsc_parallel_vector.h b/deal.II/include/deal.II/lac/petsc_parallel_vector.h index 52a1399c5a..ffbdd25986 100644 --- a/deal.II/include/deal.II/lac/petsc_parallel_vector.h +++ b/deal.II/include/deal.II/lac/petsc_parallel_vector.h @@ -391,8 +391,15 @@ namespace PETScWrappers */ void reinit (const MPI_Comm &communicator, const IndexSet &local, - const IndexSet &ghost = IndexSet(0)); + const IndexSet &ghost); + /** + * Reinit as a vector without ghost elements. See + * constructor with same signature + * for more detais. + */ + void reinit (const MPI_Comm &communicator, + const IndexSet &local); /** * Return a reference to the MPI diff --git a/deal.II/source/lac/petsc_parallel_vector.cc b/deal.II/source/lac/petsc_parallel_vector.cc index fdadfa6ae4..d790c40613 100644 --- a/deal.II/source/lac/petsc_parallel_vector.cc +++ b/deal.II/source/lac/petsc_parallel_vector.cc @@ -76,12 +76,6 @@ namespace PETScWrappers IndexSet ghost_set = ghost; ghost_set.subtract_set(local); - //possible optmization: figure out if - //there are ghost indices (collective - //operation!) and then create a - //non-ghosted vector. -// Vector::create_vector (local.size(), local.n_elements()); - Vector::create_vector(local.size(), local.n_elements(), ghost_set); } @@ -166,6 +160,15 @@ namespace PETScWrappers create_vector(local.size(), local.n_elements(), ghost_set); } + void + Vector::reinit (const MPI_Comm &comm, + const IndexSet &local) + { + communicator = comm; + + Assert(local.is_contiguous(), ExcNotImplemented()); + create_vector(local.size(), local.n_elements()); + } Vector & @@ -215,6 +218,7 @@ namespace PETScWrappers const unsigned int local_size) { Assert (local_size <= n, ExcIndexRange (local_size, 0, n)); + ghosted = false; const int ierr = VecCreateMPI (communicator, local_size, PETSC_DETERMINE,