From 559c60ce783d9267231c2688a5b1a3aefa55cf5f Mon Sep 17 00:00:00 2001 From: kronbichler Date: Sat, 18 Jan 2014 22:41:19 +0000 Subject: [PATCH] Fix at least one issue with my commit: The flux sparsity pattern needs to include other-other coupling when using MeshWorker git-svn-id: https://svn.dealii.org/trunk@32251 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/deal.II/lac/trilinos_sparse_matrix.h | 16 ++++++++++++---- deal.II/source/dofs/dof_tools_sparsity.cc | 12 +++++++++--- 2 files changed, 21 insertions(+), 7 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 13571aa507..92d4d816f8 100644 --- a/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h @@ -2756,10 +2756,18 @@ namespace TrilinosWrappers std::cout << col_index_ptr[i] << " "; std::cout << std::endl << std::endl; std::cout << "Matrix row has the following indices:" << std::endl; - int n_indices, *indices; - trilinos_sparsity_pattern().ExtractMyRowView(row_partitioner().LID(static_cast(row)), - n_indices, - indices); + std::vector indices; + const Epetra_CrsGraph* graph = + (nonlocal_matrix.get() != 0 && + row_partitioner().MyGID(static_cast(row)) == false) ? + &nonlocal_matrix->Graph() : &matrix->Graph(); + + indices.resize(graph->NumGlobalIndices(static_cast(row))); + int n_indices = 0; + graph->ExtractGlobalRowCopy(static_cast(row), + indices.size(), n_indices, &indices[0]); + AssertDimension(static_cast(n_indices), indices.size()); + for (TrilinosWrappers::types::int_type i=0; ineighbor(face)->subdomain_id() != cell->subdomain_id())) - constraints.add_entries_local_to_global - (dofs_on_other_cell, dofs_on_this_cell, - sparsity, keep_constrained_dofs); + { + constraints.add_entries_local_to_global + (dofs_on_other_cell, dofs_on_this_cell, + sparsity, keep_constrained_dofs); + if (cell->neighbor(face)->active()) + constraints.add_entries_local_to_global + (dofs_on_other_cell, dofs_on_other_cell, + sparsity, keep_constrained_dofs); + } } } } -- 2.39.5