diff --git a/src/mesh/Connectivity3D.hpp b/src/mesh/Connectivity3D.hpp index ce982d2765dd82736c3211238017529ce997d92f..7f613a539b8333240f05379e12432af3d1f8398d 100644 --- a/src/mesh/Connectivity3D.hpp +++ b/src/mesh/Connectivity3D.hpp @@ -2,6 +2,7 @@ #define CONNECTIVITY_3D_HPP #include <Kokkos_Core.hpp> +#include <Kokkos_StaticCrsGraph.hpp> #include <PastisAssert.hpp> #include <TinyVector.hpp> @@ -297,6 +298,24 @@ private: } m_face_nb_cells = face_nb_cells; + std::vector<std::vector<unsigned int>> face_to_cell_vector(m_number_of_faces); + { + size_t l=0; + for (const auto& face_cells_vector : face_cells_map) { + const auto& cells_info_vector = face_cells_vector.second; + std::vector<unsigned int>& cells_vector = face_to_cell_vector[l]; + cells_vector.resize(cells_info_vector.size()); + for (size_t j=0; j<cells_info_vector.size(); ++j) { + const auto& [cell_number, local_face_in_cell, reversed] = cells_info_vector[j]; + cells_vector[j] = cell_number; + } + ++l; + } + } + + typedef Kokkos::StaticCrsGraph<unsigned int, Kokkos::HostSpace> StaticCrsGraphType; + StaticCrsGraphType face_to_cell_matrix + = Kokkos::create_staticcrsgraph<StaticCrsGraphType>("face_to_cell_matrix", face_to_cell_vector); #warning check that the number of cell per faces is <=2 Kokkos::View<unsigned int**> face_cells("face_cells", face_cells_map.size(), 2);