Electrooptics of thin ferroelectric films