Finite-element method–method of lines approach for the analysis of three-dimensional electromagnetic cavities