From: Wolfgang Bangerth Date: Thu, 26 Jan 2023 23:14:25 +0000 (-0700) Subject: Use get_index_vector() instead of fill_index_vector(). X-Git-Tag: v9.5.0-rc1~592^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd6cb7e4c244d53479ad521ab70c451814086ada;p=dealii.git Use get_index_vector() instead of fill_index_vector(). --- diff --git a/include/deal.II/lac/parpack_solver.h b/include/deal.II/lac/parpack_solver.h index c4ac8fa075..f111a07bf3 100644 --- a/include/deal.II/lac/parpack_solver.h +++ b/include/deal.II/lac/parpack_solver.h @@ -686,7 +686,7 @@ void PArpackSolver::internal_reinit(const IndexSet &locally_owned_dofs) { // store local indices to write to vectors - locally_owned_dofs.fill_index_vector(local_indices); + local_indices = locally_owned_dofs.get_index_vector(); // scalars nloc = locally_owned_dofs.n_elements(); diff --git a/include/deal.II/matrix_free/operators.h b/include/deal.II/matrix_free/operators.h index cf0d1ecd95..03de54f81c 100644 --- a/include/deal.II/matrix_free/operators.h +++ b/include/deal.II/matrix_free/operators.h @@ -1352,10 +1352,10 @@ namespace MatrixFreeOperators } // setup edge_constrained indices - std::vector interface_indices; - mg_constrained_dofs[j] - .get_refinement_edge_indices(level) - .fill_index_vector(interface_indices); + const std::vector interface_indices = + mg_constrained_dofs[j] + .get_refinement_edge_indices(level) + .get_index_vector(); edge_constrained_indices[j].clear(); edge_constrained_indices[j].reserve(interface_indices.size()); edge_constrained_values[j].resize(interface_indices.size()); diff --git a/source/base/index_set.cc b/source/base/index_set.cc index d6aaab50ac..ef0a7c05e7 100644 --- a/source/base/index_set.cc +++ b/source/base/index_set.cc @@ -684,7 +684,7 @@ IndexSet::at(const size_type global_index) const -std::vector +std::vector IndexSet::get_index_vector() const { compress(); @@ -762,8 +762,7 @@ IndexSet::make_tpetra_map(const MPI_Comm &communicator, ); else { - std::vector indices; - fill_index_vector(indices); + const std::vector indices = get_index_vector(); std::vector int_indices(indices.size()); std::copy(indices.begin(), indices.end(), int_indices.begin()); const Teuchos::ArrayView arr_view(int_indices); @@ -831,13 +830,12 @@ IndexSet::make_trilinos_map(const MPI_Comm &communicator, ); else { - std::vector indices; - fill_index_vector(indices); + const std::vector indices = get_index_vector(); return Epetra_Map( TrilinosWrappers::types::int_type(-1), TrilinosWrappers::types::int_type(n_elements()), (n_elements() > 0 ? - reinterpret_cast( + reinterpret_cast( indices.data()) : nullptr), 0, diff --git a/source/base/partitioner.cc b/source/base/partitioner.cc index 693042d549..c42d77c638 100644 --- a/source/base/partitioner.cc +++ b/source/base/partitioner.cc @@ -365,13 +365,14 @@ namespace Utilities // exchange step and see whether the ghost indices sent to us by other // processes (ghost_indices) are the same as we hold locally // (ghost_indices_ref). - std::vector ghost_indices_ref; - ghost_indices_data.fill_index_vector(ghost_indices_ref); + const std::vector ghost_indices_ref = + ghost_indices_data.get_index_vector(); AssertDimension(ghost_indices_ref.size(), n_ghost_indices()); std::vector indices_to_send(n_import_indices()); std::vector ghost_indices(n_ghost_indices()); - std::vector my_indices; - locally_owned_range_data.fill_index_vector(my_indices); + + const std::vector my_indices = + locally_owned_range_data.get_index_vector(); std::vector requests; n_ghost_indices_in_larger_set = n_ghost_indices_data; export_to_ghosted_array_start(127, diff --git a/source/lac/petsc_parallel_vector.cc b/source/lac/petsc_parallel_vector.cc index 79a41b2dd8..d305051996 100644 --- a/source/lac/petsc_parallel_vector.cc +++ b/source/lac/petsc_parallel_vector.cc @@ -276,8 +276,7 @@ namespace PETScWrappers ghosted = true; ghost_indices = ghostnodes; - std::vector ghostindices; - ghostnodes.fill_index_vector(ghostindices); + const std::vector ghostindices = ghostnodes.get_index_vector(); const PetscInt *ptr = (ghostindices.size() > 0 ? diff --git a/source/lac/trilinos_sparse_matrix.cc b/source/lac/trilinos_sparse_matrix.cc index 5cdc79a38a..5d0ce1392f 100644 --- a/source/lac/trilinos_sparse_matrix.cc +++ b/source/lac/trilinos_sparse_matrix.cc @@ -648,14 +648,14 @@ namespace TrilinosWrappers // the owned rows. In that case, do not create the nonlocal graph and // fill the columns by demand const bool have_ghost_rows = [&]() { - std::vector indices; - relevant_rows.fill_index_vector(indices); + const std::vector indices = + relevant_rows.get_index_vector(); Epetra_Map relevant_map( TrilinosWrappers::types::int_type(-1), TrilinosWrappers::types::int_type(relevant_rows.n_elements()), (indices.empty() ? nullptr : - reinterpret_cast( + reinterpret_cast( indices.data())), 0, row_space_map.Comm());