Domain structure and phase boundaries in ferroelastics