[petsc-dev] inconsistency for its own sake?

Barry Smith bsmith at mcs.anl.gov
Sat Nov 24 21:42:27 CST 2012


typedef struct _n_KSPDM *KSPDM;
struct _n_KSPDM {
  PetscErrorCode (*computeoperators)(KSP,Mat,Mat,MatStructure*,void*);
  PetscErrorCode (*computerhs)(KSP,Vec,void*);
  PetscErrorCode (*computeinitialguess)(KSP,Vec,void*);

typedef struct _n_SNESDM *SNESDM;
struct _n_SNESDM {
  PetscErrorCode (*computefunction)(SNES,Vec,Vec,void*);
  PetscErrorCode (*computegs)(SNES,Vec,Vec,void*);
  PetscErrorCode (*computejacobian)(SNES,Vec,Mat*,Mat*,MatStructure*,void*);

  /* objective */
  PetscErrorCode (*computeobjective)(SNES,Vec,PetscReal*,void*);


typedef struct _n_TSDM *TSDM;
struct _n_TSDM {
  TSRHSFunction rhsfunction;
  TSRHSJacobian rhsjacobian;

  TSIFunction ifunction;
  TSIJacobian ijacobian;

The PETSc style guide says  to avoid typedef of function pointers unless there is a damn good reason to use them (or it should); but why use them for TS but not for SNES or KSP functions?





More information about the petsc-dev mailing list