From 71a0343dcd773af5a221e28e8dc75bc7bcedfd74 Mon Sep 17 00:00:00 2001 From: Stephane Del Pino <stephane.delpino44@gmail.com> Date: Wed, 1 Aug 2018 14:13:26 +0200 Subject: [PATCH] Define cell local number in node cells table --- src/mesh/Connectivity.hpp | 7 +++++++ src/mesh/ConnectivityComputer.cpp | 21 +++++++++++++++++++++ src/mesh/ConnectivityComputer.hpp | 4 ++++ 3 files changed, 32 insertions(+) diff --git a/src/mesh/Connectivity.hpp b/src/mesh/Connectivity.hpp index 64372ef35..b02da8ac7 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 ea6900fa1..691df7776 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 4fb47cc20..d10a5652c 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; -- GitLab