]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix clang-tidy findings
authorDaniel Arndt <arndtd@ornl.gov>
Wed, 3 Jul 2024 22:46:49 +0000 (18:46 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Thu, 4 Jul 2024 13:55:06 +0000 (09:55 -0400)
33 files changed:
include/deal.II/base/aligned_vector.h
include/deal.II/base/array_view.h
include/deal.II/base/index_set.h
include/deal.II/base/memory_space_data.h
include/deal.II/base/table.h
include/deal.II/base/thread_local_storage.h
include/deal.II/differentiation/ad/ad_number_traits.h
include/deal.II/differentiation/sd/symengine_optimizer.h
include/deal.II/lac/affine_constraints.h
include/deal.II/lac/block_indices.h
include/deal.II/lac/block_vector.h
include/deal.II/lac/block_vector.templates.h
include/deal.II/lac/full_matrix.h
include/deal.II/lac/la_parallel_block_vector.h
include/deal.II/lac/la_parallel_block_vector.templates.h
include/deal.II/lac/la_parallel_vector.h
include/deal.II/lac/la_parallel_vector.templates.h
include/deal.II/lac/linear_operator.h
include/deal.II/lac/read_write_vector.h
include/deal.II/lac/read_write_vector.templates.h
include/deal.II/lac/trilinos_parallel_block_vector.h
include/deal.II/lac/trilinos_tpetra_sparsity_pattern.h
include/deal.II/lac/trilinos_tpetra_vector.h
include/deal.II/lac/trilinos_vector.h
include/deal.II/lac/vector.h
include/deal.II/matrix_free/fe_remote_evaluation.h
include/deal.II/matrix_free/tools.h
source/base/index_set.cc
source/differentiation/sd/symengine_number_types.cc
source/differentiation/sd/symengine_utilities.cc
source/grid/grid_in.cc
source/grid/grid_tools.cc
source/lac/trilinos_vector.cc

index aa4cba37c4c41ec8d0f3b5941951d2e3f4718f98..2f9b63ef9e83bd789c924036b88f18b7f497cc68 100644 (file)
@@ -358,7 +358,7 @@ public:
    * Swaps the given vector with the calling vector.
    */
   void
-  swap(AlignedVector<T> &vec);
+  swap(AlignedVector<T> &vec) noexcept;
 
   /**
    * Return whether the vector is empty, i.e., its size is zero.
@@ -1964,7 +1964,7 @@ AlignedVector<T>::replicate_across_communicator(const MPI_Comm     communicator,
 
 template <class T>
 inline void
-AlignedVector<T>::swap(AlignedVector<T> &vec)
+AlignedVector<T>::swap(AlignedVector<T> &vec) noexcept
 {
   // Swap the data in the 'elements' objects. Then also make sure that
   // their respective deleter objects point to the right place.
index 8b020af5dab0033fd529f9c6105e07f75eab1498..ba129a8ef76b26d1a4c07c0e697e49bfd0824fe6 100644 (file)
@@ -943,9 +943,9 @@ namespace internal
  * @relatesalso ArrayView
  */
 template <typename Iterator, typename MemorySpaceType = MemorySpace::Host>
-ArrayView<typename std::remove_reference<
-            typename std::iterator_traits<Iterator>::reference>::type,
-          MemorySpaceType>
+ArrayView<
+  std::remove_reference_t<typename std::iterator_traits<Iterator>::reference>,
+  MemorySpaceType>
 make_array_view(const Iterator begin, const Iterator end)
 {
   static_assert(
@@ -964,9 +964,9 @@ make_array_view(const Iterator begin, const Iterator end)
   Assert(internal::ArrayViewHelper::is_contiguous(begin, end),
          ExcMessage("The provided range isn't contiguous in memory!"));
   // the reference type, not the value type, knows the constness of the iterator
-  return ArrayView<typename std::remove_reference<
-                     typename std::iterator_traits<Iterator>::reference>::type,
-                   MemorySpaceType>(std::addressof(*begin), end - begin);
+  return ArrayView<
+    std::remove_reference_t<typename std::iterator_traits<Iterator>::reference>,
+    MemorySpaceType>(std::addressof(*begin), end - begin);
 }
 
 
index 80475554327021a780f850b4b4bac476acb9d82c..9d143f4dd44e5d6bd0e66c737cb44d60e41741e4 100644 (file)
@@ -137,7 +137,8 @@ public:
    * Constructor from a Trilinos Teuchos::RCP<Tpetra::Map>.
    */
   explicit IndexSet(
-    Teuchos::RCP<const Tpetra::Map<int, types::signed_global_dof_index>> map);
+    const Teuchos::RCP<const Tpetra::Map<int, types::signed_global_dof_index>>
+      &map);
 #  endif // DEAL_II_TRILINOS_WITH_TPETRA
 
   /**
index 164fab5982535fc6fa994864b24e6c2a599e28d2..bae79d9b2661da25862a3fe5d895a0a3750efada 100644 (file)
@@ -99,7 +99,8 @@ namespace MemorySpace
    */
   template <typename T, typename MemorySpace>
   inline void
-  swap(MemorySpaceData<T, MemorySpace> &u, MemorySpaceData<T, MemorySpace> &v);
+  swap(MemorySpaceData<T, MemorySpace> &u,
+       MemorySpaceData<T, MemorySpace> &v) noexcept;
 
 
 #ifndef DOXYGEN
@@ -169,7 +170,8 @@ namespace MemorySpace
    */
   template <typename T, typename MemorySpace>
   inline void
-  swap(MemorySpaceData<T, MemorySpace> &u, MemorySpaceData<T, MemorySpace> &v)
+  swap(MemorySpaceData<T, MemorySpace> &u,
+       MemorySpaceData<T, MemorySpace> &v) noexcept
   {
     std::swap(u.values_host_buffer, v.values_host_buffer);
     std::swap(u.values, v.values);
index d7971c02f7d07bf4ffc20f224b5e2b3b43a850c9..911042c97377ea33b780fa0a7538d425dab59a6e 100644 (file)
@@ -740,7 +740,7 @@ public:
    * functions.
    */
   void
-  swap(TableBase<N, T> &v);
+  swap(TableBase<N, T> &v) noexcept;
 
   /**
    * Determine an estimate for the memory consumption (in bytes) of this
@@ -986,8 +986,8 @@ namespace MatrixTableIterators
     /**
      * Type of the stored pointer to the table.
      */
-    using container_pointer_type = typename std::
-      conditional<Constness, const TableType *, TableType *>::type;
+    using container_pointer_type =
+      std::conditional_t<Constness, const TableType *, TableType *>;
 
     /**
      * Value type of the underlying container.
@@ -1198,8 +1198,8 @@ namespace MatrixTableIterators
     /**
      * Type of the stored pointer to the table.
      */
-    using container_pointer_type = typename std::
-      conditional<Constness, const TableType *, TableType *>::type;
+    using container_pointer_type =
+      std::conditional_t<Constness, const TableType *, TableType *>;
 
     /**
      * Constructor from an accessor.
@@ -2558,7 +2558,7 @@ TableBase<N, T>::fill(InputIterator entries, const bool C_style_indexing)
 
 template <int N, typename T>
 inline void
-TableBase<N, T>::swap(TableBase<N, T> &v)
+TableBase<N, T>::swap(TableBase<N, T> &v) noexcept
 {
   values.swap(v.values);
   std::swap(table_size, v.table_size);
@@ -3712,7 +3712,7 @@ Table<7, T>::operator()(const size_type i,
  */
 template <int N, typename T>
 inline void
-swap(TableBase<N, T> &u, TableBase<N, T> &v)
+swap(TableBase<N, T> &u, TableBase<N, T> &v) noexcept
 {
   u.swap(v);
 }
index 60ed81ec242ee9bcc2351e1afc4447e693b23577..a8b61f4679dff12a546f4268e065c46689c37f25 100644 (file)
@@ -104,8 +104,8 @@ namespace Threads
   class ThreadLocalStorage
   {
     static_assert(
-      std::is_copy_constructible<
-        typename internal::unpack_container<T>::type>::value ||
+      std::is_copy_constructible_v<
+        typename internal::unpack_container<T>::type> ||
         std::is_default_constructible_v<T>,
       "The stored type must be either copyable, or default constructible");
 
index e549a4e91aa4b7ca667ed9d4b3be640c4784fa1f..a322e39eb226d10b72033429fd02c90a0be8007f 100644 (file)
@@ -741,8 +741,8 @@ namespace Differentiation
       std::enable_if_t<
         std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
-         std::is_floating_point<
-           typename internal::RemoveComplexWrapper<ScalarType>::type>::value)>>
+         std::is_floating_point_v<
+           typename internal::RemoveComplexWrapper<ScalarType>::type>)>>
     {
       /**
        * The type of taping used
@@ -862,8 +862,8 @@ namespace Differentiation
       /**
        * The actual auto-differentiable number type
        */
-      using ad_type = typename std::
-        conditional<is_real_valued, real_type, complex_type>::type;
+      using ad_type =
+        std::conditional_t<is_real_valued, real_type, complex_type>;
 
       /**
        * The actual auto-differentiable number directional derivative type
@@ -940,8 +940,8 @@ namespace Differentiation
       std::enable_if_t<
         std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
-         std::is_floating_point<typename internal::RemoveComplexWrapper<
-           ScalarType>::type>::value)>>::is_taped =
+         std::is_floating_point_v<typename internal::RemoveComplexWrapper<
+           ScalarType>::type>)>>::is_taped =
       internal::ADNumberInfoFromEnum<
         typename internal::RemoveComplexWrapper<ScalarType>::type,
         ADNumberTypeCode>::is_taped;
@@ -954,8 +954,8 @@ namespace Differentiation
       std::enable_if_t<
         std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
-         std::is_floating_point<typename internal::RemoveComplexWrapper<
-           ScalarType>::type>::value)>>::is_tapeless =
+         std::is_floating_point_v<typename internal::RemoveComplexWrapper<
+           ScalarType>::type>)>>::is_tapeless =
       !(NumberTraits<ScalarType, ADNumberTypeCode>::is_taped);
 
 
@@ -966,8 +966,8 @@ namespace Differentiation
       std::enable_if_t<
         std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
-         std::is_floating_point<typename internal::RemoveComplexWrapper<
-           ScalarType>::type>::value)>>::is_real_valued =
+         std::is_floating_point_v<typename internal::RemoveComplexWrapper<
+           ScalarType>::type>)>>::is_real_valued =
       (!boost::is_complex<ScalarType>::value);
 
 
@@ -978,8 +978,8 @@ namespace Differentiation
       std::enable_if_t<
         std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
-         std::is_floating_point<typename internal::RemoveComplexWrapper<
-           ScalarType>::type>::value)>>::is_complex_valued =
+         std::is_floating_point_v<typename internal::RemoveComplexWrapper<
+           ScalarType>::type>)>>::is_complex_valued =
       !(NumberTraits<ScalarType, ADNumberTypeCode>::is_real_valued);
 
 
@@ -990,8 +990,8 @@ namespace Differentiation
       std::enable_if_t<
         std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
-         std::is_floating_point<typename internal::RemoveComplexWrapper<
-           ScalarType>::type>::value)>>::n_supported_derivative_levels =
+         std::is_floating_point_v<typename internal::RemoveComplexWrapper<
+           ScalarType>::type>)>>::n_supported_derivative_levels =
       internal::ADNumberInfoFromEnum<
         typename internal::RemoveComplexWrapper<ScalarType>::type,
         ADNumberTypeCode>::n_supported_derivative_levels;
@@ -1072,8 +1072,8 @@ namespace Differentiation
       std::enable_if_t<
         std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
-         std::is_floating_point<
-           typename internal::RemoveComplexWrapper<ScalarType>::type>::value)>>
+         std::is_floating_point_v<
+           typename internal::RemoveComplexWrapper<ScalarType>::type>)>>
     {
       /**
        * The internal number type code.
@@ -1241,8 +1241,8 @@ namespace Differentiation
       std::enable_if_t<
         std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
-         std::is_floating_point<typename internal::RemoveComplexWrapper<
-           ScalarType>::type>::value)>>::is_taped = false;
+         std::is_floating_point_v<typename internal::RemoveComplexWrapper<
+           ScalarType>::type>)>>::is_taped = false;
 
 
     template <typename ScalarType>
@@ -1252,8 +1252,8 @@ namespace Differentiation
       std::enable_if_t<
         std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
-         std::is_floating_point<typename internal::RemoveComplexWrapper<
-           ScalarType>::type>::value)>>::is_tapeless = false;
+         std::is_floating_point_v<typename internal::RemoveComplexWrapper<
+           ScalarType>::type>)>>::is_tapeless = false;
 
 
     template <typename ScalarType>
@@ -1263,8 +1263,8 @@ namespace Differentiation
       std::enable_if_t<
         std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
-         std::is_floating_point<typename internal::RemoveComplexWrapper<
-           ScalarType>::type>::value)>>::is_real_valued =
+         std::is_floating_point_v<typename internal::RemoveComplexWrapper<
+           ScalarType>::type>)>>::is_real_valued =
       (!boost::is_complex<ScalarType>::value);
 
 
@@ -1275,8 +1275,8 @@ namespace Differentiation
       std::enable_if_t<
         std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
-         std::is_floating_point<typename internal::RemoveComplexWrapper<
-           ScalarType>::type>::value)>>::is_complex_valued =
+         std::is_floating_point_v<typename internal::RemoveComplexWrapper<
+           ScalarType>::type>)>>::is_complex_valued =
       !(NumberTraits<ScalarType, NumberTypes::none>::is_real_valued);
 
 
@@ -1287,8 +1287,8 @@ namespace Differentiation
       std::enable_if_t<
         std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
-         std::is_floating_point<typename internal::RemoveComplexWrapper<
-           ScalarType>::type>::value)>>::n_supported_derivative_levels = 0;
+         std::is_floating_point_v<typename internal::RemoveComplexWrapper<
+           ScalarType>::type>)>>::n_supported_derivative_levels = 0;
 
 #  else
 
index 74a088c0fac6f6c05ecce50ffa6d25a16b14c02c..97d8be6d282f714d53e1527cbcccd9abcda4d72e 100644 (file)
@@ -370,8 +370,8 @@ namespace Differentiation
       {
         static const bool is_supported = true;
 
-        using ReturnType = typename std::
-          conditional<std::is_same_v<ReturnType_, float>, float, double>::type;
+        using ReturnType =
+          std::conditional_t<std::is_same_v<ReturnType_, float>, float, double>;
       };
 
 
@@ -596,8 +596,8 @@ namespace Differentiation
       struct LLVMOptimizer<ReturnType_,
                            std::enable_if_t<std::is_arithmetic_v<ReturnType_>>>
       {
-        using ReturnType = typename std::
-          conditional<std::is_same_v<ReturnType_, float>, float, double>::type;
+        using ReturnType =
+          std::conditional_t<std::is_same_v<ReturnType_, float>, float, double>;
         using OptimizerType =
           std::conditional_t<std::is_same_v<ReturnType_, float>,
                              SymEngine::LLVMFloatVisitor,
@@ -2271,14 +2271,12 @@ namespace Differentiation
       // Serialize enum classes...
       {
         const auto m =
-          static_cast<typename std::underlying_type<OptimizerType>::type>(
-            method);
+          static_cast<std::underlying_type_t<OptimizerType>>(method);
         ar &m;
       }
       {
         const auto f =
-          static_cast<typename std::underlying_type<OptimizationFlags>::type>(
-            flags);
+          static_cast<std::underlying_type_t<OptimizationFlags>>(flags);
         ar &f;
       }
 
@@ -2354,13 +2352,13 @@ namespace Differentiation
 
       // Deserialize enum classes...
       {
-        typename std::underlying_type<OptimizerType>::type m;
-        ar                                                &m;
+        std::underlying_type_t<OptimizerType> m;
+        ar                                   &m;
         method = static_cast<OptimizerType>(m);
       }
       {
-        typename std::underlying_type<OptimizationFlags>::type f;
-        ar                                                    &f;
+        std::underlying_type_t<OptimizationFlags> f;
+        ar                                       &f;
         flags = static_cast<OptimizationFlags>(f);
       }
 
index f5cbecf8096f8a492644058ba966819ff20a2fad..7194ba6509a38af0c24d7f35d323c8746ca8d7c6 100644 (file)
@@ -1926,7 +1926,7 @@ public:
      * Swap function.
      */
     friend void
-    swap(ConstraintLine &l1, ConstraintLine &l2)
+    swap(ConstraintLine &l1, ConstraintLine &l2) noexcept
     {
       std::swap(l1.index, l2.index);
       std::swap(l1.entries, l2.entries);
index ddf4f051fcae99de064b4b74124aed64e0517777..2170d3408c810c64208294371a4863a689f35d09 100644 (file)
@@ -204,7 +204,7 @@ public:
    * Swap the contents of these two objects.
    */
   void
-  swap(BlockIndices &b);
+  swap(BlockIndices &b) noexcept;
 
   /**
    * Determine an estimate for the memory consumption (in bytes) of this
@@ -441,7 +441,7 @@ BlockIndices::operator==(const BlockIndices &b) const
 
 
 inline void
-BlockIndices::swap(BlockIndices &b)
+BlockIndices::swap(BlockIndices &b) noexcept
 {
   std::swap(n_blocks, b.n_blocks);
   std::swap(start_indices, b.start_indices);
@@ -468,7 +468,7 @@ BlockIndices::memory_consumption() const
  * @relatesalso BlockIndices
  */
 inline void
-swap(BlockIndices &u, BlockIndices &v)
+swap(BlockIndices &u, BlockIndices &v) noexcept
 {
   u.swap(v);
 }
index aa1001f687f4433d1a52c66d76527e3fa4877e59..17edb54387724857350a077f2b1a9d1fb056deea 100644 (file)
@@ -323,7 +323,7 @@ public:
    * <tt>u.swap(v)</tt>, again in analogy to standard functions.
    */
   void
-  swap(BlockVector<Number> &v);
+  swap(BlockVector<Number> &v) noexcept;
 
   /**
    * Print to a stream.
@@ -481,7 +481,7 @@ BlockVector<Number>::scale(const BlockVector2 &v)
  */
 template <typename Number>
 inline void
-swap(BlockVector<Number> &u, BlockVector<Number> &v)
+swap(BlockVector<Number> &u, BlockVector<Number> &v) noexcept
 {
   u.swap(v);
 }
index 7408eb859e4d74bba9d08c57073143a74fc9dab0..c62fd9c9b9a6aaee39927e03c77393d52da32f78 100644 (file)
@@ -157,7 +157,7 @@ BlockVector<Number>::operator=(const TrilinosWrappers::MPI::BlockVector &v)
 
 template <typename Number>
 void
-BlockVector<Number>::swap(BlockVector<Number> &v)
+BlockVector<Number>::swap(BlockVector<Number> &v) noexcept
 {
   std::swap(this->components, v.components);
 
index fef8dbb0223fadd7525db597e9fc6dc8a998731d..46d3fb98bba69ec28f618b57b76e3ef44c69b607 100644 (file)
@@ -86,8 +86,7 @@ public:
    * std::complex.
    */
   static_assert(
-    std::is_arithmetic<
-      typename numbers::NumberTraits<number>::real_type>::value,
+    std::is_arithmetic_v<typename numbers::NumberTraits<number>::real_type>,
     "The FullMatrix class only supports basic numeric types. In particular, it "
     "does not support automatically differentiated numbers.");
 
index d4b2b41e42f6f066f865c7ae3602f099b78cce51..fc9976bd6ea0410bcb867b72b558e9ad058cfd7f 100644 (file)
@@ -519,7 +519,7 @@ namespace LinearAlgebra
        * functions.
        */
       void
-      swap(BlockVector<Number> &v);
+      swap(BlockVector<Number> &v) noexcept;
       /** @} */
 
       /**
@@ -819,7 +819,7 @@ namespace LinearAlgebra
 template <typename Number>
 inline void
 swap(LinearAlgebra::distributed::BlockVector<Number> &u,
-     LinearAlgebra::distributed::BlockVector<Number> &v)
+     LinearAlgebra::distributed::BlockVector<Number> &v) noexcept
 {
   u.swap(v);
 }
index e4efc4cae00d0b01ee766e13e956b2c775681145..fd39a3fff26b537f52cb4c9db98a041418d9573f 100644 (file)
@@ -833,7 +833,7 @@ namespace LinearAlgebra
 
     template <typename Number>
     inline void
-    BlockVector<Number>::swap(BlockVector<Number> &v)
+    BlockVector<Number>::swap(BlockVector<Number> &v) noexcept
     {
       Assert(this->n_blocks() == v.n_blocks(),
              ExcDimensionMismatch(this->n_blocks(), v.n_blocks()));
index 31e591622254806425f17a433d7cbd3fe3392254..3a287bcdffb8364a72b717782c0df3f17f12e37f 100644 (file)
@@ -452,7 +452,7 @@ namespace LinearAlgebra
        * analogy to standard functions.
        */
       void
-      swap(Vector<Number, MemorySpace> &v);
+      swap(Vector<Number, MemorySpace> &v) noexcept;
 
       /**
        * Move assignment operator.
@@ -1790,7 +1790,7 @@ namespace LinearAlgebra
 template <typename Number, typename MemorySpace>
 inline void
 swap(LinearAlgebra::distributed::Vector<Number, MemorySpace> &u,
-     LinearAlgebra::distributed::Vector<Number, MemorySpace> &v)
+     LinearAlgebra::distributed::Vector<Number, MemorySpace> &v) noexcept
 {
   u.swap(v);
 }
index fe29f318b6807cb2cac36374b043afe346a5d44b..1072c6fc7c357ac5c535e10f0c51497838e918c9 100644 (file)
@@ -1367,7 +1367,8 @@ namespace LinearAlgebra
 
     template <typename Number, typename MemorySpaceType>
     void
-    Vector<Number, MemorySpaceType>::swap(Vector<Number, MemorySpaceType> &v)
+    Vector<Number, MemorySpaceType>::swap(
+      Vector<Number, MemorySpaceType> &v) noexcept
     {
 #ifdef DEAL_II_WITH_MPI
 
index 0afc36573579ab7b6a33dfd62477c5ffa58512e0..7ff7f213d223236d2877fe52783f6a05f818df59 100644 (file)
@@ -507,8 +507,8 @@ operator*(typename Range::value_type                    number,
           const LinearOperator<Range, Domain, Payload> &op)
 {
   static_assert(
-    std::is_convertible<typename Range::value_type,
-                        typename Domain::value_type>::value,
+    std::is_convertible_v<typename Range::value_type,
+                          typename Domain::value_type>,
     "Range and Domain must have implicitly convertible 'value_type's");
 
   if (op.is_null_operator)
@@ -574,8 +574,8 @@ operator*(const LinearOperator<Range, Domain, Payload> &op,
           typename Domain::value_type                   number)
 {
   static_assert(
-    std::is_convertible<typename Range::value_type,
-                        typename Domain::value_type>::value,
+    std::is_convertible_v<typename Range::value_type,
+                          typename Domain::value_type>,
     "Range and Domain must have implicitly convertible 'value_type's");
 
   return number * op;
index 0b85ec3408ab42373d907b6c0f91466941a3d9c3..53598dfbb00f76b35a7b1ea2129cfae0f5692ee4 100644 (file)
@@ -266,7 +266,7 @@ namespace LinearAlgebra
      * analogy to standard functions.
      */
     void
-    swap(ReadWriteVector<Number> &v);
+    swap(ReadWriteVector<Number> &v) noexcept;
 
     /**
      * Copies the data and the IndexSet of the input vector @p in_vector.
@@ -1179,7 +1179,7 @@ namespace LinearAlgebra
 template <typename Number>
 inline void
 swap(LinearAlgebra::ReadWriteVector<Number> &u,
-     LinearAlgebra::ReadWriteVector<Number> &v)
+     LinearAlgebra::ReadWriteVector<Number> &v) noexcept
 {
   u.swap(v);
 }
index a59f1fa13ba3c1be494d3a09a388bdf95e3ff681..d0d31a3f969dcd3dfea1949265db266f883b295f 100644 (file)
@@ -942,7 +942,7 @@ namespace LinearAlgebra
 
   template <typename Number>
   void
-  ReadWriteVector<Number>::swap(ReadWriteVector<Number> &v)
+  ReadWriteVector<Number>::swap(ReadWriteVector<Number> &v) noexcept
   {
     std::swap(stored_elements, v.stored_elements);
     std::swap(values, v.values);
index f1278eb9cf5c472c10b4f6550ac36c7f134cbf71..5cad7345d0ef9af6e99225ef2f84ee865d54d259 100644 (file)
@@ -312,7 +312,7 @@ namespace TrilinosWrappers
        * functions.
        */
       void
-      swap(BlockVector &v);
+      swap(BlockVector &v) noexcept;
 
       /**
        * Print to a stream.
@@ -427,7 +427,7 @@ namespace TrilinosWrappers
 
 
     inline void
-    BlockVector::swap(BlockVector &v)
+    BlockVector::swap(BlockVector &v) noexcept
     {
       std::swap(this->components, v.components);
 
@@ -444,7 +444,7 @@ namespace TrilinosWrappers
      * @relatesalso TrilinosWrappers::MPI::BlockVector
      */
     inline void
-    swap(BlockVector &u, BlockVector &v)
+    swap(BlockVector &u, BlockVector &v) noexcept
     {
       u.swap(v);
     }
index 3bd929ca6a9ae21d84af070200d0ec44e6153cd9..31005b6c3f3854899f32cf087c20aa7e13ce5562 100644 (file)
@@ -1353,11 +1353,11 @@ namespace LinearAlgebra
 
       const TrilinosWrappers::types::int_type *col_index_ptr_begin =
         reinterpret_cast<TrilinosWrappers::types::int_type *>(
-          const_cast<typename std::decay<decltype(*begin)>::type *>(&*begin));
+          const_cast<std::decay_t<decltype(*begin)> *>(&*begin));
 
       const TrilinosWrappers::types::int_type *col_index_ptr_end =
         reinterpret_cast<TrilinosWrappers::types::int_type *>(
-          const_cast<typename std::decay<decltype(*end)>::type *>(&*end));
+          const_cast<std::decay_t<decltype(*end)> *>(&*end));
 
       // Check at least for the first index that the conversion actually works
       AssertDimension(*col_index_ptr_begin, *begin);
index 8e44eb0b49d97ee09cd43805783b89acb3e2a211..d8d8afd05a88f688b61c451db4245868d230545a 100644 (file)
@@ -423,7 +423,7 @@ namespace LinearAlgebra
        * handle memory separately.
        */
       virtual void
-      swap(Vector &v);
+      swap(Vector &v) noexcept;
 
       /**
        * Extract a range of elements all at once.
@@ -1086,7 +1086,8 @@ namespace LinearAlgebra
 
     template <typename Number, typename MemorySpace>
     inline void
-    swap(Vector<Number, MemorySpace> &u, Vector<Number, MemorySpace> &v)
+    swap(Vector<Number, MemorySpace> &u,
+         Vector<Number, MemorySpace> &v) noexcept
     {
       u.swap(v);
     }
@@ -1110,7 +1111,7 @@ namespace LinearAlgebra
 
     template <typename Number, typename MemorySpace>
     inline void
-    Vector<Number, MemorySpace>::swap(Vector<Number, MemorySpace> &v)
+    Vector<Number, MemorySpace>::swap(Vector<Number, MemorySpace> &v) noexcept
     {
       vector.swap(v.vector);
     }
index 439ba748d5fd75a9008dc2eec83bd4d52a1f3df1..9cc22e4249af8081c36dd89cf3f25efa395ff440 100644 (file)
@@ -1303,7 +1303,7 @@ namespace TrilinosWrappers
        * analogy to standard functions.
        */
       void
-      swap(Vector &v);
+      swap(Vector &v) noexcept;
 
       /**
        * Estimate for the memory consumption in bytes.
@@ -1419,7 +1419,7 @@ namespace TrilinosWrappers
      * @relatesalso TrilinosWrappers::MPI::Vector
      */
     inline void
-    swap(Vector &u, Vector &v)
+    swap(Vector &u, Vector &v) noexcept
     {
       u.swap(v);
     }
index 550a54c65f78e152de38548cdec0f1e4005576bf..045ab4eb8e8df34eec29ad5c549b2887b8e5b1cc 100644 (file)
@@ -127,8 +127,7 @@ public:
    * std::complex.
    */
   static_assert(
-    std::is_arithmetic<
-      typename numbers::NumberTraits<Number>::real_type>::value,
+    std::is_arithmetic_v<typename numbers::NumberTraits<Number>::real_type>,
     "The Vector class only supports basic numeric types. In particular, it "
     "does not support automatically differentiated numbers.");
 
@@ -387,7 +386,7 @@ public:
    * memory separately.
    */
   virtual void
-  swap(Vector<Number> &v);
+  swap(Vector<Number> &v) noexcept;
 
   /**
    * Set all components of the vector to the given number @p s.
@@ -1436,7 +1435,7 @@ Vector<Number>::reinit(const Vector<Number2> &v,
 // swap virtual.
 template <typename Number>
 inline void
-Vector<Number>::swap(Vector<Number> &v)
+Vector<Number>::swap(Vector<Number> &v) noexcept
 {
   values.swap(v.values);
   std::swap(thread_loop_partitioner, v.thread_loop_partitioner);
@@ -1485,7 +1484,7 @@ Vector<Number>::load(Archive &ar, const unsigned int)
  */
 template <typename Number>
 inline void
-swap(Vector<Number> &u, Vector<Number> &v)
+swap(Vector<Number> &u, Vector<Number> &v) noexcept
 {
   u.swap(v);
 }
index 6546a9825afd9775c2d72cef68a5af31b6e28756..a81f330c11fb6481e3e1fd24029f83244d18849b 100644 (file)
@@ -1163,8 +1163,7 @@ namespace Utilities
                 // the batch to the corresponding data structure.
                 const unsigned int n_faces =
                   matrix_free.n_active_entries_per_face_batch(face);
-                face_batch_id_n_faces.emplace_back(
-                  std::make_pair(face, n_faces));
+                face_batch_id_n_faces.emplace_back(face, n_faces);
 
                 // Append the quadrature points to the points we need to search
                 // for.
index 287e8e6c3e8061030cece00bc4c15e44b25541ca..cb83556412fe4bd8a374e27eacb0e3ff45ce49ab 100644 (file)
@@ -1772,13 +1772,13 @@ namespace MatrixFreeTools
      * If value type of matrix and constrains equals, return a reference
      * to the given AffineConstraint instance.
      */
-    template <typename MatrixType,
-              typename Number,
-              std::enable_if_t<std::is_same_v<
-                typename std::remove_const<typename std::remove_reference<
-                  typename MatrixType::value_type>::type>::type,
-                typename std::remove_const<typename std::remove_reference<
-                  Number>::type>::type>> * = nullptr>
+    template <
+      typename MatrixType,
+      typename Number,
+      std::enable_if_t<std::is_same_v<
+        std::remove_const_t<
+          std::remove_reference_t<typename MatrixType::value_type>>,
+        std::remove_const_t<std::remove_reference_t<Number>>>> * = nullptr>
     const AffineConstraints<typename MatrixType::value_type> &
     create_new_affine_constraints_if_needed(
       const MatrixType &,
@@ -1793,13 +1793,13 @@ namespace MatrixFreeTools
      * AffineConstraint instance with the value type of the matrix is
      * created and a reference to it is returned.
      */
-    template <typename MatrixType,
-              typename Number,
-              std::enable_if_t<!std::is_same_v<
-                typename std::remove_const<typename std::remove_reference<
-                  typename MatrixType::value_type>::type>::type,
-                typename std::remove_const<typename std::remove_reference<
-                  Number>::type>::type>> * = nullptr>
+    template <
+      typename MatrixType,
+      typename Number,
+      std::enable_if_t<!std::is_same_v<
+        std::remove_const_t<
+          std::remove_reference_t<typename MatrixType::value_type>>,
+        std::remove_const_t<std::remove_reference_t<Number>>>> * = nullptr>
     const AffineConstraints<typename MatrixType::value_type> &
     create_new_affine_constraints_if_needed(
       const MatrixType &,
index 7b4186fa4fc133d8a9c4a29c94641ac95ee5bd02..cb70f27a86a3f71c45c95435c2a7680246b0d841 100644 (file)
@@ -40,7 +40,8 @@ DEAL_II_NAMESPACE_OPEN
 #  ifdef DEAL_II_TRILINOS_WITH_TPETRA
 
 IndexSet::IndexSet(
-  Teuchos::RCP<const Tpetra::Map<int, types::signed_global_dof_index>> map)
+  const Teuchos::RCP<const Tpetra::Map<int, types::signed_global_dof_index>>
+    &map)
   : is_compressed(true)
   , index_space_size(1 + map->getMaxAllGlobalIndex())
   , largest_range(numbers::invalid_unsigned_int)
index 46eb5f6895d55744c3cf5ce70ce478bdbf044a4f..2e02a91425806d69898046460d2cac67e1dae536 100644 (file)
@@ -93,17 +93,17 @@ namespace Differentiation
           Assert(SE::is_a_Boolean(entry.first.get_value()),
                  ExcMessage(
                    "The conditional expression must return a boolean type."));
-          piecewise_function.push_back(
-            {entry.second.get_RCP(),
-             SE::rcp_static_cast<const SE::Boolean>(entry.first.get_RCP())});
+          piecewise_function.emplace_back(
+            entry.second.get_RCP(),
+            SE::rcp_static_cast<const SE::Boolean>(entry.first.get_RCP()));
         }
 
       // Add default value
-      piecewise_function.push_back(
-        {expression_otherwise.get_RCP(), SE::boolTrue});
+      piecewise_function.emplace_back(expression_otherwise.get_RCP(),
+                                      SE::boolTrue);
 
       // Initialize
-      expression = SE::piecewise(std::move(piecewise_function));
+      expression = SE::piecewise(piecewise_function);
     }
 
 
index b50972f2970f2cb642032aa761c3da548c7d46f0..e33a93d254a0acb1dbff2db450953e1dca5b7699 100644 (file)
@@ -75,7 +75,7 @@ namespace Differentiation
         SD::types::symbol_vector symb_vec;
         symb_vec.reserve(symbol_vector.size());
         for (const auto &entry : symbol_vector)
-          symb_vec.push_back(SD::Expression(entry));
+          symb_vec.emplace_back(entry);
         return symb_vec;
       }
 
