Computational modeling of the mechanics of hierarchical materials