Files | |
file | gem.h |
Class Gem: the geometry manager object. | |
Classes | |
struct | sGem |
Contains public data memebers for Gem class. More... | |
Typedefs | |
typedef struct sGem | Gem |
Declaration of the Gem class as the Gem structure. | |
Functions | |
int | Gem_dim (Gem *thee) |
Return the extrinsic spatial dimension. | |
int | Gem_dimII (Gem *thee) |
Return the extrinsic spatial dimension. | |
int | Gem_dimVV (Gem *thee) |
Return the number of vertices in a simplex. | |
int | Gem_dimEE (Gem *thee) |
Return the number of edges in a simplex. | |
int | Gem_numVirtVV (Gem *thee) |
Return the logical number of vertices in the mesh. | |
int | Gem_numVirtEE (Gem *thee) |
Return the logical number of edges in the mesh. | |
int | Gem_numVirtFF (Gem *thee) |
Return the logical number of faces in the mesh. | |
int | Gem_numVirtSS (Gem *thee) |
Return the logical number of simplices in the mesh. | |
void | Gem_setNumVirtVV (Gem *thee, int i) |
Set the logical number of vertices in the mesh. | |
void | Gem_setNumVirtEE (Gem *thee, int i) |
Set the logical number of edges in the mesh. | |
void | Gem_setNumVirtFF (Gem *thee, int i) |
Geometry manager constructor. | |
void | Gem_setNumVirtSS (Gem *thee, int i) |
Set the logical number of simplices in the mesh. | |
int | Gem_numVV (Gem *thee) |
Return the number of vertices in the mesh. | |
VV * | Gem_VV (Gem *thee, int i) |
Return a given vertex. | |
VV * | Gem_createVV (Gem *thee) |
Create a new vertex (becoming the new last vertex). | |
VV * | Gem_firstVV (Gem *thee) |
Return the first vertex. | |
VV * | Gem_lastVV (Gem *thee) |
Return the last vertex. | |
VV * | Gem_nextVV (Gem *thee) |
Return the next vertex. | |
VV * | Gem_prevVV (Gem *thee) |
Return the previous vertex. | |
VV * | Gem_peekFirstVV (Gem *thee) |
Peek at the first vertex. | |
VV * | Gem_peekLastVV (Gem *thee) |
Peek at the last vertex. | |
void | Gem_destroyVV (Gem *thee) |
Destroy the last vertex. | |
void | Gem_resetVV (Gem *thee) |
Destroy all of the vertices. | |
int | Gem_numEE (Gem *thee) |
Return the number of edge. | |
EE * | Gem_EE (Gem *thee, int i) |
Return a given edge. | |
EE * | Gem_createEE (Gem *thee) |
Create a new edge (becoming the new last edge). | |
EE * | Gem_firstEE (Gem *thee) |
Return the first edge. | |
EE * | Gem_lastEE (Gem *thee) |
Return the last edge. | |
EE * | Gem_nextEE (Gem *thee) |
Return the next edge. | |
EE * | Gem_prevEE (Gem *thee) |
Return the previous edge. | |
EE * | Gem_peekFirstEE (Gem *thee) |
Peek at the first edge. | |
EE * | Gem_peekLastEE (Gem *thee) |
Peek at the last edge. | |
void | Gem_destroyEE (Gem *thee) |
Destroy the last edge. | |
void | Gem_resetEE (Gem *thee) |
Destroy all of the edges. | |
int | Gem_numSS (Gem *thee) |
Return the number of simplices. | |
SS * | Gem_SS (Gem *thee, int i) |
Return a given simplex. | |
SS * | Gem_createSS (Gem *thee) |
Create a new simplex (becoming the new last simplex). | |
SS * | Gem_firstSS (Gem *thee) |
Return the first simplex. | |
SS * | Gem_lastSS (Gem *thee) |
Return the last simplex. | |
SS * | Gem_nextSS (Gem *thee) |
Return the next simplex. | |
SS * | Gem_prevSS (Gem *thee) |
Return the previous simplex. | |
SS * | Gem_peekFirstSS (Gem *thee) |
Peek at the first simplex. | |
SS * | Gem_peekLastSS (Gem *thee) |
Peek at the last simplex. | |
void | Gem_destroySS (Gem *thee) |
Destroy the last simplex. | |
void | Gem_resetSS (Gem *thee) |
Destroy all of the simplices. | |
int | Gem_numSQ (Gem *thee, int currentQ) |
Return the number of simplices in a given queue. | |
void | Gem_resetSQ (Gem *thee, int currentQ) |
Release all of the simplices in a given queue. | |
int | Gem_numBF (Gem *thee) |
Return the number of boundary faces. | |
int | Gem_numBV (Gem *thee) |
Return the number of boundary vertices. | |
void | Gem_setNumBF (Gem *thee, int val) |
Set the number of boundary faces. | |
void | Gem_setNumBV (Gem *thee, int val) |
Set the number of boundary vertices. | |
void | Gem_addToNumBF (Gem *thee, int val) |
Increment the number of boundary faces by a given integer. | |
void | Gem_addToNumBV (Gem *thee, int val) |
Increment the number of boundary vertices by a given integer. | |
void | Gem_numBFpp (Gem *thee) |
Increment the number of boundary faces by 1. | |
void | Gem_numBVpp (Gem *thee) |
Increment the number of boundary vertices by 1. | |
void | Gem_numBFmm (Gem *thee) |
Decrement the number of boundary faces by 1. | |
void | Gem_numBVmm (Gem *thee) |
Decrement the number of boundary vertices by 1. | |
Gem * | Gem_ctor (Vmem *vmem, PDE *tpde) |
Geometry manager constructor. | |
void | Gem_dtor (Gem **thee) |
Geometry manager destructor. | |
void | Gem_reset (Gem *thee, int dim, int dimII) |
Reset all of the geometry datastructures. | |
VV * | Gem_createAndInitVV (Gem *thee) |
Create and initialize a new vertex; return a point to it. | |
EE * | Gem_createAndInitEE (Gem *thee) |
Create and initialize a new edge; return a point to it. | |
SS * | Gem_createAndInitSS (Gem *thee) |
Create and initialize a new simplex; return a point to it. | |
SS * | Gem_SQ (Gem *thee, int currentQ, int i) |
Return the simplex at a particular location in the simplex Q. | |
void | Gem_appendSQ (Gem *thee, int currentQ, SS *qsm) |
Append a simplex to the end of a simplex Q. | |
void | Gem_createSimplexRings (Gem *thee) |
Create all of the simplex rings. | |
void | Gem_destroySimplexRings (Gem *thee) |
Destroy all of the simplex rings. | |
EE * | Gem_findOrCreateEdge (Gem *thee, VV *v0, VV *v1, int *iDid) |
Look for a common edges between two vertices. If it doesn't yet exist, we create it, and then note that we did so. | |
void | Gem_createEdges (Gem *thee) |
Create all of the edges. | |
void | Gem_destroyEdges (Gem *thee) |
Destroy all of the edges. | |
void | Gem_countChk (Gem *thee) |
Count all vertices, edges, faces, simplices, and do it is cheaply as possible. Also do a form check. | |
void | Gem_countFaces (Gem *thee) |
Count all of the faces without actually creating them. | |
void | Gem_clearEdges (Gem *thee) |
Clear all of the edge numbers in each simplex. | |
void | Gem_countEdges (Gem *thee) |
Count up all of the edges without actually creating them, and keep track of the global edge numbers in each element. | |
void | Gem_formFix (Gem *thee, int key) |
Make some specified hacked fix to a given mesh. | |
void | Gem_simplexInfo (Gem *thee, SS *sm, TT *t) |
Build the basic master-to-element transformation information. | |
void | Gem_buildVolumeTrans (Gem *thee, SS *sm, TT *t) |
Build the complete master-to-element transformatio. | |
void | Gem_buildSurfaceTrans (Gem *thee, int iface, TT *t) |
Build the complete masterFace-to-elementFace transformation. | |
double | Gem_edgeLength (Gem *thee, VV *v0, VV *v1) |
Calculate the edge lengths of a simplex. | |
int | Gem_newestVertex (Gem *thee, SS *sm, int face, double *len) |
Determine the edge of a simplex opposite the newest vertex. | |
int | Gem_longestEdge (Gem *thee, SS *sm, int face, double *len) |
Determine the longest edge of a simplex or a simplex face. | |
int | Gem_shortestEdge (Gem *thee, SS *sm, int face, double *len) |
Determine the shortest edge of a simplex or a simplex face. | |
double | Gem_shapeMeasure (Gem *thee, SS *sm, double *f, double *g) |
Calculate the shape quality measure for this simplex. | |
void | Gem_shapeMeasureGrad (Gem *thee, SS *sm, int vmap[], double dm[]) |
Calculate gradient of the shape quality measure for this simplex, where the last vertex (vertex d) is treated as the set of independent variables. | |
double | Gem_edgeRatio (Gem *thee, SS *sm) |
Calculate ratio of longest-to-shortest edge of a simplex. | |
double | Gem_simplexVolume (Gem *thee, SS *sm) |
Calculate the determinant of the transformation from the master element to this element. | |
void | Gem_shapeChk (Gem *thee) |
Traverse the simplices and check their shapes. | |
void | Gem_markEdges (Gem *thee) |
Produce the initial edge markings in all of the simplices. | |
void | Gem_reorderSV (Gem *thee) |
Go through simplices and enforce a vertex ordering that will produce a positive determinant. | |
void | Gem_smoothMeshLaplace (Gem *thee) |
Smooth the mesh using simple Laplace smoothing. | |
void | Gem_smoothMesh (Gem *thee) |
Smooth the mesh using simple Laplace smoothing. | |
void | Gem_smoothMeshBnd (Gem *thee) |
Smooth the boundary mesh. | |
void | Gem_smoothMeshOpt (Gem *thee) |
Smooth the mesh using a volume optimization approach. | |
void | Gem_buildCharts (Gem *thee) |
Unify the charts of vertices. | |
void | Gem_clearCharts (Gem *thee) |
Unify the charts of vertices. | |
void | Gem_memChk (Gem *thee) |
Print the exact current malloc usage. | |
void | Gem_memChkVV (Gem *thee, int *num, int *size, int *vecUse, int *vecMal, int *vecOhd) |
Print the exact current malloc usage: vertices. | |
void | Gem_memChkEE (Gem *thee, int *tnum, int *size, int *vecUse, int *vecMal, int *vecOhd) |
Print the exact current malloc usage: edges. | |
void | Gem_memChkSS (Gem *thee, int *tnum, int *size, int *vecUse, int *vecMal, int *vecOhd) |
Print the exact current malloc usage: simplices. | |
void | Gem_memChkSQ (Gem *thee, int currentQ, int *tnum, int *tsize, int *tVecUse, int *tVecMal, int *tVecOhd) |
Print the exact current malloc usage: simplex queues. | |
void | Gem_memChkMore (Gem *thee) |
Estimate the current RAM usage. | |
void | Gem_speedChk (Gem *thee) |
Calculate the cost to traverse the various structures. | |
void | Gem_formChk (Gem *thee, int key) |
Check the self-consistency of the geometry datastructures. | |
void | Gem_contentChk (Gem *thee) |
Print out contents of all geometry structures. | |
void | Gem_ramClear (Gem *thee, int key) |
Check some structures. | |
void | Gem_makeBnd (Gem *thee, int btype) |
Force naborless faces to become boundary faces. | |
void | Gem_makeBndExt (Gem *thee, int key) |
Mark selected boundary faces in a special way. | |
void | Gem_delaunay (Gem *thee) |
Incremental flip Delaunay generator. | |
void | Gem_flip (Gem *thee, VV *vx) |
Edge or face flip for the incremental flip algorithm. | |
SS * | Gem_findSimplex (Gem *thee, VV *vx) |
Find a simplex containing a given vertex. | |
void | Gem_predinit (Gem *thee) |
Initialize the geometric predicates. | |
int | Gem_orient (Gem *thee, SS *sm) |
Determine the orientation of the vertices in a simplex. | |
int | Gem_inSphere (Gem *thee, SS *sm, int sm_facet, VV *vx, VV *vxnb) |
Determine if a vertex lies in a sphere of other vertices. | |
int | Gem_pointInSimplex (Gem *thee, SS *sm, double x[]) |
Determine whether or a not a point is in a simplex. | |
int | Gem_pointInSimplexVal (Gem *thee, SS *sm, double x[], double phi[], double phix[][3]) |
Evaluate basis functions at a point in a simplex. | |
int | Gem_deform (Gem *thee, int dimX, double *defX[MAXV]) |
Edge or face flip for the incremental flip algorithm. | |
int | Gem_markRefine (Gem *thee, int key, int color) |
Mark simplices to be refined. | |
int | Gem_refine (Gem *thee, int rkey, int bkey, int pkey) |
Refine the manifold and also build a prolongation operator that can interpolate functions from the original manifold to the new manifold. | |
void | Gem_refineEdge (Gem *thee, int currentQ, SS *sm, VV *v[4], VV **vAB, int A, int B) |
We do three things in this routine: (1) Find the midpoint of existing edge, or create it (2) Tell simplices using edge that they are now nonconforming (3) Determine the "type" of the new point by using the type of the edge. The edge type must itself be calculated on the fly, because we allow the use of lazy edge creation. | |
void | Gem_octsect (Gem *thee, SS *sm, int currentQ) |
Uniform regular (quadrasection) refinement of a single simplex. | |
void | Gem_bisectLE (Gem *thee, SS *sm, int currentQ) |
Bisection refinement of a single simplex by longest edge. | |
void | Gem_bisectNV (Gem *thee, SS *sm, int currentQ) |
Bisection refinement of a single simplex by newest vertex. | |
void | Gem_bisectNP (Gem *thee, SS *sm, int currentQ) |
Bisection refinement by pairs. | |
int | Gem_unRefine (Gem *thee, int rkey, int pkey) |
Un-refine the mesh. | |
void | Gem_delSimplex (Gem *thee, SS *sm, int currentQ) |
Delete a simplex cleanly, maintaining a consecutive list. | |
void | Gem_unHangVertices (Gem *thee) |
Toss out any hanging vertices. | |
int | Gem_read (Gem *thee, int key, Vio *sock) |
Read in the user-specified initial vertex-simplex mesh. provided to us in MC-Simplex-Format (MCSF), and transform into our internal datastructures. | |
void | Gem_write (Gem *thee, int key, Vio *sock, int fkey) |
Toss out any hanging vertices. | |
void | Gem_writeFace3d (Gem *thee, Vio *sock) |
Write out the faces of a 3-simplex mesh as a complete and legal 2-simplex mesh in "MCSF" format (described above for Gem_read). | |
int | Gem_readEdge (Gem *thee, Vio *sock) |
Read in the user-specified initial vertex-edge mesh provided to us in MC-Edge-Format (MCEF), and transform into our internal datastructures. | |
void | Gem_writeEdge (Gem *thee, Vio *sock) |
Write out the edges of a 2- or 3-simplex mesh in "MCEF" (MC-Edge-Format). | |
void | Gem_buildSfromE (Gem *thee) |
Build a vertex-simplex mesh from a vertex-edge mesh. | |
void | Gem_writeBrep (Gem *thee, Vio *sock) |
Write out the boundary edges or boundary faces of a 2-simplex or 3-simplex mesh in a "BREP" format for input into Barry Joe's 2D/3D Geompak. | |
void | Gem_writeBrep2 (Gem *thee, Vio *sock) |
Write out boundary edges of a 2-simplex mesh in a "BREP" format for input into Barry Joe's 2D Geompak. | |
void | Gem_writeBrep3 (Gem *thee, Vio *sock) |
Write out boundary faces of a 3-simplex mesh in a "BREP" format for input into Barry Joe's 3D Geompak. | |
void | Gem_writeBrep2to3 (Gem *thee, Vio *sock) |
Write out triangles of a 2-manifold as a 3-simplex boundary mesh in a "BREP" format for input into Barry Joe's 3D Geompak. | |
void | Gem_writeGEOM (Gem *thee, Vio *sock, int defKey, int colKey, int chartKey, double gluVal, int fkey, double *defX[MAXV], char *format) |
Write a finite element mesh or mesh function in some format. | |
void | Gem_writeSOL (Gem *thee, Vio *sock, int fldKey, double *defX[MAXV], char *format) |
Write a finite element mesh or mesh function in some format. | |
void | Gem_writeVolHeaderOFF (Gem *thee, Vio *sock) |
Produce an OFF file header for a volume mesh. | |
void | Gem_writeBndHeaderOFF (Gem *thee, Vio *sock) |
Produce an OFF file header for a boundary mesh. | |
void | Gem_writeTrailerOFF (Gem *thee, Vio *sock) |
Produce an OFF file trailer. | |
void | Gem_writeGV (Gem *thee, Vio *sock, int defKey, int colKey, int chartKey, double gluVal, int fkey, double *defX[MAXV]) |
Write out a mesh in "Geomview OFF" format to a file or socket. | |
void | Gem_writeFace2dGV (Gem *thee, Vio *sock, int defKey, int colKey, int chartKey, double gluVal, double *defX[MAXV]) |
Write out the faces of a 2-simplex mesh as a complete and legal 1-simplex mesh in "Geomview SKEL" format. | |
void | Gem_writeFace3dGV (Gem *thee, Vio *sock, int defKey, int colKey, int chartKey, double gluVal, double *defX[MAXV]) |
Write out the faces of a 3-simplex mesh as a complete and legal 2-simplex mesh in "Geomview OFF" format. | |
void | Gem_writeHeaderMATH (Gem *thee, Vio *sock) |
Produce an MATH file header for a volume mesh. | |
void | Gem_writeTrailerMATH (Gem *thee, Vio *sock) |
Produce an MATH file trailer. | |
void | Gem_writeMATH (Gem *thee, Vio *sock, int defKey, int colKey, int chartKey, double gluVal, int fkey, double *defX[MAXV]) |
Write out a mesh in "Mathematica" format to a file or socket. | |
void | Gem_writeGMV (Gem *thee, Vio *sock, int fldKey, double *defX[MAXV]) |
Write out a scalar or vector function over a simplex mesh in "GMV" (General Mesh Viewer) format. | |
void | Gem_writeUCD (Gem *thee, Vio *sock, int fldKey, double *defX[MAXV]) |
Write out a scalar or vector function over a simplex mesh in "UCD" (Unstructured Cell Data) format for AVS 5.0. | |
void | Gem_writeDX (Gem *thee, Vio *sock, int fldKey, double *defX[MAXV]) |
Write out a scalar or vector function over a simplex mesh in "DX" (www.opendx.org) format. | |
void | Gem_writeTEC (Gem *thee, Vio *sock, int fldKey, double *defX[MAXV]) |
Write out a scalar or vector function over a simplex mesh in "TEC" (www.opendx.org) format. | |
void | Gem_makeCube (Gem *thee) |
Generate a unit cube domain. | |
void | Gem_makeOctahedron (Gem *thee) |
Generate a unit octahedron domain. | |
void | Gem_makeIcosahedron (Gem *thee) |
Generate a unit icosahedron domain. |
void Gem_addToNumBF | ( | Gem * | thee, | |
int | val | |||
) |
Increment the number of boundary faces by a given integer.
thee | Pointer to class Gem | |
val | Value for incrementing the number of boundary faces |
void Gem_addToNumBV | ( | Gem * | thee, | |
int | val | |||
) |
Increment the number of boundary vertices by a given integer.
thee | Pointer to class Gem | |
val | value for incrementing the number of boundary vertices |
Append a simplex to the end of a simplex Q.
thee | Pointer to class Gem | |
currentQ | index of a given queue | |
qsm | Pointer to the simplex |
Bisection refinement of a single simplex by longest edge.
thee | Pointer to class Gem | |
sm | pointer to the simplex | |
currentQ | index of a given queue |
Bisection refinement by pairs.
thee | Pointer to class Gem | |
sm | pointer to the simplex | |
currentQ | index of a given queue |
Bisection refinement of a single simplex by newest vertex.
* Boundary nodes/edges[faces] are correctly refined. * * "Face Type rule": Boundary faces rule over Interior faces. * * In other words, if an edge is shared between a boundary face and * an interior face, and the edge gets refined, the new point will * be a boundary point. * * We use "newest vertex" approach to selecting the refinement edge * choice generated by the Arnold-Mukherjee marking procedure. * Below is a mathematica program that demonstrates the marking * algorithm, courtesy of Doug Arnold and Arup Mukerjee. * * (* -- BEGIN MATHEMATICA CODE ----------------------------------------- *) * (* * * NOTE: The following mathematica program, courtesy of doug arnold * * and arup mukherjee, illustrates their particular edge choice, * * which is provably non-degenerate. The small comment at the * * beginning, just following my comment here, is from Arup. * * We implement their marking procedure in MC with our MC geometry * * datastructures (as an alternative to longest edge choice) by * * allocating a few bits to indicate both the marked edges on each face * * and then the refinement edge choice. -mike * *) * (* * * Arup's Comment: I am also including a mathematica script for the * * bisection. Given a tet and its "type" it does the bisection upto a * * required bisection level and lists the total number of similarity * * classes produced in the process (it uses a Liu-Joe indicator given on * * one of their papers ... the example at the end of Chap 3 in the * * thesis has the specific reference on this). The tetrahedron specified * * in the example attains the upper bound of 36 similarity classes. * *) * * (* SET the value of nlevels (number of bisection levels) * and the TYPE of t[0] p-uf, p-f, np-aa, etc ... * before input * to mathematica *) * * nlevels=8 * * SetAttributes[bisect,Listable] * (* these are the "bisection" rules * p-uf -- planar with flag off * v0-v1 is refinement edge and v0-v2 and v1-v2 are marked edges * the plane containing all marked edges is v0 v1 v2 * p-f -- planar with flag on * v0-v1 is refinement edge and v0-v2 and v1-v2 are marked edges * the plane containing all marked edges is v0 v1 v2 * np-aa -- non planar case with adjacent markings * v0-v1 is refinement edge and v0-v2 and v1-v3 are marked edges * np-oo -- opp-opp * v0-v1 is refinement edge and v2-v3 is the other marked edge * np-ao -- adj-opp * v0-v1 is the refinement edge and v0-v2 and v2-v3 are marked * *) * * bisect[Tetra[v0_,v1_,v2_,v3_,p-uf]]:= { * Tetra[v0,v2,v3,(v0+v1)/2,p-f], Tetra[v1,v2,v3,(v0+v1)/2,p-f] } * * bisect[Tetra[v0_,v1_,v2_,v3_,p-f]]:= { * Tetra[v0,v2,v3,(v0+v1)/2,np-aa], Tetra[v1,v2,v3,(v0+v1)/2,np-aa] } * * bisect[Tetra[v0_,v1_,v2_,v3_,np-aa]]:={ * Tetra[v0,v2,v3,(v0+v1)/2,p-uf], Tetra[v1,v3,v2,(v0+v1)/2,p-uf] } * * bisect[Tetra[v0_,v1_,v2_,v3_,np-oo]]:={ * Tetra[v2,v3,v0,(v0+v1)/2,p-uf], Tetra[v2,v3,v1,(v0+v1)/2,p-uf] } * * bisect[Tetra[v0_,v1_,v2_,v3_,np-ao]]:={ * Tetra[v0,v2,v3,(v0+v1)/2,p-uf], Tetra[v2,v3,v1,(v0+v1)/2,p-uf] } * * (* a "generic" tetrahedron *) * v0={0,0,0}; * v1={23,0,0}; * v2={7,0,11}; * v3={17,5,13}; * * Clear[t] * (* set t[0] to be pf, pt, or np-** as the case may be *) * t[0]={Tetra[v0,v1,v2,v3,p-uf]}; * t[n_]:=t[n]=bisect[t[n-1]] * * (* The Liu-Joe quality indicator *) * dist2[v0_,v1_] := (v0-v1).(v0-v1) * dist[v0_,v1_] := Sqrt[dist[v0,v1]] * SetAttributes[qual,Listable] * qual[Tetra[v0_,v1_,v2_,v3_,any_]] := * 12 Abs[Det[{v1-v0,v2-v0,v3-v0}]/2]^(2/3)/ * (dist2[v0,v1]+dist2[v0,v2]+dist2[v0,v3] * +dist2[v1,v2]+dist2[v1,v3]+dist2[v2,v3]) * * (* discretized Liu-Joe quality indicator *) * (* (scaled to [0,100000] and rounded to an integer *) * SetAttributes[dqual,Listable] * dqual[t_] := Round[100000 N[qual[t],10]] * * (* q[i] --- list of qualities for level i * qq[i] -- list of all qualities upto level i * newout[i] -- the "number" of different similarity classes at * level i * totout[i] -- the "number" of different similarity classes at * or below level i *) * Do[q[i]=dqual[t[i]],{i,0,nlevels}] * Do[qq[i]= Union@@Table[q[j],{j,0,i}],{i,0,nlevels}] * Do[newout[i]=Dimensions[Union[Flatten[q[i]]]],{i,0,nlevels}] * Do[totout[i]=Dimensions[Union[Flatten[qq[i]]]],{i,0,nlevels}] * Table[{i,newout[i],totout[i]},{i,0,nlevels}]//TableForm * (* -- END MATHEMATICA CODE ---------------------------------------- *) *
thee | Pointer to class Gem | |
sm | pointer to the simplex | |
currentQ | index of a given queue |
void Gem_buildCharts | ( | Gem * | thee | ) |
Unify the charts of vertices.
thee | Pointer to class Gem |
void Gem_buildSfromE | ( | Gem * | thee | ) |
Build a vertex-simplex mesh from a vertex-edge mesh.
* Notes: Below is an email I sent to R. Bank outlining the idea of the * algorithm. I wanted to do this completely topologically, using * no geometry information, so that it would work for abstract * simplex manifolds. * * --------------------------------------------------------------------------- * Randy, * * I realized on the drive that your 2-manifold example is not actually * a problem after all. * * Consider first the planar situation we were worrying about, e.g., take a tet * and push the fourth vertex down into the plane of the other three vertices, * and you have the three (good) triangles inside one (bad) triangle. * As we agreed, any situation like this in the plane is managable (e.g. we can * detect the "bad" triangle) as long as we known what the boundary edges are * for the entire mesh. * * I conjecture that the "bad" simplices in this case and other 2D cases, as * well as the 3D case, are precisely those whose faces (edges in 2D) satisfy * both of the following conditions. (If this is a theorem, then everything * in this note is rigorous.) * (a) All interior faces are shared with >1 other simplex * (b) All boundary faces are shared with >0 other simplex * * Consider now your example, e.g. the four surface triangles of a tetrahedron * as a 2-manifold without boundary. We would like to be able to recover all * four surface triangles from the six edges, and we don't want to toss out one * of the triangles as we did above. The key difference is that above, the * problem triangle either has one or more boundary edges, OR it is imbedded in * the interior of a mesh, so its interior edges have neighoring triangles. * * That doesn't happen for the tet surface example. We would first build all * possible triangles from triples of edges. According to the above * "bad simplex" rule, all four of the triangles are "good", since they all * have exactly one naboring triangle sharing each edge. So we get the correct * triangulation of the surface of the tet. * * I conjecture that the following algorithm will rebuild d-simplices * (d=2 or d=3) from edges, using only topological information, with no * geometry information (and no floating point arithmetic at all, for that * matter). The edge-based input mesh has to satisfy three properties: * * 1. The dimension "d" of the mesh is specified (either d=2 or d=3) * 2. The edge-based mesh was built from an underlying d-simplex mesh * 3. The boundary edges are marked as such * * The two-step simplex reconstruction algorithm is then as follows: * * 1. For each vertex "v" do: * For all vertices connected to "v" by a single edge do: * Build every possible d-simplex * EndFor * EndFor * 2. For each simplex "s" that was built in step 1 do: * 3. If d=3, calculate all "face" types of "s" based on edge types * 4. Remove simplex "s" from list of simplices if (a) AND (b) hold: * (a) ALL inter faces (edges if d=2) shared by >1 other simplices * (b) ALL bndry faces (edges if d=2) shared by >0 other simplices * EndFor * * If you can come up with a triangulation of any 2-manifold, with or without * boundary, with or without holes, etc, which can't be turned into an edge * mesh and then recovered correctly using the above algorithm, then I'll * give you a dollar... -mike *
thee | Pointer to class Gem |
Build the complete masterFace-to-elementFace transformation.
thee | Pointer to class Gem | |
iface | index for the faces in a simplex | |
t | index for class TT |
Build the complete master-to-element transformatio.
thee | Pointer to class Gem | |
sm | Pointer to a simplex | |
t | Pointer to class TT |
void Gem_clearCharts | ( | Gem * | thee | ) |
Unify the charts of vertices.
thee | Pointer to class Gem |
void Gem_clearEdges | ( | Gem * | thee | ) |
Clear all of the edge numbers in each simplex.
thee | Pointer to class Gem |
void Gem_contentChk | ( | Gem * | thee | ) |
Print out contents of all geometry structures.
thee | Pointer to class Gem |
void Gem_countChk | ( | Gem * | thee | ) |
Count all vertices, edges, faces, simplices, and do it is cheaply as possible. Also do a form check.
thee | Pointer to class Gem |
void Gem_countEdges | ( | Gem * | thee | ) |
Count up all of the edges without actually creating them, and keep track of the global edge numbers in each element.
thee | Pointer to class Gem |
void Gem_countFaces | ( | Gem * | thee | ) |
Count all of the faces without actually creating them.
thee | Pointer to class Gem |
Create and initialize a new edge; return a point to it.
thee | Pointer to class Gem |
Create and initialize a new simplex; return a point to it.
thee | Pointer to class Gem |
Create and initialize a new vertex; return a point to it.
thee | Pointer to class Gem |
void Gem_createEdges | ( | Gem * | thee | ) |
Create all of the edges.
thee | Pointer to class Gem |
Create a new edge (becoming the new last edge).
thee | Pointer to class Gem |
void Gem_createSimplexRings | ( | Gem * | thee | ) |
Create all of the simplex rings.
thee | Pointer to class Gem |
Create a new simplex (becoming the new last simplex).
thee | Pointer to class Gem |
Create a new vertex (becoming the new last vertex).
thee | Pointer to class Gem |
Geometry manager constructor.
vmem | Memory management object | |
tpde | Pointer to the PDE object |
int Gem_deform | ( | Gem * | thee, | |
int | dimX, | |||
double * | defX[MAXV] | |||
) |
Edge or face flip for the incremental flip algorithm.
thee | Pointer to class Gem | |
dimX | the intrinsic spatial dimension | |
defX | Pointer to vertex deformation or displacement values |
void Gem_delaunay | ( | Gem * | thee | ) |
Incremental flip Delaunay generator.
* We use an incremental flip Delaunay mesh generator. * In 2D, this is based on the standard edge-flipping. * In 3D, this is based on 2-to-3 flips (shared face-to-edge flip), * and 3-to-2 flips (a restricted edge-to-face flip). * * The 2D version of the algorithm here is similar to several * edge-flip-based Delaunay algorithms in the literature. * * The 3D version of the algorithm here is similar to Barry Joe's * and Ernst Mucke's. However, the ringed-vertex datastructure used * here leads to a more concise implementation, as compared to * implementations using e.g. Mucke's edge-facet datastructure. * * Both this algorithm and similar incremental flip algorithms in * the 3D case are based on several recent theoretical results * due to Barry Joe, which guarantee the following: * * (1) The flipping algorithm to re-establish Delaunay-ness * always terminates in a finite number of steps. * * (2) The algorithm works regardless of the flipping order. * * (3) Only the exterior faces of the star region of the new * vertex (what Mucke calls "link facets", because these * "facets" link two triangles or tets together), and in the * 3D case the three edges which make up those faces, need * be tested and then possibly flipped. * * The algorithm is as follows: * * (1) Given N inputs points, a single enclosing simplex is * formed by adding d+1 additional points, and then forming * that single simplex. * * (2) The N points are then added to the mesh one at a time * by locating the simplex containing each point, adding * the point, and splitting the containing simplex into * d+1 children (note that unless the points are in * "general" position, this may give rise to degenerate * simplices). * * (3) The link-facets of the newly added vertex are checked * for Delaunayness. The link-facets are the faces * opposite the new vertex in each simplex that uses * the new vertex. (This is the boundary of the support * region for a finite element basis function, for example.) * If a non-Delaunay face is located, we attempt to flip * one of the three edges of the face using a 3-to-2 * (edge-to-face) flip. We only flip such as edge if the * simplex ring about the edge has length three. If no * such edge flips are possible, we do a 2-to-3 flip * (face-to-edge) if this is possible (it is only possible * if the two tets sharing the face form a convex region). * If no flipping is possible, we temporarily ignore this * non-Delaunay face and move on to the next face. * * (4) Step (3) above terminates in a finite number of steps * thanks to the theoretical results of Barry Joe. *
thee | Pointer to class Gem |
Delete a simplex cleanly, maintaining a consecutive list.
thee | Pointer to class Gem | |
sm | pointer to the simplex | |
currentQ | index of a given queue |
void Gem_destroyEdges | ( | Gem * | thee | ) |
Destroy all of the edges.
thee | Pointer to class Gem |
void Gem_destroyEE | ( | Gem * | thee | ) |
Destroy the last edge.
thee | Pointer to class Gem |
void Gem_destroySimplexRings | ( | Gem * | thee | ) |
Destroy all of the simplex rings.
thee | Pointer to class Gem |
void Gem_destroySS | ( | Gem * | thee | ) |
Destroy the last simplex.
thee | Pointer to class Gem |
void Gem_destroyVV | ( | Gem * | thee | ) |
Destroy the last vertex.
thee | Pointer to class Gem |
int Gem_dim | ( | Gem * | thee | ) |
Return the extrinsic spatial dimension.
thee | Pointer to class Gem |
int Gem_dimEE | ( | Gem * | thee | ) |
Return the number of edges in a simplex.
thee | Pointer to class Gem |
int Gem_dimII | ( | Gem * | thee | ) |
Return the extrinsic spatial dimension.
thee | Pointer to class Gem |
int Gem_dimVV | ( | Gem * | thee | ) |
Return the number of vertices in a simplex.
thee | Pointer to class Gem |
void Gem_dtor | ( | Gem ** | thee | ) |
Geometry manager destructor.
thee | Pointer to class Gem |
Calculate the edge lengths of a simplex.
thee | Pointer to class Gem | |
v0 | Pointer to the first vertex | |
v1 | Pointer to the second vertex |
Calculate ratio of longest-to-shortest edge of a simplex.
thee | Pointer to class Gem | |
sm | Pointer to the simplex |
Return a given edge.
thee | Pointer to class Gem | |
i | index for a given edge |
Look for a common edges between two vertices. If it doesn't yet exist, we create it, and then note that we did so.
thee | Pointer to class Gem | |
v0 | Pointer to the first vertex | |
v1 | Pointer to the second vertex | |
iDid | index for creating an edge |
Find a simplex containing a given vertex.
thee | Pointer to class Gem | |
vx | Pointer to the vertex |
Return the first edge.
thee | Pointer to class Gem |
Return the first simplex.
thee | Pointer to class Gem |
Return the first vertex.
thee | Pointer to class Gem |
Edge or face flip for the incremental flip algorithm.
thee | Pointer to class Gem | |
vx | Pointer to the vertex |
void Gem_formChk | ( | Gem * | thee, | |
int | key | |||
) |
Check the self-consistency of the geometry datastructures.
thee | Pointer to class Gem | |
key | 0 --> check: min (just vertices and simplices) 1 --> check: min + simplex ring 2 --> check: min + simplex ring + edge ring 3 --> check: min + simplex ring + edge ring + conform |
void Gem_formFix | ( | Gem * | thee, | |
int | key | |||
) |
Make some specified hacked fix to a given mesh.
thee | Pointer to class Gem | |
key | 0 --> ? |
Determine if a vertex lies in a sphere of other vertices.
thee | Pointer to class Gem | |
sm | pointer to the simplex | |
sm_facet | index for the face | |
vx | pointer to the vertex | |
vxnb | pointer to the given vertex |
Return the last edge.
thee | Pointer to class Gem |
Return the last simplex.
thee | Pointer to class Gem |
Return the last vertex.
thee | Pointer to class Gem |
Determine the longest edge of a simplex or a simplex face.
thee | Pointer to class Gem | |
sm | Pointer to the simplex | |
face | index for the face | |
len | Pointer to the current longest edge length |
void Gem_makeBnd | ( | Gem * | thee, | |
int | btype | |||
) |
Force naborless faces to become boundary faces.
thee | Pointer to class Gem | |
btype | 0 --> create interior boundary faces 1 --> create boundary faces of type "1" 2 --> create boundary faces of type "2" |
void Gem_makeBndExt | ( | Gem * | thee, | |
int | key | |||
) |
Mark selected boundary faces in a special way.
thee | Pointer to class Gem | |
key | index for selected boundary faces key==0 --> check: min (just vertices and simplices) key==1 --> check: min + simplex ring key==2 --> check: min + simplex ring + edge ring key==3 --> check: min + simplex ring + edge ring + conform |
void Gem_makeCube | ( | Gem * | thee | ) |
Generate a unit cube domain.
thee | Pointer to class Gem |
void Gem_makeIcosahedron | ( | Gem * | thee | ) |
Generate a unit icosahedron domain.
thee | Pointer to class Gem |
void Gem_makeOctahedron | ( | Gem * | thee | ) |
Generate a unit octahedron domain.
thee | Pointer to class Gem |
void Gem_markEdges | ( | Gem * | thee | ) |
Produce the initial edge markings in all of the simplices.
thee | Pointer to class Gem |
int Gem_markRefine | ( | Gem * | thee, | |
int | key, | |||
int | color | |||
) |
Mark simplices to be refined.
thee | Pointer to class Gem | |
key | If (key == -1) Clear all simplex refinement flags. If (key == 0) Mark all simplices for refinement. If (key == 1) Mark special simplices for a testcase refinement. | |
color | the chart of the simplex |
void Gem_memChk | ( | Gem * | thee | ) |
Print the exact current malloc usage.
thee | Pointer to class Gem |
void Gem_memChkEE | ( | Gem * | thee, | |
int * | tnum, | |||
int * | size, | |||
int * | vecUse, | |||
int * | vecMal, | |||
int * | vecOhd | |||
) |
Print the exact current malloc usage: edges.
thee | Pointer to class Gem | |
tnum | the global "T" counter -- how many "T"s in list | |
size | size of the object in bytes | |
vecUse | total object size in the the global "T" counter | |
vecMal | total size of allocated blocks | |
vecOhd | max size of blocks |
void Gem_memChkMore | ( | Gem * | thee | ) |
Estimate the current RAM usage.
thee | Pointer to class Gem |
void Gem_memChkSQ | ( | Gem * | thee, | |
int | currentQ, | |||
int * | tnum, | |||
int * | tsize, | |||
int * | tVecUse, | |||
int * | tVecMal, | |||
int * | tVecOhd | |||
) |
Print the exact current malloc usage: simplex queues.
thee | Pointer to class Gem | |
currentQ | index of a given queue | |
tnum | the global "T" counter -- how many "T"s in list | |
tsize | size of the object in bytes | |
tVecUse | total object size in the the global "T" counter | |
tVecMal | total size of allocated blocks | |
tVecOhd | max size of blocks |
void Gem_memChkSS | ( | Gem * | thee, | |
int * | tnum, | |||
int * | size, | |||
int * | vecUse, | |||
int * | vecMal, | |||
int * | vecOhd | |||
) |
Print the exact current malloc usage: simplices.
thee | Pointer to class Gem | |
tnum | the global "T" counter -- how many "T"s in list | |
size | size of the object in bytes | |
vecUse | total object size in the the global "T" counter | |
vecMal | total size of allocated blocks | |
vecOhd | max size of blocks |
void Gem_memChkVV | ( | Gem * | thee, | |
int * | num, | |||
int * | size, | |||
int * | vecUse, | |||
int * | vecMal, | |||
int * | vecOhd | |||
) |
Print the exact current malloc usage: vertices.
thee | Pointer to class Gem | |
num | the global "T" counter -- how many "T"s in list | |
size | size of the object in bytes | |
vecUse | total object size in the the global "T" counter | |
vecMal | total size of allocated blocks | |
vecOhd | max size of blocks |
Determine the edge of a simplex opposite the newest vertex.
thee | Pointer to class Gem | |
sm | Pointer to the simplex | |
face | index for the face | |
len | Pointer to the current longest edge length |
Return the next edge.
thee | Pointer to class Gem |
Return the next simplex.
thee | Pointer to class Gem |
Return the next vertex.
thee | Pointer to class Gem |
int Gem_numBF | ( | Gem * | thee | ) |
Return the number of boundary faces.
thee | Pointer to class Gem |
void Gem_numBFmm | ( | Gem * | thee | ) |
Decrement the number of boundary faces by 1.
thee | Pointer to class Gem |
void Gem_numBFpp | ( | Gem * | thee | ) |
Increment the number of boundary faces by 1.
thee | Pointer to class Gem |
int Gem_numBV | ( | Gem * | thee | ) |
Return the number of boundary vertices.
thee | Pointer to class Gem |
void Gem_numBVmm | ( | Gem * | thee | ) |
Decrement the number of boundary vertices by 1.
thee | Pointer to class Gem |
void Gem_numBVpp | ( | Gem * | thee | ) |
Increment the number of boundary vertices by 1.
thee | Pointer to class Gem |
int Gem_numEE | ( | Gem * | thee | ) |
Return the number of edge.
thee | Pointer to class Gem |
int Gem_numSQ | ( | Gem * | thee, | |
int | currentQ | |||
) |
Return the number of simplices in a given queue.
thee | Pointer to class Gem | |
currentQ | index of a given queue |
int Gem_numSS | ( | Gem * | thee | ) |
Return the number of simplices.
thee | Pointer to class Gem |
int Gem_numVirtEE | ( | Gem * | thee | ) |
Return the logical number of edges in the mesh.
thee | Pointer to class Gem |
int Gem_numVirtFF | ( | Gem * | thee | ) |
Return the logical number of faces in the mesh.
thee | Pointer to class Gem |
int Gem_numVirtSS | ( | Gem * | thee | ) |
Return the logical number of simplices in the mesh.
thee | Pointer to class Gem |
int Gem_numVirtVV | ( | Gem * | thee | ) |
Return the logical number of vertices in the mesh.
thee | Pointer to class Gem |
int Gem_numVV | ( | Gem * | thee | ) |
Return the number of vertices in the mesh.
thee | Pointer to class Gem |
Uniform regular (quadrasection) refinement of a single simplex.
thee | Pointer to class Gem | |
sm | pointer to the simplex | |
currentQ | index of a given queue |
Determine the orientation of the vertices in a simplex.
thee | Pointer to class Gem | |
sm | Pointer to the simplex |
Peek at the first edge.
thee | Pointer to class Gem |
Peek at the first simplex.
thee | Pointer to class Gem |
Peek at the first vertex.
thee | Pointer to class Gem |
Peek at the last edge.
thee | Pointer to class Gem |
Peek at the last simplex.
thee | Pointer to class Gem |
Peek at the last vertex.
thee | Pointer to class Gem |
Determine whether or a not a point is in a simplex.
thee | Pointer to class Gem | |
sm | Pointer to the simplex | |
x | arrary of the point position |
Evaluate basis functions at a point in a simplex.
thee | Pointer to class Gem | |
sm | Pointer to the simplex | |
x | arrary of the point position | |
phi | basis functions at a point in a simplex | |
phix | derivs of basis functions at a point in a simplex |
void Gem_predinit | ( | Gem * | thee | ) |
Initialize the geometric predicates.
thee | Pointer to class Gem |
Return the previous edge.
thee | Pointer to class Gem |
Return the previous simplex.
thee | Pointer to class Gem |
Return the previous vertex.
thee | Pointer to class Gem |
void Gem_ramClear | ( | Gem * | thee, | |
int | key | |||
) |
Check some structures.
thee | Pointer to class Gem | |
key | 0 --> check: min (just vertices and simplices) 1 --> check: min + simplex ring 2 --> check: min + simplex ring + edge ring |
int Gem_read | ( | Gem * | thee, | |
int | key, | |||
Vio * | sock | |||
) |
Read in the user-specified initial vertex-simplex mesh. provided to us in MC-Simplex-Format (MCSF), and transform into our internal datastructures.
* The user provides the following information about a domain and an * initial simplex-triangulation: * * D = DIMENSION = spatial dimension of problem (1, 2, or 3) * N = NVERTICES = total number of vertices in mesh * L = NSIMPLICES = total number of simplices in the mesh * * double vertex* = List of all vertex coordinates in the form: * * vertex[ N * (3+D) ] = { * { id1, chart1, v1_x1, ..., v1_xD }, * { id2, chart2, v2_x1, ..., v2_xD }, * ... * { idN, chartN, vN_x1, ..., vN_xD } * } * * Here, vj_xk is the kth component (float or double) of the vertex * with global vertex number j. The "idj" flag is a 32-bit integer * "name" for vertex j, "chartj" is a 32-bit number representing the * "chart" with which to interpret the coordinates vj_xk, in the sense * of the charts of an atlas of manifold domain. * * int simplex* = List of all simplices by vertex number in the form: * * simplex[ L * (2 + 2*(D+1)) ] = { * { id1, g1, m1, f1_1, ..., f1_{D+1}, s1_v1, ..., s1_v{D+1} }, * { id2, g2, m2, f2_1, ..., f2_{D+1}, s2_v1, ..., s2_v{D+1} }, * ... * { idL, gL, mL, fL_1, ..., f2_{D+1}, sL_v1, ..., sL_v{D+1} } * } * * Here, sj_vk is a 32-bit integer giving the global vertex number * making up the kth vertex of the simplex with global number j. The * "idj" flag is a 32-bit integer "name" for simplex j, "gj" is a * 32-bit group number associated with simplex j (for grouping subsets * of simplices together for various reasons), "mj" is a 32-bit integer * containing the information about the simplex j such as its material * type, and "fj_k" is a 32-bit integer containing the information * about each face k of simplex j such as their boundary types (each * face opposite vertex k in simplex j). * * Thus, in 2D, a simplex (triangle) is specified by 3 consecutive * vertex numbers, and in 3D a simplex (tetrahedra) is specified by 4 * consecutive vertex numbers. The physical coordinates of any vertex * k in the simplex array are given in the vertex array in the * appropriate row of the array. * * NOTE: The ordering of the vertices in a simplex is *extremely* * important here; see the note below. * * Ordering of the vertices in a simplex: * * 1D: Well, this is pretty straight-forward; we will order the vertices * from left-to-right in each simplex; this will produce the correct * sign in integration by parts. * * 2D: All closed triangles must be specified by three consecutive vertices * in simplex and must be counter-clockwise-ordered by their vertices, * as seen from the "up" side of the 2D body/shell/surface. This * produces the correct surface-normals from the right-hand-rule for * surface (line in 2D) integrals. * * 3D: All closed tetrahedra must be specified by four consecutive vertices * in "simplex" in the following way: The first three vertices must * represent any one of the four faces as a counter-clockwise-ordered * triangle, as seen from INSIDE the tetrahedra. I.e., you can think * about this first triangle as lying in the plane, and you are * standing on the plane looking down at it. The fourth vertex * specified following the first three in the simplex is then some * height above the plane containing the first counter-clockwise * ordered triangle. This specification allows the remaining three * (of the four) triangles making up any tetrahedra to be correctly * specified in a counter-clockwise, inward-facing manner, so that the * correct surface-normals can be calculated consistently. *
thee | Pointer to class Gem | |
key | input format type 0 ==> simplex format 1 ==> edge format 2 ==> simplex-nabor format | |
sock | socket for reading/writing a finite element mesh or mesh function |
int Gem_readEdge | ( | Gem * | thee, | |
Vio * | sock | |||
) |
Read in the user-specified initial vertex-edge mesh provided to us in MC-Edge-Format (MCEF), and transform into our internal datastructures.
* Notes: The user provides the following information about a domain and an * initial edge-based triangulation: * * D = DIMENSION = spatial dimension of problem (1, 2, or 3) * N = NVERTICES = total number of vertices in mesh * L = NEDGES = total number of edges in the mesh * * double vertex* = List of all vertex coordinates in the form: * * vertex[ N * (3+D) ] = { * { id1, proc1, info1, v1_x1, ..., v1_xD }, * { id2, proc2, info2, v2_x1, ..., v2_xD }, * ... * { idN, procN, infoN, vN_x1, ..., vN_xD } * } * * Here, vj_xk is the kth component (float or double) of the vertex * with global vertex number j. The "idj" flag is a 32-bit integer * "name" for vertex j, "procj" is a 32-bit color or processor number * associated with vertex j, and "infoj" is a 32-bit integer containing * information about vertex j. * * int edge* = List of all edges by vertex number in the form: * * edge[ L * (2 + 2*(D+1)) ] = { * { id1, proc1, info1, e1_v1, e1_v2 }, * { id2, proc2, info2, e2_v1, e2_v2 }, * ... * { idL, procL, infoL, eL_v1, eL_v2 } * } * * Here, ej_vk is a 32-bit integer giving the global vertex number * making up the kth vertex of the edge with global number j. The * "idj" flag is a 32-bit integer "name" for edge j, "procj" is a * 32-bit color or processor number associated with edge j, * "infoj" is a 32-bit integer containing the information about the * edge j. * * Notes: To recover a simplex (triangle) mesh from the vertices and edges, * we must traverse them and rebuild the simplex structure, and do it * all in linear time. * * The three-step simplex recovery algorithm is as follows: * * (1) Definite vertices and edges from the input data. * * (2) Create all possible simplices as follows: * * For (vx=firstVV; vx!=lastVV; vx=nextVV) { * | Build all simplices which use vx as a vertex as follows: * | 2D CASE: For each distinct pair of vertices connected * | by an edge with vx, if this pair are also * | connected by an edge, then the three make a * | triangle. If the triangle has not already * | been created, then do so and add to the * | simplex rings for each of the three vertices. * | 3D CASE: For each distinct trio of vertices connected * | by an edge with vx, if this trio forms a triangle, * | then the foursome make a tetrahedron. If the * | tetrahedron has not already been created, then do * | so and add to the simplex rings for each of the * | four vertices. * EndFor * * (3) Remove a few "bad" simplices which were created incorrectly * in Step (2) above as follows: * * For (sm=firstSS; sm!=lastSS; sm=nextSS) { * | Remove all "bad" simplices, defined to be those satisfying: * | 2D CASE: All interior edges have multiple nabors, and * | all boundary edges have at least one nabor. * | 3D CASE: All interior faces have multiple nabors, and * | all boundary faces have at least one nabor. * EndFor * * NOTE: The crucial Step (3) of the above algorithm only works * correctly if we correctly identify the boundary faces of the * simplices, which is only possible if the input edge-based mesh * was given with boundary edge information. (We can construct * correct face types from the types of the one or three edges * forming the face in 2D or 3D respectively.) * * We attempt to recover simplex face types from the given * edge types. However, (at least) one degenerate cases is not * recoverable: an isolated Neumann face surounded by Dirichlet faces * will appear simply as three Dirichlet edges in the edge-based mesh, * and we turn this into a Dirichlet face. Note that if a Neumann * face consists of more than one simplex face, then it will be * recovered correctly from the edge types. * * Note also that if a non-simplex mesh is provided as input in * as an edge-based mesh, we will build the edges as specified, * but our attempt to build simplices will only recover those * simplices which actually exist in the edge mesh. Any other * non-simplex polyedra will appear as holes in the final * simplex mesh. *
thee | Pointer to class Gem | |
sock | socket for reading/writing a finite element mesh or mesh function |
int Gem_refine | ( | Gem * | thee, | |
int | rkey, | |||
int | bkey, | |||
int | pkey | |||
) |
Refine the manifold and also build a prolongation operator that can interpolate functions from the original manifold to the new manifold.
thee | Pointer to class Gem | |
rkey | If (rkey==0) Perform recursive simplex bisection until conformity If (rkey==1) Perform first quadra-[octa-]-section, followed by recursive simplex bisection until conformity. IMPORTANT NOTE: In 2D, (rkey==1) WILL generate a conforming mesh. However, in 3D, this procedure will in general produce nonconforming simplices. To produce a conforming mesh in 3D would require an implementation covering all possible face refinement combinations (something like 169 cases). This has been done e.g. by Jurgen Bey in AGM, but we are not that patient; use (rkey==0) above if you want a conforming mesh... If (rkey==2) As a test of the conformity procedure, perform quadra-[octa-]-section until conformity, which should produce a uniformly regularly refined mesh. (In 2D, each triangle should be divided into four children, and in 3D each tetrahedron should be divided into eight children.) | |
bkey | Boolean sets the bkey type for bisecting the mesh If (bkey==0) Bisection type: Longest Edge If (bkey==1) Bisection type: Newest Vertex If (bkey==2) Bisection type: Newest Pair | |
pkey | Boolean sets the pkey type to prolongate a vector |
We do three things in this routine:
(1) Find the midpoint of existing edge, or create it
(2) Tell simplices using edge that they are now nonconforming
(3) Determine the "type" of the new point by using the type of the edge. The edge type must itself be calculated on the fly, because we allow the use of lazy edge creation.
thee | Pointer to class Gem | |
currentQ | index of a given queue | |
sm | pointer to the simplex | |
v | pointer to the vertex | |
vAB | pointer to the midpoint of the edge | |
A | index for a vertex in a simplex | |
B | index for a vertex in a simplex |
void Gem_reorderSV | ( | Gem * | thee | ) |
Go through simplices and enforce a vertex ordering that will produce a positive determinant.
thee | Pointer to class Gem |
void Gem_reset | ( | Gem * | thee, | |
int | dim, | |||
int | dimII | |||
) |
Reset all of the geometry datastructures.
thee | Pointer to class Gem | |
dim | the extrinsic spatial dimension | |
dimII | the intrinsic spatial dimension |
void Gem_resetEE | ( | Gem * | thee | ) |
Destroy all of the edges.
thee | Pointer to class Gem |
void Gem_resetSQ | ( | Gem * | thee, | |
int | currentQ | |||
) |
Release all of the simplices in a given queue.
thee | Pointer to class Gem | |
currentQ | index of a given queue |
void Gem_resetSS | ( | Gem * | thee | ) |
Destroy all of the simplices.
thee | Pointer to class Gem |
void Gem_resetVV | ( | Gem * | thee | ) |
Destroy all of the vertices.
thee | Pointer to class Gem |
void Gem_setNumBF | ( | Gem * | thee, | |
int | val | |||
) |
Set the number of boundary faces.
thee | Pointer to class Gem | |
val | value for boundary faces |
void Gem_setNumBV | ( | Gem * | thee, | |
int | val | |||
) |
Set the number of boundary vertices.
thee | Pointer to class Gem | |
val | value for boundary vertices |
void Gem_setNumVirtEE | ( | Gem * | thee, | |
int | i | |||
) |
Set the logical number of edges in the mesh.
thee | Pointer to class Gem | |
i | index for the logical number of edges |
void Gem_setNumVirtFF | ( | Gem * | thee, | |
int | i | |||
) |
Geometry manager constructor.
thee | Pointer to class Gem | |
i | index for the logical number of faces |
void Gem_setNumVirtSS | ( | Gem * | thee, | |
int | i | |||
) |
Set the logical number of simplices in the mesh.
thee | Pointer to class Gem | |
i | index for the logical number of simplices |
void Gem_setNumVirtVV | ( | Gem * | thee, | |
int | i | |||
) |
Set the logical number of vertices in the mesh.
thee | Pointer to class Gem | |
i | index for the logical number of vertices |
void Gem_shapeChk | ( | Gem * | thee | ) |
Traverse the simplices and check their shapes.
thee | Pointer to class Gem |
Calculate the shape quality measure for this simplex.
* Let |s| denote the volume (which may be negative) of a given * d-simplex "s", let v_i (i=0,...,d) denote the vertices of s, * and let e_{ij} denote the d-vectors representing the 3 or 6 edges * of s that connect v_i to v_j. We compute the following shape * quality measure for the simplex s: * * f(s,d) 2^{2(1-1/d)} * 3^{(d-1)/2} * |s|^{2/d} * meas(s,d) = ------ = -------------------------------------- * g(s,d) \sum_{0<=i<j<=d} |e_{ij}|^2 * * 2D Notes: The shape function meas(s,2) is (nearly) the same one used by * Randy Bank and Kent Smith in their joint paper on mesh smoothing: * * f(s,2) 2 * 3^{1/2} * |s| * meas(s,2) = ------ = --------------------------- * g(s,2) \sum_{0<=i<j<=2} |e_{ij}|^2 * * It has the property that its maximal value of 1 is obtained * for an equilateral triangle, and it is scaling invariant, i.e., * we don't have to worry about the size of the triangle. * Their original function was normalized (their numerator was * 2*f(s,2) above) to yield a value of 1 for a equalateral triangle * (with volume 1); this is modified to yield a maximal value * of 1 for the unit triangle (with volume 1/2) to work better with * the unit triangle code. To effect this slightly different * normalization, the numerator of the quality function was changed * to 2(3)^{1/2}|s|. * * 3D Notes: The shape function meas(s,3) is (nearly) the same one used by * Joe and Liu in their paper on quality measures for tetrahedra: * * f(s,3) 2^{4/3} * 3 * |s|^{2/3} * meas(s,3) = ------ = --------------------------- * g(s,3) \sum_{0<=i<j<=3} |e_{ij}|^2 * * It is also scaling invariant, so we don't have to worry about * the size of the tetrahedron. Their original function was * normalized (their numerator was 12(3|s|)^{2/3}) to yield a * maximal value of 1 for a regular tetrahedron (with volume 1); * this was modified to yield a maximal value of 1 for the unit * tetrahedron (with volume 1/6) to work better with the unit * tetrahedron code. To effect this slightly different * normalization, the numerator of the quality function was changed * to f(s,3) = 12(3|s|/6)^{2/3} = 2^{4/3}*3*|s|^{2/3}, as above. *
thee | Pointer to class Gem | |
sm | Pointer to the simplex | |
f | Pointer to volume scaling | |
g | Pointer to the sum of d-vectors representing the 3 or 6 edges |
Calculate gradient of the shape quality measure for this simplex, where the last vertex (vertex d) is treated as the set of independent variables.
thee | Pointer to class Gem | |
sm | Pointer to the simplex | |
vmap | the array of the map | |
dm | gradient of the shape quality measure for this simplex |
Determine the shortest edge of a simplex or a simplex face.
thee | Pointer to class Gem | |
sm | Pointer to the simplex | |
face | index for the face | |
len | Pointer to the current longest edge length |
Build the basic master-to-element transformation information.
thee | Pointer to class Gem | |
sm | Pointer to a simplex | |
t | Pointer to class TT |
Calculate the determinant of the transformation from the master element to this element.
thee | Pointer to class Gem | |
sm | Pointer to the simplex |
void Gem_smoothMesh | ( | Gem * | thee | ) |
Smooth the mesh using simple Laplace smoothing.
thee | Pointer to class Gem |
void Gem_smoothMeshBnd | ( | Gem * | thee | ) |
Smooth the boundary mesh.
thee | Pointer to class Gem |
void Gem_smoothMeshLaplace | ( | Gem * | thee | ) |
Smooth the mesh using simple Laplace smoothing.
thee | Pointer to class Gem |
void Gem_smoothMeshOpt | ( | Gem * | thee | ) |
Smooth the mesh using a volume optimization approach.
thee | Pointer to class Gem |
void Gem_speedChk | ( | Gem * | thee | ) |
Calculate the cost to traverse the various structures.
thee | Pointer to class Gem |
Return the simplex at a particular location in the simplex Q.
thee | Pointer to class Gem | |
currentQ | index of a given queue | |
i | index for the number of simplices in a given queue |
Return a given simplex.
thee | Pointer to class Gem | |
i | Pointer to a given simplex |
void Gem_unHangVertices | ( | Gem * | thee | ) |
Toss out any hanging vertices.
thee | Pointer to class Gem |
int Gem_unRefine | ( | Gem * | thee, | |
int | rkey, | |||
int | pkey | |||
) |
Un-refine the mesh.
thee | Pointer to class Gem | |
rkey | If (rkey==0) Perform recursive simplex bisection until conformity If (rkey==1) Perform first quadra-[octa-]-section, followed by recursive simplex bisection until conformity. IMPORTANT NOTE: In 2D, (rkey==1) WILL generate a conforming mesh. However, in 3D, this procedure will in general produce nonconforming simplices. To produce a conforming mesh in 3D would require an implementation covering all possible face refinement combinations (something like 169 cases). This has been done e.g. by Jurgen Bey in AGM, but we are not that patient; use (rkey==0) above if you want a conforming mesh... If (rkey==2) As a test of the conformity procedure, perform quadra-[octa-]-section until conformity, which should produce a uniformly regularly refined mesh. (In 2D, each triangle should be divided into four children, and in 3D each tetrahedron should be divided into eight children.) | |
pkey | Boolean sets the pkey type to prolongate a vector |
Return a given vertex.
thee | Pointer to class Gem | |
i | index for a given vertex |
void Gem_write | ( | Gem * | thee, | |
int | key, | |||
Vio * | sock, | |||
int | fkey | |||
) |
Toss out any hanging vertices.
thee | Pointer to class Gem | |
key | output format type 0 ==> simplex format 1 ==> edge format 2 ==> simplex-nabor format | |
sock | socket for reading/writing a finite element mesh or mesh function | |
fkey | simplex write option 0 ==> write simplices 1 ==> write only sipmlex boundary faces 2 ==> write only simplices that have at least one boundary face (NOT IMPLEMENTED HERE) |
void Gem_writeBndHeaderOFF | ( | Gem * | thee, | |
Vio * | sock | |||
) |
Produce an OFF file header for a boundary mesh.
thee | Pointer to class Gem | |
sock | socket for reading/writing a finite element mesh or mesh function |
void Gem_writeBrep | ( | Gem * | thee, | |
Vio * | sock | |||
) |
Write out the boundary edges or boundary faces of a 2-simplex or 3-simplex mesh in a "BREP" format for input into Barry Joe's 2D/3D Geompak.
thee | Pointer to class Gem | |
sock | socket for reading/writing a finite element mesh or mesh function |
void Gem_writeBrep2 | ( | Gem * | thee, | |
Vio * | sock | |||
) |
Write out boundary edges of a 2-simplex mesh in a "BREP" format for input into Barry Joe's 2D Geompak.
thee | Pointer to class Gem | |
sock | socket for reading/writing a finite element mesh or mesh function |
void Gem_writeBrep2to3 | ( | Gem * | thee, | |
Vio * | sock | |||
) |
Write out triangles of a 2-manifold as a 3-simplex boundary mesh in a "BREP" format for input into Barry Joe's 3D Geompak.
thee | Pointer to class Gem | |
sock | socket for reading/writing a finite element mesh or mesh function |
void Gem_writeBrep3 | ( | Gem * | thee, | |
Vio * | sock | |||
) |
Write out boundary faces of a 3-simplex mesh in a "BREP" format for input into Barry Joe's 3D Geompak.
thee | Pointer to class Gem | |
sock | socket for reading/writing a finite element mesh or mesh function |
void Gem_writeDX | ( | Gem * | thee, | |
Vio * | sock, | |||
int | fldKey, | |||
double * | defX[MAXV] | |||
) |
Write out a scalar or vector function over a simplex mesh in "DX" (www.opendx.org) format.
thee | Pointer to class Gem | |
sock | socket for reading/writing a finite element mesh or mesh function | |
fldKey | 0 ==> draw mesh as it is 1 ==> write field[] as a scalar field over the mesh 2 ==> write field[] as a 2-vector field over the mesh 3 ==> write field[] as a 3-vector field over the mesh 4 ==> etc | |
defX | defX[][MAXV] ==> possible scalar or vector field |
void Gem_writeEdge | ( | Gem * | thee, | |
Vio * | sock | |||
) |
Write out the edges of a 2- or 3-simplex mesh in "MCEF" (MC-Edge-Format).
thee | Pointer to class Gem | |
sock | socket for reading/writing a finite element mesh or mesh function |
void Gem_writeFace2dGV | ( | Gem * | thee, | |
Vio * | sock, | |||
int | defKey, | |||
int | colKey, | |||
int | chartKey, | |||
double | gluVal, | |||
double * | defX[MAXV] | |||
) |
Write out the faces of a 2-simplex mesh as a complete and legal 1-simplex mesh in "Geomview SKEL" format.
thee | Pointer to class Gem | |
sock | socket for reading/writing a finite element mesh or mesh function | |
defKey | 0 ==> draw mesh as it is 1 ==> use "def??" as new vertex coords (deformation) 2 ==> add "def??" to old vertex coords (displacement) | |
colKey | 0 ==> color simplices all same default color 1 ==> color simplices based on their chart 2 ==> color boundary simplices based on type | |
chartKey | < 0 ==> draw all simplices >= 0 ==> draw only simplices with chart chartKey | |
gluVal | gluVal == 1. ==> draw all simplices glued together 0. < gluVal < 1. ==> draw simplices with some separation | |
defX | defX[][MAXV] ==> vertex deformation or displacement values |
void Gem_writeFace3d | ( | Gem * | thee, | |
Vio * | sock | |||
) |
Write out the faces of a 3-simplex mesh as a complete and legal 2-simplex mesh in "MCSF" format (described above for Gem_read).
thee | Pointer to class Gem | |
sock | socket for reading/writing a finite element mesh or mesh function |
void Gem_writeFace3dGV | ( | Gem * | thee, | |
Vio * | sock, | |||
int | defKey, | |||
int | colKey, | |||
int | chartKey, | |||
double | gluVal, | |||
double * | defX[MAXV] | |||
) |
Write out the faces of a 3-simplex mesh as a complete and legal 2-simplex mesh in "Geomview OFF" format.
thee | Pointer to class Gem | |
sock | socket for reading/writing a finite element mesh or mesh function | |
defKey | 0 ==> draw mesh as it is 1 ==> use "def??" as new vertex coords (deformation) 2 ==> add "def??" to old vertex coords (displacement) | |
colKey | 0 ==> color simplices all same default color 1 ==> color simplices based on their chart 2 ==> color boundary simplices based on type | |
chartKey | < 0 ==> draw all simplices >= 0 ==> draw only simplices with chart chartKey | |
gluVal | gluVal == 1. ==> draw all simplices glued together 0. < gluVal < 1. ==> draw simplices with some separation | |
defX | defX[][MAXV] ==> vertex deformation or displacement values |
void Gem_writeGEOM | ( | Gem * | thee, | |
Vio * | sock, | |||
int | defKey, | |||
int | colKey, | |||
int | chartKey, | |||
double | gluVal, | |||
int | fkey, | |||
double * | defX[MAXV], | |||
char * | format | |||
) |
Write a finite element mesh or mesh function in some format.
thee | Pointer to class Gem | |
sock | socket for reading/writing a finite element mesh or mesh function | |
defKey | defKey == 0 ==> draw mesh as it is defKey == 1 ==> use "def??" as new vertex coords (deformation) defKey == 2 ==> add "def??" to old vertex coords (displacement) | |
colKey | colKey == 0 ==> color simplices all same default color colKey == 1 ==> color simplices based on their chart colKey == 2 ==> color boundary simplices based on type | |
chartKey | chartKey < 0 ==> draw all simplices chartKey >= 0 ==> draw only simplices with chart chartKey | |
gluVal | gluVal == 1. ==> draw all simplices glued together 0. < gluVal < 1. ==> draw simplices with some separation | |
fkey | fkey == 0 ==> draw simplices fkey == 1 ==> draw only simplex boundary faces fkey == 2 ==> draw only simplices with a boundary face | |
defX | Pointer to vertex deformation or displacement values | |
format | Pointer to GV/MATH format |
void Gem_writeGMV | ( | Gem * | thee, | |
Vio * | sock, | |||
int | fldKey, | |||
double * | defX[MAXV] | |||
) |
Write out a scalar or vector function over a simplex mesh in "GMV" (General Mesh Viewer) format.
thee | Pointer to class Gem | |
sock | socket for reading/writing a finite element mesh or mesh function | |
fldKey | 0 ==> draw mesh as it is 1 ==> write field[] as a scalar field over the mesh 2 ==> write field[] as a 2-vector field over the mesh 3 ==> write field[] as a 3-vector field over the mesh 4 ==> etc | |
defX | defX[][MAXV] ==> possible scalar or vector field |
void Gem_writeGV | ( | Gem * | thee, | |
Vio * | sock, | |||
int | defKey, | |||
int | colKey, | |||
int | chartKey, | |||
double | gluVal, | |||
int | fkey, | |||
double * | defX[MAXV] | |||
) |
Write out a mesh in "Geomview OFF" format to a file or socket.
thee | Pointer to class Gem | |
sock | socket for reading/writing a finite element mesh or mesh function | |
defKey | 0 ==> draw mesh as it is 1 ==> use "def??" as new vertex coords (deformation) 2 ==> add "def??" to old vertex coords (displacement) | |
colKey | 0 ==> color simplices all same default color 1 ==> color simplices based on their chart 2 ==> color boundary simplices based on type | |
chartKey | < 0 ==> draw all simplices >= 0 ==> draw only simplices with chart chartKey | |
gluVal | gluVal == 1. ==> draw all simplices glued together 0. < gluVal < 1. ==> draw simplices with some separation | |
fkey | 0 ==> draw simplices 1 ==> draw only simplex boundary faces 2 ==> draw only simplices with a boundary face | |
defX | defX[][MAXV] ==> vertex deformation or displacement values |
void Gem_writeHeaderMATH | ( | Gem * | thee, | |
Vio * | sock | |||
) |
Produce an MATH file header for a volume mesh.
thee | Pointer to class Gem | |
sock | socket for reading/writing a finite element mesh or mesh function |
void Gem_writeMATH | ( | Gem * | thee, | |
Vio * | sock, | |||
int | defKey, | |||
int | colKey, | |||
int | chartKey, | |||
double | gluVal, | |||
int | fkey, | |||
double * | defX[MAXV] | |||
) |
Write out a mesh in "Mathematica" format to a file or socket.
thee | Pointer to class Gem | |
sock | socket for reading/writing a finite element mesh or mesh function | |
defKey | 0 ==> draw mesh as it is 1 ==> use "def??" as new vertex coords (deformation) 2 ==> add "def??" to old vertex coords (displacement) | |
colKey | 0 ==> color simplices all same default color 1 ==> color simplices based on their chart 2 ==> color boundary simplices based on type | |
chartKey | < 0 ==> draw all simplices >= 0 ==> draw only simplices with chart chartKey | |
gluVal | gluVal == 1. ==> draw all simplices glued together 0. < gluVal < 1. ==> draw simplices with some separation | |
fkey | 0 ==> draw simplices 1 ==> draw only simplex boundary faces 2 ==> draw only simplices with a boundary face | |
defX | defX[][MAXV] ==> vertex deformation or displacement values |
void Gem_writeSOL | ( | Gem * | thee, | |
Vio * | sock, | |||
int | fldKey, | |||
double * | defX[MAXV], | |||
char * | format | |||
) |
Write a finite element mesh or mesh function in some format.
thee | Pointer to class Gem | |
sock | socket for reading/writing a finite element mesh or mesh function | |
fldKey | index for drawing the mesh fldKey == 0 ==> draw mesh as it is fldKey == 1 ==> write field[] as a scalar field over the mesh fldKey == 2 ==> write field[] as a 2-vector field over the mesh fldKey == 3 ==> write field[] as a 3-vector field over the mesh fldKey == 4 ==> etc | |
defX | Pointer to vertex deformation or displacement values | |
format | Pointer to GV/MATH format |
void Gem_writeTEC | ( | Gem * | thee, | |
Vio * | sock, | |||
int | fldKey, | |||
double * | defX[MAXV] | |||
) |
Write out a scalar or vector function over a simplex mesh in "TEC" (www.opendx.org) format.
thee | Pointer to class Gem | |
sock | socket for reading/writing a finite element mesh or mesh function | |
fldKey | 0 ==> draw mesh as it is 1 ==> write field[] as a scalar field over the mesh 2 ==> write field[] as a 2-vector field over the mesh 3 ==> write field[] as a 3-vector field over the mesh 4 ==> etc | |
defX | defX[][MAXV] ==> possible scalar or vector field |
void Gem_writeTrailerMATH | ( | Gem * | thee, | |
Vio * | sock | |||
) |
Produce an MATH file trailer.
thee | Pointer to class Gem | |
sock | socket for reading/writing a finite element mesh or mesh function |
void Gem_writeTrailerOFF | ( | Gem * | thee, | |
Vio * | sock | |||
) |
Produce an OFF file trailer.
thee | Pointer to class Gem | |
sock | socket for reading/writing a finite element mesh or mesh function |
void Gem_writeUCD | ( | Gem * | thee, | |
Vio * | sock, | |||
int | fldKey, | |||
double * | defX[MAXV] | |||
) |
Write out a scalar or vector function over a simplex mesh in "UCD" (Unstructured Cell Data) format for AVS 5.0.
thee | Pointer to class Gem | |
sock | socket for reading/writing a finite element mesh or mesh function | |
fldKey | 0 ==> draw mesh as it is 1 ==> write field[] as a scalar field over the mesh 2 ==> write field[] as a 2-vector field over the mesh 3 ==> write field[] as a 3-vector field over the mesh 4 ==> etc | |
defX | defX[][MAXV] ==> possible scalar or vector field |
void Gem_writeVolHeaderOFF | ( | Gem * | thee, | |
Vio * | sock | |||
) |
Produce an OFF file header for a volume mesh.
thee | Pointer to class Gem | |
sock | socket for reading/writing a finite element mesh or mesh function |