From: Peter Munch Date: Fri, 22 Oct 2021 17:16:45 +0000 (+0200) Subject: PETScWrappers::MPI::Vector: add new reinit() X-Git-Tag: v9.4.0-rc1~907^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12864%2Fhead;p=dealii.git PETScWrappers::MPI::Vector: add new reinit() --- diff --git a/include/deal.II/lac/petsc_vector.h b/include/deal.II/lac/petsc_vector.h index 32fe3ebbe1..bfcfb92179 100644 --- a/include/deal.II/lac/petsc_vector.h +++ b/include/deal.II/lac/petsc_vector.h @@ -22,6 +22,7 @@ # ifdef DEAL_II_WITH_PETSC # include +# include # include # include @@ -356,6 +357,14 @@ namespace PETScWrappers void reinit(const IndexSet &local, const MPI_Comm &communicator); + /** + * Initialize the vector given to the parallel partitioning described in + * @p partitioner. + */ + void + reinit( + const std::shared_ptr &partitioner); + /** * Return a reference to the MPI communicator object in use with this * vector. diff --git a/source/lac/petsc_parallel_vector.cc b/source/lac/petsc_parallel_vector.cc index af3acaf90e..6c2b1622f5 100644 --- a/source/lac/petsc_parallel_vector.cc +++ b/source/lac/petsc_parallel_vector.cc @@ -254,6 +254,15 @@ namespace PETScWrappers create_vector(local.size(), local.n_elements()); } + void + Vector::reinit( + const std::shared_ptr &partitioner) + { + this->reinit(partitioner->locally_owned_range(), + partitioner->ghost_indices(), + partitioner->get_mpi_communicator()); + } + void Vector::create_vector(const size_type n, const size_type locally_owned_size)