Analysis of Diffraction Gratings by the Mortar-Element Method