diff --git a/src/mesh/Connectivity.cpp b/src/mesh/Connectivity.cpp index 71f1d1c2d787ad1069fe57687125b3599c917567..b5ff6b825d42582379c94257452c5ac00095c9c8 100644 --- a/src/mesh/Connectivity.cpp +++ b/src/mesh/Connectivity.cpp @@ -1,6 +1,8 @@ #include <Connectivity.hpp> #include <map> +#include <Messenger.hpp> + template<size_t Dimension> Connectivity<Dimension>:: @@ -66,12 +68,30 @@ Connectivity(const ConnectivityDescriptor& descriptor) m_cell_owner = cell_owner; } + { + const int rank = parallel::rank(); + CellValue<bool> cell_is_owned(*this); + parallel_for(this->numberOfCells(), PASTIS_LAMBDA(const CellId& j) { + cell_is_owned[j] = (m_cell_owner[j] == rank); + }); + m_cell_is_owned = cell_is_owned; + } + { NodeValue<int> node_owner(*this); node_owner = convert_to_array(descriptor.node_owner_vector); m_node_owner = node_owner; } + { + const int rank = parallel::rank(); + NodeValue<bool> node_is_owned(*this); + parallel_for(this->numberOfNodes(), PASTIS_LAMBDA(const NodeId& r) { + node_is_owned[r] = (m_node_owner[r] == rank); + }); + m_node_is_owned = node_is_owned; + } + if constexpr (Dimension>1) { auto& face_to_node_matrix = m_item_to_item_matrix[itemTId(ItemType::face)][itemTId(ItemType::node)]; @@ -103,6 +123,16 @@ Connectivity(const ConnectivityDescriptor& descriptor) m_face_owner = face_owner; } + { + const int rank = parallel::rank(); + FaceValue<bool> face_is_owned(*this); + parallel_for(this->numberOfFaces(), PASTIS_LAMBDA(const FaceId& l) { + face_is_owned[l] = (m_face_owner[l] == rank); + }); + m_face_is_owned = face_is_owned; + } + + m_ref_face_list = descriptor.refFaceList(); } } diff --git a/src/mesh/Connectivity.hpp b/src/mesh/Connectivity.hpp index fea77ee29dd63e573d2e9e5e716d2087daf58a7a..335689a34b2aa954c69f4facfc158d9b48606b51 100644 --- a/src/mesh/Connectivity.hpp +++ b/src/mesh/Connectivity.hpp @@ -104,9 +104,13 @@ class Connectivity final NodeValue<const int> m_node_number; CellValue<const int> m_cell_owner; + CellValue<const bool> m_cell_is_owned; + FaceValue<const int> m_face_owner; -#warning Missing EdgeValue<const int> m_edge_owner; + FaceValue<const bool> m_face_is_owned; +#warning Missing EdgeValue<const int> m_edge_owner and m_edge_is_owned; NodeValue<const int> m_node_owner; + NodeValue<const bool> m_node_is_owned; FaceValuePerCell<const bool> m_cell_face_is_reversed; @@ -215,6 +219,24 @@ class Connectivity final return m_node_owner; } + PASTIS_INLINE + const CellValue<const bool>& cellIsOwned() const + { + return m_cell_is_owned; + } + + PASTIS_INLINE + const FaceValue<const bool>& faceIsOwned() const + { + return m_face_is_owned; + } + + PASTIS_INLINE + const NodeValue<const bool>& nodeIsOwned() const + { + return m_node_is_owned; + } + PASTIS_INLINE const bool& isConnectivityMatrixBuilt(const ItemType& item_type_0, const ItemType& item_type_1) const