From: Wolfgang Bangerth Date: Wed, 2 Feb 2022 22:52:54 +0000 (-0700) Subject: Use prefix ++ over postfix. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c3f735d68f19f1076852555873d307ec7cb5eee;p=code-gallery.git Use prefix ++ over postfix. --- diff --git a/CeresFE/src/ceres.cc b/CeresFE/src/ceres.cc index 9a9045d..88f020a 100644 --- a/CeresFE/src/ceres.cc +++ b/CeresFE/src/ceres.cc @@ -484,7 +484,7 @@ namespace Step22 { vector etas; - for (unsigned int i=0; i < system_parameters::sizeof_depths_eta; i++) + for (unsigned int i=0; i < system_parameters::sizeof_depths_eta; ++i) { etas.push_back(system_parameters::depths_eta[i]); etas.push_back(system_parameters::eta_kinks[i]); @@ -551,7 +551,7 @@ namespace Step22 //find the correct interval to do the interpolation in int n_minus_one = -1; - for (unsigned int n = 1; n <= n_visc_kinks; n++) + for (unsigned int n = 1; n <= n_visc_kinks; ++n) { unsigned int ndeep = 2 * n - 2; unsigned int nshallow = 2 * n; @@ -693,7 +693,7 @@ namespace Step22 grav_parameters.push_back(system_parameters::rho[1]); std::cout << "Body parameters are: " ; - for (int i=0; i<6; i++) + for (int i=0; i<6; ++i) std::cout << grav_parameters[i] << " "; std::cout << endl; @@ -1201,7 +1201,7 @@ namespace Step22 cell_area += fe_values.JxW(q); velocities[q] *= fe_values.JxW(q); current_cell_velocity += velocities[q]; - for (unsigned int i = 0; i < (dim+1); i++) + for (unsigned int i = 0; i < (dim+1); ++i) { velocity_grads[q][i] *= fe_values.JxW(q); current_cell_grads[i] += velocity_grads[q][i]; @@ -1210,7 +1210,7 @@ namespace Step22 current_cell_old_phiphi_stress += local_quadrature_points_history[q].old_phiphi_stress * fe_values.JxW(q); } current_cell_velocity /= cell_area; - for (unsigned int i = 0; i < (dim+1); i++) + for (unsigned int i = 0; i < (dim+1); ++i) current_cell_grads[i] /= cell_area; current_cell_old_stress /= cell_area; current_cell_old_phiphi_stress /= cell_area; @@ -1232,7 +1232,7 @@ namespace Step22 if (plastic_iteration == 0) cell_viscosities.resize(0); //loop across all the cells to find and adjust eta of failing cells - for (unsigned int i = 0; i < triangulation.n_active_cells(); i++) + for (unsigned int i = 0; i < triangulation.n_active_cells(); ++i) { double current_cell_viscosity = 0; @@ -1395,7 +1395,7 @@ namespace Step22 if (total_fails <= 100 || decrease_in_plasticity <= 0.2) { system_parameters::continue_plastic_iterations = false; - for (unsigned int j=0; j < triangulation.n_active_cells(); j++) + for (unsigned int j=0; j < triangulation.n_active_cells(); ++j) { // Writes to file the undisturbed cell viscosities std::ofstream fout_vrnew(plastic_eta_output.str().c_str(), std::ios::app); @@ -1434,7 +1434,7 @@ namespace Step22 local_quadrature_points_history[q].new_eta = system_parameters::eta_floor; quad_viscosities[cell_no][q].reinit(dim+1); - for (unsigned int ii=0; ii::faces_per_cell; ++f) { @@ -1539,11 +1539,11 @@ namespace Step22 for (unsigned int q = 0; q < quadrature_formula.size(); ++q) { std::vector nearby_etas_q; - for (unsigned int i = 0; i test_q; - for (unsigned int d=0; dat_boundary()) { int zero_faces = 0; - for (unsigned int f=0; f::faces_per_cell; f++) - for (unsigned int i=0; i::faces_per_cell; ++f) + for (unsigned int i=0; iface(f)->center()[i]) < zero_tolerance) zero_faces++; if (zero_faces==0) @@ -1758,7 +1758,7 @@ namespace Step22 std::vector ellipse_axes(0); // compute fit to boundary 0, 1, 2 ... std::cout << endl; - for (unsigned int i = 0; iface(f)->center()[i]) > zero_tolerance) how_many++; if (how_many==dim) @@ -1925,7 +1925,7 @@ namespace Step22 std::vector ellipse_axes(0); // compute fit to boundary 0, 1, 2 ... std::cout << endl; - for (unsigned int i = 0; i Grad_Nx_u = scratch.fe_values_ref[u_fe].gradient(k, q); - for (unsigned int dd = 0; dd < dim; dd++) + for (unsigned int dd = 0; dd < dim; ++dd) { - for (unsigned int ee = 0; ee < dim; ee++) + for (unsigned int ee = 0; ee < dim; ++ee) { scratch.solution_grads_u_total[q][dd][ee] += scratch.local_dof_values[k] * Grad_Nx_u[dd][ee]; @@ -2573,7 +2573,7 @@ namespace NonLinearPoroViscoElasticity scratch.solution_values_p_fluid_total[q] += scratch.local_dof_values[k] * Nx_p; - for (unsigned int dd = 0; dd < dim; dd++) + for (unsigned int dd = 0; dd < dim; ++dd) { scratch.solution_grads_p_fluid_total[q][dd] += scratch.local_dof_values[k] * Grad_Nx_p[dd]; diff --git a/goal_oriented_elastoplasticity/elastoplastic.cc b/goal_oriented_elastoplasticity/elastoplastic.cc index b687c7f..cc3c5eb 100644 --- a/goal_oriented_elastoplasticity/elastoplastic.cc +++ b/goal_oriented_elastoplasticity/elastoplastic.cc @@ -4828,7 +4828,7 @@ namespace ElastoPlastic } else { - for (unsigned int i = 0; i < 5; i++) + for (unsigned int i = 0; i < 5; ++i) { distributed_solution = incremental_displacement; @@ -5469,8 +5469,8 @@ namespace ElastoPlastic local_history_strain_values_at_qpoints (dim, std::vector< Vector >(dim)), local_history_strain_fe_values (dim, std::vector< Vector >(dim)); - for (unsigned int i=0; i > > distributed_history_stress_field (dim, std::vector< Vector >(dim)); - for (unsigned int i=0; i > > distributed_history_strain_field (dim, std::vector< Vector >(dim)); - for (unsigned int i=0; iget_dof_values (history_stress_field[i][j], local_history_stress_fe_values[i][j]); @@ -6070,8 +6070,8 @@ namespace ElastoPlastic history_stress_field (dim, std::vector< Vector >(dim)), local_history_stress_values_at_qpoints (dim, std::vector< Vector >(dim)), local_history_stress_fe_values (dim, std::vector< Vector >(dim)); - for (unsigned int i=0; i > > history_stress_on_vertices (dim, std::vector< Vector >(dim)); - for (unsigned int i=0; iget_dof_values (VM_stress_field, local_VM_stress_fe_values); - for (unsigned int i=0; iget_dof_values (history_stress_field[i][j], local_history_stress_fe_values[i][j]); @@ -6197,8 +6197,8 @@ namespace ElastoPlastic VM_stress_on_vertices (dof_1_vertex) += local_VM_stress_fe_values (v); - for (unsigned int i=0; i >(dim)), local_history_stress_values_at_qpoints (dim, std::vector< Vector >(dim)), local_history_stress_fe_values (dim, std::vector< Vector >(dim)); - for (unsigned int i=0; i > > history_stress_on_vertices (dim, std::vector< Vector >(dim)); - for (unsigned int i=0; iis_locally_owned()) { - for (unsigned int i=0; iget_dof_values (history_stress_field[i][j], local_history_stress_fe_values[i][j]); @@ -6582,8 +6582,8 @@ namespace ElastoPlastic counter_on_vertices (dof_1_vertex) += 1; - for (unsigned int i=0; i::invert_ML() { // loop on locally owned i-DOFs (rows) IndexSet::ElementIterator idofs_iter = locally_owned_dofs_LS.begin(); - for (; idofs_iter!=locally_owned_dofs_LS.end(); idofs_iter++) + for (; idofs_iter!=locally_owned_dofs_LS.end(); ++idofs_iter) { int gi = *idofs_iter; inverse_ML_vector(gi) = 1./ML_vector(gi); @@ -747,7 +747,7 @@ void LevelSetSolver::assemble_C_Matrix () } for (unsigned int i=0; i::assemble_K_DL_DH_times_vector // loop on locally owned i-DOFs (rows) IndexSet::ElementIterator idofs_iter = locally_owned_dofs_LS.begin(); - for (; idofs_iter!=locally_owned_dofs_LS.end(); idofs_iter++) + for (; idofs_iter!=locally_owned_dofs_LS.end(); ++idofs_iter) { PetscInt gi = *idofs_iter; //double ith_K_times_solution = 0; @@ -915,7 +915,7 @@ void LevelSetSolver::assemble_K_DL_DH_times_vector std::vector dLi(ncolumns), dCi(ncolumns); double dLii = 0, dCii = 0; // loop on sparsity pattern of i-th DOF - for (int j =0; j < ncolumns; j++) + for (int j =0; j < ncolumns; ++j) { C[0] = Cxi[j]; C[1] = Cyi[j]; @@ -1073,7 +1073,7 @@ void LevelSetSolver::assemble_EntRes_Matrix () } for (unsigned int i=0; i::compute_bounds(PETScWrappers::MPI::Vector &un_solution umax_vector = 0; // loop on locally owned i-DOFs (rows) IndexSet::ElementIterator idofs_iter = locally_owned_dofs_LS.begin(); - for (; idofs_iter!=locally_owned_dofs_LS.end(); idofs_iter++) + for (; idofs_iter!=locally_owned_dofs_LS.end(); ++idofs_iter) { int gi = *idofs_iter; @@ -1123,7 +1123,7 @@ void LevelSetSolver::compute_bounds(PETScWrappers::MPI::Vector &un_solution get_vector_values(un_solution,gj_indices,soln); // compute bounds, ith row of flux matrix, P vectors double mini=1E10, maxi=-1E10; - for (unsigned int j =0; j < gj_indices.size(); j++) + for (unsigned int j =0; j < gj_indices.size(); ++j) { // bounds mini = std::min(mini,soln[j]); @@ -1152,7 +1152,7 @@ void LevelSetSolver::check_max_principle(PETScWrappers::MPI::Vector &unp1_s if (cell_LS->is_locally_owned() && !cell_LS->at_boundary()) { cell_LS->get_dof_indices(local_dof_indices); - for (unsigned int i=0; i::compute_MPP_uH const PetscScalar *MCi, *dLi, *dCi; double solni, mi, solLi, solHi; - for (; idofs_iter!=locally_owned_dofs_LS.end(); idofs_iter++) + for (; idofs_iter!=locally_owned_dofs_LS.end(); ++idofs_iter) { int gi = *idofs_iter; // read vectors at i-th DOF @@ -1238,7 +1238,7 @@ void LevelSetSolver::compute_MPP_uH // compute bounds, ith row of flux matrix, P vectors double mini=1E10, maxi=-1E10; double Pposi=0 ,Pnegi=0; - for (int j =0; j < ncolumns; j++) + for (int j =0; j < ncolumns; ++j) { // bounds mini = std::min(mini,soln[j]); @@ -1281,7 +1281,7 @@ void LevelSetSolver::compute_MPP_uH const double *Ai; double Rposi, Rnegi; idofs_iter=locally_owned_dofs_LS.begin(); - for (; idofs_iter!=locally_owned_dofs_LS.end(); idofs_iter++) + for (; idofs_iter!=locally_owned_dofs_LS.end(); ++idofs_iter) { int gi = *idofs_iter; Rposi = R_pos_vector(gi); @@ -1300,7 +1300,7 @@ void LevelSetSolver::compute_MPP_uH // Array for i-th row of A_times_L matrix std::vector LxAi(ncolumns); // loop in sparsity pattern of i-th DOF - for (int j =0; j < ncolumns; j++) + for (int j =0; j < ncolumns; ++j) LxAi[j] = Ai[j] * ((Ai[j]>0) ? std::min(Rposi,Rneg[j]) : std::min(Rnegi,Rpos[j])); // save i-th row of LxA @@ -1334,14 +1334,14 @@ void LevelSetSolver::compute_MPP_uH_with_iterated_FCT const PetscInt *gj; const PetscScalar *Akp1i; double mi; - for (int iter=0; iter::compute_MPP_uH_with_iterated_FCT // compute bounds, ith row of flux matrix, P vectors double mini=1E10, maxi=-1E10; double Pposi=0 ,Pnegi=0; - for (int j =0; j < ncolumns; j++) + for (int j =0; j < ncolumns; ++j) { // bounds mini = std::min(mini,soln[j]); @@ -1390,7 +1390,7 @@ void LevelSetSolver::compute_MPP_uH_with_iterated_FCT // compute limiters. NOTE: this is a different loop due to need of i- and j-th entries of R vectors double Rposi, Rnegi; idofs_iter=locally_owned_dofs_LS.begin(); - for (; idofs_iter!=locally_owned_dofs_LS.end(); idofs_iter++) + for (; idofs_iter!=locally_owned_dofs_LS.end(); ++idofs_iter) { int gi = *idofs_iter; Rposi = R_pos_vector(gi); @@ -1408,7 +1408,7 @@ void LevelSetSolver::compute_MPP_uH_with_iterated_FCT // Array for i-th row of LxAkp1 matrix std::vector LxAkp1i(ncolumns); - for (int j =0; j < ncolumns; j++) + for (int j =0; j < ncolumns; ++j) LxAkp1i[j] = Akp1i[j] * ((Akp1i[j]>0) ? std::min(Rposi,Rneg[j]) : std::min(Rnegi,Rpos[j])); // save i-th row of LxA @@ -1496,7 +1496,7 @@ void LevelSetSolver::get_sparsity_pattern() const PetscInt *gj; const PetscScalar *MCi; - for (; idofs_iter!=locally_owned_dofs_LS.end(); idofs_iter++) + for (; idofs_iter!=locally_owned_dofs_LS.end(); ++idofs_iter) { PetscInt gi = *idofs_iter; // get i-th row of mass matrix (dummy, I just need the indices gj) @@ -1595,7 +1595,7 @@ void LevelSetSolver::get_vector_values (PETScWrappers::VectorBase &vector, PetscScalar *soln; VecGetArray(solution_in_local_form, &soln); - for (i = 0; i < n_idx; i++) + for (i = 0; i < n_idx; ++i) { int index = indices[i]; if (index >= begin && index < end) @@ -1641,7 +1641,7 @@ void LevelSetSolver::get_vector_values (PETScWrappers::VectorBase &vector, PetscScalar *soln; VecGetArray(solution_in_local_form, &soln); - for (i = 0; i < n_idx; i++) + for (i = 0; i < n_idx; ++i) { int index = map_from_Q1_to_Q2[indices[i]]; if (index >= begin && index < end)