[petsc-dev] No LocalToGlobalMapping in DMPlex

Matthew Knepley knepley at gmail.com
Sun Oct 7 22:54:19 CDT 2018


On Fri, Oct 5, 2018 at 2:58 PM Tristan Konolige <
Tristan.Konolige at colorado.edu> wrote:

> Hello PETSc Developers,
>
> I’d like to get an ISLocalToGlobalMapping from a DMPlex. But,
> currently, DMGetLocalToGlobalMapping returns an empty
> ISLocalToGlobalMapping. I can see that ISLocalToGlobalMappings are created
> in DMPlexDistribute, but they are never assigned to the DM. Is
> DMGetLocalToGlobalMapping supported with DMPlex or is this a bug?
>

LocalToGlobal mappings are only meaningful for function spaces, not
topology. DMPlex itself only deals with topology. You have to give it a
PetscSection if you want to say something about the function space, using
DMSetSection().

DMDA only has one function space (values at vertices), so it just uses this
by default, and GetLocalToGlobal() works automatically.

  Thanks,

    Matt


> I’ve included a simple example below.
>
> ```
> #include <petsc.h>
>
> int main(int argc, char** argv) {
>   PetscErrorCode ierr;
>   PetscInt size;
>   ISLocalToGlobalMapping l2g;
>   DM dm, dm_dist;
>   PetscInt num_points[2] = {2, 2};
>   PetscInt cone_size[4] = {1, 1, 0, 0};
>   PetscInt cones[2] = {2,3};
>   PetscInt orientations[2] = {0, 0};
>   PetscInt local_points[2] = {0, 1};
>   PetscInt global_points[2];
>
>   PetscInitialize(&argc, &argv, NULL, NULL);
>
>   DMPlexCreate(PETSC_COMM_WORLD, &dm);
>   DMPlexCreateFromDAG(dm, 1, num_points, cone_size, cones, orientations,
> NULL);
>   DMPlexDistribute(dm, 0, NULL, &dm_dist);
>
>   DMGetLocalToGlobalMapping(dm_dist, &l2g);
>   ISLocalToGlobalMappingApply(l2g, 2, local_points, global_points);
>
>   PetscFinalize();
> }
> ```
>
> Thank you,
> Tristan Konolige
>


-- 
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/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20181007/0a239d81/attachment.html>


More information about the petsc-dev mailing list