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

Simplify slightly implementation

parent 98f40f87
No related branches found
No related tags found
1 merge request!133Simplify access functions to the number of items
......@@ -92,22 +92,13 @@ class ItemArray
m_values.fill(data);
}
// Following Kokkos logic, these classes are view and const view does allow
// changes in data
PUGS_FORCEINLINE
Array<DataType>
operator[](const ItemId& i) const noexcept(NO_ASSERT)
template <ItemType item_t>
PUGS_INLINE Array<DataType>
operator[](const ItemIdT<item_t>& item_id) const noexcept(NO_ASSERT)
{
static_assert(item_t == item_type, "invalid ItemId type");
Assert(this->isBuilt());
Assert(i < this->numberOfItems());
return m_values[i];
}
template <typename IndexType>
Array<DataType>
operator[](const IndexType&) const noexcept(NO_ASSERT)
{
static_assert(std::is_same_v<IndexType, ItemId>, "ItemArray must be indexed by ItemId");
return m_values[item_id];
}
PUGS_INLINE
......
......@@ -100,21 +100,13 @@ class ItemValue
m_values.fill(data);
}
// Following Kokkos logic, these classes are view and const view does allow
// changes in data
PUGS_FORCEINLINE
DataType&
operator[](const ItemId& i) const noexcept(NO_ASSERT)
template <ItemType item_t>
PUGS_INLINE DataType&
operator[](const ItemIdT<item_t>& item_id) const noexcept(NO_ASSERT)
{
static_assert(item_t == item_type, "invalid ItemId type");
Assert(this->isBuilt());
return m_values[i];
}
template <typename IndexType>
DataType&
operator[](const IndexType&) const noexcept(NO_ASSERT)
{
static_assert(std::is_same_v<IndexType, ItemId>, "ItemValue must be indexed by ItemId");
return m_values[item_id];
}
template <typename DataType2, typename ConnectivityPtr2>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment