1 /* 2 mathematical function module. 3 */ 4 #pragma once 5 6 #include <petscvec.h> 7 8 /* SUBMANSEC = PF */ 9 10 /* 11 PFList contains the list of mathematical functions currently registered 12 These are added with PFRegister() 13 */ 14 PETSC_EXTERN PetscFunctionList PFList; 15 16 /*J 17 PFType - Type of PETSc mathematical function, a string name 18 19 Level: beginner 20 21 .seealso: `PFSetType()`, `PF` 22 J*/ 23 typedef const char *PFType; 24 #define PFCONSTANT "constant" 25 #define PFMAT "mat" 26 #define PFSTRING "string" 27 #define PFQUICK "quick" 28 #define PFIDENTITY "identity" 29 #define PFMATLAB "matlab" 30 31 /*S 32 PF - Abstract PETSc mathematical function that can be evaluated with `PFApply()` and may be constructed at run time (see `PFSTRING`) 33 34 Level: beginner 35 36 .seealso: `PFCreate()`, `PFDestroy()`, `PFSetType()`, `PFApply()`, `PFApplyVec()`, `PFSet()`, `PFType` 37 S*/ 38 typedef struct _p_PF *PF; 39 40 PETSC_EXTERN PetscClassId PF_CLASSID; 41 42 PETSC_EXTERN PetscErrorCode PFCreate(MPI_Comm, PetscInt, PetscInt, PF *); 43 PETSC_EXTERN PetscErrorCode PFSetType(PF, PFType, void *); 44 PETSC_EXTERN PetscErrorCode PFSet(PF, PetscErrorCode (*)(void *, PetscInt, const PetscScalar *, PetscScalar *), PetscErrorCode (*)(void *, Vec, Vec), PetscErrorCode (*)(void *, PetscViewer), PetscErrorCode (*)(void *), void *); 45 PETSC_EXTERN PetscErrorCode PFApply(PF, PetscInt, const PetscScalar *, PetscScalar *); 46 PETSC_EXTERN PetscErrorCode PFApplyVec(PF, Vec, Vec); 47 48 PETSC_EXTERN PetscErrorCode PFStringSetFunction(PF, const char *); 49 50 PETSC_EXTERN PetscErrorCode PFInitializePackage(void); 51 PETSC_EXTERN PetscErrorCode PFFinalizePackage(void); 52 53 PETSC_EXTERN PetscErrorCode PFRegister(const char[], PetscErrorCode (*)(PF, void *)); 54 55 PETSC_EXTERN PetscErrorCode PFDestroy(PF *); 56 PETSC_EXTERN PetscErrorCode PFSetFromOptions(PF); 57 PETSC_EXTERN PetscErrorCode PFGetType(PF, PFType *); 58 59 PETSC_EXTERN PetscErrorCode PFView(PF, PetscViewer); 60 PETSC_EXTERN PetscErrorCode PFViewFromOptions(PF, PetscObject, const char[]); 61 62 #define PFSetOptionsPrefix(a, s) PetscObjectSetOptionsPrefix((PetscObject)(a), s) 63