Replace BCs if their subdomain matches an existing one

Rather than adding boundary conditions on the same subdomain to the set
of BCs on the Matrix, if the new boundary condition is on the same
subdomain as an existing one, replace the old one.

Additionally, make checks for when a matrix needs reassembling smarter.
If the boundary conditions have changed, but the subdomains haven't, we
don't need to reassemble.
Add more tests of matrices with boundary conditions