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)
186 , m_container_view(ecv)
192 requires(IsSpanContainer())
193 : ConstituentItemIndexedSelectionViewBase(constituent, TraitsType::
size(ecv))
194 , m_container_view(ecv)
202 : ConstituentItemIndexedSelectionViewBase(view.component(), TraitsType::
size(view))
203 , m_container_view(view)
210 ARCCORE_HOST_DEVICE
Int32 sourceSize()
const {
return TraitsType::size(m_container_view); }
213 ItemVecView sourceView()
const {
return m_container_view; }
216 IndexArrayView selectionView()
const
221 ARCCORE_HOST_DEVICE ValueType operator[](
Int32 i)
const
226 ARCCORE_HOST_DEVICE ValueType item(
Int32 i)
const
228 ARCANE_CHECK_AT(i,
size());
235 ItemVecView m_container_view;
243template <
typename ContainerView_>
244class ConstituentItemIndexedSelectionEnumerator
249 using ThatClass = ConstituentItemIndexedSelectionEnumerator;
251 using ValueType = SelectionType::ValueType;
253 friend class EnumeratorTracer;
258 explicit ConstituentItemIndexedSelectionEnumerator(
const SelectionType& v)
260 , m_container_with_selection(v)
265 static ThatClass create(SelectionType container)
267 return ThatClass(container);
272 void operator++() { ++m_index; }
273 bool hasNext()
const {
return m_index < m_size; }
275 ValueType operator*()
const
277 return m_container_with_selection.item(m_index);
280 Int32 index()
const {
return m_index; }
286 SelectionType m_container_with_selection;
294class ComponentCellVectorSelectionView
295:
public ConstituentItemIndexedSelectionView<ComponentCellVectorView>
297 using BaseClass = ConstituentItemIndexedSelectionView<ComponentCellVectorView>;
302 : BaseClass(vector_view, indices)
308 : BaseClass(vector_view)
318class EnvCellVectorSelectionView
319:
public ConstituentItemIndexedSelectionView<EnvCellVectorView>
321 using BaseClass = ConstituentItemIndexedSelectionView<EnvCellVectorView>;
326 : BaseClass(vector_view, indices)
332 : BaseClass(vector_view)
342class MatCellVectorSelectionView
343:
public ConstituentItemIndexedSelectionView<MatCellVectorView>
345 using BaseClass = ConstituentItemIndexedSelectionView<MatCellVectorView>;
350 : BaseClass(vector_view, indices)
356 : BaseClass(vector_view)
368 return ConstituentItemIndexedSelectionEnumerator<ComponentCellVectorView>::create(container);
376 return ConstituentItemIndexedSelectionEnumerator<ComponentCellVectorView>::create(c2);
383 return ConstituentItemIndexedSelectionEnumerator<EnvCellVectorView>::create(container);
Selection sur un ComponentCellVectorView.
ComponentCellVectorSelectionView(ComponentCellVectorView vector_view)
Construit une sélection contenant tous les éléments de \view.
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.
ConstituentItemIndexedSelectionView(ItemVecView view)
Construit une sélection contenant tous les éléments de \view (qui doit dériver de ComponentCellVector...
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.
Selection sur un EnvCellVectorView.
EnvCellVectorSelectionView(EnvCellVectorView vector_view)
Construit une sélection contenant tous les éléments de \view.
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>.
MatCellVectorSelectionView(MatCellVectorView vector_view)
Construit une sélection contenant tous les éléments de \view.
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.
ConstituentItemIndexedSelectionEnumerator< ComponentCellVectorView > arcaneImplCreateConstituentEnumerator(ComponentCell, ComponentCellVectorSelectionView container)
Enumérateur sur une sélection d'un constituant.
ComponentItemVectorView ComponentCellVectorView
Type de la vue sur un ComponentCellVector.
MatItemVectorView MatCellVectorView
Type de la vue sur un MatCellVector.
std::int32_t Int32
Type entier signé sur 32 bits.
Caractéristiques pour le conteneur associé à ConstituentItemIndexedSelectionView.