[petsc-users] Equivalent to MatGetColumnVector for rows?

Jeremy Theler jeremy at seamplex.com
Thu Oct 20 07:26:04 CDT 2016


Thank you Barry. That makes a lot of sense.

--
jeremy

On Wed, 2016-10-19 at 14:54 -0500, Barry Smith wrote:
>    I don't think you want to store the values in a Vector; the vector will be as large as the entire right hand side but be almost all zeros.
> 
>    If you want to remember "the part of the matrix that is zeroed out by MatZeroRows()" you can use MatGetSubMatrix() and request just the zeroed rows but all the columns. This matrix will be in parallel, on each process it will just have the "zero rows" for that process. If you multiply this matrix by the solution vector you will get a "short" vector that on each process contains the "reaction" for each each of the "removed row" on that process.
> 
>    Easy to implement.
> 
>    Barry
> 
> > On Oct 19, 2016, at 4:38 AM, Jeremy Theler <jeremy at seamplex.com> wrote:
> > 
> > Hi all
> > 
> > Is there an equivalent to MatGetColumnVector() but for getting rows of a
> > matrix as a vector?
> > 
> > What I want to do is to compute the reactions of the nodes that belong
> > to a Dirichlet boundary condition in a FEM linear elastic problem. I set
> > these BCs with MatZeroRows() with a one in the diagonal and the desired
> > displacement in the RHS vector. But before calling MatZeroRows(), I want
> > to “remember” what the row looked like so after solving the problem, if
> > I multipliy this original row by the solution vector I get the reaction
> > corresponding to that row's DOF.
> > 
> > I have implemented something with MatGetRow() that seems to work but it
> > is some lame I am even embarrased of sharing with the list what I have
> > done.
> > 
> > Any suggestion is welcome.
> > 
> > Thanks
> > --
> > jeremy theler
> > www.seamplex.com
> > 
> > 
> 




More information about the petsc-users mailing list