Homogenization and Localization of Ratcheting Behavior of Composite Materials and Structures with the Thermal Residual Stress Effect