From: Daniel Arndt Date: Wed, 25 Jul 2018 09:46:25 +0000 (+0200) Subject: Introduce TrilinosWrappers::SparsityPattern::row_is_stored_locally X-Git-Tag: v9.1.0-rc1~867^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c13c8aea9e42304a86b0f5c47142032f1a904bc9;p=dealii.git Introduce TrilinosWrappers::SparsityPattern::row_is_stored_locally --- diff --git a/include/deal.II/lac/trilinos_sparsity_pattern.h b/include/deal.II/lac/trilinos_sparsity_pattern.h index 0dc3bb4cbb..b93709d4e3 100644 --- a/include/deal.II/lac/trilinos_sparsity_pattern.h +++ b/include/deal.II/lac/trilinos_sparsity_pattern.h @@ -943,6 +943,13 @@ namespace TrilinosWrappers bool exists(const size_type i, const size_type j) const; + /** + * Return whether a given @p row is stored in the current object + * on this process. + */ + bool + row_is_stored_locally(const size_type i) const; + /** * Determine an estimate for the memory consumption (in bytes) of this * object. Currently not implemented for this class. @@ -1230,11 +1237,6 @@ namespace TrilinosWrappers */ std::unique_ptr nonlocal_graph; - /** - * The set of locally owned rows. - */ - IndexSet locally_owned_rows; - friend class TrilinosWrappers::SparseMatrix; friend class SparsityPatternIterators::Accessor; friend class SparsityPatternIterators::Iterator; @@ -1323,7 +1325,7 @@ namespace TrilinosWrappers const auto row_length = accessor.sparsity_pattern->row_length(accessor.a_row); if (row_length == 0 || - !accessor.sparsity_pattern->locally_owned_rows.is_element( + !accessor.sparsity_pattern->row_is_stored_locally( accessor.a_row)) ++accessor.a_row; else @@ -1506,7 +1508,7 @@ namespace TrilinosWrappers const int n_cols = static_cast(end - begin); int ierr; - if (locally_owned_rows.is_element(row)) + if (row_is_stored_locally(row)) ierr = graph->InsertGlobalIndices(row, n_cols, col_index_ptr); else if (nonlocal_graph.get() != nullptr) { diff --git a/source/lac/trilinos_sparsity_pattern.cc b/source/lac/trilinos_sparsity_pattern.cc index 905ca2d921..6c71e8af47 100644 --- a/source/lac/trilinos_sparsity_pattern.cc +++ b/source/lac/trilinos_sparsity_pattern.cc @@ -154,7 +154,6 @@ namespace TrilinosWrappers , column_space_map(std::move(other.column_space_map)) , graph(std::move(other.graph)) , nonlocal_graph(std::move(other.nonlocal_graph)) - , locally_owned_rows(std::move(other.locally_owned_rows)) {} @@ -486,9 +485,6 @@ namespace TrilinosWrappers column_space_map, graph, nonlocal_graph); - locally_owned_rows.clear(); - const auto range = this->local_range(); - locally_owned_rows.add_range(range.first, range.second); } @@ -504,8 +500,6 @@ namespace TrilinosWrappers column_space_map, graph, nonlocal_graph); - const auto range = this->local_range(); - locally_owned_rows.add_range(range.first, range.second); } @@ -520,8 +514,6 @@ namespace TrilinosWrappers column_space_map, graph, nonlocal_graph); - const auto range = this->local_range(); - locally_owned_rows.add_range(range.first, range.second); } @@ -537,8 +529,6 @@ namespace TrilinosWrappers column_space_map, graph, nonlocal_graph); - const auto range = this->local_range(); - locally_owned_rows.add_range(range.first, range.second); } @@ -552,7 +542,6 @@ namespace TrilinosWrappers parallel_partitioning.make_trilinos_map(communicator, false); reinit_sp( map, map, n_entries_per_row, column_space_map, graph, nonlocal_graph); - locally_owned_rows = parallel_partitioning; } @@ -566,7 +555,6 @@ namespace TrilinosWrappers parallel_partitioning.make_trilinos_map(communicator, false); reinit_sp( map, map, n_entries_per_row, column_space_map, graph, nonlocal_graph); - locally_owned_rows = parallel_partitioning; } @@ -587,7 +575,6 @@ namespace TrilinosWrappers column_space_map, graph, nonlocal_graph); - locally_owned_rows = row_parallel_partitioning; } @@ -608,7 +595,6 @@ namespace TrilinosWrappers column_space_map, graph, nonlocal_graph); - locally_owned_rows = row_parallel_partitioning; } @@ -630,7 +616,6 @@ namespace TrilinosWrappers column_space_map, graph, nonlocal_graph); - locally_owned_rows = row_parallel_partitioning; IndexSet nonlocal_partitioner = writable_rows; AssertDimension(nonlocal_partitioner.size(), @@ -678,7 +663,6 @@ namespace TrilinosWrappers column_space_map, graph, nonlocal_graph); - locally_owned_rows = row_parallel_partitioning; } @@ -700,7 +684,6 @@ namespace TrilinosWrappers column_space_map, graph, nonlocal_graph); - locally_owned_rows = parallel_partitioning; } @@ -718,8 +701,6 @@ namespace TrilinosWrappers column_space_map, graph, nonlocal_graph); - const auto range = this->local_range(); - locally_owned_rows.add_range(range.first, range.second); } @@ -738,8 +719,6 @@ namespace TrilinosWrappers column_space_map, graph, nonlocal_graph); - const auto range = this->local_range(); - locally_owned_rows.add_range(range.first, range.second); compress(); } @@ -759,7 +738,6 @@ namespace TrilinosWrappers { column_space_map = std_cxx14::make_unique(*sp.column_space_map); graph = std_cxx14::make_unique(*sp.graph); - locally_owned_rows = sp.locally_owned_rows; if (sp.nonlocal_graph.get() != nullptr) nonlocal_graph = @@ -783,7 +761,6 @@ namespace TrilinosWrappers reinit_sp( rows, columns, sp, false, column_space_map, graph, nonlocal_graph); - locally_owned_rows = complete_index_set(sp.n_rows()); } @@ -855,10 +832,19 @@ namespace TrilinosWrappers + bool + SparsityPattern::row_is_stored_locally(const size_type i) const + { + return graph->RowMap().LID( + static_cast(i)) != -1; + } + + + bool SparsityPattern::exists(const size_type i, const size_type j) const { - if (!locally_owned_rows.is_element(i)) + if (!row_is_stored_locally(i)) { return false; }