@@ -3404,6 +3404,25 @@ void Cell::remove_self_from_all_neighbors( void )
34043404 else
34053405 { /* future error message */ }
34063406 }
3407+
3408+ // This is a bit of a ugly hack, we need to find the origin of that bug
3409+ #pragma omp parallel for
3410+ for ( int i = 0 ; i < all_cells->size (); i++ )
3411+ {
3412+ Cell* pC = (*all_cells)[i];
3413+ if (pC != this )
3414+ {
3415+ auto SearchResult = std::find (
3416+ pC->state .neighbors .begin (),pC->state .neighbors .end (),this );
3417+ if ( SearchResult != pC->state .neighbors .end () )
3418+ {
3419+ std::cout << " Cell " << pC->ID << " still has cell " << this ->ID << " as a neighbor!" << std::endl;
3420+ pC->state .neighbors .erase ( SearchResult );
3421+ }
3422+
3423+ }
3424+ }
3425+
34073426
34083427 return ;
34093428}
@@ -3433,6 +3452,25 @@ void Cell::remove_all_spring_attachments( void )
34333452 // clear my list
34343453 state.spring_attachments .clear ();
34353454 }
3455+
3456+ // This is a bit of a ugly hack, we need to find the origin of that bug
3457+ #pragma omp parallel for
3458+ for ( int i = 0 ; i < all_cells->size (); i++ )
3459+ {
3460+ Cell* pC = (*all_cells)[i];
3461+ if (pC != this )
3462+ {
3463+ auto SearchResult = std::find (
3464+ pC->state .spring_attachments .begin (),pC->state .spring_attachments .end (),this );
3465+ if ( SearchResult != pC->state .spring_attachments .end () )
3466+ {
3467+ std::cout << " Cell " << pC->ID << " still has cell " << this ->ID << " as a spring attachment!" << std::endl;
3468+ pC->state .spring_attachments .erase ( SearchResult );
3469+ }
3470+
3471+ }
3472+ }
3473+
34363474 return ;
34373475}
34383476
0 commit comments