Method for computer simulation of problems in solid mechanics and gas dynamics in three dimensions and time