Page 327 - The Combined Finite-Discrete Element Method
P. 327

310    ALGORITHM IMPLEMENTATION

                   .........continued from previous listing...........
                  /* scan all loaded y cells */
                  ielemz=i1heaz[0];
                  while(ielemz>=0)
                  { iy=i1eccy[ielemz];
                   if(i2cfy[0][iy]<nelem)
                   { i1heay[0]=i2cfy[0][iy];
                    i1heay[1]=i2cfy[0][iy-1];
                    i1heay[2]=i2cfy[1][iy+1];
                    i1heay[3]=i2cfy[1][iy];
                    i1heay[4]=i2cfy[1][iy-1];

                    if(i1heay[1]>nelem)i1heay[1]=i1heay[1]-nelemd;
                    i2cfy[0][iy]=i2cfy[0][iy]+nelemd;

            Listing 10.31 All y-lists are searched to find a ‘new’ y-list, which is then marked as ‘old’ be
            setting i2cfy[0][iy]=i2cfy[0][iy]+nelemd;.


                     .........continued from previous listing........
                    /* load elements from y cells onto x cells */
                    ihx=0;
                    for(ihy=0;ihy<5;ihy++)
                    { if(ihy>0)ihx=1;
                     ielemy=i1heay[ihy];
                     while(ielemy>=0)
                     { i1cnx[ielemy]=i2cfx[ihx][(i1eccx[ielemy])];
                      i2cfx[ihx][(i1eccx[ielemy])]=ielemy;
                      ielemy=i1cny[ielemy];
                    }}
            Listing 10.32 All elements from the ‘new’ y-list and neighbouring y-lists are loaded onto x-lists.


            representing the central row and neighbouring rows according to the contact map. The
            heads of these lists are i1heay[0], i1heay[1], i1heay[2], i1heay[3], i1heay[4]; thus the
            loop for(ihy=0;ihy<5;ihy++). Discrete elements from the list i1heay[0] (central row)
            are placed onto the first set of x-lists (set of x-lists i2cfx[0]), while discrete elements
            from neighbouring rows are together placed onto the second set of x-lists (set of x-
            lists i2cfx[1]).
              At this stage, all x-lists created are considered to be ‘new x-lists’. However, all x-lists
            do not necessarily have any discrete elements assigned to them, i.e. some of the x-lists
            are empty lists. Thus, a search for non-empty x-lists is performed (Listing 10.33).
              The search for new x-lists is done by looping over all discrete elements from the central
            row of cells iy, starting with the i1heay[0] discrete element. For a particular discrete
            element, the x-list to which that discrete element belongs is identified by the integerised
            coordinate x of that discrete element. For a particular ix, the corresponding ix-list is ‘new’
            if (i2cfx[0][ix]<nelem).Such an ix represents the central cell, and the list i2cfx[0][ix] is
            therefore called the ‘central x-list’. So as not to visit this list again with another discrete
            element from the central row, this list is immediately marked as an ‘old x-list’ by setting
            i2cfx[0][ix]= i2cfx[0][ix]+nelemd. The head of the central x-list is conveniently stored as
   322   323   324   325   326   327   328   329   330   331   332