[petsc-users] Problem Iterating DMPlex

Matthew Knepley knepley at gmail.com
Tue Nov 17 10:53:01 CST 2015


On Tue, Nov 17, 2015 at 10:11 AM, Morten Nobel-Jørgensen <mono at mek.dtu.dk>
wrote:

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

Your code is creating the serial mesh on each process. You only want
nonzero sizes on one proc.

You can see the mesh using -dm_view, and everything using -dm_view
::ascii_info_detail

  Thanks,

     Matt


> 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
>
>
>


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


More information about the petsc-users mailing list