  We present a comprehensive study of stationary states in a coherent medium
with a quadratic or Kerr nonlinearity in the presence of localized potentials
in one dimension (1D) for both positive and negative signs of the nonlinear
term, as well as for barriers and wells. The description is in terms of the
nonlinear Schr\"odinger equation (NLSE) and hence applicable to a variety of
systems, including interacting ultracold atoms in the mean field regime and
light propagation in optical fibers. We determine the full landscape of
solutions, in terms of a potential step and build solutions for rectangular
barrier and well potentials. It is shown that all the solutions can be
expressed in terms of a Jacobi elliptic function with the inclusion of a
complex-valued phase shift. Our solution method relies on the roots of a cubic
polynomial associated with a hydrodynamic picture, which provides a simple
classification of all the solutions, both bounded and unbounded, while the
boundary conditions are intuitively visualized as intersections of phase space
curves. We compare solutions for open boundary conditions with those for a
barrier potential on a ring, and also show that numerically computed solutions
for smooth barriers agree qualitatively with analytical solutions for
rectangular barriers. A stability analysis of solutions based on the Bogoliubov
equations for fluctuations show that persistent instabilities are localized at
sharp boundaries, and are predicated by the relation of the mean density change
across the boundary to the value of the derivative of the density at the edge.
We examine the scattering of a wavepacket by a barrier potential and show that
at any instant the scattered states are well described by the stationary
solutions we obtain, indicating applications of our results and methods to
nonlinear scattering problems.
