Hierarchical modeling in the mechanics of materials