<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Apr 20, 2018 at 4:33 PM, Junchao Zhang <span dir="ltr"><<a href="mailto:jczhang@mcs.anl.gov" target="_blank">jczhang@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 dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 20, 2018 at 3:18 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 Fri, Apr 20, 2018 at 4:10 PM, Junchao Zhang <span dir="ltr"><<a href="mailto:jczhang@mcs.anl.gov" target="_blank">jczhang@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 dir="ltr"><div>To pad a vector, i.e., copy a vector to a new one, I have to call VecSetValue(newb,1,&idx,...) for each element. But to be efficient, what I really needs is to set a block of values in one call. It looks PETSc does not have a routine for that(?). I looked at VecSetValuesBlocked, but it looks it is not for that purpose.</div><div>Should we have something like VecSetValuesBlock(<a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/Vec.html#Vec" target="_blank">Vec</a><span style="color:rgb(0,0,0)"> v,</span><a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscInt.html#PetscInt" target="_blank">PetscInt</a><span style="color:rgb(0,0,0)"> i,PetscInt cnt,</span><a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscScalar.html#PetscScalar" target="_blank">PetscScalar</a><span style="color:rgb(0,0,0)"> *value, </span><a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/InsertMode.html#InsertMode" target="_blank">InsertMode</a><span style="color:rgb(0,0,0)"> mode) to set cnt values starting at index i?</span></div></div></blockquote><div><br></div></span><div>Use VecGetArray().</div></div></div></div></blockquote><div>Did you mean <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">VecGetArray</span> b and newb, do a memcpy from b to new and then restore them? If yes, it does not work since some of the values I want to set might be remote.</div><div>E.g, I have 4 processors. b's size is 181 and is distributed as 46, 45,45,45, newb is distributed as 48,45,45,45 to match a matrix of block size 3.</div></div></div></div></blockquote><div><br></div><div>If values are remote, use VecScatter or PetscSF.</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 class="gmail_extra"><div class="gmail_quote"><div> </div><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"><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"><span class="m_913198168399085142m_-1296599340439652214m_-8789788293588154286HOEnZb"><font color="#888888"><div><div class="m_913198168399085142m_-1296599340439652214m_-8789788293588154286m_9049226254166887851gmail_signature"><div dir="ltr">--Junchao Zhang</div></div></div><span class="m_913198168399085142m_-1296599340439652214HOEnZb"><font color="#888888">
</font></span></font></span></div><span class="m_913198168399085142m_-1296599340439652214HOEnZb"><font color="#888888">
</font></span></blockquote></div><span class="m_913198168399085142m_-1296599340439652214HOEnZb"><font color="#888888"><br><br clear="all"><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="m_913198168399085142m_-1296599340439652214m_-8789788293588154286gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><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><br></div><div><a href="http://www.caam.rice.edu/~mk51/" target="_blank">https://www.cse.buffalo.edu/~k<wbr>nepley/</a><br></div></div></div></div></div>
</font></span></font></span></div></div>
</blockquote></div><br></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><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><br></div><div><a href="http://www.caam.rice.edu/~mk51/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div>
</div></div>