I wanted that 10 years ago.
Matt
On Tue, Oct 27, 2009 at 4:37 PM, Barry Smith bsmith at mcs.anl.gov wrote:
PetscMap is a strange beast in PETSc.
1) it is not a PetscObject (that is it has no PETSc header)
2) it is used as a PetscMap* instead of PetscMap like most objects
3) it does not have a PetscMapCreate() instead it has a
PetscMapInitialize() which is like a create except it does not malloc its
memory
4) It does have a PetscMapDestroy() that DOES free the space.
5) Sometimes a PetscMalloc() is called before PetscMapInitialize() and
sometimes a PetscMap is declared and a of the variable is passed in
In this case it will crash if one calls PetscMapDestroy() is called on
it. So instead one must call PetscFree(map-range); to free the interior
space.
This strange creature evolved over time because I did not want PetscMap to
be a full heavy weight object, but it pretty much ended up being one anyways
(for example it has reference counting). For a long time I hid PetscMap in
the less public part of PETSc didn't want most people to have to deal with
it.
I still don't want it to be something most PETSc users need ever see, but
it is time to fix it up and make it more consistent with other objects. So I
propose to make a PetscMap just like other PETSc objects, with create(),
destroy(), opaque definition except I will still not make it have a PETSc
header. This will not require much change in the code but will simplify its
usage.
Any comments.
Barry
--
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
-- next part --
An HTML attachment was scrubbed...
URL:
http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20091027/4bd34f2c/attachment.html