[petsc-users] Extracting a particular DOF from DMDA vector

Barry Smith bsmith at mcs.anl.gov
Wed Jan 29 23:27:12 CST 2014


On Jan 29, 2014, at 11:25 PM, amlan barua <abarua at iit.edu> wrote:

> Thanks. Let me state my problem more clearly. 
> I have a DMDAVector with n DOFs. My application demands  the scattering of individual components into vectors so that I can perform Mat-Vec multiplication on individual DOFs. How do I make sure that  the vector to which I want to scatter has same parallel layout as the original DMDAVector with n dofs?
> Can I create two DMDAVectors, one from a DMDA with n dofs and other from  DMDA with 1 dof and everything same otherwise?  

  Yes, the will have the same parallel layout.

  Barry

> Amlan
> 
> 
> On Mon, Jan 27, 2014 at 7:30 PM, Matthew Knepley <knepley at gmail.com> wrote:
> On Mon, Jan 27, 2014 at 1:38 AM, amlan barua <abarua at iit.edu> wrote:
> Hi,
> What is the best way of extracting all values corresponding to a particular degree of freedom of a DMDA vector?
> 
> It depends what you want to do with it. YOu can use DMDAVecGetArrayDOF() or VecScatterStride().
> 
>    Matt
>  
> 
> Amlan
> 
> 
> 
> -- 
> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
> -- Norbert Wiener
> 



More information about the petsc-users mailing list