A Nonlocal Operator Method for Partial Differential Equations with Application to Electromagnetic Waveguide Problem