Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
ConstituentItemLocalIdList.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/* ConstituentItemLocalIdList.h (C) 2000-2024 */
9/* */
10/* Management of local identifier lists for 'ComponentItemInternal'. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_MATERIALS_INTERNAL_CONSTITUENTITEMLOCALIDLIST_H
13#define ARCANE_CORE_MATERIALS_INTERNAL_CONSTITUENTITEMLOCALIDLIST_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/TraceAccessor.h"
18#include "arcane/utils/Array.h"
19
21#include "arcane/core/materials/ComponentItemInternal.h"
22
23/*---------------------------------------------------------------------------*/
24/*---------------------------------------------------------------------------*/
25
26namespace Arcane::Materials
27{
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
31
36class ARCANE_CORE_EXPORT ConstituentItemLocalIdList
37{
38 // For write access to m_constituent_item_index_list
39 friend class ConstituentItemVectorImpl;
40
41 public:
42
43 ConstituentItemLocalIdList(ComponentItemSharedInfo* shared_info, const String& debug_name);
44
45 public:
46
47 void resize(Int32 new_size);
48
49 public:
50
51 void setConstituentItem(Int32 index, ConstituentItemIndex id)
52 {
54 }
55
57 {
58 const Int32 size = ids.size();
59 resize(size);
60 for (Int32 i = 0; i < size; ++i)
61 setConstituentItem(i, ids[i]);
62 }
63
64 void copy(const ConstituentItemLocalIdListView& view)
65 {
66 m_shared_info = view.m_component_shared_info;
67 const Int32 size = view.m_ids.size();
68 resize(size);
69 for (Int32 i = 0; i < size; ++i)
70 setConstituentItem(i, view.m_ids[i]);
71 }
72
74 {
76 }
77 SmallSpan<ConstituentItemIndex> mutableLocalIds()
78 {
80 }
81 matimpl::ConstituentItemBase itemBase(Int32 index) const
82 {
83 return m_shared_info->_item(localId(index));
84 }
85 ConstituentItemIndex localId(Int32 index) const
86 {
88 }
89
90 MatVarIndex variableIndex(Int32 index) const
91 {
92 return m_shared_info->_varIndex(localId(index));
93 }
94
96 {
97 return { m_shared_info, m_constituent_item_index_list };
98 }
99
100 private:
101
102 SmallSpan<ConstituentItemIndex> _mutableItemIndexList() { return m_constituent_item_index_list.smallSpan(); }
103
106
107 ComponentItemSharedInfo* m_shared_info = nullptr;
108};
109
110/*---------------------------------------------------------------------------*/
111/*---------------------------------------------------------------------------*/
112
113} // namespace Arcane::Materials
114
115/*---------------------------------------------------------------------------*/
116/*---------------------------------------------------------------------------*/
117
118#endif
Constant view of an array of type T.
constexpr Integer size() const noexcept
Number of elements in the array.
Index of a constituent entity in the list of constituent entities.
View of a ConstituentItemLocalIdList instance.
UniqueArray< ConstituentItemIndex > m_constituent_item_index_list
List of ConstituentItemIndex for this constituent.
Represents an index on material and environment variables.
General information about a constituent entity.
View of an array of elements of type T.
Definition Span.h:805
1D data vector with value semantics (STL style).
Always enables tracing in Arcane parts concerning materials.
std::int32_t Int32
Signed integer type of 32 bits.