A Patchy Dynamic Programming Scheme for a Class of Hamilton--Jacobi--Bellman Equations