diff --git a/src/mesh/Connectivity.hpp b/src/mesh/Connectivity.hpp index f8e4dafdb7a46473434645c26e46ee1c00f86117..2b25c6e9bf6f772acf5e0b02b9e93e9ea02a9877 100644 --- a/src/mesh/Connectivity.hpp +++ b/src/mesh/Connectivity.hpp @@ -609,6 +609,23 @@ class Connectivity final : public IConnectivity return cell_to_node_matrix.numRows(); } + template <ItemType item_type> + PUGS_INLINE size_t + numberOf() const + { + if constexpr (item_type == ItemType::cell) { + return this->numberOfCells(); + } else if constexpr (item_type == ItemType::face) { + return this->numberOfFaces(); + } else if constexpr (item_type == ItemType::edge) { + return this->numberOfEdges(); + } else if constexpr (item_type == ItemType::node) { + return this->numberOfNodes(); + } else { + static_assert(is_false_item_type_v<item_type>, "unknown ItemType"); + } + } + CellValue<const double> invCellNbNodes() const { diff --git a/src/mesh/Mesh.hpp b/src/mesh/Mesh.hpp index e78383978469292d6529eb931b432406612f7220..21c100384ef2072e43af54dda74eda8d6021c2ea 100644 --- a/src/mesh/Mesh.hpp +++ b/src/mesh/Mesh.hpp @@ -63,6 +63,13 @@ class Mesh final : public IMesh return m_connectivity->numberOfCells(); } + template <ItemType item_type> + PUGS_INLINE size_t + numberOf() const + { + return m_connectivity->template numberOf<item_type>(); + } + PUGS_INLINE const NodeValue<const Rd>& xr() const