106 : m_face_family(
nullptr)
107 , m_cell_family(
nullptr) {
109 throw FatalErrorException(
"FaceToCellIncrementalConnectivity must be created with face family as source and cell family as target. Exiting.");
129 Integer face_index = -1;
144 if (face_index == -1)
throw FatalErrorException(String::format(
"Face {0} does not belong to Cell {1}. Cannot connect. Exiting."));
146 return (face_index == 1);
161 ARCANE_UNUSED(source);
162 ARCANE_UNUSED(target);
197 _addFrontCellToFace(m_face_family->itemsInternal()[
source_item.localId()],m_cell_family->itemsInternal()[
target_item.localId()]);
199 _addBackCellToFace(m_face_family->itemsInternal()[
source_item.localId()],m_cell_family->itemsInternal()[
target_item.localId()]);
214 _checkValidSourceTargetItems(face,cell);
226 if (face->
flags() & ItemFlags::II_HasFrontCell){
229 " This is most probably due to the fact that the face"
230 " is connected to a reverse cell with a negative volume."
231 " Face={0}. new_cell={1} current_cell={2}",face->
uniqueId().asInt64(),
240 Int32 iback_cell_lid = (nb_cell==1) ? face->cellId(0) : NULL_ITEM_LOCAL_ID;
241 ItemLocalId back_cell_lid(iback_cell_lid);
242 ItemLocalId front_cell_lid(cell->
localId());
243 _setBackAndFrontCells(face,back_cell_lid,front_cell_lid);
248 void _addBackCellToFace(ItemInternal* face, ItemInternal* cell){
249 _checkValidSourceTargetItems(face,cell);
251 Integer nb_cell = nbConnectedItem(ItemLocalId(face));
259 const bool check_orientation =
false;
260 if (check_orientation){
261 if (face->flags() & ItemFlags::II_HasBackCell){
262 ItemInternal* current_cell = m_cell_family->itemsInternal()[connectedItemLocalId(ItemLocalId(face),0)];
264 " This is most probably due to the fact that the face"
265 " is connected to a reverse cell with a negative volume."
266 " Face={0}. new_cell={1} current_cell={2}",face->uniqueId().asInt64(),
267 cell->uniqueId().asInt64(),current_cell->uniqueId().asInt64());
272 ARCANE_FATAL(
"face '{0}' already has two cells",face->uniqueId().asInt64());
274 Int32 ifront_cell_lid = (nb_cell==1) ? face->cellId(0) : NULL_ITEM_LOCAL_ID;
276 ItemLocalId back_cell_lid(cell->localId());
277 ItemLocalId front_cell_lid(ifront_cell_lid);
278 _setBackAndFrontCells(face,back_cell_lid,front_cell_lid);
284 void _setBackAndFrontCells(ItemInternal* face,ItemLocalId back_cell_lid,ItemLocalId front_cell_lid){
285 ItemLocalId face_lid(face->localId());
289 removeConnectedItems(face_lid);
291 if (front_cell_lid==NULL_ITEM_LOCAL_ID){
292 if (back_cell_lid!=NULL_ITEM_LOCAL_ID){
294 IncrementalItemConnectivity::addConnectedItem(face_lid,back_cell_lid);
296 mod_flags = (ItemFlags::II_Boundary | ItemFlags::II_HasBackCell | ItemFlags::II_BackCellIsFirst);
301 else if (back_cell_lid==NULL_ITEM_LOCAL_ID){
303 IncrementalItemConnectivity::addConnectedItem(face_lid,front_cell_lid);
305 mod_flags = (ItemFlags::II_Boundary | ItemFlags::II_HasFrontCell | ItemFlags::II_FrontCellIsFirst);
309 IncrementalItemConnectivity::addConnectedItem(face_lid,back_cell_lid);
310 IncrementalItemConnectivity::addConnectedItem(face_lid,front_cell_lid);
312 mod_flags = (ItemFlags::II_HasFrontCell | ItemFlags::II_HasBackCell | ItemFlags::II_BackCellIsFirst);
314 Int32 face_flags = face->flags();
315 face_flags &= ~ItemFlags::II_InterfaceFlags;
316 face_flags |= mod_flags;
317 face->setFlags(face_flags);
325 _checkValidSourceTargetItems(face,m_cell_family->itemsInternal()[
cell_to_remove_lid]);
333 ARCANE_FATAL(
"Can not remove cell lid={0} from face uid={1} with no cell connected",
344 Int32
cell0 = face->cellId(0);
345 Int32
cell1 = face->cellId(1);