Study of all-polymer-based waveguide resonant gratings and their applications for optimization of second-harmonic generation