I wanted that 10 years ago.<br><br> Matt<br><br><div class="gmail_quote">On Tue, Oct 27, 2009 at 4:37 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
PetscMap is a strange beast in PETSc.<br>
<br>
1) it is not a PetscObject (that is it has no PETSc header)<br>
2) it is used as a PetscMap* instead of PetscMap like most objects<br>
3) it does not have a PetscMapCreate() instead it has a PetscMapInitialize() which is like a create except it does not malloc its memory<br>
4) It does have a PetscMapDestroy() that DOES free the space.<br>
5) Sometimes a PetscMalloc() is called before PetscMapInitialize() and sometimes a PetscMap is declared and a & of the variable is passed in<br>
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.<br>
<br>
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.<br>
<br>
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.<br>
<br>
<br>
Any comments.<br><font color="#888888">
<br>
Barry<br>
<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener<br>