[petsc-users] Problem Iterating DMPlex

Morten Nobel-Jørgensen mono at mek.dtu.dk
Tue Nov 17 10:11:10 CST 2015


After distributing a DMPlex it seems like my cells are appearing twice (or rather multiple cells maps onto the same vertices).

I’m assuming the way I’m iterating the DMPlex is wrong. Essentially I iterate the DMPlex the following way after distribution (see code snippet below – or attached file).

A related problem; Since distribution of a DMPlex reorders the point indices, how to do I map between distributed point indices and the original point indices.

And a final question: After distributing a DMPlex, some of the vertices are shared and exists in multiple instances. When adding dofs to these, how I I know if dof is owned by the current instance or it is a ghost dof?

I hope someone can point me in the right direction :)

Kind regards,
Morten


Code snippet

PetscInt from,to,dof,off;
DMPlexGetHeightStratum(dm, 0,&from, &to);
for (int cellIndex=from;cellIndex<to;cellIndex++){
    const PetscInt *edges;
    PetscInt       numEdges;
    DMPlexGetConeSize(dm, cellIndex, &numEdges);
    DMPlexGetCone(dm, cellIndex, &edges);
    for (int e = 0;e<numEdges;e++) {
        int edgeIndex = edges[e];
        const PetscInt *vertices;
        PetscInt       numVertices;
        DMPlexGetConeSize(dm, edgeIndex, &numVertices);
        DMPlexGetCone(dm, edgeIndex, &vertices);
        for (int v = 0;v<numVertices;v++){
            int vertexIndex = vertices[v];

For a non distibuted mesh the top of the hasse diagram looks like this:
0 --> 2
0 --> 3
0 --> 4
1 --> 4
1 --> 5
1 --> 6

But when distributing (on two cores) it looks like this, where both cells maps to the same edges (true for both cores):
0 --> 11
0 --> 12
0 --> 13
1 --> 11
1 --> 12
1 --> 13


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20151117/397d317b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: twotriangles.cc
Type: application/octet-stream
Size: 3823 bytes
Desc: twotriangles.cc
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20151117/397d317b/attachment.obj>


More information about the petsc-users mailing list