Harmonic generation in nanostructures: metalnanoparticles and photonic crystals