Skip to content

Commit

Permalink
Merge pull request #1782 from arcaneframework/dev/gg-fix-potential-er…
Browse files Browse the repository at this point in the history
…ror-in-when-adding-child-cell

Fix bug in 'CellFamily::_addChildCellToCell()' when added child cell is not the last
  • Loading branch information
grospelliergilles authored Nov 25, 2024
2 parents 6503289 + f6c0a82 commit 05e8c92
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions arcane/src/arcane/mesh/CellFamily.cc
Original file line number Diff line number Diff line change
Expand Up @@ -491,15 +491,18 @@ _addChildCellToCell2(Cell iparent_cell,Cell child_cell)
/*---------------------------------------------------------------------------*/

void CellFamily::
_addChildCellToCell(Cell iparent_cell,Integer rank,Cell child_cell)
_addChildCellToCell(Cell iparent_cell,Integer position,Cell child_cell)
{
Cell parent_cell(iparent_cell);
// NOTE GG: Cette méthode ne semble fonctionner que si \a rank
// correspond parent_cell->nbHChildren().
// NOTE GG: L'ancienne méthode ci-dessous en commentaire ne semble
// fonctionner que si \a position correspond parent_cell->nbHChildren().
// Et dans ce cas il n'est pas nécessaire de faire 2 appels.
m_hchild_connectivity->addConnectedItem(parent_cell,ItemLocalId(NULL_ITEM_LOCAL_ID));
// m_hchild_connectivity->addConnectedItem(parent_cell,ItemLocalId(NULL_ITEM_LOCAL_ID));
Int32 nb_connected = m_hchild_connectivity->trueCustomConnectivity()->nbConnectedItem(parent_cell);
for( Int32 i=nb_connected; i<(position+1); ++i )
m_hchild_connectivity->addConnectedItem(parent_cell,ItemLocalId(NULL_ITEM_LOCAL_ID));
auto x = _topologyModifier();
x->replaceHChild(ItemLocalId(iparent_cell),rank,child_cell);
x->replaceHChild(ItemLocalId(iparent_cell),position,child_cell);
parent_cell.mutableItemBase().addFlags(ItemFlags::II_Inactive);
}

Expand Down

0 comments on commit 05e8c92

Please sign in to comment.