An interface-enriched finite element method for electromagnetic analysis and optimization of 2D problems