diff --git a/src/mesh/Connectivity3D.hpp b/src/mesh/Connectivity3D.hpp index 2ef2de9986c723f13f3e149da4df6ce67d1e6536..64f1c22ded5c60e19956834f8210eab540a4dc0f 100644 --- a/src/mesh/Connectivity3D.hpp +++ b/src/mesh/Connectivity3D.hpp @@ -8,6 +8,7 @@ #include <ConnectivityUtils.hpp> #include <vector> #include <map> +#include <unordered_map> #include <algorithm> #include <RefId.hpp> @@ -59,6 +60,18 @@ private: class Face { + public: + friend struct Hash; + struct Hash { + size_t operator()(const Face& f) const + { + size_t hash = 0; + for (size_t i=0; i<f.m_node_id_list.size(); ++i) { + hash ^= std::hash<unsigned int>()(f.m_node_id_list[i]) >> i; + } + return hash; + } + }; private: bool m_reversed; std::vector<unsigned int> m_node_id_list; @@ -156,7 +169,7 @@ private: ~Face() = default; }; - std::map<Face,unsigned int> m_face_number_map; + std::unordered_map<Face,unsigned int, Face::Hash> m_face_number_map; void _computeFaceCellConnectivities() { @@ -346,7 +359,7 @@ private: } m_face_cell_local_face = face_cell_local_face; - std::map<unsigned int, std::vector<unsigned int>> node_faces_map; + std::unordered_map<unsigned int, std::vector<unsigned int>> node_faces_map; for (size_t l=0; l<m_number_of_faces; ++l) { for (size_t lr=0; lr<face_nb_nodes(l); ++lr) { const unsigned int r = face_nodes(l, lr);