Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
ItemInternalEnumerator.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/* ItemInternalEnumerator.h (C) 2000-2025 */
9/* */
10/* Enumerator over a list of ItemInternal. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_ITEMINTERNALENUMERATOR_H
13#define ARCANE_CORE_ITEMINTERNALENUMERATOR_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/core/ItemInternalVectorView.h"
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28class ItemInternal;
29class ItemEnumerator;
30
31/*---------------------------------------------------------------------------*/
32/*---------------------------------------------------------------------------*/
33
40class ItemInternalEnumerator
41{
42 private:
43
44 typedef ItemInternal* ItemInternalPtr;
45 friend class ItemEnumerator;
46
47 public:
48
49 ARCANE_DEPRECATED_REASON("Y2022: This class is deprecated. Use ItemEnumerator instead")
50 ItemInternalEnumerator(const ItemInternalPtr* items, const Int32* local_ids, Integer n)
51 : m_items(items)
52 , m_local_ids(local_ids)
53 , m_index(0)
54 , m_count(n)
55 {
56 }
57
58 ARCANE_DEPRECATED_REASON("Y2022: This class is deprecated. Use ItemEnumerator instead")
59 ItemInternalEnumerator(const ItemInternalVectorView& view)
60 : m_items(view._items().data())
61 , m_local_ids(view.localIds().data())
62 , m_index(0)
63 , m_count(view.size())
64 {}
65
66 ARCANE_DEPRECATED_REASON("Y2022: This class is deprecated. Use ItemEnumerator instead")
67 ItemInternalEnumerator(const ItemInternalArrayView& items, const Int32ConstArrayView& local_ids)
68 : m_items(items.data())
69 , m_local_ids(local_ids.data())
70 , m_index(0)
71 , m_count(local_ids.size())
72 {}
73
74 public:
75
76 ItemInternal* operator*() const { return m_items[m_local_ids[m_index]]; }
77 ItemInternal* operator->() const { return m_items[m_local_ids[m_index]]; }
78 inline void operator++() { ++m_index; }
79 inline bool operator()() { return m_index < m_count; }
80 inline bool hasNext() { return m_index < m_count; }
81
83 inline Integer count() const { return m_count; }
84
86 inline Integer index() const { return m_index; }
87
89 inline Integer localId() const { return m_local_ids[m_index]; }
90
91 protected:
92
93 const ItemInternalPtr* m_items;
94 const Int32* ARCANE_RESTRICT m_local_ids;
95 Integer m_index;
96 Integer m_count;
97};
98
99/*---------------------------------------------------------------------------*/
100/*---------------------------------------------------------------------------*/
101
102} // namespace Arcane
103
104/*---------------------------------------------------------------------------*/
105/*---------------------------------------------------------------------------*/
106
107#endif
constexpr const_pointer data() const noexcept
Pointer to the allocated memory.
Enumerator over a list of entities.
Integer index() const
Current index of the enumerator.
Integer localId() const
localId() of the current entity.
Integer count() const
Number of elements in the enumerator.
Internal view on an array of entities.
Int32ConstArrayView localIds() const
Array of local entity IDs.
Integer size() const
Number of elements in the vector.
Internal structure of a mesh entity.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
Definition UtilsTypes.h:482
std::int32_t Int32
Signed integer type of 32 bits.