diff --git a/src/algebra/CRSMatrix.hpp b/src/algebra/CRSMatrix.hpp index b8a0f0a98be4036ae2bbdb9b356324aa4bc7eb9d..740343cd612f22911e187351b7929eedfbf7dcff 100644 --- a/src/algebra/CRSMatrix.hpp +++ b/src/algebra/CRSMatrix.hpp @@ -31,8 +31,7 @@ class CRSMatrix } template <typename DataType2> - Vector<MutableDataType> - operator*(const Vector<DataType2>& x) const + Vector<MutableDataType> operator*(const Vector<DataType2>& x) const { static_assert(std::is_same<std::remove_const_t<DataType>, std::remove_const_t<DataType2>>(), "Cannot multiply matrix and vector of different type"); diff --git a/src/algebra/SparseMatrixDescriptor.hpp b/src/algebra/SparseMatrixDescriptor.hpp index 6150fd450103980530b4c5eeaebbd2ab07c60c66..badfb96305c72dbe5777c689a0861dfed299ff51 100644 --- a/src/algebra/SparseMatrixDescriptor.hpp +++ b/src/algebra/SparseMatrixDescriptor.hpp @@ -28,16 +28,14 @@ class SparseMatrixDescriptor return m_id_value_map.size(); } - const DataType& - operator[](const IndexType& j) const + const DataType& operator[](const IndexType& j) const { auto i_value = m_id_value_map.find(j); Assert(i_value != m_id_value_map.end()); return i_value->second; } - DataType& - operator[](const IndexType& j) + DataType& operator[](const IndexType& j) { auto i_value = m_id_value_map.find(j); if (i_value != m_id_value_map.end()) { diff --git a/src/algebra/TinyMatrix.hpp b/src/algebra/TinyMatrix.hpp index 5949d3cf452f1d5017fc00829b2908102b3738c2..7a67fe0c1f11cd2a08954462b83fe2339a9b4adb 100644 --- a/src/algebra/TinyMatrix.hpp +++ b/src/algebra/TinyMatrix.hpp @@ -49,16 +49,14 @@ class TinyMatrix } PUGS_INLINE - constexpr friend TinyMatrix - operator*(const T& t, const TinyMatrix& A) + constexpr friend TinyMatrix operator*(const T& t, const TinyMatrix& A) { TinyMatrix B = A; return B *= t; } PUGS_INLINE - constexpr friend TinyMatrix - operator*(const T& t, TinyMatrix&& A) + constexpr friend TinyMatrix operator*(const T& t, TinyMatrix&& A) { return std::move(A *= t); } @@ -74,8 +72,7 @@ class TinyMatrix } PUGS_INLINE - constexpr TinyMatrix - operator*(const TinyMatrix& B) const + constexpr TinyMatrix operator*(const TinyMatrix& B) const { const TinyMatrix& A = *this; TinyMatrix AB; @@ -92,8 +89,7 @@ class TinyMatrix } PUGS_INLINE - constexpr TinyVector<N, T> - operator*(const TinyVector<N, T>& x) const + constexpr TinyVector<N, T> operator*(const TinyVector<N, T>& x) const { const TinyMatrix& A = *this; TinyVector<N, T> Ax; diff --git a/src/algebra/TinyVector.hpp b/src/algebra/TinyVector.hpp index 1f8cf48fb1cd4e4f55df00caa9de9655a151d774..187c405ee0a3f2007aeb9d98e2b403cbcf472ee7 100644 --- a/src/algebra/TinyVector.hpp +++ b/src/algebra/TinyVector.hpp @@ -88,16 +88,14 @@ class TinyVector } PUGS_INLINE - constexpr friend TinyVector - operator*(const T& t, const TinyVector& v) + constexpr friend TinyVector operator*(const T& t, const TinyVector& v) { TinyVector w = v; return w *= t; } PUGS_INLINE - constexpr friend TinyVector - operator*(const T& t, TinyVector&& v) + constexpr friend TinyVector operator*(const T& t, TinyVector&& v) { v *= t; return std::move(v); @@ -187,16 +185,14 @@ class TinyVector } PUGS_INLINE - constexpr T& - operator[](const size_t& i) noexcept(NO_ASSERT) + constexpr T& operator[](const size_t& i) noexcept(NO_ASSERT) { Assert(i < N); return m_values[i]; } PUGS_INLINE - constexpr const T& - operator[](const size_t& i) const noexcept(NO_ASSERT) + constexpr const T& operator[](const size_t& i) const noexcept(NO_ASSERT) { Assert(i < N); return m_values[i]; diff --git a/src/algebra/Vector.hpp b/src/algebra/Vector.hpp index ce03039489722d3aa8ab11f99051e5f18d7e8aca..43865dae1827cdb4875b3963127adafe78a8c6f3 100644 --- a/src/algebra/Vector.hpp +++ b/src/algebra/Vector.hpp @@ -33,8 +33,7 @@ class Vector // LCOV_EXCL_LINE return x_copy; } - friend Vector - operator*(const DataType& a, const Vector& x) + friend Vector operator*(const DataType& a, const Vector& x) { Vector<std::remove_const_t<DataType>> y = copy(x); return y *= a; @@ -131,8 +130,7 @@ class Vector // LCOV_EXCL_LINE } PUGS_INLINE - DataType& - operator[](const index_type& i) const noexcept(NO_ASSERT) + DataType& operator[](const index_type& i) const noexcept(NO_ASSERT) { return m_values[i]; } diff --git a/src/language/DataVariant.hpp b/src/language/DataVariant.hpp index 1aacda6502966b48e88b5181879a4bacdc159514..f6f088baf46aa098f21a414b497e0a0007d56422 100644 --- a/src/language/DataVariant.hpp +++ b/src/language/DataVariant.hpp @@ -74,16 +74,14 @@ class AggregateDataVariant // LCOV_EXCL_LINE } PUGS_INLINE - DataVariant& - operator[](size_t i) + DataVariant& operator[](size_t i) { Assert(i < m_data_vector.size()); return m_data_vector[i]; } PUGS_INLINE - const DataVariant& - operator[](size_t i) const + const DataVariant& operator[](size_t i) const { Assert(i < m_data_vector.size()); return m_data_vector[i]; diff --git a/src/language/EmbedderTable.hpp b/src/language/EmbedderTable.hpp index f12c1843dc0ae36f9af766f63eb0700819ad627c..e91df6d398b66ca0174e2beeaea0af5ed198e6ae 100644 --- a/src/language/EmbedderTable.hpp +++ b/src/language/EmbedderTable.hpp @@ -21,8 +21,7 @@ class EmbedderTable } PUGS_INLINE - const std::shared_ptr<EmbedderT>& - operator[](size_t embedder_id) const + const std::shared_ptr<EmbedderT>& operator[](size_t embedder_id) const { Assert(embedder_id < m_embedder_list.size()); return m_embedder_list[embedder_id]; diff --git a/src/language/FunctionTable.hpp b/src/language/FunctionTable.hpp index dfa43f6d02d2f601991f80f3bdfd6efde75597be..0b64d9fb8c02e51a758ef9c191c0a8702d72298a 100644 --- a/src/language/FunctionTable.hpp +++ b/src/language/FunctionTable.hpp @@ -62,16 +62,14 @@ class FunctionTable } PUGS_INLINE - FunctionDescriptor& - operator[](size_t function_id) + FunctionDescriptor& operator[](size_t function_id) { Assert(function_id < m_function_descriptor_list.size()); return m_function_descriptor_list[function_id]; } PUGS_INLINE - const FunctionDescriptor& - operator[](size_t function_id) const + const FunctionDescriptor& operator[](size_t function_id) const { Assert(function_id < m_function_descriptor_list.size()); return m_function_descriptor_list[function_id]; diff --git a/src/language/node_processor/ExecutionPolicy.hpp b/src/language/node_processor/ExecutionPolicy.hpp index f2845d9f5aa0e3b7c16dddd1393f3e91fc31bdb9..df0eb972712d1eb3eca0ca04053b10746da0c17c 100644 --- a/src/language/node_processor/ExecutionPolicy.hpp +++ b/src/language/node_processor/ExecutionPolicy.hpp @@ -35,14 +35,12 @@ class ExecutionPolicy return m_shared_values->size(); } - DataVariant& - operator[](size_t i) + DataVariant& operator[](size_t i) { return (*m_shared_values)[i]; } - const DataVariant& - operator[](size_t i) const + const DataVariant& operator[](size_t i) const { return (*m_shared_values)[i]; } diff --git a/src/mesh/ItemId.hpp b/src/mesh/ItemId.hpp index 3e03f4e5d29c14f55eaa57e03ee6a736980e1549..de7790668e17261edf0446cea870ff1c1f9202a9 100644 --- a/src/mesh/ItemId.hpp +++ b/src/mesh/ItemId.hpp @@ -15,7 +15,7 @@ class ItemIdT public: PUGS_INLINE - constexpr operator const base_type &() const + constexpr operator const base_type&() const { return m_id; } diff --git a/src/mesh/ItemToItemMatrix.hpp b/src/mesh/ItemToItemMatrix.hpp index e76f25a7736b34edf49e0c65106eac086437f2cb..04b8a7b7487cb22789f4ff48c09292b403476695 100644 --- a/src/mesh/ItemToItemMatrix.hpp +++ b/src/mesh/ItemToItemMatrix.hpp @@ -29,8 +29,7 @@ class ItemToItemMatrix } PUGS_INLINE - TargetItemId - operator[](const size_t& j) const + TargetItemId operator[](const size_t& j) const { return m_row(j); } @@ -74,16 +73,14 @@ class ItemToItemMatrix } PUGS_INLINE - auto - operator[](const SourceItemId& source_id) const + auto operator[](const SourceItemId& source_id) const { using RowType = decltype(m_connectivity_matrix.rowConst(source_id)); return SubItemList<RowType>(m_connectivity_matrix.rowConst(source_id)); } template <typename IndexType> - PUGS_INLINE const auto& - operator[](const IndexType& source_id) const + PUGS_INLINE const auto& operator[](const IndexType& source_id) const { static_assert(std::is_same_v<IndexType, SourceItemId>, "ItemToItemMatrix must be indexed using correct ItemId"); using RowType = decltype(m_connectivity_matrix.rowConst(source_id)); diff --git a/src/mesh/ItemValue.hpp b/src/mesh/ItemValue.hpp index 4de89ce34d21a2df38529299ace225b9a9c902d4..81301f7a3d9a33e66906c20a48d984c22139bf8a 100644 --- a/src/mesh/ItemValue.hpp +++ b/src/mesh/ItemValue.hpp @@ -85,16 +85,14 @@ class ItemValue // Following Kokkos logic, these classes are view and const view does allow // changes in data PUGS_FORCEINLINE - DataType& - operator[](const ItemId& i) const noexcept(NO_ASSERT) + DataType& operator[](const ItemId& i) const noexcept(NO_ASSERT) { Assert(this->isBuilt()); return m_values[i]; } template <typename IndexType> - DataType& - operator[](const IndexType&) const noexcept(NO_ASSERT) + DataType& operator[](const IndexType&) const noexcept(NO_ASSERT) { static_assert(std::is_same_v<IndexType, ItemId>, "ItemValue must be indexed by ItemId"); } diff --git a/src/mesh/SubItemValuePerItem.hpp b/src/mesh/SubItemValuePerItem.hpp index f4d40a0e53b1484b819ff83210c29606fb0c4149..a115bdedefee1c00f5894aaaea644f3ab715abf8 100644 --- a/src/mesh/SubItemValuePerItem.hpp +++ b/src/mesh/SubItemValuePerItem.hpp @@ -59,16 +59,14 @@ class SubItemValuePerItem public: PUGS_INLINE - const DataType& - operator[](const size_t& i) const noexcept(NO_ASSERT) + const DataType& operator[](const size_t& i) const noexcept(NO_ASSERT) { Assert(i < m_size); return m_sub_values[i]; } PUGS_FORCEINLINE - DataType& - operator[](const size_t& i) noexcept(NO_ASSERT) + DataType& operator[](const size_t& i) noexcept(NO_ASSERT) { Assert(i < m_size); return m_sub_values[i]; @@ -132,16 +130,14 @@ class SubItemValuePerItem // Following Kokkos logic, these classes are view and const view does allow // changes in data PUGS_FORCEINLINE - DataType& - operator[](const size_t& i) const noexcept(NO_ASSERT) + DataType& operator[](const size_t& i) const noexcept(NO_ASSERT) { Assert(this->isBuilt()); return m_values[i]; } template <typename IndexType> - DataType& - operator[](const IndexType& i) const noexcept(NO_ASSERT) + DataType& operator[](const IndexType& i) const noexcept(NO_ASSERT) { static_assert(std::is_same_v<IndexType, size_t>, "Access to SubItemValuePerItem's array must be indexed by " "size_t"); diff --git a/src/utils/Array.hpp b/src/utils/Array.hpp index a04d78a255efa7ec127dfb0530a83b43e73ab670..eaf368b3e7207e6ce849ff111a0dfff6ab113c6d 100644 --- a/src/utils/Array.hpp +++ b/src/utils/Array.hpp @@ -43,8 +43,7 @@ class Array friend PUGS_INLINE Array<DataType2> encapsulate(const Kokkos::View<DataType2*, RT...>& values); PUGS_INLINE - DataType& - operator[](const index_type& i) const noexcept(NO_ASSERT) + DataType& operator[](const index_type& i) const noexcept(NO_ASSERT) { Assert(i < m_values.extent(0)); return m_values[i]; diff --git a/src/utils/CastArray.hpp b/src/utils/CastArray.hpp index 274f5d8d4dcb6454e7a44a0c0bd75721a4c2e6a9..5202d886256692d48f50225654f77e9a1ae749d2 100644 --- a/src/utils/CastArray.hpp +++ b/src/utils/CastArray.hpp @@ -26,8 +26,7 @@ class CastArray } PUGS_INLINE - CastDataType& - operator[](const size_t& i) const + CastDataType& operator[](const size_t& i) const { Assert(i < m_size); return m_values[i]; diff --git a/tests/mpi_test_Messenger.cpp b/tests/mpi_test_Messenger.cpp index b722835502257b2f21c9e3174bd7967d0f94b675..7dae0088d7453e71f4b91489a5beee1956d5c891 100644 --- a/tests/mpi_test_Messenger.cpp +++ b/tests/mpi_test_Messenger.cpp @@ -22,7 +22,7 @@ struct integer { return m_int; } - operator const int &() const + operator const int&() const { return m_int; }