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