]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix clang-tidy-17 complains 16253/head
authorDaniel Arndt <arndtd@ornl.gov>
Tue, 7 Nov 2023 23:00:35 +0000 (18:00 -0500)
committerDaniel Arndt <arndtd@ornl.gov>
Tue, 7 Nov 2023 23:01:09 +0000 (18:01 -0500)
13 files changed:
.clang-tidy
examples/step-87/step-87.cc
include/deal.II/base/data_out_base.h
include/deal.II/base/linear_index_iterator.h
include/deal.II/base/quadrature.h
include/deal.II/differentiation/ad/ad_number_traits.h
include/deal.II/differentiation/sd/symengine_optimizer.h
include/deal.II/lac/block_vector_base.h
include/deal.II/lac/linear_operator.h
include/deal.II/lac/petsc_vector_base.h
source/base/data_out_base.cc
source/base/quadrature.cc
source/lac/petsc_vector_base.cc

index 46c3e9a24a59a5c8fcff6a8d7222dd563d9d0e79..242e9f284f7e54cc5f8239d0bca7b9781142d24a 100644 (file)
@@ -35,6 +35,7 @@ Checks: >
   performance-*,
   -performance-inefficient-string-concatenation,
   -performance-no-automatic-move,
+  -performance-avoid-endl,
   readability-qualified-auto
 
 WarningsAsErrors: '*'
index d47034a54de0e859355d33b5c67a04ee533e5b21..95e38f55ae5514a647b5c1151e8a10ebc4039f1b 100644 (file)
@@ -80,10 +80,10 @@ namespace Step87
 // triangulation is 1D, e.g., in the case of codim-1 meshes.
 #ifdef DEAL_II_WITH_P4EST
   template <int dim, int spacedim = dim>
-  using DistributedTriangulation = typename std::conditional<
+  using DistributedTriangulation = typename std::conditional_t<
     dim == 1,
     parallel::shared::Triangulation<dim, spacedim>,
-    parallel::distributed::Triangulation<dim, spacedim>>::type;
+    parallel::distributed::Triangulation<dim, spacedim>>;
 #else
   template <int dim, int spacedim = dim>
   using DistributedTriangulation =
index 2ca24be391e23e7f859ef3a6a89527ee8cc42ae0..f678c78c4c3ac8c40bc329c3015ac730f0286869 100644 (file)
@@ -372,7 +372,7 @@ namespace DataOutBase
      * Swap the current object's contents with those of the given argument.
      */
     void
-    swap(Patch<dim, spacedim> &other_patch);
+    swap(Patch<dim, spacedim> &other_patch) noexcept;
 
     /**
      * Value to be used if this patch has no neighbor on one side.
@@ -524,7 +524,7 @@ namespace DataOutBase
      * Swap the current object's contents with those of the given argument.
      */
     void
-    swap(Patch<0, spacedim> &other_patch);
+    swap(Patch<0, spacedim> &other_patch) noexcept;
 
     /**
      * Value to be used if this patch has no neighbor on one side.
index be605a4e44e6510d861d3fa236823559b9696a90..2db55b771aa261145b45aa1478fab147e0bbae14 100644 (file)
@@ -57,9 +57,9 @@ DEAL_II_NAMESPACE_OPEN
  *   public:
  *     // const iterators store a const pointer
  *     using container_pointer_type
- *       = typename std::conditional<Constness,
- *                                   const Container<T>*,
- *                                   Container<T>*>::type;
+ *       = std::conditional_t<Constness,
+ *                            const Container<T>*,
+ *                            Container<T>*>;
  *
  *     // This alias is assumed to exist.
  *     using size_type = std::size_t;
index 16bd884e363bb2a345efb1d7e5ffb001c22b6e12..7b2e9739cd57a87f06606b96b2ec6557c59465ba 100644 (file)
@@ -315,17 +315,17 @@ public:
    *
    * @note The actual return type of this function is
    * @code
-   * std::conditional<dim == 1,
-   *                  std::array<Quadrature<1>, dim>,
-   *                  const std::array<Quadrature<1>, dim> &>::type
+   * std::conditional_t<dim == 1,
+   *                    std::array<Quadrature<1>, dim>,
+   *                    const std::array<Quadrature<1>, dim> &>
    * @endcode
    * The type is abbreviated in the online documentation to improve
    * readability of this page.
    */
 #ifndef DOXYGEN
-  typename std::conditional<dim == 1,
-                            std::array<Quadrature<1>, dim>,
-                            const std::array<Quadrature<1>, dim> &>::type
+  std::conditional_t<dim == 1,
+                     std::array<Quadrature<1>, dim>,
+                     const std::array<Quadrature<1>, dim> &>
 #else
   const std::array<Quadrature<1>, dim> &
 #endif
