📄 sxgridint.h
字号:
/*\begin{comment}$Id: sxgridint.h,v 2.14 2000/07/26 13:32:45 fuhrmann Exp $This file describes the interface between sxgrid and grid managers.To be able to access the data in SimplexData without too much function call overhead, it is included by sxgrid.h as well. */#ifndef SXGRIDINT_H#define SXGRIDINT_H#ifndef wzgrid_hxx#include "stdsys/adjacency.h"#endif/*\end{comment}*//* the offsets for coordinates: */#define SX_X 1#define SX_Y 2#define SX_Z 3#define sxMaxSpaceDimension 3#define sxMaxNodesPerCell 4#define sxMaxEdgesPerCell 6#define sxMaxFacesPerCell 4#define sxNameLength 256 /*\subsubsection{Data sizes, forward declarations}\func{sxCoordinates}*/typedef double *sxCoordinates;/*\func{sxCoordsysType}*/typedef enum{ sxCartesian, sxCylindric, sxCoordsysTypes}sxCoordsysType;/*\func{sxIteratorType}*/typedef enum{ sxCells, sxNodes, sxEdges, sxFaces, sxBoundaryFaces, sxIteratorTypes}sxIteratorType;/*\func{sxGrid}*/typedef struct sxGridStruct *sxGrid,sxGridData;/*This is the data structure which holds all information about agrid. -- see \xref{sxCreate}. Users of the interface shouldconsider this to be hidden. Note that even the size of thegrid-generator internal part is hidden.The \xref{sxSimplex} structure contains also a pointer to grid-generatorinternal iterator data which is also hidden. *//*\func{sxSimplexData}*/typedef struct sxSimplexDataStruct *sxSimplex,sxSimplexData;/*\begin{comment}We sxPrivateSimplexDataStruct is used for internal purposes of the interface module.It should not be accessed directly.*/struct sxPrivateSimplexStruct{ void (*FVMFactors)(double *coord, int *cellnodes, double *cpar, double *npar, double *epar); void (*FEMFactors)(double *coord, int *cellnodes, double *cpar, double *npar, double *epar, double *gshape); void (*FVEMFactors)(double *coord, int *cellnodes, double *cpar, double *npar, double *epar, double *gshape); void (*setEdges)(sxGrid g,sxSimplex sx); void (*setFaces)(sxGrid g,sxSimplex sx); int node_space[sxMaxNodesPerCell+1]; /* to avoid malloc for nodes */ int edge_space[sxMaxEdgesPerCell+1]; /* to avoid malloc for edges */ int face_space[sxMaxFacesPerCell+1]; /* to avoid malloc for faces */ double coord_space[sxMaxNodesPerCell*sxMaxSpaceDimension+1]; /*necessary for current FVMFactor link*/ int *coord_nodes; int coord_node_space[sxMaxNodesPerCell+1]; double *coord_ptr; double stiffmat_space[(sxMaxNodesPerCell+1)*(sxMaxNodesPerCell+1)]; double massmat_space[(sxMaxNodesPerCell+1)*(sxMaxNodesPerCell+1)]; void *internal; /* points to your internal iterator */ struct sxGridStruct *grid; /* obsolete (to save sxStop) */};/*\end{comment}*/struct sxSimplexDataStruct{ /* these data change in every iteration: */ int index; /* global index */ int *node; /* global indices of adjacent nodes */ int *edge; /* global indices of adjacent edges */ int *face; /* global indices of adjacent faces */ int material; sxCoordinates coordinates[sxMaxNodesPerCell+1]; /* these data remain constant for the whole loop: */ sxIteratorType iterator_type; int spaceDimension; /* space dimension */ int dimension; /* dimension of simplex */ int codimension; /* codimension of simplex (spacedim - dim) */ int numberOfNodes; /* number of nodes of simplex */ int numberOfEdges; /* number of edges of simplex */ int numberOfFaces; /* number of faces of simplex */ int numberOfFaceNodes; /*number of Nodes per face */ int numberOfEdgeNodes; /*number of nodes per edge */ int edgeNodes[sxMaxEdgesPerCell+1][sxMaxNodesPerCell+1]; /* internal indices of nodes of adjacent edges */ int faceNodes[sxMaxFacesPerCell+1][sxMaxNodesPerCell+1]; /* internal indices of nodes of adjacent faces */ double discreteGradient[sxMaxNodesPerCell+1][sxMaxSpaceDimension+1]; int (*setSimplexData)(sxGrid g,sxSimplex sx);/* set Simplex data */ /* storage for application-dependent data */ double volume; double nodeFactors[sxMaxNodesPerCell+1]; double edgeFactors[sxMaxEdgesPerCell+1]; double *massMatrix[sxMaxNodesPerCell+1]; double *stiffnessMatrix[sxMaxNodesPerCell+1]; struct sxPrivateSimplexStruct priv;};/*SimplexData is a ''data shuttle'' which is used to transportinformation about the mesh simplices during the loops. *//*\func{sxInitEdges}*/void sxInitEdges(sxGrid g);/*Initialize cell-edge adjacency calculations on the mesh.*//*\func{sxInitFaces}*/void sxInitFaces(sxGrid g);/*Initialize cell-face adjacency calculations on the mesh.*//*\func{sxSetEdges}*/void sxSetEdges(sxGrid g, sxSimplex sx);/*Set {\tt sx->edges}*//*\func{sxSetFaces}*/void sxSetFaces(sxGrid g, sxSimplex sx);/*Set {\tt sx->faces}*//*%----------------------------------------------------------*//*\subsection{Simplex Loops}*//*The macro {\tt SX\_LOOP} is used to define a loop over components(cells, faces, edges, nodes, boundary faces) of the simplex mesh. Itis designed to be the only way to ''load'' simplex data.*//*\begin{comment}*/#define sxEndOfLoop 0#define sxDefined 1#define sxLoop(sxg,sx,what) for(\ (sx)->index=1,\ (sx)->iterator_type=what,\ (*((sxg)->initLoop))(sxg,sx);\ (*((sx)->setSimplexData))(sxg,sx);\ (sx)->index++)/*\end{comment}*//* The typical usage of this macro looks like the followingcode for a loop over all cells:sxGrid g; sxSimplex s; sxIteratorType t=sxCells;sxLoop(g,s,t){ ......}*//*\func{sxFunction}*/typedef double *sxFunction;/*The data type of functions over components -- see \xref{sxCreateFunction}.*//*%----------------------------------------------------------*//*\subsection{ Grid information retrieval}*//*\func{sxDimension}*/int sxDimension(sxGrid g);/*Return the dimension of the grid.*//*\func{sxNumber}*/int sxNumber(sxGrid g, sxIteratorType t);/*Return the numer of cells, edges faces or nodes, depending on\verb|component|. *//*\func{sxNumberOfMaterials}*/int sxNumberOfMaterials(sxGrid g, sxIteratorType t);/*Return the maximum material number for each component. This can beused e.g. for allocating arrays over the number of boundaryconditions. {\bf Bugs:}For nodes and edges, there is currently no implementation. *//*\func{MinMax}*/double sxXMin(sxGrid g);double sxXMax(sxGrid g);double sxYMin(sxGrid g);double sxYMax(sxGrid g);double sxZMin(sxGrid g);double sxZMax(sxGrid g);/*These functions are return the minimum and maximum of all node coordinates of the grid.*//*\begin{comment}This is the internal structure which holds the data of a simplex grid.*/struct sxGridStruct{ char name[sxNameLength]; /* name of the grid */ void (*initLoop)(sxGrid g,sxSimplex sx);/* initialize loop */ void (*destroyGrid)(sxGrid g); /* see sxDestructorDefault */ void (*setAdditionalData)(sxGrid g,sxSimplex sx); int spaceDim; int gridDim; int numOfSimplices[sxIteratorTypes]; int numOfMaterials[sxIteratorTypes]; int *material[sxIteratorTypes]; int boxNotDefined; double mincoord[sxMaxSpaceDimension+1]; double maxcoord[sxMaxSpaceDimension+1]; void * priv; void (*setBisection)(sxGrid g); int (*Depth)(sxGrid g,sxSimplex sx); void (*Mark)(sxGrid g,sxSimplex sx, int mark); int (*Marked)(sxGrid g,sxSimplex sx); int (*MaxDepth)(sxGrid g); void (*Refine)(sxGrid g); void (*Coarsen)(sxGrid g); void (*Flatten)(sxGrid g); int (*Adaptive)(sxGrid g); void (*LocatePoint)(sxGrid g, sxSimplex sxStart, double *coord, sxSimplex sxFound, double *barycoord); double* (*InterpolateFunctionFromPrevLevel)( sxGrid g, double* f_old, int num, int comp); double* (*InterpolateFunctionFromPrevGrid)( sxGrid g, sxGrid gprev, double* f_old, int num, int comp); void (*initFaces)(sxGrid g); void (*initEdges)(sxGrid g);#ifndef wzgrid_hxx Adjacency edges;#endif int *faces[sxIteratorTypes]; int faces_ok; int edges_ok; sxCoordsysType coordsys;};void sxDefaultInitLoop(sxGrid g, sxSimplex s);void sxDefaultDestroyGrid(sxGrid g);void sxDefaultInitEdges(sxGrid g);void sxDefaultInitFaces(sxGrid g);#endif/*$Log: sxgridint.h,v $Revision 2.14 2000/07/26 13:32:45 fuhrmann#ifndef wzgrid_hxxRevision 2.13 2000/07/18 13:21:18 fuhrmannAdjcency appears to work in feflowRevision 2.12 2000/01/11 16:33:43 fuhrmannname buffer sizesRevision 2.11 1998/12/18 19:54:08 fuhrmannsxgrid-albert -Anpassungsxbridges directory * Revision 2.10 1998/07/06 10:45:37 fuhrmann * Increased compiler warning level for all PDELIB-1.7 modules, * removed all bugs, some warnings remain (rcsids, ld_init, unused parameters) * * Revision 2.9 1998/03/05 12:08:47 fuhrmann * cylindric coordinate stuff added, not really tested * * Revision 2.8 1998/02/04 12:54:52 fuhrmann * locatePoint modified * * Revision 2.7 1998/02/04 12:28:40 fuhrmann * bcellmat * setData on simplex, not on grid * * Revision 2.6 1998/01/28 20:26:03 fuhrmann * documentation update for sxgrid * upload from module & project directories * upload dir is now lib/www * * Revision 2.5 1998/01/16 20:54:26 fuhrmann * sxgrid edges work, faces still to do * * Revision 2.4 1998/01/14 17:01:44 fuhrmann * Id & Log *\end{comment}*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -