From a1db86ab2f80ea536a6e1ac34661fc8d63d274ca Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Wed, 3 Jul 2024 18:46:49 -0400 Subject: [PATCH] Fix clang-tidy findings --- include/deal.II/base/aligned_vector.h | 4 +- include/deal.II/base/array_view.h | 12 ++--- include/deal.II/base/index_set.h | 3 +- include/deal.II/base/memory_space_data.h | 6 ++- include/deal.II/base/table.h | 14 ++--- include/deal.II/base/thread_local_storage.h | 4 +- .../differentiation/ad/ad_number_traits.h | 52 +++++++++---------- .../differentiation/sd/symengine_optimizer.h | 22 ++++---- include/deal.II/lac/affine_constraints.h | 2 +- include/deal.II/lac/block_indices.h | 6 +-- include/deal.II/lac/block_vector.h | 4 +- include/deal.II/lac/block_vector.templates.h | 2 +- include/deal.II/lac/full_matrix.h | 3 +- .../deal.II/lac/la_parallel_block_vector.h | 4 +- .../lac/la_parallel_block_vector.templates.h | 2 +- include/deal.II/lac/la_parallel_vector.h | 4 +- .../lac/la_parallel_vector.templates.h | 3 +- include/deal.II/lac/linear_operator.h | 8 +-- include/deal.II/lac/read_write_vector.h | 4 +- .../deal.II/lac/read_write_vector.templates.h | 2 +- .../lac/trilinos_parallel_block_vector.h | 6 +-- .../lac/trilinos_tpetra_sparsity_pattern.h | 4 +- include/deal.II/lac/trilinos_tpetra_vector.h | 7 +-- include/deal.II/lac/trilinos_vector.h | 4 +- include/deal.II/lac/vector.h | 9 ++-- .../matrix_free/fe_remote_evaluation.h | 3 +- include/deal.II/matrix_free/tools.h | 28 +++++----- source/base/index_set.cc | 3 +- .../sd/symengine_number_types.cc | 12 ++--- .../differentiation/sd/symengine_utilities.cc | 2 +- source/grid/grid_in.cc | 2 +- source/grid/grid_tools.cc | 1 + source/lac/trilinos_vector.cc | 2 +- 33 files changed, 123 insertions(+), 121 deletions(-) diff --git a/include/deal.II/base/aligned_vector.h b/include/deal.II/base/aligned_vector.h index aa4cba37c4..2f9b63ef9e 100644 --- a/include/deal.II/base/aligned_vector.h +++ b/include/deal.II/base/aligned_vector.h @@ -358,7 +358,7 @@ public: * Swaps the given vector with the calling vector. */ void - swap(AlignedVector &vec); + swap(AlignedVector &vec) noexcept; /** * Return whether the vector is empty, i.e., its size is zero. @@ -1964,7 +1964,7 @@ AlignedVector::replicate_across_communicator(const MPI_Comm communicator, template inline void -AlignedVector::swap(AlignedVector &vec) +AlignedVector::swap(AlignedVector &vec) noexcept { // Swap the data in the 'elements' objects. Then also make sure that // their respective deleter objects point to the right place. diff --git a/include/deal.II/base/array_view.h b/include/deal.II/base/array_view.h index 8b020af5da..ba129a8ef7 100644 --- a/include/deal.II/base/array_view.h +++ b/include/deal.II/base/array_view.h @@ -943,9 +943,9 @@ namespace internal * @relatesalso ArrayView */ template -ArrayView::reference>::type, - MemorySpaceType> +ArrayView< + std::remove_reference_t::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::reference>::type, - MemorySpaceType>(std::addressof(*begin), end - begin); + return ArrayView< + std::remove_reference_t::reference>, + MemorySpaceType>(std::addressof(*begin), end - begin); } diff --git a/include/deal.II/base/index_set.h b/include/deal.II/base/index_set.h index 8047555432..9d143f4dd4 100644 --- a/include/deal.II/base/index_set.h +++ b/include/deal.II/base/index_set.h @@ -137,7 +137,8 @@ public: * Constructor from a Trilinos Teuchos::RCP. */ explicit IndexSet( - Teuchos::RCP> map); + const Teuchos::RCP> + &map); # endif // DEAL_II_TRILINOS_WITH_TPETRA /** diff --git a/include/deal.II/base/memory_space_data.h b/include/deal.II/base/memory_space_data.h index 164fab5982..bae79d9b26 100644 --- a/include/deal.II/base/memory_space_data.h +++ b/include/deal.II/base/memory_space_data.h @@ -99,7 +99,8 @@ namespace MemorySpace */ template inline void - swap(MemorySpaceData &u, MemorySpaceData &v); + swap(MemorySpaceData &u, + MemorySpaceData &v) noexcept; #ifndef DOXYGEN @@ -169,7 +170,8 @@ namespace MemorySpace */ template inline void - swap(MemorySpaceData &u, MemorySpaceData &v) + swap(MemorySpaceData &u, + MemorySpaceData &v) noexcept { std::swap(u.values_host_buffer, v.values_host_buffer); std::swap(u.values, v.values); diff --git a/include/deal.II/base/table.h b/include/deal.II/base/table.h index d7971c02f7..911042c973 100644 --- a/include/deal.II/base/table.h +++ b/include/deal.II/base/table.h @@ -740,7 +740,7 @@ public: * functions. */ void - swap(TableBase &v); + swap(TableBase &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::type; + using container_pointer_type = + std::conditional_t; /** * 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::type; + using container_pointer_type = + std::conditional_t; /** * Constructor from an accessor. @@ -2558,7 +2558,7 @@ TableBase::fill(InputIterator entries, const bool C_style_indexing) template inline void -TableBase::swap(TableBase &v) +TableBase::swap(TableBase &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 inline void -swap(TableBase &u, TableBase &v) +swap(TableBase &u, TableBase &v) noexcept { u.swap(v); } diff --git a/include/deal.II/base/thread_local_storage.h b/include/deal.II/base/thread_local_storage.h index 60ed81ec24..a8b61f4679 100644 --- a/include/deal.II/base/thread_local_storage.h +++ b/include/deal.II/base/thread_local_storage.h @@ -104,8 +104,8 @@ namespace Threads class ThreadLocalStorage { static_assert( - std::is_copy_constructible< - typename internal::unpack_container::type>::value || + std::is_copy_constructible_v< + typename internal::unpack_container::type> || std::is_default_constructible_v, "The stored type must be either copyable, or default constructible"); diff --git a/include/deal.II/differentiation/ad/ad_number_traits.h b/include/deal.II/differentiation/ad/ad_number_traits.h index e549a4e91a..a322e39eb2 100644 --- a/include/deal.II/differentiation/ad/ad_number_traits.h +++ b/include/deal.II/differentiation/ad/ad_number_traits.h @@ -741,8 +741,8 @@ namespace Differentiation std::enable_if_t< std::is_floating_point_v || (boost::is_complex::value && - std::is_floating_point< - typename internal::RemoveComplexWrapper::type>::value)>> + std::is_floating_point_v< + typename internal::RemoveComplexWrapper::type>)>> { /** * The type of taping used @@ -862,8 +862,8 @@ namespace Differentiation /** * The actual auto-differentiable number type */ - using ad_type = typename std:: - conditional::type; + using ad_type = + std::conditional_t; /** * The actual auto-differentiable number directional derivative type @@ -940,8 +940,8 @@ namespace Differentiation std::enable_if_t< std::is_floating_point_v || (boost::is_complex::value && - std::is_floating_point::type>::value)>>::is_taped = + std::is_floating_point_v::type>)>>::is_taped = internal::ADNumberInfoFromEnum< typename internal::RemoveComplexWrapper::type, ADNumberTypeCode>::is_taped; @@ -954,8 +954,8 @@ namespace Differentiation std::enable_if_t< std::is_floating_point_v || (boost::is_complex::value && - std::is_floating_point::type>::value)>>::is_tapeless = + std::is_floating_point_v::type>)>>::is_tapeless = !(NumberTraits::is_taped); @@ -966,8 +966,8 @@ namespace Differentiation std::enable_if_t< std::is_floating_point_v || (boost::is_complex::value && - std::is_floating_point::type>::value)>>::is_real_valued = + std::is_floating_point_v::type>)>>::is_real_valued = (!boost::is_complex::value); @@ -978,8 +978,8 @@ namespace Differentiation std::enable_if_t< std::is_floating_point_v || (boost::is_complex::value && - std::is_floating_point::type>::value)>>::is_complex_valued = + std::is_floating_point_v::type>)>>::is_complex_valued = !(NumberTraits::is_real_valued); @@ -990,8 +990,8 @@ namespace Differentiation std::enable_if_t< std::is_floating_point_v || (boost::is_complex::value && - std::is_floating_point::type>::value)>>::n_supported_derivative_levels = + std::is_floating_point_v::type>)>>::n_supported_derivative_levels = internal::ADNumberInfoFromEnum< typename internal::RemoveComplexWrapper::type, ADNumberTypeCode>::n_supported_derivative_levels; @@ -1072,8 +1072,8 @@ namespace Differentiation std::enable_if_t< std::is_floating_point_v || (boost::is_complex::value && - std::is_floating_point< - typename internal::RemoveComplexWrapper::type>::value)>> + std::is_floating_point_v< + typename internal::RemoveComplexWrapper::type>)>> { /** * The internal number type code. @@ -1241,8 +1241,8 @@ namespace Differentiation std::enable_if_t< std::is_floating_point_v || (boost::is_complex::value && - std::is_floating_point::type>::value)>>::is_taped = false; + std::is_floating_point_v::type>)>>::is_taped = false; template @@ -1252,8 +1252,8 @@ namespace Differentiation std::enable_if_t< std::is_floating_point_v || (boost::is_complex::value && - std::is_floating_point::type>::value)>>::is_tapeless = false; + std::is_floating_point_v::type>)>>::is_tapeless = false; template @@ -1263,8 +1263,8 @@ namespace Differentiation std::enable_if_t< std::is_floating_point_v || (boost::is_complex::value && - std::is_floating_point::type>::value)>>::is_real_valued = + std::is_floating_point_v::type>)>>::is_real_valued = (!boost::is_complex::value); @@ -1275,8 +1275,8 @@ namespace Differentiation std::enable_if_t< std::is_floating_point_v || (boost::is_complex::value && - std::is_floating_point::type>::value)>>::is_complex_valued = + std::is_floating_point_v::type>)>>::is_complex_valued = !(NumberTraits::is_real_valued); @@ -1287,8 +1287,8 @@ namespace Differentiation std::enable_if_t< std::is_floating_point_v || (boost::is_complex::value && - std::is_floating_point::type>::value)>>::n_supported_derivative_levels = 0; + std::is_floating_point_v::type>)>>::n_supported_derivative_levels = 0; # else diff --git a/include/deal.II/differentiation/sd/symengine_optimizer.h b/include/deal.II/differentiation/sd/symengine_optimizer.h index 74a088c0fa..97d8be6d28 100644 --- a/include/deal.II/differentiation/sd/symengine_optimizer.h +++ b/include/deal.II/differentiation/sd/symengine_optimizer.h @@ -370,8 +370,8 @@ namespace Differentiation { static const bool is_supported = true; - using ReturnType = typename std:: - conditional, float, double>::type; + using ReturnType = + std::conditional_t, float, double>; }; @@ -596,8 +596,8 @@ namespace Differentiation struct LLVMOptimizer>> { - using ReturnType = typename std:: - conditional, float, double>::type; + using ReturnType = + std::conditional_t, float, double>; using OptimizerType = std::conditional_t, SymEngine::LLVMFloatVisitor, @@ -2271,14 +2271,12 @@ namespace Differentiation // Serialize enum classes... { const auto m = - static_cast::type>( - method); + static_cast>(method); ar &m; } { const auto f = - static_cast::type>( - flags); + static_cast>(flags); ar &f; } @@ -2354,13 +2352,13 @@ namespace Differentiation // Deserialize enum classes... { - typename std::underlying_type::type m; - ar &m; + std::underlying_type_t m; + ar &m; method = static_cast(m); } { - typename std::underlying_type::type f; - ar &f; + std::underlying_type_t f; + ar &f; flags = static_cast(f); } diff --git a/include/deal.II/lac/affine_constraints.h b/include/deal.II/lac/affine_constraints.h index f5cbecf809..7194ba6509 100644 --- a/include/deal.II/lac/affine_constraints.h +++ b/include/deal.II/lac/affine_constraints.h @@ -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); diff --git a/include/deal.II/lac/block_indices.h b/include/deal.II/lac/block_indices.h index ddf4f051fc..2170d3408c 100644 --- a/include/deal.II/lac/block_indices.h +++ b/include/deal.II/lac/block_indices.h @@ -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); } diff --git a/include/deal.II/lac/block_vector.h b/include/deal.II/lac/block_vector.h index aa1001f687..17edb54387 100644 --- a/include/deal.II/lac/block_vector.h +++ b/include/deal.II/lac/block_vector.h @@ -323,7 +323,7 @@ public: * u.swap(v), again in analogy to standard functions. */ void - swap(BlockVector &v); + swap(BlockVector &v) noexcept; /** * Print to a stream. @@ -481,7 +481,7 @@ BlockVector::scale(const BlockVector2 &v) */ template inline void -swap(BlockVector &u, BlockVector &v) +swap(BlockVector &u, BlockVector &v) noexcept { u.swap(v); } diff --git a/include/deal.II/lac/block_vector.templates.h b/include/deal.II/lac/block_vector.templates.h index 7408eb859e..c62fd9c9b9 100644 --- a/include/deal.II/lac/block_vector.templates.h +++ b/include/deal.II/lac/block_vector.templates.h @@ -157,7 +157,7 @@ BlockVector::operator=(const TrilinosWrappers::MPI::BlockVector &v) template void -BlockVector::swap(BlockVector &v) +BlockVector::swap(BlockVector &v) noexcept { std::swap(this->components, v.components); diff --git a/include/deal.II/lac/full_matrix.h b/include/deal.II/lac/full_matrix.h index fef8dbb022..46d3fb98bb 100644 --- a/include/deal.II/lac/full_matrix.h +++ b/include/deal.II/lac/full_matrix.h @@ -86,8 +86,7 @@ public: * std::complex. */ static_assert( - std::is_arithmetic< - typename numbers::NumberTraits::real_type>::value, + std::is_arithmetic_v::real_type>, "The FullMatrix class only supports basic numeric types. In particular, it " "does not support automatically differentiated numbers."); diff --git a/include/deal.II/lac/la_parallel_block_vector.h b/include/deal.II/lac/la_parallel_block_vector.h index d4b2b41e42..fc9976bd6e 100644 --- a/include/deal.II/lac/la_parallel_block_vector.h +++ b/include/deal.II/lac/la_parallel_block_vector.h @@ -519,7 +519,7 @@ namespace LinearAlgebra * functions. */ void - swap(BlockVector &v); + swap(BlockVector &v) noexcept; /** @} */ /** @@ -819,7 +819,7 @@ namespace LinearAlgebra template inline void swap(LinearAlgebra::distributed::BlockVector &u, - LinearAlgebra::distributed::BlockVector &v) + LinearAlgebra::distributed::BlockVector &v) noexcept { u.swap(v); } diff --git a/include/deal.II/lac/la_parallel_block_vector.templates.h b/include/deal.II/lac/la_parallel_block_vector.templates.h index e4efc4cae0..fd39a3fff2 100644 --- a/include/deal.II/lac/la_parallel_block_vector.templates.h +++ b/include/deal.II/lac/la_parallel_block_vector.templates.h @@ -833,7 +833,7 @@ namespace LinearAlgebra template inline void - BlockVector::swap(BlockVector &v) + BlockVector::swap(BlockVector &v) noexcept { Assert(this->n_blocks() == v.n_blocks(), ExcDimensionMismatch(this->n_blocks(), v.n_blocks())); diff --git a/include/deal.II/lac/la_parallel_vector.h b/include/deal.II/lac/la_parallel_vector.h index 31e5916222..3a287bcdff 100644 --- a/include/deal.II/lac/la_parallel_vector.h +++ b/include/deal.II/lac/la_parallel_vector.h @@ -452,7 +452,7 @@ namespace LinearAlgebra * analogy to standard functions. */ void - swap(Vector &v); + swap(Vector &v) noexcept; /** * Move assignment operator. @@ -1790,7 +1790,7 @@ namespace LinearAlgebra template inline void swap(LinearAlgebra::distributed::Vector &u, - LinearAlgebra::distributed::Vector &v) + LinearAlgebra::distributed::Vector &v) noexcept { u.swap(v); } diff --git a/include/deal.II/lac/la_parallel_vector.templates.h b/include/deal.II/lac/la_parallel_vector.templates.h index fe29f318b6..1072c6fc7c 100644 --- a/include/deal.II/lac/la_parallel_vector.templates.h +++ b/include/deal.II/lac/la_parallel_vector.templates.h @@ -1367,7 +1367,8 @@ namespace LinearAlgebra template void - Vector::swap(Vector &v) + Vector::swap( + Vector &v) noexcept { #ifdef DEAL_II_WITH_MPI diff --git a/include/deal.II/lac/linear_operator.h b/include/deal.II/lac/linear_operator.h index 0afc365735..7ff7f213d2 100644 --- a/include/deal.II/lac/linear_operator.h +++ b/include/deal.II/lac/linear_operator.h @@ -507,8 +507,8 @@ operator*(typename Range::value_type number, const LinearOperator &op) { static_assert( - std::is_convertible::value, + std::is_convertible_v, "Range and Domain must have implicitly convertible 'value_type's"); if (op.is_null_operator) @@ -574,8 +574,8 @@ operator*(const LinearOperator &op, typename Domain::value_type number) { static_assert( - std::is_convertible::value, + std::is_convertible_v, "Range and Domain must have implicitly convertible 'value_type's"); return number * op; diff --git a/include/deal.II/lac/read_write_vector.h b/include/deal.II/lac/read_write_vector.h index 0b85ec3408..53598dfbb0 100644 --- a/include/deal.II/lac/read_write_vector.h +++ b/include/deal.II/lac/read_write_vector.h @@ -266,7 +266,7 @@ namespace LinearAlgebra * analogy to standard functions. */ void - swap(ReadWriteVector &v); + swap(ReadWriteVector &v) noexcept; /** * Copies the data and the IndexSet of the input vector @p in_vector. @@ -1179,7 +1179,7 @@ namespace LinearAlgebra template inline void swap(LinearAlgebra::ReadWriteVector &u, - LinearAlgebra::ReadWriteVector &v) + LinearAlgebra::ReadWriteVector &v) noexcept { u.swap(v); } diff --git a/include/deal.II/lac/read_write_vector.templates.h b/include/deal.II/lac/read_write_vector.templates.h index a59f1fa13b..d0d31a3f96 100644 --- a/include/deal.II/lac/read_write_vector.templates.h +++ b/include/deal.II/lac/read_write_vector.templates.h @@ -942,7 +942,7 @@ namespace LinearAlgebra template void - ReadWriteVector::swap(ReadWriteVector &v) + ReadWriteVector::swap(ReadWriteVector &v) noexcept { std::swap(stored_elements, v.stored_elements); std::swap(values, v.values); diff --git a/include/deal.II/lac/trilinos_parallel_block_vector.h b/include/deal.II/lac/trilinos_parallel_block_vector.h index f1278eb9cf..5cad7345d0 100644 --- a/include/deal.II/lac/trilinos_parallel_block_vector.h +++ b/include/deal.II/lac/trilinos_parallel_block_vector.h @@ -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); } diff --git a/include/deal.II/lac/trilinos_tpetra_sparsity_pattern.h b/include/deal.II/lac/trilinos_tpetra_sparsity_pattern.h index 3bd929ca6a..31005b6c3f 100644 --- a/include/deal.II/lac/trilinos_tpetra_sparsity_pattern.h +++ b/include/deal.II/lac/trilinos_tpetra_sparsity_pattern.h @@ -1353,11 +1353,11 @@ namespace LinearAlgebra const TrilinosWrappers::types::int_type *col_index_ptr_begin = reinterpret_cast( - const_cast::type *>(&*begin)); + const_cast *>(&*begin)); const TrilinosWrappers::types::int_type *col_index_ptr_end = reinterpret_cast( - const_cast::type *>(&*end)); + const_cast *>(&*end)); // Check at least for the first index that the conversion actually works AssertDimension(*col_index_ptr_begin, *begin); diff --git a/include/deal.II/lac/trilinos_tpetra_vector.h b/include/deal.II/lac/trilinos_tpetra_vector.h index 8e44eb0b49..d8d8afd05a 100644 --- a/include/deal.II/lac/trilinos_tpetra_vector.h +++ b/include/deal.II/lac/trilinos_tpetra_vector.h @@ -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 inline void - swap(Vector &u, Vector &v) + swap(Vector &u, + Vector &v) noexcept { u.swap(v); } @@ -1110,7 +1111,7 @@ namespace LinearAlgebra template inline void - Vector::swap(Vector &v) + Vector::swap(Vector &v) noexcept { vector.swap(v.vector); } diff --git a/include/deal.II/lac/trilinos_vector.h b/include/deal.II/lac/trilinos_vector.h index 439ba748d5..9cc22e4249 100644 --- a/include/deal.II/lac/trilinos_vector.h +++ b/include/deal.II/lac/trilinos_vector.h @@ -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); } diff --git a/include/deal.II/lac/vector.h b/include/deal.II/lac/vector.h index 550a54c65f..045ab4eb8e 100644 --- a/include/deal.II/lac/vector.h +++ b/include/deal.II/lac/vector.h @@ -127,8 +127,7 @@ public: * std::complex. */ static_assert( - std::is_arithmetic< - typename numbers::NumberTraits::real_type>::value, + std::is_arithmetic_v::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 &v); + swap(Vector &v) noexcept; /** * Set all components of the vector to the given number @p s. @@ -1436,7 +1435,7 @@ Vector::reinit(const Vector &v, // swap virtual. template inline void -Vector::swap(Vector &v) +Vector::swap(Vector &v) noexcept { values.swap(v.values); std::swap(thread_loop_partitioner, v.thread_loop_partitioner); @@ -1485,7 +1484,7 @@ Vector::load(Archive &ar, const unsigned int) */ template inline void -swap(Vector &u, Vector &v) +swap(Vector &u, Vector &v) noexcept { u.swap(v); } diff --git a/include/deal.II/matrix_free/fe_remote_evaluation.h b/include/deal.II/matrix_free/fe_remote_evaluation.h index 6546a9825a..a81f330c11 100644 --- a/include/deal.II/matrix_free/fe_remote_evaluation.h +++ b/include/deal.II/matrix_free/fe_remote_evaluation.h @@ -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. diff --git a/include/deal.II/matrix_free/tools.h b/include/deal.II/matrix_free/tools.h index 287e8e6c3e..cb83556412 100644 --- a/include/deal.II/matrix_free/tools.h +++ b/include/deal.II/matrix_free/tools.h @@ -1772,13 +1772,13 @@ namespace MatrixFreeTools * If value type of matrix and constrains equals, return a reference * to the given AffineConstraint instance. */ - template ::type>::type, - typename std::remove_const::type>::type>> * = nullptr> + template < + typename MatrixType, + typename Number, + std::enable_if_t>, + std::remove_const_t>>> * = nullptr> const AffineConstraints & 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 ::type>::type, - typename std::remove_const::type>::type>> * = nullptr> + template < + typename MatrixType, + typename Number, + std::enable_if_t>, + std::remove_const_t>>> * = nullptr> const AffineConstraints & create_new_affine_constraints_if_needed( const MatrixType &, diff --git a/source/base/index_set.cc b/source/base/index_set.cc index 7b4186fa4f..cb70f27a86 100644 --- a/source/base/index_set.cc +++ b/source/base/index_set.cc @@ -40,7 +40,8 @@ DEAL_II_NAMESPACE_OPEN # ifdef DEAL_II_TRILINOS_WITH_TPETRA IndexSet::IndexSet( - Teuchos::RCP> map) + const Teuchos::RCP> + &map) : is_compressed(true) , index_space_size(1 + map->getMaxAllGlobalIndex()) , largest_range(numbers::invalid_unsigned_int) diff --git a/source/differentiation/sd/symengine_number_types.cc b/source/differentiation/sd/symengine_number_types.cc index 46eb5f6895..2e02a91425 100644 --- a/source/differentiation/sd/symengine_number_types.cc +++ b/source/differentiation/sd/symengine_number_types.cc @@ -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(entry.first.get_RCP())}); + piecewise_function.emplace_back( + entry.second.get_RCP(), + SE::rcp_static_cast(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); } diff --git a/source/differentiation/sd/symengine_utilities.cc b/source/differentiation/sd/symengine_utilities.cc index b50972f297..e33a93d254 100644 --- a/source/differentiation/sd/symengine_utilities.cc +++ b/source/differentiation/sd/symengine_utilities.cc @@ -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; } diff --git a/source/grid/grid_in.cc b/source/grid/grid_in.cc index 71687f1984..3cec748811 100644 --- a/source/grid/grid_in.cc +++ b/source/grid/grid_in.cc @@ -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: diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index 2503c671fd..91a664ae57 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -3676,6 +3676,7 @@ namespace GridTools ArborXWrappers::DistributedTree distributed_tree( comm, global_bboxes[0]); std::vector> query_bounding_boxes; + query_bounding_boxes.reserve(entities.size()); for (const auto &entity : entities) query_bounding_boxes.emplace_back( BoundingBox(entity).create_extended(tolerance)); diff --git a/source/lac/trilinos_vector.cc b/source/lac/trilinos_vector.cc index f3404b72cb..9ed58caaa0 100644 --- a/source/lac/trilinos_vector.cc +++ b/source/lac/trilinos_vector.cc @@ -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); -- 2.39.5