Thermal residual stresses in plates and coatings composed of multi-layered and functionally graded materials