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      depth;         /* The depth of the transformed mesh */
 35:   PetscInt     *depthStart;    /* The starting point for each depth stratum */
 36:   PetscInt     *depthEnd;      /* The starting point for the next depth stratum */
 37:   PetscInt     *trNv;          /* The number of transformed vertices in the closure of a cell of each type */
 38:   PetscScalar **trVerts;       /* The transformed vertex coordinates in the closure of a cell of each type */
 39:   PetscInt  ****trSubVerts;    /* The indices for vertices of subcell (rct, r) in a cell of each type */
 40:   PetscFE      *coordFE;       /* Finite element for each cell type, used for localized coordinate interpolation */
 41:   PetscFEGeom **refGeom;       /* Geometry of the reference cell for each cell type */
 42: };

 44: typedef struct {
 45:   PetscInt dummy;
 46: } DMPlexTransform_Filter;

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

 71: typedef struct {
 72:   PetscInt dummy;
 73: } DMPlexRefine_Regular;

 75: typedef struct {
 76:   PetscInt dummy;
 77: } DMPlexRefine_ToBox;

 79: typedef struct {
 80:   PetscInt dummy;
 81: } DMPlexRefine_Alfeld;

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

 89: typedef struct {
 90:   PetscInt dummy;
 91: } DMPlexRefine_1D;

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

104: PetscErrorCode DMPlexTransformSetDimensions_Internal(DMPlexTransform, DM, DM);
105: PetscErrorCode DMPlexTransformMapCoordinatesBarycenter_Internal(DMPlexTransform, DMPolytopeType, DMPolytopeType, PetscInt, PetscInt, PetscInt, PetscInt, const PetscScalar[], PetscScalar[]);
106: PetscErrorCode DMPlexTransformGetSubcellOrientation_Regular(DMPlexTransform, DMPolytopeType, PetscInt, PetscInt, DMPolytopeType, PetscInt, PetscInt, PetscInt *, PetscInt *);
107: PetscErrorCode DMPlexTransformCellRefine_Regular(DMPlexTransform, DMPolytopeType, PetscInt, PetscInt *, PetscInt *, DMPolytopeType *[], PetscInt *[], PetscInt *[], PetscInt *[]);

109: #endif