Fast time- and frequency-domain finite-element methods for electromagnetic analysis