index 270eaeff1cefbb96a652c2cc7301c0b8cbe50648..769c3167a9332037739558fecfb8034e5a624d6e 100644 (file)
@@ -309,10 +309,10 @@ namespace Differentiation
                  (void)std::declval<typename ADNumberTrait::real_type>(),
                  (void)std::declval<typename ADNumberTrait::derivative_type>(),
                  void())>
-        : std::conditional<
+        : std::conditional_t<
             std::is_floating_point_v<typename ADNumberTrait::real_type>,
             std::false_type,
-            std::true_type>::type
+            std::true_type>
       {};
 
 
@@ -869,14 +869,14 @@ namespace Differentiation
       /**
        * The actual auto-differentiable number directional derivative type
        */
-      using derivative_type = typename std::conditional<
+      using derivative_type = std::conditional_t<
         is_real_valued,
         typename internal::ADNumberInfoFromEnum<
           typename internal::RemoveComplexWrapper<ScalarType>::type,
           ADNumberTypeCode>::derivative_type,
         std::complex<typename internal::ADNumberInfoFromEnum<
           typename internal::RemoveComplexWrapper<ScalarType>::type,
-          ADNumberTypeCode>::derivative_type>>::type;
+          ADNumberTypeCode>::derivative_type>>;
 
 
       /**
index 4fac65cad3091a0c8bef087bb8d5973b29f31b7f..1dc9fdecd18c63b8e6b50dfefe3069b87df832bb 100644 (file)
@@ -388,10 +388,10 @@ namespace Differentiation
       {
         static const bool is_supported = true;
 
-        using ReturnType = typename std::conditional<
-          std::is_same_v<ReturnType_, std::complex<float>>,
-          std::complex<float>,
-          std::complex<double>>::type;
+        using ReturnType =
+          std::conditional_t<std::is_same_v<ReturnType_, std::complex<float>>,
+                             std::complex<float>,
+                             std::complex<double>>;
       };
 
 
@@ -500,13 +500,13 @@ namespace Differentiation
                                ReturnType_>::is_supported>>
       {
         using ReturnType =
-          typename std::conditional<!boost::is_complex<ReturnType_>::value,
-                                    double,
-                                    std::complex<double>>::type;
-        using OptimizerType = typename std::conditional<
-          !boost::is_complex<ReturnType_>::value,
-          SymEngine::LambdaRealDoubleVisitor,
-          SymEngine::LambdaComplexDoubleVisitor>::type;
+          std::conditional_t<!boost::is_complex<ReturnType_>::value,
+                             double,
+                             std::complex<double>>;
+        using OptimizerType =
+          std::conditional_t<!boost::is_complex<ReturnType_>::value,
+                             SymEngine::LambdaRealDoubleVisitor,
+                             SymEngine::LambdaComplexDoubleVisitor>;
 
 
         /**
@@ -601,9 +601,9 @@ namespace Differentiation
         using ReturnType = typename std::
           conditional<std::is_same_v<ReturnType_, float>, float, double>::type;
         using OptimizerType =
-          typename std::conditional<std::is_same_v<ReturnType_, float>,
-                                    SymEngine::LLVMFloatVisitor,
-                                    SymEngine::LLVMDoubleVisitor>::type;
+          std::conditional_t<std::is_same_v<ReturnType_, float>,
+                             SymEngine::LLVMFloatVisitor,
+                             SymEngine::LLVMDoubleVisitor>;
 
         /**
          * A flag to indicate if the ReturnType is supported by a
index 90d50a087bfcfb9a3cac760e5180202c05b0c32b..d71908552663872b9f5dab94f9ffa508228a461a 100644 (file)
@@ -133,9 +133,9 @@ namespace internal
        * number.
        */
       using value_type =
-        typename std::conditional<Constness,
-                                  const typename BlockVectorType::value_type,
-                                  typename BlockVectorType::value_type>::type;
+        std::conditional_t<Constness,
+                           const typename BlockVectorType::value_type,
+                           typename BlockVectorType::value_type>;
 
       /**
        * Declare some aliases that are standard for iterators and are used
@@ -155,17 +155,17 @@ namespace internal
       using reference         = typename BlockVectorType::reference;
       using pointer           = value_type *;
 
-      using dereference_type = typename std::conditional<
-        Constness,
-        value_type,
-        typename BlockVectorType::BlockType::reference>::type;
+      using dereference_type =
+        std::conditional_t<Constness,
+                           value_type,
+                           typename BlockVectorType::BlockType::reference>;
 
       /**
        * Typedef the type of the block vector (which differs in constness,
        * depending on the second template parameter).
        */
