12#ifndef ARCANE_CORE_MATERIALS_CONSTITUENTITEMINDEXEDSELECTIONVIEW_H
13#define ARCANE_CORE_MATERIALS_CONSTITUENTITEMINDEXEDSELECTIONVIEW_H
17#include "arcane/core/materials/MaterialsCoreGlobal.h"
18#include "arcane/core/materials/ComponentItemVectorView.h"
23namespace Arcane::Materials::Impl
35template <
typename ContainerType_>
38template <
typename ConstituentContainerType_>
41 using ThatContainer = ConstituentContainerType_;
42 using ValueType = ThatContainer::ValueType;
43 static constexpr bool IsSpan() {
return false; }
44 static Int32 size(ThatContainer v)
81template <
typename ConstituentItemType_>
85 using ValueType = ConstituentItemType_;
86 static constexpr bool IsSpan() {
return true; }
87 static ARCCORE_HOST_DEVICE
Int32 size(ThatContainer v)
91 static ARCCORE_HOST_DEVICE ValueType item(ThatContainer v,
Int32 i)
129class ARCANE_CORE_EXPORT ConstituentItemIndexedSelectionViewBase
138 explicit ConstituentItemIndexedSelectionViewBase(
IMeshComponent* constituent,
Int32 selection_size);
170template <
typename ContainerView_>
171class ConstituentItemIndexedSelectionView
172:
public ConstituentItemIndexedSelectionViewBase
176 using ItemVecView = ContainerView_;
177 using ThatClass = ConstituentItemIndexedSelectionView;
179 using ValueType = TraitsType::ValueType;
180 static constexpr bool IsSpanContainer() {
return TraitsType::IsSpan(); }
184 ConstituentItemIndexedSelectionView(ItemVecView ecv, IndexArrayView indices)
185 : ConstituentItemIndexedSelectionViewBase(indices)
192 requires(!IsSpanContainer())
193 : ConstituentItemIndexedSelectionViewBase(view.component(), TraitsType::
size(view))
200 requires(IsSpanContainer())
201 : ConstituentItemIndexedSelectionViewBase(constituent, TraitsType::
size(ecv))
213 IndexArrayView selectionView()
const
218 ARCCORE_HOST_DEVICE ValueType operator[](
Int32 i)
const
223 ARCCORE_HOST_DEVICE ValueType item(
Int32 i)
const
225 ARCANE_CHECK_AT(i,
size());
240template <
typename ContainerView_>
241class ConstituentItemIndexedSelectionEnumerator
246 using ThatClass = ConstituentItemIndexedSelectionEnumerator;
248 using ValueType = SelectionType::ValueType;
250 friend class EnumeratorTracer;
255 explicit ConstituentItemIndexedSelectionEnumerator(
const SelectionType& v)
257 , m_container_with_selection(v)
262 static ThatClass create(SelectionType container)
264 return ThatClass(container);
269 void operator++() { ++m_index; }
270 bool hasNext()
const {
return m_index < m_size; }
272 ValueType operator*()
const
274 return m_container_with_selection.item(m_index);
277 Int32 index()
const {
return m_index; }
283 SelectionType m_container_with_selection;
292 return ConstituentItemIndexedSelectionEnumerator<ComponentCellVectorView>::create(container);
299 return ConstituentItemIndexedSelectionEnumerator<ComponentCellVectorView>::create(c2);
305 return ConstituentItemIndexedSelectionEnumerator<EnvCellVectorView>::create(container);
Vue sur un vecteur sur les entités d'un composant.
__host__ __device__ ComponentCell componentCell(Int32 index) const
Retourne la index-ème ComponentCell de la vue.
Enumérateur sur les éléments d'un ConstituentItemIndexedSelectionView.
__host__ __device__ Int32 size() const
nombre de EnvCell sélectionnées
SmallSpan< const Int32 > m_selection_view
Sélection.
Vue sur un sous ensemble d'un conteneur de ConstituentItem.
ItemVecView m_container_view
Vue sur les éléments d'origine.
ConstituentItemIndexedSelectionView(ItemVecView view)
Construit une sélection contenant tous les éléments de \view.
ConstituentItemIndexedSelectionView(IMeshComponent *constituent, SmallSpan< const ValueType > ecv)
Constructeur à partir d'une vue de ConstituentCell, de MatCell ou EnvCell.
Représente un composant d'une maille multi-matériau.
Maille arcane d'un milieu.
__host__ __device__ EnvCell envCell(Int32 index) const
Récupère la index-ème EnvCell de la vue.
Interface d'un composant (matériau ou milieu) d'un maillage.
Spécialisation partielle pour un SmallSpan<T>.
Représente un matériau d'une maille multi-matériau.
__host__ __device__ MatCell matCell(Int32 index) const
Récupère la index-ème MatCell de la vue.
Vue d'un tableau d'éléments de type T.
constexpr __host__ __device__ SizeType size() const noexcept
Retourne la taille du tableau.
constexpr ConstArrayView< value_type > constSmallView() const
Vue constante sur cette vue.
Active toujours les traces dans les parties Arcane concernant les matériaux.
EnvItemVectorView EnvCellVectorView
Type de la vue sur un EnvCellVector.
MatItemVectorView MatCellVectorView
Type de la vue sur un MatCellVector.
ConstituentItemIndexedSelectionEnumerator< ComponentCellVectorView > arcaneImplCreateConstituentEnumerator(ComponentCell, ConstituentItemIndexedSelectionView< ComponentCellVectorView > container)
Enumérateur sur une sélection d'un constituant.
std::int32_t Int32
Type entier signé sur 32 bits.
Caractéristiques pour le conteneur associé à ConstituentItemIndexedSelectionView.