Data structures and program techniques of finite element methods for analysis and optimization of electric devices