-      using BlockVector = typename std::
-        conditional<Constness, const BlockVectorType, BlockVectorType>::type;
+      using BlockVector =
+        std::conditional_t<Constness, const BlockVectorType, BlockVectorType>;
 
       /**
        * Construct an iterator from a vector to which we point and the global
index ac9171334c02eda5877d02a9e37edf2564964e96..0693e98fb9fe2daf56eb712610cdbca8629c0353 100644 (file)
@@ -1427,10 +1427,10 @@ linear_operator(const OperatorExemplar &operator_exemplar, const Matrix &matrix)
       Domain>::reinit_domain_vector(operator_exemplar, v, omit_zeroing_entries);
   };
 
-  typename std::conditional<
+  std::conditional_t<
     has_vmult_add_and_Tvmult_add<Range, Domain, Matrix>::type::value,
     MatrixInterfaceWithVmultAdd<Range, Domain, Payload>,
-    MatrixInterfaceWithoutVmultAdd<Range, Domain, Payload>>::type()
+    MatrixInterfaceWithoutVmultAdd<Range, Domain, Payload>>()
     .
     operator()(return_op, matrix);
 
@@ -1464,10 +1464,10 @@ linear_operator(const LinearOperator<Range, Domain, Payload> &operator_exemplar,
   // Initialize the payload based on the LinearOperator exemplar
   auto return_op = operator_exemplar;
 
-  typename std::conditional<
+  std::conditional_t<
     has_vmult_add_and_Tvmult_add<Range, Domain, Matrix>::type::value,
     MatrixInterfaceWithVmultAdd<Range, Domain, Payload>,
-    MatrixInterfaceWithoutVmultAdd<Range, Domain, Payload>>::type()
+    MatrixInterfaceWithoutVmultAdd<Range, Domain, Payload>>()
     .
     operator()(return_op, matrix);
 
index d60193581c60de42c504bfd24206b5ff2f4f404e..1a25e0260fc494b43c06a2e1c9f743b1e38318ef 100644 (file)
@@ -774,7 +774,7 @@ namespace PETScWrappers
      * analogy to standard functions.
      */
     void
-    swap(VectorBase &v);
+    swap(VectorBase &v) noexcept;
 
     /**
      * Conversion operator to gain access to the underlying PETSc type. If you
@@ -866,7 +866,7 @@ namespace PETScWrappers
    * @relatesalso PETScWrappers::VectorBase
    */
   inline void
-  swap(VectorBase &u, VectorBase &v)
+  swap(VectorBase &u, VectorBase &v) noexcept
   {
     u.swap(v);
   }
index 185d45a622fd408026288172e61695fe2633420b..b0f60a5e829efa8bfd2f53ca7c55c21628f8b069 100644 (file)
@@ -1845,7 +1845,7 @@ namespace DataOutBase
 
   template <int dim, int spacedim>
   void
-  Patch<dim, spacedim>::swap(Patch<dim, spacedim> &other_patch)
+  Patch<dim, spacedim>::swap(Patch<dim, spacedim> &other_patch) noexcept
   {
     std::swap(vertices, other_patch.vertices);
     std::swap(neighbors, other_patch.neighbors);
@@ -1935,7 +1935,7 @@ namespace DataOutBase
 
   template <int spacedim>
   void
-  Patch<0, spacedim>::swap(Patch<0, spacedim> &other_patch)
+  Patch<0, spacedim>::swap(Patch<0, spacedim> &other_patch) noexcept
   {
     std::swap(vertices, other_patch.vertices);
     std::swap(patch_index, other_patch.patch_index);
index b060625d09af6033a02e96fcc5b4d05a886eeacc..a3daba9958ef3987e1127d082ab037f86a8cefc6 100644 (file)
@@ -332,9 +332,9 @@ Quadrature<dim>::memory_consumption() const
 
 
 template <int dim>
-typename std::conditional<dim == 1,
-                          std::array<Quadrature<1>, dim>,
-                          const std::array<Quadrature<1>, dim> &>::type
+typename std::conditional_t<dim == 1,
+                            std::array<Quadrature<1>, dim>,
+                            const std::array<Quadrature<1>, dim> &>
 Quadrature<dim>::get_tensor_basis() const
 {
   Assert(this->is_tensor_product_flag == true,
index 8967c581e3340248deb9a2e6f1bf77797cb8a462..d3db0022dd7eaa7119c0198b7e8790b2fd884d8d 100644 (file)
@@ -1008,7 +1008,7 @@ namespace PETScWrappers
 
 
   void
-  VectorBase::swap(VectorBase &v)
+  VectorBase::swap(VectorBase &v) noexcept
   {
     std::swap(this->vector, v.vector);
     std::swap(this->ghosted, v.ghosted);

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.