[petsc-users] get a DOF component of DMDA and save it to file

Matthew Knepley knepley at gmail.com
Tue Apr 17 13:42:07 CDT 2018


On Tue, Apr 17, 2018 at 2:06 PM, Oleksandr Koshkarov <olk548 at mail.usask.ca>
wrote:

> Hello All,
>
> I have a 3d DMDA with big DOF number. I want to save one component of DOF
> to the file, however I see only a solution where I create 3D DMDA with
> DOF=1, then copy a slice and then save the resulting vector with VecView.
> There should be a simpler way. I hope you can help me with this :)
>

I would create the same DMDA with just 1 component (one line), get a vector
from it (one line),
call this to map your big vector to the smaller one (one line),


http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecStrideGather.html

and VecView() it, so 4 lines instead of 1-2.

  Thanks,

     Matt

Thank you,
>
> Oleksandr Koshkarov.
>
>


-- 
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

https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180417/9f7892b9/attachment.html>


More information about the petsc-users mailing list