Skip to content
Snippets Groups Projects
Commit b706c14d authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Add numberOf template functions

These functions return the number of items (template parameter)
parent 6b2d417a
No related branches found
No related tags found
1 merge request!80Feature/writers improvement
...@@ -609,6 +609,23 @@ class Connectivity final : public IConnectivity ...@@ -609,6 +609,23 @@ class Connectivity final : public IConnectivity
return cell_to_node_matrix.numRows(); 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> CellValue<const double>
invCellNbNodes() const invCellNbNodes() const
{ {
......
...@@ -63,6 +63,13 @@ class Mesh final : public IMesh ...@@ -63,6 +63,13 @@ class Mesh final : public IMesh
return m_connectivity->numberOfCells(); return m_connectivity->numberOfCells();
} }
template <ItemType item_type>
PUGS_INLINE size_t
numberOf() const
{
return m_connectivity->template numberOf<item_type>();
}
PUGS_INLINE PUGS_INLINE
const NodeValue<const Rd>& const NodeValue<const Rd>&
xr() const xr() const
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment