Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
ItemVector.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/* ItemVector.cc (C) 2000-2024 */
9/* */
10/* Vector of entities of the same type. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/core/ItemVector.h"
15
17#include "arcane/utils/FatalErrorException.h"
18
19#include "arcane/core/IItemFamily.h"
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arcane
25{
26namespace
27{
28 IMemoryAllocator* _getAllocator()
29 {
31 }
32} // namespace
33
34/*---------------------------------------------------------------------------*/
35/*---------------------------------------------------------------------------*/
36
38ItemVector(IItemFamily* afamily)
39: m_local_ids(_getAllocator())
40, m_family(afamily)
41{
42 _init();
43}
44
45/*---------------------------------------------------------------------------*/
46/*---------------------------------------------------------------------------*/
47
50: m_local_ids(_getAllocator())
51, m_family(afamily)
52{
53 _init();
54 m_local_ids.resize(local_ids.size());
55 MemoryUtils::copy(m_local_ids.span(), Span<const Int32>(local_ids));
56}
57
58/*---------------------------------------------------------------------------*/
59/*---------------------------------------------------------------------------*/
60
62ItemVector(IItemFamily* afamily, Integer asize)
63: m_local_ids(_getAllocator())
64, m_family(afamily)
65{
66 m_local_ids.resize(asize);
67 _init();
68}
69
70/*---------------------------------------------------------------------------*/
71/*---------------------------------------------------------------------------*/
72
75: m_local_ids(_getAllocator())
76{
77}
78
79/*---------------------------------------------------------------------------*/
80/*---------------------------------------------------------------------------*/
81
82void ItemVector::
83_init()
84{
85 if (m_family) {
86 ItemInfoListView info_view(m_family);
87 m_shared_info = info_view.m_item_shared_info;
88 }
89 else
90 m_shared_info = ItemSharedInfo::nullInstance();
91}
92
93/*---------------------------------------------------------------------------*/
94/*---------------------------------------------------------------------------*/
95
97setFamily(IItemFamily* afamily)
98{
99 m_local_ids.clear();
100 m_family = afamily;
101 _init();
102}
103
104/*---------------------------------------------------------------------------*/
105/*---------------------------------------------------------------------------*/
106
107template class ItemVectorViewT<Node>;
108template class ItemVectorViewT<Edge>;
109template class ItemVectorViewT<Face>;
110template class ItemVectorViewT<Cell>;
111template class ItemVectorViewT<Particle>;
112template class ItemVectorViewT<DoF>;
113
114template class ItemVectorT<Node>;
115template class ItemVectorT<Edge>;
116template class ItemVectorT<Face>;
117template class ItemVectorT<Cell>;
118template class ItemVectorT<Particle>;
119template class ItemVectorT<DoF>;
120
121/*---------------------------------------------------------------------------*/
122/*---------------------------------------------------------------------------*/
123
124} // namespace Arcane
125
126/*---------------------------------------------------------------------------*/
127/*---------------------------------------------------------------------------*/
Memory and allocator management functions.
constexpr Integer size() const noexcept
Number of elements in the array.
Interface of an entity family.
Definition IItemFamily.h:83
View of a list to obtain information about entities.
Typed entity vector.
Definition ItemVector.h:168
View on a typed array of entities.
ItemVector()
Creates a null vector. You must then call setFamily() to use it.
Definition ItemVector.cc:74
void setFamily(IItemFamily *afamily)
Sets the associated family.
Definition ItemVector.cc:97
View of an array of elements of type T.
Definition Span.h:635
IMemoryAllocator * getDefaultDataAllocator()
Default allocator for data.
void copy(MutableMemoryView destination, eMemoryResource destination_mem, ConstMemoryView source, eMemoryResource source_mem, const RunQueue *queue=nullptr)
Copies source to destination using the queue queue.
-- 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