Thermal-wave depth profiling: Theory