[petsc-dev] inconsistency for its own sake?
Jed Brown
jedbrown at mcs.anl.gov
Sun Nov 25 03:58:58 CST 2012
On Sun, Nov 25, 2012 at 4:42 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> 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);
Can we revisit this choice in the interest of writing one man page that
documents the assumptions that one can make about a callback routine? I
hate duplicating the same information in TS{Set,Get}IFunction() and
DMTS{Set,Get}IFunction(). Also, if a typedef is used everywhere, we can
more reliably find all places that depend on it. (using grep or M-x
gtags-find-symbol).
> but why use them for TS but not for SNES or KSP functions?
>
Because they were already defined for use with
TSSetIFunction()/TSGetIFunction().
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20121125/2e172e9f/attachment.html>
More information about the petsc-dev
mailing list