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

Change name SubItemOfItemType -> ItemOfItemType and wording

parent c6b83972
No related branches found
No related tags found
1 merge request!11Feature/mpi
#include <ConnectivityDispatcher.hpp> #include <ConnectivityDispatcher.hpp>
#include <Partitioner.hpp> #include <Partitioner.hpp>
#include <SubItemOfItemType.hpp> #include <ItemOfItemType.hpp>
#include <unordered_map> #include <unordered_map>
...@@ -168,19 +168,19 @@ _buildCellNumberIdMap() ...@@ -168,19 +168,19 @@ _buildCellNumberIdMap()
} }
template <int Dimension> template <int Dimension>
template <typename SubItemOfItemT> template <typename ItemOfItemT>
void void
ConnectivityDispatcher<Dimension>:: ConnectivityDispatcher<Dimension>::
_buildSubItemNumberIdMapAs(const std::vector<Array<const int>>& recv_cell_sub_item_number_by_proc) _buildSubItemNumberToIdMap(const std::vector<Array<const int>>& recv_cell_sub_item_number_by_proc)
{ {
static_assert(SubItemOfItemT::item_type == ItemType::cell, "Dispatcher requires to be build using cell as master entities"); static_assert(ItemOfItemT::item_type == ItemType::cell, "Dispatcher requires to be build using cell as master entities");
auto& sub_item_number_id_map = this->_dispatchedInfo<SubItemOfItemT::sub_item_type>().m_number_to_id_map; auto& sub_item_number_id_map = this->_dispatchedInfo<ItemOfItemT::sub_item_type>().m_number_to_id_map;
for (size_t i_rank=0; i_rank<parallel::size(); ++i_rank) { for (size_t i_rank=0; i_rank<parallel::size(); ++i_rank) {
int sub_item_id=0; int sub_item_id=0;
for (size_t i=0; i<recv_cell_sub_item_number_by_proc[i_rank].size(); ++i) { for (size_t i=0; i<recv_cell_sub_item_number_by_proc[i_rank].size(); ++i) {
int node_number = recv_cell_sub_item_number_by_proc[i_rank][i]; int sub_item_number = recv_cell_sub_item_number_by_proc[i_rank][i];
auto [iterator, inserted] = sub_item_number_id_map.insert(std::make_pair(node_number, sub_item_id)); auto [iterator, inserted] = sub_item_number_id_map.insert(std::make_pair(sub_item_number, sub_item_id));
if (inserted) sub_item_id++; if (inserted) sub_item_id++;
} }
} }
...@@ -305,12 +305,12 @@ ConnectivityDispatcher<Dimension>::_dispatchFaces() ...@@ -305,12 +305,12 @@ ConnectivityDispatcher<Dimension>::_dispatchFaces()
{ {
if constexpr (Dimension>1) { if constexpr (Dimension>1) {
std::vector<Array<const int>> recv_number_of_face_per_cell_by_proc = std::vector<Array<const int>> recv_number_of_face_per_cell_by_proc =
_getRecvNumberOfSubItemPerItemByProc<SubFaceOfCell>(); _getRecvNumberOfSubItemPerItemByProc<FaceOfCell>();
std::vector<Array<const int>> recv_cell_face_numbering_by_proc std::vector<Array<const int>> recv_cell_face_numbering_by_proc
= this->_getRecvItemSubItemNumberingByProc<SubFaceOfCell>(recv_number_of_face_per_cell_by_proc); = this->_getRecvItemSubItemNumberingByProc<FaceOfCell>(recv_number_of_face_per_cell_by_proc);
this->_buildSubItemNumberIdMapAs<SubFaceOfCell>(recv_cell_face_numbering_by_proc); this->_buildSubItemNumberToIdMap<FaceOfCell>(recv_cell_face_numbering_by_proc);
const std::unordered_map<int, int>& face_number_id_map = const std::unordered_map<int, int>& face_number_id_map =
this->_dispatchedInfo<ItemType::face>().m_number_to_id_map; this->_dispatchedInfo<ItemType::face>().m_number_to_id_map;
...@@ -328,7 +328,6 @@ ConnectivityDispatcher<Dimension>::_dispatchFaces() ...@@ -328,7 +328,6 @@ ConnectivityDispatcher<Dimension>::_dispatchFaces()
this->_buildRecvItemIdCorrespondanceByProc<ItemType::face>(); this->_buildRecvItemIdCorrespondanceByProc<ItemType::face>();
this->_gatherFrom(m_connectivity.template number<ItemType::face>(), m_new_descriptor.face_number_vector); this->_gatherFrom(m_connectivity.template number<ItemType::face>(), m_new_descriptor.face_number_vector);
{ {
const auto& cell_list_to_recv_size_by_proc = const auto& cell_list_to_recv_size_by_proc =
this->_dispatchedInfo<ItemType::cell>().m_list_to_recv_size_by_proc; this->_dispatchedInfo<ItemType::cell>().m_list_to_recv_size_by_proc;
...@@ -392,10 +391,10 @@ ConnectivityDispatcher<Dimension>::_dispatchFaces() ...@@ -392,10 +391,10 @@ ConnectivityDispatcher<Dimension>::_dispatchFaces()
this->_gatherFrom(this->_dispatchedInfo<ItemType::face>().m_new_owner, m_new_descriptor.face_owner_vector); this->_gatherFrom(this->_dispatchedInfo<ItemType::face>().m_new_owner, m_new_descriptor.face_owner_vector);
std::vector<Array<const int>> recv_number_of_node_per_face_by_proc = std::vector<Array<const int>> recv_number_of_node_per_face_by_proc =
_getRecvNumberOfSubItemPerItemByProc<SubNodeOfFace>(); _getRecvNumberOfSubItemPerItemByProc<NodeOfFace>();
std::vector<Array<const int>> recv_face_node_numbering_by_proc std::vector<Array<const int>> recv_face_node_numbering_by_proc
= this->_getRecvItemSubItemNumberingByProc<SubNodeOfFace>(recv_number_of_node_per_face_by_proc); = this->_getRecvItemSubItemNumberingByProc<NodeOfFace>(recv_number_of_node_per_face_by_proc);
{ {
const auto& node_number_id_map = this->_dispatchedInfo<ItemType::node>().m_number_to_id_map; const auto& node_number_id_map = this->_dispatchedInfo<ItemType::node>().m_number_to_id_map;
...@@ -589,15 +588,15 @@ ConnectivityDispatcher<Dimension>::ConnectivityDispatcher(const ConnectivityType ...@@ -589,15 +588,15 @@ ConnectivityDispatcher<Dimension>::ConnectivityDispatcher(const ConnectivityType
this->_buildCellNumberIdMap(); this->_buildCellNumberIdMap();
const std::vector<Array<const int>> recv_number_of_node_per_cell_by_proc const std::vector<Array<const int>> recv_number_of_node_per_cell_by_proc
= this->_getRecvNumberOfSubItemPerItemByProc<SubNodeOfCell>(); = this->_getRecvNumberOfSubItemPerItemByProc<NodeOfCell>();
const std::vector<Array<const int>> recv_cell_node_numbering_by_proc const std::vector<Array<const int>> recv_cell_node_numbering_by_proc
= this->_getRecvItemSubItemNumberingByProc<SubNodeOfCell>(recv_number_of_node_per_cell_by_proc); = this->_getRecvItemSubItemNumberingByProc<NodeOfCell>(recv_number_of_node_per_cell_by_proc);
this->_buildRecvItemIdCorrespondanceByProc<ItemType::cell>(); this->_buildRecvItemIdCorrespondanceByProc<ItemType::cell>();
this->_gatherFrom(m_connectivity.template number<ItemType::cell>(), m_new_descriptor.cell_number_vector); this->_gatherFrom(m_connectivity.template number<ItemType::cell>(), m_new_descriptor.cell_number_vector);
this->_buildSubItemNumberIdMapAs<SubNodeOfCell>(recv_cell_node_numbering_by_proc); this->_buildSubItemNumberToIdMap<NodeOfCell>(recv_cell_node_numbering_by_proc);
this->_buildItemListToSend<ItemType::node>(); this->_buildItemListToSend<ItemType::node>();
Array<unsigned int> nb_node_to_send_by_proc(parallel::size()); Array<unsigned int> nb_node_to_send_by_proc(parallel::size());
......
...@@ -75,8 +75,8 @@ class ConnectivityDispatcher ...@@ -75,8 +75,8 @@ class ConnectivityDispatcher
void _buildCellNumberIdMap(); void _buildCellNumberIdMap();
template <typename SubItemOfItemT> template <typename ItemOfItemT>
void _buildSubItemNumberIdMapAs(const std::vector<Array<const int>>& recv_cell_node_number_by_proc); void _buildSubItemNumberToIdMap(const std::vector<Array<const int>>& recv_cell_node_number_by_proc);
void _dispatchFaces(); void _dispatchFaces();
......
#ifndef ITEM_OF_ITEM_TYPE_HPP
#define ITEM_OF_ITEM_TYPE_HPP
#include <ItemType.hpp>
#warning Should use this type in all sub item constructions
template <ItemType sub_item_t,
ItemType item_t>
struct ItemOfItemType
{
static_assert(sub_item_t != item_t, "item and its sub-item cannot be of same type");
constexpr static ItemType sub_item_type = sub_item_t;
constexpr static ItemType item_type = item_t;
};
using FaceOfCell = ItemOfItemType<ItemType::face, ItemType::cell>;
using EdgeOfCell = ItemOfItemType<ItemType::edge, ItemType::cell>;
using NodeOfCell = ItemOfItemType<ItemType::node, ItemType::cell>;
using CellofFace = ItemOfItemType<ItemType::cell, ItemType::face>;
using EdgeOfFace = ItemOfItemType<ItemType::edge, ItemType::face>;
using NodeOfFace = ItemOfItemType<ItemType::node, ItemType::face>;
using CellofEdge = ItemOfItemType<ItemType::cell, ItemType::edge>;
using FaceOfEdge = ItemOfItemType<ItemType::face, ItemType::edge>;
using NodeOfEdge = ItemOfItemType<ItemType::node, ItemType::edge>;
using CellofNode = ItemOfItemType<ItemType::cell, ItemType::node>;
using FaceOfNode = ItemOfItemType<ItemType::face, ItemType::node>;
using EdgeOfNode = ItemOfItemType<ItemType::edge, ItemType::node>;
#endif // ITEM_OF_ITEM_TYPE_HPP
#ifndef SUB_ITEM_OF_ITEM_TYPE_HPP
#define SUB_ITEM_OF_ITEM_TYPE_HPP
#include <ItemType.hpp>
#warning Should use this type in all sub item constructions
template <ItemType sub_item_t,
ItemType item_t>
struct SubItemOfItemType
{
static_assert(sub_item_t != item_t, "item and its sub-item cannot be of same type");
constexpr static ItemType sub_item_type = sub_item_t;
constexpr static ItemType item_type = item_t;
};
using SubFaceOfCell = SubItemOfItemType<ItemType::face, ItemType::cell>;
using SubEdgeOfCell = SubItemOfItemType<ItemType::edge, ItemType::cell>;
using SubNodeOfCell = SubItemOfItemType<ItemType::node, ItemType::cell>;
using SubCellofFace = SubItemOfItemType<ItemType::cell, ItemType::face>;
using SubEdgeOfFace = SubItemOfItemType<ItemType::edge, ItemType::face>;
using SubNodeOfFace = SubItemOfItemType<ItemType::node, ItemType::face>;
using SubCellofEdge = SubItemOfItemType<ItemType::cell, ItemType::edge>;
using SubFaceOfEdge = SubItemOfItemType<ItemType::face, ItemType::edge>;
using SubNodeOfEdge = SubItemOfItemType<ItemType::node, ItemType::edge>;
using SubCellofNode = SubItemOfItemType<ItemType::cell, ItemType::node>;
using SubFaceOfNode = SubItemOfItemType<ItemType::face, ItemType::node>;
using SubEdgeOfNode = SubItemOfItemType<ItemType::edge, ItemType::node>;
#endif // SUB_ITEM_OF_ITEM_TYPE_HPP
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment