]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Change a few things in the Trilinos wrapper classes.
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 1 Mar 2009 22:45:27 +0000 (22:45 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 1 Mar 2009 22:45:27 +0000 (22:45 +0000)
git-svn-id: https://svn.dealii.org/trunk@18438 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/trilinos_sparse_matrix.h
deal.II/lac/include/lac/trilinos_sparsity_pattern.h
deal.II/lac/include/lac/trilinos_vector_base.h

index 4e4285e835cf6776e23341dd28f46b0ae0eb278b..8d2f6e2bee1cb41cbff90aef46d49fbeeb4f68a5 100755 (executable)
@@ -2427,6 +2427,8 @@ namespace TrilinosWrappers
     int ierr;
     if (last_action == Insert)
       {
+       // TODO: this could lead to a dead lock when only one processor
+       // calls GlobalAssemble.
        ierr = matrix->GlobalAssemble(col_map, row_map, false);
 
        AssertThrow (ierr == 0, ExcTrilinosError(ierr));
@@ -2509,7 +2511,27 @@ namespace TrilinosWrappers
                                            Epetra_FECrsMatrix::ROW_MAJOR);
       }
 
-    Assert (ierr <= 0, ExcAccessToNonPresentElement(row, col_index_ptr[0]));
+#ifdef DEBUG
+    if (ierr > 0)
+      {
+       std::cout << "Got error " << ierr << " in row " << row 
+                 << " of proc " << row_map.Comm().MyPID()
+                 << " with columns:" << std::endl;
+       for (int i=0; i<n_columns; ++i)
+         std::cout << col_index_ptr[i] << " ";
+       std::cout << endl;
+       std::cout << " Matrix row has indices:" << std::endl;
+       int n_indices, *indices;
+       trilinos_sparsity_pattern().ExtractMyRowView(row_map.LID(row),
+                                                    n_indices,
+                                                    indices);
+       for (int i=0; i<n_indices; ++i)
+         std::cout << indices[i] << " ";
+       std::cout << endl;
+       Assert (ierr <= 0, 
+               ExcAccessToNonPresentElement(row, col_index_ptr[0]));
+      }
+#endif 
     AssertThrow (ierr >= 0, ExcTrilinosError(ierr));
   }
 
@@ -2519,7 +2541,7 @@ namespace TrilinosWrappers
   const Epetra_CrsMatrix &
   SparseMatrix::trilinos_matrix () const
   {
-    return static_cast<Epetra_CrsMatrix&>(*matrix);
+    return static_cast<const Epetra_CrsMatrix&>(*matrix);
   }
 
 
