The smoothed particle hydrodynamics method via residual iteration