I have noticed that, when I run the diffusion example code in parallel, there is a difference between uh.vector.getArray() and uh.x.array where uh is the unknown function. For example, running it on two processors I was getting a size of 1300 and 1301 on the two processors for uh.vector.getArray().shape, but the array sizes of uh.x.array.shape was 1375 and 1375.
When I looked at the code for this,
it looks like vector is supposed to be a petsc wrapper around self.x? Could someone please shed some light on this?
The .vector wraps the .x as an petsc array.
The .x.array lists all values on the process (including ghosts), while vector does not show have the ghost values available.
Internally in dolfinx, the access to ghost values is crucial for easy parallel access of data.
Dolfinx provides the wrapper to petsc such that one can easily interface with the petsc4py interface.