@@ -57,7 +57,9 @@ class ARCANE_CORE_EXPORT ComponentItemInternalLocalId
57
57
return a.m_id != b.m_id ;
58
58
}
59
59
ARCANE_CORE_EXPORT friend std::ostream&
60
- operator <<(std::ostream& o,const ComponentItemInternalLocalId& id);
60
+ operator <<(std::ostream& o, const ComponentItemInternalLocalId& id);
61
+
62
+ ARCCORE_HOST_DEVICE constexpr bool isNull () const { return m_id == (-1 ); }
61
63
62
64
private:
63
65
@@ -96,6 +98,8 @@ class ARCANE_CORE_EXPORT ComponentItemSharedInfoStorageView
96
98
Int32* m_global_item_local_id_data = nullptr ;
97
99
// ! Id de l'entité sous-constituant parente
98
100
ComponentItemInternalLocalId* m_super_component_item_local_id_data = nullptr ;
101
+ // ! MatVarIndex de l'entité
102
+ MatVarIndex* m_var_index_data = nullptr ;
99
103
};
100
104
101
105
/* ---------------------------------------------------------------------------*/
@@ -120,6 +124,8 @@ class ARCANE_CORE_EXPORT ComponentItemSharedInfo
120
124
friend class ConstituentItemLocalIdListView ;
121
125
friend class matimpl ::ConstituentItemBase;
122
126
127
+ static const int MAT_INDEX_OFFSET = 10 ;
128
+
123
129
private:
124
130
125
131
// ! Pour l'entité nulle
@@ -184,11 +190,31 @@ class ARCANE_CORE_EXPORT ComponentItemSharedInfo
184
190
m_super_component_item_local_id_data[id.localId ()] = super_id;
185
191
}
186
192
193
+ ARCCORE_HOST_DEVICE MatVarIndex _varIndex (ComponentItemInternalLocalId id)
194
+ {
195
+ ARCCORE_CHECK_RANGE (id.localId (), -1 , m_storage_size);
196
+ return m_var_index_data[id.localId ()];
197
+ }
198
+ ARCCORE_HOST_DEVICE void _setVarIndex (ComponentItemInternalLocalId id, MatVarIndex mv_index)
199
+ {
200
+ ARCCORE_CHECK_RANGE (id.localId (), -1 , m_storage_size);
201
+ m_var_index_data[id.localId ()] = mv_index;
202
+ }
203
+
204
+ // ! Numéro unique de l'entité component
205
+ Int64 _componentUniqueId (ComponentItemInternalLocalId id) const
206
+ {
207
+ // TODO: Vérifier que arrayIndex() ne dépasse pas (1<<MAT_INDEX_OFFSET)
208
+ impl::ItemBase item_base (_globalItemBase (id));
209
+ return (Int64)m_var_index_data[id.localId ()].arrayIndex () + ((Int64)item_base.uniqueId () << MAT_INDEX_OFFSET);
210
+ }
211
+
187
212
inline void _reset (ComponentItemInternalLocalId id)
188
213
{
189
214
Int32 local_id = id.localId ();
190
215
ARCCORE_CHECK_RANGE (local_id, -1 , m_storage_size);
191
216
217
+ m_var_index_data[local_id].reset ();
192
218
m_first_sub_constituent_item_id_data[local_id] = {};
193
219
m_nb_sub_constituent_item_data[local_id] = 0 ;
194
220
m_component_id_data[local_id] = -1 ;
@@ -248,7 +274,7 @@ class ARCANE_CORE_EXPORT ConstituentItemBase
248
274
public:
249
275
250
276
// ! Indexeur dans les variables matériaux
251
- inline ARCCORE_HOST_DEVICE constexpr MatVarIndex variableIndex () const ;
277
+ inline ARCCORE_HOST_DEVICE MatVarIndex variableIndex () const ;
252
278
253
279
// ! Identifiant du composant
254
280
inline ARCCORE_HOST_DEVICE Int32 componentId () const ;
@@ -327,8 +353,8 @@ class ARCANE_CORE_EXPORT ConstituentItemBase
327
353
328
354
private:
329
355
330
- inline ComponentItemSharedInfo* _sharedInfo () const ;
331
- inline ComponentItemInternalLocalId _localId () const ;
356
+ inline ARCCORE_HOST_DEVICE ComponentItemSharedInfo* _sharedInfo () const ;
357
+ inline ARCCORE_HOST_DEVICE ComponentItemInternalLocalId _localId () const ;
332
358
};
333
359
334
360
/* ---------------------------------------------------------------------------*/
@@ -376,31 +402,26 @@ class ARCANE_CORE_EXPORT ComponentItemInternal
376
402
377
403
private:
378
404
379
- static const int MAT_INDEX_OFFSET = 10 ;
380
-
381
405
// ! Entité nulle
382
406
static ComponentItemInternal nullComponentItemInternal;
383
407
384
408
public:
385
409
386
- ComponentItemInternal ()
387
- {
388
- m_var_index.reset ();
389
- }
410
+ ComponentItemInternal () = default ;
390
411
391
412
public:
392
413
393
414
// ! Indexeur dans les variables matériaux
394
- ARCCORE_HOST_DEVICE constexpr MatVarIndex variableIndex () const
415
+ ARCCORE_HOST_DEVICE MatVarIndex variableIndex () const
395
416
{
396
- return m_var_index ;
417
+ return m_shared_info-> _varIndex (m_component_item_internal_local_id) ;
397
418
}
398
419
399
420
// ! Identifiant du composant
400
421
ARCCORE_HOST_DEVICE Int32 componentId () const { return m_shared_info->_componentId (m_component_item_internal_local_id); }
401
422
402
423
// ! Indique s'il s'agit de la maille nulle.
403
- ARCCORE_HOST_DEVICE constexpr bool null () const { return m_var_index. null (); }
424
+ ARCCORE_HOST_DEVICE constexpr bool null () const { return m_component_item_internal_local_id. isNull (); }
404
425
405
426
/* !
406
427
* \brief Composant associé.
@@ -427,17 +448,15 @@ class ARCANE_CORE_EXPORT ComponentItemInternal
427
448
// ! Numéro unique de l'entité component
428
449
Int64 componentUniqueId () const
429
450
{
430
- // TODO: Vérifier que arrayIndex() ne dépasse pas (1<<MAT_INDEX_OFFSET)
431
- impl::ItemBase item_base (globalItemBase ());
432
- return (Int64)m_var_index.arrayIndex () + ((Int64)item_base.uniqueId () << MAT_INDEX_OFFSET);
451
+ return m_shared_info->_componentUniqueId (m_component_item_internal_local_id);
433
452
}
434
453
435
454
protected:
436
455
437
456
// NOTE : Cette classe est partagée avec le wrapper C#
438
457
// Toute modification de la structure interne doit être reportée
439
458
// dans la structure C# correspondante
440
- MatVarIndex m_var_index;
459
+ // MatVarIndex m_var_index;
441
460
ComponentItemInternalLocalId m_component_item_internal_local_id;
442
461
ComponentItemSharedInfo* m_shared_info = nullptr ;
443
462
@@ -469,8 +488,6 @@ class ARCANE_CORE_EXPORT ComponentItemInternal
469
488
{
470
489
m_component_item_internal_local_id = id;
471
490
m_shared_info = shared_info;
472
-
473
- m_var_index.reset ();
474
491
m_shared_info->_reset (id);
475
492
}
476
493
};
@@ -541,10 +558,10 @@ _superItemBase() const
541
558
/* ---------------------------------------------------------------------------*/
542
559
/* ---------------------------------------------------------------------------*/
543
560
544
- inline ARCCORE_HOST_DEVICE constexpr MatVarIndex matimpl::ConstituentItemBase::
561
+ inline ARCCORE_HOST_DEVICE MatVarIndex matimpl::ConstituentItemBase::
545
562
variableIndex () const
546
563
{
547
- return m_component_item-> variableIndex ( );
564
+ return _sharedInfo ()-> _varIndex ( _localId () );
548
565
}
549
566
550
567
inline ARCCORE_HOST_DEVICE Int32 matimpl::ConstituentItemBase::
@@ -592,7 +609,7 @@ componentUniqueId() const
592
609
inline void matimpl::ConstituentItemBase::
593
610
_setVariableIndex (MatVarIndex index)
594
611
{
595
- m_component_item-> m_var_index = index;
612
+ _sharedInfo ()-> _setVarIndex ( _localId (), index) ;
596
613
}
597
614
598
615
inline matimpl::ConstituentItemBase matimpl::ConstituentItemBase::
0 commit comments