Assigning degrees of freedom to a grid.
