[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Validate a Object



Dear all

I am programming a simulator with PetSc, and I need to create matrix and vector which shall be destoried in the end.

However, the problem is : sometimes, a matrix is declared but never created, and if I try to destory this object, Petsc would dump error.

Is there anyway to check whether a Mat or Vec has been created or not?


e.g


Mat A;
MatDestory A; // this will dump error, which function should I use to check whether A is created?


Thank you.
Best regards
Zhifeng Sheng