PetscObjectNullify#

sets a PETSc object, such as Vec, back to the state it had when it was declared, so it can be used in a creation routine, such as VecCreate() Fortran only

Synopsis#

#include <petsc/finclude/petscsys.h>
PetscObjectNullify(PetscObject obj)

Logically Collective

Input Parameter#

  • obj - the PETSc object

Example Usage#

  Vec x, y

  VecCreate(PETSC_COMM_WORLD, x, ierr)
  ...
  y = x
  ...
  PetscObjectNullify(y)

You should not call VecDestroy() on y because that will destroy x since the assignment y = x does not increase the reference count of x

Note#

Code such as

  y = PETSC_NULL_VEC

is not allowed.

See Also#

PetscObject, PETSC_NULL_OBJECT, PETSC_NULL_VEC, PETSC_NULL_VEC_ARRAY, PetscObjectIsNull()

Level#

beginner

Location#

src/sys/objects/inherit.c


Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages