Skip to content

Commit 8a022e4

Browse files
[arcane,materials] Utilise 'ComponentItemInternalLocalId' pour conserver l'instance sur l'entité parente.
1 parent d919286 commit 8a022e4

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

arcane/src/arcane/core/materials/ComponentItemInternal.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ class ARCANE_CORE_EXPORT ComponentItemSharedInfo
6262

6363
private:
6464

65+
// NOTE : Cette classe est partagée avec le wrapper C#
66+
// Toute modification de la structure interne doit être reportée
67+
// dans la structure C# correspondante
6568
ItemSharedInfo* m_item_shared_info = ItemSharedInfo::nullInstance();
6669
Int16 m_level = (-1);
6770
ConstArrayView<IMeshComponent*> m_components;
@@ -207,7 +210,7 @@ class ARCANE_CORE_EXPORT ComponentItemInternal
207210
Int16 m_nb_sub_component_item = 0;
208211
Int32 m_global_item_local_id = NULL_ITEM_LOCAL_ID;
209212
ComponentItemInternalLocalId m_component_item_internal_local_id;
210-
ComponentItemInternal* m_super_component_item = nullptr;
213+
ComponentItemInternalLocalId m_super_component_item_local_id;
211214
ComponentItemInternal* m_first_sub_component_item = nullptr;
212215
ComponentItemSharedInfo* m_shared_info = nullptr;
213216

@@ -237,12 +240,13 @@ class ARCANE_CORE_EXPORT ComponentItemInternal
237240
//! Composant supérieur (0 si aucun)
238241
matimpl::ConstituentItemBase _superItemBase() const
239242
{
240-
return m_super_component_item;
243+
return &m_shared_info->m_component_item_internal_view[m_super_component_item_local_id.localId()];
241244
}
242245

243246
void _setSuperAndGlobalItem(ComponentItemInternal* cii, ItemLocalId ii)
244247
{
245-
m_super_component_item = cii;
248+
if (cii)
249+
m_super_component_item_local_id = cii->_internalLocalId();
246250
m_global_item_local_id = ii.localId();
247251
}
248252

@@ -280,11 +284,16 @@ class ARCANE_CORE_EXPORT ComponentItemInternal
280284
m_component_id = static_cast<Int16>(component_id);
281285
}
282286

287+
ComponentItemInternalLocalId _internalLocalId() const
288+
{
289+
return m_component_item_internal_local_id;
290+
}
291+
283292
void _reset(ComponentItemInternalLocalId id, ComponentItemSharedInfo* shared_info)
284293
{
285294
m_var_index.reset();
286295
m_component_id = -1;
287-
m_super_component_item = nullptr;
296+
m_super_component_item_local_id = {};
288297
m_component_item_internal_local_id = id;
289298
m_nb_sub_component_item = 0;
290299
m_first_sub_component_item = nullptr;

arcane/tools/wrapper/materials/csharp/ComponentItemInternal.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ public unsafe struct ComponentItemSharedInfo
88
{
99
internal ItemSharedInfo* m_item_shared_info;
1010
internal Int16 m_level;
11+
internal MeshEnvironmentListView m_components;
12+
internal ComponentItemSharedInfo* m_parent_component_item_shared_info;
13+
internal ComponentItemInternalConstArrayView m_component_item_internal_view;
1114
}
1215

1316
[StructLayout(LayoutKind.Sequential)]
@@ -18,10 +21,17 @@ public unsafe struct ComponentItemInternal
1821
internal Int16 m_nb_sub_component_item;
1922
internal Int32 m_global_item_local_id;
2023
internal Int32 m_component_item_internal_local_id;
21-
internal ComponentItemInternal* m_super_component_item;
24+
internal Int32 m_super_component_item_local_id;
2225
internal ComponentItemInternal* m_first_sub_component_item;
2326
internal ComponentItemSharedInfo* m_shared_info;
2427
}
28+
29+
[StructLayout(LayoutKind.Sequential)]
30+
public unsafe struct ComponentItemInternalConstArrayView
31+
{
32+
internal Int32 m_size;
33+
internal Arcane.Materials.ComponentItemInternal* m_ptr;
34+
}
2535
}
2636

2737
namespace Arcane

0 commit comments

Comments
 (0)