Numerical modeling of critical-state magnetization in type-II superconducting cylinders under parallel and transverse magnetic field