Skip to content
Snippets Groups Projects
Commit 5ba73bfb authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Add {item}IsOwned mechanism

This is based on ItemValue<const bool>, a refinement could be to build this
information on demand.
parent 62780add
No related branches found
No related tags found
1 merge request!11Feature/mpi
#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();
}
}
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment