Matrix-vector multiplication in weak formulation

Is the way of adding boundary condition in SNESSolve the same with TAO? If the initial value of boundary nodes are set to meet the requirements of boundary condition, can it be maintained using the constrain of upper and lower bound or using the form as on(1,2,3,4, du1=0,du2=0,du3=0) in varf function?

Thank you for your reply.