<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>After distributing a DMPlex it seems like my cells are appearing twice (or rather multiple cells maps onto the same vertices). </div>
<div><br>
</div>
<div>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). </div>
<div><br>
</div>
<div>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. </div>
<div><br>
</div>
<div>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? </div>
<div><br>
</div>
<div>I hope someone can point me in the right direction :)</div>
<div><br>
</div>
<div>Kind regards, </div>
<div>Morten</div>
<div><br>
</div>
<div><br>
</div>
<div>Code snippet</div>
<div>
<pre style="background-color: rgb(255, 255, 255); font-family: Menlo; font-size: 9pt;"><pre style="font-family: Menlo; font-size: 9pt;">PetscInt from,to,dof,off;<br>DMPlexGetHeightStratum(dm, <span style="color:#0000ff;">0</span>,&from, &to);<br><span style="color:#000080;font-weight:bold;">for </span>(<span style="color:#000080;font-weight:bold;">int </span>cellIndex=from;cellIndex<to;cellIndex++){<br>    <span style="color:#000080;font-weight:bold;">const </span>PetscInt *edges;<br>    PetscInt       numEdges;<br>    DMPlexGetConeSize(dm, cellIndex, &numEdges);<br>    DMPlexGetCone(dm, cellIndex, &edges);<br>    <span style="color:#000080;font-weight:bold;">for </span>(<span style="color:#000080;font-weight:bold;">int </span>e = <span style="color:#0000ff;">0</span>;e<numEdges;e++) {<br>        <span style="color:#000080;font-weight:bold;">int </span>edgeIndex = edges[e];<br>        <span style="color:#000080;font-weight:bold;">const </span>PetscInt *vertices;<br>        PetscInt       numVertices;<br>        DMPlexGetConeSize(dm, edgeIndex, &numVertices);<br>        DMPlexGetCone(dm, edgeIndex, &vertices);<br>        <span style="color:#000080;font-weight:bold;">for </span>(<span style="color:#000080;font-weight:bold;">int </span>v = <span style="color:#0000ff;">0</span>;v<numVertices;v++){<br>            <span style="color:#000080;font-weight:bold;">int </span>vertexIndex = vertices[v];<br></pre></pre>
</div>
<div>For a non distibuted mesh the top of the hasse diagram looks like this:</div>
<div>
<div>0 --> 2</div>
<div>0 --> 3</div>
<div>0 --> 4</div>
<div>1 --> 4</div>
<div>1 --> 5</div>
<div>1 --> 6</div>
</div>
<div><br>
</div>
<div>But when distributing (on two cores) it looks like this, where both cells maps to the same edges (true for both cores):</div>
<div>
<div>0 --> 11</div>
<div>0 --> 12</div>
<div>0 --> 13</div>
<div>1 --> 11</div>
<div>1 --> 12</div>
<div>1 --> 13</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div id="MAC_OUTLOOK_SIGNATURE"></div>
</div>
</body>
</html>