]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
add *::MPI::BlockVector::has_ghost_elements() and a missing constructor
authorheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 1 Aug 2013 20:56:18 +0000 (20:56 +0000)
committerheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 1 Aug 2013 20:56:18 +0000 (20:56 +0000)
git-svn-id: https://svn.dealii.org/trunk@30209 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/include/deal.II/lac/petsc_parallel_block_vector.h
deal.II/include/deal.II/lac/trilinos_parallel_block_vector.h

index 9ba000d1742127e684c37f1d97d500ff8f679c00..401a70d3ae18537c305a2afbc1437109d5364a8e 100644 (file)
@@ -44,6 +44,13 @@ inconvenience this causes.
 <h3>Specific improvements</h3>
 
 <ol>
+  <li>
+  add has_ghost_elements() for PETScWrappers::MPI::BlockVector and
+  TrilinosWrappers::MPI::BlockVector.
+  <br>
+  (Timo Heister, 2013/08/01)
+  </li>
+
   <li>
   SparsityTools::distribute_sparsity_pattern did not work correctly for
   block systems, this has been fixed (function has a different signature).
index 7d52ee379216f3843d6a890e18fb82b3cb4f548d..f7e5a4f1dbc90653b945d87e80c3832cf0d31887 100644 (file)
@@ -313,6 +313,11 @@ namespace PETScWrappers
        */
       void reinit (const unsigned int num_blocks);
 
+      /**
+       * Returns if this vector is a ghosted vector (and thus read-only).
+       */
+      bool has_ghost_elements() const;
+
       /**
        * Return a reference to the MPI
        * communicator object in use with
@@ -543,6 +548,17 @@ namespace PETScWrappers
       return block(0).get_mpi_communicator();
     }
 
+    inline
+    bool
+    BlockVector::has_ghost_elements() const
+    {
+      bool ghosted=block(0).has_ghost_elements();
+#ifdef DEBUG
+      for (unsigned int i=0; i<this->n_blocks(); ++i)
+        Assert(block(i).has_ghost_elements()==ghosted, ExcInternalError());
+#endif
+      return ghosted;
+    }
 
 
     inline
index f35166b1c376716bd278bc234188a9f1739d03b2..d684216bdcd798d931f5822a30a37b7ef5292f73 100644 (file)
@@ -127,6 +127,16 @@ namespace TrilinosWrappers
       explicit BlockVector (const std::vector<IndexSet> &parallel_partitioning,
                             const MPI_Comm              &communicator = MPI_COMM_WORLD);
 
+      /**
+       * Creates a BlockVector with ghost elements. @p ghost_values
+       * may contain any elements in @p parallel_partitioning, they will
+       * be ignored.
+       */
+      BlockVector (const std::vector<IndexSet> &parallel_partitioning,
+          const std::vector<IndexSet> &ghost_values,
+          const MPI_Comm              &communicator);
+
+
       /**
        * Copy-Constructor. Set all the
        * properties of the parallel vector
@@ -353,6 +363,11 @@ namespace TrilinosWrappers
        */
       bool is_compressed () const;
 
+      /**
+       * Returns if this Vector contains ghost elements.
+       */
+      bool has_ghost_elements() const;
+
       /**
        * Swap the contents of this
        * vector and the other vector
@@ -431,6 +446,14 @@ namespace TrilinosWrappers
     }
 
 
+    inline
+    BlockVector::BlockVector (const std::vector<IndexSet> &parallel_partitioning,
+        const std::vector<IndexSet> &ghost_values,
+        const MPI_Comm              &communicator)
+    {
+      reinit(parallel_partitioning, ghost_values, communicator);
+    }
+
 
     inline
     BlockVector::BlockVector (const size_type num_blocks)
@@ -510,6 +533,18 @@ namespace TrilinosWrappers
     }
 
 
+    inline
+    bool
+    BlockVector::has_ghost_elements() const
+    {
+      bool ghosted=block(0).has_ghost_elements();
+#ifdef DEBUG
+      for (unsigned int i=0; i<this->n_blocks(); ++i)
+        Assert(block(i).has_ghost_elements()==ghosted, ExcInternalError());
+#endif
+      return ghosted;
+    }
+
     inline
     void
     BlockVector::swap (BlockVector &v)

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.