Actual source code: meshimpl.h

  1: /* $Id: meshimpl.h,v 1.12 2000/10/17 13:48:54 knepley Exp $ */
  2: /*
  3:   This file includes the definition of structures used in PETSc for 
  4:   meshes. This should not be included in users' code.
  5: */

  7: #ifndef __MESHIMPL_H

 10:  #include petscsles.h
 11:  #include mesh.h

 13: struct _MeshOps {
 14:       /* Generic Operations */
 15:   int (*setup)(Mesh),
 16:       (*setfromoptions)(Mesh),
 17:       (*view)(Mesh, PetscViewer),
 18:       (*copy)(Mesh, Mesh),
 19:       (*duplicate)(Mesh, Mesh *),
 20:       (*destroy)(Mesh),
 21:       /* Mesh-Specific Operations */
 22:       (*partition)(Mesh),
 23:       (*coarsen)(Mesh, PointFunction, Mesh *),
 24:       (*refine)(Mesh, PointFunction, Mesh *),
 25:       (*resetnodes)(Mesh, PetscTruth),
 26:       (*savemesh)(Mesh),
 27:       (*restoremesh)(Mesh),
 28:       /* Mesh Query Functions */
 29:       (*updateboundingbox)(Mesh),
 30:       (*isdistorted)(Mesh, PetscTruth *),
 31:       /* Mesh Boundary Query Functions */
 32:       (*getboundarysize)(Mesh, int, int *),
 33:       (*getboundaryindex)(Mesh, int, int *),
 34:       (*getboundarystart)(Mesh, int, PetscTruth, int *),
 35:       (*getboundarynext)(Mesh, int, PetscTruth, int *),
 36:       (*getactiveboundary)(Mesh, int*),
 37:       /* Mesh Node Query Functions */
 38:       (*getnodeboundary)(Mesh, int, int *),
 39:       (*nodeisvertex)(Mesh, int, PetscTruth *),
 40:       (*getnodecoords)(Mesh, int, double *, double *, double *),
 41:       (*setnodecoords)(Mesh, int, double, double, double),
 42:       (*getnodecoordssaved)(Mesh, int, double *, double *, double *),
 43:       (*nearestnode)(Mesh, double, double, double, PetscTruth, int *),
 44:       (*getnodesupport)(Mesh, int, int, int *, int **),
 45:       /* Mesh Element Query Functions */
 46:       (*getelemneighbor)(Mesh, int, int, int *),
 47:       (*locatepoint)(Mesh, double, double, double, int *),
 48:       /* Mesh Embedding Query Functions */
 49:       (*getnodefromelement)(Mesh, int, int, int *),
 50:       (*getnodefromedge)(Mesh, int, int, int *),
 51:       /* CSR Support Functions */
 52:       (*createlocalcsr)(Mesh, int *, int *, int **, int **, double **, int, int *, PetscTruth),
 53:       (*createfullcsr)(Mesh, PetscTruth, int *, int *, int **, int **),
 54:       (*createdualcsr)(Mesh, int **, int **, int **, int);
 55: };

 57: struct _Mesh {
 58:   PETSCHEADER(struct _MeshOps)
 59:   int        dim;                             /* Dimension of the mesh: 1, 2 or 3 */
 60:   PetscTruth setupcalled;                     /* Flag for mesh setup */
 61:   void      *data;                            /* Holds implementation-specific information */
 62:   void      *usr;                             /* An optional user-context */

 64:   /* Domain information */
 65:   double     startX, startY, startZ;          /* Start of mesh bounding box, in periodic meshes these are input */
 66:   double     endX,   endY,   endZ;            /* End   of mesh bounding box, in periodic meshes these are input */
 67:   double     sizeX,  sizeY,  sizeZ;           /* Size  of mesh bounding box */
 68:   double     locStartX, locStartY, locStartZ; /* Start of local mesh bounding box, in periodic meshes these are input */
 69:   double     locEndX,   locEndY,   locEndZ;   /* End   of local mesh bounding box, in periodic meshes these are input */
 70:   double     locSizeX,  locSizeY,  locSizeZ;  /* Size  of local mesh bounding box */
 71:   PetscTruth isPeriodic;                      /* Flag for periodic meshes */
 72:   PetscTruth isPeriodicDim[3];                /* Flag for periodicity in a certain dimension */

 74:   /* Mesh boundary information */
 75:   MeshBoundary2D *bdCtx;                      /* Boundary of the mesh */
 76:   MeshBoundary2D *bdCtxNew;                   /* Boundary used for reforming */

 78:   /* Mesh generator information */
 79:   AO         nodeOrdering;                    /* A reordering of the nodes after they are output from the mesh generator */

 81:   /* Mesh information */
 82:   int        numBd;                           /* B:     Number of closed boundaries */
 83:   int        numVertices;                     /* V:     Number of points in the mesh */
 84:   int        numNodes;                        /* N:     Number of discretization points, V for linear elems, V+E for quadratic elems */
 85:   int        numBdNodes;                      /* NB:    Number of boundary nodes */
 86:   int        numEdges;                        /* E:     Number of edges in the mesh */
 87:   int        numBdEdges;                      /* EB:    Number of boundary edges in the mesh */
 88:   int        numFaces;                        /* F:     Number of triangles in the mesh */
 89:   int        numBdFaces;                      /* FB:    Number of boundary faces in the mesh */
 90:   int        numCells;                        /* C:     Number of volume elements in the mesh */
 91:   int        numHoles;                        /* H:     Number of holes */
 92:   int        numCorners;                      /* C':    Number of nodes on a face, 3 for a linear element, 6  for a quadratic element */
 93:   int        numCellCorners;                  /* C*:    Number of nodes on a cell, 4 for a linear element, 10 for a quadratic element */
 94:   int        maxDegree;                       /* MD:    The maximum degree of a vertex */
 95:   double    *holes;                           /* [dH]:  List of hole coordinates */

 97:   /* Iterator Constructs */
 98:   int        activeBd;                        /* Canonical number of boundary being iterated over */
 99:   int        activeBdOld;                     /* Canonical number of last boundary being iterated over */
100:   int        activeBdNode;                    /* Current boundary node in the iteration */
101:   int        activeBdNodeClass;               /* Class of current boundary node in the iteration (e.g. vertex or midnode) */

103:   /* Quality limits */
104:   PetscReal  maxAspectRatio;                  /* The largest allowable aspect ratio = (length of longest side)^2/(2 area) */

106:   /* Partitioning support */
107:   Partition  part;                            /* A partition of the mesh */
108:   int        partitioned;                     /* Flag for application of the current partition */

110:   /* Coarsening support */
111:   AO         coarseMap;                       /* Map of nodes to nodes in a finer mesh */

113:   /* Graphics support */
114:   int        highlightElement;                /* This local element will be highlighted in a display of the mesh */

116:   /* Support calculations */
117:   int       *support;                         /* [MD]: A preallocated array to hold the support of a vertex */
118:   PetscTruth supportTaken;                    /*       The support pointer has been taken */

120:   /* Movement support */
121:   PetscTruth isMoving;                        /* Flag for moving mesh */
122: };

