Nonrelativistic and relativistic simple wave problems solved with Smoothed Particle Hydrodynamics