Efficient Implementation of the Fourier Modal Method (RCWA) for the Optical Simulation of Optoelectronics Devices