Heat equations with discontinuous nonlinearities on convex and nonconvex constraints