# HG changeset patch # User Jed Brown # Date 1362324032 21600 # Node ID 6e14df3a9b8f008fe8b70feb69aa36ac31f670f6 # Parent 843a1e745f4adac5c560ae71c339edcdf578acae dmshell: Fix dispatch for fortran callbacks * PetscObjectUseFortranCallbackSubType for subtype dispatch * Object types are also passed by reference * Correct copy/paste error with ourlocaltoglobalbegin/end diff --git a/src/dm/impls/shell/ftn-custom/zdmshellf.c b/src/dm/impls/shell/ftn-custom/zdmshellf.c --- a/src/dm/impls/shell/ftn-custom/zdmshellf.c +++ b/src/dm/impls/shell/ftn-custom/zdmshellf.c @@ -44,8 +44,8 @@ type = PETSC_NULL_CHARACTER_Fortran; len = 0; } - PetscObjectUseFortranCallback(dm,_cb.creatematrix,(DM*,CHAR PETSC_MIXED_LEN_PROTO,Mat*,PetscErrorCode* PETSC_END_LEN_PROTO), - (&dm,ftype PETSC_MIXED_LEN_CALL(len),A,&ierr PETSC_END_LEN_CALL(len))); + PetscObjectUseFortranCallbackSubType(dm,_cb.creatematrix,(DM*,CHAR PETSC_MIXED_LEN_PROTO,Mat*,PetscErrorCode* PETSC_END_LEN_PROTO), + (&dm,ftype PETSC_MIXED_LEN_CALL(len),A,&ierr PETSC_END_LEN_CALL(len))); return 0; } @@ -53,7 +53,7 @@ #define __FUNCT__ "ourcreateglobalvector" static PetscErrorCode ourcreateglobalvector(DM dm,Vec *v) { - PetscObjectUseFortranCallback(dm,_cb.createglobalvector,(DM*,Vec*,PetscErrorCode*),(&dm,v,&ierr)); + PetscObjectUseFortranCallbackSubType(dm,_cb.createglobalvector,(DM*,Vec*,PetscErrorCode*),(&dm,v,&ierr)); return 0; } @@ -61,7 +61,7 @@ #define __FUNCT__ "ourcreatelocalvector" static PetscErrorCode ourcreatelocalvector(DM dm,Vec *v) { - PetscObjectUseFortranCallback(dm,_cb.createlocalvector,(DM*,Vec*,PetscErrorCode*),(&dm,v,&ierr)); + PetscObjectUseFortranCallbackSubType(dm,_cb.createlocalvector,(DM*,Vec*,PetscErrorCode*),(&dm,v,&ierr)); return 0; } @@ -69,7 +69,7 @@ #define __FUNCT__ "ourglobaltolocalbegin" static PetscErrorCode ourglobaltolocalbegin(DM dm,Vec g,InsertMode mode,Vec l) { - PetscObjectUseFortranCallback(dm,_cb.globaltolocalbegin,(DM*,Vec*,InsertMode*,Vec*,PetscErrorCode*),(&dm,g,&mode,l,&ierr)); + PetscObjectUseFortranCallbackSubType(dm,_cb.globaltolocalbegin,(DM*,Vec*,InsertMode*,Vec*,PetscErrorCode*),(&dm,&g,&mode,&l,&ierr)); return 0; } @@ -77,7 +77,7 @@ #define __FUNCT__ "ourglobaltolocalend" static PetscErrorCode ourglobaltolocalend(DM dm,Vec g,InsertMode mode,Vec l) { - PetscObjectUseFortranCallback(dm,_cb.globaltolocalend,(DM*,Vec*,InsertMode*,Vec*,PetscErrorCode*),(&dm,g,&mode,l,&ierr)); + PetscObjectUseFortranCallbackSubType(dm,_cb.globaltolocalend,(DM*,Vec*,InsertMode*,Vec*,PetscErrorCode*),(&dm,&g,&mode,&l,&ierr)); return 0; } @@ -85,7 +85,7 @@ #define __FUNCT__ "ourlocaltoglobalbegin" static PetscErrorCode ourlocaltoglobalbegin(DM dm,Vec l,InsertMode mode,Vec g) { - PetscObjectUseFortranCallback(dm,_cb.localtoglobalbegin,(DM*,Vec*,InsertMode*,Vec*,PetscErrorCode*),(&dm,l,&mode,g,&ierr)); + PetscObjectUseFortranCallbackSubType(dm,_cb.localtoglobalbegin,(DM*,Vec*,InsertMode*,Vec*,PetscErrorCode*),(&dm,&l,&mode,&g,&ierr)); return 0; } @@ -93,7 +93,7 @@ #define __FUNCT__ "ourlocaltoglobalend" static PetscErrorCode ourlocaltoglobalend(DM dm,Vec l,InsertMode mode,Vec g) { - PetscObjectUseFortranCallback(dm,_cb.localtoglobalend,(DM*,Vec*,InsertMode*,Vec*,PetscErrorCode*),(&dm,l,&mode,g,&ierr)); + PetscObjectUseFortranCallbackSubType(dm,_cb.localtoglobalend,(DM*,Vec*,InsertMode*,Vec*,PetscErrorCode*),(&dm,&l,&mode,&g,&ierr)); return 0; } @@ -133,5 +133,5 @@ if (*ierr) return; *ierr = PetscObjectSetFortranCallback((PetscObject)*dm,PETSC_FORTRAN_CALLBACK_SUBTYPE,&_cb.localtoglobalend,(PetscVoidFunction)end,NULL); if (*ierr) return; - *ierr = DMShellSetLocalToGlobal(*dm,ourglobaltolocalbegin,ourglobaltolocalend); + *ierr = DMShellSetLocalToGlobal(*dm,ourlocaltoglobalbegin,ourlocaltoglobalend); }