From: Daniel Arndt Date: Sun, 6 Jan 2019 21:42:26 +0000 (+0100) Subject: Fix source/fe X-Git-Tag: v9.1.0-rc1~425^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=267d068ed57d0445aeac8f88397b7ca21f9d025c;p=dealii.git Fix source/fe --- diff --git a/source/fe/fe_abf.cc b/source/fe/fe_abf.cc index da6817056e..6a2655e9c3 100644 --- a/source/fe/fe_abf.cc +++ b/source/fe/fe_abf.cc @@ -100,11 +100,11 @@ FE_ABF::FE_ABF(const unsigned int deg) this->interface_constraints.reinit((1 << (dim - 1)) * this->dofs_per_face, this->dofs_per_face); unsigned int target_row = 0; - for (unsigned int d = 0; d < face_embeddings.size(); ++d) - for (unsigned int i = 0; i < face_embeddings[d].m(); ++i) + for (const auto &face_embedding : face_embeddings) + for (unsigned int i = 0; i < face_embedding.m(); ++i) { - for (unsigned int j = 0; j < face_embeddings[d].n(); ++j) - this->interface_constraints(target_row, j) = face_embeddings[d](i, j); + for (unsigned int j = 0; j < face_embedding.n(); ++j) + this->interface_constraints(target_row, j) = face_embedding(i, j); ++target_row; } } diff --git a/source/fe/fe_enriched.cc b/source/fe/fe_enriched.cc index 195101e5ee..8dd92350b1 100644 --- a/source/fe/fe_enriched.cc +++ b/source/fe/fe_enriched.cc @@ -1072,14 +1072,14 @@ namespace ColorEnriched dof_handler.get_triangulation().n_vertices(), false); // Mark vertices that belong to cells in subdomain 1 - for (auto cell : dof_handler.active_cell_iterators()) + for (const auto &cell : dof_handler.active_cell_iterators()) if (predicate_1(cell)) // True ==> part of subdomain 1 for (unsigned int v = 0; v < GeometryInfo::vertices_per_cell; ++v) vertices_subdomain_1[cell->vertex_index(v)] = true; // Find if cells in subdomain 2 and subdomain 1 share vertices. - for (auto cell : dof_handler.active_cell_iterators()) + for (const auto &cell : dof_handler.active_cell_iterators()) if (predicate_2(cell)) // True ==> part of subdomain 2 for (unsigned int v = 0; v < GeometryInfo::vertices_per_cell; ++v) @@ -1173,7 +1173,7 @@ namespace ColorEnriched * of predicates active in the given cell. */ unsigned int map_index = 0; - for (auto cell : dof_handler.active_cell_iterators()) + for (const auto &cell : dof_handler.active_cell_iterators()) { // set default FE index ==> no enrichment and no active predicates cell->set_active_fe_index(0); @@ -1289,7 +1289,7 @@ namespace ColorEnriched */ // loop through faces - for (auto cell : dof_handler.active_cell_iterators()) + for (const auto &cell : dof_handler.active_cell_iterators()) { const unsigned int fe_index = cell->active_fe_index(); const std::set fe_set = fe_sets.at(fe_index); @@ -1413,8 +1413,7 @@ namespace ColorEnriched // loop through color sets and create FE_enriched element for each // of them provided before calling this function, we have color // enrichment function associated with each color. - for (unsigned int color_set_id = 0; color_set_id < fe_sets.size(); - ++color_set_id) + for (const auto &fe_set : fe_sets) { std::vector *> vec_fe_enriched( n_colors, &fe_nothing); @@ -1422,12 +1421,12 @@ namespace ColorEnriched const typename Triangulation::cell_iterator &)>>> functions(n_colors, {dummy_function}); - for (const auto it : fe_sets[color_set_id]) + for (const unsigned int color_id : fe_set) { - // Given a color id ( = it), corresponding color enrichment + // Given a color id, corresponding color enrichment // function is at index id-1 because color_enrichments are // indexed from zero and colors are indexed from 1. - const unsigned int ind = it - 1; + const unsigned int ind = color_id - 1; AssertIndexRange(ind, vec_fe_enriched.size()); AssertIndexRange(ind, functions.size()); diff --git a/source/fe/fe_q_base.cc b/source/fe/fe_q_base.cc index 79bdddd3e0..3742ebdd6a 100644 --- a/source/fe/fe_q_base.cc +++ b/source/fe/fe_q_base.cc @@ -329,9 +329,9 @@ struct FE_Q_Base::Implementation for (unsigned int child = 0; child < GeometryInfo::max_children_per_cell; ++child) - for (unsigned int i = 0; i < inner_points.size(); ++i) + for (const auto &inner_point : inner_points) constraint_points.push_back( - GeometryInfo::child_to_cell_coordinates(inner_points[i], + GeometryInfo::child_to_cell_coordinates(inner_point, child)); } diff --git a/source/fe/fe_system.cc b/source/fe/fe_system.cc index 2774779780..7477fa495c 100644 --- a/source/fe/fe_system.cc +++ b/source/fe/fe_system.cc @@ -2162,10 +2162,9 @@ FESystem::hp_object_dof_identities( Assert(false, ExcNotImplemented()); } - for (unsigned int i = 0; i < base_identities.size(); ++i) - identities.emplace_back(base_identities[i].first + dof_offset, - base_identities[i].second + - dof_offset_other); + for (const auto &base_identity : base_identities) + identities.emplace_back(base_identity.first + dof_offset, + base_identity.second + dof_offset_other); // record the dofs treated above as already taken care of dof_offset += base.template n_dofs_per_object(); @@ -2407,10 +2406,9 @@ FESystem::get_constant_modes() const k) = base_table.first(c, ind.second); } for (unsigned int r = 0; r < element_multiplicity; ++r) - for (unsigned int c = 0; c < base_table.second.size(); ++c) + for (const unsigned int c : base_table.second) components.push_back( - comp + r * this->base_elements[i].first->n_components() + - base_table.second[c]); + comp + r * this->base_elements[i].first->n_components() + c); } AssertDimension(components.size(), constant_modes.n_rows()); return std::pair, std::vector>(constant_modes, diff --git a/source/fe/mapping_c1.cc b/source/fe/mapping_c1.cc index c8d8e0083d..ffaa8871a4 100644 --- a/source/fe/mapping_c1.cc +++ b/source/fe/mapping_c1.cc @@ -143,12 +143,12 @@ MappingC1<2>::MappingC1Generic::add_line_support_points( Point<2>(t2, s_t2)}; // then transform these points to real coordinates by rotating, // scaling and shifting - for (unsigned int i = 0; i < 2; ++i) + for (const auto &new_unit_point : new_unit_points) { - Point<2> real_point(std::cos(alpha) * new_unit_points[i][0] - - std::sin(alpha) * new_unit_points[i][1], - std::sin(alpha) * new_unit_points[i][0] + - std::cos(alpha) * new_unit_points[i][1]); + Point<2> real_point(std::cos(alpha) * new_unit_point[0] - + std::sin(alpha) * new_unit_point[1], + std::sin(alpha) * new_unit_point[0] + + std::cos(alpha) * new_unit_point[1]); real_point *= h; real_point += line->vertex(0); a.push_back(real_point);