]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix some clang-tidy 9 findings clang-9-tidy 8866/head 8874/head
authorDaniel Arndt <arndtd@ornl.gov>
Thu, 26 Sep 2019 18:07:49 +0000 (18:07 +0000)
committerDaniel Arndt <arndtd@ornl.gov>
Thu, 26 Sep 2019 20:28:40 +0000 (16:28 -0400)
examples/step-63/step-63.cc
include/deal.II/algorithms/general_data_storage.h
include/deal.II/base/parameter_acceptor.h
include/deal.II/lac/la_parallel_vector.templates.h
source/base/patterns.cc
source/dofs/dof_tools_constraints.cc
source/lac/dynamic_sparsity_pattern.cc

index 35e08044dceb8c353564d3e2d8c2e5ee4f2f821a..a3437c7553e1c6e728f5fa54cc92fb93fb6b199c 100644 (file)
@@ -488,7 +488,7 @@ namespace Step63
   class AdvectionProblem
   {
   public:
-    AdvectionProblem(Settings settings);
+    AdvectionProblem(const Settings &settings);
     void run();
 
   private:
@@ -548,7 +548,7 @@ namespace Step63
 
 
   template <int dim>
-  AdvectionProblem<dim>::AdvectionProblem(Settings settings)
+  AdvectionProblem<dim>::AdvectionProblem(const Settings &settings)
     : triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
     , dof_handler(triangulation)
     , fe(settings.fe_degree)
index 6e58609b5db4eef4d1252988cbf9fa051652e684..b9040e3e21277187ee210828fe1540d7d26e196c 100644 (file)
@@ -351,7 +351,7 @@ template <class Stream>
 void
 GeneralDataStorage::print_info(Stream &os)
 {
-  for (auto it : any_data)
+  for (const auto &it : any_data)
     {
       os << it.first << '\t' << '\t'
          << boost::core::demangle(it.second.type().name()) << std::endl;
index 71546e0689ac94bd4da25c25939fc6ece5bff974..e0467454cb41a3dd12ee7dd6691d6f5856675bd4 100644 (file)
@@ -603,7 +603,7 @@ public:
    * are passed to the SourceClass constructor.
    */
   template <typename... Args>
-  ParameterAcceptorProxy(const std::string section_name, Args... args);
+  ParameterAcceptorProxy(const std::string &section_name, Args... args);
 
   /**
    * Overloads the ParameterAcceptor::declare_parameters function, by calling
@@ -641,7 +641,7 @@ ParameterAcceptor::add_parameter(const std::string &          entry,
 template <class SourceClass>
 template <typename... Args>
 ParameterAcceptorProxy<SourceClass>::ParameterAcceptorProxy(
-  const std::string section_name,
+  const std::string &section_name,
   Args... args)
   : SourceClass(args...)
   , ParameterAcceptor(section_name)
index 558436628d35639f0100a0227504685c7767104c..04c43ee38cfdc89d74ea0945822d4b493ab968a5 100644 (file)
@@ -152,13 +152,15 @@ namespace LinearAlgebra
         }
 
         static void
-        import(const ::dealii::LinearAlgebra::ReadWriteVector<Number> &V,
-               ::dealii::VectorOperation::values operation,
-               std::shared_ptr<const ::dealii::Utilities::MPI::Partitioner>
-                               communication_pattern,
-               const IndexSet &locally_owned_elem,
-               ::dealii::MemorySpace::
-                 MemorySpaceData<Number, ::dealii::MemorySpace::Host> &data)
+        import(
+          const ::dealii::LinearAlgebra::ReadWriteVector<Number> &V,
+          ::dealii::VectorOperation::values                       operation,
+          const std::shared_ptr<const ::dealii::Utilities::MPI::Partitioner>
+            &             communication_pattern,
+          const IndexSet &locally_owned_elem,
+          ::dealii::MemorySpace::MemorySpaceData<Number,
+                                                 ::dealii::MemorySpace::Host>
+            &data)
         {
           Assert(
             (operation == ::dealii::VectorOperation::add) ||
index 9dba7f3a5fac1ced440d96d01f26ba3267569b6b..37edd78b98eadb4af801d1fc080ffd6c953160ea 100644 (file)
@@ -1278,17 +1278,14 @@ namespace Patterns
 
 
     // check the different possibilities
-    for (std::vector<std::string>::const_iterator test_string =
-           split_names.begin();
-         test_string != split_names.end();
-         ++test_string)
+    for (const auto &test_string : split_names)
       {
         bool string_found = false;
 
         tmp = sequence;
         while (tmp.find('|') != std::string::npos)
           {
-            if (*test_string == std::string(tmp, 0, tmp.find('|')))
+            if (test_string == std::string(tmp, 0, tmp.find('|')))
               {
                 // string found, quit
                 // loop. don't change
@@ -1302,7 +1299,7 @@ namespace Patterns
           }
         // check last choice, not finished by |
         if (!string_found)
-          if (*test_string == tmp)
+          if (test_string == tmp)
             string_found = true;
 
         if (!string_found)
index 55de132df61c8450e8df6a4c870521b3730799b0..6420085e64a6f56f02e1a6934b034d25ed9aad1b 100644 (file)
@@ -289,11 +289,8 @@ namespace DoFTools
 
         // finally copy the list into the mask
         std::fill(master_dof_mask.begin(), master_dof_mask.end(), false);
-        for (std::vector<types::global_dof_index>::const_iterator i =
-               master_dof_list.begin();
-             i != master_dof_list.end();
-             ++i)
-          master_dof_mask[*i] = true;
+        for (const auto dof : master_dof_list)
+          master_dof_mask[dof] = true;
       }
 
 
index dc28f418bbe1cb60d3aa9512a1a1908ac2531001..ecc7b62f0e242001998e9964dad406de23032b6f 100644 (file)
@@ -387,30 +387,23 @@ DynamicSparsityPattern::symmetrize()
 {
   Assert(rows == cols, ExcNotQuadratic());
 
-  // loop over all elements presently
-  // in the sparsity pattern and add
-  // the transpose element. note:
+  // loop over all elements presently in the sparsity pattern and add the
+  // transpose element. note:
   //
-  // 1. that the sparsity pattern
-  // changes which we work on, but
-  // not the present row
+  // 1. that the sparsity pattern changes which we work on, but not the present
+  // row
   //
-  // 2. that the @p{add} function can
-  // be called on elements that
-  // already exist without any harm
+  // 2. that the @p{add} function can be called on elements that already exist
+  // without any harm
   for (size_type row = 0; row < lines.size(); ++row)
     {
       const size_type rowindex =
         rowset.size() == 0 ? row : rowset.nth_index_in_set(row);
 
-      for (std::vector<size_type>::const_iterator j =
-             lines[row].entries.begin();
-           j != lines[row].entries.end();
-           ++j)
-        // add the transpose entry if
-        // this is not the diagonal
-        if (rowindex != *j)
-          add(*j, rowindex);
+      for (const size_type row_entry : lines[row].entries)
+        // add the transpose entry if this is not the diagonal
+        if (rowindex != row_entry)
+          add(row_entry, rowindex);
     }
 }
 

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.