[petsc-users] check if object was created

Satish Balay balay at mcs.anl.gov
Sun Oct 2 08:30:38 CDT 2011


On Sun, 2 Oct 2011, Dominik Szczerba wrote:

> Is it OK to do:
> 
> KSP/Mat/Vec/etc object;

try

KSP/Mat/Vec/etc object=0;

Satish

> 
> if(object)
>    KSP/Mat/Vec/etcDestroy(object)
> 
> It other words, are default constructors initializing the object to
> NULL, or is there an other dedicated way to check if an object was
> actually allocated? I could not easily deduce it from the code...
> 
> Many thanks,
> Dominik
> 



More information about the petsc-users mailing list