src/ts/examples/tests/ex5_adolc.cpp
static PetscErrorCode IJacobianDestroy(Mat A)
{
  IJacobianctx   *mctx;
  PetscErrorCode ierr;

  PetscFunctionBeginUser;
  ierr = MatShellGetContext(A,(void**)&mctx);CHKERRQ(ierr);
  ierr = PetscFree(mctx);CHKERRQ(ierr);
  PetscFunctionReturn(0);
}
/* we lazily attach contexts to the shell matrices
   each will own its context */
we lazily attach contexts to the shell matrices
each will own its context
we lazily attach contexts to the shell matrices each will own its context
static PetscErrorCode IJacobianDestroy(Mat A)
{
  IJacobianctx   *mctx;
  PetscErrorCode ierr;
  PetscFunctionBeginUser;
  ierr = MatShellGetContext(A,(void**)&mctx);CHKERRQ(ierr);
  ierr = PetscFree(mctx);CHKERRQ(ierr);
  PetscFunctionReturn(0);
}
static PetscErrorCode IJacobianDestroy ( Mat A ) { IJacobianctx * mctx ; PetscErrorCode ierr ; PetscFunctionBeginUser ; ierr = MatShellGetContext ( A , ( void * * ) & mctx ) ; CHKERRQ ( ierr ) ; ierr = PetscFree ( mctx ) ; CHKERRQ ( ierr ) ; PetscFunctionReturn ( 0 ) ; }
we lazily attach contexts to the shell matrices
each will own its context
we lazily attach contexts to the shell matrices each will own its context