On Tue, Oct 1, 2019 at 6:35 AM Lawrence Mitchell <wence@gmx.li> wrote:
On 1 Oct 2019, at 10:48, Matthew Knepley <knepley@gmail.com> wrote:
On Mon, Sep 30, 2019 at 10:46 PM Sentz, Peter <sentz2@illinois.edu> wrote: So is there a way to return how the global degrees of freedom are distributed across processors?
I would recommend changing your workflow so that you do not need this, since it complicates everything.
However, if you still really want to do this, you can
1) Tell the DM to constructs mappings back to the original ordering
https://www.mcs.anl.gov/petsc/petsc-master/docs/manualpages/DM/DMSetUseNatur...
2) After distribution, map a vector back to that ordering
https://www.mcs.anl.gov/petsc/petsc-master/docs/manualpages/DMPLEX/DMPlexGlo...
3) Output that vector using view()
FWIW, I would be a little bit careful checking that this all DTRT. We don't set a Section on the DMPlex before distribution, so (as I understand the code) the global-to-natural SF won't be built.
Ah, you are correct. Crap.
Aside: why does the interface in PETSc not build an SF for the permutation of the topology to natural ordering, and then you would do:
We could have if we had thought of it. I did not write it and I missed that in review. Thanks, Matt
DMGlobalToNatural(dm, Vec global, Section layout, Vec natural);
Peter, perhaps you can explain why you need a consistent ordering and we can figure out a way to achieve the same thing without doing this dance. As Matt says, it does make lots of things more complicated.
Thanks,
Lawrence
-- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>