Skip to content

Commit

Permalink
Merge pull request #12864 from peterrum/petsc_vector_reinit
Browse files Browse the repository at this point in the history
PETScWrappers::MPI::Vector: add new reinit()
  • Loading branch information
drwells committed Oct 23, 2021
2 parents 4e68a80 + f48aecf commit 2683ac8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/deal.II/lac/petsc_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
# ifdef DEAL_II_WITH_PETSC

# include <deal.II/base/index_set.h>
# include <deal.II/base/partitioner.h>
# include <deal.II/base/subscriptor.h>

# include <deal.II/lac/exceptions.h>
Expand Down Expand Up @@ -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<const Utilities::MPI::Partitioner> &partitioner);

/**
* Return a reference to the MPI communicator object in use with this
* vector.
Expand Down
9 changes: 9 additions & 0 deletions source/lac/petsc_parallel_vector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,15 @@ namespace PETScWrappers
create_vector(local.size(), local.n_elements());
}

void
Vector::reinit(
const std::shared_ptr<const Utilities::MPI::Partitioner> &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)
Expand Down

0 comments on commit 2683ac8

Please sign in to comment.