<p>Can anyone think of a better mnemonic, I find PETSC_OWN_VALUES to be ambiguous without reading the man page?</p>
<p>Jed</p>
<p><blockquote type="cite">On Oct 3, 2010 7:57 PM, "Barry Smith" <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br><br><br>
   I find the three routines ISCreateGeneral(), ISCreateGeneralNC() and ISCreateGeneralWithArray() to be confusing and code redundant.<br>
<br>
   Therefore in PETSc-dev I have introduced<br>
<br>
/*E<br>
    PetscCopyMode  - Determines how an array passed to certain functions is copied or retained<br>
<br>
   Level: beginner<br>
<br>
$   PETSC_COPY_VALUES - the array values are copied into new space, the user is free to reuse or delete the passed in array<br>
$   PETSC_OWN_POINTER - the array values are NOT copied, the object takes ownership of the array and will free it later, the user cannot change or<br>
$                       delete the array. The array MUST have been obtained with PetscMalloc(). Hence this mode cannot be used in Fortran.<br>
$   PETSC_USE_POINTER - the array values are NOT copied, the object uses the array but does NOT take ownership of the array. The user cannot use<br>
                        the array but the user must delete the array after the object is destroyed.<br>
<br>
E*/<br>
typedef enum { PETSC_COPY_VALUES, PETSC_OWN_POINTER, PETSC_USE_POINTER} PetscCopyMode;<br>
extern const char *PetscCopyModes[];<br>
<br>
and merged  ISCreateGeneral/NC/WithArray() into a single routine with an additional PetscCopyMode argument.<br>
<br>
I have also merged ISLocalToGlobalMappingCreate() and ISLocalToGlobalMappingCreateNC() into a single routine.<br>
<br>
There may be other places we can use this paradigm in the future, keep your eyes open,<br>
<br>
  Happy computing,<br>
<font color="#888888"><br>
    Barry<br>
<br>
</font></blockquote></p>