Classical field theory methods in laser physics. I. Radiation field in empty resonators and resonators with inhomogeneous active medium