@@ -71,11 +71,27 @@ class ARCANE_CORE_EXPORT ComponentItemInternalLocalId
71
71
*/
72
72
class ARCANE_CORE_EXPORT ComponentItemSharedInfoStorageView
73
73
{
74
- protected:
74
+ // Les champs de cette classe sont des tableaux dont la taille est
75
+ // \a m_storage_size et qui peuvent être indexés par une entité nulle
76
+ // (ComponentItemInternalLocalId==(-1)).
77
+ // Le conteneur est géré par ComponenItemInternalData.
78
+ // Seuls ComponentItemSharedInfo et ComponenItemInternalData
79
+ // doivent accéder aux champs de cette classe
75
80
76
- Int32 m_storage_size = 0 ;
77
81
// TODO: Utiliser stockage avec un seul élément pour le nullComponent
78
- ComponentItemInternalLocalId* m_first_sub_constituent_list_ptr = nullptr ;
82
+
83
+ friend class ComponentItemInternalData ;
84
+ friend class ComponentItemSharedInfo ;
85
+
86
+ private:
87
+
88
+ Int32 m_storage_size = 0 ;
89
+ // ! Id de la première entité sous-constituant
90
+ ComponentItemInternalLocalId* m_first_sub_constituent_item_id_data = nullptr ;
91
+ // ! Index du constituant (IMeshComponent)
92
+ Int16* m_component_id_data = nullptr ;
93
+ // ! Nombre d'entités sous-constituant
94
+ Int16* m_nb_sub_constituent_item_data = nullptr ;
79
95
};
80
96
81
97
/* ---------------------------------------------------------------------------*/
@@ -91,7 +107,7 @@ class ARCANE_CORE_EXPORT ComponentItemSharedInfoStorageView
91
107
* d'un MeshMaterialMng.
92
108
*/
93
109
class ARCANE_CORE_EXPORT ComponentItemSharedInfo
94
- : ComponentItemSharedInfoStorageView
110
+ : private ComponentItemSharedInfoStorageView
95
111
{
96
112
friend class ComponentItemInternal ;
97
113
friend class ComponentItemInternalData ;
@@ -111,22 +127,52 @@ class ARCANE_CORE_EXPORT ComponentItemSharedInfo
111
127
112
128
inline constexpr ComponentItemInternal* _itemInternal (ComponentItemInternalLocalId id);
113
129
inline constexpr matimpl::ConstituentItemBase _item (ComponentItemInternalLocalId id);
114
- inline ARCCORE_HOST_DEVICE ComponentItemInternalLocalId _firstSubConstituentLocalId (ComponentItemInternalLocalId id)
130
+ inline ARCCORE_HOST_DEVICE ComponentItemInternalLocalId _firstSubConstituentLocalId (ComponentItemInternalLocalId id) const
131
+ {
132
+ ARCCORE_CHECK_RANGE (id.localId (), -1 , m_storage_size);
133
+ return m_first_sub_constituent_item_id_data[id.localId ()];
134
+ }
135
+ inline ARCCORE_HOST_DEVICE Int16 _nbSubConstituent (ComponentItemInternalLocalId id) const
115
136
{
116
137
ARCCORE_CHECK_RANGE (id.localId (), -1 , m_storage_size);
117
- return m_first_sub_constituent_list_ptr [id.localId ()];
138
+ return m_nb_sub_constituent_item_data [id.localId ()];
118
139
}
140
+ inline void _setNbSubConstituent (ComponentItemInternalLocalId id, Int16 n)
141
+ {
142
+ ARCCORE_CHECK_RANGE (id.localId (), -1 , m_storage_size);
143
+ m_nb_sub_constituent_item_data[id.localId ()] = n;
144
+ }
145
+ inline ARCCORE_HOST_DEVICE Int16 _componentId (ComponentItemInternalLocalId id) const
146
+ {
147
+ ARCCORE_CHECK_RANGE (id.localId (), -1 , m_storage_size);
148
+ return m_component_id_data[id.localId ()];
149
+ }
150
+ inline void _setComponentId (ComponentItemInternalLocalId id, Int16 component_id)
151
+ {
152
+ ARCCORE_CHECK_RANGE (id.localId (), -1 , m_storage_size);
153
+ m_component_id_data[id.localId ()] = component_id;
154
+ }
155
+
119
156
inline ARCCORE_HOST_DEVICE void
120
157
_setFirstSubConstituentLocalId (ComponentItemInternalLocalId id, ComponentItemInternalLocalId first_id)
121
158
{
122
159
ARCCORE_CHECK_RANGE (id.localId (), -1 , m_storage_size);
123
- m_first_sub_constituent_list_ptr[id.localId ()] = first_id;
160
+ m_first_sub_constituent_item_id_data[id.localId ()] = first_id;
161
+ }
162
+
163
+ IMeshComponent* _component (ComponentItemInternalLocalId id) const
164
+ {
165
+ return m_components[_componentId (id)];
124
166
}
167
+
125
168
inline void _reset (ComponentItemInternalLocalId id)
126
169
{
127
170
Int32 local_id = id.localId ();
128
171
ARCCORE_CHECK_RANGE (local_id, -1 , m_storage_size);
129
- m_first_sub_constituent_list_ptr[local_id] = {};
172
+
173
+ m_first_sub_constituent_item_id_data[local_id] = {};
174
+ m_nb_sub_constituent_item_data[local_id] = 0 ;
175
+ m_component_id_data[local_id] = -1 ;
130
176
}
131
177
132
178
private:
@@ -184,7 +230,7 @@ class ARCANE_CORE_EXPORT ConstituentItemBase
184
230
inline ARCCORE_HOST_DEVICE constexpr MatVarIndex variableIndex () const ;
185
231
186
232
// ! Identifiant du composant
187
- inline ARCCORE_HOST_DEVICE constexpr Int32 componentId () const ;
233
+ inline ARCCORE_HOST_DEVICE Int32 componentId () const ;
188
234
189
235
// ! Indique s'il s'agit de la maille nulle.
190
236
inline ARCCORE_HOST_DEVICE constexpr bool null () const ;
@@ -198,7 +244,7 @@ class ARCANE_CORE_EXPORT ConstituentItemBase
198
244
inline IMeshComponent* component () const ;
199
245
200
246
// ! Nombre de sous-composants.
201
- inline ARCCORE_HOST_DEVICE constexpr Int32 nbSubItem () const ;
247
+ inline ARCCORE_HOST_DEVICE Int32 nbSubItem () const ;
202
248
203
249
// ! Entité globale correspondante.
204
250
inline impl::ItemBase globalItemBase () const ;
@@ -239,12 +285,12 @@ class ARCANE_CORE_EXPORT ConstituentItemBase
239
285
inline ARCCORE_HOST_DEVICE matimpl::ConstituentItemBase _subItemBase (Int32 i) const ;
240
286
241
287
// ! Positionne le nombre de sous-composants.
242
- inline void _setNbSubItem (Int32 nb_sub_item);
288
+ inline void _setNbSubItem (Int16 nb_sub_item);
243
289
244
290
// ! Positionne le premier sous-composant.
245
291
inline void _setFirstSubItem (ComponentItemInternalLocalId first_sub_item);
246
292
247
- inline void _setComponent (Int32 component_id);
293
+ inline void _setComponent (Int16 component_id);
248
294
249
295
inline ARCCORE_HOST_DEVICE ComponentItemInternalLocalId _internalLocalId () const ;
250
296
@@ -260,12 +306,8 @@ class ARCANE_CORE_EXPORT ConstituentItemBase
260
306
261
307
private:
262
308
263
- void _checkIsInt16 (Int32 v)
264
- {
265
- if (v < (-32768 ) || v > 32767 )
266
- _throwBadCast (v);
267
- }
268
- void _throwBadCast (Int32 v);
309
+ inline ComponentItemSharedInfo* _sharedInfo () const ;
310
+ inline ComponentItemInternalLocalId _localId () const ;
269
311
};
270
312
271
313
/* ---------------------------------------------------------------------------*/
@@ -334,7 +376,7 @@ class ARCANE_CORE_EXPORT ComponentItemInternal
334
376
}
335
377
336
378
// ! Identifiant du composant
337
- ARCCORE_HOST_DEVICE constexpr Int32 componentId () const { return m_component_id ; }
379
+ ARCCORE_HOST_DEVICE Int32 componentId () const { return m_shared_info-> _componentId (m_component_item_internal_local_id) ; }
338
380
339
381
// ! Indique s'il s'agit de la maille nulle.
340
382
ARCCORE_HOST_DEVICE constexpr bool null () const { return m_var_index.null (); }
@@ -345,12 +387,12 @@ class ARCANE_CORE_EXPORT ComponentItemInternal
345
387
* Cet appel n'est valide que pour les mailles matériaux ou milieux. Si on souhaite
346
388
* un appel valide pour toutes les 'ComponentItem', il faut utiliser componentId().
347
389
*/
348
- IMeshComponent* component () const { return m_shared_info->m_components [m_component_id] ; }
390
+ IMeshComponent* component () const { return m_shared_info->_component (m_component_item_internal_local_id) ; }
349
391
350
392
// ! Nombre de sous-composants.
351
- ARCCORE_HOST_DEVICE constexpr Int32 nbSubItem () const
393
+ ARCCORE_HOST_DEVICE Int32 nbSubItem () const
352
394
{
353
- return m_nb_sub_component_item ;
395
+ return m_shared_info-> _nbSubConstituent (m_component_item_internal_local_id) ;
354
396
}
355
397
356
398
// ! Entité globale correspondante.
@@ -375,22 +417,11 @@ class ARCANE_CORE_EXPORT ComponentItemInternal
375
417
// Toute modification de la structure interne doit être reportée
376
418
// dans la structure C# correspondante
377
419
MatVarIndex m_var_index;
378
- Int16 m_component_id = -1 ;
379
- Int16 m_nb_sub_component_item = 0 ;
380
420
Int32 m_global_item_local_id = NULL_ITEM_LOCAL_ID;
381
421
ComponentItemInternalLocalId m_component_item_internal_local_id;
382
422
ComponentItemInternalLocalId m_super_component_item_local_id;
383
423
ComponentItemSharedInfo* m_shared_info = nullptr ;
384
424
385
- private:
386
-
387
- void _checkIsInt16 (Int32 v)
388
- {
389
- if (v < (-32768 ) || v > 32767 )
390
- _throwBadCast (v);
391
- }
392
- void _throwBadCast (Int32 v);
393
-
394
425
private:
395
426
396
427
// ! Entité nulle
@@ -418,10 +449,8 @@ class ARCANE_CORE_EXPORT ComponentItemInternal
418
449
void _reset (ComponentItemInternalLocalId id, ComponentItemSharedInfo* shared_info)
419
450
{
420
451
m_var_index.reset ();
421
- m_component_id = -1 ;
422
452
m_super_component_item_local_id = {};
423
453
m_component_item_internal_local_id = id;
424
- m_nb_sub_component_item = 0 ;
425
454
m_global_item_local_id = NULL_ITEM_LOCAL_ID;
426
455
m_shared_info = shared_info;
427
456
m_shared_info->_reset (id);
@@ -452,6 +481,18 @@ ConstituentItemBase(ComponentItemSharedInfo* shared_info, ComponentItemInternalL
452
481
{
453
482
}
454
483
484
+ inline ComponentItemSharedInfo* matimpl::ConstituentItemBase::
485
+ _sharedInfo () const
486
+ {
487
+ return m_component_item->m_shared_info ;
488
+ }
489
+
490
+ inline ComponentItemInternalLocalId matimpl::ConstituentItemBase::
491
+ _localId () const
492
+ {
493
+ return m_component_item->m_component_item_internal_local_id ;
494
+ }
495
+
455
496
/* ---------------------------------------------------------------------------*/
456
497
/* ---------------------------------------------------------------------------*/
457
498
@@ -478,7 +519,7 @@ variableIndex() const
478
519
return m_component_item->variableIndex ();
479
520
}
480
521
481
- inline ARCCORE_HOST_DEVICE constexpr Int32 matimpl::ConstituentItemBase::
522
+ inline ARCCORE_HOST_DEVICE Int32 matimpl::ConstituentItemBase::
482
523
componentId () const
483
524
{
484
525
return m_component_item->componentId ();
@@ -496,7 +537,7 @@ component() const
496
537
return m_component_item->component ();
497
538
}
498
539
499
- inline ARCCORE_HOST_DEVICE constexpr Int32 matimpl::ConstituentItemBase::
540
+ inline ARCCORE_HOST_DEVICE Int32 matimpl::ConstituentItemBase::
500
541
nbSubItem () const
501
542
{
502
543
return m_component_item->nbSubItem ();
@@ -560,28 +601,22 @@ _subItemBase(Int32 i) const
560
601
561
602
// ! Positionne le nombre de sous-composants.
562
603
inline void matimpl::ConstituentItemBase::
563
- _setNbSubItem (Int32 nb_sub_item)
604
+ _setNbSubItem (Int16 nb_sub_item)
564
605
{
565
- #ifdef ARCANE_CHECK
566
- _checkIsInt16 (nb_sub_item);
567
- #endif
568
- m_component_item->m_nb_sub_component_item = static_cast <Int16>(nb_sub_item);
606
+ _sharedInfo ()->_setNbSubConstituent (_localId (), nb_sub_item);
569
607
}
570
608
571
609
// ! Positionne le premier sous-composant.
572
610
inline void matimpl::ConstituentItemBase::
573
611
_setFirstSubItem (ComponentItemInternalLocalId first_sub_item)
574
612
{
575
- m_component_item-> m_shared_info -> _setFirstSubConstituentLocalId (m_component_item-> m_component_item_internal_local_id , first_sub_item);
613
+ _sharedInfo ()-> _setFirstSubConstituentLocalId (_localId () , first_sub_item);
576
614
}
577
615
578
616
inline void matimpl::ConstituentItemBase::
579
- _setComponent (Int32 component_id)
617
+ _setComponent (Int16 component_id)
580
618
{
581
- #ifdef ARCANE_CHECK
582
- _checkIsInt16 (component_id);
583
- #endif
584
- m_component_item->m_component_id = static_cast <Int16>(component_id);
619
+ _sharedInfo ()->_setComponentId (_localId (), component_id);
585
620
}
586
621
587
622
inline ARCCORE_HOST_DEVICE ComponentItemInternalLocalId matimpl::ConstituentItemBase::
0 commit comments