Actual source code: dmplextransformimpl.h

  1: #ifndef _PLEXTRANSFORMIMPL_H
  2: #define _PLEXTRANSFORMIMPL_H

  4: #include <petsc/private/dmpleximpl.h>
  5: #include <petscdmplextransform.h>

  7: typedef struct _p_DMPlexTransformOps *DMPlexTransformOps;
  8: struct _p_DMPlexTransformOps {
  9:   PetscErrorCode (*view)(DMPlexTransform, PetscViewer);
 10:   PetscErrorCode (*setfromoptions)(DMPlexTransform, PetscOptionItems *);
 11:   PetscErrorCode (*setup)(DMPlexTransform);
 12:   PetscErrorCode (*destroy)(DMPlexTransform);
 13:   PetscErrorCode (*setdimensions)(DMPlexTransform, DM, DM);
 14:   PetscErrorCode (*celltransform)(DMPlexTransform, DMPolytopeType, PetscInt, PetscInt *, PetscInt *, DMPolytopeType *[], PetscInt *[], PetscInt *[], PetscInt *[]);
 15:   PetscErrorCode (*getsubcellorientation)(DMPlexTransform, DMPolytopeType, PetscInt, PetscInt, DMPolytopeType, PetscInt, PetscInt, PetscInt *, PetscInt *);
 16:   PetscErrorCode (*mapcoordinates)(DMPlexTransform, DMPolytopeType, DMPolytopeType, PetscInt, PetscInt, PetscInt, PetscInt, const PetscScalar[], PetscScalar[]);
 17: };

 19: struct _p_DMPlexTransform {
 20:   PETSCHEADER(struct _p_DMPlexTransformOps);
 21:   void *data;

 23:   DM            dm;            /* This is the DM for which the transform has been computed */
 24:   DMLabel       active;        /* If not NULL, indicates points that are participating in the transform */
 25:   DMLabel       trType;        /* If not NULL, this holds the transformation type for each point */
 26:   PetscInt      setupcalled;   /* Flag to indicate the setup stage */
 27:   PetscInt     *ctOrderOld;    /* [i] = ct: An array with original cell types in depth order */
 28:   PetscInt     *ctOrderInvOld; /* [ct] = i: An array with the ordinal numbers for each original cell type */
 29:   PetscInt     *ctStart;       /* [ct]: The number for the first cell of each polytope type in the original mesh */
 30:   PetscInt     *ctOrderNew;    /* [i] = ct: An array with produced cell types in depth order */
 31:   PetscInt     *ctOrderInvNew; /* [ct] = i: An array with the ordinal numbers for each produced cell type */
 32:   PetscInt     *ctStartNew;    /* [ctNew]: The number for the first cell of each polytope type in the new mesh */
 33:   PetscInt     *offset;        /* [ct/rt][ctNew]: The offset from ctStartNew[ctNew] in the new point numbering of a point of type ctNew produced from an old point of type ct or refine type rt */
 34:   PetscInt     *trNv;          /* The number of transformed vertices in the closure of a cell of each type */
 35:   PetscScalar **trVerts;       /* The transformed vertex coordinates in the closure of a cell of each type */
 36:   PetscInt  ****trSubVerts;    /* The indices for vertices of subcell (rct, r) in a cell of each type */
 37:   PetscFE      *coordFE;       /* Finite element for each cell type, used for localized coordinate interpolation */
 38:   PetscFEGeom **refGeom;       /* Geometry of the reference cell for each cell type */
 39: };

 41: typedef struct {
 42:   DMLabel label; /* This marks the points to be deleted/ignored */
 43: } DMPlexTransform_Filter;

 45: typedef struct {
 46:   /* Inputs */
 47:   PetscInt             dimEx;       /* The dimension of the extruded mesh */
 48:   PetscInt             cdim;        /* The coordinate dimension of the input mesh */
 49:   PetscInt             cdimEx;      /* The coordinate dimension of the extruded mesh */
 50:   PetscInt             layers;      /* The number of extruded layers */
 51:   PetscReal            thickness;   /* The total thickness of the extruded layers */
 52:   PetscInt             Nth;         /* The number of specified thicknesses */
 53:   PetscReal           *thicknesses; /* The input layer thicknesses */
 54:   PetscBool            useTensor;   /* Flag to create tensor cells */
 55:   PetscBool            useNormal;   /* Use input normal instead of calculating it */
 56:   PetscReal            normal[3];   /* Surface normal from input */
 57:   PetscSimplePointFunc normalFunc;  /* A function returning the normal at a given point */
 58:   PetscBool            symmetric;   /* Extrude layers symmetrically about the surface */
 59:   /* Calculated quantities */
 60:   PetscReal       *layerPos; /* The position of each layer relative to the original surface, along the local normal direction */
 61:   PetscInt        *Nt;       /* The array of the number of target types */
 62:   DMPolytopeType **target;   /* The array of target types */
 63:   PetscInt       **size;     /* The array of the number of each target type */
 64:   PetscInt       **cone;     /* The array of cones for each target cell */
 65:   PetscInt       **ornt;     /* The array of orientation for each target cell */
 66: } DMPlexTransform_Extrude;

 68: typedef struct {
 69:   PetscInt dummy;
 70: } DMPlexRefine_Regular;

 72: typedef struct {
 73:   PetscInt dummy;
 74: } DMPlexRefine_ToBox;

 76: typedef struct {
 77:   PetscInt dummy;
 78: } DMPlexRefine_Alfeld;

 80: typedef struct {
 81:   DMLabel      splitPoints; /* List of edges to be bisected (1) and cells to be divided (2) */
 82:   PetscSection secEdgeLen;  /* Section for edge length field */
 83:   PetscReal   *edgeLen;     /* Storage for edge length field */
 84: } DMPlexRefine_SBR;

 86: typedef struct {
 87:   PetscInt dummy;
 88: } DMPlexRefine_1D;

 90: typedef struct {
 91:   PetscInt         n;      /* The number of divisions to produce, so n = 1 gives 2 new cells */
 92:   PetscReal        r;      /* The factor increase for cell height */
 93:   PetscScalar     *h;      /* The computed cell heights, based on r */
 94:   PetscInt        *Nt;     /* The array of the number of target types */
 95:   DMPolytopeType **target; /* The array of target types */
 96:   PetscInt       **size;   /* The array of the number of each target type */
 97:   PetscInt       **cone;   /* The array of cones for each target cell */
 98:   PetscInt       **ornt;   /* The array of orientation for each target cell */
 99: } DMPlexRefine_BL;

101: PetscErrorCode DMPlexTransformMapCoordinatesBarycenter_Internal(DMPlexTransform, DMPolytopeType, DMPolytopeType, PetscInt, PetscInt, PetscInt, PetscInt, const PetscScalar[], PetscScalar[]);
102: PetscErrorCode DMPlexTransformGetSubcellOrientation_Regular(DMPlexTransform, DMPolytopeType, PetscInt, PetscInt, DMPolytopeType, PetscInt, PetscInt, PetscInt *, PetscInt *);
103: PetscErrorCode DMPlexTransformCellRefine_Regular(DMPlexTransform, DMPolytopeType, PetscInt, PetscInt *, PetscInt *, DMPolytopeType *[], PetscInt *[], PetscInt *[], PetscInt *[]);

105: #endif