124: /*-------------------------------------------------------------------------------------------------------------------*/

126: struct _PartitionOps {
127:       /* Generic Operations */
128:   int (*setup)(Partition),
129:       (*setfromoptions)(Partition),
130:       (*view)(Partition, PetscViewer),
131:       (*copy)(Partition, Partition),
132:       (*duplicate)(Partition,  Partition *),
133:       (*destroy)(Partition),
134:       /* Partition-Specific Operations */
135:       (*ghostnodeexchange)(Partition, InsertMode, ScatterMode, int *, int *),
136:       /* Node Query Functions */
137:       (*gettotalnodes)(Partition, int *),
138:       (*getstartnode)(Partition, int *),
139:       (*getendnode)(Partition, int *),
140:       (*getnumnodes)(Partition, int *),
141:       (*getnumoverlapnodes)(Partition, int *),
142:       (*globaltolocalnodeindex)(Partition, int, int *),
143:       (*localtoglobalnodeindex)(Partition, int, int *),
144:       (*globaltoghostnodeindex)(Partition, int, int *, int *),
145:       (*ghosttoglobalnodeindex)(Partition, int, int *, int *),
146:       (*getnodeordering)(Partition, AO *),
147:       /* Face Query Functions */
148:       (*gettotalfaces)(Partition, int *),
149:       (*getstartface)(Partition, int *),
150:       (*getendface)(Partition, int *),
151:       (*getnumfaces)(Partition, int *),
152:       (*getnumoverlapfaces)(Partition, int *),
153:       (*globaltolocalfaceindex)(Partition, int, int *),
154:       (*localtoglobalfaceindex)(Partition, int, int *),
155:       (*getfaceordering)(Partition, AO *),
156:       /* Edge Query Functions */
157:       (*gettotaledges)(Partition, int *),
158:       (*getstartedge)(Partition, int *),
159:       (*getendedge)(Partition, int *),
160:       (*getnumedges)(Partition, int *),
161:       (*getnumoverlapedges)(Partition, int *),
162:       (*globaltolocaledgeindex)(Partition, int, int *),
163:       (*localtoglobaledgeindex)(Partition, int, int *),
164:       (*getedgeordering)(Partition, AO *);
165: };

167: struct _Partition {
168:   PETSCHEADER(struct _PartitionOps)
169:   Mesh       mesh;                 /*        The mesh which was partitioned */
170:   int        setupcalled;          /*        The flag for partition setup */
171:   void      *data;                 /*        This holds implementation-specific information */
172:   int        numProcs;             /*        The number of processors in the communicator */
173:   int        rank;                 /*        The rank of this processor */
174:   /* Partitioning order */
175:   PetscTruth isElementPartitioned; /*        The flag indicating that the nodes have been partitioned */
176:   /* Element variables */
177:   AO         ordering;             /*        The reordering which implements the partition */
178:   int        numLocElements;       /*  LE:   The number of local elements */
179:   int        numElements;          /*   E:   The global number of elements */
180:   int        numOverlapElements;   /* LE+NG: The number of local + ghost elements */
181:   int       *firstElement;         /* [P+1]: The first element in each domain */
182:   int       *ghostElements;        /* [NG]:  The global number of each ghost element */
183:   int       *ghostElementProcs;    /* [NG]:  The domain of each ghost element */
184: };

186: #endif /* __MESHIMPL_H */