A solver for 2D Poisson problem with Dirichlet or Neumann boundary conditions