Dear PETSc developers / Matt Thanks for your suggestions regarding our use of dmplex in a FEM context. However, Matt's advise on using the PetscFE is not sufficient for our needs (our end goal is a topology optimization framework - not just FEM) and we must honestly admit that we do not see how we can use the MATIS and the MatSetValuesClosure or DMPlexMatSetClosure to solve our current issues as Stefano has suggested.
We have therefore created a more representative, yet heavily oversimplified, code example that demonstrates our problem. That is, the dof handling is only correct on a single process and goes wrong on np>1. We hope very much that you can help us to overcome our problem. Thank you for an excellent toolkit Morten and Niels