Date: 2026-06-01T23:13:16+00:00

Actual source code: petscdmfield.h

      1: #pragma once

      3: #include <petscdm.h>
      4: #include <petscdt.h>
      5: #include <petscfe.h>

      7: /* SUBMANSEC = DM */

      9: PETSC_EXTERN PetscErrorCode DMFieldInitializePackage(void);
     10: PETSC_EXTERN PetscErrorCode DMFieldFinalizePackage(void);

     12: PETSC_EXTERN PetscClassId DMFIELD_CLASSID;

     14: /*J
     15:   DMFieldType - String with the name of a `DMField` implementation

     17:   Values:
     18: + `DMFIELDDA`    - a field defined only by its values at the corners of a `DMDA`
     19: . `DMFIELDDS`    - a field defined by a discretization over a mesh set with `DMSetField()`
     20: - `DMFIELDSHELL` - a field defined by arbitrary callbacks

     22:   Level: intermediate

     24: .seealso: [](ch_dmbase), `DMField`, `DMFieldSetType()`, `DMFieldGetType()`, `DMFieldRegister()`
     25: J*/
     26: typedef const char *DMFieldType;
     27: #define DMFIELDDA    "da"
     28: #define DMFIELDDS    "ds"
     29: #define DMFIELDSHELL "shell"

     31: PETSC_EXTERN PetscFunctionList DMFieldList;
     32: PETSC_EXTERN PetscErrorCode    DMFieldSetType(DMField, DMFieldType);
     33: PETSC_EXTERN PetscErrorCode    DMFieldGetType(DMField, DMFieldType *);
     34: PETSC_EXTERN PetscErrorCode    DMFieldRegister(const char[], PetscErrorCode (*)(DMField));

     36: typedef enum {
     37:   DMFIELD_VERTEX,
     38:   DMFIELD_EDGE,
     39:   DMFIELD_FACET,
     40:   DMFIELD_CELL
     41: } DMFieldContinuity;
     42: PETSC_EXTERN const char *const DMFieldContinuities[];

     44: PETSC_EXTERN PetscErrorCode DMFieldDestroy(DMField *);
     45: PETSC_EXTERN PetscErrorCode DMFieldView(DMField, PetscViewer);

     47: PETSC_EXTERN PetscErrorCode DMFieldGetDM(DMField, DM *);
     48: PETSC_EXTERN PetscErrorCode DMFieldGetNumComponents(DMField, PetscInt *);

     50: PETSC_EXTERN PetscErrorCode DMFieldEvaluate(DMField, Vec, PetscDataType, void *, void *, void *);
     51: PETSC_EXTERN PetscErrorCode DMFieldEvaluateFE(DMField, IS, PetscQuadrature, PetscDataType, void *, void *, void *);
     52: PETSC_EXTERN PetscErrorCode DMFieldEvaluateFV(DMField, IS, PetscDataType, void *, void *, void *);
     53: PETSC_EXTERN PetscErrorCode DMFieldCreateFEGeom(DMField, IS, PetscQuadrature, PetscFEGeomMode, PetscFEGeom **);

     55: PETSC_EXTERN PetscErrorCode DMFieldCreateDefaultQuadrature(DMField, IS, PetscQuadrature *);
     56: PETSC_EXTERN PetscErrorCode DMFieldCreateDefaultFaceQuadrature(DMField, IS, PetscQuadrature *);

     58: PETSC_EXTERN PetscErrorCode DMFieldGetDegree(DMField, IS, PetscInt *, PetscInt *);

     60: PETSC_EXTERN PetscErrorCode DMFieldCreateDA(DM, PetscInt, const PetscScalar *, DMField *);
     61: PETSC_EXTERN PetscErrorCode DMFieldCreateDS(DM, PetscInt, Vec, DMField *);
     62: PETSC_EXTERN PetscErrorCode DMFieldCreateDSWithDG(DM, DM, PetscInt, Vec, Vec, DMField *);

     64: PETSC_EXTERN PetscErrorCode DMFieldCreateShell(DM, PetscInt, DMFieldContinuity, PetscCtx, DMField *);
     65: PETSC_EXTERN PetscErrorCode DMFieldShellSetDestroy(DMField, PetscErrorCode (*)(DMField));
     66: PETSC_EXTERN PetscErrorCode DMFieldShellGetContext(DMField, PetscCtxRt);
     67: PETSC_EXTERN PetscErrorCode DMFieldShellSetEvaluate(DMField, PetscErrorCode (*)(DMField, Vec, PetscDataType, void *, void *, void *));
     68: PETSC_EXTERN PetscErrorCode DMFieldShellSetEvaluateFE(DMField, PetscErrorCode (*)(DMField, IS, PetscQuadrature, PetscDataType, void *, void *, void *));
     69: PETSC_EXTERN PetscErrorCode DMFieldShellEvaluateFEDefault(DMField, IS, PetscQuadrature, PetscDataType, void *, void *, void *);
     70: PETSC_EXTERN PetscErrorCode DMFieldShellSetEvaluateFV(DMField, PetscErrorCode (*)(DMField, IS, PetscDataType, void *, void *, void *));
     71: PETSC_EXTERN PetscErrorCode DMFieldShellEvaluateFVDefault(DMField, IS, PetscDataType, void *, void *, void *);
     72: PETSC_EXTERN PetscErrorCode DMFieldShellSetGetDegree(DMField, PetscErrorCode (*)(DMField, IS, PetscInt *, PetscInt *));
     73: PETSC_EXTERN PetscErrorCode DMFieldShellSetCreateDefaultQuadrature(DMField, PetscErrorCode (*)(DMField, IS, PetscQuadrature *));