<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Oct 19, 2016 at 4:38 AM, Jeremy Theler <span dir="ltr"><<a href="mailto:jeremy@seamplex.com" target="_blank">jeremy@seamplex.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi all<br>
<br>
Is there an equivalent to MatGetColumnVector() but for getting rows of a<br>
matrix as a vector?<br>
<br>
What I want to do is to compute the reactions of the nodes that belong<br>
to a Dirichlet boundary condition in a FEM linear elastic problem. I set<br>
these BCs with MatZeroRows() with a one in the diagonal and the desired<br>
displacement in the RHS vector. But before calling MatZeroRows(), I want<br>
to “remember” what the row looked like so after solving the problem, if<br>
I multipliy this original row by the solution vector I get the reaction<br>
corresponding to that row's DOF.<br>
<br>
I have implemented something with MatGetRow() that seems to work but it<br>
is some lame I am even embarrased of sharing with the list what I have<br>
done.<br></blockquote><div><br></div><div>If you look at what that code is doing:</div><div><br></div><div>  <a href="http://www.mcs.anl.gov/petsc/petsc-current/src/mat/utils/getcolv.c.html#MatGetColumnVector">http://www.mcs.anl.gov/petsc/petsc-current/src/mat/utils/getcolv.c.html#MatGetColumnVector</a></div><div><br></div><div>it just puts a 1 in the vector at that column and does a MatMult(). He codes the MatMult by hand</div><div>because no communication is necessary for in the input vector since we know it.</div><div><br></div><div>You can do the same thing with MatMultTranspose() for rows, and it will do the right thing in parallel.</div><div><br></div><div>   Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Any suggestion is welcome.<br>
<br>
Thanks<br>
--<br>
jeremy theler<br>
<a href="http://www.seamplex.com" rel="noreferrer" target="_blank">www.seamplex.com</a><br>
<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">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>