12#ifndef ARCANE_CORE_INDEXEDITEMCONNECTIVITYVIEW_H
13#define ARCANE_CORE_INDEXEDITEMCONNECTIVITYVIEW_H
18#include "arcane/core/Item.h"
19#include "arcane/core/IItemFamily.h"
36class ARCANE_CORE_EXPORT IndexedItemConnectivityViewBase
38 friend class IndexedItemConnectivityViewBase2;
42 IndexedItemConnectivityViewBase() =
default;
45 : m_container_view(container_view)
46 , m_source_kind(source_kind)
47 , m_target_kind(target_kind)
54 constexpr ARCCORE_HOST_DEVICE
Int32 nbSourceItem()
const {
return m_container_view.nbItem(); }
56 constexpr ARCCORE_HOST_DEVICE
Int32 nbItem(
ItemLocalId lid)
const {
return m_container_view.m_nb_connected_items[lid]; }
60 return m_container_view.itemsIds<
Item>(lid);
62 eItemKind sourceItemKind()
const {
return m_source_kind; }
63 eItemKind targetItemKind()
const {
return m_target_kind; }
66 ARCANE_DEPRECATED_REASON(
"Y2022: This method is internal to Arcane and should be replaced by call to constructor")
72 m_source_kind = source_kind;
73 m_target_kind = target_kind;
80 m_container_view = view.m_container_view;
81 m_source_kind = view.m_source_kind;
82 m_target_kind = view.m_target_kind;
87 ItemConnectivityContainerView m_container_view;
88 eItemKind m_source_kind = IK_Unknown;
89 eItemKind m_target_kind = IK_Unknown;
93 [[noreturn]]
void _badConversion(eItemKind k1, eItemKind k2)
const;
97 void _checkValid(eItemKind k1, eItemKind k2)
const
99 if (k1 != m_source_kind || k2 != m_target_kind)
100 _badConversion(k1, k2);
113class ARCANE_CORE_EXPORT IndexedItemConnectivityViewBase2
117 IndexedItemConnectivityViewBase2() =
default;
122 : m_container_view(view.m_container_view)
135 return m_container_view.itemsIds<
Item>(lid);
149template <
typename ItemType1,
typename ItemType2>
150class IndexedItemConnectivityGenericViewT
151:
public IndexedItemConnectivityViewBase2
155 using ItemType1Type = ItemType1;
156 using ItemType2Type = ItemType2;
157 using ItemLocalId1 = ItemType1::LocalIdType;
158 using ItemLocalId2 = ItemType2::LocalIdType;
164 : IndexedItemConnectivityViewBase2(view)
169 view._checkValid(k1, k2);
172 IndexedItemConnectivityGenericViewT() =
default;
177 constexpr ARCCORE_HOST_DEVICE ItemLocalIdViewType
items(ItemLocalId1 lid)
const
179 return m_container_view.itemsIds<ItemType2>(lid);
183 constexpr ARCCORE_HOST_DEVICE ItemLocalIdViewType
itemIds(ItemLocalId1 lid)
const
185 return m_container_view.itemsIds<ItemType2>(lid);
189 constexpr ARCCORE_HOST_DEVICE ItemLocalId2
itemId(ItemLocalId1 lid,
Int32 index)
const
191 return m_container_view.itemId<ItemLocalId2>(lid, index);
201template <
typename ItemType>
202class IndexedItemConnectivityViewT<ItemType,
Node>
203:
public IndexedItemConnectivityGenericViewT<ItemType, Node>
207 using BaseClass = IndexedItemConnectivityGenericViewT<ItemType, Node>;
208 using ItemLocalIdType = ItemType::LocalIdType;
209 using ItemLocalIdViewType = BaseClass::ItemLocalIdViewType;
210 using ItemLocalId2 = BaseClass::ItemLocalId2;
217 IndexedItemConnectivityViewT() =
default;
222 constexpr ARCCORE_HOST_DEVICE
Int32 nbNode(ItemLocalIdType lid)
const
227 constexpr ARCCORE_HOST_DEVICE ItemLocalIdViewType
nodes(ItemLocalIdType lid)
const
232 constexpr ARCCORE_HOST_DEVICE ItemLocalIdViewType
nodeIds(ItemLocalIdType lid)
const
237 constexpr ARCCORE_HOST_DEVICE ItemLocalId2
nodeId(ItemLocalIdType lid,
Int32 index)
const
249template <
typename ItemType>
250class IndexedItemConnectivityViewT<ItemType,
Edge>
251:
public IndexedItemConnectivityGenericViewT<ItemType, Edge>
255 using BaseClass = IndexedItemConnectivityGenericViewT<ItemType, Edge>;
256 using ItemLocalIdType = ItemType::LocalIdType;
257 using ItemLocalIdViewType = BaseClass::ItemLocalIdViewType;
258 using ItemLocalId2 = BaseClass::ItemLocalId2;
265 IndexedItemConnectivityViewT() =
default;
270 constexpr ARCCORE_HOST_DEVICE
Int32 nbEdge(ItemLocalIdType lid)
const
275 constexpr ARCCORE_HOST_DEVICE ItemLocalIdViewType
edges(ItemLocalIdType lid)
const
280 constexpr ARCCORE_HOST_DEVICE ItemLocalIdViewType
edgeIds(ItemLocalIdType lid)
const
285 constexpr ARCCORE_HOST_DEVICE ItemLocalId2
edgeId(ItemLocalIdType lid,
Int32 index)
const
297template <
typename ItemType>
298class IndexedItemConnectivityViewT<ItemType,
Face>
299:
public IndexedItemConnectivityGenericViewT<ItemType, Face>
303 using BaseClass = IndexedItemConnectivityGenericViewT<ItemType, Face>;
304 using ItemLocalIdType = ItemType::LocalIdType;
305 using ItemLocalIdViewType = BaseClass::ItemLocalIdViewType;
306 using ItemLocalId2 = BaseClass::ItemLocalId2;
313 IndexedItemConnectivityViewT() =
default;
318 constexpr ARCCORE_HOST_DEVICE
Int32 nbFace(ItemLocalIdType lid)
const
323 constexpr ARCCORE_HOST_DEVICE ItemLocalIdViewType
faces(ItemLocalIdType lid)
const
328 constexpr ARCCORE_HOST_DEVICE ItemLocalIdViewType
faceIds(ItemLocalIdType lid)
const
333 constexpr ARCCORE_HOST_DEVICE ItemLocalId2
faceId(ItemLocalIdType lid,
Int32 index)
const
345template <
typename ItemType>
346class IndexedItemConnectivityViewT<ItemType,
Cell>
347:
public IndexedItemConnectivityGenericViewT<ItemType, Cell>
351 using BaseClass = IndexedItemConnectivityGenericViewT<ItemType, Cell>;
352 using ItemLocalIdType = ItemType::LocalIdType;
353 using ItemLocalIdViewType = BaseClass::ItemLocalIdViewType;
354 using ItemLocalId2 = BaseClass::ItemLocalId2;
361 IndexedItemConnectivityViewT() =
default;
366 constexpr ARCCORE_HOST_DEVICE
Int32 nbCell(ItemLocalIdType lid)
const
371 constexpr ARCCORE_HOST_DEVICE ItemLocalIdViewType
cells(ItemLocalIdType lid)
const
376 constexpr ARCCORE_HOST_DEVICE ItemLocalIdViewType
cellIds(ItemLocalIdType lid)
const
381 constexpr ARCCORE_HOST_DEVICE ItemLocalId2
cellId(ItemLocalIdType lid,
Int32 index)
const
393template <
typename ItemType>
394class IndexedItemConnectivityViewT<ItemType,
DoF>
395:
public IndexedItemConnectivityGenericViewT<ItemType, DoF>
399 using BaseClass = IndexedItemConnectivityGenericViewT<ItemType, DoF>;
400 using ItemLocalIdType = ItemType::LocalIdType;
401 using ItemLocalIdViewType = BaseClass::ItemLocalIdViewType;
402 using ItemLocalId2 = BaseClass::ItemLocalId2;
409 IndexedItemConnectivityViewT() =
default;
414 constexpr ARCCORE_HOST_DEVICE
Int32 nbDof(ItemLocalIdType lid)
const
419 constexpr ARCCORE_HOST_DEVICE ItemLocalIdViewType
dofs(ItemLocalIdType lid)
const
424 constexpr ARCCORE_HOST_DEVICE ItemLocalIdViewType
dofIds(ItemLocalIdType lid)
const
429 constexpr ARCCORE_HOST_DEVICE ItemLocalId2
dofId(ItemLocalIdType lid,
Int32 index)
const
443class ARCANE_CORE_EXPORT IndexedParticleCellConnectivityView
444:
public IndexedItemConnectivityGenericViewT<Particle, Cell>
448 using BaseClass = IndexedItemConnectivityGenericViewT<Particle, Cell>;
450 using ItemLocalIdViewType = BaseClass::ItemLocalIdViewType;
451 using ItemLocalId2 = BaseClass::ItemLocalId2;
459 explicit IndexedParticleCellConnectivityView(
IItemFamily* pf);
460 IndexedParticleCellConnectivityView() =
default;
465 constexpr ARCCORE_HOST_DEVICE
bool hasCell(ItemLocalIdType lid)
const
467 return !
cellId(lid).isNull();
470 constexpr ARCCORE_HOST_DEVICE ItemLocalId2
cellId(ItemLocalIdType lid)
const
484class ARCANE_CORE_EXPORT MutableIndexedParticleCellConnectivityView
485:
public IndexedParticleCellConnectivityView
491 using ItemLocalIdViewType = BaseClass::ItemLocalIdViewType;
492 using ItemLocalId2 = BaseClass::ItemLocalId2;
496 explicit MutableIndexedParticleCellConnectivityView(
IParticleFamily* pf);
497 explicit MutableIndexedParticleCellConnectivityView(
IItemFamily* pf);
502 ARCCORE_HOST_DEVICE
void setCellId(ParticleLocalId particle_lid, CellLocalId cell_lid)
const
504 m_container_view._setParticleCellId(particle_lid, cell_lid);
515using IndexedCellNodeConnectivityView = IndexedItemConnectivityViewT<Cell, Node>;
516using IndexedCellEdgeConnectivityView = IndexedItemConnectivityViewT<Cell, Edge>;
517using IndexedCellFaceConnectivityView = IndexedItemConnectivityViewT<Cell, Face>;
518using IndexedCellCellConnectivityView = IndexedItemConnectivityViewT<Cell, Cell>;
519using IndexedCellDoFConnectivityView = IndexedItemConnectivityViewT<Cell, DoF>;
521using IndexedFaceNodeConnectivityView = IndexedItemConnectivityViewT<Face, Node>;
522using IndexedFaceEdgeConnectivityView = IndexedItemConnectivityViewT<Face, Edge>;
523using IndexedFaceFaceConnectivityView = IndexedItemConnectivityViewT<Face, Face>;
524using IndexedFaceCellConnectivityView = IndexedItemConnectivityViewT<Face, Cell>;
525using IndexedFaceDoFConnectivityView = IndexedItemConnectivityViewT<Face, DoF>;
527using IndexedEdgeNodeConnectivityView = IndexedItemConnectivityViewT<Edge, Node>;
528using IndexedEdgeEdgeConnectivityView = IndexedItemConnectivityViewT<Edge, Edge>;
529using IndexedEdgeFaceConnectivityView = IndexedItemConnectivityViewT<Edge, Face>;
530using IndexedEdgeCellConnectivityView = IndexedItemConnectivityViewT<Edge, Cell>;
531using IndexedEdgeDoFConnectivityView = IndexedItemConnectivityViewT<Edge, DoF>;
533using IndexedNodeNodeConnectivityView = IndexedItemConnectivityViewT<Node, Node>;
534using IndexedNodeEdgeConnectivityView = IndexedItemConnectivityViewT<Node, Edge>;
535using IndexedNodeFaceConnectivityView = IndexedItemConnectivityViewT<Node, Face>;
536using IndexedNodeCellConnectivityView = IndexedItemConnectivityViewT<Node, Cell>;
537using IndexedNodeDoFConnectivityView = IndexedItemConnectivityViewT<Node, DoF>;
539using IndexedDoFNodeConnectivityView = IndexedItemConnectivityViewT<DoF, Node>;
540using IndexedDoFEdgeConnectivityView = IndexedItemConnectivityViewT<DoF, Edge>;
541using IndexedDoFFaceConnectivityView = IndexedItemConnectivityViewT<DoF, Face>;
542using IndexedDoFCellConnectivityView = IndexedItemConnectivityViewT<DoF, Cell>;
543using IndexedDoFDoFConnectivityView = IndexedItemConnectivityViewT<DoF, DoF>;
Declarations of Arcane's general types.
Interface of an entity family.
Interface of a particle family.
Specialized view on unstructured connectivity between two entities.
constexpr __host__ __device__ ItemLocalId2 itemId(ItemLocalId1 lid, Int32 index) const
i-th entity connected to entity lid
constexpr __host__ __device__ ItemLocalIdViewType items(ItemLocalId1 lid) const
List of entities connected to entity lid.
constexpr __host__ __device__ ItemLocalIdViewType itemIds(ItemLocalId1 lid) const
List of entities connected to entity lid.
constexpr __host__ __device__ ItemLocalIdListViewT< Item > items(ItemLocalId lid) const
List of entities connected to entity lid.
constexpr __host__ __device__ Int32 nbItem(ItemLocalId lid) const
Number of entities connected to entity lid.
constexpr __host__ __device__ Int32 nbSourceItem() const
Number of source entities.
Base class for a view on unstructured connectivity.
constexpr __host__ __device__ Int32 nbSourceItem() const
Number of source entities.
void init(SmallSpan< const Int32 > nb_item, SmallSpan< const Int32 > indexes, SmallSpan< const Int32 > list_data, eItemKind source_kind, eItemKind target_kind)
Initializes the view.
constexpr __host__ __device__ ItemLocalIdListViewT< Item > items(ItemLocalId lid) const
List of entities connected to entity lid.
constexpr __host__ __device__ Int32 nbItem(ItemLocalId lid) const
Number of entities connected to entity lid.
constexpr __host__ __device__ ItemLocalIdViewType cellIds(ItemLocalIdType lid) const
List of cells connected to entity lid.
constexpr __host__ __device__ ItemLocalIdViewType cells(ItemLocalIdType lid) const
List of cells connected to entity lid.
constexpr __host__ __device__ Int32 nbCell(ItemLocalIdType lid) const
Number of cells connected to entity lid.
constexpr __host__ __device__ ItemLocalId2 cellId(ItemLocalIdType lid, Int32 index) const
i-th cell connected to entity lid
constexpr __host__ __device__ Int32 nbDof(ItemLocalIdType lid) const
Number of DoFs connected to entity lid.
constexpr __host__ __device__ ItemLocalId2 dofId(ItemLocalIdType lid, Int32 index) const
i-th DoF connected to entity lid
constexpr __host__ __device__ ItemLocalIdViewType dofIds(ItemLocalIdType lid) const
List of DoFs connected to entity lid.
constexpr __host__ __device__ ItemLocalIdViewType dofs(ItemLocalIdType lid) const
List of DoFs connected to entity lid.
constexpr __host__ __device__ ItemLocalId2 edgeId(ItemLocalIdType lid, Int32 index) const
i-th edge connected to entity lid
constexpr __host__ __device__ ItemLocalIdViewType edges(ItemLocalIdType lid) const
List of edges connected to entity lid.
constexpr __host__ __device__ ItemLocalIdViewType edgeIds(ItemLocalIdType lid) const
List of edges connected to entity lid.
constexpr __host__ __device__ Int32 nbEdge(ItemLocalIdType lid) const
Number of edges connected to entity lid.
constexpr __host__ __device__ ItemLocalIdViewType faces(ItemLocalIdType lid) const
List of faces connected to entity lid.
constexpr __host__ __device__ Int32 nbFace(ItemLocalIdType lid) const
Number of faces connected to entity lid.
constexpr __host__ __device__ ItemLocalId2 faceId(ItemLocalIdType lid, Int32 index) const
i-th face connected to entity lid
constexpr __host__ __device__ ItemLocalIdViewType faceIds(ItemLocalIdType lid) const
List of faces connected to entity lid.
constexpr __host__ __device__ Int32 nbNode(ItemLocalIdType lid) const
Number of nodes connected to entity lid.
constexpr __host__ __device__ ItemLocalIdViewType nodes(ItemLocalIdType lid) const
List of nodes connected to entity lid.
constexpr __host__ __device__ ItemLocalId2 nodeId(ItemLocalIdType lid, Int32 index) const
i-th node connected to entity lid
constexpr __host__ __device__ ItemLocalIdViewType nodeIds(ItemLocalIdType lid) const
List of nodes connected to entity lid.
constexpr __host__ __device__ bool hasCell(ItemLocalIdType lid) const
Indicates if the particle lid is connected to a cell.
constexpr __host__ __device__ ItemLocalId2 cellId(ItemLocalIdType lid) const
Cell connected to entity lid.
Views of containers holding connectivity. This class allows the containers used to be opaque outside ...
Typed view over a list of connectivity entities.
Index of an Item in a variable.
static eItemKind kind()
Entity kind.
Base class for a mesh element.
__host__ __device__ void setCellId(ParticleLocalId particle_lid, CellLocalId cell_lid) const
Cell connected to entity lid.
ParticleLocalId LocalIdType
Type of localId().
View of an array of elements of type T.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
eItemKind
Mesh entity type.
std::int32_t Int32
Signed integer type of 32 bits.