Resonant optical second harmonic generation and mixing