  We investigate the ultrarelativistic boost of a Schwarzschild black hole
immersed in an external electromagnetic field, described by an exact solution
of the Einstein-Maxwell equations found by Ernst (the ``Schwarzschild-Melvin''
metric). Following the classical method of Aichelburg and Sexl, the
gravitational field generated by a black hole moving ``with the speed of
light'' and the transformed electromagnetic field are determined. The
corresponding exact solution describes an impulsive gravitational wave
propagating in the static, cylindrically symmetric, electrovac universe of
Melvin, and for a vanishing electromagnetic field it reduces to the well known
Aichelburg-Sexl pp-wave. In the boosting process, the original Petrov type I of
the Schwarzschild-Melvin solution simplifies to the type II on the impulse, and
to the type D elsewhere. The geometry of the wave front is studied, in
particular its non-constant Gauss curvature. In addition, a more general class
of impulsive waves in the Melvin universe is constructed by means of a
six-dimensional embedding formalism adapted to the background. A coordinate
system is also presented in which all the impulsive metrics take a continuous
form. Finally, it is shown that these solutions are a limiting case of a family
of exact gravitational waves with an arbitrary profile. This family is
identified with a solution previously found by Garfinkle and Melvin. We thus
complement their analysis, in particular demonstrating that such spacetimes are
of type II and belong to the Kundt class.
