Arcane  4.2.1.0
User documentation
Loading...
Searching...
No Matches
ItemLocalIdListView.cc
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/* ItemLocalIdListView.cc (C) 2000-2026 */
9/* */
10/* View of a list of ItemLocalId. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/core/ItemLocalIdListView.h"
15
16#include "arcane/utils/Array.h"
17
18#include <iostream>
19
20/*---------------------------------------------------------------------------*/
21/*---------------------------------------------------------------------------*/
22
23namespace Arcane::impl
24{
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29std::ostream&
30operator<<(std::ostream& o, const impl::ItemLocalIdListContainerView& lhs)
31{
32 const Int32 n = lhs.size();
33 if (n == 0) {
34 o << "{}";
35 }
36 else {
37 o << "{ " << lhs[0];
38 for (Int32 i = 1; i < n; ++i)
39 o << ", " << lhs[i];
40 o << " }";
41 }
42 return o;
43}
44
45/*---------------------------------------------------------------------------*/
46/*---------------------------------------------------------------------------*/
47} // namespace Arcane::impl
48
49/*---------------------------------------------------------------------------*/
50/*---------------------------------------------------------------------------*/
51
52namespace Arcane
53{
54
55/*---------------------------------------------------------------------------*/
56/*---------------------------------------------------------------------------*/
57
58bool operator==(const ItemLocalIdListView& lhs, const ItemLocalIdListView& rhs)
59{
60 Int32 size1 = lhs.size();
61 Int32 size2 = rhs.size();
62 if (size1 != size2)
63 return false;
64 for (Int32 i = 0; i < size1; ++i)
65 if (lhs[i] != rhs[i])
66 return false;
67 return true;
68}
69
70/*---------------------------------------------------------------------------*/
71/*---------------------------------------------------------------------------*/
72
73void impl::ItemLocalIdListContainerView::
74fillLocalIds(Array<Int32>& ids) const
75{
76 for (Int32 i = 0, n = m_size; i < n; ++i)
77 ids.add(localId(i));
78}
79
80/*---------------------------------------------------------------------------*/
81/*---------------------------------------------------------------------------*/
82
83// To test the instantiation of these classes
84template class ItemLocalIdListViewT<Node>;
85
86/*---------------------------------------------------------------------------*/
87/*---------------------------------------------------------------------------*/
88
89} // namespace Arcane
90
91/*---------------------------------------------------------------------------*/
92/*---------------------------------------------------------------------------*/
Base class for 1D data vectors.
View over a list of ItemLocalId.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int32_t Int32
Signed integer type of 32 bits.