12#ifndef ARCANE_CORE_MATERIALS_CONSTITUENTITEMBASE_H
13#define ARCANE_CORE_MATERIALS_CONSTITUENTITEMBASE_H
17#include "arcane/core/ItemInternal.h"
18#include "arcane/core/Item.h"
19#include "arcane/core/materials/ConstituentItemLocalId.h"
20#include "arcane/core/materials/ComponentItemInternal.h"
25namespace Arcane::Materials::matimpl
46 friend MeshMaterialMng;
49 friend MeshEnvironment;
50 friend MeshComponentData;
51 friend ComponentItemInternalData;
56 : m_constituent_item_index(
id)
57 , m_shared_info(shared_info)
66 return m_shared_info->_varIndex(m_constituent_item_index);
71 return m_constituent_item_index;
77 return m_shared_info->_componentId(m_constituent_item_index);
81 inline ARCCORE_HOST_DEVICE
constexpr bool null()
const
83 return m_constituent_item_index.isNull();
94 return m_shared_info->_component(m_constituent_item_index);
100 return m_shared_info->_nbSubConstituent(m_constituent_item_index);
106 return m_shared_info->_globalItemBase(m_constituent_item_index);
109 inline ARCCORE_HOST_DEVICE
constexpr Int32 level()
const
111 return m_shared_info->m_level;
117 return m_shared_info->_componentUniqueId(m_constituent_item_index);
122 ARCCORE_HOST_DEVICE
constexpr friend bool
125 return ((a.m_constituent_item_index == b.m_constituent_item_index) && (a.m_shared_info == b.m_shared_info));
127 ARCCORE_HOST_DEVICE
constexpr friend bool
128 operator!=(
const ConstituentItemBase& a,
const ConstituentItemBase& b)
136 ARCCORE_HOST_DEVICE
inline void _setVariableIndex(
MatVarIndex index)
138 m_shared_info->_setVarIndex(m_constituent_item_index, index);
142 ARCCORE_HOST_DEVICE
inline matimpl::ConstituentItemBase _superItemBase()
const;
144 ARCCORE_HOST_DEVICE
inline void _setSuperAndGlobalItem(ConstituentItemIndex cii, ItemLocalId ii)
146 m_shared_info->_setSuperItem(m_constituent_item_index, cii);
147 m_shared_info->_setGlobalItem(m_constituent_item_index, ii);
150 ARCCORE_HOST_DEVICE
inline void _setGlobalItem(ItemLocalId ii)
152 m_shared_info->_setGlobalItem(m_constituent_item_index, ii);
156 inline ARCCORE_HOST_DEVICE ConstituentItemIndex _firstSubItemLocalId()
const
158 return m_shared_info->_firstSubConstituentLocalId(m_constituent_item_index);
161 inline ARCCORE_HOST_DEVICE matimpl::ConstituentItemBase _subItemBase(Int32 i)
const;
164 ARCCORE_HOST_DEVICE
void _setNbSubItem(Int16 nb_sub_item)
166 m_shared_info->_setNbSubConstituent(m_constituent_item_index, nb_sub_item);
170 ARCCORE_HOST_DEVICE
void _setFirstSubItem(ConstituentItemIndex first_sub_item)
172 m_shared_info->_setFirstSubConstituentLocalId(m_constituent_item_index, first_sub_item);
175 ARCCORE_HOST_DEVICE
void _setComponent(Int16 component_id)
177 m_shared_info->_setComponentId(m_constituent_item_index, component_id);
182 ConstituentItemIndex m_constituent_item_index;
183 ComponentItemSharedInfo* m_shared_info = ComponentItemSharedInfo::null_shared_info_pointer;
200inline constexpr matimpl::ConstituentItemBase ComponentItemSharedInfo::
201_item(ConstituentItemIndex
id)
203 return matimpl::ConstituentItemBase(
this,
id);
206ARCCORE_HOST_DEVICE
inline matimpl::ConstituentItemBase ComponentItemSharedInfo::
207_superItemBase(ConstituentItemIndex
id)
const
209 ARCCORE_CHECK_RANGE(
id.localId(), -1, m_storage_size);
210 ConstituentItemIndex super_local_id(m_super_component_item_local_id_data[
id.localId()]);
211 return m_super_component_item_shared_info->_item(super_local_id);
214inline ARCCORE_HOST_DEVICE matimpl::ConstituentItemBase ComponentItemSharedInfo::
215_subItemBase(ConstituentItemIndex
id,Int32 sub_index)
const
217 ARCCORE_CHECK_RANGE(
id.localId(), -1, m_storage_size);
218 ConstituentItemIndex lid(m_first_sub_constituent_item_id_data[
id.localId()].localId() + sub_index);
219 return m_sub_component_item_shared_info->_item(lid);
225inline ARCCORE_HOST_DEVICE matimpl::ConstituentItemBase matimpl::ConstituentItemBase::
226_superItemBase()
const
228 return m_shared_info->_superItemBase(m_constituent_item_index);
231inline ARCCORE_HOST_DEVICE matimpl::ConstituentItemBase matimpl::ConstituentItemBase::
232_subItemBase(Int32 i)
const
234 return m_shared_info->_subItemBase(m_constituent_item_index, i);
247class ARCANE_CORE_EXPORT ConstituentItemLocalIdListView
249 friend class ConstituentItemLocalIdList;
250 friend class ComponentItemVectorView;
251 friend class MeshComponentPartData;
252 friend class ComponentPartItemVectorView;
253 friend class ComponentPartCellEnumerator;
254 friend class ComponentCellEnumerator;
255 friend class MeshEnvironment;
259 ConstituentItemLocalIdListView() =
default;
260 ConstituentItemLocalIdListView(ComponentItemSharedInfo* shared_info,
261 ConstArrayView<ConstituentItemIndex> ids)
262 : m_component_shared_info(shared_info)
272 ARCCORE_HOST_DEVICE matimpl::ConstituentItemBase _constituenItemBase(Int32 index)
const
274 return m_component_shared_info->_item(m_ids[index]);
276 MatVarIndex _matVarIndex(Int32 index)
const
278 return m_component_shared_info->_varIndex(m_ids[index]);
280 ConstituentItemLocalIdListView _subView(Int32 begin, Int32 size)
const
282 return { m_component_shared_info, m_ids.subView(begin, size) };
285 bool _isSamePointerData(
const ConstituentItemLocalIdListView& rhs)
const
287 return (m_ids.data() == rhs.m_ids.data());
289 friend bool operator==(
const ConstituentItemLocalIdListView& a,
290 const ConstituentItemLocalIdListView& b)
292 bool t1 = a.m_component_shared_info == b.m_component_shared_info;
293 bool t2 = a.m_ids == b.m_ids;
296 friend bool operator!=(
const ConstituentItemLocalIdListView& a,
297 const ConstituentItemLocalIdListView& b)
307 ComponentItemSharedInfo* m_component_shared_info =
nullptr;
308 ConstArrayView<ConstituentItemIndex> m_ids;
312 void _checkCoherency()
const;
Classe de base pour les entités du maillage.
Maille arcane avec info matériaux et milieux.
Représente un composant d'une maille multi-matériau.
Maille arcane d'un milieu.
Interface d'un composant (matériau ou milieu) d'un maillage.
Représente un matériau d'une maille multi-matériau.
Représente un index sur les variables matériaux et milieux.
__host__ __device__ MatVarIndex variableIndex() const
Indexeur dans les variables matériaux.
IMeshComponent * component() const
Composant associé.
__host__ __device__ constexpr bool null() const
Indique s'il s'agit de la maille nulle.
__host__ __device__ Int32 componentId() const
Identifiant du composant.
__host__ __device__ Int32 nbSubItem() const
Nombre de sous-composants.
Int64 componentUniqueId() const
Numéro unique de l'entité component.
impl::ItemBase globalItemBase() const
Entité globale correspondante.
Active toujours les traces dans les parties Arcane concernant les matériaux.