Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
ItemLocalIdListContainerView.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 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/* View over the container of a list of 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/*---------------------------------------------------------------------------*/
27
28/*!
29 * \internal
30 * \brief View over the container of a list of ItemLocalId.
31 *
32 * This class is only used to store the necessary information
33 * for a list of 'ItemLocalId' and is only used to pass
34 * information between entity views (e.g., ItemVectorView)
35 * and associated iterators.
36 *
37 * The associated user class is ItemLocalIdListView.
38 */
39class ARCANE_CORE_EXPORT ItemLocalIdListContainerView
40{
41 // NOTE: This class is mapped in C# and if its structure is changed,
42 // the corresponding C# version must be updated.
43 template <typename ItemType> friend class ::Arcane::ItemLocalIdListViewT;
44 template <int Extent> friend class ::Arcane::impl::ItemIndexedListView;
45 friend ItemVectorView;
46 friend ItemLocalIdListView;
47 friend ItemInternalConnectivityList;
48 friend ItemInternalVectorView;
49 friend ItemEnumeratorBase;
50 friend SimdItemEnumeratorBase;
51 friend ItemIndexArrayView;
52
53 private:
54
55 ItemLocalIdListContainerView() = default;
56 constexpr ARCCORE_HOST_DEVICE ItemLocalIdListContainerView(const Int32* ids, Int32 s, Int32 local_id_offset)
57 : m_local_ids(ids)
58 , m_local_id_offset(local_id_offset)
59 , m_size(s)
60 {}
61
62 constexpr ARCCORE_HOST_DEVICE ItemLocalIdListContainerView(SmallSpan<const Int32> ids, Int32 local_id_offset)
63 : m_local_ids(ids.data())
64 , m_local_id_offset(local_id_offset)
65 , m_size(ids.size())
66 {}
67
68 public:
69
70 constexpr ARCCORE_HOST_DEVICE Int32 operator[](Int32 index) const
71 {
72 ARCANE_CHECK_AT(index, m_size);
73 return m_local_ids[index] + m_local_id_offset;
74 }
75 constexpr ARCCORE_HOST_DEVICE Int32 localId(Int32 index) const
76 {
77 ARCANE_CHECK_AT(index, m_size);
78 return m_local_ids[index] + m_local_id_offset;
79 }
80 constexpr ARCCORE_HOST_DEVICE Int32 size() const { return m_size; }
81
82 void fillLocalIds(Array<Int32>& ids) const;
83
84 friend ARCANE_CORE_EXPORT std::ostream&
85 operator<<(std::ostream& o, const ItemLocalIdListContainerView& lhs);
86
87 private:
88
89 ConstArrayView<Int32> _idsWithoutOffset() const { return { m_size, m_local_ids }; }
90
91 private:
92
93 const Int32* m_local_ids = nullptr;
94 Int32 m_local_id_offset = 0;
95 Int32 m_size = 0;
96};
97
98/*---------------------------------------------------------------------------*/
99/*---------------------------------------------------------------------------*/
100
101} // namespace Arcane::impl
102
103/*---------------------------------------------------------------------------*/
104/*---------------------------------------------------------------------------*/
105
106#endif
Declarations of types on entities.
Base class for 1D data vectors.
Constant view of an array of type T.
View of an array of elements of type T.
Definition Span.h:805
std::int32_t Int32
Signed integer type of 32 bits.