]> https://gitweb.dealii.org/ - dealii.git/commitdiff
several improvements done based on clang-tidy 9.0 suggestions
authorReza Rastak <rastak@stanford.edu>
Mon, 20 Apr 2020 04:09:36 +0000 (21:09 -0700)
committerReza Rastak <rastak@stanford.edu>
Mon, 20 Apr 2020 04:09:36 +0000 (21:09 -0700)
examples/step-69/step-69.cc
include/deal.II/lac/qr.h
include/deal.II/optimization/solver_bfgs.h
source/base/parameter_handler.cc
source/lac/trilinos_precondition_ml.cc
source/opencascade/utilities.cc

index b61f6cf74c4344a17a11f730875af0c7a335bb47..6e43d71be60b164aff7c4e225edc234db65c0a6e 100644 (file)
@@ -945,12 +945,14 @@ namespace Step69
     // primarily used to write the updated nodal values, stored as
     // <code>Tensor<1,problem_dimension></code>, into the global objects.
 
-    template <std::size_t k>
+    template <std::size_t k, int k2>
     DEAL_II_ALWAYS_INLINE inline void
     scatter(std::array<LinearAlgebra::distributed::Vector<double>, k> &U,
-            const Tensor<1, ((identity<std::size_t>::type)k)> &        tensor,
+            const Tensor<1, k2> &                                      tensor,
             const unsigned int                                         i)
     {
+      static_assert(k == k2,
+                    "The dimensions of the input arguments must agree");
       for (unsigned int j = 0; j < k; ++j)
         U[j].local_element(i) = tensor[j];
     }
@@ -2530,8 +2532,8 @@ namespace Step69
   namespace
   {
     void print_head(ConditionalOStream &pcout,
-                    std::string         header,
-                    std::string         secondary = "")
+                    const std::string & header,
+                    const std::string & secondary = "")
     {
       const auto header_size   = header.size();
       const auto padded_header = std::string((34 - header_size) / 2, ' ') +
index 19adeed3d122112dd918748cec8cca948a646372..04ddcf67ea131610c17ac61397bb675aea24367f 100644 (file)
@@ -46,7 +46,7 @@ class BaseQR
   /**
    * Number type for R matrix.
    */
-  typedef typename VectorType::value_type Number;
+  using Number = typename VectorType::value_type;
 
 protected:
   /**
@@ -243,7 +243,7 @@ public:
   /**
    * Number type for R matrix.
    */
-  typedef typename VectorType::value_type Number;
+  using Number = typename VectorType::value_type;
 
   /**
    * Default constructor.
@@ -352,7 +352,7 @@ public:
   /**
    * Number type for R matrix.
    */
-  typedef typename VectorType::value_type Number;
+  using Number = typename VectorType::value_type;
 
   /**
    * Default constructor.
index 5a72b7c87daeb49d5e74f0189e635984a19bd6df..549dd51eeb429a236782d19ded4f53500a484b6d 100644 (file)
@@ -61,7 +61,7 @@ public:
   /**
    * Number type.
    */
-  typedef typename VectorType::value_type Number;
+  using Number = typename VectorType::value_type;
 
 
   /**
index 4fc7deca58ef5b1189f52e9a53a3fe7bb268271f..f072e83c22dfad21f84eedd6b342a4504f652704 100644 (file)
@@ -2007,7 +2007,7 @@ ParameterHandler::get_entries_wrongly_not_set() const
 {
   std::set<std::string> entries_wrongly_not_set;
 
-  for (auto it : entries_set_status)
+  for (const auto &it : entries_set_status)
     if (it.second.first == true && it.second.second == false)
       entries_wrongly_not_set.insert(it.first);
 
index 38855b134617f02767291c60656389efb9202823..435ea9f8480f96ea0349b540a7208ad172cf3ff3 100644 (file)
@@ -133,8 +133,8 @@ namespace TrilinosWrappers
     const Epetra_Map &domain_map = matrix.OperatorDomainMap();
 
     const size_type constant_modes_dimension = constant_modes.size();
-    ptr_distributed_constant_modes.reset(new Epetra_MultiVector(
-      domain_map, constant_modes_dimension > 0 ? constant_modes_dimension : 1));
+    ptr_distributed_constant_modes = std_cxx14::make_unique<Epetra_MultiVector>(
+      domain_map, constant_modes_dimension > 0 ? constant_modes_dimension : 1);
     Assert(ptr_distributed_constant_modes, ExcNotInitialized());
     Epetra_MultiVector &distributed_constant_modes =
       *ptr_distributed_constant_modes;
index 4c5872724e653711297846a9513126a9ca74a6f5..f2468ae15f29ca38d3c1a6100c420c803444aa76 100644 (file)
@@ -301,17 +301,12 @@ namespace OpenCASCADE
     std::vector<TopoDS_Edge>   edges;
     std::vector<TopoDS_Face>   faces;
     OpenCASCADE::extract_geometrical_shapes(shape, faces, edges, vertices);
-    bool mesh_is_present = true;
-    for (unsigned int i = 0; i < faces.size(); ++i)
-      {
+    const bool mesh_is_present =
+      std::none_of(faces.begin(), faces.end(), [&Loc](const TopoDS_Face &face) {
         Handle(Poly_Triangulation) theTriangulation =
-          BRep_Tool::Triangulation(faces[i], Loc);
-        if (theTriangulation.IsNull())
-          {
-            mesh_is_present = false;
-            break;
-          }
-      }
+          BRep_Tool::Triangulation(face, Loc);
+        return theTriangulation.IsNull();
+      });
     TopoDS_Shape shape_to_be_written = shape;
     if (!mesh_is_present)
       {

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.