From 228871e317d812b57398d27c681ab73f20893165 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sun, 15 Aug 2021 17:12:34 -0600 Subject: [PATCH] Change post- to pre-increment statements in foor loops (include/ and source/). --- include/deal.II/base/geometry_info.h | 4 +- .../base/mpi_compute_index_owner_internal.h | 2 +- .../base/mpi_consensus_algorithms.templates.h | 10 ++-- .../mpi_noncontiguous_partitioner.templates.h | 6 +-- include/deal.II/base/partitioner.templates.h | 8 +-- include/deal.II/base/polynomials_pyramid.h | 2 +- include/deal.II/base/polynomials_wedge.h | 2 +- include/deal.II/base/quadrature_point_data.h | 16 +++--- .../deal.II/base/symmetric_tensor.templates.h | 52 +++++++++---------- include/deal.II/base/vectorization.h | 2 +- include/deal.II/fe/fe_series.h | 12 ++--- include/deal.II/fe/fe_tools.templates.h | 4 +- include/deal.II/grid/connectivity.h | 12 ++--- .../lac/affine_constraints.templates.h | 14 ++--- include/deal.II/lac/eigen.h | 4 +- .../lac/la_parallel_block_vector.templates.h | 24 ++++----- .../lac/la_parallel_vector.templates.h | 8 +-- include/deal.II/lac/slepc_solver.h | 2 +- include/deal.II/lac/solver_gmres.h | 2 +- include/deal.II/lac/solver_relaxation.h | 2 +- .../matrix_free/cuda_matrix_free.templates.h | 2 +- .../deal.II/matrix_free/evaluation_kernels.h | 22 ++++---- include/deal.II/matrix_free/matrix_free.h | 30 +++++------ .../matrix_free/matrix_free.templates.h | 10 ++-- include/deal.II/matrix_free/tools.h | 2 +- .../mg_transfer_global_coarsening.templates.h | 4 +- .../numerics/data_out_dof_data.templates.h | 24 ++++----- .../numerics/error_estimator.templates.h | 2 +- .../numerics/fe_field_function.templates.h | 2 +- .../vector_tools_point_value.templates.h | 8 +-- source/base/data_out_base.cc | 28 +++++----- source/base/function_cspline.cc | 2 +- source/base/function_spherical.cc | 8 +-- source/base/mpi.cc | 8 +-- source/base/mpi_noncontiguous_partitioner.cc | 4 +- source/base/partitioner.cc | 2 +- source/base/partitioner.cu | 2 +- source/base/polynomial.cc | 12 ++--- .../polynomials_integrated_legendre_sz.cc | 2 +- source/base/polynomials_pyramid.cc | 4 +- source/base/polynomials_wedge.cc | 4 +- source/base/utilities.cc | 6 +-- source/differentiation/ad/ad_drivers.cc | 24 ++++----- source/differentiation/ad/ad_helpers.cc | 20 +++---- source/distributed/p4est_wrappers.cc | 28 +++++----- source/dofs/dof_handler.cc | 4 +- source/dofs/dof_handler_policy.cc | 10 ++-- source/dofs/dof_tools.cc | 2 +- source/dofs/dof_tools_constraints.cc | 2 +- source/dofs/dof_tools_sparsity.cc | 4 +- source/fe/fe_dgq.cc | 10 ++-- source/fe/fe_enriched.cc | 28 +++++----- source/fe/fe_q.cc | 6 +-- source/fe/fe_q_bubbles.cc | 6 +-- source/fe/fe_q_dg0.cc | 6 +-- source/fe/fe_q_hierarchical.cc | 18 +++---- source/fe/fe_series.cc | 2 +- source/fe/fe_series_fourier.cc | 4 +- source/fe/fe_series_legendre.cc | 8 +-- source/fe/fe_system.cc | 6 +-- source/grid/grid_generator.cc | 48 ++++++++--------- source/grid/grid_in.cc | 16 +++--- source/grid/grid_out.cc | 4 +- source/grid/grid_tools.cc | 10 ++-- source/grid/grid_tools_dof_handlers.cc | 2 +- source/grid/manifold_lib.cc | 2 +- source/grid/tria.cc | 2 +- source/grid/tria_accessor.cc | 2 +- source/lac/slepc_solver.cc | 2 +- source/lac/sparsity_pattern.cc | 4 +- source/lac/sparsity_tools.cc | 6 +-- source/matrix_free/dof_info.cc | 2 +- source/matrix_free/task_info.cc | 30 +++++------ source/matrix_free/vector_data_exchange.cc | 28 +++++----- source/multigrid/mg_transfer_internal.cc | 2 +- source/multigrid/mg_transfer_matrix_free.cc | 2 +- source/non_matching/quadrature_generator.cc | 8 +-- source/numerics/point_value_history.cc | 26 +++++----- source/numerics/smoothness_estimator.cc | 2 +- 79 files changed, 381 insertions(+), 381 deletions(-) diff --git a/include/deal.II/base/geometry_info.h b/include/deal.II/base/geometry_info.h index 361b60b6e5..7d249ae37a 100644 --- a/include/deal.II/base/geometry_info.h +++ b/include/deal.II/base/geometry_info.h @@ -4716,7 +4716,7 @@ inline Point GeometryInfo::project_to_unit_cell(const Point &q) { Point p; - for (unsigned int i = 0; i < dim; i++) + for (unsigned int i = 0; i < dim; ++i) p[i] = std::min(std::max(q[i], Number(0.)), Number(1.)); return p; @@ -4730,7 +4730,7 @@ GeometryInfo::distance_to_unit_cell(const Point &p) { double result = 0.0; - for (unsigned int i = 0; i < dim; i++) + for (unsigned int i = 0; i < dim; ++i) { result = std::max(result, -p[i]); result = std::max(result, p[i] - 1.); diff --git a/include/deal.II/base/mpi_compute_index_owner_internal.h b/include/deal.II/base/mpi_compute_index_owner_internal.h index 93008991c0..45682a7489 100644 --- a/include/deal.II/base/mpi_compute_index_owner_internal.h +++ b/include/deal.II/base/mpi_compute_index_owner_internal.h @@ -783,7 +783,7 @@ namespace Utilities Assert(recv_indices[other_rank].size() == recv_buffer.size(), ExcMessage("Sizes do not match!")); - for (unsigned int j = 0; j < recv_indices[other_rank].size(); j++) + for (unsigned int j = 0; j < recv_indices[other_rank].size(); ++j) owning_ranks[recv_indices[other_rank][j]] = recv_buffer[j]; } diff --git a/include/deal.II/base/mpi_consensus_algorithms.templates.h b/include/deal.II/base/mpi_consensus_algorithms.templates.h index 2fd8e28279..0885619176 100644 --- a/include/deal.II/base/mpi_consensus_algorithms.templates.h +++ b/include/deal.II/base/mpi_consensus_algorithms.templates.h @@ -285,7 +285,7 @@ namespace Utilities { // 4) send and receive - for (unsigned int i = 0; i < n_targets; i++) + for (unsigned int i = 0; i < n_targets; ++i) { const unsigned int rank = targets[i]; const unsigned int index = i; @@ -365,7 +365,7 @@ namespace Utilities // unpack data { - for (unsigned int i = 0; i < targets.size(); i++) + for (unsigned int i = 0; i < targets.size(); ++i) this->process.read_answer(targets[i], recv_buffers[i]); } #endif @@ -392,7 +392,7 @@ namespace Utilities const unsigned int n_requests = start_communication(); // 2) answer requests - for (unsigned int request = 0; request < n_requests; request++) + for (unsigned int request = 0; request < n_requests; ++request) answer_requests(request); // 3) process answers @@ -494,7 +494,7 @@ namespace Utilities requests_buffers.resize(n_sources); // 4) send and receive - for (unsigned int i = 0; i < n_targets; i++) + for (unsigned int i = 0; i < n_targets; ++i) { const unsigned int rank = targets[i]; @@ -556,7 +556,7 @@ namespace Utilities } // unpack received data - for (unsigned int i = 0; i < targets.size(); i++) + for (unsigned int i = 0; i < targets.size(); ++i) this->process.read_answer(targets[i], recv_buffers[i]); #endif } diff --git a/include/deal.II/base/mpi_noncontiguous_partitioner.templates.h b/include/deal.II/base/mpi_noncontiguous_partitioner.templates.h index 38a15b4151..a12f00b0fa 100644 --- a/include/deal.II/base/mpi_noncontiguous_partitioner.templates.h +++ b/include/deal.II/base/mpi_noncontiguous_partitioner.templates.h @@ -104,7 +104,7 @@ namespace Utilities // post recv AssertIndexRange(recv_ranks.size(), recv_ptr.size()); - for (types::global_dof_index i = 0; i < recv_ranks.size(); i++) + for (types::global_dof_index i = 0; i < recv_ranks.size(); ++i) { const int ierr = MPI_Irecv(buffers.data() + recv_ptr[i], @@ -119,7 +119,7 @@ namespace Utilities // post send AssertIndexRange(send_ranks.size(), send_ptr.size()); - for (types::global_dof_index i = 0, k = 0; i < send_ranks.size(); i++) + for (types::global_dof_index i = 0, k = 0; i < send_ranks.size(); ++i) { // collect data to be send for (types::global_dof_index j = send_ptr[i]; j < send_ptr[i + 1]; @@ -164,7 +164,7 @@ namespace Utilities Assert(false, ExcNeedsMPI()); #else // receive all data packages and copy data from buffers - for (types::global_dof_index proc = 0; proc < recv_ranks.size(); proc++) + for (types::global_dof_index proc = 0; proc < recv_ranks.size(); ++proc) { int i; MPI_Status status; diff --git a/include/deal.II/base/partitioner.templates.h b/include/deal.II/base/partitioner.templates.h index c91db2b6d1..221b3e5542 100644 --- a/include/deal.II/base/partitioner.templates.h +++ b/include/deal.II/base/partitioner.templates.h @@ -88,7 +88,7 @@ namespace Utilities n_ghost_indices() : ghost_array.data(); - for (unsigned int i = 0; i < n_ghost_targets; i++) + for (unsigned int i = 0; i < n_ghost_targets; ++i) { // allow writing into ghost indices even though we are in a // const function @@ -117,7 +117,7 @@ namespace Utilities initialize_import_indices_plain_dev(); # endif - for (unsigned int i = 0; i < n_import_targets; i++) + for (unsigned int i = 0; i < n_import_targets; ++i) { # if defined(DEAL_II_COMPILER_CUDA_AWARE) && \ defined(DEAL_II_MPI_WITH_CUDA_SUPPORT) @@ -315,7 +315,7 @@ namespace Utilities // initiate the receive operations Number *temp_array_ptr = temporary_storage.data(); - for (unsigned int i = 0; i < n_import_targets; i++) + for (unsigned int i = 0; i < n_import_targets; ++i) { AssertThrow( static_cast(import_targets_data[i].second) * @@ -342,7 +342,7 @@ namespace Utilities // move the data to send to the front of the array AssertIndexRange(n_ghost_indices(), n_ghost_indices_in_larger_set + 1); Number *ghost_array_ptr = ghost_array.data(); - for (unsigned int i = 0; i < n_ghost_targets; i++) + for (unsigned int i = 0; i < n_ghost_targets; ++i) { // in case we only sent a subset of indices, we now need to move the // data to the correct positions and delete the old content diff --git a/include/deal.II/base/polynomials_pyramid.h b/include/deal.II/base/polynomials_pyramid.h index 8a1bb972c7..0c0ee41a5c 100644 --- a/include/deal.II/base/polynomials_pyramid.h +++ b/include/deal.II/base/polynomials_pyramid.h @@ -131,7 +131,7 @@ ScalarLagrangePolynomialPyramid::compute_derivative( Assert(order == 1, ExcNotImplemented()); const auto grad = compute_grad(i, p); - for (unsigned int i = 0; i < dim; i++) + for (unsigned int i = 0; i < dim; ++i) der[i] = grad[i]; return der; diff --git a/include/deal.II/base/polynomials_wedge.h b/include/deal.II/base/polynomials_wedge.h index 5f9afefcb2..2cd3a27962 100644 --- a/include/deal.II/base/polynomials_wedge.h +++ b/include/deal.II/base/polynomials_wedge.h @@ -154,7 +154,7 @@ ScalarLagrangePolynomialWedge::compute_derivative( AssertDimension(order, 1); const auto grad = compute_grad(i, p); - for (unsigned int i = 0; i < dim; i++) + for (unsigned int i = 0; i < dim; ++i) der[i] = grad[i]; return der; diff --git a/include/deal.II/base/quadrature_point_data.h b/include/deal.II/base/quadrature_point_data.h index 19f572566f..41b36bd554 100644 --- a/include/deal.II/base/quadrature_point_data.h +++ b/include/deal.II/base/quadrature_point_data.h @@ -620,7 +620,7 @@ CellDataStorage::initialize( // will end with a single same T object stored in each element of the // vector: const auto it = map.find(key); - for (unsigned int q = 0; q < n_q_points; q++) + for (unsigned int q = 0; q < n_q_points; ++q) it->second[q] = std::make_shared(); } } @@ -635,7 +635,7 @@ CellDataStorage::initialize( const CellIteratorType &cell_end, const unsigned int number) { - for (CellIteratorType it = cell_start; it != cell_end; it++) + for (CellIteratorType it = cell_start; it != cell_end; ++it) if (it->is_locally_owned()) initialize(it, number); } @@ -651,7 +651,7 @@ CellDataStorage::erase(const CellIteratorType &cell) if (it == map.end()) return false; Assert(&cell->get_triangulation() == tria, ExcTriangulationMismatch()); - for (unsigned int i = 0; i < it->second.size(); i++) + for (unsigned int i = 0; i < it->second.size(); ++i) { Assert( it->second[i].unique(), @@ -675,7 +675,7 @@ CellDataStorage::clear() while (it != map.end()) { // loop over all objects and see if no one is using them - for (unsigned int i = 0; i < it->second.size(); i++) + for (unsigned int i = 0; i < it->second.size(); ++i) { Assert( it->second[i].unique(), @@ -707,7 +707,7 @@ CellDataStorage::get_data( // fully) specialized. Thus, stick with copying of shared pointers even when // the T==DataType: std::vector> res(it->second.size()); - for (unsigned int q = 0; q < res.size(); q++) + for (unsigned int q = 0; q < res.size(); ++q) { res[q] = std::dynamic_pointer_cast(it->second[q]); Assert(res[q], ExcCellDataTypeMismatch()); @@ -734,7 +734,7 @@ CellDataStorage::get_data( // T==DataType as we need to return shared_ptr to make sure the user // does not modify the content of QP objects std::vector> res(it->second.size()); - for (unsigned int q = 0; q < res.size(); q++) + for (unsigned int q = 0; q < res.size(); ++q) { res[q] = std::dynamic_pointer_cast(it->second[q]); Assert(res[q], ExcCellDataTypeMismatch()); @@ -760,7 +760,7 @@ CellDataStorage::try_get_data( // shared_ptr to make sure the user // does not modify the content of QP objects std::vector> result(it->second.size()); - for (unsigned int q = 0; q < result.size(); q++) + for (unsigned int q = 0; q < result.size(); ++q) { result[q] = std::dynamic_pointer_cast(it->second[q]); Assert(result[q], ExcCellDataTypeMismatch()); @@ -791,7 +791,7 @@ CellDataStorage::try_get_data( // shared_ptr to make sure the user // does not modify the content of QP objects std::vector> result(it->second.size()); - for (unsigned int q = 0; q < result.size(); q++) + for (unsigned int q = 0; q < result.size(); ++q) { result[q] = std::dynamic_pointer_cast(it->second[q]); Assert(result[q], ExcCellDataTypeMismatch()); diff --git a/include/deal.II/base/symmetric_tensor.templates.h b/include/deal.II/base/symmetric_tensor.templates.h index 51175264eb..bc2d57376c 100644 --- a/include/deal.II/base/symmetric_tensor.templates.h +++ b/include/deal.II/base/symmetric_tensor.templates.h @@ -168,7 +168,7 @@ namespace internal // Make the first row and column to be of the // desired form h = 0.0; - for (int i = 1; i < dim; i++) + for (int i = 1; i < dim; ++i) h += A[0][i] * A[0][i]; g = 0.0; @@ -179,7 +179,7 @@ namespace internal e[0] = g; std::array u; - for (int i = 1; i < dim; i++) + for (int i = 1; i < dim; ++i) { u[i] = A[0][i]; if (i == 1) @@ -192,44 +192,44 @@ namespace internal { omega_inv = 1.0 / omega; K = 0.0; - for (int i = 1; i < dim; i++) + for (int i = 1; i < dim; ++i) { f = 0.0; - for (int j = 1; j < dim; j++) + for (int j = 1; j < dim; ++j) f += A[i][j] * u[j]; q[i] = omega_inv * f; K += u[i] * f; } K *= 0.5 * omega_inv * omega_inv; - for (int i = 1; i < dim; i++) + for (int i = 1; i < dim; ++i) q[i] = q[i] - K * u[i]; d[0] = A[0][0]; - for (int i = 1; i < dim; i++) + for (int i = 1; i < dim; ++i) d[i] = A[i][i] - 2.0 * q[i] * u[i]; // Store inverse Householder transformation // in Q - for (int j = 1; j < dim; j++) + for (int j = 1; j < dim; ++j) { f = omega_inv * u[j]; - for (int i = 1; i < dim; i++) + for (int i = 1; i < dim; ++i) Q[i][j] = Q[i][j] - f * u[i]; } // For dim = 3: Calculate updated A[1][2] and // store it in e[1] - for (int i = 1; i < dim - 1; i++) + for (int i = 1; i < dim - 1; ++i) e[i] = A[i][i + 1] - q[i] * u[i + 1] - u[i] * q[i + 1]; } else { - for (int i = 0; i < dim; i++) + for (int i = 0; i < dim; ++i) d[i] = A[i][i]; // For dim = 3: - for (int i = 1; i < dim - 1; i++) + for (int i = 1; i < dim - 1; ++i) e[i] = A[i][i + 1]; } } @@ -269,14 +269,14 @@ namespace internal Number g, r, p, f, b, s, c, t; // Loop over all off-diagonal elements - for (int l = 0; l < dim - 1; l++) + for (int l = 0; l < dim - 1; ++l) { for (unsigned int it = 0; it <= max_n_it; ++it) { // Check for convergence and exit iteration loop // if the off-diagonal element e[l] is zero int m = l; - for (; m <= dim - 2; m++) + for (; m <= dim - 2; ++m) { g = std::abs(w[m]) + std::abs(w[m + 1]); if (std::abs(e[m]) + g == g) @@ -339,7 +339,7 @@ namespace internal g = c * r - b; // Form the eigenvectors - for (int k = 0; k < dim; k++) + for (int k = 0; k < dim; ++k) { t = Q[k][i + 1]; Q[k][i + 1] = s * Q[k][i] + c * t; @@ -399,7 +399,7 @@ namespace internal // The diagonal elements of the tridiagonal matrix; // this will ultimately store the eigenvalues std::array w; - for (int i = 0; i < dim; i++) + for (int i = 0; i < dim; ++i) w[i] = A[i][i]; // Calculate (tr(A))^{2} @@ -408,12 +408,12 @@ namespace internal // Number of iterations const unsigned int max_n_it = 50; - for (unsigned int it = 0; it <= max_n_it; it++) + for (unsigned int it = 0; it <= max_n_it; ++it) { // Test for convergence so = 0.0; - for (int p = 0; p < dim; p++) - for (int q = p + 1; q < dim; q++) + for (int p = 0; p < dim; ++p) + for (int q = p + 1; q < dim; ++q) so += std::abs(A[p][q]); if (so == 0.0) break; @@ -438,8 +438,8 @@ namespace internal thresh = 0.0; // Perform sweep - for (int p = 0; p < dim; p++) - for (int q = p + 1; q < dim; q++) + for (int p = 0; p < dim; ++p) + for (int q = p + 1; q < dim; ++q) { g = 100.0 * std::abs(A[p][q]); @@ -486,19 +486,19 @@ namespace internal w[p] -= z; w[q] += z; // ... by executing the various rotations in sequence - for (int r = 0; r < p; r++) + for (int r = 0; r < p; ++r) { t = A[r][p]; A[r][p] = c * t - s * A[r][q]; A[r][q] = s * t + c * A[r][q]; } - for (int r = p + 1; r < q; r++) + for (int r = p + 1; r < q; ++r) { t = A[p][r]; A[p][r] = c * t - s * A[r][q]; A[r][q] = s * t + c * A[r][q]; } - for (int r = q + 1; r < dim; r++) + for (int r = q + 1; r < dim; ++r) { t = A[p][r]; A[p][r] = c * t - s * A[q][r]; @@ -506,7 +506,7 @@ namespace internal } // Update the eigenvectors - for (int r = 0; r < dim; r++) + for (int r = 0; r < dim; ++r) { t = Q[r][p]; Q[r][p] = c * t - s * Q[r][q]; @@ -674,7 +674,7 @@ namespace internal else // This is the standard branch { norm = std::sqrt(1.0 / norm); - for (unsigned j = 0; j < dim; j++) + for (unsigned j = 0; j < dim; ++j) Q[j][0] = Q[j][0] * norm; } @@ -691,7 +691,7 @@ namespace internal else { norm = std::sqrt(1.0 / norm); - for (unsigned int j = 0; j < dim; j++) + for (unsigned int j = 0; j < dim; ++j) Q[j][1] = Q[j][1] * norm; } diff --git a/include/deal.II/base/vectorization.h b/include/deal.II/base/vectorization.h index 868c239c1b..35ffce4446 100644 --- a/include/deal.II/base/vectorization.h +++ b/include/deal.II/base/vectorization.h @@ -753,7 +753,7 @@ gather(VectorizedArray & out, const std::array &ptrs, const unsigned int offset) { - for (unsigned int v = 0; v < width; v++) + for (unsigned int v = 0; v < width; ++v) out.data[v] = ptrs[v][offset]; } diff --git a/include/deal.II/fe/fe_series.h b/include/deal.II/fe/fe_series.h index 9b899a325e..814a86cf48 100644 --- a/include/deal.II/fe/fe_series.h +++ b/include/deal.II/fe/fe_series.h @@ -455,7 +455,7 @@ namespace internal std::pair(const TableIndices<1> &)> &predicate, std::map> & pred_to_values) { - for (unsigned int i = 0; i < coefficients.size(0); i++) + for (unsigned int i = 0; i < coefficients.size(0); ++i) { const TableIndices<1> ind(i); fill_map_index(coefficients, ind, predicate, pred_to_values); @@ -472,8 +472,8 @@ namespace internal std::pair(const TableIndices<2> &)> &predicate, std::map> & pred_to_values) { - for (unsigned int i = 0; i < coefficients.size(0); i++) - for (unsigned int j = 0; j < coefficients.size(1); j++) + for (unsigned int i = 0; i < coefficients.size(0); ++i) + for (unsigned int j = 0; j < coefficients.size(1); ++j) { const TableIndices<2> ind(i, j); fill_map_index(coefficients, ind, predicate, pred_to_values); @@ -490,9 +490,9 @@ namespace internal std::pair(const TableIndices<3> &)> &predicate, std::map> & pred_to_values) { - for (unsigned int i = 0; i < coefficients.size(0); i++) - for (unsigned int j = 0; j < coefficients.size(1); j++) - for (unsigned int k = 0; k < coefficients.size(2); k++) + for (unsigned int i = 0; i < coefficients.size(0); ++i) + for (unsigned int j = 0; j < coefficients.size(1); ++j) + for (unsigned int k = 0; k < coefficients.size(2); ++k) { const TableIndices<3> ind(i, j, k); fill_map_index(coefficients, ind, predicate, pred_to_values); diff --git a/include/deal.II/fe/fe_tools.templates.h b/include/deal.II/fe/fe_tools.templates.h index 1d09fd36cd..03fccbee81 100644 --- a/include/deal.II/fe/fe_tools.templates.h +++ b/include/deal.II/fe/fe_tools.templates.h @@ -96,14 +96,14 @@ namespace FETools unsigned int n_components = 0; // Get the number of components from the first given finite element. - for (unsigned int i = 0; i < fes.size(); i++) + for (unsigned int i = 0; i < fes.size(); ++i) if (multiplicities[i] > 0) { n_components = fes[i]->n_components(); break; } - for (unsigned int i = 0; i < fes.size(); i++) + for (unsigned int i = 0; i < fes.size(); ++i) if (multiplicities[i] > 0) { // TODO: the implementation makes the assumption that all faces have diff --git a/include/deal.II/grid/connectivity.h b/include/deal.II/grid/connectivity.h index 93e5e9a6a9..716749fdc2 100644 --- a/include/deal.II/grid/connectivity.h +++ b/include/deal.II/grid/connectivity.h @@ -962,10 +962,10 @@ namespace internal std::vector> neighbors(n_faces, {-1, -1}); // loop over all cells - for (unsigned int i_0 = 0; i_0 < ptr_cf.size() - 1; i_0++) + for (unsigned int i_0 = 0; i_0 < ptr_cf.size() - 1; ++i_0) { // ... and all its faces - for (std::size_t j_0 = ptr_cf[i_0]; j_0 < ptr_cf[i_0 + 1]; j_0++) + for (std::size_t j_0 = ptr_cf[i_0]; j_0 < ptr_cf[i_0 + 1]; ++j_0) { if (neighbors[col_cf[j_0]].first == static_cast(-1)) { @@ -1053,7 +1053,7 @@ namespace internal static const unsigned int offset = 1; // loop over all cells - for (unsigned int c = 0, counter = 0; c < cell_types_index.size(); c++) + for (unsigned int c = 0, counter = 0; c < cell_types_index.size(); ++c) { const auto &cell_type = cell_types[static_cast( @@ -1065,7 +1065,7 @@ namespace internal cell_vertices.data() + cell_ptr[c], cell_ptr[c + 1] - cell_ptr[c]); // ... loop over all its entities - for (unsigned int e = 0; e < cell_type->n_entities(d); e++) + for (unsigned int e = 0; e < cell_type->n_entities(d); ++e) { // ... determine global entity vertices const auto &local_entity_vertices = @@ -1074,7 +1074,7 @@ namespace internal std::array entity_vertices; std::fill(entity_vertices.begin(), entity_vertices.end(), 0); - for (unsigned int i = 0; i < local_entity_vertices.size(); i++) + for (unsigned int i = 0; i < local_entity_vertices.size(); ++i) entity_vertices[i] = cell_vertice[local_entity_vertices[i]] + offset; @@ -1195,7 +1195,7 @@ namespace internal { const auto &cell_type = cell_types[static_cast(c)]; - for (unsigned int e = 0; e < cell_type->n_entities(d); e++) + for (unsigned int e = 0; e < cell_type->n_entities(d); ++e) key_length = std::max(key_length, cell_type->vertices_of_entity(d, e).size()); } diff --git a/include/deal.II/lac/affine_constraints.templates.h b/include/deal.II/lac/affine_constraints.templates.h index 83ce3beb9c..b268155e90 100644 --- a/include/deal.II/lac/affine_constraints.templates.h +++ b/include/deal.II/lac/affine_constraints.templates.h @@ -3043,7 +3043,7 @@ namespace internal step = length / 2; while (step > 0) { - for (i = step; i < length; i++) + for (i = step; i < length; ++i) { istep = step; j = i; @@ -3628,7 +3628,7 @@ namespace internal average_diagonal = static_cast(1.); } - for (size_type i = 0; i < global_rows.n_constraints(); i++) + for (size_type i = 0; i < global_rows.n_constraints(); ++i) { const size_type local_row = global_rows.constraint_origin(i); const size_type global_row = local_dof_indices[local_row]; @@ -3683,7 +3683,7 @@ namespace internal // that have been left out above if (global_rows.n_constraints() > 0) { - for (size_type i = 0; i < global_rows.n_constraints(); i++) + for (size_type i = 0; i < global_rows.n_constraints(); ++i) { const size_type local_row = global_rows.constraint_origin(i); const size_type global_row = local_dof_indices[local_row]; @@ -4299,11 +4299,11 @@ AffineConstraints::add_entries_local_to_global( // need to add the whole row and column structure in case we keep // constrained entries. Unfortunately, we can't use the nice matrix // structure we use elsewhere, so manually add those indices one by one. - for (size_type i = 0; i < n_local_dofs; i++) + for (size_type i = 0; i < n_local_dofs; ++i) if (is_constrained(local_dof_indices[i])) { if (keep_constrained_entries == true) - for (size_type j = 0; j < n_local_dofs; j++) + for (size_type j = 0; j < n_local_dofs; ++j) { sparsity_pattern.add(local_dof_indices[i], local_dof_indices[j]); @@ -4476,11 +4476,11 @@ AffineConstraints::add_entries_local_to_global( } } - for (size_type i = 0; i < n_local_dofs; i++) + for (size_type i = 0; i < n_local_dofs; ++i) if (is_constrained(local_dof_indices[i])) { if (keep_constrained_entries == true) - for (size_type j = 0; j < n_local_dofs; j++) + for (size_type j = 0; j < n_local_dofs; ++j) { sparsity_pattern.add(local_dof_indices[i], local_dof_indices[j]); diff --git a/include/deal.II/lac/eigen.h b/include/deal.II/lac/eigen.h index 91ee6b5fa1..1c79845f65 100644 --- a/include/deal.II/lac/eigen.h +++ b/include/deal.II/lac/eigen.h @@ -224,7 +224,7 @@ EigenPower::solve(double &value, const MatrixType &A, VectorType &x) // Main loop int iter = 0; - for (; conv == SolverControl::iterate; iter++) + for (; conv == SolverControl::iterate; ++iter) { y.add(additional_data.shift, x); @@ -323,7 +323,7 @@ EigenInverse::solve(double & value, // Main loop double res = std::numeric_limits::lowest(); size_type iter = 0; - for (; conv == SolverControl::iterate; iter++) + for (; conv == SolverControl::iterate; ++iter) { solver.solve(A_s, y, x, prec); diff --git a/include/deal.II/lac/la_parallel_block_vector.templates.h b/include/deal.II/lac/la_parallel_block_vector.templates.h index f6b94b649f..805e2c07e2 100644 --- a/include/deal.II/lac/la_parallel_block_vector.templates.h +++ b/include/deal.II/lac/la_parallel_block_vector.templates.h @@ -936,12 +936,12 @@ namespace LinearAlgebra { Assert(m == n, ExcDimensionMismatch(m, n)); - for (unsigned int i = 0; i < m; i++) - for (unsigned int j = i; j < n; j++) + for (unsigned int i = 0; i < m; ++i) + for (unsigned int j = i; j < n; ++j) matrix(i, j) = this->block(i).inner_product_local(V.block(j)); - for (unsigned int i = 0; i < m; i++) - for (unsigned int j = i + 1; j < n; j++) + for (unsigned int i = 0; i < m; ++i) + for (unsigned int j = i + 1; j < n; ++j) matrix(j, i) = matrix(i, j); } else @@ -985,19 +985,19 @@ namespace LinearAlgebra { Assert(m == n, ExcDimensionMismatch(m, n)); - for (unsigned int i = 0; i < m; i++) + for (unsigned int i = 0; i < m; ++i) { res += matrix(i, i) * this->block(i).inner_product_local(V.block(i)); - for (unsigned int j = i + 1; j < n; j++) + for (unsigned int j = i + 1; j < n; ++j) res += 2. * matrix(i, j) * this->block(i).inner_product_local(V.block(j)); } } else { - for (unsigned int i = 0; i < m; i++) - for (unsigned int j = 0; j < n; j++) + for (unsigned int i = 0; i < m; ++i) + for (unsigned int j = 0; j < n; ++j) res += matrix(i, j) * this->block(i).inner_product_local(V.block(j)); } @@ -1028,21 +1028,21 @@ namespace LinearAlgebra Assert(matrix.m() == m, ExcDimensionMismatch(matrix.m(), m)); Assert(matrix.n() == n, ExcDimensionMismatch(matrix.n(), n)); - for (unsigned int i = 0; i < n; i++) + for (unsigned int i = 0; i < n; ++i) { // below we make this work gracefully for identity-like matrices in // which case the two loops over j won't do any work as A(j,i)==0 const unsigned int k = std::min(i, m - 1); V.block(i).sadd_local(s, matrix(k, i) * b, this->block(k)); - for (unsigned int j = 0; j < k; j++) + for (unsigned int j = 0; j < k; ++j) V.block(i).add_local(matrix(j, i) * b, this->block(j)); - for (unsigned int j = k + 1; j < m; j++) + for (unsigned int j = k + 1; j < m; ++j) V.block(i).add_local(matrix(j, i) * b, this->block(j)); } if (V.block(0).vector_is_ghosted) { - for (unsigned int i = 0; i < n; i++) + for (unsigned int i = 0; i < n; ++i) Assert(V.block(i).vector_is_ghosted, ExcMessage( "All blocks should be either in ghosted state or not.")); diff --git a/include/deal.II/lac/la_parallel_vector.templates.h b/include/deal.II/lac/la_parallel_vector.templates.h index 6c27adf248..3854487284 100644 --- a/include/deal.II/lac/la_parallel_vector.templates.h +++ b/include/deal.II/lac/la_parallel_vector.templates.h @@ -181,7 +181,7 @@ namespace LinearAlgebra s, sizeof(Number), info, comm_shared, &data_this, &mpi_window); AssertThrowMPI(ierr); - for (unsigned int i = 0; i < size_sm; i++) + for (unsigned int i = 0; i < size_sm; ++i) { int disp_unit; MPI_Aint ssize; @@ -211,7 +211,7 @@ namespace LinearAlgebra comm_shared); AssertThrowMPI(ierr); - for (unsigned int i = 0; i < size_sm; i++) + for (unsigned int i = 0; i < size_sm; ++i) others[i] += n_align_sm[i]; std::vector new_alloc_sizes(size_sm); @@ -226,7 +226,7 @@ namespace LinearAlgebra AssertThrowMPI(ierr); data.values_sm.resize(size_sm); - for (unsigned int i = 0; i < size_sm; i++) + for (unsigned int i = 0; i < size_sm; ++i) data.values_sm[i] = ArrayView(others[i], new_alloc_sizes[i]); @@ -2127,7 +2127,7 @@ namespace LinearAlgebra // turn #ifdef DEAL_II_WITH_MPI if (partitioner->n_mpi_processes() > 1) - for (unsigned int i = 0; i < partitioner->this_mpi_process(); i++) + for (unsigned int i = 0; i < partitioner->this_mpi_process(); ++i) { const int ierr = MPI_Barrier(partitioner->get_mpi_communicator()); AssertThrowMPI(ierr); diff --git a/include/deal.II/lac/slepc_solver.h b/include/deal.II/lac/slepc_solver.h index 6cf8ec40f4..68c4cd4df2 100644 --- a/include/deal.II/lac/slepc_solver.h +++ b/include/deal.II/lac/slepc_solver.h @@ -831,7 +831,7 @@ namespace SLEPcWrappers { std::vector vecs(this_initial_space.size()); - for (unsigned int i = 0; i < this_initial_space.size(); i++) + for (unsigned int i = 0; i < this_initial_space.size(); ++i) { Assert(this_initial_space[i].l2_norm() > 0.0, ExcMessage("Initial vectors should be nonzero.")); diff --git a/include/deal.II/lac/solver_gmres.h b/include/deal.II/lac/solver_gmres.h index 91b4fa1d37..434e273cd4 100644 --- a/include/deal.II/lac/solver_gmres.h +++ b/include/deal.II/lac/solver_gmres.h @@ -632,7 +632,7 @@ SolverGMRES::givens_rotation(Vector &h, Vector &si, int col) const { - for (int i = 0; i < col; i++) + for (int i = 0; i < col; ++i) { const double s = si(i); const double c = ci(i); diff --git a/include/deal.II/lac/solver_relaxation.h b/include/deal.II/lac/solver_relaxation.h index f50c7b1938..66b5a34f55 100644 --- a/include/deal.II/lac/solver_relaxation.h +++ b/include/deal.II/lac/solver_relaxation.h @@ -116,7 +116,7 @@ SolverRelaxation::solve(const MatrixType & A, int iter = 0; // Main loop - for (; conv == SolverControl::iterate; iter++) + for (; conv == SolverControl::iterate; ++iter) { // Compute residual A.vmult(r, x); diff --git a/include/deal.II/matrix_free/cuda_matrix_free.templates.h b/include/deal.II/matrix_free/cuda_matrix_free.templates.h index bffcdab551..0d2fc60ad2 100644 --- a/include/deal.II/matrix_free/cuda_matrix_free.templates.h +++ b/include/deal.II/matrix_free/cuda_matrix_free.templates.h @@ -1045,7 +1045,7 @@ namespace CUDAWrappers else inner_cells.emplace_back(cell); } - for (unsigned i = 0; i < inner_cells.size(); i++) + for (unsigned i = 0; i < inner_cells.size(); ++i) if (i < inner_cells.size() / 2) graph[0].emplace_back(inner_cells[i]); else diff --git a/include/deal.II/matrix_free/evaluation_kernels.h b/include/deal.II/matrix_free/evaluation_kernels.h index ab10f44ba8..d4dd77eafa 100644 --- a/include/deal.II/matrix_free/evaluation_kernels.h +++ b/include/deal.II/matrix_free/evaluation_kernels.h @@ -274,7 +274,7 @@ namespace internal switch (dim) { case 1: - for (unsigned int c = 0; c < n_components; c++) + for (unsigned int c = 0; c < n_components; ++c) { if (evaluation_flag & EvaluationFlags::values) eval.template values<0, true, false>(values_dofs, values_quad); @@ -294,7 +294,7 @@ namespace internal break; case 2: - for (unsigned int c = 0; c < n_components; c++) + for (unsigned int c = 0; c < n_components; ++c) { // grad x if (evaluation_flag & EvaluationFlags::gradients) @@ -342,7 +342,7 @@ namespace internal break; case 3: - for (unsigned int c = 0; c < n_components; c++) + for (unsigned int c = 0; c < n_components; ++c) { if (evaluation_flag & EvaluationFlags::gradients) { @@ -523,7 +523,7 @@ namespace internal switch (dim) { case 1: - for (unsigned int c = 0; c < n_components; c++) + for (unsigned int c = 0; c < n_components; ++c) { if (integration_flag & EvaluationFlags::values) { @@ -565,7 +565,7 @@ namespace internal break; case 2: - for (unsigned int c = 0; c < n_components; c++) + for (unsigned int c = 0; c < n_components; ++c) { if ((integration_flag & EvaluationFlags::values) && !(integration_flag & EvaluationFlags::gradients)) @@ -624,7 +624,7 @@ namespace internal break; case 3: - for (unsigned int c = 0; c < n_components; c++) + for (unsigned int c = 0; c < n_components; ++c) { if ((integration_flag & EvaluationFlags::values) && !(integration_flag & EvaluationFlags::gradients)) @@ -1393,7 +1393,7 @@ namespace internal shape_info.data.front().shape_hessians_collocation_eo); constexpr unsigned int n_q_points = Utilities::pow(fe_degree + 1, dim); - for (unsigned int c = 0; c < n_components; c++) + for (unsigned int c = 0; c < n_components; ++c) { if (evaluation_flag & EvaluationFlags::values) for (unsigned int i = 0; i < n_q_points; ++i) @@ -1473,7 +1473,7 @@ namespace internal constexpr unsigned int n_q_points = Utilities::pow(fe_degree + 1, dim); constexpr unsigned int hdim = (dim * (dim + 1)) / 2; - for (unsigned int c = 0; c < n_components; c++) + for (unsigned int c = 0; c < n_components; ++c) { if (integration_flag & EvaluationFlags::values) { @@ -1623,7 +1623,7 @@ namespace internal "operation.")); constexpr unsigned int n_q_points = Utilities::pow(n_q_points_1d, dim); - for (unsigned int c = 0; c < n_components; c++) + for (unsigned int c = 0; c < n_components; ++c) { FEEvaluationImplBasisChange< evaluate_evenodd, @@ -1687,7 +1687,7 @@ namespace internal constexpr unsigned int n_q_points = Utilities::pow(n_q_points_1d, dim); constexpr unsigned int hdim = (dim * (dim + 1)) / 2; - for (unsigned int c = 0; c < n_components; c++) + for (unsigned int c = 0; c < n_components; ++c) { // apply derivatives in collocation space if (integration_flag & @@ -2728,7 +2728,7 @@ namespace internal dofs_per_component_on_face : dofs_per_component_on_cell; - for (unsigned int c = 0; c < n_components; c++) + for (unsigned int c = 0; c < n_components; ++c) { if (do_hessians) evalf.template apply_face locally_owned_set; locally_owned_set.reserve(dofh.size()); - for (unsigned int j = 0; j < dofh.size(); j++) + for (unsigned int j = 0; j < dofh.size(); ++j) if (level == numbers::invalid_unsigned_int) locally_owned_set.push_back(dofh[j]->locally_owned_dofs()); else @@ -3964,7 +3964,7 @@ namespace internal n_components(const std::vector &vec) { unsigned int components = 0; - for (unsigned int comp = 0; comp < vec.size(); comp++) + for (unsigned int comp = 0; comp < vec.size(); ++comp) components += n_components_block( vec[comp], std::integral_constant::value>()); @@ -3976,7 +3976,7 @@ namespace internal n_components(const std::vector &vec) { unsigned int components = 0; - for (unsigned int comp = 0; comp < vec.size(); comp++) + for (unsigned int comp = 0; comp < vec.size(); ++comp) components += n_components_block( *vec[comp], std::integral_constant::value>()); @@ -4080,7 +4080,7 @@ namespace internal VectorDataExchange &exchanger) { unsigned int component_index = 0; - for (unsigned int comp = 0; comp < vec.size(); comp++) + for (unsigned int comp = 0; comp < vec.size(); ++comp) { update_ghost_values_start(vec[comp], exchanger, component_index); component_index += n_components(vec[comp]); @@ -4100,7 +4100,7 @@ namespace internal VectorDataExchange &exchanger) { unsigned int component_index = 0; - for (unsigned int comp = 0; comp < vec.size(); comp++) + for (unsigned int comp = 0; comp < vec.size(); ++comp) { update_ghost_values_start(*vec[comp], exchanger, component_index); component_index += n_components(*vec[comp]); @@ -4167,7 +4167,7 @@ namespace internal VectorDataExchange &exchanger) { unsigned int component_index = 0; - for (unsigned int comp = 0; comp < vec.size(); comp++) + for (unsigned int comp = 0; comp < vec.size(); ++comp) { update_ghost_values_finish(vec[comp], exchanger, component_index); component_index += n_components(vec[comp]); @@ -4187,7 +4187,7 @@ namespace internal VectorDataExchange &exchanger) { unsigned int component_index = 0; - for (unsigned int comp = 0; comp < vec.size(); comp++) + for (unsigned int comp = 0; comp < vec.size(); ++comp) { update_ghost_values_finish(*vec[comp], exchanger, component_index); component_index += n_components(*vec[comp]); @@ -4251,7 +4251,7 @@ namespace internal VectorDataExchange &exchanger) { unsigned int component_index = 0; - for (unsigned int comp = 0; comp < vec.size(); comp++) + for (unsigned int comp = 0; comp < vec.size(); ++comp) { compress_start(vec[comp], exchanger, component_index); component_index += n_components(vec[comp]); @@ -4271,7 +4271,7 @@ namespace internal VectorDataExchange &exchanger) { unsigned int component_index = 0; - for (unsigned int comp = 0; comp < vec.size(); comp++) + for (unsigned int comp = 0; comp < vec.size(); ++comp) { compress_start(*vec[comp], exchanger, component_index); component_index += n_components(*vec[comp]); @@ -4338,7 +4338,7 @@ namespace internal VectorDataExchange &exchanger) { unsigned int component_index = 0; - for (unsigned int comp = 0; comp < vec.size(); comp++) + for (unsigned int comp = 0; comp < vec.size(); ++comp) { compress_finish(vec[comp], exchanger, component_index); component_index += n_components(vec[comp]); @@ -4358,7 +4358,7 @@ namespace internal VectorDataExchange &exchanger) { unsigned int component_index = 0; - for (unsigned int comp = 0; comp < vec.size(); comp++) + for (unsigned int comp = 0; comp < vec.size(); ++comp) { compress_finish(*vec[comp], exchanger, component_index); component_index += n_components(*vec[comp]); @@ -4428,7 +4428,7 @@ namespace internal if (exchanger.ghosts_were_set == true) return; - for (unsigned int comp = 0; comp < vec.size(); comp++) + for (unsigned int comp = 0; comp < vec.size(); ++comp) reset_ghost_values(vec[comp], exchanger); } @@ -4448,7 +4448,7 @@ namespace internal if (exchanger.ghosts_were_set == true) return; - for (unsigned int comp = 0; comp < vec.size(); comp++) + for (unsigned int comp = 0; comp < vec.size(); ++comp) reset_ghost_values(*vec[comp], exchanger); } @@ -4506,7 +4506,7 @@ namespace internal std::vector & vec, VectorDataExchange &exchanger) { - for (unsigned int comp = 0; comp < vec.size(); comp++) + for (unsigned int comp = 0; comp < vec.size(); ++comp) zero_vector_region(range_index, vec[comp], exchanger); } @@ -4523,7 +4523,7 @@ namespace internal std::vector & vec, VectorDataExchange &exchanger) { - for (unsigned int comp = 0; comp < vec.size(); comp++) + for (unsigned int comp = 0; comp < vec.size(); ++comp) zero_vector_region(range_index, *vec[comp], exchanger); } diff --git a/include/deal.II/matrix_free/matrix_free.templates.h b/include/deal.II/matrix_free/matrix_free.templates.h index 9b0438583e..506607a556 100644 --- a/include/deal.II/matrix_free/matrix_free.templates.h +++ b/include/deal.II/matrix_free/matrix_free.templates.h @@ -383,13 +383,13 @@ MatrixFree::internal_reinit( n_quad_in_collection = std::max(n_quad_in_collection, quad[q].size()); shape_info.reinit(TableIndices<4>( n_components, n_quad, n_fe_in_collection, n_quad_in_collection)); - for (unsigned int no = 0, c = 0; no < dof_handler.size(); no++) + for (unsigned int no = 0, c = 0; no < dof_handler.size(); ++no) for (unsigned int b = 0; b < dof_handler[no]->get_fe(0).n_base_elements(); ++b, ++c) for (unsigned int fe_no = 0; fe_no < dof_handler[no]->get_fe_collection().size(); ++fe_no) - for (unsigned int nq = 0; nq < n_quad; nq++) + for (unsigned int nq = 0; nq < n_quad; ++nq) for (unsigned int q_no = 0; q_no < quad[nq].size(); ++q_no) shape_info(c, nq, fe_no, q_no) .reinit(quad[nq][q_no], dof_handler[no]->get_fe(fe_no), b); @@ -1487,7 +1487,7 @@ namespace internal .push_back(renumbering[counter]); } counter = 0; - for (unsigned int j = 0; j < dof_info[0].max_fe_index; j++) + for (unsigned int j = 0; j < dof_info[0].max_fe_index; ++j) { for (const auto jj : renumbering_fe_index[j]) renumbering[counter++] = jj; @@ -1510,7 +1510,7 @@ namespace internal .push_back(renumbering[counter]); } counter = start_nonboundary * n_lanes; - for (unsigned int j = 0; j < dof_info[0].max_fe_index; j++) + for (unsigned int j = 0; j < dof_info[0].max_fe_index; ++j) { for (const auto jj : renumbering_fe_index[j]) renumbering[counter++] = jj; @@ -1708,7 +1708,7 @@ MatrixFree::initialize_indices( { Quadrature quad(QGauss(1)); Quadrature quad_simplex(QGaussSimplex(1)); - for (unsigned int no = 0, c = 0; no < dof_handlers.size(); no++) + for (unsigned int no = 0, c = 0; no < dof_handlers.size(); ++no) for (unsigned int b = 0; b < dof_handlers[no]->get_fe(0).n_base_elements(); ++b, ++c) diff --git a/include/deal.II/matrix_free/tools.h b/include/deal.II/matrix_free/tools.h index 3af2d8d14a..cc2cf6aa88 100644 --- a/include/deal.II/matrix_free/tools.h +++ b/include/deal.II/matrix_free/tools.h @@ -192,7 +192,7 @@ namespace MatrixFreeTools const auto to_category = [&](const auto &cell) { unsigned int c_num = 0; - for (unsigned int i = 0; i < GeometryInfo::faces_per_cell; i++) + for (unsigned int i = 0; i < GeometryInfo::faces_per_cell; ++i) { auto &face = *cell->face(i); if (face.at_boundary() && !cell->has_periodic_neighbor(i)) diff --git a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h index 5bf9a45126..77da761097 100644 --- a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h +++ b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h @@ -1852,7 +1852,7 @@ namespace internal std::vector level_dof_indices_fine_( fe_index_pairs.size()); - for (unsigned int i = 0; i < fe_index_pairs.size(); i++) + for (unsigned int i = 0; i < fe_index_pairs.size(); ++i) { level_dof_indices_coarse_[i] = transfer.schemes[i].level_dof_indices_coarse.data(); @@ -2059,7 +2059,7 @@ namespace internal fe_index_pairs.size()); std::vector weights_(fe_index_pairs.size()); - for (unsigned int i = 0; i < fe_index_pairs.size(); i++) + for (unsigned int i = 0; i < fe_index_pairs.size(); ++i) { level_dof_indices_fine_[i] = &transfer.schemes[i].level_dof_indices_fine[0]; 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 17cfd07cb9..5ab61a0ad5 100644 --- a/include/deal.II/numerics/data_out_dof_data.templates.h +++ b/include/deal.II/numerics/data_out_dof_data.templates.h @@ -1144,13 +1144,13 @@ namespace internal fe_patch_values.n_quadrature_points; std::vector> tmp(n_eval_points); - for (unsigned int i = 0; i < n_eval_points; i++) + for (unsigned int i = 0; i < n_eval_points; ++i) tmp[i].reinit(n_components); fe_patch_values.get_function_values(vector, tmp); AssertDimension(patch_values_system.size(), n_eval_points); - for (unsigned int i = 0; i < n_eval_points; i++) + for (unsigned int i = 0; i < n_eval_points; ++i) { AssertDimension(patch_values_system[i].size(), n_components); @@ -1190,7 +1190,7 @@ namespace internal fe_patch_values.get_function_values(vector, tmp); - for (unsigned int i = 0; i < tmp.size(); i++) + for (unsigned int i = 0; i < tmp.size(); ++i) patch_values[i] = get_component(tmp[i], extract_component); } } @@ -1235,17 +1235,17 @@ namespace internal std::vector>> tmp( n_eval_points); - for (unsigned int i = 0; i < n_eval_points; i++) + for (unsigned int i = 0; i < n_eval_points; ++i) tmp[i].resize(n_components); fe_patch_values.get_function_gradients(vector, tmp); AssertDimension(patch_gradients_system.size(), n_eval_points); - for (unsigned int i = 0; i < n_eval_points; i++) + for (unsigned int i = 0; i < n_eval_points; ++i) { AssertDimension(patch_gradients_system[i].size(), n_components); - for (unsigned int j = 0; j < n_components; j++) + for (unsigned int j = 0; j < n_components; ++j) patch_gradients_system[i][j] = get_component(tmp[i][j], extract_component); } @@ -1283,7 +1283,7 @@ namespace internal fe_patch_values.get_function_gradients(vector, tmp); - for (unsigned int i = 0; i < tmp.size(); i++) + for (unsigned int i = 0; i < tmp.size(); ++i) patch_gradients[i] = get_component(tmp[i], extract_component); } } @@ -1328,17 +1328,17 @@ namespace internal std::vector>> tmp( n_eval_points); - for (unsigned int i = 0; i < n_eval_points; i++) + for (unsigned int i = 0; i < n_eval_points; ++i) tmp[i].resize(n_components); fe_patch_values.get_function_hessians(vector, tmp); AssertDimension(patch_hessians_system.size(), n_eval_points); - for (unsigned int i = 0; i < n_eval_points; i++) + for (unsigned int i = 0; i < n_eval_points; ++i) { AssertDimension(patch_hessians_system[i].size(), n_components); - for (unsigned int j = 0; j < n_components; j++) + for (unsigned int j = 0; j < n_components; ++j) patch_hessians_system[i][j] = get_component(tmp[i][j], extract_component); } @@ -1376,7 +1376,7 @@ namespace internal fe_patch_values.get_function_hessians(vector, tmp); - for (unsigned int i = 0; i < tmp.size(); i++) + for (unsigned int i = 0; i < tmp.size(); ++i) patch_hessians[i] = get_component(tmp[i], extract_component); } } @@ -1638,7 +1638,7 @@ namespace internal const unsigned int n_eval_points = fe_patch_values.n_quadrature_points; AssertDimension(patch_values_system.size(), n_eval_points); - for (unsigned int q = 0; q < n_eval_points; q++) + for (unsigned int q = 0; q < n_eval_points; ++q) { AssertDimension(patch_values_system[q].size(), n_components); patch_values_system[q] = 0.0; diff --git a/include/deal.II/numerics/error_estimator.templates.h b/include/deal.II/numerics/error_estimator.templates.h index d320669e4b..d72d4531ec 100644 --- a/include/deal.II/numerics/error_estimator.templates.h +++ b/include/deal.II/numerics/error_estimator.templates.h @@ -735,7 +735,7 @@ namespace internal local_face_integrals[face] = integrate_over_face(parallel_data, face, fe_face_values_cell); - for (unsigned int i = 0; i < local_face_integrals[face].size(); i++) + for (unsigned int i = 0; i < local_face_integrals[face].size(); ++i) local_face_integrals[face][i] *= factor; } diff --git a/include/deal.II/numerics/fe_field_function.templates.h b/include/deal.II/numerics/fe_field_function.templates.h index 1a0bacda7c..e7b6d78d55 100644 --- a/include/deal.II/numerics/fe_field_function.templates.h +++ b/include/deal.II/numerics/fe_field_function.templates.h @@ -403,7 +403,7 @@ namespace Functions { const unsigned int s = vgrads[q].size(); values[maps[i][q]].resize(s); - for (unsigned int l = 0; l < s; l++) + for (unsigned int l = 0; l < s; ++l) values[maps[i][q]][l] = vgrads[q][l]; } } diff --git a/include/deal.II/numerics/vector_tools_point_value.templates.h b/include/deal.II/numerics/vector_tools_point_value.templates.h index 5a1d9a4dd7..3d3a35c1ab 100644 --- a/include/deal.II/numerics/vector_tools_point_value.templates.h +++ b/include/deal.II/numerics/vector_tools_point_value.templates.h @@ -310,7 +310,7 @@ namespace VectorTools std::vector local_dof_indices(dofs_per_cell); cell_point.first->get_dof_indices(local_dof_indices); - for (unsigned int i = 0; i < dofs_per_cell; i++) + for (unsigned int i = 0; i < dofs_per_cell; ++i) rhs_vector(local_dof_indices[i]) = fe_values.shape_value(i, 0); } @@ -375,7 +375,7 @@ namespace VectorTools std::vector local_dof_indices(dofs_per_cell); cell_point.first->get_dof_indices(local_dof_indices); - for (unsigned int i = 0; i < dofs_per_cell; i++) + for (unsigned int i = 0; i < dofs_per_cell; ++i) rhs_vector(local_dof_indices[i]) = fe_values.shape_value(i, 0); } @@ -420,7 +420,7 @@ namespace VectorTools std::vector local_dof_indices(dofs_per_cell); cell_point.first->get_dof_indices(local_dof_indices); - for (unsigned int i = 0; i < dofs_per_cell; i++) + for (unsigned int i = 0; i < dofs_per_cell; ++i) rhs_vector(local_dof_indices[i]) = orientation * fe_values[vec].value(i, 0); } @@ -492,7 +492,7 @@ namespace VectorTools std::vector local_dof_indices(dofs_per_cell); cell_point.first->get_dof_indices(local_dof_indices); - for (unsigned int i = 0; i < dofs_per_cell; i++) + for (unsigned int i = 0; i < dofs_per_cell; ++i) rhs_vector(local_dof_indices[i]) = orientation * fe_values[vec].value(i, 0); } diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index cc39da2a2d..3121729503 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -3017,13 +3017,13 @@ namespace DataOutBase A[1][1] = temp; } - for (unsigned int k = 0; k < 1; k++) + for (unsigned int k = 0; k < 1; ++k) { - for (unsigned int i = k + 1; i < 2; i++) + for (unsigned int i = k + 1; i < 2; ++i) { x = A[i][k] / A[k][k]; - for (unsigned int j = k + 1; j < 2; j++) + for (unsigned int j = k + 1; j < 2; ++j) A[i][j] = A[i][j] - A[k][j] * x; b[i] = b[i] - b[k] * x; @@ -3036,7 +3036,7 @@ namespace DataOutBase { sum = b[i]; - for (unsigned int j = i + 1; j < 2; j++) + for (unsigned int j = i + 1; j < 2; ++j) sum = sum - A[i][j] * b[j]; b[i] = sum / A[i][i]; @@ -3075,13 +3075,13 @@ namespace DataOutBase A[1][1] = temp; } - for (unsigned int k = 0; k < 1; k++) + for (unsigned int k = 0; k < 1; ++k) { - for (unsigned int i = k + 1; i < 2; i++) + for (unsigned int i = k + 1; i < 2; ++i) { x = A[i][k] / A[k][k]; - for (unsigned int j = k + 1; j < 2; j++) + for (unsigned int j = k + 1; j < 2; ++j) A[i][j] = A[i][j] - A[k][j] * x; b[i] = b[i] - b[k] * x; @@ -3094,7 +3094,7 @@ namespace DataOutBase { sum = b[i]; - for (unsigned int j = i + 1; j < 2; j++) + for (unsigned int j = i + 1; j < 2; ++j) sum = sum - A[i][j] * b[j]; b[i] = sum / A[i][i]; @@ -3133,13 +3133,13 @@ namespace DataOutBase A[1][1] = temp; } - for (unsigned int k = 0; k < 1; k++) + for (unsigned int k = 0; k < 1; ++k) { - for (unsigned int i = k + 1; i < 2; i++) + for (unsigned int i = k + 1; i < 2; ++i) { x = A[i][k] / A[k][k]; - for (unsigned int j = k + 1; j < 2; j++) + for (unsigned int j = k + 1; j < 2; ++j) A[i][j] = A[i][j] - A[k][j] * x; b[i] = b[i] - b[k] * x; @@ -3152,7 +3152,7 @@ namespace DataOutBase { sum = b[i]; - for (unsigned int j = i + 1; j < 2; j++) + for (unsigned int j = i + 1; j < 2; ++j) sum = sum - A[i][j] * b[j]; b[i] = sum / A[i][i]; @@ -6983,7 +6983,7 @@ namespace DataOutBase additional_width = static_cast(.5 + (height / 100.) * 2.5); - for (unsigned int index = 0; index < 4; index++) + for (unsigned int index = 0; index < 4; ++index) { double start_h = .667 - ((index + 1) / 4.) * .667; double stop_h = .667 - (index / 4.) * .667; @@ -7100,7 +7100,7 @@ namespace DataOutBase << index << ")\"/>" << '\n'; } - for (unsigned int index = 0; index < 5; index++) + for (unsigned int index = 0; index < 5; ++index) { out << " & in2) { if (val != 0.) - for (unsigned int i = 0; i < dim; i++) - for (unsigned int j = i; j < dim; j++) + for (unsigned int i = 0; i < dim; ++i) + for (unsigned int j = i; j < dim; ++j) out[i][j] += (in1[i] * in2[j] + in1[j] * in2[i]) * val; } @@ -146,8 +146,8 @@ namespace Functions const Tensor<1, dim> & in) { if (val != 0.) - for (unsigned int i = 0; i < dim; i++) - for (unsigned int j = i; j < dim; j++) + for (unsigned int i = 0; i < dim; ++i) + for (unsigned int j = i; j < dim; ++j) out[i][j] += val * in[i] * in[j]; } } // namespace diff --git a/source/base/mpi.cc b/source/base/mpi.cc index 8e4fa7d917..861853eed9 100644 --- a/source/base/mpi.cc +++ b/source/base/mpi.cc @@ -456,7 +456,7 @@ namespace Utilities const MinMaxAvg *in_lhs = static_cast(in_lhs_); MinMaxAvg * inout_rhs = static_cast(inout_rhs_); - for (int i = 0; i < *len; i++) + for (int i = 0; i < *len; ++i) { inout_rhs[i].sum += in_lhs[i].sum; if (inout_rhs[i].min > in_lhs[i].min) @@ -498,7 +498,7 @@ namespace Utilities if (job_supports_mpi() == false || Utilities::MPI::n_mpi_processes(mpi_communicator) <= 1) { - for (unsigned int i = 0; i < my_values.size(); i++) + for (unsigned int i = 0; i < my_values.size(); ++i) { result[i].sum = my_values[i]; result[i].avg = my_values[i]; @@ -591,7 +591,7 @@ namespace Utilities std::vector in(my_values.size()); - for (unsigned int i = 0; i < my_values.size(); i++) + for (unsigned int i = 0; i < my_values.size(); ++i) { in[i].sum = in[i].min = in[i].max = my_values[i]; in[i].min_index = in[i].max_index = my_id; @@ -669,7 +669,7 @@ namespace Utilities { AssertDimension(my_values.size(), result.size()); - for (unsigned int i = 0; i < my_values.size(); i++) + for (unsigned int i = 0; i < my_values.size(); ++i) { result[i].sum = my_values[i]; result[i].avg = my_values[i]; diff --git a/source/base/mpi_noncontiguous_partitioner.cc b/source/base/mpi_noncontiguous_partitioner.cc index 0c74c114b4..8a40b54fba 100644 --- a/source/base/mpi_noncontiguous_partitioner.cc +++ b/source/base/mpi_noncontiguous_partitioner.cc @@ -220,7 +220,7 @@ namespace Utilities std::vector temp_map_send( index_set_has.n_elements()); - for (types::global_dof_index i = 0; i < indices_has.size(); i++) + for (types::global_dof_index i = 0; i < indices_has.size(); ++i) if (indices_has[i] != numbers::invalid_dof_index) temp_map_send[index_set_has.index_within_set(indices_has[i])] = i; @@ -232,7 +232,7 @@ namespace Utilities std::vector temp_map_recv( index_set_want.n_elements()); - for (types::global_dof_index i = 0; i < indices_want.size(); i++) + for (types::global_dof_index i = 0; i < indices_want.size(); ++i) if (indices_want[i] != numbers::invalid_dof_index) temp_map_recv[index_set_want.index_within_set(indices_want[i])] = i; diff --git a/source/base/partitioner.cc b/source/base/partitioner.cc index 617f177306..2e54b0cc6c 100644 --- a/source/base/partitioner.cc +++ b/source/base/partitioner.cc @@ -443,7 +443,7 @@ namespace Utilities for (unsigned int p = 0; p < ghost_targets_data.size(); ++p) { unsigned int last_index = numbers::invalid_unsigned_int - 1; - for (unsigned int ii = 0; ii < ghost_targets_data[p].second; ii++) + for (unsigned int ii = 0; ii < ghost_targets_data[p].second; ++ii) { const unsigned int i = shift + ii; if (expanded_numbering[i] == last_index + 1) diff --git a/source/base/partitioner.cu b/source/base/partitioner.cu index 5f3b82d81c..7063aa5162 100644 --- a/source/base/partitioner.cu +++ b/source/base/partitioner.cu @@ -29,7 +29,7 @@ namespace Utilities { const unsigned int n_import_targets = import_targets_data.size(); import_indices_plain_dev.reserve(n_import_targets); - for (unsigned int i = 0; i < n_import_targets; i++) + for (unsigned int i = 0; i < n_import_targets; ++i) { // Expand the indices on the host std::vector>::const_iterator diff --git a/source/base/polynomial.cc b/source/base/polynomial.cc index 9f9efbeb8d..0cb7326468 100644 --- a/source/base/polynomial.cc +++ b/source/base/polynomial.cc @@ -990,7 +990,7 @@ namespace Polynomials if ((k % 2) == 0) { double b = 1.; // 8.; - // for (unsigned int i=1; i<=k; i++) + // for (unsigned int i=1; i<=k; ++i) // b /= 2.*i; ck[1] += b * (*recursive_coefficients[2])[1]; @@ -1296,7 +1296,7 @@ namespace Polynomials const double auxiliary_zero = find_support_point_x_star(jacobi_roots); this->lagrange_support_points[0] = auxiliary_zero; - for (unsigned int m = 0; m < degree - 3; m++) + for (unsigned int m = 0; m < degree - 3; ++m) this->lagrange_support_points[m + 1] = jacobi_roots[m]; this->lagrange_support_points[degree - 2] = 1.; this->lagrange_support_points[degree - 1] = 1.; @@ -1307,7 +1307,7 @@ namespace Polynomials else if (index == 1) { this->lagrange_support_points[0] = 0.; - for (unsigned int m = 0; m < degree - 3; m++) + for (unsigned int m = 0; m < degree - 3; ++m) this->lagrange_support_points[m + 1] = jacobi_roots[m]; this->lagrange_support_points[degree - 2] = 1.; this->lagrange_support_points[degree - 1] = 1.; @@ -1344,7 +1344,7 @@ namespace Polynomials { this->lagrange_support_points[0] = 0.; this->lagrange_support_points[1] = 0.; - for (unsigned int m = 0, c = 2; m < degree - 3; m++) + for (unsigned int m = 0, c = 2; m < degree - 3; ++m) if (m + 2 != index) this->lagrange_support_points[c++] = jacobi_roots[m]; this->lagrange_support_points[degree - 2] = 1.; @@ -1358,7 +1358,7 @@ namespace Polynomials { this->lagrange_support_points[0] = 0.; this->lagrange_support_points[1] = 0.; - for (unsigned int m = 0; m < degree - 3; m++) + for (unsigned int m = 0; m < degree - 3; ++m) this->lagrange_support_points[m + 2] = jacobi_roots[m]; this->lagrange_support_points[degree - 1] = 1.; @@ -1388,7 +1388,7 @@ namespace Polynomials find_support_point_x_star(jacobi_roots); this->lagrange_support_points[0] = 0.; this->lagrange_support_points[1] = 0.; - for (unsigned int m = 0; m < degree - 3; m++) + for (unsigned int m = 0; m < degree - 3; ++m) this->lagrange_support_points[m + 2] = jacobi_roots[m]; this->lagrange_support_points[degree - 1] = 1. - auxiliary_zero; diff --git a/source/base/polynomials_integrated_legendre_sz.cc b/source/base/polynomials_integrated_legendre_sz.cc index b5a7620ca7..4699f5fa21 100644 --- a/source/base/polynomials_integrated_legendre_sz.cc +++ b/source/base/polynomials_integrated_legendre_sz.cc @@ -53,7 +53,7 @@ IntegratedLegendreSZ::get_coefficients(const unsigned int k) // To maintain stability, delay the division (multiplication by a) until the // end. - for (unsigned int i = 1; i <= k - 2; i++) + for (unsigned int i = 1; i <= k - 2; ++i) { coefficients[i] = b * coefficients_km1[i - 1] - c * coefficients_km2[i]; } diff --git a/source/base/polynomials_pyramid.cc b/source/base/polynomials_pyramid.cc index 2c7944902f..f6d4595f44 100644 --- a/source/base/polynomials_pyramid.cc +++ b/source/base/polynomials_pyramid.cc @@ -193,11 +193,11 @@ ScalarLagrangePolynomialPyramid::evaluate( (void)fourth_derivatives; if (values.size() == this->n()) - for (unsigned int i = 0; i < this->n(); i++) + for (unsigned int i = 0; i < this->n(); ++i) values[i] = compute_value(i, unit_point); if (grads.size() == this->n()) - for (unsigned int i = 0; i < this->n(); i++) + for (unsigned int i = 0; i < this->n(); ++i) grads[i] = compute_grad(i, unit_point); } diff --git a/source/base/polynomials_wedge.cc b/source/base/polynomials_wedge.cc index 829fa7ea97..402fbf954e 100644 --- a/source/base/polynomials_wedge.cc +++ b/source/base/polynomials_wedge.cc @@ -160,11 +160,11 @@ ScalarLagrangePolynomialWedge::evaluate( (void)fourth_derivatives; if (values.size() == this->n()) - for (unsigned int i = 0; i < this->n(); i++) + for (unsigned int i = 0; i < this->n(); ++i) values[i] = compute_value(i, unit_point); if (grads.size() == this->n()) - for (unsigned int i = 0; i < this->n(); i++) + for (unsigned int i = 0; i < this->n(); ++i) grads[i] = compute_grad(i, unit_point); } diff --git a/source/base/utilities.cc b/source/base/utilities.cc index 0534635e6f..9721503193 100644 --- a/source/base/utilities.cc +++ b/source/base/utilities.cc @@ -300,7 +300,7 @@ namespace Utilities for (Integer q = M; q > 1; q >>= 1) { const Integer p = q - 1; - for (unsigned int i = 0; i < dim; i++) + for (unsigned int i = 0; i < dim; ++i) { // invert if (X[i] & q) @@ -318,14 +318,14 @@ namespace Utilities } // Gray encode (inverse of decode) - for (unsigned int i = 1; i < dim; i++) + for (unsigned int i = 1; i < dim; ++i) X[i] ^= X[i - 1]; Integer t = 0; for (Integer q = M; q > 1; q >>= 1) if (X[dim - 1] & q) t ^= q - 1; - for (unsigned int i = 0; i < dim; i++) + for (unsigned int i = 0; i < dim; ++i) X[i] ^= t; // now we need to go from index stored in transpose format to diff --git a/source/differentiation/ad/ad_drivers.cc b/source/differentiation/ad/ad_drivers.cc index 0615346a3f..fa0806fc56 100644 --- a/source/differentiation/ad/ad_drivers.cc +++ b/source/differentiation/ad/ad_drivers.cc @@ -771,8 +771,8 @@ namespace Differentiation // ADOL-C builds only the lower-triangular part of the // symmetric Hessian, so we should copy the relevant // entries into the upper triangular part. - for (unsigned int i = 0; i < n_independent_variables; i++) - for (unsigned int j = 0; j < i; j++) + for (unsigned int i = 0; i < n_independent_variables; ++i) + for (unsigned int j = 0; j < i; ++j) hessian[j][i] = hessian[i][j]; // Symmetry } @@ -1840,7 +1840,7 @@ namespace Differentiation internal::reverse_mode_dependent_variable_activation( const_cast(dependent_variables[0])); const std::size_t n_independent_variables = independent_variables.size(); - for (unsigned int i = 0; i < n_independent_variables; i++) + for (unsigned int i = 0; i < n_independent_variables; ++i) gradient[i] = internal::NumberType::value( ADNumberTraits::get_directional_derivative( independent_variables[i], 0 /*This number doesn't really matter*/)); @@ -1877,7 +1877,7 @@ namespace Differentiation internal::reverse_mode_dependent_variable_activation( const_cast(dependent_variables[0])); const std::size_t n_independent_variables = independent_variables.size(); - for (unsigned int i = 0; i < n_independent_variables; i++) + for (unsigned int i = 0; i < n_independent_variables; ++i) { using derivative_type = typename ADNumberTraits::derivative_type; @@ -1918,7 +1918,7 @@ namespace Differentiation ExcDimensionMismatch(values.size(), dependent_variables.size())); const std::size_t n_dependent_variables = dependent_variables.size(); - for (unsigned int i = 0; i < n_dependent_variables; i++) + for (unsigned int i = 0; i < n_dependent_variables; ++i) values[i] = ADNumberTraits::get_scalar_value( dependent_variables[i]); } @@ -1965,11 +1965,11 @@ namespace Differentiation n_independent_variables, dealii::internal::NumberType::value(0.0)); - for (unsigned int i = 0; i < n_dependent_variables; i++) + for (unsigned int i = 0; i < n_dependent_variables; ++i) { internal::reverse_mode_dependent_variable_activation( const_cast(dependent_variables[i])); - for (unsigned int j = 0; j < n_independent_variables; j++) + for (unsigned int j = 0; j < n_independent_variables; ++j) { const accumulation_type df_i_dx_j = ADNumberTraits::get_directional_derivative( @@ -2122,7 +2122,7 @@ namespace Differentiation // In forward mode, the gradients are computed from the // dependent variables const std::size_t n_independent_variables = independent_variables.size(); - for (unsigned int i = 0; i < n_independent_variables; i++) + for (unsigned int i = 0; i < n_independent_variables; ++i) gradient[i] = internal::NumberType::value( ADNumberTraits::get_directional_derivative( dependent_variables[0], i)); @@ -2159,7 +2159,7 @@ namespace Differentiation // In forward mode, the gradients are computed from the // dependent variables const std::size_t n_independent_variables = independent_variables.size(); - for (unsigned int i = 0; i < n_independent_variables; i++) + for (unsigned int i = 0; i < n_independent_variables; ++i) { using derivative_type = typename ADNumberTraits::derivative_type; @@ -2202,7 +2202,7 @@ namespace Differentiation ExcDimensionMismatch(values.size(), dependent_variables.size())); const std::size_t n_dependent_variables = dependent_variables.size(); - for (unsigned int i = 0; i < n_dependent_variables; i++) + for (unsigned int i = 0; i < n_dependent_variables; ++i) values[i] = ADNumberTraits::get_scalar_value( dependent_variables[i]); } @@ -2238,8 +2238,8 @@ namespace Differentiation // In forward mode, the gradients are computed from the // dependent variables - for (unsigned int i = 0; i < n_dependent_variables; i++) - for (unsigned int j = 0; j < n_independent_variables; j++) + for (unsigned int i = 0; i < n_dependent_variables; ++i) + for (unsigned int j = 0; j < n_independent_variables; ++j) jacobian[i][j] = internal::NumberType::value( ADNumberTraits::get_directional_derivative( dependent_variables[i], j)); diff --git a/source/differentiation/ad/ad_helpers.cc b/source/differentiation/ad/ad_helpers.cc index 0f310c9d1a..3494a45893 100644 --- a/source/differentiation/ad/ad_helpers.cc +++ b/source/differentiation/ad/ad_helpers.cc @@ -322,7 +322,7 @@ namespace Differentiation stream << "Registered independent variables: " << "\n"; - for (unsigned int i = 0; i < n_independent_variables(); i++) + for (unsigned int i = 0; i < n_independent_variables(); ++i) stream << registered_independent_variable_values[i] << (i < (n_independent_variables() - 1) ? "," : ""); stream << std::endl; @@ -333,7 +333,7 @@ namespace Differentiation stream << "Registered marked independent variables: " << "\n"; - for (unsigned int i = 0; i < n_independent_variables(); i++) + for (unsigned int i = 0; i < n_independent_variables(); ++i) stream << registered_marked_independent_variables[i] << (i < (n_independent_variables() - 1) ? "," : "") << std::flush; @@ -341,14 +341,14 @@ namespace Differentiation stream << "Dependent variable values: " << "\n"; - for (unsigned int i = 0; i < n_dependent_variables(); i++) + for (unsigned int i = 0; i < n_dependent_variables(); ++i) stream << dependent_variables[i] << (i < (n_dependent_variables() - 1) ? "," : ""); stream << std::endl; stream << "Registered dependent variables: " << "\n"; - for (unsigned int i = 0; i < n_dependent_variables(); i++) + for (unsigned int i = 0; i < n_dependent_variables(); ++i) stream << registered_marked_dependent_variables[i] << (i < (n_dependent_variables() - 1) ? "," : ""); stream << std::endl; @@ -364,7 +364,7 @@ namespace Differentiation HelperBase::print_values( std::ostream &stream) const { - for (unsigned int i = 0; i < n_independent_variables(); i++) + for (unsigned int i = 0; i < n_independent_variables(); ++i) stream << independent_variable_values[i] << (i < (n_independent_variables() - 1) ? "," : "") << std::flush; @@ -1461,7 +1461,7 @@ namespace Differentiation } // Account for symmetries of tensor components - for (unsigned int i = 0; i < this->n_independent_variables(); i++) + for (unsigned int i = 0; i < this->n_independent_variables(); ++i) { if (this->is_symmetric_independent_variable(i) == true) gradient[i] *= 0.5; @@ -1541,8 +1541,8 @@ namespace Differentiation } // Account for symmetries of tensor components - for (unsigned int i = 0; i < this->n_independent_variables(); i++) - for (unsigned int j = 0; j < i + 1; j++) + for (unsigned int i = 0; i < this->n_independent_variables(); ++i) + for (unsigned int j = 0; j < i + 1; ++j) { if (this->is_symmetric_independent_variable(i) == true && this->is_symmetric_independent_variable(j) == true) @@ -1793,13 +1793,13 @@ namespace Differentiation jacobian); } - for (unsigned int j = 0; j < this->n_independent_variables(); j++) + for (unsigned int j = 0; j < this->n_independent_variables(); ++j) { // Because we perform just a single differentiation // operation with respect to the "column" variables, // we only need to consider them for symmetry conditions. if (this->is_symmetric_independent_variable(j) == true) - for (unsigned int i = 0; i < this->n_dependent_variables(); i++) + for (unsigned int i = 0; i < this->n_dependent_variables(); ++i) jacobian[i][j] *= 0.5; } } diff --git a/source/distributed/p4est_wrappers.cc b/source/distributed/p4est_wrappers.cc index 785e0bc9ab..996a0fcc32 100644 --- a/source/distributed/p4est_wrappers.cc +++ b/source/distributed/p4est_wrappers.cc @@ -39,7 +39,7 @@ namespace internal dealii::types::global_dof_index dealii_index = triangulation->get_p4est_tree_to_coarse_cell_permutation()[treeidx]; - for (i = 0; i < l; i++) + for (i = 0; i < l; ++i) { typename dealii::Triangulation::cell_iterator cell( triangulation, i, dealii_index); @@ -100,7 +100,7 @@ namespace internal *vertices_with_ghost_neighbors = fg->vertices_with_ghost_neighbors; subids->elem_count = 0; - for (i = 0; i < nsides; i++) + for (i = 0; i < nsides; ++i) { if (sides[i].is_ghost) { @@ -127,7 +127,7 @@ namespace internal subdomain_ids = reinterpret_cast(subids->array); - for (i = 0; i < nsides; i++) + for (i = 0; i < nsides; ++i) { if (!sides[i].is_ghost) { @@ -140,7 +140,7 @@ namespace internal Assert(!cell->is_ghost(), ExcMessage("local quad found ghost cell")); - for (j = 0; j < nsubs; j++) + for (j = 0; j < nsubs; ++j) { (*vertices_with_ghost_neighbors)[cell->vertex_index( sides[i].corner)] @@ -176,11 +176,11 @@ namespace internal *vertices_with_ghost_neighbors = fg->vertices_with_ghost_neighbors; subids->elem_count = 0; - for (i = 0; i < nsides; i++) + for (i = 0; i < nsides; ++i) { if (sides[i].is_hanging) { - for (j = 0; j < 2; j++) + for (j = 0; j < 2; ++j) { if (sides[i].is.hanging.is_ghost[j]) { @@ -207,11 +207,11 @@ namespace internal subdomain_ids = reinterpret_cast(subids->array); - for (i = 0; i < nsides; i++) + for (i = 0; i < nsides; ++i) { if (sides[i].is_hanging) { - for (j = 0; j < 2; j++) + for (j = 0; j < 2; ++j) { if (!sides[i].is.hanging.is_ghost[j]) { @@ -221,7 +221,7 @@ namespace internal sides[i].treeid, *(sides[i].is.hanging.quad[j])); - for (k = 0; k < nsubs; k++) + for (k = 0; k < nsubs; ++k) { (*vertices_with_ghost_neighbors) [cell->vertex_index( @@ -262,11 +262,11 @@ namespace internal int limit = (dim == 2) ? 2 : 4; subids->elem_count = 0; - for (i = 0; i < nsides; i++) + for (i = 0; i < nsides; ++i) { if (sides[i].is_hanging) { - for (j = 0; j < limit; j++) + for (j = 0; j < limit; ++j) { if (sides[i].is.hanging.is_ghost[j]) { @@ -293,11 +293,11 @@ namespace internal subdomain_ids = reinterpret_cast(subids->array); - for (i = 0; i < nsides; i++) + for (i = 0; i < nsides; ++i) { if (sides[i].is_hanging) { - for (j = 0; j < limit; j++) + for (j = 0; j < limit; ++j) { if (!sides[i].is.hanging.is_ghost[j]) { @@ -307,7 +307,7 @@ namespace internal sides[i].treeid, *(sides[i].is.hanging.quad[j])); - for (k = 0; k < nsubs; k++) + for (k = 0; k < nsubs; ++k) { if (dim == 2) { diff --git a/source/dofs/dof_handler.cc b/source/dofs/dof_handler.cc index e403dd2dfe..236896c10c 100644 --- a/source/dofs/dof_handler.cc +++ b/source/dofs/dof_handler.cc @@ -1358,7 +1358,7 @@ namespace internal dof_handler.hp_object_fe_indices[d][offset] = fe; dof_handler.object_dof_ptr[l][d][offset + 1] = n_dofs; - for (unsigned int i = 0; i < n_dofs; i++) + for (unsigned int i = 0; i < n_dofs; ++i) dof_handler.object_dof_indices[l][d].push_back( numbers::invalid_dof_index); } @@ -1403,7 +1403,7 @@ namespace internal n_dofs_2; - for (unsigned int i = 0; i < n_dofs_1 + n_dofs_2; i++) + for (unsigned int i = 0; i < n_dofs_1 + n_dofs_2; ++i) dof_handler.object_dof_indices[l][d].push_back( numbers::invalid_dof_index); } diff --git a/source/dofs/dof_handler_policy.cc b/source/dofs/dof_handler_policy.cc index 3fbc72711d..9a79a2c62a 100644 --- a/source/dofs/dof_handler_policy.cc +++ b/source/dofs/dof_handler_policy.cc @@ -1860,7 +1860,7 @@ namespace internal const IndexSet & indices_we_care_about, DoFHandler & dof_handler) { - for (unsigned int d = 1; d < dim; d++) + for (unsigned int d = 1; d < dim; ++d) for (auto &i : dof_handler.object_dof_indices[0][d]) if (i != numbers::invalid_dof_index) i = ((indices_we_care_about.size() == 0) ? @@ -2124,7 +2124,7 @@ namespace internal if (dof_handler.hp_capability_enabled == false) { - for (unsigned int d = 1; d < dim; d++) + for (unsigned int d = 1; d < dim; ++d) for (auto &i : dof_handler.object_dof_indices[0][d]) if (i != numbers::invalid_dof_index) i = ((indices_we_care_about.size() == 0) ? @@ -2233,7 +2233,7 @@ namespace internal if (dof_handler.hp_capability_enabled == false) { - for (unsigned int d = 1; d < dim; d++) + for (unsigned int d = 1; d < dim; ++d) for (auto &i : dof_handler.object_dof_indices[0][d]) if (i != numbers::invalid_dof_index) i = ((indices_we_care_about.size() == 0) ? @@ -3446,7 +3446,7 @@ namespace internal // compute the displacements (relative to recvbuf) // at which to place the incoming data from process i std::vector displacements(n_cpu); - for (unsigned int i = 0; i < n_cpu; i++) + for (unsigned int i = 0; i < n_cpu; ++i) { displacements[i] = shift; shift += rcounts[i]; @@ -3479,7 +3479,7 @@ namespace internal Utilities::MPI::all_gather( tr->get_communicator(), this->dof_handler->locally_owned_dofs()); - for (unsigned int i = 0; i < n_cpu; i++) + for (unsigned int i = 0; i < n_cpu; ++i) { const IndexSet iset = locally_owned_dofs_per_processor[i]; for (types::global_dof_index ind = 0; ind < iset.n_elements(); diff --git a/source/dofs/dof_tools.cc b/source/dofs/dof_tools.cc index 2774128843..8d2725356a 100644 --- a/source/dofs/dof_tools.cc +++ b/source/dofs/dof_tools.cc @@ -1421,7 +1421,7 @@ namespace DoFTools subdomain_association.size()); } - for (unsigned int i = 0; i < n_subdomains; i++) + for (unsigned int i = 0; i < n_subdomains; ++i) index_sets[i].compress(); return index_sets; diff --git a/source/dofs/dof_tools_constraints.cc b/source/dofs/dof_tools_constraints.cc index 7ec83eaee1..d285de7841 100644 --- a/source/dofs/dof_tools_constraints.cc +++ b/source/dofs/dof_tools_constraints.cc @@ -1945,7 +1945,7 @@ namespace DoFTools // neighbor a face are artificial, we simply test to see if the face // does not have a valid dof initialization. - for (unsigned int i = 0; i < dofs_per_face; i++) + for (unsigned int i = 0; i < dofs_per_face; ++i) if (dofs_1[i] == numbers::invalid_dof_index || dofs_2[i] == numbers::invalid_dof_index) { diff --git a/source/dofs/dof_tools_sparsity.cc b/source/dofs/dof_tools_sparsity.cc index 7f049f6e3b..87c4df922f 100644 --- a/source/dofs/dof_tools_sparsity.cc +++ b/source/dofs/dof_tools_sparsity.cc @@ -307,7 +307,7 @@ namespace DoFTools child_cells = GridTools::get_active_child_cells>( cell_row); - for (unsigned int i = 0; i < child_cells.size(); i++) + for (unsigned int i = 0; i < child_cells.size(); ++i) { const typename DoFHandler::cell_iterator cell_row_child = child_cells[i]; @@ -334,7 +334,7 @@ namespace DoFTools child_cells = GridTools::get_active_child_cells>( cell_col); - for (unsigned int i = 0; i < child_cells.size(); i++) + for (unsigned int i = 0; i < child_cells.size(); ++i) { const typename DoFHandler::active_cell_iterator cell_col_child = child_cells[i]; diff --git a/source/fe/fe_dgq.cc b/source/fe/fe_dgq.cc index ce2a845039..9ec53290f7 100644 --- a/source/fe/fe_dgq.cc +++ b/source/fe/fe_dgq.cc @@ -861,11 +861,11 @@ FE_DGQArbitraryNodes::get_name() const Assert(polynomial_space != nullptr, ExcInternalError()); std::vector lexicographic = polynomial_space->get_numbering_inverse(); - for (unsigned int j = 0; j <= this->degree; j++) + for (unsigned int j = 0; j <= this->degree; ++j) points[j] = this->unit_support_points[lexicographic[j]][0]; // Check whether the support points are equidistant. - for (unsigned int j = 0; j <= this->degree; j++) + for (unsigned int j = 0; j <= this->degree; ++j) if (std::abs(points[j] - static_cast(j) / this->degree) > 1e-15) { equidistant = false; @@ -889,7 +889,7 @@ FE_DGQArbitraryNodes::get_name() const // Check whether the support points come from QGaussLobatto. const QGaussLobatto<1> points_gl(this->degree + 1); bool gauss_lobatto = true; - for (unsigned int j = 0; j <= this->degree; j++) + for (unsigned int j = 0; j <= this->degree; ++j) if (points[j] != points_gl.point(j)(0)) { gauss_lobatto = false; @@ -906,7 +906,7 @@ FE_DGQArbitraryNodes::get_name() const // Check whether the support points come from QGauss. const QGauss<1> points_g(this->degree + 1); bool gauss = true; - for (unsigned int j = 0; j <= this->degree; j++) + for (unsigned int j = 0; j <= this->degree; ++j) if (points[j] != points_g.point(j)(0)) { gauss = false; @@ -923,7 +923,7 @@ FE_DGQArbitraryNodes::get_name() const // Check whether the support points come from QGauss. const QGaussLog<1> points_glog(this->degree + 1); bool gauss_log = true; - for (unsigned int j = 0; j <= this->degree; j++) + for (unsigned int j = 0; j <= this->degree; ++j) if (points[j] != points_glog.point(j)(0)) { gauss_log = false; diff --git a/source/fe/fe_enriched.cc b/source/fe/fe_enriched.cc index 8a77533b8c..707168479f 100644 --- a/source/fe/fe_enriched.cc +++ b/source/fe/fe_enriched.cc @@ -39,7 +39,7 @@ namespace internal { std::vector multiplicities; multiplicities.push_back(1); // the first one is non-enriched FE - for (unsigned int i = 0; i < functions.size(); i++) + for (unsigned int i = 0; i < functions.size(); ++i) multiplicities.push_back(functions[i].size()); return multiplicities; @@ -57,7 +57,7 @@ namespace internal { std::vector *> fes; fes.push_back(fe_base); - for (unsigned int i = 0; i < fe_enriched.size(); i++) + for (unsigned int i = 0; i < fe_enriched.size(); ++i) fes.push_back(fe_enriched[i]); return fes; @@ -91,7 +91,7 @@ namespace internal const unsigned int n_comp_base = fes[0]->n_components(); // start from fe=1 as 0th is always non-enriched FE. - for (unsigned int fe = 1; fe < fes.size(); fe++) + for (unsigned int fe = 1; fe < fes.size(); ++fe) { const FE_Nothing *fe_nothing = dynamic_cast *>(fes[fe]); @@ -120,7 +120,7 @@ namespace internal const std::vector *> &fes) { // start from fe=1 as 0th is always non-enriched FE. - for (unsigned int fe = 1; fe < fes.size(); fe++) + for (unsigned int fe = 1; fe < fes.size(); ++fe) if (dynamic_cast *>(fes[fe]) == nullptr) // this is not FE_Nothing => there will be enrichment return true; @@ -203,7 +203,7 @@ FE_Enriched::FE_Enriched( // resize to be consistent with all FEs used to construct the FE_Enriched, // even though we will never use the 0th element. base_no_mult_local_enriched_dofs.resize(fes.size()); - for (unsigned int fe = 1; fe < fes.size(); fe++) + for (unsigned int fe = 1; fe < fes.size(); ++fe) base_no_mult_local_enriched_dofs[fe].resize(multiplicities[fe]); Assert(base_no_mult_local_enriched_dofs.size() == this->n_base_elements(), @@ -285,7 +285,7 @@ FE_Enriched::clone() const std::vector *> fes; std::vector multiplicities; - for (unsigned int i = 0; i < this->n_base_elements(); i++) + for (unsigned int i = 0; i < this->n_base_elements(); ++i) { fes.push_back(&base_element(i)); multiplicities.push_back(this->element_multiplicity(i)); @@ -434,7 +434,7 @@ FE_Enriched::initialize( // block of code this->base_to_block_indices.reinit(0, 0); - for (unsigned int i = 0; i < fes.size(); i++) + for (unsigned int i = 0; i < fes.size(); ++i) if (multiplicities[i] > 0) this->base_to_block_indices.push_back(multiplicities[i]); @@ -661,7 +661,7 @@ FE_Enriched::multiply_by_enrichment( // TODO: do we need it only for dim_1 == dim (i.e. fill_fe_values)? if (dim_1 == dim) - for (unsigned int base_no = 1; base_no < this->n_base_elements(); base_no++) + for (unsigned int base_no = 1; base_no < this->n_base_elements(); ++base_no) { const FiniteElement &base_fe = base_element(base_no); typename FiniteElement::InternalDataBase &base_fe_data = @@ -725,7 +725,7 @@ FE_Enriched::multiply_by_enrichment( ExcDimensionMismatch(base_no_mult_local_enriched_dofs.size(), fe_data.enrichment.size())); // calculate hessians, gradients and values for each function - for (unsigned int base_no = 1; base_no < this->n_base_elements(); base_no++) + for (unsigned int base_no = 1; base_no < this->n_base_elements(); ++base_no) { Assert( base_no_mult_local_enriched_dofs[base_no].size() == @@ -757,7 +757,7 @@ FE_Enriched::multiply_by_enrichment( ExcDimensionMismatch( fe_data.enrichment[base_no][m].hessians.size(), n_q_points)); - for (unsigned int q = 0; q < n_q_points; q++) + for (unsigned int q = 0; q < n_q_points; ++q) fe_data.enrichment[base_no][m].hessians[q] = enrichments[base_no - 1][m](cell)->hessian( mapping_data.quadrature_points[q]); @@ -770,7 +770,7 @@ FE_Enriched::multiply_by_enrichment( ExcDimensionMismatch( fe_data.enrichment[base_no][m].gradients.size(), n_q_points)); - for (unsigned int q = 0; q < n_q_points; q++) + for (unsigned int q = 0; q < n_q_points; ++q) fe_data.enrichment[base_no][m].gradients[q] = enrichments[base_no - 1][m](cell)->gradient( mapping_data.quadrature_points[q]); @@ -782,7 +782,7 @@ FE_Enriched::multiply_by_enrichment( ExcDimensionMismatch( fe_data.enrichment[base_no][m].values.size(), n_q_points)); - for (unsigned int q = 0; q < n_q_points; q++) + for (unsigned int q = 0; q < n_q_points; ++q) fe_data.enrichment[base_no][m].values[q] = enrichments[base_no - 1][m](cell)->value( mapping_data.quadrature_points[q]); @@ -830,7 +830,7 @@ FE_Enriched::multiply_by_enrichment( } if (flags & update_gradients) - for (unsigned int base_no = 1; base_no < this->n_base_elements(); base_no++) + for (unsigned int base_no = 1; base_no < this->n_base_elements(); ++base_no) { for (unsigned int m = 0; m < base_no_mult_local_enriched_dofs[base_no].size(); @@ -853,7 +853,7 @@ FE_Enriched::multiply_by_enrichment( } if (flags & update_values) - for (unsigned int base_no = 1; base_no < this->n_base_elements(); base_no++) + for (unsigned int base_no = 1; base_no < this->n_base_elements(); ++base_no) { for (unsigned int m = 0; m < base_no_mult_local_enriched_dofs[base_no].size(); diff --git a/source/fe/fe_q.cc b/source/fe/fe_q.cc index 89f4459706..47d5de838b 100644 --- a/source/fe/fe_q.cc +++ b/source/fe/fe_q.cc @@ -107,11 +107,11 @@ FE_Q::get_name() const dynamic_cast *>(this->poly_space.get()); std::vector lexicographic = poly_space_derived_ptr->get_numbering_inverse(); - for (unsigned int j = 0; j <= this->degree; j++) + for (unsigned int j = 0; j <= this->degree; ++j) points[j] = this->unit_support_points[lexicographic[j]][0]; // Check whether the support points are equidistant. - for (unsigned int j = 0; j <= this->degree; j++) + for (unsigned int j = 0; j <= this->degree; ++j) if (std::fabs(points[j] - static_cast(j) / this->degree) > 1e-15) { equidistant = false; @@ -132,7 +132,7 @@ FE_Q::get_name() const // Check whether the support points come from QGaussLobatto. const QGaussLobatto<1> points_gl(this->degree + 1); bool gauss_lobatto = true; - for (unsigned int j = 0; j <= this->degree; j++) + for (unsigned int j = 0; j <= this->degree; ++j) if (points[j] != points_gl.point(j)(0)) { gauss_lobatto = false; diff --git a/source/fe/fe_q_bubbles.cc b/source/fe/fe_q_bubbles.cc index 6145ad07c6..0eb56d92c5 100644 --- a/source/fe/fe_q_bubbles.cc +++ b/source/fe/fe_q_bubbles.cc @@ -281,7 +281,7 @@ FE_Q_Bubbles::get_name() const unsigned int index = 0; // Decode the support points in one coordinate direction. - for (unsigned int j = 0; j < dofs_per_cell; j++) + for (unsigned int j = 0; j < dofs_per_cell; ++j) { if ((dim > 1) ? (unit_support_points[j](1) == 0 && ((dim > 2) ? unit_support_points[j](2) == 0 : true)) : @@ -303,7 +303,7 @@ FE_Q_Bubbles::get_name() const "Could not decode support points in one coordinate direction.")); // Check whether the support points are equidistant. - for (unsigned int j = 0; j < n_points; j++) + for (unsigned int j = 0; j < n_points; ++j) if (std::fabs(points[j] - static_cast(j) / (this->degree - 1)) > 1e-15) { @@ -325,7 +325,7 @@ FE_Q_Bubbles::get_name() const // Check whether the support points come from QGaussLobatto. const QGaussLobatto<1> points_gl(n_points); type = true; - for (unsigned int j = 0; j < n_points; j++) + for (unsigned int j = 0; j < n_points; ++j) if (points[j] != points_gl.point(j)(0)) { type = false; diff --git a/source/fe/fe_q_dg0.cc b/source/fe/fe_q_dg0.cc index 16ae3a9236..291d83123d 100644 --- a/source/fe/fe_q_dg0.cc +++ b/source/fe/fe_q_dg0.cc @@ -106,7 +106,7 @@ FE_Q_DG0::get_name() const unsigned int index = 0; // Decode the support points in one coordinate direction. - for (unsigned int j = 0; j < dofs_per_cell; j++) + for (unsigned int j = 0; j < dofs_per_cell; ++j) { if ((dim > 1) ? (unit_support_points[j](1) == 0 && ((dim > 2) ? unit_support_points[j](2) == 0 : true)) : @@ -128,7 +128,7 @@ FE_Q_DG0::get_name() const "Could not decode support points in one coordinate direction.")); // Check whether the support points are equidistant. - for (unsigned int j = 0; j < n_points; j++) + for (unsigned int j = 0; j < n_points; ++j) if (std::fabs(points[j] - static_cast(j) / this->degree) > 1e-15) { type = false; @@ -149,7 +149,7 @@ FE_Q_DG0::get_name() const // Check whether the support points come from QGaussLobatto. const QGaussLobatto<1> points_gl(n_points); type = true; - for (unsigned int j = 0; j < n_points; j++) + for (unsigned int j = 0; j < n_points; ++j) if (points[j] != points_gl.point(j)(0)) { type = false; diff --git a/source/fe/fe_q_hierarchical.cc b/source/fe/fe_q_hierarchical.cc index 71296683df..30f8568a43 100644 --- a/source/fe/fe_q_hierarchical.cc +++ b/source/fe/fe_q_hierarchical.cc @@ -178,7 +178,7 @@ FE_Q_Hierarchical::get_interpolation_matrix( { const std::vector dof_map = this->get_embedding_dofs(source_fe->degree); - for (unsigned int j = 0; j < dof_map.size(); j++) + for (unsigned int j = 0; j < dof_map.size(); ++j) matrix[dof_map[j]][j] = 1.; } // and when just truncate higher modes. @@ -186,7 +186,7 @@ FE_Q_Hierarchical::get_interpolation_matrix( { const std::vector dof_map = source_fe->get_embedding_dofs(this->degree); - for (unsigned int j = 0; j < dof_map.size(); j++) + for (unsigned int j = 0; j < dof_map.size(); ++j) matrix[j][dof_map[j]] = 1.; } } @@ -275,7 +275,7 @@ FE_Q_Hierarchical::hp_line_dof_identities( // increasingly. Thus we return a vector of pairs for the first N-1, where // N is minimum number of dofs_per_line for each FE_Q_Hierarchical. std::vector> res; - for (unsigned int i = 0; i < std::min(this_dpl, other_dpl); i++) + for (unsigned int i = 0; i < std::min(this_dpl, other_dpl); ++i) res.emplace_back(i, i); return res; @@ -319,7 +319,7 @@ FE_Q_Hierarchical::hp_quad_dof_identities( // increasingly. Thus we return a vector of pairs for the first N-1, where // N is minimum number of dofs_per_line for each FE_Q_Hierarchical. std::vector> res; - for (unsigned int i = 0; i < std::min(this_dpq, other_dpq); i++) + for (unsigned int i = 0; i < std::min(this_dpq, other_dpq); ++i) res.emplace_back(i, i); return res; @@ -542,7 +542,7 @@ FE_Q_Hierarchical::initialize_constraints( case 3: { - for (unsigned int i = 0; i < dofs_1d * dofs_1d; i++) + for (unsigned int i = 0; i < dofs_1d * dofs_1d; ++i) { // center vertex node this->interface_constraints(0, face_renumber[i]) = @@ -564,7 +564,7 @@ FE_Q_Hierarchical::initialize_constraints( dofs_subcell[1](1, (i - (i % dofs_1d)) / dofs_1d); // interior edges - for (unsigned int j = 0; j < (this->degree - 1); j++) + for (unsigned int j = 0; j < (this->degree - 1); ++j) { this->interface_constraints(5 + j, face_renumber[i]) = dofs_subcell[0](1, i % dofs_1d) * @@ -584,7 +584,7 @@ FE_Q_Hierarchical::initialize_constraints( } // boundary edges - for (unsigned int j = 0; j < (this->degree - 1); j++) + for (unsigned int j = 0; j < (this->degree - 1); ++j) { // left edge this->interface_constraints(5 + 4 * (this->degree - 1) + j, @@ -632,8 +632,8 @@ FE_Q_Hierarchical::initialize_constraints( } // interior faces - for (unsigned int j = 0; j < (this->degree - 1); j++) - for (unsigned int k = 0; k < (this->degree - 1); k++) + for (unsigned int j = 0; j < (this->degree - 1); ++j) + for (unsigned int k = 0; k < (this->degree - 1); ++k) { // subcell 0 this->interface_constraints(5 + 12 * (this->degree - 1) + diff --git a/source/fe/fe_series.cc b/source/fe/fe_series.cc index e1f7ca40f8..f3c2c80ed5 100644 --- a/source/fe/fe_series.cc +++ b/source/fe/fe_series.cc @@ -41,7 +41,7 @@ namespace FESeries double sum_1 = 0.0, sum_x = 0.0, sum_x2 = 0.0, sum_y = 0.0, sum_xy = 0.0; - for (unsigned int i = 0; i < x.size(); i++) + for (unsigned int i = 0; i < x.size(); ++i) { sum_1 += 1.0; sum_x += x[i]; diff --git a/source/fe/fe_series_fourier.cc b/source/fe/fe_series_fourier.cc index 465883228c..e780a98de8 100644 --- a/source/fe/fe_series_fourier.cc +++ b/source/fe/fe_series_fourier.cc @@ -306,8 +306,8 @@ namespace FESeries Assert(local_dof_values.size() == matrix.n(), ExcDimensionMismatch(local_dof_values.size(), matrix.n())); - for (unsigned int i = 0; i < unrolled_coefficients.size(); i++) - for (unsigned int j = 0; j < local_dof_values.size(); j++) + for (unsigned int i = 0; i < unrolled_coefficients.size(); ++i) + for (unsigned int j = 0; j < local_dof_values.size(); ++j) unrolled_coefficients[i] += matrix[i][j] * local_dof_values[j]; fourier_coefficients.fill(unrolled_coefficients.begin()); diff --git a/source/fe/fe_series_legendre.cc b/source/fe/fe_series_legendre.cc index 10558399db..3c30cd5a35 100644 --- a/source/fe/fe_series_legendre.cc +++ b/source/fe/fe_series_legendre.cc @@ -41,7 +41,7 @@ namespace Lh(const Point &x_q, const TableIndices &indices) { double res = 1.0; - for (unsigned int d = 0; d < dim; d++) + for (unsigned int d = 0; d < dim; ++d) { const double x = 2.0 * (x_q[d] - 0.5); Assert((x_q[d] <= 1.0) && (x_q[d] >= 0.), ExcLegendre(d, x_q[d])); @@ -61,7 +61,7 @@ namespace multiplier(const TableIndices &indices) { double res = 1.0; - for (unsigned int d = 0; d < dim; d++) + for (unsigned int d = 0; d < dim; ++d) res *= (0.5 + indices[d]); return res; @@ -309,8 +309,8 @@ namespace FESeries Assert(local_dof_values.size() == matrix.n(), ExcDimensionMismatch(local_dof_values.size(), matrix.n())); - for (unsigned int i = 0; i < unrolled_coefficients.size(); i++) - for (unsigned int j = 0; j < local_dof_values.size(); j++) + for (unsigned int i = 0; i < unrolled_coefficients.size(); ++i) + for (unsigned int j = 0; j < local_dof_values.size(); ++j) unrolled_coefficients[i] += matrix[i][j] * local_dof_values[j]; legendre_coefficients.fill(unrolled_coefficients.begin()); diff --git a/source/fe/fe_system.cc b/source/fe/fe_system.cc index 5aeb6c603d..98ba883d10 100644 --- a/source/fe/fe_system.cc +++ b/source/fe/fe_system.cc @@ -341,7 +341,7 @@ FESystem::clone() const std::vector *> fes; std::vector multiplicities; - for (unsigned int i = 0; i < this->n_base_elements(); i++) + for (unsigned int i = 0; i < this->n_base_elements(); ++i) { fes.push_back(&base_element(i)); multiplicities.push_back(this->element_multiplicity(i)); @@ -1645,7 +1645,7 @@ FESystem::initialize( this->base_to_block_indices.reinit(0, 0); - for (unsigned int i = 0; i < fes.size(); i++) + for (unsigned int i = 0; i < fes.size(); ++i) if (multiplicities[i] > 0) this->base_to_block_indices.push_back(multiplicities[i]); @@ -1653,7 +1653,7 @@ FESystem::initialize( Threads::TaskGroup<> clone_base_elements; unsigned int ind = 0; - for (unsigned int i = 0; i < fes.size(); i++) + for (unsigned int i = 0; i < fes.size(); ++i) if (multiplicities[i] > 0) { clone_base_elements += Threads::new_task([&, i, ind]() { diff --git a/source/grid/grid_generator.cc b/source/grid/grid_generator.cc index fb6bce5881..c0a594d89b 100644 --- a/source/grid/grid_generator.cc +++ b/source/grid/grid_generator.cc @@ -439,7 +439,7 @@ namespace GridGenerator // find index in vector to nose point (min) and tail point (max) - for (unsigned int i = 0; i < jouk_points.size(); i++) + for (unsigned int i = 0; i < jouk_points.size(); ++i) { if (jouk_points[i](0) < nose_x_coordinate) { @@ -454,9 +454,9 @@ namespace GridGenerator } // copy point on upper side of airfoil - for (unsigned int i = tail_index; i < jouk_points.size(); i++) + for (unsigned int i = tail_index; i < jouk_points.size(); ++i) upper_points.emplace_back(jouk_points[i]); - for (unsigned int i = 0; i <= nose_index; i++) + for (unsigned int i = 0; i <= nose_index; ++i) upper_points.emplace_back(jouk_points[i]); std::reverse(upper_points.begin(), upper_points.end()); @@ -533,7 +533,7 @@ namespace GridGenerator // (number_points) equidistant points. const double theta = 2 * numbers::PI / number_points; // first point is leading edge then counterclockwise - for (unsigned int i = 0; i < number_points; i++) + for (unsigned int i = 0; i < number_points; ++i) circle_points.emplace_back(center[0] - radius * cos(i * theta), center[1] - radius * sin(i * theta)); @@ -554,7 +554,7 @@ namespace GridGenerator std::vector> joukowski_points(circle_points.size()); // transform each point - for (unsigned int i = 0; i < circle_points.size(); i++) + for (unsigned int i = 0; i < circle_points.size(); ++i) { const double chi = circle_points[i](0); const double eta = circle_points[i](1); @@ -657,7 +657,7 @@ namespace GridGenerator std::vector> naca_points; if (digit_0 == 0 && digit_1 == 0) // is symmetric - for (unsigned int i = 0; i < number_points; i++) + for (unsigned int i = 0; i < number_points; ++i) { const double x = i * 1 / (1.0 * number_points - 1); const double y_t = @@ -672,7 +672,7 @@ namespace GridGenerator naca_points.emplace_back(x, -y_t); } else // is asymmetric - for (unsigned int i = 0; i < number_points; i++) + for (unsigned int i = 0; i < number_points; ++i) { const double m = 1.0 * digit_0 / 100; // max. chamber const double p = 1.0 * digit_1 / 10; // location of max. chamber @@ -770,7 +770,7 @@ namespace GridGenerator // calculate arclength std::vector arclength_L(non_equidistant_points.size(), 0); - for (unsigned int i = 0; i < non_equidistant_points.size() - 1; i++) + for (unsigned int i = 0; i < non_equidistant_points.size() - 1; ++i) arclength_L[i + 1] = arclength_L[i] + non_equidistant_points[i + 1].distance(non_equidistant_points[i]); @@ -790,7 +790,7 @@ namespace GridGenerator // loop over all subsections - for (unsigned int j = 0, i = 1; j < n_points - 1; j++) + for (unsigned int j = 0, i = 1; j < n_points - 1; ++j) { // get reference left and right end of this section const auto Lj = arclength_L[j]; @@ -2722,7 +2722,7 @@ namespace GridGenerator } double x = 0; - for (unsigned int j = 0; j < step_sizes.at(i).size(); j++) + for (unsigned int j = 0; j < step_sizes.at(i).size(); ++j) x += step_sizes[i][j]; Assert(std::fabs(x - (p2(i) - p1(i))) <= 1e-12 * std::fabs(x), ExcMessage( @@ -2928,7 +2928,7 @@ namespace GridGenerator Assert(spacing[0].size() == n_cells, ExcInvalidRepetitionsDimension(1)); double delta = std::numeric_limits::max(); - for (unsigned int i = 0; i < n_cells; i++) + for (unsigned int i = 0; i < n_cells; ++i) { Assert(spacing[0][i] >= 0, ExcInvalidRepetitions(-1)); delta = std::min(delta, spacing[0][i]); @@ -2945,7 +2945,7 @@ namespace GridGenerator } // create the cells unsigned int n_val_cells = 0; - for (unsigned int i = 0; i < n_cells; i++) + for (unsigned int i = 0; i < n_cells; ++i) if (material_id[i] != numbers::invalid_material_id) n_val_cells++; @@ -2983,10 +2983,10 @@ namespace GridGenerator std::vector repetitions(2); double delta = std::numeric_limits::max(); - for (unsigned int i = 0; i < 2; i++) + for (unsigned int i = 0; i < 2; ++i) { repetitions[i] = spacing[i].size(); - for (unsigned int j = 0; j < repetitions[i]; j++) + for (unsigned int j = 0; j < repetitions[i]; ++j) { Assert(spacing[i][j] >= 0, ExcInvalidRepetitions(-1)); delta = std::min(delta, spacing[i][j]); @@ -3013,8 +3013,8 @@ namespace GridGenerator // create the cells unsigned int n_val_cells = 0; - for (unsigned int i = 0; i < material_id.size(0); i++) - for (unsigned int j = 0; j < material_id.size(1); j++) + for (unsigned int i = 0; i < material_id.size(0); ++i) + for (unsigned int j = 0; j < material_id.size(1); ++j) if (material_id[i][j] != numbers::invalid_material_id) n_val_cells++; @@ -3077,10 +3077,10 @@ namespace GridGenerator std::vector repetitions(dim); double delta = std::numeric_limits::max(); - for (unsigned int i = 0; i < dim; i++) + for (unsigned int i = 0; i < dim; ++i) { repetitions[i] = spacing[i].size(); - for (unsigned int j = 0; j < repetitions[i]; j++) + for (unsigned int j = 0; j < repetitions[i]; ++j) { Assert(spacing[i][j] >= 0, ExcInvalidRepetitions(-1)); delta = std::min(delta, spacing[i][j]); @@ -3113,9 +3113,9 @@ namespace GridGenerator // create the cells unsigned int n_val_cells = 0; - for (unsigned int i = 0; i < material_id.size(0); i++) - for (unsigned int j = 0; j < material_id.size(1); j++) - for (unsigned int k = 0; k < material_id.size(2); k++) + for (unsigned int i = 0; i < material_id.size(0); ++i) + for (unsigned int j = 0; j < material_id.size(1); ++j) + for (unsigned int k = 0; k < material_id.size(2); ++k) if (material_id[i][j][k] != numbers::invalid_material_id) n_val_cells++; @@ -8088,7 +8088,7 @@ namespace GridGenerator Table<2, unsigned int> swap_matrix( GeometryInfo::faces_per_cell, GeometryInfo::vertices_per_cell); - for (unsigned int i1 = 0; i1 < GeometryInfo::faces_per_cell; i1++) + for (unsigned int i1 = 0; i1 < GeometryInfo::faces_per_cell; ++i1) { for (unsigned int i2 = 0; i2 < GeometryInfo::vertices_per_cell; i2++) @@ -8205,7 +8205,7 @@ namespace GridGenerator if (dim == 2) { for (const auto &cell : surface_mesh.active_cell_iterators()) - for (unsigned int vertex = 0; vertex < 2; vertex++) + for (unsigned int vertex = 0; vertex < 2; ++vertex) if (cell->face(vertex)->at_boundary()) cell->face(vertex)->set_boundary_id(0); } @@ -8310,7 +8310,7 @@ namespace GridGenerator std::map::cell_iterator, typename MeshType::face_iterator> surface_to_volume_mapping; - for (unsigned int i = 0; i < temporary_map_boundary_cell_face.size(); i++) + for (unsigned int i = 0; i < temporary_map_boundary_cell_face.size(); ++i) surface_to_volume_mapping[temporary_map_boundary_cell_face[i].first] = temporary_map_boundary_cell_face[i].second.first; diff --git a/source/grid/grid_in.cc b/source/grid/grid_in.cc index 46ea8035b6..4d7e4793e7 100644 --- a/source/grid/grid_in.cc +++ b/source/grid/grid_in.cc @@ -226,7 +226,7 @@ GridIn::read_vtk(std::istream &in) if (dim == 3) { - for (unsigned int count = 0; count < n_geometric_objects; count++) + for (unsigned int count = 0; count < n_geometric_objects; ++count) { unsigned int n_vertices; in >> n_vertices; @@ -305,7 +305,7 @@ GridIn::read_vtk(std::istream &in) } else if (dim == 2) { - for (unsigned int count = 0; count < n_geometric_objects; count++) + for (unsigned int count = 0; count < n_geometric_objects; ++count) { unsigned int n_vertices; in >> n_vertices; @@ -366,7 +366,7 @@ GridIn::read_vtk(std::istream &in) } else if (dim == 1) { - for (unsigned int count = 0; count < n_geometric_objects; count++) + for (unsigned int count = 0; count < n_geometric_objects; ++count) { unsigned int type; in >> type; @@ -377,7 +377,7 @@ GridIn::read_vtk(std::istream &in) "While reading VTK file, unknown cell type encountered")); cells.emplace_back(type); - for (unsigned int j = 0; j < type; j++) // loop to feed data + for (unsigned int j = 0; j < type; ++j) // loop to feed data in >> cells.back().vertices[j]; cells.back().material_id = 0; @@ -493,7 +493,7 @@ GridIn::read_vtk(std::istream &in) // assumption that cells come before all faces and // lines has been verified above via an assertion, so // the order used in the following blocks makes sense - for (unsigned int i = 0; i < cells.size(); i++) + for (unsigned int i = 0; i < cells.size(); ++i) { int id; in >> id; @@ -662,7 +662,7 @@ GridIn::read_unv(std::istream &in) vertices.emplace_back(); - for (unsigned int d = 0; d < spacedim; d++) + for (unsigned int d = 0; d < spacedim; ++d) vertices.back()(d) = x[d]; vertex_indices[no] = no_vertex; @@ -825,7 +825,7 @@ GridIn::read_unv(std::istream &in) const unsigned int n_lines = (n_entities % 2 == 0) ? (n_entities / 2) : ((n_entities + 1) / 2); - for (unsigned int line = 0; line < n_lines; line++) + for (unsigned int line = 0; line < n_lines; ++line) { unsigned int n_fragments; @@ -1393,7 +1393,7 @@ GridIn::read_xda(std::istream &in) // XDA happens to use ExodusII's numbering because XDA/XDR is libMesh's // native format, and libMesh's node numberings come from ExodusII: - for (unsigned int i = 0; i < GeometryInfo::vertices_per_cell; i++) + for (unsigned int i = 0; i < GeometryInfo::vertices_per_cell; ++i) in >> cell.vertices[reference_cell.exodusii_vertex_to_deal_vertex(i)]; } diff --git a/source/grid/grid_out.cc b/source/grid/grid_out.cc index d341522ddc..92362ce53a 100644 --- a/source/grid/grid_out.cc +++ b/source/grid/grid_out.cc @@ -2170,7 +2170,7 @@ GridOut::write_svg(const Triangulation<2, 2> &tria, std::ostream &out) const auto subdomains_it = subdomains.begin(); auto level_subdomains_it = level_subdomains.begin(); - for (unsigned int index = 0; index < n; index++) + for (unsigned int index = 0; index < n; ++index) { double h; @@ -2944,7 +2944,7 @@ GridOut::write_svg(const Triangulation<2, 2> &tria, std::ostream &out) const auto subdomains_it = subdomains.begin(); auto level_subdomains_it = level_subdomains.begin(); - for (unsigned int index = 0; index < n; index++) + for (unsigned int index = 0; index < n; ++index) { switch (svg_flags.coloring) { diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index 08c648658f..4b37c3eb1f 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -342,8 +342,8 @@ namespace GridTools else { LAPACKFullMatrix J = LAPACKFullMatrix(dim); - for (unsigned int i = 0; i < dim; i++) - for (unsigned int j = 0; j < dim; j++) + for (unsigned int i = 0; i < dim; ++i) + for (unsigned int j = 0; j < dim; ++j) J(i, j) = jacobian[i][j]; J.compute_svd(); @@ -2484,7 +2484,7 @@ namespace GridTools // For all remaining vertices, test // whether they are any closer - for (unsigned int j = best_vertex + 1; j < vertices.size(); j++) + for (unsigned int j = best_vertex + 1; j < vertices.size(); ++j) if (vertices_to_use[j]) { const double dist = (p - vertices[j]).norm_square(); @@ -6709,7 +6709,7 @@ namespace GridTools std::array, n_lines> vertex_list_reduced; std::array local_remap; std::fill(local_remap.begin(), local_remap.end(), X); - for (int i = 0; new_line_table[configuration][i] != X; i++) + for (int i = 0; new_line_table[configuration][i] != X; ++i) if (local_remap[new_line_table[configuration][i]] == X) { vertex_list_reduced[local_vertex_count] = @@ -6720,7 +6720,7 @@ namespace GridTools // write back vertices const unsigned int n_vertices_old = vertices.size(); - for (unsigned int i = 0; i < local_vertex_count; i++) + for (unsigned int i = 0; i < local_vertex_count; ++i) vertices.push_back(vertex_list_reduced[i]); // write back cells diff --git a/source/grid/grid_tools_dof_handlers.cc b/source/grid/grid_tools_dof_handlers.cc index 371ded1a76..9a8cf26e33 100644 --- a/source/grid/grid_tools_dof_handlers.cc +++ b/source/grid/grid_tools_dof_handlers.cc @@ -112,7 +112,7 @@ namespace GridTools // For all remaining vertices, test // whether they are any closer - for (unsigned int j = best_vertex + 1; j < vertices.size(); j++) + for (unsigned int j = best_vertex + 1; j < vertices.size(); ++j) if (used[j]) { double dist = (p - vertices[j]).norm_square(); diff --git a/source/grid/manifold_lib.cc b/source/grid/manifold_lib.cc index ad2fb12e1a..052718befa 100644 --- a/source/grid/manifold_lib.cc +++ b/source/grid/manifold_lib.cc @@ -825,7 +825,7 @@ SphericalManifold::guess_new_point( // Perform a simple average ... double total_weights = 0.; - for (unsigned int i = 0; i < directions.size(); i++) + for (unsigned int i = 0; i < directions.size(); ++i) { // if one weight is one, return its direction if (std::abs(1 - weights[i]) < tolerance) diff --git a/source/grid/tria.cc b/source/grid/tria.cc index 57b6da92e2..2b8925bdcf 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -13963,7 +13963,7 @@ template bool Triangulation::has_hanging_nodes() const { - for (unsigned int lvl = 0; lvl < n_global_levels() - 1; lvl++) + for (unsigned int lvl = 0; lvl < n_global_levels() - 1; ++lvl) if (n_active_cells(lvl) != 0) return true; diff --git a/source/grid/tria_accessor.cc b/source/grid/tria_accessor.cc index aacd4828e9..16e6858d63 100644 --- a/source/grid/tria_accessor.cc +++ b/source/grid/tria_accessor.cc @@ -1903,7 +1903,7 @@ CellAccessor<3>::point_inside(const Point<3> &p) const // rule out points outside the // bounding box of this cell - for (unsigned int d = 0; d < dim; d++) + for (unsigned int d = 0; d < dim; ++d) if ((p[d] < minp[d]) || (p[d] > maxp[d])) return false; diff --git a/source/lac/slepc_solver.cc b/source/lac/slepc_solver.cc index 19ec32474a..5d4118f7aa 100644 --- a/source/lac/slepc_solver.cc +++ b/source/lac/slepc_solver.cc @@ -206,7 +206,7 @@ namespace SLEPcWrappers AssertThrow(ierr == 0, ExcSLEPcError(ierr)); // get the maximum of residual norm among converged eigenvectors. - for (unsigned int i = 0; i < *n_converged; i++) + for (unsigned int i = 0; i < *n_converged; ++i) { double residual_norm_i = 0.0; // EPSComputeError (or, in older versions of SLEPc, diff --git a/source/lac/sparsity_pattern.cc b/source/lac/sparsity_pattern.cc index 94437de1df..e9fc4d1590 100644 --- a/source/lac/sparsity_pattern.cc +++ b/source/lac/sparsity_pattern.cc @@ -708,7 +708,7 @@ SparsityPatternBase::add(const size_type i, const size_type j) AssertIndexRange(j, cols); Assert(compressed == false, ExcMatrixIsCompressed()); - for (std::size_t k = rowstart[i]; k < rowstart[i + 1]; k++) + for (std::size_t k = rowstart[i]; k < rowstart[i + 1]; ++k) { // entry already exists if (colnums[k] == j) @@ -743,7 +743,7 @@ SparsityPattern::add_entries(const size_type row, bool has_larger_entries = false; // skip diagonal std::size_t k = rowstart[row] + store_diagonal_first_in_row; - for (; k < rowstart[row + 1]; k++) + for (; k < rowstart[row + 1]; ++k) if (colnums[k] == invalid_entry) break; else if (colnums[k] >= *it) diff --git a/source/lac/sparsity_tools.cc b/source/lac/sparsity_tools.cc index 5f297c05d1..3bc1ecd538 100644 --- a/source/lac/sparsity_tools.cc +++ b/source/lac/sparsity_tools.cc @@ -210,7 +210,7 @@ namespace SparsityTools // set global degrees of freedom auto n_dofs = graph->n_rows(); - for (unsigned int i = 0; i < n_dofs; i++) + for (unsigned int i = 0; i < n_dofs; ++i) { globalID[i] = i; localID[i] = i; // Same as global ids. @@ -388,7 +388,7 @@ namespace SparsityTools // copy from export_to_part to partition_indices, whose part_ids != 0. Assert(export_to_part != nullptr, ExcInternalError()); - for (int i = 0; i < num_export; i++) + for (int i = 0; i < num_export; ++i) partition_indices[export_local_ids[i]] = export_to_part[i]; #endif } @@ -494,7 +494,7 @@ namespace SparsityTools std::vector color_exp(num_objects); // Set ids for which coloring needs to be done - for (int i = 0; i < num_objects; i++) + for (int i = 0; i < num_objects; ++i) global_ids[i] = i; // Call ZOLTAN coloring algorithm diff --git a/source/matrix_free/dof_info.cc b/source/matrix_free/dof_info.cc index f445e34f1e..7c249bd461 100644 --- a/source/matrix_free/dof_info.cc +++ b/source/matrix_free/dof_info.cc @@ -176,7 +176,7 @@ namespace internal types::global_dof_index last_contiguous_start = ghost_origin[0].first; ghost_numbering[ghost_origin[0].second] = 0; - for (std::size_t i = 1; i < n_ghosts; i++) + for (std::size_t i = 1; i < n_ghosts; ++i) { if (ghost_origin[i].first > ghost_origin[i - 1].first + 1) { diff --git a/source/matrix_free/task_info.cc b/source/matrix_free/task_info.cc index 2a15805aa8..bc0ccbc0a6 100644 --- a/source/matrix_free/task_info.cc +++ b/source/matrix_free/task_info.cc @@ -153,7 +153,7 @@ namespace internal std::vector blocked_worker(n_blocked_workers); root->set_ref_count(evens + 1); - for (unsigned int j = 0; j < evens; j++) + for (unsigned int j = 0; j < evens; ++j) { worker[j] = new (root->allocate_child()) CellWork(function, @@ -357,7 +357,7 @@ namespace internal MPICommunication *worker_compr = new (root->allocate_child()) MPICommunication(funct, true); worker_compr->set_ref_count(1); - for (unsigned int j = 0; j < evens; j++) + for (unsigned int j = 0; j < evens; ++j) { if (j > 0) { @@ -1232,7 +1232,7 @@ namespace internal unsigned int mcell_start = 0; block_start[0] = 0; - for (unsigned int block = 0; block < n_blocks; block++) + for (unsigned int block = 0; block < n_blocks; ++block) { block_start[block + 1] = block_start[block]; for (unsigned int mcell = mcell_start; @@ -1255,7 +1255,7 @@ namespace internal block_size_last = block_size; unsigned int tick = 0; - for (unsigned int block = 0; block < n_blocks; block++) + for (unsigned int block = 0; block < n_blocks; ++block) { unsigned int present_block = partition_color_list[block]; for (unsigned int cell = block_start[present_block]; @@ -1270,7 +1270,7 @@ namespace internal if (cell_partition_data[tick] == block) cell_partition_data[tick++] = counter_macro; - for (unsigned int j = 0; j < this_block_size; j++) + for (unsigned int j = 0; j < this_block_size; ++j) irregular[counter_macro++] = irregular_cells[present_block * block_size + j]; } @@ -1414,7 +1414,7 @@ namespace internal // This is the simple case. The renumbering is just a combination of // the renumbering that we were given as an input and the // renumbering of partition/coloring given in partition_2layers_list - for (unsigned int j = 0; j < renumbering.size(); j++) + for (unsigned int j = 0; j < renumbering.size(); ++j) renumbering[j] = renumbering_in[partition_2layers_list[j]]; // Account for the ghost cells, finally. for (unsigned int i = 0; i < n_ghost_cells; ++i) @@ -1430,7 +1430,7 @@ namespace internal unsigned int counter = 0; unsigned int mcell_start = 0; block_start[0] = 0; - for (unsigned int block = 0; block < n_blocks; block++) + for (unsigned int block = 0; block < n_blocks; ++block) { block_start[block + 1] = block_start[block]; for (unsigned int mcell = mcell_start; @@ -1453,7 +1453,7 @@ namespace internal block_size_last = block_size; unsigned int tick = 0; - for (unsigned int block = 0; block < n_blocks; block++) + for (unsigned int block = 0; block < n_blocks; ++block) { unsigned int present_block = partition_2layers_list[block]; for (unsigned int cell = block_start[present_block]; @@ -1468,7 +1468,7 @@ namespace internal if (cell_partition_data[tick] == block) cell_partition_data[tick++] = counter_macro; - for (unsigned int j = 0; j < this_block_size; j++) + for (unsigned int j = 0; j < this_block_size; ++j) irregular[counter_macro++] = irregular_cells[present_block * block_size + j]; } @@ -1552,7 +1552,7 @@ namespace internal partition_list.swap(renumbering); - for (unsigned int j = 0; j < renumbering.size(); j++) + for (unsigned int j = 0; j < renumbering.size(); ++j) renumbering[j] = partition_list[partition_partition_list[j]]; for (unsigned int i = 0; i < n_ghost_cells; ++i) @@ -1751,7 +1751,7 @@ namespace internal .push_back(partition_partition_list[cell]); } // check how many more cells are needed in the lists - for (unsigned int j = 0; j < max_fe_index + 1; j++) + for (unsigned int j = 0; j < max_fe_index + 1; ++j) { remaining_per_cell_batch[j] = renumbering_fe_index[j].size() % @@ -1876,7 +1876,7 @@ namespace internal // index within one partition-partition which was // implicitly assumed above cell = counter - partition_counter; - for (unsigned int j = 0; j < max_fe_index + 1; j++) + for (unsigned int j = 0; j < max_fe_index + 1; ++j) { for (const unsigned int jj : renumbering_fe_index[j]) @@ -1944,7 +1944,7 @@ namespace internal partition_row_index.resize(partition + 1); cell_partition_data.clear(); unsigned int color_counter = 0, index_counter = 0; - for (unsigned int part = 0; part < partition; part++) + for (unsigned int part = 0; part < partition; ++part) { partition_row_index[part] = index_counter; unsigned int max_color = 0; @@ -1981,7 +1981,7 @@ namespace internal // Reorder within partition: First, all blocks that belong the 0 and // then so on until those with color max (Note that the smaller the // number the larger the partition) - for (unsigned int color = 0; color <= max_color; color++) + for (unsigned int color = 0; color <= max_color; ++color) { cell_partition_data.push_back(color_counter); index_counter++; @@ -2245,7 +2245,7 @@ namespace internal partition_odds.resize(partition); partition_n_blocked_workers.resize(partition); partition_n_workers.resize(partition); - for (unsigned int part = 0; part < partition; part++) + for (unsigned int part = 0; part < partition; ++part) { partition_evens[part] = (partition_row_index[part + 1] - partition_row_index[part] + 1) / 2; diff --git a/source/matrix_free/vector_data_exchange.cc b/source/matrix_free/vector_data_exchange.cc index 842f18e4aa..c8adede572 100644 --- a/source/matrix_free/vector_data_exchange.cc +++ b/source/matrix_free/vector_data_exchange.cc @@ -332,7 +332,7 @@ namespace internal std::vector recv_indices; std::vector recv_len; - for (unsigned int i = 0; i + 1 < sm_export_ptr.size(); i++) + for (unsigned int i = 0; i + 1 < sm_export_ptr.size(); ++i) { if (sm_export_ptr[i] != sm_export_ptr[i + 1]) { @@ -459,7 +459,7 @@ namespace internal std::map> rank_to_local_indices; - for (unsigned int i = 0; i < owning_ranks_of_ghosts.size(); i++) + for (unsigned int i = 0; i < owning_ranks_of_ghosts.size(); ++i) rank_to_local_indices[owning_ranks_of_ghosts[i]].push_back(i); unsigned int compressed_offset = 0; @@ -575,7 +575,7 @@ namespace internal std::vector requests(sm_ghost_ranks.size() + sm_import_ranks.size()); - for (unsigned int i = 0; i < sm_ghost_ranks.size(); i++) + for (unsigned int i = 0; i < sm_ghost_ranks.size(); ++i) { const int ierr = MPI_Isend(sm_export_data_this_indices.data() + sm_export_data_this_ptr[i], @@ -589,7 +589,7 @@ namespace internal AssertThrowMPI(ierr); } - for (unsigned int i = 0; i < sm_import_ranks.size(); i++) + for (unsigned int i = 0; i < sm_import_ranks.size(); ++i) { const int ierr = MPI_Irecv(sm_import_data_indices.data() + sm_import_data_ptr[i], @@ -612,7 +612,7 @@ namespace internal std::vector requests(sm_import_ranks.size() + sm_ghost_ranks.size()); - for (unsigned int i = 0; i < sm_import_ranks.size(); i++) + for (unsigned int i = 0; i < sm_import_ranks.size(); ++i) { const int ierr = MPI_Isend(sm_import_data_this_indices.data() + sm_import_data_this_ptr[i], @@ -626,7 +626,7 @@ namespace internal AssertThrowMPI(ierr); } - for (unsigned int i = 0; i < sm_ghost_ranks.size(); i++) + for (unsigned int i = 0; i < sm_ghost_ranks.size(); ++i) { const int ierr = MPI_Irecv(sm_export_data_indices.data() + sm_export_data_ptr[i], @@ -860,7 +860,7 @@ namespace internal int dummy; // receive a signal that relevant sm neighbors are ready - for (unsigned int i = 0; i < sm_ghost_ranks.size(); i++) + for (unsigned int i = 0; i < sm_ghost_ranks.size(); ++i) { const int ierr = MPI_Irecv(&dummy, @@ -874,7 +874,7 @@ namespace internal } // signal to all relevant sm neighbors that this process is ready - for (unsigned int i = 0; i < sm_import_ranks.size(); i++) + for (unsigned int i = 0; i < sm_import_ranks.size(); ++i) { const int ierr = MPI_Isend(&dummy, 0, @@ -887,7 +887,7 @@ namespace internal } // receive data from remote processes - for (unsigned int i = 0; i < ghost_targets_data.size(); i++) + for (unsigned int i = 0; i < ghost_targets_data.size(); ++i) { const unsigned int offset = n_ghost_indices_in_larger_set_by_remote_rank[i] - @@ -906,7 +906,7 @@ namespace internal } // send data to remote processes - for (unsigned int i = 0, k = 0; i < import_targets_data.size(); i++) + for (unsigned int i = 0, k = 0; i < import_targets_data.size(); ++i) { for (unsigned int j = import_indices_data.first[i]; j < import_indices_data.first[i + 1]; @@ -1107,7 +1107,7 @@ namespace internal ghost_targets_data.size() + import_targets_data.size()); int dummy; - for (unsigned int i = 0; i < sm_ghost_ranks.size(); i++) + for (unsigned int i = 0; i < sm_ghost_ranks.size(); ++i) { const int ierr = MPI_Isend(&dummy, 0, @@ -1119,7 +1119,7 @@ namespace internal AssertThrowMPI(ierr); } - for (unsigned int i = 0; i < sm_import_ranks.size(); i++) + for (unsigned int i = 0; i < sm_import_ranks.size(); ++i) { const int ierr = MPI_Irecv(&dummy, @@ -1132,7 +1132,7 @@ namespace internal AssertThrowMPI(ierr); } - for (unsigned int i = 0; i < ghost_targets_data.size(); i++) + for (unsigned int i = 0; i < ghost_targets_data.size(); ++i) { for (unsigned int c = 0, ko = ghost_indices_subset_data.first[i], @@ -1182,7 +1182,7 @@ namespace internal AssertThrowMPI(ierr); } - for (unsigned int i = 0; i < import_targets_data.size(); i++) + for (unsigned int i = 0; i < import_targets_data.size(); ++i) { const int ierr = MPI_Irecv( temporary_storage.data() + import_targets_data[i][1], diff --git a/source/multigrid/mg_transfer_internal.cc b/source/multigrid/mg_transfer_internal.cc index d45879149d..3bed763b93 100644 --- a/source/multigrid/mg_transfer_internal.cc +++ b/source/multigrid/mg_transfer_internal.cc @@ -287,7 +287,7 @@ namespace internal AssertThrow(level_dof_indices.size() == index_owner.size(), ExcMessage("Size does not match!")); - for (unsigned int i = 0; i < index_owner.size(); i++) + for (unsigned int i = 0; i < index_owner.size(); ++i) send_data[index_owner[i]].emplace_back(level, global_dof_indices[i], level_dof_indices[i]); diff --git a/source/multigrid/mg_transfer_matrix_free.cc b/source/multigrid/mg_transfer_matrix_free.cc index e15f327f0e..ab2ef052be 100644 --- a/source/multigrid/mg_transfer_matrix_free.cc +++ b/source/multigrid/mg_transfer_matrix_free.cc @@ -151,7 +151,7 @@ MGTransferMatrixFree::build( // duplicate and put into vectorized array prolongation_matrix_1d.resize(elem_info.prolongation_matrix_1d.size()); - for (unsigned int i = 0; i < elem_info.prolongation_matrix_1d.size(); i++) + for (unsigned int i = 0; i < elem_info.prolongation_matrix_1d.size(); ++i) prolongation_matrix_1d[i] = elem_info.prolongation_matrix_1d[i]; // reshuffle into aligned vector of vectorized arrays diff --git a/source/non_matching/quadrature_generator.cc b/source/non_matching/quadrature_generator.cc index 4680dd8536..7588e76e7e 100644 --- a/source/non_matching/quadrature_generator.cc +++ b/source/non_matching/quadrature_generator.cc @@ -350,7 +350,7 @@ namespace NonMatching const BoundingBox & box, ExtendableQuadrature &quadrature) { - for (unsigned int i = 0; i < unit_quadrature.size(); i++) + for (unsigned int i = 0; i < unit_quadrature.size(); ++i) { const Point point = box.unit_to_real(unit_quadrature.point(i)); const double weight = unit_quadrature.weight(i) * box.volume(); @@ -846,7 +846,7 @@ namespace NonMatching , low_dim_algorithm(q_collection1D, additional_data) , up_through_dimension_creator(q_collection1D, additional_data) { - for (unsigned int i = 0; i < q_collection1D.size(); i++) + for (unsigned int i = 0; i < q_collection1D.size(); ++i) tensor_products.push_back(Quadrature(q_collection1D[i])); } @@ -945,7 +945,7 @@ namespace NonMatching { // Get the side lengths for each direction and sort them. std::array, dim> side_lengths; - for (int i = 0; i < dim; i++) + for (int i = 0; i < dim; ++i) { side_lengths[i].first = box.side_length(i); side_lengths[i].second = i; @@ -1398,7 +1398,7 @@ namespace NonMatching std::vector> normals; normals.reserve(surface_quadrature_wrong_normal.size()); - for (unsigned int i = 0; i < surface_quadrature_wrong_normal.size(); i++) + for (unsigned int i = 0; i < surface_quadrature_wrong_normal.size(); ++i) { const Point point = dealii::internal::create_higher_dim_point( surface_quadrature_wrong_normal.point(i), diff --git a/source/numerics/point_value_history.cc b/source/numerics/point_value_history.cc index 79575ef9e7..4571d27ba7 100644 --- a/source/numerics/point_value_history.cc +++ b/source/numerics/point_value_history.cc @@ -245,7 +245,7 @@ PointValueHistory::add_point(const Point &location) // efficient than find_active_cell_around_point // because it operates on a set of points. - for (; cell != endc; cell++) + for (; cell != endc; ++cell) { fe_values.reinit(cell); @@ -394,7 +394,7 @@ PointValueHistory::add_points(const std::vector> &locations) // may be slightly more // efficient than find_active_cell_around_point // because it operates on a set of points. - for (; cell != endc; cell++) + for (; cell != endc; ++cell) { fe_values.reinit(cell); for (unsigned int support_point = 0; support_point < n_support_points; @@ -406,7 +406,7 @@ PointValueHistory::add_points(const std::vector> &locations) const Point &test_point = fe_values.quadrature_point(support_point); - for (unsigned int point = 0; point < locations.size(); point++) + for (unsigned int point = 0; point < locations.size(); ++point) { if (locations[point].distance(test_point) < locations[point].distance(current_points[point][component])) @@ -422,7 +422,7 @@ PointValueHistory::add_points(const std::vector> &locations) std::vector local_dof_indices( dof_handler->get_fe().n_dofs_per_cell()); - for (unsigned int point = 0; point < locations.size(); point++) + for (unsigned int point = 0; point < locations.size(); ++point) { current_cell[point]->get_dof_indices(local_dof_indices); std::vector new_solution_indices; @@ -730,7 +730,7 @@ PointValueHistory::evaluate_field( fe_values.get_quadrature_points(); double distance = cell->diameter(); unsigned int selected_point = 0; - for (unsigned int q_point = 0; q_point < n_quadrature_points; q_point++) + for (unsigned int q_point = 0; q_point < n_quadrature_points; ++q_point) { if (requested_location.distance(quadrature_points[q_point]) < distance) @@ -988,7 +988,7 @@ PointValueHistory::push_back_independent( static_cast(independent_values[0].size())) < 2, ExcDataLostSync()); - for (unsigned int component = 0; component < n_indep; component++) + for (unsigned int component = 0; component < n_indep; ++component) independent_values[component].push_back(indep_values[component]); } @@ -1025,18 +1025,18 @@ PointValueHistory::write_gnuplot( } else { - for (unsigned int component = 0; component < n_indep; component++) + for (unsigned int component = 0; component < n_indep; ++component) { to_gnuplot << " "; } to_gnuplot << "\n"; } // write general data stored - for (unsigned int key = 0; key < dataset_key.size(); key++) + for (unsigned int key = 0; key < dataset_key.size(); ++key) { to_gnuplot << dataset_key[key]; - for (unsigned int component = 0; component < n_indep; component++) + for (unsigned int component = 0; component < n_indep; ++component) { to_gnuplot << " " << independent_values[component][key]; } @@ -1128,7 +1128,7 @@ PointValueHistory::write_gnuplot( } else { - for (unsigned int component = 0; component < n_indep; component++) + for (unsigned int component = 0; component < n_indep; ++component) { to_gnuplot << " "; } @@ -1164,11 +1164,11 @@ PointValueHistory::write_gnuplot( to_gnuplot << "\n"; // write data stored for the point - for (unsigned int key = 0; key < dataset_key.size(); key++) + for (unsigned int key = 0; key < dataset_key.size(); ++key) { to_gnuplot << dataset_key[key]; - for (unsigned int component = 0; component < n_indep; component++) + for (unsigned int component = 0; component < n_indep; ++component) { to_gnuplot << " " << independent_values[component][key]; } @@ -1287,7 +1287,7 @@ PointValueHistory::get_postprocessor_locations( double distance = cell->diameter(); unsigned int selected_point = 0; - for (unsigned int q_point = 0; q_point < n_quadrature_points; q_point++) + for (unsigned int q_point = 0; q_point < n_quadrature_points; ++q_point) { if (requested_location.distance(evaluation_points[q_point]) < distance) diff --git a/source/numerics/smoothness_estimator.cc b/source/numerics/smoothness_estimator.cc index 8438ddf13d..5ec60c3c57 100644 --- a/source/numerics/smoothness_estimator.cc +++ b/source/numerics/smoothness_estimator.cc @@ -55,7 +55,7 @@ namespace SmoothnessEstimator resize(Table &coeff, const unsigned int N) { TableIndices size; - for (unsigned int d = 0; d < dim; d++) + for (unsigned int d = 0; d < dim; ++d) size[d] = N; coeff.reinit(size); } -- 2.39.5