<div dir="ltr">Now that I look at DMShellSetLocalToGlobal, I see that it sets the begin/end functions. But these are already set.<div><br></div><div>It looks like DMShell's SetType must set something for <span style="font-size:13px;font-family:arial,sans-serif">dm->ops-></span><span style="font-size:13px;font-family:arial,sans-serif">getlocaltoglobalmapping for DMShell to be usable to get a matrix from a Composite DM.</span></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 6, 2014 at 2:34 PM, Mark Adams <span dir="ltr"><<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</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">It looks like DMShellCreate does not set <span style="font-family:arial,sans-serif;font-size:13px">dm->ops-></span><span style="font-family:arial,sans-serif;font-size:13px">getlocaltoglobalmapping, which is needed for </span><span style="font-family:arial,sans-serif;font-size:13px">DMCreateMatrix with a composite DM. I do set a global and local vector and a matrix. It looks like I could call </span>DMShellSetLocalToGlobal. Should I be doing this? Seems low level and the kind of thing this using the DM was supposed to avoid<div>
<br></div><div>This seems like it is simply a copy of a local vector to to local part of a global vector.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Mark<br><div><div><br></div></div></div></font></span></div>
<div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">
On Wed, Aug 6, 2014 at 12:23 PM, Mark Adams <span dir="ltr"><<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</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">adding a subject ...<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 6, 2014 at 12:00 PM, Mark Adams <span dir="ltr"><<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</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>I am moving my code to have the DM create the matrix and am hitting this error in DMGetLocalToGlobalMapping:</div>
<div><br></div><div>if (!dm->ops->getlocaltoglobalmapping) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"DM can not create LocalToGlobalMapping");</div>
<div><br></div><div>This happens when I create the matrix like this:</div><div><br></div><div><div> call DMCompositeCreate(comm,solver%da,ierr) </div><div> call DMSetOptionsPrefix(solver%da,'fsa_',ierr)</div><div>
call DMCompositeAddDM(solver%da,solver%daphi,ierr)</div><div> call DMCompositeAddDM(solver%da,solver%dalam,ierr)</div><div> call DMSetFromOptions(solver%da,ierr)</div><div> call DMCreateMatrix(solver%da,solver%KKTmat,ierr)<br>
</div></div><div><br></div><div>I am using DMShell and create them like so:</div><div><br></div><div><div> ! phi DM</div><div> call VecCreate(comm,x1Vec,ierr)</div><div> call VecSetSizes(x1Vec,N1loc,N1Glob,ierr)</div>
<div>
call VecSetFromOptions(x1Vec,ierr)</div><div><br></div><div> call DMShellCreate(comm,solver%daphi,ierr)</div><div> call DMShellSetGlobalVector(solver%daphi,x1Vec,ierr)</div><div> call DMShellSetMatrix(solver%daphi,solver%A0Mat,ierr)</div>
<div> call VecDestroy(x1Vec,ierr)</div><div> call DMSetOptionsPrefix(solver%daphi,'phi_',ierr)</div><div> call DMSetFromOptions(solver%daphi,ierr)</div><div><br></div><div> call VecCreate(PETSC_COMM_SELF,x1Vecloc,ierr)</div>
<div> call VecSetSizes(x1Vecloc,N1loc,N1loc,ierr)</div><div> call VecSetFromOptions(x1Vecloc,ierr)</div><div> call DMShellSetLocalVector(solver%daphi,x1Vecloc,ierr)</div><div> call VecDestroy(x1Vecloc,ierr)</div></div>
<div><br></div><div>All the examples that I see use DMDAs. I am able to create a global vector with this DM.</div><div><br></div><div>Any ideas? </div></div>
</blockquote></div><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>