Extension of the surface-density Monte Carlo technique to heat transfer in nonconvex regions