Ultrafast all-optical switching and optical properties of microcavities and photonic crystals door