Modeling the Action of Protons and Heavier Ions in Biological Targets: Nuclear Interactions in Hadrontherapy and Space Radiation Protection