]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
integrate r28202,r28203,r28204 from unified linear algebra branch: introduces get_mpi...
authorheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 1 Feb 2013 00:23:08 +0000 (00:23 +0000)
committerheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 1 Feb 2013 00:23:08 +0000 (00:23 +0000)
git-svn-id: https://svn.dealii.org/trunk@28206 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/lac/petsc_vector_base.h
deal.II/source/lac/petsc_solver.cc

index 29391b7705bca90a2d88a5d64f245282b9ed4628..a50120b792685252a356915310f38aa435f4ce4d 100644 (file)
@@ -810,6 +810,13 @@ namespace PETScWrappers
      */
     std::size_t memory_consumption () const;
 
+    /**
+     * Return a reference to the MPI
+     * communicator object in use with this
+     * object.
+     */
+    virtual const MPI_Comm &get_mpi_communicator () const;
+
   protected:
     /**
      * A generic vector object in
@@ -1182,6 +1189,14 @@ namespace PETScWrappers
     return operator()(index);
   }
 
+  inline
+  const MPI_Comm &
+  VectorBase::get_mpi_communicator () const
+  {
+    static MPI_Comm comm;
+    PetscObjectGetComm((PetscObject)vector, &comm);
+    return comm;
+  }
 
 #endif // DOXYGEN
 }
index caaa9ea4b94d0ae054739af016ac612673f44be0..8a8dc50073990c091b37916c5bf51bb88415805c 100644 (file)
@@ -63,6 +63,11 @@ namespace PETScWrappers
                      const PreconditionerBase &preconditioner)
   {
     int ierr;
+
+    Assert(A.get_mpi_communicator()==mpi_communicator, ExcMessage("PETSc Solver and Matrix need to use the same MPI_Comm."));
+    Assert(x.get_mpi_communicator()==mpi_communicator, ExcMessage("PETSc Solver and Vector need to use the same MPI_Comm."));
+    Assert(b.get_mpi_communicator()==mpi_communicator, ExcMessage("PETSc Solver and Vector need to use the same MPI_Comm."));
+
     // first create a solver object if this
     // is necessary
     if (solver_data.get() == 0)

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.