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

SORTING CONTACT DETECTION ALGORITHM        101

                         3  1  7112145        9  4  812613 15 16 10

                                11 > 8,                   6 < 8,
                                 so it                     so it
                                moves                     moves
             Figure 3.34 A new pair that needs to be swapped is found (6 and 11 need to swap places).




                         3  1  7  6  2 14 5   9  4  8 12 11 13 15 16 10


                                   2 < 8,             12 > 8,
                                    so it              so it
                                   stays               stays

                                   Figure 3.35  No swapping needed.




                         3  1  7  6  2 14 5   9  4  8 12 11 13 15 16 10

                                      14 > 8,      8 = 8,
                                       so it        so it
                                      moves         stays

                            Figure 3.36 Swapping needed, but not possible yet.




                         3  1  7  6  2 14 5   9  4  8 12 11 13 15 16 10

                                     14 > 8,    4 < 8,
                                      so it      so it
                                     moves      moves

                           Figure 3.37 The new pair to be swapped is identified.





                              Array X 1,A              Array X 1,B

                         3  1  7  6  2 14 5   9  4  8 12 11 13 15 16 10

                                        5 < 8,  9 > 8,
                                         so it  so it
                                        stays  stays

                      Figure 3.38 The swapping sequence has resulted in two sub-arrays.
   113   114   115   116   117   118   119   120   121   122   123