]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Update clang-tidy checks for recent clang versions
authorDaniel Arndt <arndtd@ornl.gov>
Mon, 9 Jan 2023 14:45:16 +0000 (09:45 -0500)
committerDaniel Arndt <arndtd@ornl.gov>
Mon, 9 Jan 2023 15:23:45 +0000 (10:23 -0500)
14 files changed:
.clang-tidy
bundled/.clang-tidy
include/deal.II/base/mpi_consensus_algorithms.h
include/deal.II/base/parameter_handler.h
include/deal.II/numerics/data_out_dof_data.templates.h
source/base/qprojector.cc
source/distributed/tria_base.cc
source/dofs/dof_tools.cc
source/fe/mapping_q.cc
source/grid/grid_generator.cc
source/grid/grid_tools.cc
source/lac/sparsity_tools.cc
source/multigrid/mg_transfer_internal.cc
source/numerics/time_dependent.cc

index 7532f07a2ed98e04042a525c2bdf7244674263f8..8c31e2638a0b9e22f93cde14c3edb04f3f2bd7ab 100644 (file)
 Checks: >
   -*,
   cppcoreguidelines-pro-type-static-cast-downcast,
-  google-readability-casting,
+  cppcoreguidelines-pro-type-cstyle-cast,
   modernize-*,
   -modernize-avoid-c-arrays,
   -modernize-concat-nested-namespaces,
   -modernize-pass-by-value,
   -modernize-raw-string-literal,
+  -modernize-return-braced-init-list,
   -modernize-use-auto,
   -modernize-use-default-member-init,
   -modernize-use-nodiscard,
index eb40a98a77a045290831e5df0f48fe3591c25e76..9c0625aeff74cbd8c7c58b7a0e98b48d7a053b24 100644 (file)
@@ -2,5 +2,5 @@
 # bundled/. Clang-tidy fails if nothing is chosen, so we just enable a single
 # harmless warning:
 
-Checks: "-*,misc-sizeof-container"
+Checks: "-*,misc-definitions-in-headers"
 
index 066d4ec08ccf5ba9ec563dccddd455078dd3da32..6667de282647017dc188024d966359fd198cdd69 100644 (file)
@@ -1561,7 +1561,7 @@ namespace Utilities
           // MPI deadlock. Abort with a reasonable error message instead.
           try
             {
-              std::rethrow_exception(std::move(exception));
+              std::rethrow_exception(exception);
             }
           catch (ExceptionBase &exc)
             {
index 2ca043f2976b00084c9105aa1a6e04d3ad4b3466..f9935bb0e2e9a1b398bf4522696f5eac8d341860 100644 (file)
@@ -2299,6 +2299,7 @@ ParameterHandler::save(Archive &ar, const unsigned int) const
 
   std::vector<std::string> descriptions;
 
+  descriptions.reserve(patterns.size());
   for (const auto &pattern : patterns)
     descriptions.push_back(pattern->description());
 
index 71d069885a6b21aeef5d9917d56958df7c30f5c4..f203ae74a1d9e5eeddd141f60b47dd44de4e2f70 100644 (file)
@@ -1935,7 +1935,7 @@ DataOut_DoFData<dim, patch_dim, spacedim, patch_spacedim>::
              ExcMessage("The DoF handler attached to the current output vector "
                         "does not have any degrees of freedom, so it is not "
                         "possible to output DoF data in this context."));
-      const std::string  name         = names[0];
+      const std::string &name         = names[0];
       const unsigned int n_components = dof_handler->get_fe(0).n_components();
       deduced_names.resize(n_components);
       if (n_components > 1)
