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::MatImpl
37template <
typename ContainerType_>
40template <
typename ConstituentContainerType_>
43 using ThatContainer = ConstituentContainerType_;
44 using ValueType = ThatContainer::ValueType;
45 static constexpr bool IsSpan() {
return false; }
46 static Int32 size(ThatContainer v)
83template <
typename ConstituentItemType_>
87 using ValueType = ConstituentItemType_;
88 static constexpr bool IsSpan() {
return true; }
89 static ARCCORE_HOST_DEVICE
Int32 size(ThatContainer v)
93 static ARCCORE_HOST_DEVICE ValueType item(ThatContainer v,
Int32 i)
132class ARCANE_CORE_EXPORT ConstituentItemIndexedSelectionViewBase
141 explicit ConstituentItemIndexedSelectionViewBase(
IMeshComponent* constituent,
Int32 selection_size);
174template <
typename ContainerView_>
175class ConstituentItemIndexedSelectionView
176:
public ConstituentItemIndexedSelectionViewBase
180 using ItemVecView = ContainerView_;
181 using ThatClass = ConstituentItemIndexedSelectionView;
183 using ValueType = TraitsType::ValueType;
184 static constexpr bool IsSpanContainer() {
return TraitsType::IsSpan(); }
188 ConstituentItemIndexedSelectionView(ItemVecView ecv, IndexArrayView indices)
189 : ConstituentItemIndexedSelectionViewBase(indices)
190 , m_container_view(ecv)
196 requires(IsSpanContainer())
197 : ConstituentItemIndexedSelectionViewBase(constituent, TraitsType::
size(ecv))
198 , m_container_view(ecv)
206 : ConstituentItemIndexedSelectionViewBase(view.component(), TraitsType::
size(view))
207 , m_container_view(view)
214 ARCCORE_HOST_DEVICE
Int32 sourceSize()
const {
return TraitsType::size(m_container_view); }
217 ItemVecView sourceView()
const {
return m_container_view; }
220 IndexArrayView selectionView()
const
225 ARCCORE_HOST_DEVICE ValueType operator[](
Int32 i)
const
230 ARCCORE_HOST_DEVICE ValueType item(
Int32 i)
const
232 ARCANE_CHECK_AT(i,
size());
239 ItemVecView m_container_view;
248template <
typename ContainerView_>
249class ConstituentItemIndexedSelectionEnumerator
254 using ThatClass = ConstituentItemIndexedSelectionEnumerator;
256 using ValueType = SelectionType::ValueType;
258 friend class EnumeratorTracer;
263 explicit ConstituentItemIndexedSelectionEnumerator(
const SelectionType& v)
265 , m_container_with_selection(v)
270 static ThatClass create(SelectionType container)
272 return ThatClass(container);
277 void operator++() { ++m_index; }
278 bool hasNext()
const {
return m_index < m_size; }
280 ValueType operator*()
const
282 return m_container_with_selection.item(m_index);
285 Int32 index()
const {
return m_index; }
291 SelectionType m_container_with_selection;
300class ComponentCellVectorSelectionView
301:
public ConstituentItemIndexedSelectionView<ComponentCellVectorView>
303 using BaseClass = ConstituentItemIndexedSelectionView<ComponentCellVectorView>;
308 : BaseClass(vector_view, indices)
314 : BaseClass(vector_view)
325class EnvCellVectorSelectionView
326:
public ConstituentItemIndexedSelectionView<EnvCellVectorView>
328 using BaseClass = ConstituentItemIndexedSelectionView<EnvCellVectorView>;
333 : BaseClass(vector_view, indices)
339 : BaseClass(vector_view)
350class MatCellVectorSelectionView
351:
public ConstituentItemIndexedSelectionView<MatCellVectorView>
353 using BaseClass = ConstituentItemIndexedSelectionView<MatCellVectorView>;
358 : BaseClass(vector_view, indices)
364 : BaseClass(vector_view)
376 return ConstituentItemIndexedSelectionEnumerator<ComponentCellVectorView>::create(container);
384 return ConstituentItemIndexedSelectionEnumerator<ComponentCellVectorView>::create(c2);
391 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.
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.
Spécialisation partielle pour un SmallSpan<T>.
__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.