A multiscale framework for computational nanomechanics: Application to the modeling of carbon nanotubes