From 5e464080110110290cfe193388d2006a3e6ca3e7 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Mon, 6 Apr 2020 13:30:26 -0400 Subject: [PATCH] Replace some loops --- .../deal.II/differentiation/ad/ad_helpers.h | 4 +- .../lac/affine_constraints.templates.h | 12 +-- .../lac/la_parallel_vector.templates.h | 8 +- .../deal.II/lac/relaxation_block.templates.h | 7 +- include/deal.II/lac/sparse_vanka.templates.h | 6 +- .../deal.II/matrix_free/face_setup_internal.h | 6 +- .../matrix_free/matrix_free.templates.h | 4 +- include/deal.II/matrix_free/operators.h | 8 +- .../meshworker/integration_info.templates.h | 33 +++---- .../deal.II/multigrid/mg_transfer.templates.h | 36 +++---- .../numerics/data_out_dof_data.templates.h | 34 ++++--- source/differentiation/ad/ad_helpers.cc | 16 ++-- source/grid/grid_in.cc | 8 +- source/hp/dof_handler.cc | 4 +- source/multigrid/mg_level_global_transfer.cc | 4 +- source/numerics/point_value_history.cc | 96 +++++++------------ 16 files changed, 118 insertions(+), 168 deletions(-) diff --git a/include/deal.II/differentiation/ad/ad_helpers.h b/include/deal.II/differentiation/ad/ad_helpers.h index f8c6ec810e..a7271a41e3 100644 --- a/include/deal.II/differentiation/ad/ad_helpers.h +++ b/include/deal.II/differentiation/ad/ad_helpers.h @@ -3794,10 +3794,10 @@ namespace Differentiation # ifdef DEBUG const std::vector index_set( internal::extract_field_component_indices(extractor)); - for (unsigned int i = 0; i < index_set.size(); ++i) + for (const unsigned int index : index_set) { Assert( - this->registered_independent_variable_values[index_set[i]] == false, + this->registered_independent_variable_values[index] == false, ExcMessage( "Overlapping indices for independent variables. " "One or more indices associated with the field that " diff --git a/include/deal.II/lac/affine_constraints.templates.h b/include/deal.II/lac/affine_constraints.templates.h index 73460313f9..5712424ca7 100644 --- a/include/deal.II/lac/affine_constraints.templates.h +++ b/include/deal.II/lac/affine_constraints.templates.h @@ -2539,14 +2539,14 @@ namespace internals << "Constr rows " << n_constraints() << std::endl << "Inhom rows " << n_inhomogeneous_rows << std::endl << "Local: "; - for (size_type i = 0; i < total_row_indices.size(); ++i) - os << ' ' << std::setw(4) << total_row_indices[i].local_row; + for (const auto &total_row_index : total_row_indices) + os << ' ' << std::setw(4) << total_row_index.local_row; os << std::endl << "Global:"; - for (size_type i = 0; i < total_row_indices.size(); ++i) - os << ' ' << std::setw(4) << total_row_indices[i].global_row; + for (const auto &total_row_index : total_row_indices) + os << ' ' << std::setw(4) << total_row_index.global_row; os << std::endl << "ConPos:"; - for (size_type i = 0; i < total_row_indices.size(); ++i) - os << ' ' << std::setw(4) << total_row_indices[i].constraint_position; + for (const auto &total_row_index : total_row_indices) + os << ' ' << std::setw(4) << total_row_index.constraint_position; os << std::endl; } diff --git a/include/deal.II/lac/la_parallel_vector.templates.h b/include/deal.II/lac/la_parallel_vector.templates.h index e5ad13c720..b9d8215a4a 100644 --- a/include/deal.II/lac/la_parallel_vector.templates.h +++ b/include/deal.II/lac/la_parallel_vector.templates.h @@ -381,15 +381,15 @@ namespace LinearAlgebra Vector::clear_mpi_requests() { #ifdef DEAL_II_WITH_MPI - for (size_type j = 0; j < compress_requests.size(); j++) + for (auto &compress_request : compress_requests) { - const int ierr = MPI_Request_free(&compress_requests[j]); + const int ierr = MPI_Request_free(&compress_request); AssertThrowMPI(ierr); } compress_requests.clear(); - for (size_type j = 0; j < update_ghost_values_requests.size(); j++) + for (auto &update_ghost_values_request : update_ghost_values_requests) { - const int ierr = MPI_Request_free(&update_ghost_values_requests[j]); + const int ierr = MPI_Request_free(&update_ghost_values_request); AssertThrowMPI(ierr); } update_ghost_values_requests.clear(); diff --git a/include/deal.II/lac/relaxation_block.templates.h b/include/deal.II/lac/relaxation_block.templates.h index 997ea0a442..6f74fff166 100644 --- a/include/deal.II/lac/relaxation_block.templates.h +++ b/include/deal.II/lac/relaxation_block.templates.h @@ -49,11 +49,8 @@ inline std::size_t RelaxationBlock::AdditionalData:: memory_consumption() const { - std::size_t result = - sizeof(*this) + block_list.memory_consumption() - sizeof(block_list); - for (unsigned int i = 0; i < order.size(); ++i) - result += MemoryConsumption::memory_consumption(order[i]); - return result; + return sizeof(*this) + block_list.memory_consumption() - sizeof(block_list) + + MemoryConsumption::memory_consumption(order); } diff --git a/include/deal.II/lac/sparse_vanka.templates.h b/include/deal.II/lac/sparse_vanka.templates.h index 1b2f3dd564..66b721b9e9 100644 --- a/include/deal.II/lac/sparse_vanka.templates.h +++ b/include/deal.II/lac/sparse_vanka.templates.h @@ -654,10 +654,8 @@ template std::size_t SparseBlockVanka::memory_consumption() const { - std::size_t mem = SparseVanka::memory_consumption(); - for (size_type i = 0; i < dof_masks.size(); ++i) - mem += MemoryConsumption::memory_consumption(dof_masks[i]); - return mem; + return SparseVanka::memory_consumption() + + MemoryConsumption::memory_consumption(dof_masks); } diff --git a/include/deal.II/matrix_free/face_setup_internal.h b/include/deal.II/matrix_free/face_setup_internal.h index 2ad4ab8437..01c2d3145a 100644 --- a/include/deal.II/matrix_free/face_setup_internal.h +++ b/include/deal.II/matrix_free/face_setup_internal.h @@ -738,9 +738,9 @@ namespace internal cells_close_to_boundary.end()); std::vector final_cells; final_cells.reserve(cells_close_to_boundary.size()); - for (unsigned int i = 0; i < cells_close_to_boundary.size(); ++i) - if (at_processor_boundary[cells_close_to_boundary[i]] == false) - final_cells.push_back(cells_close_to_boundary[i]); + for (const unsigned int cell : cells_close_to_boundary) + if (at_processor_boundary[cell] == false) + final_cells.push_back(cell); cells_close_to_boundary = std::move(final_cells); } diff --git a/include/deal.II/matrix_free/matrix_free.templates.h b/include/deal.II/matrix_free/matrix_free.templates.h index d2ca43976c..fc0b4670ed 100644 --- a/include/deal.II/matrix_free/matrix_free.templates.h +++ b/include/deal.II/matrix_free/matrix_free.templates.h @@ -1190,8 +1190,8 @@ MatrixFree::initialize_indices( additional_data.cell_vectorization_categories_strict || dof_handlers.active_dof_handler == DoFHandlers::hp; unsigned int dofs_per_cell = 0; - for (unsigned int no = 0; no < dof_info.size(); ++no) - dofs_per_cell = std::max(dofs_per_cell, dof_info[no].dofs_per_cell[0]); + for (const auto &info : dof_info) + dofs_per_cell = std::max(dofs_per_cell, info.dofs_per_cell[0]); task_info.create_blocks_serial(subdomain_boundary_cells, face_setup.cells_close_to_boundary, dofs_per_cell, diff --git a/include/deal.II/matrix_free/operators.h b/include/deal.II/matrix_free/operators.h index b30f77691f..e5e771dbc1 100644 --- a/include/deal.II/matrix_free/operators.h +++ b/include/deal.II/matrix_free/operators.h @@ -1101,8 +1101,8 @@ namespace MatrixFreeOperators Assert(data.get() != nullptr, ExcNotInitialized()); typename Base::size_type total_size = 0; - for (unsigned int i = 0; i < selected_rows.size(); ++i) - total_size += data->get_vector_partitioner(selected_rows[i])->size(); + for (const unsigned int selected_row : selected_rows) + total_size += data->get_vector_partitioner(selected_row)->size(); return total_size; } @@ -1115,8 +1115,8 @@ namespace MatrixFreeOperators Assert(data.get() != nullptr, ExcNotInitialized()); typename Base::size_type total_size = 0; - for (unsigned int i = 0; i < selected_columns.size(); ++i) - total_size += data->get_vector_partitioner(selected_columns[i])->size(); + for (const unsigned int selected_column : selected_columns) + total_size += data->get_vector_partitioner(selected_column)->size(); return total_size; } diff --git a/include/deal.II/meshworker/integration_info.templates.h b/include/deal.II/meshworker/integration_info.templates.h index c310b5629f..195f3cedbf 100644 --- a/include/deal.II/meshworker/integration_info.templates.h +++ b/include/deal.II/meshworker/integration_info.templates.h @@ -38,41 +38,38 @@ namespace MeshWorker const unsigned int nqp = fevalv[0]->n_quadrature_points; values.resize(global_data->n_values()); - // For all selected finite - // element functions - for (unsigned int i = 0; i < values.size(); ++i) + // For all selected finite element functions + for (auto &function_values : values) { - values[i].resize(n_components); + function_values.resize(n_components); // For all components - for (unsigned int j = 0; j < values[i].size(); ++j) + for (auto &component_values : function_values) { - values[i][j].resize(nqp); + component_values.resize(nqp); } } gradients.resize(global_data->n_gradients()); - // For all selected finite - // element functions - for (unsigned int i = 0; i < gradients.size(); ++i) + // For all selected finite element functions + for (auto &function_gradients : gradients) { - gradients[i].resize(n_components); + function_gradients.resize(n_components); // For all components - for (unsigned int j = 0; j < gradients[i].size(); ++j) + for (auto &component_gradients : function_gradients) { - gradients[i][j].resize(nqp); + component_gradients.resize(nqp); } } hessians.resize(global_data->n_hessians()); - // For all selected finite - // element functions - for (unsigned int i = 0; i < hessians.size(); ++i) + // For all selected finite element functions + for (auto &function_hessians : hessians) { - hessians[i].resize(n_components); + function_hessians.resize(n_components); // For all components - for (unsigned int j = 0; j < hessians[i].size(); ++j) + for (auto &component_hessians : function_hessians) { - hessians[i][j].resize(nqp); + component_hessians.resize(nqp); } } } diff --git a/include/deal.II/multigrid/mg_transfer.templates.h b/include/deal.II/multigrid/mg_transfer.templates.h index 0158b6310b..df58561dfe 100644 --- a/include/deal.II/multigrid/mg_transfer.templates.h +++ b/include/deal.II/multigrid/mg_transfer.templates.h @@ -247,17 +247,13 @@ MGLevelGlobalTransfer::copy_to_mg( VectorType &dst_level = dst[level]; // first copy local unknowns - for (dof_pair_iterator i = copy_indices[level].begin(); - i != copy_indices[level].end(); - ++i) - dst_level(i->second) = src(i->first); + for (const auto ©_index : copy_indices[level]) + dst_level(copy_index.second) = src(copy_index.first); // Do the same for the indices where the global index is local, but the // local index is not - for (dof_pair_iterator i = copy_indices_global_mine[level].begin(); - i != copy_indices_global_mine[level].end(); - ++i) - dst_level(i->second) = src(i->first); + for (const auto ©_index : copy_indices_global_mine[level]) + dst_level(copy_index.second) = src(copy_index.first); dst_level.compress(VectorOperation::insert); @@ -314,17 +310,13 @@ MGLevelGlobalTransfer::copy_from_mg( const VectorType &src_level = src[level]; // First copy all indices local to this process - for (dof_pair_iterator i = copy_indices[level].begin(); - i != copy_indices[level].end(); - ++i) - dst(i->first) = src_level(i->second); + for (const auto ©_index : copy_indices[level]) + dst(copy_index.first) = src_level(copy_index.second); // Do the same for the indices where the level index is local, but the // global index is not - for (dof_pair_iterator i = copy_indices_level_mine[level].begin(); - i != copy_indices_level_mine[level].end(); - ++i) - dst(i->first) = src_level(i->second); + for (const auto ©_index : copy_indices_level_mine[level]) + dst(copy_index.first) = src_level(copy_index.second); #ifdef DEBUG_OUTPUT { @@ -366,17 +358,13 @@ MGLevelGlobalTransfer::copy_from_mg_add( const VectorType &src_level = src[level]; // First add all indices local to this process - for (dof_pair_iterator i = copy_indices[level].begin(); - i != copy_indices[level].end(); - ++i) - dst(i->first) += src_level(i->second); + for (const auto ©_index : copy_indices[level]) + dst(copy_index.first) += src_level(copy_index.second); // Do the same for the indices where the level index is local, but the // global index is not - for (dof_pair_iterator i = copy_indices_level_mine[level].begin(); - i != copy_indices_level_mine[level].end(); - ++i) - dst(i->first) += src_level(i->second); + for (const auto ©_index : copy_indices_level_mine[level]) + dst(copy_index.first) += src_level(copy_index.second); } dst.compress(VectorOperation::add); } diff --git a/include/deal.II/numerics/data_out_dof_data.templates.h b/include/deal.II/numerics/data_out_dof_data.templates.h index d9d4a3071e..6ad298b399 100644 --- a/include/deal.II/numerics/data_out_dof_data.templates.h +++ b/include/deal.II/numerics/data_out_dof_data.templates.h @@ -493,16 +493,15 @@ namespace internal names.size())); // check that the names use only allowed characters - for (unsigned int i = 0; i < names.size(); ++i) - Assert(names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "0123456789_<>()") == - std::string::npos, + for (const auto &name : names) + Assert(name.find_first_not_of("abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789_<>()") == std::string::npos, Exceptions::DataOutImplementation::ExcInvalidCharacter( - names[i], - names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "0123456789_<>()"))); + name, + name.find_first_not_of("abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789_<>()"))); } @@ -531,16 +530,15 @@ namespace internal data_postprocessor->get_data_component_interpretation().size())); // check that the names use only allowed characters - for (unsigned int i = 0; i < names.size(); ++i) - Assert(names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "0123456789_<>()") == - std::string::npos, + for (const auto &name : names) + Assert(name.find_first_not_of("abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789_<>()") == std::string::npos, Exceptions::DataOutImplementation::ExcInvalidCharacter( - names[i], - names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "0123456789_<>()"))); + name, + name.find_first_not_of("abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789_<>()"))); } diff --git a/source/differentiation/ad/ad_helpers.cc b/source/differentiation/ad/ad_helpers.cc index 2fea29d658..392fa59555 100644 --- a/source/differentiation/ad/ad_helpers.cc +++ b/source/differentiation/ad/ad_helpers.cc @@ -81,11 +81,9 @@ namespace Differentiation HelperBase::reset_registered_independent_variables() { - for (typename std::vector::iterator it = - registered_independent_variable_values.begin(); - it != registered_independent_variable_values.end(); - ++it) - *it = false; + for (auto &®istered_independent_variable_value : + registered_independent_variable_values) + registered_independent_variable_value = false; } @@ -95,11 +93,9 @@ namespace Differentiation HelperBase:: reset_registered_dependent_variables(const bool flag) { - for (typename std::vector::iterator it = - registered_marked_dependent_variables.begin(); - it != registered_marked_dependent_variables.end(); - ++it) - *it = flag; + for (auto &®istered_marked_dependent_variable : + registered_marked_dependent_variables) + registered_marked_dependent_variable = flag; } diff --git a/source/grid/grid_in.cc b/source/grid/grid_in.cc index cf8639fc6e..cdc599a05f 100644 --- a/source/grid/grid_in.cc +++ b/source/grid/grid_in.cc @@ -4032,18 +4032,18 @@ namespace // Write out node numbers // Loop over all nodes - for (unsigned int ii = 0; ii < node_list.size(); ++ii) + for (const auto &node : node_list) { // Node number - output << node_list[ii][0] << "\t"; + output << node[0] << "\t"; // Node coordinates output.setf(std::ios::scientific, std::ios::floatfield); for (unsigned int jj = 1; jj < spacedim + 1; ++jj) { // invoke tolerance -> set points close to zero equal to zero - if (std::abs(node_list[ii][jj]) > tolerance) - output << static_cast(node_list[ii][jj]) << "\t"; + if (std::abs(node[jj]) > tolerance) + output << static_cast(node[jj]) << "\t"; else output << 0.0 << "\t"; } diff --git a/source/hp/dof_handler.cc b/source/hp/dof_handler.cc index fb2ced901c..2431997e41 100644 --- a/source/hp/dof_handler.cc +++ b/source/hp/dof_handler.cc @@ -1520,8 +1520,8 @@ namespace hp MemoryConsumption::memory_consumption(number_cache) + MemoryConsumption::memory_consumption(vertex_dofs) + MemoryConsumption::memory_consumption(vertex_dof_offsets)); - for (unsigned int i = 0; i < levels.size(); ++i) - mem += MemoryConsumption::memory_consumption(*levels[i]); + for (const auto &level : levels) + mem += MemoryConsumption::memory_consumption(*level); mem += MemoryConsumption::memory_consumption(*faces); return mem; diff --git a/source/multigrid/mg_level_global_transfer.cc b/source/multigrid/mg_level_global_transfer.cc index 964f1a9d13..db089eaabe 100644 --- a/source/multigrid/mg_level_global_transfer.cc +++ b/source/multigrid/mg_level_global_transfer.cc @@ -73,8 +73,8 @@ MGLevelGlobalTransfer::fill_and_communicate_copy_indices( // check whether there is a renumbering of degrees of freedom on // either the finest level or the global dofs, which means that we // cannot apply a plain copy - for (unsigned int i = 0; i < copy_indices.back().size(); ++i) - if (copy_indices.back()[i].first != copy_indices.back()[i].second) + for (const auto ©_index : copy_indices.back()) + if (copy_index.first != copy_index.second) { my_perform_plain_copy = false; break; diff --git a/source/numerics/point_value_history.cc b/source/numerics/point_value_history.cc index 89445ff029..fe0cd668f3 100644 --- a/source/numerics/point_value_history.cc +++ b/source/numerics/point_value_history.cc @@ -304,17 +304,13 @@ PointValueHistory::add_point(const Point &location) new_point_geometry_data(location, current_points, new_solution_indices); point_geometry_data.push_back(new_point_geometry_data); - std::map>>::iterator - data_store_begin = data_store.begin(); - for (; data_store_begin != data_store.end(); ++data_store_begin) + for (auto &data_entry : data_store) { - // add an extra row to each vector - // entry + // add an extra row to each vector entry const ComponentMask ¤t_mask = - (component_mask.find(data_store_begin->first))->second; + (component_mask.find(data_entry.first))->second; unsigned int n_stored = current_mask.n_selected_components(); - data_store_begin->second.resize(data_store_begin->second.size() + - n_stored); + data_entry.second.resize(data_entry.second.size() + n_stored); } } @@ -444,17 +440,13 @@ PointValueHistory::add_points(const std::vector> &locations) point_geometry_data.push_back(new_point_geometry_data); - std::map>>::iterator - data_store_begin = data_store.begin(); - for (; data_store_begin != data_store.end(); ++data_store_begin) + for (auto &data_entry : data_store) { - // add an extra row to each vector - // entry + // add an extra row to each vector entry const ComponentMask current_mask = - (component_mask.find(data_store_begin->first))->second; + (component_mask.find(data_entry.first))->second; unsigned int n_stored = current_mask.n_selected_components(); - data_store_begin->second.resize(data_store_begin->second.size() + - n_stored); + data_entry.second.resize(data_entry.second.size() + n_stored); } } } @@ -1023,9 +1015,9 @@ PointValueHistory::write_gnuplot( if (indep_names.size() > 0) { - for (unsigned int name = 0; name < indep_names.size(); name++) + for (const auto &indep_name : indep_names) { - to_gnuplot << "<" << indep_names[name] << "> "; + to_gnuplot << "<" << indep_name << "> "; } to_gnuplot << "\n"; } @@ -1127,9 +1119,9 @@ PointValueHistory::write_gnuplot( if (indep_names.size() > 0) { - for (unsigned int name = 0; name < indep_names.size(); name++) + for (const auto &indep_name : indep_names) { - to_gnuplot << "<" << indep_names[name] << "> "; + to_gnuplot << "<" << indep_name << "> "; } } else @@ -1140,16 +1132,13 @@ PointValueHistory::write_gnuplot( } } - for (std::map>>::iterator - data_store_begin = data_store.begin(); - data_store_begin != data_store.end(); - ++data_store_begin) + for (const auto &data_entry : data_store) { typename std::map::iterator mask = - component_mask.find(data_store_begin->first); + component_mask.find(data_entry.first); unsigned int n_stored = mask->second.n_selected_components(); std::vector names = - (component_names_map.find(data_store_begin->first))->second; + (component_names_map.find(data_entry.first))->second; if (names.size() > 0) { @@ -1165,8 +1154,8 @@ PointValueHistory::write_gnuplot( for (unsigned int component = 0; component < n_stored; component++) { - to_gnuplot << "<" << data_store_begin->first << "_" - << component << "> "; + to_gnuplot << "<" << data_entry.first << "_" << component + << "> "; } } } @@ -1182,14 +1171,10 @@ PointValueHistory::write_gnuplot( to_gnuplot << " " << independent_values[component][key]; } - for (std::map>>::iterator - data_store_begin = data_store.begin(); - data_store_begin != data_store.end(); - ++data_store_begin) + for (const auto &data_entry : data_store) { typename std::map::iterator mask = - component_mask.find(data_store_begin->first); + component_mask.find(data_entry.first); unsigned int n_stored = mask->second.n_selected_components(); for (unsigned int component = 0; component < n_stored; @@ -1197,9 +1182,8 @@ PointValueHistory::write_gnuplot( { to_gnuplot << " " - << (data_store_begin - ->second)[data_store_index * n_stored + component] - [key]; + << (data_entry.second)[data_store_index * n_stored + + component][key]; } } to_gnuplot << "\n"; @@ -1377,9 +1361,9 @@ PointValueHistory::status(std::ostream &out) if (indep_names.size() > 0) { out << "Names: "; - for (unsigned int name = 0; name < indep_names.size(); name++) + for (const auto &indep_name : indep_names) { - out << "<" << indep_names[name] << "> "; + out << "<" << indep_name << "> "; } out << "\n"; } @@ -1389,17 +1373,15 @@ PointValueHistory::status(std::ostream &out) out << "No independent values stored\n"; } - std::map>>::iterator - data_store_begin = data_store.begin(); - if (data_store_begin != data_store.end()) + if (data_store.begin() != data_store.end()) { out << "Mnemonic: data set size (mask size, n true components) : n data sets\n"; } - for (; data_store_begin != data_store.end(); ++data_store_begin) + for (const auto &data_entry : data_store) { // Find field mnemonic - std::string vector_name = data_store_begin->first; + std::string vector_name = data_entry.first; typename std::map::iterator mask = component_mask.find(vector_name); Assert(mask != component_mask.end(), @@ -1409,18 +1391,16 @@ PointValueHistory::status(std::ostream &out) Assert(component_names != component_names_map.end(), ExcMessage("vector_name not in class")); - if (data_store_begin->second.size() != 0) + if (data_entry.second.size() != 0) { - out << data_store_begin->first << ": " - << data_store_begin->second.size() << " ("; + out << data_entry.first << ": " << data_entry.second.size() << " ("; out << mask->second.size() << ", " << mask->second.n_selected_components() << ") : "; - out << (data_store_begin->second)[0].size() << "\n"; + out << (data_entry.second)[0].size() << "\n"; } else { - out << data_store_begin->first << ": " - << data_store_begin->second.size() << " ("; + out << data_entry.first << ": " << data_entry.second.size() << " ("; out << mask->second.size() << ", " << mask->second.n_selected_components() << ") : "; out << "No points added" @@ -1457,14 +1437,12 @@ PointValueHistory::deep_check(const bool strict) return false; } } - std::map>>::iterator - data_store_begin = data_store.begin(); if (have_dof_handler) { - for (; data_store_begin != data_store.end(); ++data_store_begin) + for (const auto &data_entry : data_store) { - Assert(data_store_begin->second.size() > 0, ExcInternalError()); - if ((data_store_begin->second)[0].size() != dataset_key.size()) + Assert(data_entry.second.size() > 0, ExcInternalError()); + if ((data_entry.second)[0].size() != dataset_key.size()) return false; // this loop only tests one // member for each name, @@ -1487,13 +1465,11 @@ PointValueHistory::deep_check(const bool strict) if (have_dof_handler) { - std::map>>::iterator - data_store_begin = data_store.begin(); - for (; data_store_begin != data_store.end(); ++data_store_begin) + for (const auto &data_entry : data_store) { - Assert(data_store_begin->second.size() > 0, ExcInternalError()); + Assert(data_entry.second.size() > 0, ExcInternalError()); - if (std::abs(static_cast((data_store_begin->second)[0].size()) - + if (std::abs(static_cast((data_entry.second)[0].size()) - static_cast(dataset_key.size())) >= 2) return false; // this loop only tests one member -- 2.39.5