Electromagnetic analysis with discrete exterior calculus