Is the dofmap contains glocal index or local index?

Now I think the main issue is within the assembler, since I got the same function space in both interfaces, and I think that is correct.

When I impose PBC, what I do is to add the the entity with the index of the slave dof to that with the master dof(is it correct?), like this:

2 1 0 0 0 0 0 0 0 0 0                             4 1 0 0 0 0 0 0 0 0 1
1 4 1 0 0 0 0 0 0 0 0                             1 4 1 0 0 0 0 0 0 0 0 
0 1 4 1 0 0 0 0 0 0 0                             0 1 4 1 0 0 0 0 0 0 0
0 0 1 4 1 0 0 0 0 0 0                             0 0 1 4 1 0 0 0 0 0 0
0 0 0 1 4 1 0 0 0 0 0                             0 0 0 1 4 1 0 0 0 0 0
0 0 0 0 1 4 1 0 0 0 0         ==>                 0 0 0 0 1 4 1 0 0 0 0
0 0 0 0 0 1 4 1 0 0 0                             0 0 0 0 0 1 4 1 0 0 0 
0 0 0 0 0 0 1 4 1 0 0                             0 0 0 0 0 0 1 4 1 0 0
0 0 0 0 0 0 0 1 4 1 0                             0 0 0 0 0 0 0 1 4 1 0
0 0 0 0 0 0 0 0 1 4 1                             1 0 0 0 0 0 0 0 1 4 1
0 0 0 0 0 0 0 0 0 1 2

And when I work in CPP interface, the malloc error happend when the assembler try to add values to (0,9) or (9,0), while in python interface, this process is also blocked (but no error message), so the mass matrix is like this

2 1 0 0 0 0 0 0 0 0                          
1 4 1 0 0 0 0 0 0 0                         
0 1 4 1 0 0 0 0 0 0             
0 0 1 4 1 0 0 0 0 0         
0 0 0 1 4 1 0 0 0 0             
0 0 0 0 1 4 1 0 0 0     
0 0 0 0 0 1 4 1 0 0       
0 0 0 0 0 0 1 4 1 0         
0 0 0 0 0 0 0 1 4 1                 
0 0 0 0 0 0 0 0 1 4                    

I believe this is the problem withing the PETSC matrix, because I remember that in the DOLFINX_MPC, we create the matrix with a different way, using the sparse pattern given by the MPC.