From ff90ee91013e257915743e90d95e4625001510c2 Mon Sep 17 00:00:00 2001 From: kronbichler Date: Mon, 24 Nov 2008 18:34:38 +0000 Subject: [PATCH] Corrected some more errors in Trilinos sparse matrix collective add functions. git-svn-id: https://svn.dealii.org/trunk@17713 0785d39b-7218-0410-832d-ea1e28bc413d --- .../lac/trilinos_block_sparse_matrix.h | 4 +-- .../lac/include/lac/trilinos_sparse_matrix.h | 28 +++++++++++-------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/deal.II/lac/include/lac/trilinos_block_sparse_matrix.h b/deal.II/lac/include/lac/trilinos_block_sparse_matrix.h index 92db2a99aa..6aaea7c2ad 100644 --- a/deal.II/lac/include/lac/trilinos_block_sparse_matrix.h +++ b/deal.II/lac/include/lac/trilinos_block_sparse_matrix.h @@ -828,7 +828,7 @@ namespace TrilinosWrappers ExcDimensionMismatch(col_indices.size(), values.n())); for (unsigned int i=0; iFilled() == false) { - ierr = matrix->Epetra_CrsMatrix::InsertGlobalValues(row, n_cols, + ierr = matrix->Epetra_CrsMatrix::InsertGlobalValues(row, n_columns, const_cast(col_value_ptr), col_index_ptr); @@ -2151,7 +2153,7 @@ namespace TrilinosWrappers ierr = 0; } else - ierr = matrix->Epetra_CrsMatrix::ReplaceGlobalValues(row, n_cols, + ierr = matrix->Epetra_CrsMatrix::ReplaceGlobalValues(row, n_columns, const_cast(col_value_ptr), col_index_ptr); } @@ -2172,7 +2174,7 @@ namespace TrilinosWrappers if (matrix->Filled() == false) { ierr = matrix->InsertGlobalValues (1, (int*)&row, - (int)n_cols, col_index_ptr, + n_columns, col_index_ptr, &col_value_ptr, Epetra_FECrsMatrix::ROW_MAJOR); if (ierr > 0) @@ -2180,13 +2182,13 @@ namespace TrilinosWrappers } else ierr = matrix->ReplaceGlobalValues (1, (int*)&row, - (int)n_cols, col_index_ptr, + n_columns, col_index_ptr, &col_value_ptr, Epetra_FECrsMatrix::ROW_MAJOR); } Assert (ierr <= 0, ExcAccessToNonPresentElement(row, col_index_ptr[0])); - AssertThrow (ierr == 0, ExcTrilinosError(ierr)); + AssertThrow (ierr >= 0, ExcTrilinosError(ierr)); } @@ -2289,6 +2291,7 @@ namespace TrilinosWrappers int * col_index_ptr; TrilinosScalar const* col_value_ptr; + int n_columns; // If we don't elide zeros, the pointers // are already available... @@ -2296,6 +2299,7 @@ namespace TrilinosWrappers { col_index_ptr = (int*)col_indices; col_value_ptr = values; + n_columns = n_cols; } else { @@ -2305,7 +2309,7 @@ namespace TrilinosWrappers column_indices.resize(n_cols); column_values.resize(n_cols); - unsigned int n_columns = 0; + n_columns = 0; for (unsigned int j=0; jEpetra_CrsMatrix::SumIntoGlobalValues(row, n_cols, + ierr = matrix->Epetra_CrsMatrix::SumIntoGlobalValues(row, n_columns, const_cast(col_value_ptr), col_index_ptr); } @@ -2344,14 +2348,14 @@ namespace TrilinosWrappers // one element at a time). compressed = false; - ierr = matrix->SumIntoGlobalValues (1, (int*)&row, (int)n_cols, + ierr = matrix->SumIntoGlobalValues (1, (int*)&row, n_columns, col_index_ptr, &col_value_ptr, Epetra_FECrsMatrix::ROW_MAJOR); } Assert (ierr <= 0, ExcAccessToNonPresentElement(row, col_index_ptr[0])); - AssertThrow (ierr == 0, ExcTrilinosError(ierr)); + AssertThrow (ierr >= 0, ExcTrilinosError(ierr)); } -- 2.39.5