Actual source code: petscpf.h

  1: /*
  2:       mathematical function module.
  3: */
  4: #pragma once

  6: #include <petscvec.h>

  8: /* MANSEC = Vec */
  9: /* SUBMANSEC = PF */

 11: /*
 12:     PFList contains the list of mathematical functions currently registered
 13:    These are added with PFRegister()
 14: */
 15: PETSC_EXTERN PetscFunctionList PFList;

 17: /*J
 18:     PFType - Type of PETSc mathematical function, a string name

 20:    Level: beginner

 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"

 32: /*S
 33:      PF - Abstract PETSc mathematical function that can be evaluated with `PFApply()` and may be constructed at run time (see `PFSTRING`)

 35:    Level: beginner

 37: .seealso: `PFCreate()`, `PFDestroy()`, `PFSetType()`, `PFApply()`, `PFApplyVec()`, `PFSet()`, `PFType`
 38: S*/
 39: typedef struct _p_PF *PF;

 41: PETSC_EXTERN PetscClassId PF_CLASSID;

 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);

 49: PETSC_EXTERN PetscErrorCode PFStringSetFunction(PF, const char *);

 51: PETSC_EXTERN PetscErrorCode PFInitializePackage(void);
 52: PETSC_EXTERN PetscErrorCode PFFinalizePackage(void);

 54: PETSC_EXTERN PetscErrorCode PFRegister(const char[], PetscErrorCode (*)(PF, void *));

 56: PETSC_EXTERN PetscErrorCode PFDestroy(PF *);
 57: PETSC_EXTERN PetscErrorCode PFSetFromOptions(PF);
 58: PETSC_EXTERN PetscErrorCode PFGetType(PF, PFType *);

 60: PETSC_EXTERN PetscErrorCode PFView(PF, PetscViewer);
 61: PETSC_EXTERN PetscErrorCode PFViewFromOptions(PF, PetscObject, const char[]);

 63: #define PFSetOptionsPrefix(a, s) PetscObjectSetOptionsPrefix((PetscObject)(a), s)