1f97fa5f8SBarry Smith /* 23e3e4676SBarry Smith mathematical function module. 3f97fa5f8SBarry Smith */ 4a4963045SJacob Faibussowitsch #pragma once 5ac09b921SBarry Smith 62c8e378dSBarry Smith #include <petscvec.h> 7f97fa5f8SBarry Smith 8*ce78bad3SBarry Smith /* MANSEC = Vec */ 9ac09b921SBarry Smith /* SUBMANSEC = PF */ 10ac09b921SBarry Smith 11f97fa5f8SBarry Smith /* 1237e93019SBarry Smith PFList contains the list of mathematical functions currently registered 13bdf89e91SBarry Smith These are added with PFRegister() 14f97fa5f8SBarry Smith */ 1537e93019SBarry Smith PETSC_EXTERN PetscFunctionList PFList; 16f97fa5f8SBarry Smith 1776bdecfbSBarry Smith /*J 18b9617806SBarry Smith PFType - Type of PETSc mathematical function, a string name 19b9617806SBarry Smith 20b9617806SBarry Smith Level: beginner 21b9617806SBarry Smith 22db781477SPatrick Sanan .seealso: `PFSetType()`, `PF` 2376bdecfbSBarry Smith J*/ 2419fd82e9SBarry Smith typedef const char *PFType; 253e3e4676SBarry Smith #define PFCONSTANT "constant" 263e3e4676SBarry Smith #define PFMAT "mat" 273eda8832SBarry Smith #define PFSTRING "string" 283eda8832SBarry Smith #define PFQUICK "quick" 2974637425SBarry Smith #define PFIDENTITY "identity" 3074637425SBarry Smith #define PFMATLAB "matlab" 31f97fa5f8SBarry Smith 32b9617806SBarry Smith /*S 3316a05f60SBarry Smith PF - Abstract PETSc mathematical function that can be evaluated with `PFApply()` and may be constructed at run time (see `PFSTRING`) 34f97fa5f8SBarry Smith 35b9617806SBarry Smith Level: beginner 36b9617806SBarry Smith 37db781477SPatrick Sanan .seealso: `PFCreate()`, `PFDestroy()`, `PFSetType()`, `PFApply()`, `PFApplyVec()`, `PFSet()`, `PFType` 38b9617806SBarry Smith S*/ 39b9617806SBarry Smith typedef struct _p_PF *PF; 40b9617806SBarry Smith 41014dd563SJed Brown PETSC_EXTERN PetscClassId PF_CLASSID; 42f97fa5f8SBarry Smith 43014dd563SJed Brown PETSC_EXTERN PetscErrorCode PFCreate(MPI_Comm, PetscInt, PetscInt, PF *); 4419fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode PFSetType(PF, PFType, void *); 45014dd563SJed Brown PETSC_EXTERN PetscErrorCode PFSet(PF, PetscErrorCode (*)(void *, PetscInt, const PetscScalar *, PetscScalar *), PetscErrorCode (*)(void *, Vec, Vec), PetscErrorCode (*)(void *, PetscViewer), PetscErrorCode (*)(void *), void *); 46014dd563SJed Brown PETSC_EXTERN PetscErrorCode PFApply(PF, PetscInt, const PetscScalar *, PetscScalar *); 47014dd563SJed Brown PETSC_EXTERN PetscErrorCode PFApplyVec(PF, Vec, Vec); 48f97fa5f8SBarry Smith 49f236b2adSBarry Smith PETSC_EXTERN PetscErrorCode PFStringSetFunction(PF, const char *); 50f236b2adSBarry Smith 51607a6623SBarry Smith PETSC_EXTERN PetscErrorCode PFInitializePackage(void); 524bf303faSJacob Faibussowitsch PETSC_EXTERN PetscErrorCode PFFinalizePackage(void); 53f97fa5f8SBarry Smith 54bdf89e91SBarry Smith PETSC_EXTERN PetscErrorCode PFRegister(const char[], PetscErrorCode (*)(PF, void *)); 55f97fa5f8SBarry Smith 56014dd563SJed Brown PETSC_EXTERN PetscErrorCode PFDestroy(PF *); 57014dd563SJed Brown PETSC_EXTERN PetscErrorCode PFSetFromOptions(PF); 5819fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode PFGetType(PF, PFType *); 59f97fa5f8SBarry Smith 60014dd563SJed Brown PETSC_EXTERN PetscErrorCode PFView(PF, PetscViewer); 61fe2efc57SMark PETSC_EXTERN PetscErrorCode PFViewFromOptions(PF, PetscObject, const char[]); 62f97fa5f8SBarry Smith 633eda8832SBarry Smith #define PFSetOptionsPrefix(a, s) PetscObjectSetOptionsPrefix((PetscObject)(a), s) 64