From 2056ed421c86c3e857f092f060df6eaee665ee07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Del=20Pino?= <stephane.delpino44@gmail.com> Date: Thu, 10 Mar 2022 14:13:21 +0100 Subject: [PATCH] Make IConnectivity::getMatrix() public --- src/mesh/Connectivity.hpp | 6 +++--- src/mesh/ConnectivityComputer.cpp | 4 ++-- src/mesh/IConnectivity.hpp | 5 ++--- src/mesh/SubItemArrayPerItem.hpp | 2 +- src/mesh/SubItemValuePerItem.hpp | 4 ++-- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/mesh/Connectivity.hpp b/src/mesh/Connectivity.hpp index dc2e0e890..3ec986e8b 100644 --- a/src/mesh/Connectivity.hpp +++ b/src/mesh/Connectivity.hpp @@ -123,9 +123,10 @@ class Connectivity final : public IConnectivity friend class ConnectivityComputer; + public: PUGS_INLINE const ConnectivityMatrix& - _getMatrix(const ItemType& item_type_0, const ItemType& item_type_1) const + getMatrix(const ItemType& item_type_0, const ItemType& item_type_1) const final { const ConnectivityMatrix& connectivity_matrix = m_item_to_item_matrix[itemTId(item_type_0)][itemTId(item_type_1)]; if (not connectivity_matrix.isBuilt()) { @@ -135,7 +136,6 @@ class Connectivity final : public IConnectivity return connectivity_matrix; } - public: PUGS_INLINE CellValue<const CellType> cellType() const @@ -336,7 +336,7 @@ class Connectivity final : public IConnectivity PUGS_INLINE ItemToItemMatrix<source_item_type, target_item_type> getItemToItemMatrix() const { - return ItemToItemMatrix<source_item_type, target_item_type>(_getMatrix(source_item_type, target_item_type)); + return ItemToItemMatrix<source_item_type, target_item_type>(getMatrix(source_item_type, target_item_type)); } PUGS_INLINE diff --git a/src/mesh/ConnectivityComputer.cpp b/src/mesh/ConnectivityComputer.cpp index 3c4d1714f..7e8b32020 100644 --- a/src/mesh/ConnectivityComputer.cpp +++ b/src/mesh/ConnectivityComputer.cpp @@ -15,7 +15,7 @@ ConnectivityComputer::computeConnectivityMatrix(const ConnectivityType& connecti { ConnectivityMatrix item_to_child_item_matrix; if (connectivity.isConnectivityMatrixBuilt(child_item_type, item_type)) { - const ConnectivityMatrix& child_to_item_matrix = connectivity._getMatrix(child_item_type, item_type); + const ConnectivityMatrix& child_to_item_matrix = connectivity.getMatrix(child_item_type, item_type); std::cout << "computing connectivity " << itemName(item_type) << " -> " << itemName(child_item_type) << '\n'; @@ -58,7 +58,7 @@ ConnectivityComputer::_computeInverse(const ConnectivityMatrix& item_to_child_ma size_t i = 0; for (const auto& [child_item_id, item_vector] : child_to_item_vector_map) { if (child_item_id != i) { - throw NotImplementedError("sparse item numerotation NIY\n"); + throw NotImplementedError("sparse item numerotation"); } ++i; } diff --git a/src/mesh/IConnectivity.hpp b/src/mesh/IConnectivity.hpp index 90c49e4d8..def3475c3 100644 --- a/src/mesh/IConnectivity.hpp +++ b/src/mesh/IConnectivity.hpp @@ -9,16 +9,15 @@ class IConnectivity : public std::enable_shared_from_this<IConnectivity> { - protected: + public: template <typename DataType, typename ItemOfItem, typename ConnectivityPtr> friend class SubItemValuePerItem; template <typename DataType, typename ItemOfItem, typename ConnectivityPtr> friend class SubItemArrayPerItem; - virtual const ConnectivityMatrix& _getMatrix(const ItemType& item_type_0, const ItemType& item_type_1) const = 0; + virtual const ConnectivityMatrix& getMatrix(const ItemType& item_type_0, const ItemType& item_type_1) const = 0; - public: virtual size_t dimension() const = 0; std::shared_ptr<const IConnectivity> diff --git a/src/mesh/SubItemArrayPerItem.hpp b/src/mesh/SubItemArrayPerItem.hpp index 96a8edb56..318063f8a 100644 --- a/src/mesh/SubItemArrayPerItem.hpp +++ b/src/mesh/SubItemArrayPerItem.hpp @@ -197,7 +197,7 @@ class SubItemArrayPerItem static_assert(not std::is_const_v<DataType>, "Cannot allocate SubItemArrayPerItem of const data: only " "view is supported"); - ConnectivityMatrix connectivity_matrix = connectivity._getMatrix(item_type, sub_item_type); + ConnectivityMatrix connectivity_matrix = connectivity.getMatrix(item_type, sub_item_type); m_row_map = connectivity_matrix.rowsMap(); m_values = Table<std::remove_const_t<DataType>>(connectivity_matrix.numberOfValues(), size_of_arrays); diff --git a/src/mesh/SubItemValuePerItem.hpp b/src/mesh/SubItemValuePerItem.hpp index 820117656..865238539 100644 --- a/src/mesh/SubItemValuePerItem.hpp +++ b/src/mesh/SubItemValuePerItem.hpp @@ -192,10 +192,10 @@ class SubItemValuePerItem static_assert(not std::is_const_v<DataType>, "Cannot allocate SubItemValuePerItem of const data: only " "view is supported"); - ConnectivityMatrix connectivity_matrix = connectivity._getMatrix(item_type, sub_item_type); + ConnectivityMatrix connectivity_matrix = connectivity.getMatrix(item_type, sub_item_type); m_row_map = connectivity_matrix.rowsMap(); - m_values = Array<std::remove_const_t<DataType>>(connectivity_matrix.numberOfValues()); + m_values = Array<DataType>(connectivity_matrix.numberOfValues()); } ~SubItemValuePerItem() = default; -- GitLab