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 <[email protected]> 
> 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

Reply via email to