]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
fix has_ghost_elements() in trilinos 10.12.x
authorheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 22 Aug 2012 21:37:41 +0000 (21:37 +0000)
committerheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 22 Aug 2012 21:37:41 +0000 (21:37 +0000)
git-svn-id: https://svn.dealii.org/trunk@26093 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/include/deal.II/lac/trilinos_vector.h
deal.II/include/deal.II/lac/trilinos_vector_base.h
deal.II/source/lac/trilinos_vector.cc
deal.II/source/lac/trilinos_vector_base.cc

index c75381a056b8618c164a62d6e7c67a366c0e1561..ee0efc5bf7f0663b0d51c7e29e12ecd92d385514 100644 (file)
@@ -293,6 +293,13 @@ enabled due to a missing include file in file
 <h3>Specific improvements</h3>
 
 <ol>
+<li> Changed: To support Trilinos version 10.12.x we need to cache the
+result of has_ghost_elements() in parallel vectors at construction time
+of the vector. Starting from 10.12 Trilinos will communicate in this
+call, which therefore only works if called from all CPUs.
+<br>
+(Timo Heister, 2012/08/22)
+
 <li> New: The copy constructor of FullMatrix from IdentityMatrix
 used to be explicit, but that didn't appear to be necessary in hindsight.
 Consequently, it is now a regular copy constructor.
index f70303b23b2b9180ebd1e54ac802dc7a88815c21..a2891c18fd212cad6bdd7918003a0adf1c351df8 100644 (file)
@@ -508,6 +508,8 @@ namespace TrilinosWrappers
       if (vector.get() != 0 && vector->Map().SameAs(parallel_partitioner))
         vector.reset (new Epetra_FEVector(parallel_partitioner));
 
+      has_ghosts = vector->Map().UniqueGIDs()==false;
+
       const int size = parallel_partitioner.NumMyElements();
 
                                    // Need to copy out values, since the
index 48d3b13c812a96cf31f8e664bf0183ce0caed12f..f7e1450221c75fb50f5ce04281037777a639ddc7 100644 (file)
@@ -494,7 +494,9 @@ namespace TrilinosWrappers
 
                                        /**
                                         * Return if the vector contains ghost
-                                        * elements.
+                                        * elements. This answer is true if there
+                                        * are ghost elements on at least one
+                                        * process.
                                         */
       bool has_ghost_elements() const;
 
@@ -1011,6 +1013,13 @@ namespace TrilinosWrappers
                                         */
       bool compressed;
 
+      /**
+       * Whether this vector has ghost elements. This is true
+       * on all processors even if only one of them has any
+       * ghost elements.
+       */
+      bool has_ghosts;
+
                                        /**
                                         * An Epetra distibuted vector
                                         * type. Requires an existing
@@ -1165,7 +1174,7 @@ namespace TrilinosWrappers
   bool
   VectorBase::has_ghost_elements() const
   {
-    return vector->Map().UniqueGIDs()==false;
+    return has_ghosts;
   }
 
 
index ddda7908ac0c4327c3078f29847680d07c3a73d3..3d8f1a05ad38efebe1a822c0ecba54ca79d8f1af 100644 (file)
@@ -61,6 +61,7 @@ namespace TrilinosWrappers
     {
       last_action = Zero;
       vector.reset (new Epetra_FEVector(*v.vector));
+      has_ghosts = v.has_ghosts;
     }
 
 
@@ -124,6 +125,7 @@ namespace TrilinosWrappers
           Assert (ierr == 0, ExcTrilinosError(ierr));
         }
 
+      has_ghosts = vector->Map().UniqueGIDs()==false;
       last_action = Zero;
     }
 
@@ -158,6 +160,7 @@ namespace TrilinosWrappers
           if (vector->Map().SameAs(v.vector->Map()) == false)
             {
               vector.reset (new Epetra_FEVector(v.vector->Map()));
+              has_ghosts = v.has_ghosts;
               last_action = Zero;
             }
           else if (fast == false)
@@ -306,6 +309,7 @@ namespace TrilinosWrappers
         {
           vector.reset (new Epetra_FEVector(*v.vector));
           last_action = Zero;
+          has_ghosts = v.has_ghosts;
         }
 
       return *this;
index afb660aa725acae7b2d694423f4c296c06f232a0..a90bb9e0ae05ff9f48e1b96fedc8b0fc0d6597b8 100644 (file)
@@ -57,6 +57,7 @@ namespace TrilinosWrappers
                         :
                         last_action (Zero),
                         compressed  (true),
+                        has_ghosts  (false),
 #ifdef DEAL_II_COMPILER_SUPPORTS_MPI
                         vector(new Epetra_FEVector(
                                  Epetra_Map(0,0,Epetra_MpiComm(MPI_COMM_SELF))))
@@ -73,6 +74,7 @@ namespace TrilinosWrappers
                         Subscriptor(),
                         last_action (Zero),
                         compressed (true),
+                        has_ghosts  (v.has_ghosts),
                         vector(new Epetra_FEVector(*v.vector))
   {}
 
@@ -95,6 +97,7 @@ namespace TrilinosWrappers
     Epetra_Map map (0, 0, Epetra_SerialComm());
 #endif
 
+    has_ghosts = false;
     vector.reset (new Epetra_FEVector(map));
     last_action = Zero;
   }
@@ -111,6 +114,7 @@ namespace TrilinosWrappers
       {
         last_action = Zero;
         vector.reset (new Epetra_FEVector(*v.vector));
+        has_ghosts = v.has_ghosts;
       }
     else
       {

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.