From: Wolfgang Bangerth Date: Sun, 15 Aug 2021 23:12:40 +0000 (-0600) Subject: Change post- to pre-increment statements in foor loops (examples/). X-Git-Tag: v9.4.0-rc1~1074^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bdf5f79b43570198861968e9a926ee770c55481b;p=dealii.git Change post- to pre-increment statements in foor loops (examples/). --- diff --git a/examples/step-18/doc/results.dox b/examples/step-18/doc/results.dox index 4d0f61e8cb..7bc78a1a1a 100644 --- a/examples/step-18/doc/results.dox +++ b/examples/step-18/doc/results.dox @@ -527,8 +527,8 @@ general approach to this would go like this: local_history_values_at_qpoints (dim, std::vector< Vector >(dim)), local_history_fe_values (dim, std::vector< Vector >(dim)); - for (unsigned int i=0; iget_dof_values (history_field[i][j], local_history_fe_values[i][j]); diff --git a/examples/step-29/step-29.cc b/examples/step-29/step-29.cc index 544faddc6b..03a3f0479f 100644 --- a/examples/step-29/step-29.cc +++ b/examples/step-29/step-29.cc @@ -339,7 +339,7 @@ namespace Step29 // should return the square of the absolute value -- // thereby not satisfying the properties mathematicians require of // something called a "norm".) - for (unsigned int i = 0; i < computed_quantities.size(); i++) + for (unsigned int i = 0; i < computed_quantities.size(); ++i) { Assert(computed_quantities[i].size() == 1, ExcDimensionMismatch(computed_quantities[i].size(), 1)); diff --git a/examples/step-33/step-33.cc b/examples/step-33/step-33.cc index aa64b0721a..7031b3af1f 100644 --- a/examples/step-33/step-33.cc +++ b/examples/step-33/step-33.cc @@ -359,7 +359,7 @@ namespace Step33 const Vector &boundary_values, const DataVector & Wminus) { - for (unsigned int c = 0; c < n_components; c++) + for (unsigned int c = 0; c < n_components; ++c) switch (boundary_kind[c]) { case inflow_boundary: @@ -409,7 +409,7 @@ namespace Step33 // orthogonal to the surface normal. This creates sensitivities // of across the velocity components. typename DataVector::value_type vdotn = 0; - for (unsigned int d = 0; d < dim; d++) + for (unsigned int d = 0; d < dim; ++d) { vdotn += Wplus[d] * normal_vector[d]; } @@ -1257,7 +1257,7 @@ namespace Step33 { std::vector expressions(EulerEquations::n_components, "0.0"); - for (unsigned int di = 0; di < EulerEquations::n_components; di++) + for (unsigned int di = 0; di < EulerEquations::n_components; ++di) expressions[di] = prm.get("w_" + Utilities::int_to_string(di) + " value"); initial_conditions.initialize( @@ -1756,7 +1756,7 @@ namespace Step33 W_old[q][c] += old_solution(dof_indices[i]) * fe_v.shape_value_component(i, q, c); - for (unsigned int d = 0; d < dim; d++) + for (unsigned int d = 0; d < dim; ++d) { grad_W[q][c][d] += independent_local_dof_values[i] * fe_v.shape_grad_component(i, q, c)[d]; @@ -1855,14 +1855,14 @@ namespace Step33 fe_v.shape_value_component(i, point, component_i) * fe_v.JxW(point); - for (unsigned int d = 0; d < dim; d++) + for (unsigned int d = 0; d < dim; ++d) R_i -= (parameters.theta * flux[point][component_i][d] + (1.0 - parameters.theta) * flux_old[point][component_i][d]) * fe_v.shape_grad_component(i, point, component_i)[d] * fe_v.JxW(point); - for (unsigned int d = 0; d < dim; d++) + for (unsigned int d = 0; d < dim; ++d) R_i += 1.0 * std::pow(fe_v.get_cell()->diameter(), @@ -1923,14 +1923,14 @@ namespace Step33 const unsigned int n_independent_variables = (external_face == false ? 2 * dofs_per_cell : dofs_per_cell); - for (unsigned int i = 0; i < dofs_per_cell; i++) + for (unsigned int i = 0; i < dofs_per_cell; ++i) { independent_local_dof_values[i] = current_solution(dof_indices[i]); independent_local_dof_values[i].diff(i, n_independent_variables); } if (external_face == false) - for (unsigned int i = 0; i < dofs_per_cell; i++) + for (unsigned int i = 0; i < dofs_per_cell; ++i) { independent_neighbor_dof_values[i] = current_solution(dof_indices_neighbor[i]); @@ -2012,7 +2012,7 @@ namespace Step33 parameters.boundary_conditions[boundary_id].values.vector_value_list( fe_v.get_quadrature_points(), boundary_values); - for (unsigned int q = 0; q < n_q_points; q++) + for (unsigned int q = 0; q < n_q_points; ++q) { EulerEquations::compute_Wminus( parameters.boundary_conditions[boundary_id].kind, diff --git a/examples/step-41/step-41.cc b/examples/step-41/step-41.cc index b8ee77ee61..b52f55e544 100644 --- a/examples/step-41/step-41.cc +++ b/examples/step-41/step-41.cc @@ -246,7 +246,7 @@ namespace Step41 mass_matrix.reinit(dsp); assemble_mass_matrix_diagonal(mass_matrix); diagonal_of_mass_matrix.reinit(solution_index_set); - for (unsigned int j = 0; j < solution.size(); j++) + for (unsigned int j = 0; j < solution.size(); ++j) diagonal_of_mass_matrix(j) = mass_matrix.diag_element(j); } diff --git a/examples/step-57/step-57.cc b/examples/step-57/step-57.cc index b1982db5aa..d932aa48b3 100644 --- a/examples/step-57/step-57.cc +++ b/examples/step-57/step-57.cc @@ -786,7 +786,7 @@ namespace Step57 VectorTools::point_value(dof_handler, present_solution, p, tmp_vector); f << p(dim - 1); - for (int j = 0; j < dim; j++) + for (int j = 0; j < dim; ++j) f << " " << tmp_vector(j); f << std::endl; } diff --git a/examples/step-62/step-62.cc b/examples/step-62/step-62.cc index ed8b8c6453..6fbf85d8f6 100644 --- a/examples/step-62/step-62.cc +++ b/examples/step-62/step-62.cc @@ -564,7 +564,7 @@ namespace step62 // height="200" /> // where the brown color represents material_a and the green color // represents material_b. - for (unsigned int idx = 0; idx < nb_mirror_pairs; idx++) + for (unsigned int idx = 0; idx < nb_mirror_pairs; ++idx) { const double layer_transition_center = material_a_wavelength / 2 + @@ -586,7 +586,7 @@ namespace step62 // [subpixel // smoothing](https://meep.readthedocs.io/en/latest/Subpixel_Smoothing/) // which improves the precision of the simulation. - for (unsigned int idx = 0; idx < nb_mirror_pairs; idx++) + for (unsigned int idx = 0; idx < nb_mirror_pairs; ++idx) { const double layer_transition_center = material_a_wavelength / 2 + @@ -612,7 +612,7 @@ namespace step62 } // the material_a layers - for (unsigned int idx = 0; idx < nb_mirror_pairs; idx++) + for (unsigned int idx = 0; idx < nb_mirror_pairs; ++idx) { const double layer_center = material_a_wavelength / 2 + @@ -627,7 +627,7 @@ namespace step62 } // the material_b layers - for (unsigned int idx = 0; idx < nb_mirror_pairs; idx++) + for (unsigned int idx = 0; idx < nb_mirror_pairs; ++idx) { const double layer_center = material_a_wavelength / 2 + diff --git a/examples/step-75/step-75.cc b/examples/step-75/step-75.cc index 951d173b01..56648232e0 100644 --- a/examples/step-75/step-75.cc +++ b/examples/step-75/step-75.cc @@ -573,7 +573,7 @@ namespace Step75 MGLevelObject smoother_data( min_level, max_level); - for (unsigned int level = min_level; level <= max_level; level++) + for (unsigned int level = min_level; level <= max_level; ++level) { smoother_data[level].preconditioner = std::make_shared(); diff --git a/examples/step-78/step-78.cc b/examples/step-78/step-78.cc index 1b3fc652a2..1fb89ede07 100644 --- a/examples/step-78/step-78.cc +++ b/examples/step-78/step-78.cc @@ -707,7 +707,7 @@ namespace BlackScholesSolver Vector vmult_result; Vector forcing_terms; - for (unsigned int cycle = 0; cycle < n_cycles; cycle++) + for (unsigned int cycle = 0; cycle < n_cycles; ++cycle) { if (cycle != 0) {