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

Add an external size function for convenience

parent 1b762f6c
No related branches found
No related tags found
1 merge request!124Add files for high order integration with quadratures
...@@ -175,6 +175,13 @@ class ItemValue ...@@ -175,6 +175,13 @@ class ItemValue
~ItemValue() = default; ~ItemValue() = default;
}; };
template <typename DataType, ItemType item_type, typename ConnectivityPtr>
PUGS_INLINE size_t
size(const ItemValue<DataType, item_type, ConnectivityPtr>& item_value)
{
return item_value.numberOfItems();
}
template <typename DataType> template <typename DataType>
using NodeValue = ItemValue<DataType, ItemType::node>; using NodeValue = ItemValue<DataType, ItemType::node>;
......
...@@ -140,6 +140,13 @@ class [[nodiscard]] Array ...@@ -140,6 +140,13 @@ class [[nodiscard]] Array
~Array() = default; ~Array() = default;
}; };
template <typename DataType>
PUGS_INLINE size_t
size(const Array<DataType>& array)
{
return array.size();
}
template <typename DataType, typename... RT> template <typename DataType, typename... RT>
PUGS_INLINE Array<DataType> PUGS_INLINE Array<DataType>
encapsulate(const Kokkos::View<DataType*, RT...>& values) encapsulate(const Kokkos::View<DataType*, RT...>& values)
......
...@@ -128,6 +128,13 @@ class [[nodiscard]] SmallArray ...@@ -128,6 +128,13 @@ class [[nodiscard]] SmallArray
~SmallArray() = default; ~SmallArray() = default;
}; };
template <typename DataType>
PUGS_INLINE size_t
size(const SmallArray<DataType>& array)
{
return array.size();
}
// map, multimap, unordered_map and stack cannot be copied this way // map, multimap, unordered_map and stack cannot be copied this way
template <typename Container> template <typename Container>
PUGS_INLINE SmallArray<std::remove_const_t<typename Container::value_type>> PUGS_INLINE SmallArray<std::remove_const_t<typename Container::value_type>>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment