Skip to content

Commit 28cc1c4

Browse files
Merge pull request #501 from arcaneframework/dev/gg-continue-remove-some-usage-of-iteminternal
Continue removal of usage of 'ItemInternal'
2 parents e41710d + 8beff30 commit 28cc1c4

24 files changed

+381
-384
lines changed

arcane/ceapart/src/arcane/cartesianmesh/internal/CartesianMeshUniqueIdRenumbering.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ _applyFamilyRenumbering(IItemFamily* family, VariableItemInt64& items_new_uid)
159159
if (new_uid >= 0 && new_uid != current_uid) {
160160
if (m_is_verbose)
161161
info() << "Change ItemUID old=" << current_uid << " new=" << new_uid;
162-
item.internal()->setUniqueId(new_uid);
162+
item.mutableItemBase().setUniqueId(new_uid);
163163
}
164164
}
165165
family->notifyItemsUniqueIdChanged();

arcane/src/arcane/Item.h

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,12 @@ class ARCANE_CORE_EXPORT Item
169169
//! Construit une référence à l'entité \a internal
170170
//ARCANE_DEPRECATED_REASON("Remove this overload")
171171
Item(ItemInternal* ainternal)
172-
: m_shared_info(ainternal->m_shared_info)
173-
, m_local_id(ainternal->m_local_id) { ARCANE_ITEM_ADD_STAT(m_nb_created_from_internal); }
172+
{
173+
ARCANE_CHECK_PTR(ainternal);
174+
m_shared_info = ainternal->m_shared_info;
175+
m_local_id = ainternal->m_local_id;
176+
ARCANE_ITEM_ADD_STAT(m_nb_created_from_internal);
177+
}
174178

175179
// NOTE: Pour le constructeur suivant; il est indispensable d'utiliser
176180
// const& pour éviter une ambiguité avec le constructeur par recopie
@@ -257,13 +261,13 @@ class ARCANE_CORE_EXPORT Item
257261
//! Converti l'entité en le genre \a DoF.
258262
inline DoF toDoF() const;
259263

260-
//! Nombre de parents
264+
//! Nombre de parents pour les sous-maillages
261265
Int32 nbParent() const { return _nbParent(); }
262266

263-
//! i-ème parent
267+
//! i-ème parent pour les sous-maillages
264268
Item parent(Int32 i) const { return m_shared_info->_parentV2(m_local_id,i); }
265269

266-
//! premier parent
270+
//! premier parent pour les sous-maillages
267271
Item parent() const { return m_shared_info->_parentV2(m_local_id,0); }
268272

269273
public:
@@ -319,7 +323,8 @@ class ARCANE_CORE_EXPORT Item
319323
*
320324
* \warning La partie interne de l'entité ne doit être modifiée que
321325
* par ceux qui savent ce qu'ils font.
322-
* \deprecated Utiliser itemBase() ou mutableItemBase() à la place
326+
* \deprecated Utiliser itemBase() ou mutableItemBase() à la place pour
327+
* les cas l'instance retournée n'est pas conservée.
323328
*/
324329
ItemInternal* internal() const
325330
{
@@ -413,11 +418,11 @@ class ARCANE_CORE_EXPORT Item
413418
Integer _nbFace() const { return _connectivity()->_nbFaceV2(m_local_id); }
414419
//! Nombre de mailles connectées à l'entité (pour les noeuds, arêtes et faces)
415420
Integer _nbCell() const { return _connectivity()->_nbCellV2(m_local_id); }
416-
//! Nombre de parent
421+
//! Nombre de parent pour l'AMR
417422
Int32 _nbHParent() const { return _connectivity()->_nbHParentV2(m_local_id); }
418-
//! Nombre d' enfants
423+
//! Nombre d' enfants pour l'AMR
419424
Int32 _nbHChildren() const { return _connectivity()->_nbHChildrenV2(m_local_id); }
420-
//! Nombre de parent
425+
//! Nombre de parent pour les sous-maillages
421426
Integer _nbParent() const { return m_shared_info->nbParent(); }
422427
NodeLocalId _nodeId(Int32 index) const { return NodeLocalId(_connectivity()->_nodeLocalIdV2(m_local_id,index)); }
423428
EdgeLocalId _edgeId(Int32 index) const { return EdgeLocalId(_connectivity()->_edgeLocalIdV2(m_local_id,index)); }
@@ -1251,12 +1256,16 @@ class ARCANE_CORE_EXPORT Cell
12511256
//! un seul parent
12521257
Cell hParent() const { return Cell(_hParentBase(0)); }
12531258

1259+
//! Nombre de parent pour l'AMR
1260+
Int32 nbHParent() const { return _nbHParent(); }
1261+
1262+
//! Nombre d'enfants pour l'AMR
12541263
Int32 nbHChildren() const { return _nbHChildren(); }
12551264

1256-
//! i-ème enfant
1265+
//! i-ème enfant AMR
12571266
Cell hChild(Int32 i) const { return Cell(_hChildBase(i)); }
12581267

1259-
//! parent de niveau 0
1268+
//! parent de niveau 0 pour l'AMR
12601269
Cell topHParent() const { return Cell(_toItemBase().topHParentBase()); }
12611270

12621271
/*!

arcane/src/arcane/ItemCompatibility.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,12 @@ namespace mesh
3939
class FaceFamily;
4040
class OneMeshItemAdder;
4141
class ParallelAMRConsistency;
42+
class MeshRefinement;
43+
}
44+
namespace AnyItem
45+
{
46+
class Group;
4247
}
43-
4448
/*---------------------------------------------------------------------------*/
4549
/*---------------------------------------------------------------------------*/
4650
/*!
@@ -65,6 +69,8 @@ class ItemCompatibility
6569
friend mesh::FaceFamily;
6670
friend mesh::ParallelAMRConsistency;
6771
friend mesh::OneMeshItemAdder;
72+
friend mesh::MeshRefinement;
73+
friend AnyItem::Group;
6874

6975
private:
7076

arcane/src/arcane/ItemInternal.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,11 +494,11 @@ class ARCANE_CORE_EXPORT ItemBase
494494
Integer nbFace() const { return _connectivity()->_nbFaceV2(m_local_id); }
495495
//! Nombre de mailles connectées à l'entité (pour les noeuds, arêtes et faces)
496496
Integer nbCell() const { return _connectivity()->_nbCellV2(m_local_id); }
497-
//! Nombre de parent
497+
//! Nombre de parents pour l'AMR
498498
Int32 nbHParent() const { return _connectivity()->_nbHParentV2(m_local_id); }
499-
//! Nombre d' enfants
499+
//! Nombre d'enfants pour l'AMR
500500
Int32 nbHChildren() const { return _connectivity()->_nbHChildrenV2(m_local_id); }
501-
//! Nombre de parent
501+
//! Nombre de parent pour les sous-maillages
502502
Integer nbParent() const { return m_shared_info->nbParent(); }
503503

504504
public:

arcane/src/arcane/aleph/tests/AlephTestSchemeFaces.cc

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,12 @@ amrRefine(RealArray& values, const Real trigRefine)
150150
const Real T0 = m_cell_temperature[iCell];
151151
const Real T1 = values[m_cell_matrix_idx[iCell]];
152152
const Real ecart_relatif = ECART_RELATIF(T0, T1);
153-
ItemInternal* iItem = (*iCell).internal();
153+
Cell iItem = (*iCell);
154154

155155
if (ecart_relatif > trigRefine) {
156156
//debug()<< "[AlephTestModule::_amrRefine] HIT ecart_relatif="<<ecart_relatif<<", cell_"<<(*iCell).localId();
157157
cells_lid.add((*iCell).localId());
158-
iItem->setFlags(iItem->flags() | ItemInternal::II_Refine);
158+
iItem.mutableItemBase().addFlags(ItemInternal::II_Refine);
159159
}
160160
}
161161

@@ -260,10 +260,7 @@ amrCoarsen(RealArray& values, const Real trigCoarsen)
260260
parents_to_coarsen_lid.add((*iCell).localId());
261261

262262
// Et on la tag comme Active
263-
Integer f = (*iCell).internal()->flags();
264-
//f |= ItemInternal::II_CoarsenInactive; //!< L'entité est inactive et a des enfants tagués pour déraffinement
265-
f &= ~ItemInternal::II_Inactive;
266-
(*iCell).internal()->setFlags(f);
263+
(*iCell).mutableItemBase().removeFlags(ItemInternal::II_CoarsenInactive);
267264
ARCANE_ASSERT(((*iCell).isActive()), ("Parent not active!"));
268265

269266
// On set la nouvell valeure de la maille
@@ -272,7 +269,7 @@ amrCoarsen(RealArray& values, const Real trigCoarsen)
272269
// On rajoute les lids des enfants pour les remover par la suite
273270
for (Integer j = 0, js = CELL_NB_H_CHILDREN(cell); j < js; ++j) {
274271
children_to_coarsen_lid.add(CELL_H_CHILD(cell, j).localId());
275-
CELL_H_CHILD(cell, j).internal()->setFlags(CELL_H_CHILD(cell, j).internal()->flags() | ItemInternal::II_Inactive); //II_Coarsen
272+
CELL_H_CHILD(cell, j).mutableItemBase().setFlags(CELL_H_CHILD(cell, j).itemBase().flags() | ItemInternal::II_Inactive); //II_Coarsen
276273
}
277274

278275
// Now stare at the children to set up new faces' values
@@ -360,7 +357,7 @@ amrCoarsen(RealArray& values, const Real trigCoarsen)
360357
for (Integer j = 0, js = children_to_coarsen_lid.size(); j < js; ++j) {
361358
//const Cell &cell=cellFamily()->itemsInternal()[children_to_coarsen_lid[j]];
362359
//debug()<<"\t\t[FaceAmrCoarsen] REMOVING CELL_"<<children_to_coarsen_lid[j];
363-
dynMesh->trueCellFamily().removeCell(cells_view[children_to_coarsen_lid[j]].internal());
360+
dynMesh->trueCellFamily().removeCell(cells_view[children_to_coarsen_lid[j]]);
364361
//dynMesh->trueCellFamily().detachCell(cellFamily()->itemsInternal()[children_to_coarsen_lid[j]]);
365362
/* ENUMERATE_FACE(iFace, cell.faces()){
366363
dynMesh->trueFaceFamily().populateBackFrontCellsFromParentFaces(cell.internal());
@@ -372,15 +369,15 @@ amrCoarsen(RealArray& values, const Real trigCoarsen)
372369
// On ré-attache les faces
373370
for (Integer j = 0, js = faces_to_attach.size(); j < js; ++j) {
374371
Face face = faces_view[faces_to_attach[j]];
375-
if (face.internal()->flags() & ItemInternal::II_HasBackCell) {
372+
if (face.itemBase().flags() & ItemInternal::II_HasBackCell) {
376373
debug() << "\t\t[FaceAmrCoarsen] NOW patch face_" << faces_to_attach[j] << ": " << face.backCell().localId() << "->" << lids_to_be_attached[j];
377374
//dynMesh->trueFaceFamily().replaceFrontCellToFace(face.internal(),cellFamily()->itemsInternal()[lids_to_be_attached[j]]);
378-
dynMesh->trueFaceFamily().addFrontCellToFace(face.internal(), cells_view[lids_to_be_attached[j]]);
375+
dynMesh->trueFaceFamily().addFrontCellToFace(face, cells_view[lids_to_be_attached[j]]);
379376
}
380377
else {
381378
debug() << "\t\t[FaceAmrCoarsen] NOW patch face_" << faces_to_attach[j] << ": " << face.frontCell().localId() << "->" << lids_to_be_attached[j];
382379
//dynMesh->trueFaceFamily().replaceBackCellToFace(face.internal(),cellFamily()->itemsInternal()[lids_to_be_attached[j]]);
383-
dynMesh->trueFaceFamily().addBackCellToFace(face.internal(), cells_view[lids_to_be_attached[j]]);
380+
dynMesh->trueFaceFamily().addBackCellToFace(face, cells_view[lids_to_be_attached[j]]);
384381
}
385382
faceReorienter.checkAndChangeOrientation(face);
386383
}

arcane/src/arcane/anyitem/AnyItemGroup.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,12 @@ class PartialGroupBuilder
7575
* Construction dans les familles AnyItem
7676
*/
7777
class Group
78-
{
78+
{
79+
static ItemInternal* _toInternal(const Item& v)
80+
{
81+
return ItemCompatibility::_itemInternal(v);
82+
}
83+
7984
public:
8085

8186
/*!
@@ -102,8 +107,9 @@ class Group
102107

103108
//! Déréférencement vers l'item Arcane associé
104109
Item operator*() const { return m_items[ m_local_ids[m_index] ]; }
110+
// TODO: retourner un 'Item*' de manière similaire à ItemEnumerator.
105111
//! Déréférencement indirect vers l'item Arcane associé
106-
ItemInternal* operator->() const { return m_items[ m_local_ids[m_index] ].internal(); }
112+
ItemInternal* operator->() const { return Group::_toInternal(m_items[ m_local_ids[m_index] ]); }
107113
//! Avancement de l'énumérateur
108114
inline void operator++() { ++m_index; }
109115
//! Test de fin de l'énumérateur

arcane/src/arcane/impl/CheckpointMng.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ _changeItemsOwner(IMesh* mesh,Int32ConstArrayView old_ranks_to_new_ranks)
529529
ENUMERATE_ITEM(iitem,all_items){
530530
Item item = *iitem;
531531
Int32 owner = item.owner();
532-
item.internal()->setOwner(old_ranks_to_new_ranks[owner],mesh_rank);
532+
item.mutableItemBase().setOwner(old_ranks_to_new_ranks[owner],mesh_rank);
533533
}
534534
family->notifyItemsOwnerChanged();
535535
}

arcane/src/arcane/impl/VariableSynchronizer.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ compute()
143143
Integer nb_error = 0;
144144
Int64UniqueArray bad_items_uid;
145145
ENUMERATE_ITEM(i,m_item_group){
146-
const Item& item = *i;
147-
ItemInternal* item_internal = item.internal();
148-
Integer owner = item_internal->owner();
146+
Item item = *i;
147+
impl::ItemBase item_internal = item.itemBase();
148+
Int32 owner = item_internal.owner();
149149
if (owner==my_rank)
150150
continue;
151-
Int64 uid = item_internal->uniqueId().asInt64();
151+
Int64 uid = item_internal.uniqueId().asInt64();
152152
if (owner==A_NULL_RANK || owner>=nb_rank){
153153
++nb_error;
154154
if (nb_error<10)
@@ -157,9 +157,9 @@ compute()
157157
}
158158
if (global_debug_sync){
159159
info() << "Add entity uid=" << uid
160-
<< " lid=" << item_internal->localId() << " to the subdomain " << owner;
160+
<< " lid=" << item_internal.localId() << " to the subdomain " << owner;
161161
}
162-
boundary_items[owner].add(item_internal->localId());
162+
boundary_items[owner].add(item_internal.localId());
163163
}
164164
if (nb_error!=0){
165165
for( Integer i=0, is=bad_items_uid.size(); i<is; ++i ){

arcane/src/arcane/materials/AllEnvData.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ forceRecompute(bool compute_all)
279279
Int32 lid = icell.itemLocalId();
280280
Int32 nb_env = m_nb_env_per_cell[icell];
281281
ComponentItemInternal& ref_ii = m_all_env_items_internal[lid];
282-
ref_ii.setSuperAndGlobalItem(0,c.internal());
282+
ref_ii.setSuperAndGlobalItem(0,c);
283283
ref_ii.setVariableIndex(MatVarIndex(0,lid));
284284
ref_ii.setNbSubItem(nb_env);
285285
ref_ii.setLevel(LEVEL_ALLENVIRONMENT);

arcane/src/arcane/materials/MeshMaterialMng.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ checkValid()
631631
if (all_env_cell.level()!=LEVEL_ALLENVIRONMENT)
632632
ARCANE_FATAL("Bad level for all_env_item");
633633

634-
if (all_env_cell.globalCell().internal()!=cell.internal())
634+
if (all_env_cell.globalCell()!=cell)
635635
ARCANE_FATAL("Bad corresponding globalCell() in all_env_item");
636636
if (cell_nb_env!=nb_env_per_cell[cell])
637637
ARCANE_FATAL("Bad value for nb_env direct='{0}' var='{1}'",
@@ -643,7 +643,7 @@ checkValid()
643643
ComponentItemInternal* eii = ec.internal();
644644
if (all_env_cell.internal()!=eii->superItem())
645645
ARCANE_FATAL("Bad corresponding allEnvItem() in env_item uid={0}",cell_uid);
646-
if (eii->globalItem()!=cell.internal())
646+
if (eii->globalItem2()!=cell)
647647
ARCANE_FATAL("Bad corresponding globalItem() in env_item");
648648
if (eii->level()!=LEVEL_ENVIRONMENT)
649649
ARCANE_FATAL("Bad level '{0}' for in env_item",eii->level());
@@ -657,7 +657,7 @@ checkValid()
657657
ComponentItemInternal* mci = mc.internal();
658658
if (eii!=mci->superItem())
659659
ARCANE_FATAL("Bad corresponding env_item in mat_item");
660-
if (mci->globalItem()!=cell.internal())
660+
if (mci->globalItem2()!=cell)
661661
ARCANE_FATAL("Bad corresponding globalItem() in mat_item");
662662
if (mci->level()!=LEVEL_MATERIAL)
663663
ARCANE_FATAL("Bad level '{0}' for in mat_item",mci->level());

0 commit comments

Comments
 (0)