Input: the line storage of grids
Step . Obtain the basic neighbor grids for each grid in the structure ;
Step . For each basic neighbor of every grid, if selves of this neighbor are empty, complement the neighbor of this
  neighbor in the same direction as an attached neighbor for the grid;
Step . For each attached neighbor of every grid, if selves of this neighbor are empty, complement the neighbor of this
   neighbor in the same direction as an attached neighbor for the grid.
Algorithm 5: The filling process of neighbor grids.