Mat A=0; if (A) MatDestroy(A); Satish
On Wed, 24 Oct 2007, Zhifeng Sheng wrote: > 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 > >
