xref: /petsc/include/petscdstypes.h (revision 174dc0c8cee294b82b85e4dd3b331b29396264fc)
1 #pragma once
2 
3 #include <petscdmlabel.h>
4 
5 /* MANSEC = DM */
6 /* SUBMANSEC = DT */
7 
8 /*S
9   PetscDS - PETSc object that manages a discrete system, which is a set of discretizations + continuum equations from a `PetscWeakForm`
10 
11   Level: intermediate
12 
13 .seealso: `PetscDSCreate()`, `PetscDSSetType()`, `PetscDSType`, `PetscWeakForm`, `PetscFECreate()`, `PetscFVCreate()`
14 S*/
15 typedef struct _p_PetscDS *PetscDS;
16 
17 /*S
18   PetscWeakForm - PETSc object that manages a sets of pointwise functions defining a system of equations
19 
20   Level: intermediate
21 
22 .seealso: `PetscWeakFormCreate()`, `PetscDS`, `PetscFECreate()`, `PetscFVCreate()`
23 S*/
24 typedef struct _p_PetscWeakForm *PetscWeakForm;
25 
26 /*S
27   PetscFormKey - This key indicates how to use a set of pointwise functions defining part of a system of equations
28 
29   The subdomain on which to integrate is specified by (label, value), the test function field by (field), and the
30   piece of the equation by (part). For example, LHS = 0 and RHS = 1 in IMEX methods. More pieces can be present for
31   operator splitting methods.
32 
33   Level: intermediate
34 
35   Note:
36   This is a struct, not a `PetscObject`
37 
38 .seealso: `DMPlexSNESComputeResidualFEM()`, `DMPlexSNESComputeJacobianFEM()`, `DMPlexSNESComputeBoundaryFEM()`
39 S*/
40 typedef struct {
41   DMLabel  label; /* The (label, value) select a subdomain */
42   PetscInt value;
43   PetscInt field; /* Selects the field for the test function */
44   PetscInt part;  /* Selects the equation part. For example, LHS = 0 and RHS = 1 in IMEX methods. More pieces can be present for operator splitting methods. */
45 } PetscFormKey;
46 
47 /*E
48   PetscWeakFormKind - The kind of weak form. The specific forms are given in the documentation for the integraton functions.
49 
50   Values:
51 + OBJECTIVE                  - Objective form
52 . F0, F1                     - Residual forms
53 . G0, G1, G2, G3             - Jacobian forms
54 . GP0, GP1, GP2, GP3         - Jacobian preconditioner matrix forms
55 . GT0, GT1, GT2, GT3         - Dynamic Jacobian matrix forms
56 . BDF0, BDF1                 - Boundary Residual forms
57 . BDG0, BDG1, BDG2, BDG3     - Jacobian forms
58 . BDGP0, BDGP1, BDGP2, BDGP3 - Jacobian preconditioner matrix forms
59 . R                          - Riemann solver
60 - CEED                       - libCEED QFunction
61 
62   Level: beginner
63 
64 .seealso: `PetscWeakForm`, `PetscFEIntegrateResidual()`, `PetscFEIntegrateJacobian()`, `PetscFEIntegrateBdResidual()`, `PetscFEIntegrateBdJacobian()`,
65           `PetscFVIntegrateRHSFunction()`, `PetscWeakFormSetIndexResidual()`, `PetscWeakFormClearIndex()`
66 E*/
67 typedef enum {
68   PETSC_WF_OBJECTIVE,
69   PETSC_WF_F0,
70   PETSC_WF_F1,
71   PETSC_WF_G0,
72   PETSC_WF_G1,
73   PETSC_WF_G2,
74   PETSC_WF_G3,
75   PETSC_WF_GP0,
76   PETSC_WF_GP1,
77   PETSC_WF_GP2,
78   PETSC_WF_GP3,
79   PETSC_WF_GT0,
80   PETSC_WF_GT1,
81   PETSC_WF_GT2,
82   PETSC_WF_GT3,
83   PETSC_WF_BDF0,
84   PETSC_WF_BDF1,
85   PETSC_WF_BDG0,
86   PETSC_WF_BDG1,
87   PETSC_WF_BDG2,
88   PETSC_WF_BDG3,
89   PETSC_WF_BDGP0,
90   PETSC_WF_BDGP1,
91   PETSC_WF_BDGP2,
92   PETSC_WF_BDGP3,
93   PETSC_WF_R,
94   PETSC_WF_CEED,
95   PETSC_NUM_WF
96 } PetscWeakFormKind;
97 PETSC_EXTERN const char *const PetscWeakFormKinds[];
98 
99 typedef void (*PetscPointFunc)(PetscInt, PetscInt, PetscInt, const PetscInt[], const PetscInt[], const PetscScalar[], const PetscScalar[], const PetscScalar[], const PetscInt[], const PetscInt[], const PetscScalar[], const PetscScalar[], const PetscScalar[], PetscReal, const PetscReal[], PetscInt, const PetscScalar[], PetscScalar[]);
100 typedef void (*PetscPointJac)(PetscInt, PetscInt, PetscInt, const PetscInt[], const PetscInt[], const PetscScalar[], const PetscScalar[], const PetscScalar[], const PetscInt[], const PetscInt[], const PetscScalar[], const PetscScalar[], const PetscScalar[], PetscReal, PetscReal, const PetscReal[], PetscInt, const PetscScalar[], PetscScalar[]);
101 typedef void (*PetscBdPointFunc)(PetscInt, PetscInt, PetscInt, const PetscInt[], const PetscInt[], const PetscScalar[], const PetscScalar[], const PetscScalar[], const PetscInt[], const PetscInt[], const PetscScalar[], const PetscScalar[], const PetscScalar[], PetscReal, const PetscReal[], const PetscReal[], PetscInt, const PetscScalar[], PetscScalar[]);
102 typedef void (*PetscBdPointJac)(PetscInt, PetscInt, PetscInt, const PetscInt[], const PetscInt[], const PetscScalar[], const PetscScalar[], const PetscScalar[], const PetscInt[], const PetscInt[], const PetscScalar[], const PetscScalar[], const PetscScalar[], PetscReal, PetscReal, const PetscReal[], const PetscReal[], PetscInt, const PetscScalar[], PetscScalar[]);
103 typedef void (*PetscRiemannFunc)(PetscInt, PetscInt, const PetscReal[], const PetscReal[], const PetscScalar[], const PetscScalar[], PetscInt, const PetscScalar[], PetscScalar[], void *);
104 
105 /*S
106   PetscSimplePointFn - A prototype of a simple pointwise function that can be passed to, for example, `DMPlexTransformExtrudeSetNormalFunction()`
107 
108   Calling Sequence:
109 + dim  - The coordinate dimension of the original mesh (usually a surface)
110 . time - The current time, or 0.
111 . x    - The location of the current normal, in the coordinate space of the original mesh
112 . r    - The layer number of this point
113 . u    - The user provides the computed normal on output
114 - ctx  - An optional user context
115 
116   Level: beginner
117 
118   Note:
119   The deprecated `PetscSimplePointFunc` works as a replacement for `PetscSimplePointFn` *
120 
121 .seealso: `DMPlexTransformExtrudeSetNormalFunction()`
122 S*/
123 PETSC_EXTERN_TYPEDEF typedef PetscErrorCode(PetscSimplePointFn)(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt r, PetscScalar u[], void *ctx);
124 
125 PETSC_EXTERN_TYPEDEF typedef PetscSimplePointFn *PetscSimplePointFunc;
126