On Oct 3, 2010, at 5:58 PM, Jed Brown wrote:
> Can anyone think of a better mnemonic, I find PETSC_OWN_VALUES to be
> ambiguous without reading the man page?
It is PETSC_OWN_POINTER (so clearly it is ambiguous because you didn't read
the man page :-).
I agree with you about the mnemonic not being great, but couldn't come up
with something short and not using CS-slang like deep copy versus shallow
copy....
It could be PETSC_OWN_VALUES and PETSC_USE_VALUES instead of pointer ?
PETSC_TAKE_OWNERSHIP_OF_VALUES is too long.
Barry
>
> Jed
>
>
>> On Oct 3, 2010 7:57 PM, "Barry Smith" <bsmith at mcs.anl.gov> wrote:
>>
>>
>> I find the three routines ISCreateGeneral(), ISCreateGeneralNC() and
>> ISCreateGeneralWithArray() to be confusing and code redundant.
>>
>> Therefore in PETSc-dev I have introduced
>>
>> /*E
>> PetscCopyMode - Determines how an array passed to certain functions is
>> copied or retained
>>
>> Level: beginner
>>
>> $ PETSC_COPY_VALUES - the array values are copied into new space, the user
>> is free to reuse or delete the passed in array
>> $ 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
>> $ delete the array. The array MUST have been obtained
>> with PetscMalloc(). Hence this mode cannot be used in Fortran.
>> $ 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
>> the array but the user must delete the array after
>> the object is destroyed.
>>
>> E*/
>> typedef enum { PETSC_COPY_VALUES, PETSC_OWN_POINTER, PETSC_USE_POINTER}
>> PetscCopyMode;
>> extern const char *PetscCopyModes[];
>>
>> and merged ISCreateGeneral/NC/WithArray() into a single routine with an
>> additional PetscCopyMode argument.
>>
>> I have also merged ISLocalToGlobalMappingCreate() and
>> ISLocalToGlobalMappingCreateNC() into a single routine.
>>
>> There may be other places we can use this paradigm in the future, keep your
>> eyes open,
>>
>> Happy computing,
>>
>> Barry
>>
>