From: Daniel Arndt Date: Thu, 28 Jun 2018 08:05:21 +0000 (+0200) Subject: Pass IndexSet element by copy X-Git-Tag: v9.1.0-rc1~973^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70665ef80c06924177bc3b4d808d3774b7a9802e;p=dealii.git Pass IndexSet element by copy --- diff --git a/include/deal.II/base/index_set.h b/include/deal.II/base/index_set.h index 68a7cad4a9..42dd03323e 100644 --- a/include/deal.II/base/index_set.h +++ b/include/deal.II/base/index_set.h @@ -691,7 +691,7 @@ public: * Dereferencing operator. The returned value is the index of the element * inside the IndexSet. */ - const size_type &operator*() const; + size_type operator*() const; /** * Does this iterator point to an existing element? @@ -1283,7 +1283,7 @@ IndexSet::ElementIterator::is_valid() const -inline const IndexSet::size_type &IndexSet::ElementIterator::operator*() const +inline IndexSet::size_type IndexSet::ElementIterator::operator*() const { Assert( is_valid(), diff --git a/include/deal.II/lac/affine_constraints.templates.h b/include/deal.II/lac/affine_constraints.templates.h index 7cd691b39b..de00d9625e 100644 --- a/include/deal.II/lac/affine_constraints.templates.h +++ b/include/deal.II/lac/affine_constraints.templates.h @@ -165,7 +165,7 @@ AffineConstraints::is_consistent_in_parallel( { // find all lines to send to @p owner IndexSet indices_to_send = non_owned & locally_owned_dofs[owner]; - for (const auto &row_idx : indices_to_send) + for (const auto row_idx : indices_to_send) { to_send[owner].push_back(get_line(row_idx)); } diff --git a/include/deal.II/lac/read_write_vector.templates.h b/include/deal.II/lac/read_write_vector.templates.h index d577e4c7c7..05a875240c 100644 --- a/include/deal.II/lac/read_write_vector.templates.h +++ b/include/deal.II/lac/read_write_vector.templates.h @@ -562,7 +562,7 @@ namespace LinearAlgebra stored_elements.print(out); out << std::endl; unsigned int i = 0; - for (const auto &idx : this->stored_elements) + for (const auto idx : this->stored_elements) out << "[" << idx << "]: " << values[i++] << '\n'; out << std::flush; diff --git a/source/dofs/dof_renumbering.cc b/source/dofs/dof_renumbering.cc index d9d8a2e626..2fa17cbe77 100644 --- a/source/dofs/dof_renumbering.cc +++ b/source/dofs/dof_renumbering.cc @@ -528,7 +528,7 @@ namespace DoFRenumbering active_but_not_owned_dofs.subtract_set(locally_owned_dofs); std::set erase_these_indices; - for (const auto &p : active_but_not_owned_dofs) + for (const auto p : active_but_not_owned_dofs) { const auto index = index_set_to_use.index_within_set(p); Assert(index < index_set_to_use.n_elements(), diff --git a/source/dofs/dof_tools.cc b/source/dofs/dof_tools.cc index 75075ab289..c6cb63c66f 100644 --- a/source/dofs/dof_tools.cc +++ b/source/dofs/dof_tools.cc @@ -1040,7 +1040,7 @@ namespace DoFTools ExcDimensionMismatch(selected_dofs.size(), dof_handler.n_dofs())); // preset all values by false std::fill(selected_dofs.begin(), selected_dofs.end(), false); - for (const auto &index : selected_dofs_as_index_set) + for (const auto index : selected_dofs_as_index_set) selected_dofs[index] = true; } diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index 5f00abc06d..01ac23648b 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -1740,7 +1740,7 @@ namespace GridTools // Creating a bounding box for all active cell on coarser level for (unsigned int i = 0; i < refinement_level; ++i) - for (typename MeshType::cell_iterator cell : + for (const typename MeshType::cell_iterator &cell : mesh.active_cell_iterators_on_level(i)) { bool has_predicate = false; diff --git a/source/lac/trilinos_sparse_matrix.cc b/source/lac/trilinos_sparse_matrix.cc index fe657772ef..5b3905e1b5 100644 --- a/source/lac/trilinos_sparse_matrix.cc +++ b/source/lac/trilinos_sparse_matrix.cc @@ -411,7 +411,7 @@ namespace TrilinosWrappers // Try to copy all the rows of the matrix one by one. In case of error // (i.e., the column indices are different), we need to abort and blow // away the matrix. - for (const auto &row : locally_owned_range_indices()) + for (const auto row : locally_owned_range_indices()) { const int row_local = matrix->RowMap().LID( static_cast(row)); @@ -1905,7 +1905,7 @@ namespace TrilinosWrappers const bool same_col_map = matrix->ColMap().SameAs(rhs.matrix->ColMap()); - for (const auto &row : locally_owned_range_indices()) + for (const auto row : locally_owned_range_indices()) { const int row_local = matrix->RowMap().LID( static_cast(row));