Arcane  v3.16.0.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
ItemLocalIdListContainerView.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2024 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* ItemLocalIdListContainerView.h (C) 2000-2024 */
9/* */
10/* Vue sur le conteneur d'une liste de ItemLocalId. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_ITEMLOCALIDLISTCONTAINERVIEW_H
13#define ARCANE_CORE_ITEMLOCALIDLISTCONTAINERVIEW_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane::impl
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
38class ARCANE_CORE_EXPORT ItemLocalIdListContainerView
39{
40 // NOTE: Cette classe est mappée en C# et si on change sa structure il
41 // faut mettre à jour la version C# correspondante.
42 template <typename ItemType> friend class ::Arcane::ItemLocalIdListViewT;
43 template <int Extent> friend class ::Arcane::impl::ItemIndexedListView;
44 friend ItemVectorView;
45 friend ItemLocalIdListView;
46 friend ItemInternalConnectivityList;
47 friend ItemInternalVectorView;
48 friend ItemEnumeratorBase;
49 friend SimdItemEnumeratorBase;
50 friend ItemIndexArrayView;
51
52 private:
53
54 ItemLocalIdListContainerView() = default;
55 constexpr ARCCORE_HOST_DEVICE ItemLocalIdListContainerView(const Int32* ids, Int32 s, Int32 local_id_offset)
56 : m_local_ids(ids)
57 , m_local_id_offset(local_id_offset)
58 , m_size(s)
59 {}
60
61 constexpr ARCCORE_HOST_DEVICE ItemLocalIdListContainerView(SmallSpan<const Int32> ids, Int32 local_id_offset)
62 : m_local_ids(ids.data())
63 , m_local_id_offset(local_id_offset)
64 , m_size(ids.size())
65 {}
66
67 public:
68
69 constexpr ARCCORE_HOST_DEVICE Int32 operator[](Int32 index) const
70 {
71 ARCANE_CHECK_AT(index, m_size);
72 return m_local_ids[index] + m_local_id_offset;
73 }
74 constexpr ARCCORE_HOST_DEVICE Int32 localId(Int32 index) const
75 {
76 ARCANE_CHECK_AT(index, m_size);
77 return m_local_ids[index] + m_local_id_offset;
78 }
79 constexpr ARCCORE_HOST_DEVICE Int32 size() const { return m_size; }
80
81 void fillLocalIds(Array<Int32>& ids) const;
82
83 friend ARCANE_CORE_EXPORT std::ostream&
84 operator<<(std::ostream& o, const ItemLocalIdListContainerView& lhs);
85
86 private:
87
88 ConstArrayView<Int32> _idsWithoutOffset() const { return { m_size, m_local_ids }; }
89
90 private:
91
92 const Int32* m_local_ids = nullptr;
93 Int32 m_local_id_offset = 0;
94 Int32 m_size = 0;
95};
96
97/*---------------------------------------------------------------------------*/
98/*---------------------------------------------------------------------------*/
99
100} // namespace Arcane::impl
101
102/*---------------------------------------------------------------------------*/
103/*---------------------------------------------------------------------------*/
104
105#endif
Déclarations de types sur les entités.
Tableau d'items de types quelconques.
Vue constante d'un tableau de type T.
Vue d'un tableau d'éléments de type T.
Definition Span.h:673
std::int32_t Int32
Type entier signé sur 32 bits.