From 1e2757d0b19af42fe1d1e3f9ad4c565de4ecb5e7 Mon Sep 17 00:00:00 2001 From: kronbichler Date: Mon, 20 Jan 2014 09:01:13 +0000 Subject: [PATCH] Need to add a few more entries to non-local part of sparsity pattern for MeshWorker assembly. Now the reason for failing MG tests is a wrong prolongation matrix where some non-local rows get lost git-svn-id: https://svn.dealii.org/trunk@32260 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/deal.II/lac/trilinos_sparse_matrix.h | 4 +++- deal.II/source/dofs/dof_tools_sparsity.cc | 13 ++++--------- deal.II/source/lac/sparsity_tools.cc | 8 +++----- deal.II/source/lac/trilinos_sparse_matrix.cc | 6 +++++- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h b/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h index 92d4d816f8..c5ab727b66 100644 --- a/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h @@ -2755,7 +2755,9 @@ namespace TrilinosWrappers for (TrilinosWrappers::types::int_type i=0; i(row)) == false ? "(nonlocal part)" : "") + << " has the following indices:" << std::endl; std::vector indices; const Epetra_CrsGraph* graph = (nonlocal_matrix.get() != 0 && diff --git a/deal.II/source/dofs/dof_tools_sparsity.cc b/deal.II/source/dofs/dof_tools_sparsity.cc index bc26fd13cd..6f97a33e9a 100644 --- a/deal.II/source/dofs/dof_tools_sparsity.cc +++ b/deal.II/source/dofs/dof_tools_sparsity.cc @@ -596,11 +596,8 @@ namespace DoFTools { // Refinement edges are taken care of by coarser // cells - - // TODO: in the distributed case, we miss out the - // constraints when the neighbor cell is coarser, but - // only the current cell is owned locally! - if (cell->neighbor_is_coarser(face)) + if (cell->neighbor_is_coarser(face) && + neighbor->subdomain_id() == cell->subdomain_id()) continue; const unsigned int n_dofs_on_neighbor @@ -619,14 +616,12 @@ namespace DoFTools // around if (!cell->neighbor(face)->active() || - (cell->neighbor(face)->subdomain_id() != - cell->subdomain_id())) + (neighbor->subdomain_id() != cell->subdomain_id())) { constraints.add_entries_local_to_global (dofs_on_other_cell, dofs_on_this_cell, sparsity, keep_constrained_dofs); - if (cell->neighbor(face)->subdomain_id() != - cell->subdomain_id()) + if (neighbor->subdomain_id() != cell->subdomain_id()) constraints.add_entries_local_to_global (dofs_on_other_cell, sparsity, keep_constrained_dofs); } diff --git a/deal.II/source/lac/sparsity_tools.cc b/deal.II/source/lac/sparsity_tools.cc index 57a04430c0..afa8e0fa3d 100644 --- a/deal.II/source/lac/sparsity_tools.cc +++ b/deal.II/source/lac/sparsity_tools.cc @@ -477,7 +477,7 @@ namespace SparsityTools Assert (status.MPI_TAG==124, ExcInternalError()); MPI_Get_count(&status, MPI_BYTE, &len); - Assert( len%sizeof(unsigned int)==0, ExcInternalError()); + Assert( len%sizeof(size_type)==0, ExcInternalError()); recv_buf.resize(len/sizeof(size_type)); @@ -500,8 +500,7 @@ namespace SparsityTools } } - // complete all sends, so that we can - // safely destroy the buffers. + // complete all sends, so that we can safely destroy the buffers. MPI_Waitall(requests.size(), &requests[0], MPI_STATUSES_IGNORE); } @@ -625,8 +624,7 @@ namespace SparsityTools } } - // complete all sends, so that we can - // safely destroy the buffers. + // complete all sends, so that we can safely destroy the buffers. MPI_Waitall(requests.size(), &requests[0], MPI_STATUSES_IGNORE); } diff --git a/deal.II/source/lac/trilinos_sparse_matrix.cc b/deal.II/source/lac/trilinos_sparse_matrix.cc index 55dcb90411..88e828f356 100644 --- a/deal.II/source/lac/trilinos_sparse_matrix.cc +++ b/deal.II/source/lac/trilinos_sparse_matrix.cc @@ -609,6 +609,9 @@ namespace TrilinosWrappers Utilities::MPI::internal::mpi_type_id(&my_elements), communicator->Comm()); + AssertDimension(std::accumulate(owned_per_proc.begin(), + owned_per_proc.end(), size_type()), sparsity_pattern.n_rows()); + SparsityTools::distribute_sparsity_pattern (const_cast(sparsity_pattern), owned_per_proc, communicator->Comm(), sparsity_pattern.row_index_set()); @@ -756,6 +759,7 @@ namespace TrilinosWrappers + void SparseMatrix::reinit (const SparsityPattern &sparsity_pattern) { @@ -1804,7 +1808,7 @@ namespace TrilinosWrappers template void SparseMatrix::reinit (const Epetra_Map &, const Epetra_Map &, - const CompressedSimpleSparsityPattern &, + const CompressedSetSparsityPattern &, const bool); } -- 2.39.5