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
39class ARCANE_CORE_EXPORT ConstituentItemBase
46 friend MeshMaterialMng;
47 friend ComponentItemSharedInfo;
49 friend MeshEnvironment;
50 friend MeshComponentData;
51 friend ComponentItemInternalData;
55 ARCCORE_HOST_DEVICE
constexpr ConstituentItemBase(ComponentItemSharedInfo* shared_info,
ConstituentItemIndex id)
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)
138 m_shared_info->_setVarIndex(m_constituent_item_index, index);
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);
158 return m_shared_info->_firstSubConstituentLocalId(m_constituent_item_index);
166 m_shared_info->_setNbSubConstituent(m_constituent_item_index, nb_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);
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);
209 ARCCORE_CHECK_RANGE(
id.localId(), -1, m_storage_size);
211 return m_super_component_item_shared_info->_item(super_local_id);
217 ARCCORE_CHECK_RANGE(
id.localId(), -1, m_storage_size);
219 return m_sub_component_item_shared_info->_item(lid);
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,
262 : m_component_shared_info(shared_info)
274 return m_component_shared_info->_item(m_ids[index]);
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) };
287 return (m_ids.data() == rhs.m_ids.data());
292 bool t1 = a.m_component_shared_info == b.m_component_shared_info;
293 bool t2 = a.m_ids == b.m_ids;
307 ComponentItemSharedInfo* m_component_shared_info =
nullptr;
308 ConstArrayView<ConstituentItemIndex> m_ids;
312 void _checkCoherency()
const;
Vue constante d'un tableau de type T.
Index d'un Item dans une variable.
ConstituentItemIndex * m_first_sub_constituent_item_id_data
Id de la première entité sous-constituant.
ConstituentItemIndex * m_super_component_item_local_id_data
Id de l'entité sous-constituant parente.
Index d'une entité constituant dans la liste des entités constituants.
Vue sur une instance de ConstituentItemLocalIdList.
bool _isSamePointerData(const ConstituentItemLocalIdListView &rhs) const
Pour les tests, vérifie que les vues pointent vers les mêmes données.
Interface d'un composant (matériau ou milieu) d'un maillage.
Représente un index sur les variables matériaux et milieux.
Informations génériques sur une entité d'un constituant.
__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__ void _setVariableIndex(MatVarIndex index)
Positionne l'indexeur dans les variables matériaux.
__host__ __device__ matimpl::ConstituentItemBase _superItemBase() const
Composant supérieur (0 si aucun)
__host__ __device__ ConstituentItemIndex _firstSubItemLocalId() const
Première entité sous-composant.
__host__ __device__ Int32 componentId() const
Identifiant du composant.
__host__ __device__ Int32 nbSubItem() const
Nombre de sous-composants.
__host__ __device__ void _setFirstSubItem(ConstituentItemIndex first_sub_item)
Positionne le premier sous-composant.
__host__ __device__ void _setNbSubItem(Int16 nb_sub_item)
Positionne le 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.
std::int64_t Int64
Type entier signé sur 64 bits.
std::int16_t Int16
Type entier signé sur 16 bits.
std::int32_t Int32
Type entier signé sur 32 bits.