[petsc-users] check if object was created

Jed Brown jedbrown at mcs.anl.gov
Sun Oct 2 10:35:41 CDT 2011


On Sun, Oct 2, 2011 at 04:46, Dominik Szczerba <dominik at itis.ethz.ch> wrote:

> if(object)
>   KSP/Mat/Vec/etcDestroy(object)
>

Just call KSPDestroy(&ksp);

It doesn't matter if KSP is NULL or a valid object because this function
checks. But note that if you just write

KSP ksp;

or allocate similarly in part of malloc() --- with no memzero() or similar
--- then the value of ksp is undefined.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111002/68af2179/attachment.htm>


More information about the petsc-users mailing list