Unified formulation of numerical methods. I. Green's formulas for operators in discontinuous fields