[petsc-dev] No LocalToGlobalMapping in DMPlex

Tristan Konolige Tristan.Konolige at Colorado.EDU
Fri Oct 5 13:58:48 CDT 2018


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?

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


More information about the petsc-dev mailing list