Partially invariant solutions of nonlinear Klein–Gordon and Laplace equations