<div dir="ltr">Yes, that's what I need. If I added a variable to the edges with <a href="http://www.mcs.anl.gov/petsc/petsc-master/docs/manualpages/DM/DMNetworkAddNumVariables.htmlhttp://www.mcs.anl.gov/petsc/petsc-master/docs/manualpages/DM/DMNetworkAddNumVariables.htmlhttp://www.mcs.anl.gov/petsc/petsc-master/docs/manualpages/DM/DMNetworkAddNumVariables.html" target="_blank" style="font-family:Helvetica,sans-serif">DMNetworkAddNumVariables</a><font color="#000000" face="Helvetica, sans-serif">(), my global vector that </font><a href="http://www.mcs.anl.gov/petsc/petsc-master/docs/manualpages/DM/DMCreateGlobalVector.html" target="_blank" style="font-family:Helvetica,sans-serif">DMCreateGlobalVector</a><font color="#000000" face="Helvetica, sans-serif">() creates would have the edge variables that I don't want to have mixed with the variables I added in the vertices. I want them to be in a separate vectors. Therefore, I create a vector with </font><font color="#000000" face="Helvetica, sans-serif"> </font><a href="http://www.mcs.anl.gov/petsc/petsc-master/docs/manualpages/DM/DMCreateGlobalVector.html" target="_blank" style="font-family:Helvetica,sans-serif">DMCreateGlobalVector</a><font color="#000000" face="Helvetica, sans-serif">() with the variables I added in the vertices. Now I want another vector with "other" variables in the edges, and this vector has to be partitioned the same way the edges are.</font><br><div><font color="#000000" face="Helvetica, sans-serif"><br></font></div><div><font color="#000000" face="Helvetica, sans-serif">Thanks</font></div><div><font color="#000000" face="Helvetica, sans-serif">Miguel</font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 23, 2015 at 10:33 AM, Abhyankar, Shrirang G. <span dir="ltr"><<a href="mailto:abhyshr@mcs.anl.gov" target="_blank">abhyshr@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;color:rgb(0,0,0);font-size:14px;font-family:Helvetica,sans-serif">
<div>Miguel,</div>
<div> It's not entirely clear what you are trying to do and what solver you intend to use eventually. The way DMNetwork is set up currently (following from DMPlex) is that you can assign degrees of freedom for each vertex and edge using
<a href="http://www.mcs.anl.gov/petsc/petsc-master/docs/manualpages/DM/DMNetworkAddNumVariables.htmlhttp://www.mcs.anl.gov/petsc/petsc-master/docs/manualpages/DM/DMNetworkAddNumVariables.htmlhttp://www.mcs.anl.gov/petsc/petsc-master/docs/manualpages/DM/DMNetworkAddNumVariables.html" target="_blank">
DMNetworkAddNumVariables</a>. Once the DM is setup and/or distributed, one create global vector(s) of the appropriate size using
<a href="http://www.mcs.anl.gov/petsc/petsc-master/docs/manualpages/DM/DMCreateGlobalVector.html" target="_blank">
DMCreateGlobalVector</a>. During a residual evaluation, one first gets the local vectors from the DM and then does a
<a href="http://www.mcs.anl.gov/petsc/petsc-master/docs/manualpages/DM/DMGlobalToLocalBegin.html" target="_blank">
DMGlobalToLocalBegin/End</a> to copy the contents of the global vector to the local vector. You can then use a VecGetArray() on this local vector to access the elements of the vector. While iterating over the local edges/vertices,
<a href="http://www.mcs.anl.gov/petsc/petsc-master/docs/manualpages/DM/DMNetworkGetVariableOffset.html" target="_blank">
DMNetworkGetVariableOffset</a> gives you the location of the first element in the local vector for that particular edge/vertex point. This is how it is done in the DMNetwork example pf.c.</div>
<div><br>
</div>
<div>Now back to your question, are you creating your "global petsc vector" using DMCreateGlobalVector()? Do you wish to have vectors of different sizes associated with a DMNetwork? </div>
<div><br>
</div>
<div>Shri</div>
<div><br>
</div>
<div><br>
</div>
<span>
<div style="font-family:Calibri;font-size:11pt;text-align:left;color:black;BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;PADDING-BOTTOM:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;BORDER-TOP:#b5c4df 1pt solid;BORDER-RIGHT:medium none;PADDING-TOP:3pt">
<span style="font-weight:bold">From: </span>Miguel Angel Salazar de Troya <<a href="mailto:salazardetroya@gmail.com" target="_blank">salazardetroya@gmail.com</a>><br>
<span style="font-weight:bold">Date: </span>Mon, 23 Feb 2015 09:27:51 -0600<br>
<span style="font-weight:bold">To: </span>Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>><br>
<span style="font-weight:bold">Cc: </span>Shri <<a href="mailto:abhyshr@mcs.anl.gov" target="_blank">abhyshr@mcs.anl.gov</a>>, "<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>" <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><div><div class="h5"><br>
<span style="font-weight:bold">Subject: </span>Re: [petsc-users] DMNetworkGetEdgeRange() in parallel<br>
</div></div></div><div><div class="h5">
<div><br>
</div>
<blockquote style="BORDER-LEFT:#b5c4df 5 solid;PADDING:0 0 0 5;MARGIN:0 0 0 5">
<div dir="ltr">I'm iterating through local edges given in <span style="font-size:13px">DMNetworkGetEdgeRange(</span><span style="font-size:13px">). For each edge, I extract or modify its corresponding value in a global petsc vector. Therefore that vector must
have as many components as edges there are in the network. To extract the value in the vector, I use VecGetArray() and a variable counter that is incremented in each iteration. The array that I obtain in
</span><span style="font-size:13px">VecGetArray() has to be the same size than the edge range. That variable counter starts as 0, so if the array that I obtained in </span><span style="font-size:13px">VecGetArray() is </span><span style="color:rgb(0,0,0)">x_array, </span><span style="color:rgb(0,0,0)">x_array[0]
must be the component in the global vector that corresponds with the start edge given in </span><span style="font-size:13px">DMNetworkGetEdgeRange(</span><span style="font-size:13px">)</span>
<div><br>
</div>
<div>
<div>I need that global petsc vector because I will use it in other operations, it's not just data. Sorry for the confusion. Thanks in advance.<br>
<div><span style="font-size:13px"><br>
</span></div>
<div><span style="font-size:13px">Miguel</span></div>
<div><span style="font-size:13px"><br>
</span></div>
</div>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Feb 23, 2015 at 9:09 AM, Matthew Knepley <span dir="ltr">
<<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote"><span>On Mon, Feb 23, 2015 at 8:42 AM, Miguel Angel Salazar de Troya
<span dir="ltr"><<a href="mailto:salazardetroya@gmail.com" target="_blank">salazardetroya@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<p dir="ltr">Thanks, that will help me. Now what I would like to have is the following: if I have two processors and ten edges, the partitioning results in the first processor having the edges 0-4 and the second processor, the edges 5-9. I also have a global
vector with as many components as edges, 10. How can I partition it so the first processor also has the 0-4 components and the second, the 5-9 components of the vector?</p>
</blockquote>
</span>
<div>I think it would help to know what you want to accomplish. This is how you are proposing to do it.'</div>
<div><br>
</div>
<div>If you just want to put data on edges, DMNetwork has a facility for that already.</div>
<div><br>
</div>
<div> Thanks,</div>
<div><br>
</div>
<div> Matt</div>
<div>
<div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<p dir="ltr">Miguel</p>
<div class="gmail_quote">On Feb 23, 2015 8:08 AM, "Abhyankar, Shrirang G." <<a href="mailto:abhyshr@mcs.anl.gov" target="_blank">abhyshr@mcs.anl.gov</a>> wrote:<br type="attribution">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;color:rgb(0,0,0);font-size:14px;font-family:Helvetica,sans-serif">
<div>Miguel,</div>
<div> One possible way is to store the global numbering of any edge/vertex in the "component" attached to it. Once the mesh gets partitioned, the components are also distributed so you can easily retrieve the global number of any edge/vertex by accessing
its component. This is what is done in the DMNetwork example pf.c although the global numbering is not used for anything. </div>
<div><br>
</div>
<div>Shri</div>
<span>
<div style="font-family:Calibri;font-size:11pt;text-align:left;color:black;BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;PADDING-BOTTOM:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;BORDER-TOP:#b5c4df 1pt solid;BORDER-RIGHT:medium none;PADDING-TOP:3pt">
<span style="font-weight:bold">From: </span>Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>><br>
<span style="font-weight:bold">Date: </span>Mon, 23 Feb 2015 07:54:34 -0600<br>
<span style="font-weight:bold">To: </span>Miguel Angel Salazar de Troya <<a href="mailto:salazardetroya@gmail.com" target="_blank">salazardetroya@gmail.com</a>><br>
<span style="font-weight:bold">Cc: </span>"<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>" <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [petsc-users] DMNetworkGetEdgeRange() in parallel<br>
</div>
<div><br>
</div>
<blockquote style="BORDER-LEFT:#b5c4df 5 solid;PADDING:0 0 0 5;MARGIN:0 0 0 5">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Sun, Feb 22, 2015 at 3:59 PM, Miguel Angel Salazar de Troya
<span dir="ltr"><<a href="mailto:salazardetroya@gmail.com" target="_blank">salazardetroya@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Thanks. Once I obtain that Index Set with the routine <span style="font-size:13px">DMPlexCreateCellNumbering() (I assume that the edges in DMNetwork correspond to cells in DMPlex) can I use it to partition a vector with as many components as
edges I have in my network?</span></div>
</blockquote>
<div><br>
</div>
<div>I do not completely understand the question.</div>
<div><br>
</div>
<div>If you want a partition of the edges, you can use DMPlexCreatePartition() and its friend DMPlexDistribute(). What</div>
<div>are you trying to do?</div>
<div><br>
</div>
<div> Matt</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div><span style="font-size:13px">Thanks</span></div>
<div><span style="font-size:13px">Miguel</span></div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Sun, Feb 22, 2015 at 12:15 PM, Matthew Knepley <span dir="ltr">
<<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote"><span>On Sun, Feb 22, 2015 at 11:01 AM, Miguel Angel Salazar de Troya
<span dir="ltr"><<a href="mailto:salazardetroya@gmail.com" target="_blank">salazardetroya@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi
<div><br>
</div>
<div>I noticed that the routine DMNetworkGetEdgeRange() returns the local indices for the edge range. Is there any way to obtain the global indices? So if my network has 10 edges, the processor 1 has the 0-4 edges and the processor 2, the 5-9 edges, how can
I obtain this information?</div>
</div>
</blockquote>
<div><br>
</div>
</span>
<div>One of the points of DMPlex is we do not require a global numbering. Everything is numbered</div>
<div>locally, and the PetscSF maps local numbers to local numbers in order to determine ownership.</div>
<div><br>
</div>
<div>If you want to create a global numbering for some reason, you can using DMPlexCreatePointNumbering().</div>
<div>There are also cell and vertex versions that we use for output, so you could do it just for edges as well.</div>
<div><br>
</div>
<div> Thanks,</div>
<div><br>
</div>
<div> Matt</div>
<span>
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div>Thanks </div>
<span><font color="#888888">
<div>Miguel<br clear="all">
<div><br>
</div>
-- <br>
<div>
<div dir="ltr"><font face="verdana,sans-serif"><b>Miguel Angel Salazar de Troya</b></font><span><font color="#888888"><br>
<font face="arial,helvetica,sans-serif">Graduate Research Assistant<br>
Department of Mechanical Science and Engineering<br>
</font>University of Illinois at Urbana-Champaign<br>
<a href="tel:%28217%29%20550-2360" value="+12175502360" target="_blank">(217) 550-2360</a><br>
<a href="mailto:salaza11@illinois.edu" target="_blank">salaza11@illinois.edu</a></font></span>
<div><br>
</div>
</div>
</div>
</div>
</font></span></div>
</blockquote>
</span></div>
<span><font color="#888888"><br>
<br clear="all">
<span><font color="#888888">
<div><br>
</div>
-- <br>
<div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener</div>
</font></span></font></span></div>
</div>
<span><font color="#888888"></font></span></blockquote>
</div>
<span><font color="#888888"><br>
<br clear="all">
<span><font color="#888888">
<div><br>
</div>
-- <br>
<div>
<div dir="ltr"><font face="verdana,sans-serif"><b>Miguel Angel Salazar de Troya</b></font><span><font color="#888888"><br>
<font face="arial,helvetica,sans-serif">Graduate Research Assistant<br>
Department of Mechanical Science and Engineering<br>
</font>University of Illinois at Urbana-Champaign<br>
<a href="tel:%28217%29%20550-2360" value="+12175502360" target="_blank">(217) 550-2360</a><br>
<a href="mailto:salaza11@illinois.edu" target="_blank">salaza11@illinois.edu</a></font></span>
<div><br>
</div>
</div>
</div>
</font></span></font></span></div>
<span><font color="#888888"></font></span></blockquote>
<span><font color="#888888"></font></span></div>
<span><font color="#888888"><br>
<br clear="all">
<div><br>
</div>
-- <br>
<div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener</div>
</font></span></div>
</div>
</blockquote>
</span></div>
</blockquote>
</div>
</blockquote>
</div>
</div>
</div>
<div>
<div><br>
<br clear="all">
<div><br>
</div>
-- <br>
<div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div>
<div dir="ltr"><font face="verdana,sans-serif"><b>Miguel Angel Salazar de Troya</b></font><span><font color="#888888"><br>
<font face="arial,helvetica,sans-serif">Graduate Research Assistant<br>
Department of Mechanical Science and Engineering<br>
</font>University of Illinois at Urbana-Champaign<br>
(217) 550-2360<br>
<a href="mailto:salaza11@illinois.edu" target="_blank">salaza11@illinois.edu</a></font></span>
<div><br>
</div>
</div>
</div>
</div>
</blockquote>
</div></div></span>
</div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><font face="verdana, sans-serif"><b>Miguel Angel Salazar de Troya</b></font><span><font color="#888888"><br><font face="arial,helvetica,sans-serif">Graduate Research Assistant<br>Department of Mechanical Science and Engineering<br></font>University of Illinois at Urbana-Champaign<br>(217) 550-2360<br>
<a href="mailto:salaza11@illinois.edu" target="_blank">salaza11@illinois.edu</a></font></span><div><br></div></div></div>
</div>