diff --git a/src/mesh/Connectivity.hpp b/src/mesh/Connectivity.hpp index 0994fc9c84e4105c3f9de66b55231f3fd61ff8fe..b72a38abdadae65a8aed62d4ec9ebd0f09cbf628 100644 --- a/src/mesh/Connectivity.hpp +++ b/src/mesh/Connectivity.hpp @@ -439,7 +439,7 @@ class Connectivity final } KOKKOS_INLINE_FUNCTION - size_t numberOfNodes() const + size_t numberOfNodes() const final { const auto& node_to_cell_matrix = this->getMatrix(ItemType::node,ItemType::cell); @@ -447,7 +447,15 @@ class Connectivity final } KOKKOS_INLINE_FUNCTION - size_t numberOfFaces() const + size_t numberOfEdges() const final + { + const auto& edge_to_node_matrix + = this->getMatrix(ItemType::edge,ItemType::node); + return edge_to_node_matrix.numRows(); + } + + KOKKOS_INLINE_FUNCTION + size_t numberOfFaces() const final { const auto& face_to_node_matrix = this->getMatrix(ItemType::face,ItemType::cell); @@ -455,7 +463,7 @@ class Connectivity final } KOKKOS_INLINE_FUNCTION - size_t numberOfCells() const + size_t numberOfCells() const final { const auto& cell_to_node_matrix = this->getMatrix(ItemType::cell,ItemType::node); diff --git a/src/mesh/IConnectivity.hpp b/src/mesh/IConnectivity.hpp index 49432fdea276d770c993960a2ffb48da2f7407b0..b9da32e8dc4cd9ed9d968490cf1510ad94f1d785 100644 --- a/src/mesh/IConnectivity.hpp +++ b/src/mesh/IConnectivity.hpp @@ -10,6 +10,42 @@ struct IConnectivity getMatrix(const ItemType& item_type_0, const ItemType& item_type_1) const = 0; + virtual size_t numberOfNodes() const = 0; + virtual size_t numberOfEdges() const = 0; + virtual size_t numberOfFaces() const = 0; + virtual size_t numberOfCells() const = 0; + + template <ItemType item_type> + size_t numberOf() const = delete; + + template <> + KOKKOS_INLINE_FUNCTION + size_t numberOf<ItemType::node>() const + { + return this->numberOfNodes(); + } + + template <> + KOKKOS_INLINE_FUNCTION + size_t numberOf<ItemType::edge>() const + { + return this->numberOfEdges(); + } + + template <> + KOKKOS_INLINE_FUNCTION + size_t numberOf<ItemType::face>() const + { + return this->numberOfFaces(); + } + + template <> + KOKKOS_INLINE_FUNCTION + size_t numberOf<ItemType::cell>() const + { + return this->numberOfCells(); + } + IConnectivity() = default; IConnectivity(const IConnectivity&) = delete; ~IConnectivity() = default;