Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
ItemVectorView.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/* ItemVectorView.cc (C) 2000-2024 */
9/* */
10/* View over a list to retrieve information about entities. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/core/Item.h"
15
16#include "arcane/core/IItemFamily.h"
17
18/*---------------------------------------------------------------------------*/
19/*---------------------------------------------------------------------------*/
20
21namespace Arcane
22{
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
27ItemVectorView::
28ItemVectorView(IItemFamily* family, ConstArrayView<Int32> local_ids)
29: m_index_view(local_ids)
30{
31 _init2(family);
32}
33
34/*---------------------------------------------------------------------------*/
35/*---------------------------------------------------------------------------*/
36
37ItemVectorView::
38ItemVectorView(IItemFamily* family, ItemIndexArrayView indexes)
39: m_index_view(indexes)
40{
41 _init2(family);
42}
43
44/*---------------------------------------------------------------------------*/
45/*---------------------------------------------------------------------------*/
46
47void ItemVectorView::
48_init2(IItemFamily* family)
49{
50 if (family) {
51 ItemInfoListView info_view(family);
52 m_shared_info = info_view.m_item_shared_info;
53 }
54 else
55 m_shared_info = ItemSharedInfo::nullInstance();
56}
57
58/*---------------------------------------------------------------------------*/
59/*---------------------------------------------------------------------------*/
60
61void ItemVectorView::
62fillLocalIds(Array<Int32>& ids) const
63{
64 m_index_view.fillLocalIds(ids);
65}
66
67/*---------------------------------------------------------------------------*/
68/*---------------------------------------------------------------------------*/
69
70void ItemIndexArrayView::
71fillLocalIds(Array<Int32>& ids) const
72{
73 m_view.fillLocalIds(ids);
74}
75
76/*---------------------------------------------------------------------------*/
77/*---------------------------------------------------------------------------*/
78
79// Note: these structures must have the same layout as the version in NumericWrapper.h
80
81// This class serves as a return type to wrap the ConstArrayView class
82template <typename DataType> class ConstArrayViewPOD_T
83{
84 public:
85
86 Integer m_size;
87 const DataType* m_ptr;
88};
89
91{
92 public:
93
95 Int32 m_flags;
96};
97
99{
100 public:
101
102 ItemIndexArrayViewPOD m_local_ids;
103 ItemSharedInfo* m_shared_info;
104};
105
106/*---------------------------------------------------------------------------*/
107/*---------------------------------------------------------------------------*/
108
109void ItemVectorView::
110_internalSwigSet(ItemVectorViewPOD* vpod)
111{
112 vpod->m_local_ids.m_local_ids.m_size = localIds().size();
113 vpod->m_local_ids.m_local_ids.m_ptr = localIds().unguardedBasePointer();
114 vpod->m_local_ids.m_flags = indexes().flags();
115 vpod->m_shared_info = m_shared_info;
116}
117
118/*---------------------------------------------------------------------------*/
119/*---------------------------------------------------------------------------*/
120
121} // End namespace Arcane
122
123/*---------------------------------------------------------------------------*/
124/*---------------------------------------------------------------------------*/
Base class for 1D data vectors.
Constant view of an array of type T.
Interface of an entity family.
Definition IItemFamily.h:83
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
std::int32_t Int32
Signed integer type of 32 bits.