[petsc-dev] DMGetNamedGlobalVector() implementation?

Barry Smith bsmith at mcs.anl.gov
Thu Jul 19 14:07:26 CDT 2012


On Jul 19, 2012, at 1:54 PM, Jed Brown wrote:

> On Thu, Jul 19, 2012 at 1:50 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>  Is there a way to fix the reference loop problem in PetscObjectCompose()? (Since you have a magic fix for DMGetNamedGlobalVector() can we use that everywhere)
> 
> Look at the ugly code in DMDestroy that takes care of the work vectors and named list. Note that the API maintains that these named vectors have reverse links. If you allow a mix, it gets messier. What about indirect loops?
>  
> 
>    You have to admit that introducing in a bunch of places separate constructs for containment rather than using a single universal construct is not good software development.
> 
> I agree, but I could not find an easy way.

  Can you find a difficult way ?

  We chose to make the DM both a factory for creating stuff and a place to stash stuff that people can pull out later, this will lead to more and more of these loops. We could

1) do proper garbage collection always (yuck from the person who has to write that perspective)

2) have separate factories that the user manage; so basically split the DM into two parts that do not reference each other. (Yuck from the user perspective)

3) continue with all these hacks to prevent loops

4) something else?






More information about the petsc-dev mailing list