A method comprises computing an interference pattern between a simulated
design input optical signal and a simulated design output optical signal,
and computationally deriving an arrangement of at least one diffractive
element set from the computed interference pattern. The interference
pattern is computed in a transmission grating region, with the input and
output optical signals each propagating through the transmission grating
region as substantially unconfined optical beams. The arrangement of
diffractive element set is computationally derived so that when the
diffractive element set thus arranged is formed in or on a transmission
grating, each diffractive element set would route, between corresponding
input and output optical ports, a corresponding diffracted portion of an
input optical signal incident on and transmitted by the transmission
grating. The method can further comprise forming the set of diffractive
elements in or on the transmission grating according to the derived
arrangement.