The finite element method applied to the study of two-dimensional photonic crystals and resonant cavities.