[petsc-dev] The "type" field in PetscObject

Lisandro Dalcin dalcinl at gmail.com
Fri Nov 26 13:46:08 CST 2010

On 26 November 2010 15:55, Barry Smith <bsmith at mcs.anl.gov> wrote:
> On Nov 26, 2010, at 12:32 PM, Jed Brown wrote:
>> This seems to be equal to either 0 or -1 for every type in PETSc.  The comments for PetscHeaderCreate suggest that it no longer has any meaning, but we still have PetscCheckSameTypeAndComm.  What was the intent of this field?
>     Originally types were ints; that field has hung around ever since then. It is not used and should be removed. Then replaced with something better.
>>  Is it to have a faster way than strcmp to check whether two implementations match?
>    Not currently. We have PetscClassId and class_name. We could also have PetscTypeId and type_name in the PetscObject struct. When XXXRegisterDynamic() is called it could create a new PetscTypeId for the string name. When an XXXSetType() is called it could determine the Id based on the string name of the type set in (how to do this efficiently, would it search through a list of strings?) I think we should think about this a bit before doing it.

I would like to have PetscTypeId for use in petsc4py, specially after
Barry's DM/DA changes.

Lisandro Dalcin
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169

More information about the petsc-dev mailing list