A method comprises: formulating simulated design input and output optical
signals propagating from/to respective designed optical input and output
ports as optical beams substantially confined by a planar optical
waveguide; computing an interference pattern between the simulated input
and output signals; and computationally deriving an arrangement of
diffractive elements of a diffractive element set from the computed
interference pattern. When the diffractive element set is formed in the
planar optical waveguide, each diffractive element routes, between
corresponding input and output optical ports, a corresponding diffracted
portion of an input optical signal propagating in the planar optical
waveguide that is diffracted by the diffractive element set. The input
optical signal is successively incident on the diffractive elements.