57 friend MeshMaterialMng;
61 friend ConstituentItemVectorImpl;
66 : m_constituent_item_index(mii.m_constituent_item_index)
67 , m_shared_info(mii.m_shared_info)
72#ifndef ARCCORE_DEVICE_CODE
73 m_shared_info = ComponentItemSharedInfo::_nullInstance();
85 ARCCORE_HOST_DEVICE
MatVarIndex _varIndex()
const {
return m_shared_info->_varIndex(m_constituent_item_index); }
96 ARCCORE_HOST_DEVICE Int32
componentId()
const {
return m_shared_info->_componentId(m_constituent_item_index); }
99 ARCCORE_HOST_DEVICE
bool null()
const {
return m_constituent_item_index.isNull(); }
105 ARCCORE_HOST_DEVICE Int32
level()
const {
return m_shared_info->m_level; }
108 ARCCORE_HOST_DEVICE Int32
nbSubItem()
const {
return m_shared_info->_nbSubConstituent(m_constituent_item_index); }
113 return Cell(m_shared_info->_globalItemBase(m_constituent_item_index));
119 return CellLocalId(m_shared_info->_globalItemId(m_constituent_item_index));
130 Int64
componentUniqueId()
const {
return m_shared_info->_componentUniqueId(m_constituent_item_index); }
136 ARCANE_CORE_EXPORT
friend std::ostream&
142 [[maybe_unused]] Int32 expected_level)
144#if !defined(ARCCORE_DEVICE_CODE)
145 if (item_base.null())
147 Int32 lvl = item_base.level();
148 if (lvl != expected_level)
149 _badConversion(item_base, lvl, expected_level);
156 return m_shared_info->_subItemBase(m_constituent_item_index, index);
158 ARCCORE_HOST_DEVICE matimpl::ConstituentItemBase _superItemBase()
const
160 return m_shared_info->_superItemBase(m_constituent_item_index);
162 ARCCORE_HOST_DEVICE ConstituentItemIndex _firstSubConstituentLocalId()
const
164 return m_shared_info->_firstSubConstituentLocalId(m_constituent_item_index);
169 ConstituentItemIndex m_constituent_item_index;
170 ComponentItemSharedInfo* m_shared_info =
nullptr;
175 ARCCORE_HOST_DEVICE ConstituentItemIndex _constituentItemIndex()
const
177 return m_constituent_item_index;
200 using iterator_category = std::forward_iterator_tag;
206 : m_index(enumerator.m_index)
207 , m_size(enumerator.m_size)
208 , m_first_sub_index(enumerator.m_first_sub_index)
209 , m_sub_constituent_shared_info(enumerator.m_sub_constituent_shared_info)
214 ARCCORE_HOST_DEVICE
void operator++() { ++m_index; }
217 ARCANE_CHECK_AT(m_index, m_size);
224 friend ARCCORE_HOST_DEVICE
bool operator==(
const Iterator& x,
const Sentinel&)
226 return x.m_index == x.m_size;
233 Int32 m_first_sub_index = -1;
244 return m_sub_constituent_shared_info->_varIndex(
ConstituentItemIndex(m_first_sub_index + m_index));
248 template <
typename ConstituentItemType>
253 using value_type = ConstituentItemType;
264 ARCCORE_HOST_DEVICE ConstituentItemType
operator*()
const
266 ARCANE_CHECK_AT(m_index, m_size);
267 return ConstituentItemType(_currentSubItemBase());
274 : m_size(super_item.nbSubItem())
275 , m_first_sub_index(super_item._firstSubConstituentLocalId().localId())
276 , m_sub_constituent_shared_info(super_item.m_shared_info->m_sub_component_item_shared_info)
282 ARCCORE_HOST_DEVICE
void operator++() { ++m_index; }
283 ARCCORE_HOST_DEVICE
bool hasNext()
const {
return m_index < m_size; }
285 ARCCORE_HOST_DEVICE ComponentCell operator*()
const
287 ARCANE_CHECK_AT(m_index, m_size);
288 return ComponentCell(_currentSubItemBase());
290 ARCCORE_HOST_DEVICE MatVarIndex _varIndex()
const
292 return m_sub_constituent_shared_info->_varIndex(ConstituentItemIndex(m_first_sub_index + m_index));
294 ARCCORE_HOST_DEVICE Int32 index()
const {
return m_index; }
295 ARCCORE_HOST_DEVICE
operator ComponentItemLocalId()
const
297 return ComponentItemLocalId(_varIndex());
299 ARCCORE_HOST_DEVICE Iterator begin()
const {
return Iterator(*
this); }
300 ARCCORE_HOST_DEVICE Sentinel end()
const {
return {}; }
306 Int32 m_first_sub_index = -1;
307 ComponentItemSharedInfo* m_sub_constituent_shared_info =
nullptr;
311 ARCCORE_HOST_DEVICE matimpl::ConstituentItemBase _currentSubItemBase()
const
313 return m_sub_constituent_shared_info->_item(ConstituentItemIndex(m_first_sub_index + m_index));