Basis Functions With Divergence Constraints for the Finite Element Method