index 71687f1984bc44470426b5cbc3f3f8d9d6edad57..3cec7488116776553d3795ab56a75ae3843e24f6 100644 (file)
@@ -3684,7 +3684,7 @@ namespace
         for (auto &pair : face_side_sets)
           {
             Assert(pair.second.size() > 0, ExcInternalError());
-            face_id_to_side_sets.push_back(std::move(pair));
+            face_id_to_side_sets.emplace_back(std::move(pair));
           }
 
         // sort by side sets:
index 2503c671fdaff249eba79bf4807a3dfa9d06738a..91a664ae57a955c181259247f11aa5f0d8c05aa7 100644 (file)
@@ -3676,6 +3676,7 @@ namespace GridTools
               ArborXWrappers::DistributedTree distributed_tree(
                 comm, global_bboxes[0]);
               std::vector<BoundingBox<spacedim>> query_bounding_boxes;
+              query_bounding_boxes.reserve(entities.size());
               for (const auto &entity : entities)
                 query_bounding_boxes.emplace_back(
                   BoundingBox<spacedim>(entity).create_extended(tolerance));
index f3404b72cbdb95d3152a02619e9f8f7626287126..9ed58caaa0e03df6811003028a8bdcc3b3873d55 100644 (file)
@@ -892,7 +892,7 @@ namespace TrilinosWrappers
 
 
     void
-    Vector::swap(Vector &v)
+    Vector::swap(Vector &v) noexcept
     {
       std::swap(last_action, v.last_action);
       std::swap(compressed, v.compressed);

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.