Some questions about Matrix and Vectors

Hello, in DOLFINX, it seems like we users have more power on the matrix and vector of the linear system. But I’m confused about some lines of the codes in this demo https://github.com/FEniCS/dolfinx/blob/v0.6.0/python/dolfinx/fem/petsc.py#L680

WX20231005-155304

  1. It seems to me that from line 221-224, we have already assemble the matrix, then what the function fem::set_diagonal actually does?
  2. For the vectors, I suppose that we employ the function apply_lifting() to apply the boundary condition, then what is the point to use the function set_bc?

Thanks very much!

Refer to the DOLFINx documentation and PETSc documentation.

Thanks for replying.