From eb758ca9cdebaf9b37cc0469930c13dcfcacb0fe Mon Sep 17 00:00:00 2001 From: Stephane Del Pino <stephane.delpino44@gmail.com> Date: Tue, 11 Sep 2018 18:54:17 +0200 Subject: [PATCH] Impose item->item connectivity access through correct ItemId --- src/mesh/ItemToItemMatrix.hpp | 9 +++++++++ src/mesh/MeshNodeBoundary.hpp | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mesh/ItemToItemMatrix.hpp b/src/mesh/ItemToItemMatrix.hpp index d03ee9e0c..20f57dc33 100644 --- a/src/mesh/ItemToItemMatrix.hpp +++ b/src/mesh/ItemToItemMatrix.hpp @@ -60,6 +60,15 @@ class ItemToItemMatrix return SubItemList<RowType>(m_connectivity_matrix.rowConst(source_id)); } + template <typename IndexType> + const auto operator[](const IndexType& source_id) const + { + static_assert(std::is_same<IndexType, SourceItemId>(), + "ItemToItemMatrix must be indexed using correct ItemId"); + using RowType = decltype(m_connectivity_matrix.rowConst(source_id)); + return SubItemList<RowType>(m_connectivity_matrix.rowConst(source_id)); + } + ItemToItemMatrix(const ConnectivityMatrix& connectivity_matrix) : m_connectivity_matrix{connectivity_matrix} { diff --git a/src/mesh/MeshNodeBoundary.hpp b/src/mesh/MeshNodeBoundary.hpp index fe84d7860..0a4b9ec63 100644 --- a/src/mesh/MeshNodeBoundary.hpp +++ b/src/mesh/MeshNodeBoundary.hpp @@ -52,7 +52,7 @@ class MeshNodeBoundary = mesh.connectivity().faceToNodeMatrix(); for (size_t l=0; l<face_list.size(); ++l) { - const size_t face_number = face_list[l]; + const FaceId face_number = face_list[l]; const auto& face_nodes = face_to_node_matrix[face_number]; for (size_t r=0; r<face_nodes.size(); ++r) { -- GitLab