On Thu, Nov 16, 2023 at 10:30 AM Barry Smith <[email protected]> wrote:
> > 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). > Caution: It is not hard to create reference cycles when using PetscObjectCompose(). Thanks, Matt > 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 > > > -- 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.cse.buffalo.edu/~knepley/>
