From bad3b05766bd80c3b0fe4d657c2966d804f431bf Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 8 Mar 2023 20:11:35 -0700 Subject: [PATCH] Use better variable names in step-69. --- examples/step-69/step-69.cc | 44 ++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/examples/step-69/step-69.cc b/examples/step-69/step-69.cc index c013a95546..92f9e3951c 100644 --- a/examples/step-69/step-69.cc +++ b/examples/step-69/step-69.cc @@ -1222,9 +1222,10 @@ namespace Step69 // - The iterator indices.begin() points to a row index. // - The iterator indices.end() points to a numerically higher // row index. - // - The function on_subranges(i1,i2) (where i1 - // and i2 define a sub-range within the range spanned by - // the end and begin iterators defined in the two previous bullets) + // - The function on_subranges(index_begin, index_end) + // (where index_begin and index_end + // define a sub-range within the range spanned by + // the begin and end iterators defined in the two previous bullets) // applies an operation to every iterator in such subrange. We may as // well call on_subranges the "worker". // - Grainsize: minimum number of iterators (in this case representing @@ -1271,10 +1272,10 @@ namespace Step69 0, n_locally_relevant); const auto on_subranges = // - [&](const auto i1, const auto i2) { + [&](const auto index_begin, const auto index_end) { for (const auto row_index : - std_cxx20::ranges::iota_view(*i1, - *i2)) + std_cxx20::ranges::iota_view( + *index_begin, *index_end)) { // First column-loop: we compute and store the entries of the // matrix norm_matrix and write normalized entries into the @@ -1810,17 +1811,17 @@ namespace Step69 // nij_matrix above are used here again. // // We define again a "worker" function on_subranges that - // computes the viscosity $d_{ij}$ for a subrange [i1, i2) of column - // indices: + // computes the viscosity $d_{ij}$ for a subrange `[*index_begin, + // *index_end)` of column indices: { TimerOutput::Scope scope(computing_timer, "time_stepping - 1 compute d_ij"); const auto on_subranges = // - [&](const auto i1, const auto i2) { + [&](const auto index_begin, const auto index_end) { for (const auto i : - std_cxx20::ranges::iota_view(*i1, - *i2)) + std_cxx20::ranges::iota_view( + *index_begin, *index_end)) { const auto U_i = gather(U, i); @@ -1913,12 +1914,12 @@ namespace Step69 // locally. const auto on_subranges = // - [&](const auto i1, const auto i2) { + [&](const auto index_begin, const auto index_end) { double tau_max_on_subrange = std::numeric_limits::infinity(); for (const auto i : - std_cxx20::ranges::iota_view(*i1, - *i2)) + std_cxx20::ranges::iota_view( + *index_begin, *index_end)) { double d_sum = 0.; @@ -1999,8 +2000,9 @@ namespace Step69 "time_stepping - 3 perform update"); const auto on_subranges = // - [&](const auto i1, const auto i2) { - for (const auto i : boost::make_iterator_range(i1, i2)) + [&](const auto index_begin, const auto index_end) { + for (const auto i : + boost::make_iterator_range(index_begin, index_end)) { Assert(i < n_locally_owned, ExcInternalError()); @@ -2249,11 +2251,12 @@ namespace Step69 // global maxima and minima of the gradients. { const auto on_subranges = // - [&](const auto i1, const auto i2) { + [&](const auto index_begin, const auto index_end) { double r_i_max_on_subrange = 0.; double r_i_min_on_subrange = std::numeric_limits::infinity(); - for (const auto i : boost::make_iterator_range(i1, i2)) + for (const auto i : + boost::make_iterator_range(index_begin, index_end)) { Assert(i < n_locally_owned, ExcInternalError()); @@ -2333,8 +2336,9 @@ namespace Step69 { const auto on_subranges = // - [&](const auto i1, const auto i2) { - for (const auto i : boost::make_iterator_range(i1, i2)) + [&](const auto index_begin, const auto index_end) { + for (const auto i : + boost::make_iterator_range(index_begin, index_end)) { Assert(i < n_locally_owned, ExcInternalError()); -- 2.39.5