index bf4e2ca5f5a83045225327cb88c59e48dfb5878f..a6dd7b29418b6aa67a7b776f87bd8aa53862b1d0 100755 (executable)
@@ -303,7 +303,7 @@ namespace TrilinosWrappers
                                        * sparsity pattern.
                                         */
       SparsityPattern (const Epetra_Map   &InputMap,
-                      const unsigned int  n_entries_per_row = 1);
+                      const unsigned int  n_entries_per_row = 0);
 
                                        /**
                                         * Same as before, but now use the
@@ -358,7 +358,7 @@ namespace TrilinosWrappers
                                         */
       SparsityPattern (const Epetra_Map   &InputRowMap,
                       const Epetra_Map   &InputColMap,
-                      const unsigned int  n_entries_per_row = 1);
+                      const unsigned int  n_entries_per_row = 0);
 
                                        /**
                                         * This constructor is similar to the
@@ -408,7 +408,7 @@ namespace TrilinosWrappers
                                         */
       SparsityPattern (const unsigned int  m,
                       const unsigned int  n,
-                      const unsigned int  n_entries_per_row = 1);
+                      const unsigned int  n_entries_per_row = 0);
 
                                        /**
                                         * Generate a sparsity pattern that
@@ -466,7 +466,7 @@ namespace TrilinosWrappers
                                         */
       void  
       reinit (const Epetra_Map   &InputMap,
-             const unsigned int  n_entries_per_row = 1);
+             const unsigned int  n_entries_per_row = 0);
 
                                        /**
                                         * Same as before, but now use the
@@ -521,7 +521,7 @@ namespace TrilinosWrappers
       void  
       reinit (const Epetra_Map   &InputRowMap,
              const Epetra_Map   &InputColMap,
-             const unsigned int  n_entries_per_row = 1);
+             const unsigned int  n_entries_per_row = 0);
 
                                        /**
                                         * This reinit function is similar to
@@ -573,7 +573,7 @@ namespace TrilinosWrappers
       void  
       reinit (const unsigned int  m,
              const unsigned int  n,
-             const unsigned int  n_entries_per_row = 1);
+             const unsigned int  n_entries_per_row = 0);
 
                                        /**
                                         * Initialize a sparsity pattern that
@@ -1368,28 +1368,9 @@ namespace TrilinosWrappers
     int * col_index_ptr = (int*)(col_indices);
     compressed = false;
 
-    int ierr;
-
-                                  // If the calling sparsity pattern owns
-                                  // the row to which we want to add
-                                  // values, we can directly call the
-                                  // Epetra_CrsGraph input function, which
-                                  // is much faster than the
-                                  // Epetra_FECrsGraph function.
-    //if (row_map.MyGID(row) == true)
-    //ierr = graph->Epetra_CrsGraph::InsertGlobalIndices(row, 
-    //                                          n_cols,
-    //                                          col_index_ptr);
-    //else
-      {
-                                  // When we're at off-processor data, we
-                                  // have to stick with the standard
-                                  // SumIntoGlobalValues method.
-
-       ierr = graph->InsertGlobalIndices (1, (int*)&row, n_cols, col_index_ptr);
-      }
+    const int ierr = graph->InsertGlobalIndices (1, (int*)&row, 
+                                                n_cols, col_index_ptr);
 
-    //Assert (ierr <= 0, ExcAccessToNonPresentElement(row, col_index_ptr[0]));
     AssertThrow (ierr >= 0, ExcTrilinosError(ierr));
   }
 
@@ -1399,7 +1380,7 @@ namespace TrilinosWrappers
   const Epetra_CrsGraph &
   SparsityPattern::trilinos_sparsity_pattern () const
   {
-    return static_cast<Epetra_CrsGraph&>(*graph);
+    return static_cast<const Epetra_CrsGraph&>(*graph);
   }
 
 
@@ -1408,7 +1389,7 @@ namespace TrilinosWrappers
   const Epetra_Map &
   SparsityPattern::domain_partitioner () const
   {
-    return (Epetra_Map &) graph->DomainMap();
+    return static_cast<const Epetra_Map&>(graph->DomainMap());
   }
 
 
@@ -1417,7 +1398,7 @@ namespace TrilinosWrappers
   const Epetra_Map &
   SparsityPattern::range_partitioner () const
   {
-    return (Epetra_Map &) graph->RangeMap();
+    return static_cast<const Epetra_Map&>(graph->RangeMap());
   }
 
 
@@ -1426,7 +1407,7 @@ namespace TrilinosWrappers
   const Epetra_Map &
   SparsityPattern::row_partitioner () const
   {
-    return (Epetra_Map &) graph->RowMap();
+    return static_cast<const Epetra_Map&>(graph->RowMap());
   }
 
 
@@ -1435,7 +1416,7 @@ namespace TrilinosWrappers
   const Epetra_Map &
   SparsityPattern::col_partitioner () const
   {
-    return (Epetra_Map &) graph->ColMap();
+    return static_cast<const Epetra_Map&>(graph->ColMap());
   }
 
 
index a9890a017feb6db8c48d2d0aaaf93434a16db26a..36a46571f83ed1c230f2233d94b09b45532dba4f 100644 (file)
@@ -1215,7 +1215,7 @@ namespace TrilinosWrappers
   const Epetra_MultiVector &
   VectorBase::trilinos_vector () const
   {
-    return static_cast<Epetra_MultiVector &>(*vector);
+    return static_cast<const Epetra_MultiVector&>(*vector);
   }
 
 
@@ -1233,7 +1233,7 @@ namespace TrilinosWrappers
   const Epetra_Map &
   VectorBase::vector_partitioner () const
   {
-    return (Epetra_Map &)vector->Map();
+    return static_cast<const Epetra_Map&>(vector->Map());
   }
 
 #endif // DOXYGEN

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.