]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix clang-tidy complaints 15422/head
authorDaniel Arndt <arndtd@ornl.gov>
Wed, 21 Jun 2023 20:26:43 +0000 (16:26 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Wed, 21 Jun 2023 20:26:43 +0000 (16:26 -0400)
examples/step-36/step-36.cc
examples/step-71/step-71.cc
include/deal.II/differentiation/sd/symengine_number_visitor_internal.h
include/deal.II/differentiation/sd/symengine_optimizer.h
source/differentiation/sd/symengine_number_types.cc
source/differentiation/sd/symengine_utilities.cc
source/opencascade/manifold_lib.cc
source/sundials/ida.cc

index c72cd33c852dd037a32aff49f0075522e6a2e0c8..5032992fb59a23aaa8b01a2b2e04a8b186f60acf 100644 (file)
@@ -211,8 +211,8 @@ namespace Step36
     IndexSet eigenfunction_index_set = dof_handler.locally_owned_dofs();
     eigenfunctions.resize(
       parameters.get_integer("Number of eigenvalues/eigenfunctions"));
-    for (unsigned int i = 0; i < eigenfunctions.size(); ++i)
-      eigenfunctions[i].reinit(eigenfunction_index_set, MPI_COMM_WORLD);
+    for (auto &eigenfunction : eigenfunctions)
+      eigenfunction.reinit(eigenfunction_index_set, MPI_COMM_WORLD);
 
     eigenvalues.resize(eigenfunctions.size());
   }
@@ -384,8 +384,8 @@ namespace Step36
     // does not necessarily have to be attained at a node, and so
     // $\max_{\mathbf x}\phi_i(\mathbf x)\ge\max_j (\Phi_i)_j$ (although the
     // equality is usually nearly true).
-    for (unsigned int i = 0; i < eigenfunctions.size(); ++i)
-      eigenfunctions[i] /= eigenfunctions[i].linfty_norm();
+    for (auto &eigenfunction : eigenfunctions)
+      eigenfunction /= eigenfunction.linfty_norm();
 
     // Finally return the number of iterations it took to converge:
     return solver_control.last_step();
index da0f91306c8b749e4197ea1bce30734a2a4c2239..9c8310e3305e3fa0bae3e70eb3c1a726f4b7f45d 100644 (file)
@@ -3799,9 +3799,9 @@ namespace Step71
       Coupled_Magnetomechanical_Constitutive_Law_Base<dim>
         &material_hand_calculated,
       Coupled_Magnetomechanical_Constitutive_Law_Base<dim>
