diff --git a/src/mesh/Boundary.hpp b/src/mesh/Boundary.hpp index e23097d5699c7966b1676ddff818b3870d981311..f5164262f5582e2a829c2627df7cb18131fbd65d 100644 --- a/src/mesh/Boundary.hpp +++ b/src/mesh/Boundary.hpp @@ -4,12 +4,14 @@ #include <Kokkos_Core.hpp> #include <RefId.hpp> +#include <set> + class Boundary { private: RefId m_ref_id; - Kokkos::View<unsigned int*> m_face_list; - Kokkos::View<unsigned int*> m_node_list; + Kokkos::View<const unsigned int*> m_face_id_list; + Kokkos::View<const unsigned int*> m_node_id_list; public: const RefId& refId() const @@ -19,26 +21,47 @@ class Boundary const Kokkos::View<const unsigned int*> faceList() const { - return m_face_list; + return m_face_id_list; } const Kokkos::View<const unsigned int*> nodeList() const { - return m_node_list; + return m_node_id_list; } - Boundary(const RefId& ref_id, - Kokkos::View<unsigned int*> face_list) + template<typename ConnectivityType> + Boundary(const ConnectivityType& connectivity, + const RefId& ref_id, + const Kokkos::View<const unsigned int*> face_id_list) : m_ref_id(ref_id), - m_face_list(face_list) + m_face_id_list(face_id_list) { - ; - } + std::set<unsigned int> node_id_set; + const Kokkos::View<const unsigned int**> face_nodes = connectivity.faceNodes(); - ~Boundary() - { - ; + for (unsigned int l=0; l<m_face_id_list.extent(0); ++l) { + for (unsigned short r=0; r<2; ++r) { + node_id_set.insert(face_nodes(m_face_id_list[l],r)); + } + } + + Kokkos::View<unsigned int*> node_id_list("node_id_list", node_id_set.size()); + { + int r=0; + for (auto node_id : node_id_set) { + node_id_list[r] = node_id; + ++r; + } + } + m_node_id_list = node_id_list; } + + Boundary& operator=(const Boundary&) = default; + Boundary& operator=(Boundary&&) = default; + + Boundary() = default; + Boundary(const Boundary&) = default; + ~Boundary() = default; }; #endif // BOUNDARY_HPP