12#ifndef ARCANE_CORE_ITEMPAIRENUMERATOR_H
13#define ARCANE_CORE_ITEMPAIRENUMERATOR_H
17#include "arcane/core/Item.h"
38class ARCANE_CORE_EXPORT ItemPairEnumerator
47 ItemPairEnumerator() =
default;
51 inline void operator++()
55 inline bool hasNext()
const
57 return m_current < m_end;
59 inline Int32 itemLocalId()
const
61 return m_items_local_id[m_current];
63 inline Int32 index()
const
69 return { m_sub_items_shared_info, _ids() };
71 inline Item operator*()
const
73 return Item(m_items_local_id[m_current], m_items_shared_info);
75 inline Integer nbSubItem()
const
77 return static_cast<Int32>(m_indexes[m_current + 1] - m_indexes[m_current]);
90 ItemSharedInfo* m_items_shared_info = ItemSharedInfo::nullInstance();
91 ItemSharedInfo* m_sub_items_shared_info = ItemSharedInfo::nullInstance();
95 Item _currentItem()
const
97 return Item(m_items_local_id[m_current], m_items_shared_info);
99 ConstArrayView<Int32> _ids()
const
101 return ConstArrayView<Int32>(nbSubItem(), m_sub_items_local_id.
data() + m_indexes[m_current]);
112template <
typename ItemType>
113class ItemPairEnumeratorSubT
114:
public ItemPairEnumerator
119 : ItemPairEnumerator(array)
125 inline ItemType operator*()
const
127 return ItemType(this->_currentItem());
140template <
typename ItemType,
typename SubItemType>
141class ItemPairEnumeratorT
142:
public ItemPairEnumeratorSubT<ItemType>
144 using BaseClass = ItemPairEnumeratorSubT<ItemType>;
149 : ItemPairEnumeratorSubT<ItemType>(array)
155 return { this->m_sub_items_shared_info, this->_ids() };
Internal structure of a mesh entity.
Index of an ItemType entity in a variable.
Index of an Item in a variable.
Reference to a group of a given kind.
Internal shared structure of a mesh entity.
Base class for a mesh element.
constexpr __host__ __device__ pointer data() const noexcept
Pointer to the start of the view.
View of an array of elements of type T.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
ConstArrayView< Int64 > Int64ConstArrayView
C equivalent of a 1D array of 64-bit integers.
std::int32_t Int32
Signed integer type of 32 bits.