From: kronbichler Date: Sun, 1 Mar 2009 22:45:27 +0000 (+0000) Subject: Change a few things in the Trilinos wrapper classes. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e69c2f92af0a75eb3c7b8ebb0cfcb078e891213f;p=dealii-svn.git Change a few things in the Trilinos wrapper classes. git-svn-id: https://svn.dealii.org/trunk@18438 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/trilinos_sparse_matrix.h b/deal.II/lac/include/lac/trilinos_sparse_matrix.h index 4e4285e835..8d2f6e2bee 100755 --- a/deal.II/lac/include/lac/trilinos_sparse_matrix.h +++ b/deal.II/lac/include/lac/trilinos_sparse_matrix.h @@ -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= 0, ExcTrilinosError(ierr)); } @@ -2519,7 +2541,7 @@ namespace TrilinosWrappers const Epetra_CrsMatrix & SparseMatrix::trilinos_matrix () const { - return static_cast(*matrix); + return static_cast(*matrix); } diff --git a/deal.II/lac/include/lac/trilinos_sparsity_pattern.h b/deal.II/lac/include/lac/trilinos_sparsity_pattern.h index bf4e2ca5f5..a6dd7b2941 100755 --- a/deal.II/lac/include/lac/trilinos_sparsity_pattern.h +++ b/deal.II/lac/include/lac/trilinos_sparsity_pattern.h @@ -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(*graph); + return static_cast(*graph); } @@ -1408,7 +1389,7 @@ namespace TrilinosWrappers const Epetra_Map & SparsityPattern::domain_partitioner () const { - return (Epetra_Map &) graph->DomainMap(); + return static_cast(graph->DomainMap()); } @@ -1417,7 +1398,7 @@ namespace TrilinosWrappers const Epetra_Map & SparsityPattern::range_partitioner () const { - return (Epetra_Map &) graph->RangeMap(); + return static_cast(graph->RangeMap()); } @@ -1426,7 +1407,7 @@ namespace TrilinosWrappers const Epetra_Map & SparsityPattern::row_partitioner () const { - return (Epetra_Map &) graph->RowMap(); + return static_cast(graph->RowMap()); } @@ -1435,7 +1416,7 @@ namespace TrilinosWrappers const Epetra_Map & SparsityPattern::col_partitioner () const { - return (Epetra_Map &) graph->ColMap(); + return static_cast(graph->ColMap()); } diff --git a/deal.II/lac/include/lac/trilinos_vector_base.h b/deal.II/lac/include/lac/trilinos_vector_base.h index a9890a017f..36a46571f8 100644 --- a/deal.II/lac/include/lac/trilinos_vector_base.h +++ b/deal.II/lac/include/lac/trilinos_vector_base.h @@ -1215,7 +1215,7 @@ namespace TrilinosWrappers const Epetra_MultiVector & VectorBase::trilinos_vector () const { - return static_cast(*vector); + return static_cast(*vector); } @@ -1233,7 +1233,7 @@ namespace TrilinosWrappers const Epetra_Map & VectorBase::vector_partitioner () const { - return (Epetra_Map &)vector->Map(); + return static_cast(vector->Map()); } #endif // DOXYGEN