From 4a6a45df15f2d4b0f4fd089270ffe6aedc358d88 Mon Sep 17 00:00:00 2001 From: bangerth Date: Sun, 21 Sep 2008 18:50:47 +0000 Subject: [PATCH] Make using a sparsity pattern without epetra_map work. git-svn-id: https://svn.dealii.org/trunk@16879 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/source/trilinos_sparse_matrix.cc | 106 +++++++++++-------- 1 file changed, 59 insertions(+), 47 deletions(-) diff --git a/deal.II/lac/source/trilinos_sparse_matrix.cc b/deal.II/lac/source/trilinos_sparse_matrix.cc index 0346016a1d..80e3f2351e 100755 --- a/deal.II/lac/source/trilinos_sparse_matrix.cc +++ b/deal.II/lac/source/trilinos_sparse_matrix.cc @@ -162,54 +162,21 @@ namespace TrilinosWrappers void SparseMatrix::reinit (const SparsityPattern &sparsity_pattern) { - unsigned int n_rows = sparsity_pattern.n_rows(); - - // TODO: As of now, assume that the - // sparsity pattern sits at the all - // processors (completely), and let - // each processor set its rows. Since - // this is wasteful, a better solution - // should be found in the future. - Assert (matrix->NumGlobalRows() == (int)sparsity_pattern.n_rows(), - ExcDimensionMismatch (matrix->NumGlobalRows(), - sparsity_pattern.n_rows())); - - // Trilinos has a bug for rectangular - // matrices at this point, so do not - // check for consistent column numbers - // here. - // - // this bug is filed in the Sandia - // bugzilla under #4123 and should be - // fixed for version 9.0 -// Assert (matrix->NumGlobalCols() == (int)sparsity_pattern.n_cols(), -// ExcDimensionMismatch (matrix->NumGlobalCols(), -// sparsity_pattern.n_cols())); - - std::vector values; - std::vector row_indices; - - for (unsigned int row=0; rowInsertGlobalValues (row, row_length, - &values[0], &row_indices[0]); - } - - last_action = Zero; + const Epetra_Map rows (sparsity_pattern.n_rows(), + 0, + trilinos_communicator); + const Epetra_Map columns (sparsity_pattern.n_cols(), + 0, + trilinos_communicator); - // In the end, the matrix needs to - // be compressed in order to be - // really ready. - compress(); - } + reinit (rows, columns, sparsity_pattern); + } @@ -265,7 +232,52 @@ namespace TrilinosWrappers (new Epetra_FECrsMatrix(Copy, row_map, &n_entries_per_row[0], false)); - reinit (sparsity_pattern); + + // TODO: As of now, assume that the + // sparsity pattern sits at the all + // processors (completely), and let + // each processor set its rows. Since + // this is wasteful, a better solution + // should be found in the future. + Assert (matrix->NumGlobalRows() == (int)sparsity_pattern.n_rows(), + ExcDimensionMismatch (matrix->NumGlobalRows(), + sparsity_pattern.n_rows())); + + // Trilinos has a bug for rectangular + // matrices at this point, so do not + // check for consistent column numbers + // here. + // + // this bug is filed in the Sandia + // bugzilla under #4123 and should be + // fixed for version 9.0 +// Assert (matrix->NumGlobalCols() == (int)sparsity_pattern.n_cols(), +// ExcDimensionMismatch (matrix->NumGlobalCols(), +// sparsity_pattern.n_cols())); + + std::vector values; + std::vector row_indices; + + for (unsigned int row=0; rowInsertGlobalValues (row, row_length, + &values[0], &row_indices[0]); + } + + last_action = Zero; + + // In the end, the matrix needs to + // be compressed in order to be + // really ready. + compress(); } -- 2.39.5