Analysis and design of passive waveguide devices by spectral element methods