A frame-based system for the design of electromagnetic devices