]> https://gitweb.dealii.org/ - dealii.git/commitdiff
PETScWrappers::MPI::Vector: add new reinit() 12864/head
authorPeter Munch <peterrmuench@gmail.com>
Fri, 22 Oct 2021 17:16:45 +0000 (19:16 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Fri, 22 Oct 2021 17:16:45 +0000 (19:16 +0200)
include/deal.II/lac/petsc_vector.h
source/lac/petsc_parallel_vector.cc

index 32fe3ebbe1c26614390e8ac1dff6d9bcbcaa8d8a..bfcfb92179fbce9959a64935e9c800c5a28dbefd 100644 (file)
@@ -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>
@@ -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.
index af3acaf90e11bc9943d6558c6e8bda375ec102a5..6c2b1622f5b745aa88ee203254adfe3e41f5b001 100644 (file)
@@ -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)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.