PetscObjectComposeFunction#
Associates a function with a given PETSc object.
Synopsis#
#include <petscsys.h>
PetscErrorCode PetscObjectComposeFunction(PetscObject obj,const char name[],void (*fptr)(void))
Logically Collective
Input Parameters#
obj - the PETSc object; this must be cast with a (
PetscObject
), for example,PetscObjectCompose
((PetscObject
)mat,…);name - name associated with the child function
fname - name of the function
fptr - function pointer
Notes#
When the first argument of the function is the object within which it has been composed then PetscTryMethod()
and PetscUseMethod()
can be used to call the function directly with error checking.
To remove a registered routine, pass in NULL for fptr().
PetscObjectComposeFunction() can be used with any PETSc object (such as
Mat
, Vec
, KSP
, SNES
, etc.) or any user-provided object.
PetscCallMethod()
is used to call a function that is stored in the objects obj->ops table.
See Also#
PetscObjectQueryFunction()
, PetscContainerCreate()
PetscObjectCompose()
, PetscObjectQuery()
, PetscTryMethod()
, PetscUseMethod()
,
PetscCallMethod()
Level#
advanced
Location#
Examples#
src/mat/tutorials/ex8.c.html
src/ksp/ksp/tutorials/ex73.c.html
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages