[petsc-dev] why exist named global and local vectors
Smith, Barry F.
bsmith at mcs.anl.gov
Fri Oct 5 23:31:28 CDT 2018
ok, sounds reasonable
> On Oct 5, 2018, at 11:26 PM, Jed Brown <jed at jedbrown.org> wrote:
>
> Vecs hold a reference to their DM. If the Vec is also composed to the
> DM, then you have a reference counting loop. Discovering and breaking
> general reference counting loops is hard; the named vectors are a
> restrictive feature so that it is not hard. I don't have a problem with
> other solutions, but that was the rationale.
>
> You can see the original commit.
>
> commit dfe153156869f5931ee6b299eecdcfd8470c0dd0
> Author: Jed Brown <jed at 59A2.org>
> Date: Sun Mar 25 20:17:10 2012 -0500
>
> Strip out bad idea of holding vec_sol in SNESDM, implement DMGetNamedGlobalVector() and implement restriction with it
>
> Hg-commit: 0040de20b98becd00af00473b94f3d32a4299b3d
>
> include/petsc-private/dmimpl.h | 10 ++++
> include/petsc-private/snesimpl.h | 6 ---
> include/petscdm.h | 2 +
> src/dm/impls/da/dalocal.c | 94 +++++++++++++++++++++++++++++++++++
> src/dm/interface/dm.c | 10 ++++
> src/snes/interface/snes.c | 40 +++++++++++++--
> src/snes/utils/dmsnes.c | 74 +--------------------------
> 7 files changed, 154 insertions(+), 82 deletions(-)
>
> "Smith, Barry F." <bsmith at mcs.anl.gov> writes:
>
>> Why have
>>
>> PETSC_EXTERN PetscErrorCode DMHasNamedGlobalVector(DM,const char*,PetscBool*);
>> PETSC_EXTERN PetscErrorCode DMGetNamedGlobalVector(DM,const char*,Vec*);
>> PETSC_EXTERN PetscErrorCode DMRestoreNamedGlobalVector(DM,const char*,Vec*);
>> PETSC_EXTERN PetscErrorCode DMHasNamedLocalVector(DM,const char*,PetscBool*);
>> PETSC_EXTERN PetscErrorCode DMGetNamedLocalVector(DM,const char*,Vec*);
>> PETSC_EXTERN PetscErrorCode DMRestoreNamedLocalVector(DM,const char*,Vec*);
>>
>> when one can simply using the already existing PetscObjectCompose() and PetscObjectQuery() to attach named vectors to a given DM (or any other object in fact)?
>>
>> Barry
More information about the petsc-dev
mailing list