[petsc-dev] MatSetDA -> MatSetDM

Barry Smith bsmith at mcs.anl.gov
Thu Mar 17 09:28:39 CDT 2011


On Mar 17, 2011, at 7:19 AM, Lisandro Dalcin wrote:

> On 16 March 2011 23:27, Barry Smith <bsmith at mcs.anl.gov> wrote:
>> 
>> 
>>   No. Then we need VecGetComm(), KSPGetComm(), MonkeyGetComm() and it never ends
>> 
> 
> Yes, I know...
> 
>>   Perhaps
>> 
>>   PetscErrorCode PetscObjectGetComm_(PetscObject,MPI_Comm*);
>>   #define PetscObjectGetComm(A,B) PetscObjectGetComm_((PetscObject)A,B)
>> 
>>   to hide the uglyness?
>> 
> 
> The problem with this is that you effectively loose type checking...
> You can PetscObjectGetComm() with whatever crap, and you do not notice
> until runtime.

   But doing the cast yourself also removes the type checking:   PetscObjectGetComm((PetscObject)vec,&comm);   I can pass anything in for vec (like a pointer to an integer) and the type is not checked.

   Not having the type checking in PetscObjectGetComm() doesn't really bother me since it is pretty obvious that a PetscObject must be passed in; plus there is the run time checking. 

   Barry

> 
>>   In fact, XXXXSetOptionsPrefix() could be all wrapped up in PetscObjectSetOptionsPrefix(). Heck even XXXSetFromOptions() and XXXSetUp() could be wrapped in PetscObjectSetFromOptions(), PetscObjectSetUp() but that may be going too far :-)
>> 
> 
> Well, you have a very valid point, but as I said, PetscObjectXXX()
> calls are nasty to use and you loose type checking... What about
> providing XXSetup(), XXXGetComm(), XXXSetFromOptions(), and any other
> important enough as STATIC_INLINE functions being a thin wrapper to
> the corresponding PetscObjectXXX() ?
> 
> 
> -- 
> Lisandro Dalcin
> ---------------
> CIMEC (INTEC/CONICET-UNL)
> Predio CONICET-Santa Fe
> Colectora RN 168 Km 472, Paraje El Pozo
> 3000 Santa Fe, Argentina
> Tel: +54-342-4511594 (ext 1011)
> Tel/Fax: +54-342-4511169




More information about the petsc-dev mailing list