[petsc-users] Get DM used to create Vec

Barry Smith bsmith at petsc.dev
Thu Nov 16 09:24:13 CST 2023


https://petsc.org/release/manualpages/DM/VecGetDM/

Note there is also https://petsc.org/release/manualpages/Sys/PetscObjectCompose/ which along with https://petsc.org/release/manualpages/Sys/PetscContainerCreate/ allows you to attach any data you like to a Vec for later access. This approach supports layering your own higher-level vector information on top of regular Vec (it is done this way to support C and old Fortran that don't support inheritance).



> On Nov 16, 2023, at 9:02 AM, Carl-Johan Thore <carljohanthore at gmail.com> wrote:
> 
> Hi,
> 
> Given a Vec (or Mat) created at some point with DMCreate...,
> is it possible to retrieve from this Vec a pointer to the DM used
> to create it? 
> 
> (I could perhaps build my own Vec-type on top of PETSc's
> which carried with it such a pointer but that doesn't seem like
> a good idea)
> 
> Kind regards,
> Carl-Johan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20231116/116caded/attachment.html>


More information about the petsc-users mailing list