12#ifndef ARCANE_CORE_ITEMCONNECTEDENUMERATORBASE_H
13#define ARCANE_CORE_ITEMCONNECTEDENUMERATORBASE_H
17#include "arcane/core/ItemInternalEnumerator.h"
18#include "arcane/core/Item.h"
40class ItemConnectedEnumeratorBase
43 template <
typename T>
friend class ItemConnectedEnumeratorBaseT;
47 ItemConnectedEnumeratorBase() =
default;
49 : m_local_ids(local_ids.
data())
50 , m_count(local_ids.
size())
55 , m_local_id_offset(rhs._localIdOffset())
58 : m_local_ids(local_ids)
75 return m_index < m_count;
79 constexpr bool hasNext()
const {
return m_index < m_count; }
91 constexpr Int32 localId()
const {
return m_local_id_offset + m_local_ids[m_index]; }
95 const Int32* ARCANE_RESTRICT m_local_ids =
nullptr;
98 Int32 m_local_id_offset = 0;
110template <
typename ItemType>
111class ItemConnectedEnumeratorBaseT
112:
public ItemConnectedEnumeratorBase
114 friend class ItemConnectedEnumerator;
119 using LocalIdType =
typename ItemType::LocalIdType;
120 using BaseClass = ItemConnectedEnumeratorBase;
124 ItemConnectedEnumeratorBaseT()
126 , m_item(NULL_ITEM_LOCAL_ID, ItemSharedInfo::nullInstance())
130 : BaseClass(local_ids)
131 , m_item(NULL_ITEM_LOCAL_ID, shared_info)
135 : ItemConnectedEnumeratorBaseT(view.m_shared_info, view.
constLocalIds())
140 , m_item(NULL_ITEM_LOCAL_ID, rhs.m_shared_info)
144 : ItemConnectedEnumeratorBase(local_ids,
index, n)
151 constexpr ItemType operator*()
const
153 m_item.m_local_id = m_local_id_offset + m_local_ids[m_index];
156 constexpr const ItemType* operator->()
const
158 m_item.m_local_id = m_local_id_offset + m_local_ids[m_index];
162 constexpr LocalIdType asItemLocalId()
const
164 return LocalIdType{ m_local_id_offset + m_local_ids[m_index] };
169 mutable ItemType m_item = ItemType(NULL_ITEM_LOCAL_ID,
nullptr);
Constant view of an array of type T.
constexpr const_pointer data() const noexcept
Pointer to the allocated memory.
constexpr Integer size() const noexcept
Number of elements in the array.
constexpr void operator++()
Increments the enumerator index.
constexpr Int32 count() const
Number of elements in the enumerator.
constexpr bool operator()() const
True if the end of the enumerator has not been reached (index()<count()).
constexpr ItemLocalId itemLocalId() const
localId() of the current entity.
constexpr Int32 localId() const
localId() of the current entity.
constexpr Int32 index() const
Current index of the enumerator.
constexpr bool hasNext() const
True if the end of the enumerator has not been reached (index()<count()).
Enumerator over a typed list of connected entities of type ItemType.
View of a list of entities connected to another.
View of a list of entities connected to another entity.
Int32ConstArrayView _localIds() const
View of the index array.
Index of an Item in a variable.
Internal shared structure of a mesh entity.
Base class for a mesh element.
Internal view of an array of entities.
ConstArrayView< Int32 > constLocalIds() const
Array of local entity IDs.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
std::int32_t Int32
Signed integer type of 32 bits.