index 3c95d1c1cf5f033b0d70de563e5a5b0ba4039769..cafd48cf3d7da21014126e75764fe6f05d24618f 100644 (file)
@@ -891,7 +891,7 @@ QProjector<3>::project_to_all_faces(const ReferenceCell &     reference_cell,
         {
           SubQuadrature mutation;
 
-          const auto quadrature_f =
+          const auto &quadrature_f =
             quadrature[quadrature.size() == 1 ? 0 : face];
           switch (i)
             {
index 9da27f97520938832e4a0b30da1ccf0b156a64fc..1ee351481e5121e247b668a119f681f390b69365 100644 (file)
@@ -302,6 +302,7 @@ namespace parallel
     // Utilities::MPI::compute_set_union)
     std::vector<unsigned int> reference_cells_ui;
 
+    reference_cells_ui.reserve(this->reference_cells.size());
     for (const auto &i : this->reference_cells)
       reference_cells_ui.push_back(static_cast<unsigned int>(i));
 
index 252705ccedb19c4e8cdaa42b210c0f96b6d8bf5f..dd307b18bdf3af44e8f1dace4f7aed06c32358ba 100644 (file)
@@ -2757,7 +2757,7 @@ namespace DoFTools
     // all duplicates are ignored
     for (unsigned int i = 0; i < patch.size(); ++i)
       {
-        const typename DoFHandler<dim, spacedim>::active_cell_iterator cell =
+        const typename DoFHandler<dim, spacedim>::active_cell_iterator &cell =
           patch[i];
         Assert(cell->is_artificial() == false,
                ExcMessage("This function can not be called with cells that are "
@@ -2788,7 +2788,7 @@ namespace DoFTools
     // all duplicates are ignored
     for (unsigned int i = 0; i < patch.size(); ++i)
       {
-        const typename DoFHandler<dim, spacedim>::active_cell_iterator cell =
+        const typename DoFHandler<dim, spacedim>::active_cell_iterator &cell =
           patch[i];
         Assert(cell->is_artificial() == false,
                ExcMessage("This function can not be called with cells that are "
index c55cae5e07544103918bd912589b5951d555d55a..9760fb508d3ee0dbde20e117cd12a368e6563443 100644 (file)
@@ -123,7 +123,7 @@ MappingQ<dim, spacedim>::InternalData::initialize(
       // in all directions
       if (tensor_product_quadrature)
         {
-          const std::array<Quadrature<1>, dim> quad_array =
+          const std::array<Quadrature<1>, dim> &quad_array =
             q.get_tensor_basis();
           for (unsigned int i = 1; i < dim && tensor_product_quadrature; ++i)
             {
index 497d9506fd8222618ef4430176840f0dda3f9462..e1eed6e2927f602c6b1ec3f4f64e6ec4e68c0e72 100644 (file)
@@ -5505,14 +5505,14 @@ namespace GridGenerator
       {
         const double height = initial_height + height_increment * rep;
 
-        vertices.emplace_back(Point<3>(-d, height, -d));
-        vertices.emplace_back(Point<3>(d, height, -d));
-        vertices.emplace_back(Point<3>(-a, height, -a));
-        vertices.emplace_back(Point<3>(a, height, -a));
-        vertices.emplace_back(Point<3>(-a, height, a));
-        vertices.emplace_back(Point<3>(a, height, a));
-        vertices.emplace_back(Point<3>(-d, height, d));
-        vertices.emplace_back(Point<3>(d, height, d));
+        vertices.emplace_back(-d, height, -d);
+        vertices.emplace_back(d, height, -d);
+        vertices.emplace_back(-a, height, -a);
+        vertices.emplace_back(a, height, -a);
+        vertices.emplace_back(-a, height, a);
+        vertices.emplace_back(a, height, a);
+        vertices.emplace_back(-d, height, d);
+        vertices.emplace_back(d, height, d);
       }
 
     // Turn cylinder such that y->x
index 61f11d7902712c4ec39be5c464a9b779f8c6a38f..29461a2d23a65d7d9ce8abdf93188f3404b930a8 100644 (file)
@@ -5043,7 +5043,7 @@ namespace GridTools
          cell_ptr != distorted_cells.distorted_cells.end();
          ++cell_ptr)
       {
-        const typename Triangulation<dim, spacedim>::cell_iterator cell =
+        const typename Triangulation<dim, spacedim>::cell_iterator &cell =
           *cell_ptr;
 
         Assert(!cell->is_active(),
index 54835e47d8fffa22656ebd24f125e4ae68d034a9..e5bc4b86684614c720fc753dc47257c1c455fc3a 100644 (file)
@@ -621,9 +621,8 @@ namespace SparsityTools
     DynamicSparsityPattern::size_type next_free_number = 0;
 
     // enumerate the first round dofs
-    for (DynamicSparsityPattern::size_type i = 0; i != last_round_dofs.size();
-         ++i)
-      new_indices[last_round_dofs[i]] = next_free_number++;
+    for (unsigned int last_round_dof : last_round_dofs)
+      new_indices[last_round_dof] = next_free_number++;
 
     // now do as many steps as needed to renumber all dofs
     while (true)
index f442e6b9e6668c3fc9f0ff1b896e7ae1dca50b48..fe4e35562ac467b508825cc8f07e5908317bfbaf 100644 (file)
@@ -24,6 +24,8 @@
 
 #include <deal.II/multigrid/mg_transfer_internal.h>
 
+#include <memory>
+
 DEAL_II_NAMESPACE_OPEN
 
 namespace internal
@@ -449,8 +451,10 @@ namespace internal
                 ghosted_dofs.index_within_set(
                   target_partitioner->local_to_global(
                     copy_indices_global_mine(1, i)));
-          target_partitioner.reset(new Utilities::MPI::Partitioner(
-            locally_owned, ghosted_dofs, communicator));
+          target_partitioner =
+            std::make_shared<Utilities::MPI::Partitioner>(locally_owned,
+                                                          ghosted_dofs,
+                                                          communicator);
         }
     }
 
index ab5e754514c4ce849697cb1dfe0eba925a9f448b..4726c3f6e84d1614e850b5208dead39d855302e1 100644 (file)
@@ -928,11 +928,11 @@ TimeStepBase_Tria<dim>::refine_grid(const RefinementData refinement_data)
           (sweep_no >= refinement_flags.correction_relaxations.size() ?
              refinement_flags.correction_relaxations.back() :
              refinement_flags.correction_relaxations[sweep_no]);
-        for (unsigned int r = 0; r != relaxations.size(); ++r)
-          if (n_active_cells < relaxations[r].first)
+        for (const auto &relaxation : relaxations)
+          if (n_active_cells < relaxation.first)
             {
-              delta_up *= relaxations[r].second;
-              delta_down *= relaxations[r].second;
+              delta_up *= relaxation.second;
+              delta_down *= relaxation.second;
               break;
             }
 

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.