diff --git a/src/mesh/Connectivity.hpp b/src/mesh/Connectivity.hpp index 64372ef3518c2b947f8a64c4a9d11fb07e2a04c4..b02da8ac7b3af0f46b63b9bdb0e577f592bb3f80 100644 --- a/src/mesh/Connectivity.hpp +++ b/src/mesh/Connectivity.hpp @@ -230,6 +230,7 @@ public: static constexpr bool has_face = (dimension>1); ConnectivityMatrix m_cell_to_node_matrix; + NodeValuePerCell<unsigned short> m_cell_to_node_local_cell; ConnectivityMatrix m_cell_to_face_matrix; FaceValuePerCell<bool> m_cell_face_is_reversed; @@ -356,6 +357,12 @@ private: m_connectivity_computer.computeLocalChildItemNumberInItem(m_cell_to_node_matrix, m_node_to_cell_matrix, m_node_to_cell_local_node); + + m_cell_to_node_local_cell = NodeValuePerCell<unsigned short>(*this); + + m_connectivity_computer.computeLocalChildItemNumberInItem(m_node_to_cell_matrix, + m_cell_to_node_matrix, + m_cell_to_node_local_cell); if constexpr (Dimension>1) { this->_computeFaceCellConnectivities(); } diff --git a/src/mesh/ConnectivityComputer.cpp b/src/mesh/ConnectivityComputer.cpp index ea6900fa1546591b77e2f39c1211aba9f467f344..691df7776db83e44a1bf7f18b91bd84f6627cf18 100644 --- a/src/mesh/ConnectivityComputer.cpp +++ b/src/mesh/ConnectivityComputer.cpp @@ -55,6 +55,27 @@ computeLocalChildItemNumberInItem(const ConnectivityMatrix& item_to_child_items_ } +void ConnectivityComputer:: +computeLocalChildItemNumberInItem(const ConnectivityMatrix& item_to_child_items_matrix, + const ConnectivityMatrix& child_item_to_items_matrix, + NodeValuePerCell<unsigned short>& child_item_number_in_item_matrix) const +{ + for (unsigned int r=0; r<child_item_to_items_matrix.numRows(); ++r) { + const auto& child_item_to_items = child_item_to_items_matrix.rowConst(r); + for (unsigned short J=0; J<child_item_to_items.length; ++J) { + const unsigned int j = child_item_to_items(J); + const auto& item_to_child_items = item_to_child_items_matrix.rowConst(j); + + for (unsigned int R=0; R<item_to_child_items.length; ++R) { + if (item_to_child_items(R) == r) { + child_item_number_in_item_matrix(r,J) = R; + break; + } + } + } + } +} + void ConnectivityComputer:: computeLocalChildItemNumberInItem(const ConnectivityMatrix& item_to_child_items_matrix, diff --git a/src/mesh/ConnectivityComputer.hpp b/src/mesh/ConnectivityComputer.hpp index 4fb47cc206edcc34e5186e9e37dac03b15741cd7..d10a5652c5da137a7c1b2bb4ffe332eda8077727 100644 --- a/src/mesh/ConnectivityComputer.hpp +++ b/src/mesh/ConnectivityComputer.hpp @@ -13,6 +13,10 @@ struct ConnectivityComputer const ConnectivityMatrix& child_item_to_items_matrix, CellValuePerNode<unsigned short>& child_item_number_in_item_matrix) const; + void computeLocalChildItemNumberInItem(const ConnectivityMatrix& item_to_child_items_matrix, + const ConnectivityMatrix& child_item_to_items_matrix, + NodeValuePerCell<unsigned short>& child_item_number_in_item_matrix) const; + void computeLocalChildItemNumberInItem(const ConnectivityMatrix& item_to_child_items_matrix, const ConnectivityMatrix& child_item_to_items_matrix, CellValuePerFace<unsigned short>& child_item_number_in_item_matrix) const;