-        &               material_assisted_computation,
-      TimerOutput &     timer,
-      const std::string filename)
+        &                material_assisted_computation,
+      TimerOutput &      timer,
+      const std::string &filename)
     {
       // We can take the hand-implemented constitutive law and compare the
       // results that we attain with it to those that we get using AD or SD.
index 232a341cd1afd07ec7438f2cb0b6ebc40d69d683..4515c78cda9da02b177e095ffaa3f63c8e4a6295 100644 (file)
@@ -664,12 +664,12 @@ namespace Differentiation
 
         // ... followed by any intermediate evaluations due to the application
         // of CSE. These are fed directly back into the substitution map...
-        for (unsigned i = 0; i < intermediate_symbols_exprs.size(); ++i)
+        for (const auto &expression : intermediate_symbols_exprs)
           {
             const SymEngine::RCP<const SymEngine::Basic> &cse_symbol =
-              intermediate_symbols_exprs[i].first;
+              expression.first;
             const SymEngine::RCP<const SymEngine::Basic> &cse_expr =
-              intermediate_symbols_exprs[i].second;
+              expression.second;
             Assert(substitution_value_map.find(cse_symbol) ==
                      substitution_value_map.end(),
                    ExcMessage(
index 424bf78ec119b1bce628828073ea77e2162b6a2a..8bd56698d9c3d4d4541834ba866644e12074c20d 100644 (file)
@@ -1484,7 +1484,7 @@ namespace Differentiation
       /**
        * Move constructor.
        */
-      BatchOptimizer(BatchOptimizer &&) = default;
+      BatchOptimizer(BatchOptimizer &&) noexcept = default;
 
       /**
        * Destructor.
index ce828f1d87e8cb1239cf4bc419c6e52ee890fb7c..635f4521ff1e5927d17430d2152a777780d93d04 100644 (file)
@@ -104,7 +104,7 @@ namespace Differentiation
         {expression_otherwise.get_RCP(), SE::boolTrue});
 
       // Initialize
-      expression = SE::piecewise(std::move(piecewise_function));
+      expression = SE::piecewise(piecewise_function);
     }
 
 
index 182520a8b1359bc10e2f1a7f1b7f711645df168b..b58dc67d3af6c419cf4c3a50d3d35e3f328d042d 100644 (file)
@@ -103,8 +103,8 @@ namespace Differentiation
         std::vector<std::pair<SD::Expression, SD::Expression>> symb_val_vec;
         symb_val_vec.reserve(symbol_value_vector.size());
         for (const auto &entry : symbol_value_vector)
-          symb_val_vec.push_back(std::make_pair(SD::Expression(entry.first),
-                                                SD::Expression(entry.second)));
+          symb_val_vec.emplace_back(SD::Expression(entry.first),
+                                    SD::Expression(entry.second));
         return symb_val_vec;
       }
 
index c2640d373d19d970d77cc9fb7693cfae3dbb32c8..c3baa00875925ec7bae0cf8e49ccf36bc9597a20 100644 (file)
@@ -236,13 +236,11 @@ namespace OpenCASCADE
       TopoDS_Shape        out_shape;
       Tensor<1, spacedim> average_normal;
 #  ifdef DEBUG
-      for (unsigned int i = 0; i < surrounding_points.size(); ++i)
+      for (const auto &point : surrounding_points)
         {
-          Assert(closest_point(sh, surrounding_points[i], tolerance)
-                     .distance(surrounding_points[i]) <
-                   std::max(tolerance * surrounding_points[i].norm(),
-                            tolerance),
-                 ExcPointNotOnManifold<spacedim>(surrounding_points[i]));
+          Assert(closest_point(sh, point, tolerance).distance(point) <
+                   std::max(tolerance * point.norm(), tolerance),
+                 ExcPointNotOnManifold<spacedim>(point));
         }
 #  endif
 
@@ -250,11 +248,13 @@ namespace OpenCASCADE
         {
           case 2:
             {
-              for (unsigned int i = 0; i < surrounding_points.size(); ++i)
+              for (const auto &point : surrounding_points)
                 {
                   std::tuple<Point<3>, Tensor<1, 3>, double, double>
-                    p_and_diff_forms = closest_point_and_differential_forms(
-                      sh, surrounding_points[i], tolerance);
+                    p_and_diff_forms =
+                      closest_point_and_differential_forms(sh,
+                                                           point,
+                                                           tolerance);
                   average_normal += std::get<1>(p_and_diff_forms);
                 }
 
index f05c6bdbdba54c96bbd7d740fbdc87fc868ae7ae..98b04474caae3e663997a5dfe1ab28be69bbca39 100644 (file)
@@ -278,9 +278,8 @@ namespace SUNDIALS
       {
         VectorType diff_comp_vector(solution);
         diff_comp_vector = 0.0;
-        auto dc          = differential_components();
-        for (auto i = dc.begin(); i != dc.end(); ++i)
-          diff_comp_vector[*i] = 1.0;
+        for (const auto &component : differential_components())
+          diff_comp_vector[component] = 1.0;
         diff_comp_vector.compress(VectorOperation::insert);
 
         const auto diff_id = internal::make_nvector_view(diff_comp_vector

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.