High-efficient direct numerical methods are currently in demand for optimization procedures in the fields of both conventional diffractive and metasurface optics. With a view of extending the scope of application of the previously proposed Generalized Source Method in the curvilinear coordinates, which has theoretical $Oleft(Nlog Nright)$ asymptotic numerical complexity, a new method formulation is developed for gratings with sharp edges. It is shown that corrugation corners can be treated as effective medium interfaces within the rationale of the method. Moreover, the given formulation is demonstrated to allow for application of the same derivation as one used in classical electrodynamics to derive the interface conditions. This yields continuous combinations of the fields and metric tensor components, which can be directly Fourier factorized. Together with an efficient algorithm the new formulation is demonstrated to substantially increase the computation accuracy for given computer resources.