[petsc-users] Extract subsection of DMDA

thiele at itwm.fraunhofer.de thiele at itwm.fraunhofer.de
Wed Nov 12 15:16:20 CST 2014

Thanks for your reply. I thought about changing the constructor
parameters, too, but I found it rather complicated and it exceeds my
current PETSc knowledge. So maybe you are right and I should use the
visualization tool if there is no other way to do it with PETSc.


> On Wed, Nov 12, 2014 at 9:56 AM, Christopher Thiele <
> christopher.thiele at itwm.fraunhofer.de> wrote:
>> Hello,
>> I have a 3d DMDA and a vector created by DMCreateGlobalVector. I want to
>> visualize and therefore export a subset of the values, i.e. I want to
>> "remove" some points at the boundary. For example, if the DMDA
>> represents the domain [0,1]^3, I want to extract [0.25,0.75]^3.
>> I already tried to create another (smaller) DMDA, use DMDAVecGetArray on
>> both of them and then copy the values. The problem is that the vectors
>> are distributed differently, so this approach leads to segfaults.
>> Is there another way to do this?
> You can force the same layout using lx, ly, lz in the constructor.
> However,
> this kind of clipping
> is usually much easier in a visualization program.
>   Thanks,
>     Matt
>> Regards,
>> Christopher
> --
> 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