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

Continue debugging [ci-skip]

Cells and nodes look ok.
Faces (and probably edges are not correctly exchanged yet)
parent 31b27760
No related branches found
No related tags found
1 merge request!204Remove m_cell_global_index from Connectivity
This commit is part of merge request !204. Comments created here will be created in the context of that merge request.
...@@ -14,19 +14,13 @@ template <ItemType item_type> ...@@ -14,19 +14,13 @@ template <ItemType item_type>
void void
ConnectivityDispatcher<Dimension>::_buildNewOwner() ConnectivityDispatcher<Dimension>::_buildNewOwner()
{ {
std::cout << "#### " << rang::fgB::yellow << itemName(item_type) << rang::fg::reset << " _buildNewOwner() ####\n";
if constexpr (item_type == ItemType::cell) { if constexpr (item_type == ItemType::cell) {
CRSGraph connectivity_graph = m_connectivity.ownCellToCellGraph(); CRSGraph connectivity_graph = m_connectivity.ownCellToCellGraph();
Partitioner P; Partitioner P;
Array new_owner_array = P.partition(connectivity_graph); Array new_owner_array = P.partition(connectivity_graph);
std::cout << "new_owner_array = " << new_owner_array << '\n';
const auto& cell_is_owned = m_connectivity.cellIsOwned(); const auto& cell_is_owned = m_connectivity.cellIsOwned();
std::cout << "cell_is_owned = " << cell_is_owned << '\n';
CellValue<int> cell_new_owner(m_connectivity); CellValue<int> cell_new_owner(m_connectivity);
size_t i = 0; size_t i = 0;
...@@ -37,9 +31,6 @@ ConnectivityDispatcher<Dimension>::_buildNewOwner() ...@@ -37,9 +31,6 @@ ConnectivityDispatcher<Dimension>::_buildNewOwner()
} }
synchronize(cell_new_owner); synchronize(cell_new_owner);
std::cout << "cell_new_owner = " << cell_new_owner << '\n';
std::cout << "cell_number = " << m_connectivity.template number<item_type>() << '\n';
this->_dispatchedInfo<ItemType::cell>().m_new_owner = cell_new_owner; this->_dispatchedInfo<ItemType::cell>().m_new_owner = cell_new_owner;
} else { } else {
const auto& item_to_cell_matrix = m_connectivity.template getItemToItemMatrix<item_type, ItemType::cell>(); const auto& item_to_cell_matrix = m_connectivity.template getItemToItemMatrix<item_type, ItemType::cell>();
...@@ -65,9 +56,6 @@ ConnectivityDispatcher<Dimension>::_buildNewOwner() ...@@ -65,9 +56,6 @@ ConnectivityDispatcher<Dimension>::_buildNewOwner()
synchronize(item_new_owner); synchronize(item_new_owner);
std::cout << itemName(item_type) << "_new_owner = " << item_new_owner << '\n';
std::cout << itemName(item_type) << "_number = " << m_connectivity.template number<item_type>() << '\n';
this->_dispatchedInfo<item_type>().m_new_owner = item_new_owner; this->_dispatchedInfo<item_type>().m_new_owner = item_new_owner;
} }
} }
...@@ -98,8 +86,6 @@ ConnectivityDispatcher<Dimension>::_buildItemListToSend() ...@@ -98,8 +86,6 @@ ConnectivityDispatcher<Dimension>::_buildItemListToSend()
const auto& cell_new_owner = this->_dispatchedInfo<ItemType::cell>().m_new_owner; const auto& cell_new_owner = this->_dispatchedInfo<ItemType::cell>().m_new_owner;
const auto& cell_number = m_connectivity.cellNumber(); const auto& cell_number = m_connectivity.cellNumber();
std::cout << "- cell_new_owner = " << cell_new_owner << '\n';
std::vector<std::vector<CellId>> cell_vector_to_send_by_proc(parallel::size()); std::vector<std::vector<CellId>> cell_vector_to_send_by_proc(parallel::size());
Array<bool> send_to_rank(parallel::size()); Array<bool> send_to_rank(parallel::size());
...@@ -107,9 +93,6 @@ ConnectivityDispatcher<Dimension>::_buildItemListToSend() ...@@ -107,9 +93,6 @@ ConnectivityDispatcher<Dimension>::_buildItemListToSend()
send_to_rank.fill(false); send_to_rank.fill(false);
const auto& cell_to_node = cell_to_node_matrix[cell_id]; const auto& cell_to_node = cell_to_node_matrix[cell_id];
std::cout << rang::fgB::cyan << " looking for cell " << cell_id << "(" << cell_number[cell_id] << ")"
<< rang::fg::reset << "\n";
if (cell_is_owned[cell_id]) { if (cell_is_owned[cell_id]) {
for (size_t i_node = 0; i_node < cell_to_node.size(); ++i_node) { for (size_t i_node = 0; i_node < cell_to_node.size(); ++i_node) {
const NodeId& node_id = cell_to_node[i_node]; const NodeId& node_id = cell_to_node[i_node];
...@@ -117,8 +100,6 @@ ConnectivityDispatcher<Dimension>::_buildItemListToSend() ...@@ -117,8 +100,6 @@ ConnectivityDispatcher<Dimension>::_buildItemListToSend()
for (size_t i_node_cell = 0; i_node_cell < node_to_cell.size(); ++i_node_cell) { for (size_t i_node_cell = 0; i_node_cell < node_to_cell.size(); ++i_node_cell) {
const CellId& node_cell = node_to_cell[i_node_cell]; const CellId& node_cell = node_to_cell[i_node_cell];
send_to_rank[cell_new_owner[node_cell]] = true; send_to_rank[cell_new_owner[node_cell]] = true;
std::cout << rang::fgB::green << " storing cell " << node_cell << "(" << cell_number[node_cell] << ")"
<< rang::fg::reset << "\n";
} }
} }
...@@ -135,10 +116,6 @@ ConnectivityDispatcher<Dimension>::_buildItemListToSend() ...@@ -135,10 +116,6 @@ ConnectivityDispatcher<Dimension>::_buildItemListToSend()
for (size_t i = 0; i < parallel::size(); ++i) { for (size_t i = 0; i < parallel::size(); ++i) {
cell_list_to_send_by_proc[i] = convert_to_array(cell_vector_to_send_by_proc[i]); cell_list_to_send_by_proc[i] = convert_to_array(cell_vector_to_send_by_proc[i]);
} }
for (size_t i = 0; i < parallel::size(); ++i) {
std::cout << itemName(item_type) << " send to " << i << ": " << cell_list_to_send_by_proc[i] << '\n';
}
} else { } else {
const auto& cell_list_to_send_by_proc = this->_dispatchedInfo<ItemType::cell>().m_list_to_send_by_proc; const auto& cell_list_to_send_by_proc = this->_dispatchedInfo<ItemType::cell>().m_list_to_send_by_proc;
...@@ -167,10 +144,6 @@ ConnectivityDispatcher<Dimension>::_buildItemListToSend() ...@@ -167,10 +144,6 @@ ConnectivityDispatcher<Dimension>::_buildItemListToSend()
} }
item_list_to_send_by_proc[i_rank] = convert_to_array(item_id_vector); item_list_to_send_by_proc[i_rank] = convert_to_array(item_id_vector);
} }
for (size_t i = 0; i < parallel::size(); ++i) {
std::cout << itemName(item_type) << " send to " << i << ": " << item_list_to_send_by_proc[i] << '\n';
}
} }
} }
...@@ -186,14 +159,7 @@ ConnectivityDispatcher<Dimension>::_buildNumberOfItemToExchange() ...@@ -186,14 +159,7 @@ ConnectivityDispatcher<Dimension>::_buildNumberOfItemToExchange()
} }
this->_dispatchedInfo<item_type>().m_list_to_send_size_by_proc = nb_item_to_send_by_proc; this->_dispatchedInfo<item_type>().m_list_to_send_size_by_proc = nb_item_to_send_by_proc;
std::cout << rang::fgB::yellow << itemName(item_type) << " nb_item_to_send_by_proc = " << nb_item_to_send_by_proc
<< rang::fg::reset << '\n';
this->_dispatchedInfo<item_type>().m_list_to_recv_size_by_proc = parallel::allToAll(nb_item_to_send_by_proc); this->_dispatchedInfo<item_type>().m_list_to_recv_size_by_proc = parallel::allToAll(nb_item_to_send_by_proc);
std::cout << rang::fgB::blue << itemName(item_type)
<< " m_list_to_recv_size_by_proc = " << this->_dispatchedInfo<item_type>().m_list_to_recv_size_by_proc
<< rang::fg::reset << '\n';
} }
template <size_t Dimension> template <size_t Dimension>
...@@ -202,40 +168,19 @@ void ...@@ -202,40 +168,19 @@ void
ConnectivityDispatcher<Dimension>::_gatherFrom(const ItemValue<DataType, item_type, ConnectivityPtr>& data_to_gather, ConnectivityDispatcher<Dimension>::_gatherFrom(const ItemValue<DataType, item_type, ConnectivityPtr>& data_to_gather,
Array<std::remove_const_t<DataType>>& gathered_array) Array<std::remove_const_t<DataType>>& gathered_array)
{ {
std::cout << rang::style::underline << "-- _gatherFrom[" << itemName(item_type) << "][" << demangle<DataType>()
<< "] --" << rang::style::reset << "\n";
std::vector<Array<const DataType>> recv_item_data_by_proc = this->exchange(data_to_gather); std::vector<Array<const DataType>> recv_item_data_by_proc = this->exchange(data_to_gather);
if constexpr (not(std::is_same_v<std::decay_t<DataType>, CellType>)) {
for (size_t i_rank = 0; i_rank < recv_item_data_by_proc.size(); ++i_rank) {
std::cout << "- from " << rang::fgB::cyan << i_rank << ": recv_" << itemName(item_type)
<< "_data_by_proc=" << recv_item_data_by_proc[i_rank] << rang::fg::reset << '\n';
}
}
const auto& recv_id_correspondance_by_proc = this->_dispatchedInfo<item_type>().m_recv_id_correspondance_by_proc; const auto& recv_id_correspondance_by_proc = this->_dispatchedInfo<item_type>().m_recv_id_correspondance_by_proc;
if constexpr (not(std::is_same_v<std::decay_t<DataType>, CellType>)) {
for (size_t i_rank = 0; i_rank < parallel::size(); ++i_rank) {
std::cout << rang::fgB::green << "* recv_id_correspondance_by_proc[" << i_rank
<< "] = " << recv_id_correspondance_by_proc[i_rank] << rang::fg::reset << '\n';
}
}
Assert(recv_id_correspondance_by_proc.size() == parallel::size()); Assert(recv_id_correspondance_by_proc.size() == parallel::size());
gathered_array = Array<std::remove_const_t<DataType>>(this->_dispatchedInfo<item_type>().m_number_to_id_map.size()); gathered_array = Array<std::remove_const_t<DataType>>(this->_dispatchedInfo<item_type>().m_number_to_id_map.size());
size_t shift = 0;
for (size_t i_rank = 0; i_rank < parallel::size(); ++i_rank) { for (size_t i_rank = 0; i_rank < parallel::size(); ++i_rank) {
Assert(recv_id_correspondance_by_proc[i_rank].size() == recv_item_data_by_proc[i_rank].size()); Assert(recv_id_correspondance_by_proc[i_rank].size() == recv_item_data_by_proc[i_rank].size());
for (size_t r = 0; r < recv_id_correspondance_by_proc[i_rank].size(); ++r) { for (size_t r = 0; r < recv_id_correspondance_by_proc[i_rank].size(); ++r) {
const auto& item_id = recv_id_correspondance_by_proc[i_rank][r]; const auto& item_id = recv_id_correspondance_by_proc[i_rank][r];
gathered_array[item_id + shift] = recv_item_data_by_proc[i_rank][r]; gathered_array[item_id] = recv_item_data_by_proc[i_rank][r];
}
shift += recv_item_data_by_proc[i_rank].size();
} }
if constexpr (not(std::is_same_v<std::decay_t<DataType>, CellType>)) {
std::cout << rang::style::reversed << rang::fgB::yellow << "=> gathered_array = " << gathered_array
<< rang::style::reset << rang::fg::reset << "\n";
} }
} }
...@@ -304,8 +249,8 @@ ConnectivityDispatcher<Dimension>::_buildCellNumberIdMap() ...@@ -304,8 +249,8 @@ ConnectivityDispatcher<Dimension>::_buildCellNumberIdMap()
{ {
const auto recv_cell_number_by_proc = this->exchange(m_connectivity.template number<ItemType::cell>()); const auto recv_cell_number_by_proc = this->exchange(m_connectivity.template number<ItemType::cell>());
auto& cell_number_id_map = this->_dispatchedInfo<ItemType::cell>().m_number_to_id_map; auto& cell_number_id_map = this->_dispatchedInfo<ItemType::cell>().m_number_to_id_map;
for (size_t i_rank = 0; i_rank < parallel::size(); ++i_rank) {
CellId cell_id = 0; CellId cell_id = 0;
for (size_t i_rank = 0; i_rank < parallel::size(); ++i_rank) {
for (size_t i = 0; i < recv_cell_number_by_proc[i_rank].size(); ++i) { for (size_t i = 0; i < recv_cell_number_by_proc[i_rank].size(); ++i) {
const int cell_number = recv_cell_number_by_proc[i_rank][i]; const int cell_number = recv_cell_number_by_proc[i_rank][i];
auto [iterator, inserted] = cell_number_id_map.insert(std::make_pair(cell_number, cell_id)); auto [iterator, inserted] = cell_number_id_map.insert(std::make_pair(cell_number, cell_id));
...@@ -332,13 +277,9 @@ ConnectivityDispatcher<Dimension>::_buildSubItemNumberToIdMap() ...@@ -332,13 +277,9 @@ ConnectivityDispatcher<Dimension>::_buildSubItemNumberToIdMap()
for (size_t i = 0; i < cell_sub_item_number_to_recv_by_proc[i_rank].size(); ++i) { for (size_t i = 0; i < cell_sub_item_number_to_recv_by_proc[i_rank].size(); ++i) {
int sub_item_number = cell_sub_item_number_to_recv_by_proc[i_rank][i]; int sub_item_number = cell_sub_item_number_to_recv_by_proc[i_rank][i];
std::cout << "looking for " << sub_item_number;
auto [iterator, inserted] = sub_item_number_id_map.insert(std::make_pair(sub_item_number, sub_item_id)); auto [iterator, inserted] = sub_item_number_id_map.insert(std::make_pair(sub_item_number, sub_item_id));
if (inserted) { if (inserted) {
std::cout << ": inserted with item_id " << sub_item_id << '\n';
++sub_item_id; ++sub_item_id;
} else {
std::cout << ": *exists* with item_id " << iterator->second << '\n';
} }
} }
} }
...@@ -361,13 +302,6 @@ ConnectivityDispatcher<Dimension>::_buildNumberOfSubItemPerItemToRecvByProc() ...@@ -361,13 +302,6 @@ ConnectivityDispatcher<Dimension>::_buildNumberOfSubItemPerItemToRecvByProc()
this->_dispatchedInfo<SubItemOfItemT>().m_number_of_sub_item_per_item_to_recv_by_proc = this->_dispatchedInfo<SubItemOfItemT>().m_number_of_sub_item_per_item_to_recv_by_proc =
this->exchange(number_of_sub_item_per_item); this->exchange(number_of_sub_item_per_item);
for (size_t i_rank = 0; i_rank < parallel::size(); ++i_rank) {
std::cout << "rcv from " << i_rank << ": " << rang::fgB::red << itemName(SubItemOfItemT::item_type) << "->"
<< itemName(SubItemOfItemT::sub_item_type) << ": "
<< this->_dispatchedInfo<SubItemOfItemT>().m_number_of_sub_item_per_item_to_recv_by_proc[i_rank]
<< rang::fg::reset << '\n';
}
} }
template <size_t Dimension> template <size_t Dimension>
...@@ -402,12 +336,6 @@ ConnectivityDispatcher<Dimension>::_buildSubItemNumbersToRecvByProc() ...@@ -402,12 +336,6 @@ ConnectivityDispatcher<Dimension>::_buildSubItemNumbersToRecvByProc()
return mutable_sub_item_numbers_to_send_by_proc; return mutable_sub_item_numbers_to_send_by_proc;
}(); }();
for (size_t i_rank = 0; i_rank < parallel::size(); ++i_rank) {
std::cout << "sub_item_nb_to_send " << i_rank << ": " << rang::fgB::magenta << itemName(SubItemOfItemT::item_type)
<< "->" << itemName(SubItemOfItemT::sub_item_type) << ": " << sub_item_numbers_to_send_by_proc[i_rank]
<< rang::fg::reset << '\n';
}
const auto& number_of_sub_item_per_item_to_recv_by_proc = const auto& number_of_sub_item_per_item_to_recv_by_proc =
this->_dispatchedInfo<SubItemOfItemT>().m_number_of_sub_item_per_item_to_recv_by_proc; this->_dispatchedInfo<SubItemOfItemT>().m_number_of_sub_item_per_item_to_recv_by_proc;
...@@ -424,13 +352,6 @@ ConnectivityDispatcher<Dimension>::_buildSubItemNumbersToRecvByProc() ...@@ -424,13 +352,6 @@ ConnectivityDispatcher<Dimension>::_buildSubItemNumbersToRecvByProc()
for (size_t i_rank = 0; i_rank < parallel::size(); ++i_rank) { for (size_t i_rank = 0; i_rank < parallel::size(); ++i_rank) {
const_sub_item_numbers_to_recv_by_proc[i_rank] = sub_item_numbers_to_recv_by_proc[i_rank]; const_sub_item_numbers_to_recv_by_proc[i_rank] = sub_item_numbers_to_recv_by_proc[i_rank];
} }
for (size_t i_rank = 0; i_rank < parallel::size(); ++i_rank) {
std::cout << "sub_item_nb_to_recv " << i_rank << ": " << rang::fgB::magenta << itemName(SubItemOfItemT::item_type)
<< "->" << itemName(SubItemOfItemT::sub_item_type) << ": "
<< this->_dispatchedInfo<SubItemOfItemT>().m_sub_item_numbers_to_recv_by_proc[i_rank] << rang::fg::reset
<< '\n';
}
} }
template <size_t Dimension> template <size_t Dimension>
...@@ -441,8 +362,6 @@ ConnectivityDispatcher<Dimension>::_buildItemToSubItemDescriptor() ...@@ -441,8 +362,6 @@ ConnectivityDispatcher<Dimension>::_buildItemToSubItemDescriptor()
constexpr ItemType item_type = ItemOfItemT::item_type; constexpr ItemType item_type = ItemOfItemT::item_type;
constexpr ItemType sub_item_type = ItemOfItemT::sub_item_type; constexpr ItemType sub_item_type = ItemOfItemT::sub_item_type;
constexpr const bool print = (item_type == ItemType::cell) and (sub_item_type == ItemType::node);
const auto& item_list_to_recv_size_by_proc = this->_dispatchedInfo<item_type>().m_list_to_recv_size_by_proc; const auto& item_list_to_recv_size_by_proc = this->_dispatchedInfo<item_type>().m_list_to_recv_size_by_proc;
const auto& number_of_sub_item_per_item_to_recv_by_proc = const auto& number_of_sub_item_per_item_to_recv_by_proc =
...@@ -450,22 +369,9 @@ ConnectivityDispatcher<Dimension>::_buildItemToSubItemDescriptor() ...@@ -450,22 +369,9 @@ ConnectivityDispatcher<Dimension>::_buildItemToSubItemDescriptor()
const auto& sub_item_number_id_map = this->_dispatchedInfo<sub_item_type>().m_number_to_id_map; const auto& sub_item_number_id_map = this->_dispatchedInfo<sub_item_type>().m_number_to_id_map;
std::cout << "sub_item_number_id_map = ";
std::cout << rang::fgB::magenta << rang::style::reversed;
for (auto&& i_sub : sub_item_number_id_map) {
std::cout << ' ' << i_sub.first << "->" << i_sub.second;
}
std::cout << rang::fg::reset << rang::style::reset;
std::cout << '\n';
const auto& recv_item_of_item_numbers_by_proc = const auto& recv_item_of_item_numbers_by_proc =
this->_dispatchedInfo<ItemOfItemT>().m_sub_item_numbers_to_recv_by_proc; this->_dispatchedInfo<ItemOfItemT>().m_sub_item_numbers_to_recv_by_proc;
for (size_t i_rank = 0; i_rank < parallel::size(); ++i_rank) {
std::cout << rang::fgB::blue << "recv_item_of_item_numbers_by_proc[" << i_rank
<< "] = " << recv_item_of_item_numbers_by_proc[i_rank] << rang::fg::reset << '\n';
}
std::vector<std::vector<unsigned int>> item_to_subitem_legacy; std::vector<std::vector<unsigned int>> item_to_subitem_legacy;
size_t number_of_node_by_cell = 0; size_t number_of_node_by_cell = 0;
for (size_t i_rank = 0; i_rank < parallel::size(); ++i_rank) { for (size_t i_rank = 0; i_rank < parallel::size(); ++i_rank) {
...@@ -483,13 +389,6 @@ ConnectivityDispatcher<Dimension>::_buildItemToSubItemDescriptor() ...@@ -483,13 +389,6 @@ ConnectivityDispatcher<Dimension>::_buildItemToSubItemDescriptor()
} }
} }
if constexpr (print) {
for (size_t i = 0; i < item_to_subitem_legacy.size(); ++i) {
std::cout << rang::fgB::magenta << "item_to_subitem_legacy[" << i
<< "] = " << convert_to_array(item_to_subitem_legacy[i]) << rang::fg::reset << '\n';
}
}
Array<unsigned int> item_to_subitem_row_map(item_to_subitem_legacy.size() + 1); Array<unsigned int> item_to_subitem_row_map(item_to_subitem_legacy.size() + 1);
Array<unsigned int> item_to_subitem_list(number_of_node_by_cell); Array<unsigned int> item_to_subitem_list(number_of_node_by_cell);
...@@ -536,6 +435,7 @@ ConnectivityDispatcher<Dimension>::_buildRecvItemIdCorrespondanceByProc() ...@@ -536,6 +435,7 @@ ConnectivityDispatcher<Dimension>::_buildRecvItemIdCorrespondanceByProc()
parallel::exchange(send_item_number_by_proc, recv_item_number_by_proc); parallel::exchange(send_item_number_by_proc, recv_item_number_by_proc);
const auto& item_number_to_id_map = this->_dispatchedInfo<item_type>().m_number_to_id_map; const auto& item_number_to_id_map = this->_dispatchedInfo<item_type>().m_number_to_id_map;
for (size_t i_rank = 0; i_rank < item_list_to_recv_size_by_proc.size(); ++i_rank) { for (size_t i_rank = 0; i_rank < item_list_to_recv_size_by_proc.size(); ++i_rank) {
Array<ItemId> item_id_correspondance(item_list_to_recv_size_by_proc[i_rank]); Array<ItemId> item_id_correspondance(item_list_to_recv_size_by_proc[i_rank]);
for (size_t l = 0; l < item_list_to_recv_size_by_proc[i_rank]; ++l) { for (size_t l = 0; l < item_list_to_recv_size_by_proc[i_rank]; ++l) {
...@@ -815,40 +715,6 @@ ConnectivityDispatcher<Dimension>::ConnectivityDispatcher(const ConnectivityType ...@@ -815,40 +715,6 @@ ConnectivityDispatcher<Dimension>::ConnectivityDispatcher(const ConnectivityType
} }
} }
std::cout << "--- initial mesh ---\n";
std::cout << "--- cells\n";
for (CellId cell_id = 0; cell_id < connectivity.numberOfCells(); ++cell_id) {
std::cout << "cell " << cell_id << "(" << connectivity.cellNumber()[cell_id] << "):" << rang::style::bold
<< ((connectivity.cellIsOwned()[cell_id]) ? 'O' : 'G') << rang::style::reset << ": ";
auto node_list = connectivity.cellToNodeMatrix()[cell_id];
for (size_t i_node = 0; i_node < node_list.size(); ++i_node) {
const NodeId node_id = node_list[i_node];
std::cout << ' ' << node_id << "(" << connectivity.nodeNumber()[node_id] << "):" << rang::style::bold
<< ((connectivity.nodeIsOwned()[node_id]) ? 'O' : 'G') << rang::style::reset;
}
std::cout << '\n';
}
if constexpr (Dimension > 1) {
std::cout << "--- faces\n";
for (FaceId face_id = 0; face_id < connectivity.numberOfFaces(); ++face_id) {
std::cout << "cell " << face_id << "(" << connectivity.faceNumber()[face_id] << "):" << rang::style::bold
<< ((connectivity.faceIsOwned()[face_id]) ? 'O' : 'G') << rang::style::reset << ": ";
auto node_list = connectivity.faceToNodeMatrix()[face_id];
for (size_t i_node = 0; i_node < node_list.size(); ++i_node) {
const NodeId node_id = node_list[i_node];
std::cout << ' ' << node_id << "(" << connectivity.nodeNumber()[node_id] << "):" << rang::style::bold
<< ((connectivity.nodeIsOwned()[node_id]) ? 'O' : 'G') << rang::style::reset;
}
std::cout << '\n';
}
}
std::cout << "--- nodes\n";
for (NodeId node_id = 0; node_id < connectivity.numberOfNodes(); ++node_id) {
std::cout << "node " << node_id << "(" << connectivity.nodeNumber()[node_id] << "):" << rang::style::bold
<< ((connectivity.nodeIsOwned()[node_id]) ? 'O' : 'G') << rang::style::reset << ": ";
std::cout << '\n';
}
this->_buildNewOwner<ItemType::cell>(); this->_buildNewOwner<ItemType::cell>();
if constexpr (Dimension > 1) { if constexpr (Dimension > 1) {
this->_buildNewOwner<ItemType::face>(); this->_buildNewOwner<ItemType::face>();
...@@ -858,16 +724,10 @@ ConnectivityDispatcher<Dimension>::ConnectivityDispatcher(const ConnectivityType ...@@ -858,16 +724,10 @@ ConnectivityDispatcher<Dimension>::ConnectivityDispatcher(const ConnectivityType
} }
this->_buildNewOwner<ItemType::node>(); this->_buildNewOwner<ItemType::node>();
std::cout << rang::style::reversed << "--- cell to exchange ---" << rang::style::reset << '\n';
this->_buildItemToExchangeLists<ItemType::cell>(); this->_buildItemToExchangeLists<ItemType::cell>();
std::cout << rang::style::reversed << "--- number of node per cell ---" << rang::style::reset << '\n';
this->_buildNumberOfSubItemPerItemToRecvByProc<NodeOfCell>(); this->_buildNumberOfSubItemPerItemToRecvByProc<NodeOfCell>();
std::cout << rang::style::reversed << "--- node by cell to recv by proc ---" << rang::style::reset << '\n';
this->_buildSubItemNumbersToRecvByProc<NodeOfCell>(); this->_buildSubItemNumbersToRecvByProc<NodeOfCell>();
m_new_descriptor.setCellNumberVector([&] { m_new_descriptor.setCellNumberVector([&] {
...@@ -876,15 +736,8 @@ ConnectivityDispatcher<Dimension>::ConnectivityDispatcher(const ConnectivityType ...@@ -876,15 +736,8 @@ ConnectivityDispatcher<Dimension>::ConnectivityDispatcher(const ConnectivityType
return cell_number_vector; return cell_number_vector;
}()); }());
std::cout << rang::fgB::green << "cell_number_vector = " << m_new_descriptor.cellNumberVector() << rang::fg::reset
<< "\n";
std::cout << rang::style::reversed << "--- node of cell to id map ---" << rang::style::reset << '\n';
this->_buildSubItemNumberToIdMap<NodeOfCell>(); this->_buildSubItemNumberToIdMap<NodeOfCell>();
std::cout << rang::style::reversed << "--- node to exchange ---" << rang::style::reset << '\n';
this->_buildItemToExchangeLists<ItemType::node>(); this->_buildItemToExchangeLists<ItemType::node>();
m_new_descriptor.setCellTypeVector([&] { m_new_descriptor.setCellTypeVector([&] {
...@@ -920,25 +773,6 @@ ConnectivityDispatcher<Dimension>::ConnectivityDispatcher(const ConnectivityType ...@@ -920,25 +773,6 @@ ConnectivityDispatcher<Dimension>::ConnectivityDispatcher(const ConnectivityType
this->_dispatchEdges(); this->_dispatchEdges();
this->_buildItemReferenceList<ItemType::node>(); this->_buildItemReferenceList<ItemType::node>();
std::cout << "m_new_descriptor.nodeNumberVector() = " << m_new_descriptor.nodeNumberVector() << '\n';
std::cout << rang::fgB::blue << m_new_descriptor.nodeNumberVector() << rang::fg::reset << '\n';
std::cout << "m_new_descriptor.nodeOwnerVector() = " << m_new_descriptor.nodeOwnerVector() << '\n';
std::cout << rang::fgB::blue << m_new_descriptor.nodeOwnerVector() << rang::fg::reset << '\n';
std::cout << "m_new_descriptor.cellOwnerVector().size() = " << m_new_descriptor.cellOwnerVector().size()
<< '\n';
std::cout << rang::fgB::blue << m_new_descriptor.cellOwnerVector() << rang::fg::reset << '\n';
std::cout << "m_new_descriptor.cellTypeVector().size() = " << m_new_descriptor.cellTypeVector().size()
<< '\n';
std::cout << "m_new_descriptor.cellToNodeMatrix().numberOfRows() = "
<< m_new_descriptor.cellToNodeMatrix().numberOfRows() << '\n';
for (CellId cell_id = 0; cell_id < m_new_descriptor.cellToNodeMatrix().numberOfRows(); ++cell_id) {
std::cout << "- cell [" << cell_id << "](" // << m_new_descriptor.cellNumberVector()[cell_id]
<< ")" << m_new_descriptor.cellToNodeMatrix()[cell_id] << '\n';
}
m_dispatched_connectivity = ConnectivityType::build(m_new_descriptor); m_dispatched_connectivity = ConnectivityType::build(m_new_descriptor);
{ {
......
...@@ -273,16 +273,14 @@ class ConnectivityDispatcher ...@@ -273,16 +273,14 @@ class ConnectivityDispatcher
const auto& recv_item_id_correspondance_by_proc = const auto& recv_item_id_correspondance_by_proc =
this->_dispatchedInfo<item_type>().m_recv_id_correspondance_by_proc; this->_dispatchedInfo<item_type>().m_recv_id_correspondance_by_proc;
ItemValue<MutableDataType, item_type> new_item_value(*m_dispatched_connectivity); ItemValue<MutableDataType, item_type> new_item_value(*m_dispatched_connectivity);
size_t shift = 0;
for (size_t i_rank = 0; i_rank < parallel::size(); ++i_rank) { for (size_t i_rank = 0; i_rank < parallel::size(); ++i_rank) {
const auto& recv_item_id_correspondance = recv_item_id_correspondance_by_proc[i_rank]; const auto& recv_item_id_correspondance = recv_item_id_correspondance_by_proc[i_rank];
const auto& recv_item_value = recv_item_value_by_proc[i_rank]; const auto& recv_item_value = recv_item_value_by_proc[i_rank];
parallel_for( parallel_for(
recv_item_value.size(), PUGS_LAMBDA(size_t index) { recv_item_value.size(), PUGS_LAMBDA(size_t index) {
const ItemId shifted_item_id = recv_item_id_correspondance[index] + shift; const ItemId item_id = recv_item_id_correspondance[index];
new_item_value[shifted_item_id] = recv_item_value[index]; new_item_value[item_id] = recv_item_value[index];
}); });
shift += recv_item_value.size();
} }
return new_item_value; return new_item_value;
} }
......
...@@ -45,8 +45,10 @@ class CharArrayEmbedder : public ICharArrayEmbedder ...@@ -45,8 +45,10 @@ class CharArrayEmbedder : public ICharArrayEmbedder
void void
write(std::ostream& os) const final write(std::ostream& os) const final
{ {
if (m_char_cast_array.size() > 0) {
os.write(&(m_char_cast_array[0]), m_char_cast_array.size()); os.write(&(m_char_cast_array[0]), m_char_cast_array.size());
} }
}
CharArrayEmbedder(Array<InputDataT> array) : m_char_cast_array{array} {} CharArrayEmbedder(Array<InputDataT> array) : m_char_cast_array{array} {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment