hier_grid function

Compute a grid given different hierarchies