Gem class

The geometry manager object. More...


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.
VVGem_VV (Gem *thee, int i)
 Return a given vertex.
VVGem_createVV (Gem *thee)
 Create a new vertex (becoming the new last vertex).
VVGem_firstVV (Gem *thee)
 Return the first vertex.
VVGem_lastVV (Gem *thee)
 Return the last vertex.
VVGem_nextVV (Gem *thee)
 Return the next vertex.
VVGem_prevVV (Gem *thee)
 Return the previous vertex.
VVGem_peekFirstVV (Gem *thee)
 Peek at the first vertex.
VVGem_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.
EEGem_EE (Gem *thee, int i)
 Return a given edge.
EEGem_createEE (Gem *thee)
 Create a new edge (becoming the new last edge).
EEGem_firstEE (Gem *thee)
 Return the first edge.
EEGem_lastEE (Gem *thee)
 Return the last edge.
EEGem_nextEE (Gem *thee)
 Return the next edge.
EEGem_prevEE (Gem *thee)
 Return the previous edge.
EEGem_peekFirstEE (Gem *thee)
 Peek at the first edge.
EEGem_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.
SSGem_SS (Gem *thee, int i)
 Return a given simplex.
SSGem_createSS (Gem *thee)
 Create a new simplex (becoming the new last simplex).
SSGem_firstSS (Gem *thee)
 Return the first simplex.
SSGem_lastSS (Gem *thee)
 Return the last simplex.
SSGem_nextSS (Gem *thee)
 Return the next simplex.
SSGem_prevSS (Gem *thee)
 Return the previous simplex.
SSGem_peekFirstSS (Gem *thee)
 Peek at the first simplex.
SSGem_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.
GemGem_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.
VVGem_createAndInitVV (Gem *thee)
 Create and initialize a new vertex; return a point to it.
EEGem_createAndInitEE (Gem *thee)
 Create and initialize a new edge; return a point to it.
SSGem_createAndInitSS (Gem *thee)
 Create and initialize a new simplex; return a point to it.
SSGem_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.
EEGem_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.
SSGem_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.

Detailed Description

The geometry manager object.


Typedef Documentation

typedef struct sGem Gem

Declaration of the Gem class as the Gem structure.

Author:
Michael Holst
Returns:
None


Function Documentation

void Gem_addToNumBF ( Gem thee,
int  val 
)

Increment the number of boundary faces by a given integer.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
None
Parameters:
thee Pointer to class Gem
val value for incrementing the number of boundary vertices

void Gem_appendSQ ( Gem thee,
int  currentQ,
SS qsm 
)

Append a simplex to the end of a simplex Q.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c)
Returns:
None
Parameters:
thee Pointer to class Gem
currentQ index of a given queue
qsm Pointer to the simplex

void Gem_bisectLE ( Gem thee,
SS sm,
int  currentQ 
)

Bisection refinement of a single simplex by longest edge.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemref.c)
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.
Returns:
None
Parameters:
thee Pointer to class Gem
sm pointer to the simplex
currentQ index of a given queue

void Gem_bisectNP ( Gem thee,
SS sm,
int  currentQ 
)

Bisection refinement by pairs.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemref.c)
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.
Returns:
None
Parameters:
thee Pointer to class Gem
sm pointer to the simplex
currentQ index of a given queue

void Gem_bisectNV ( Gem thee,
SS sm,
int  currentQ 
)

Bisection refinement of a single simplex by newest vertex.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemref.c)

 *           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 ---------------------------------------- *)
 * 
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemg.c)
Returns:
None
Parameters:
thee Pointer to class Gem

void Gem_buildSfromE ( Gem thee  ) 

Build a vertex-simplex mesh from a vertex-edge mesh.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemio.c)
 * 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
 * 
Returns:
None
Parameters:
thee Pointer to class Gem

void Gem_buildSurfaceTrans ( Gem thee,
int  iface,
TT t 
)

Build the complete masterFace-to-elementFace transformation.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemg.c)
We ASSUME that Gem_simplexInfo has already been called to build the basic information in the TT structure we are given. We then compute some additional things here for a SINGLE face specified by "iface", such as the inverse transformations and various determinants.
We do not actually have to assume that Gem_buildVolumeTrans has been previously called, only that Gem_simplexInfo has been called. However, it seems that all situations that occur result in Gem_buildVolumeTrans being called for an element before Gem_buildSurfTrans is called on any face.
Returns:
None
Parameters:
thee Pointer to class Gem
iface index for the faces in a simplex
t index for class TT

void Gem_buildVolumeTrans ( Gem thee,
SS sm,
TT t 
)

Build the complete master-to-element transformatio.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemg.c)
We just call Gem_simplexInfo to build the basic information, and then we compute the transformation and some additional things like the inverse transformations and various determinants.
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemg.c)
Returns:
None
Parameters:
thee Pointer to class Gem

void Gem_clearEdges ( Gem thee  ) 

Clear all of the edge numbers in each simplex.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c)
Returns:
None
Parameters:
thee Pointer to class Gem

void Gem_contentChk ( Gem thee  ) 

Print out contents of all geometry structures.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemchk.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c)
Based on a simplex traversal.
Returns:
None
Parameters:
thee Pointer to class Gem

void Gem_countFaces ( Gem thee  ) 

Count all of the faces without actually creating them.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c)
Keep track of the global face numbers in each element.
Returns:
None
Parameters:
thee Pointer to class Gem

EE* Gem_createAndInitEE ( Gem thee  ) 

Create and initialize a new edge; return a point to it.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c)
Returns:
a point to the newly created and initialized edge
Parameters:
thee Pointer to class Gem

SS* Gem_createAndInitSS ( Gem thee  ) 

Create and initialize a new simplex; return a point to it.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c)
Returns:
a point to the newly created and initialized simplex
Parameters:
thee Pointer to class Gem

VV* Gem_createAndInitVV ( Gem thee  ) 

Create and initialize a new vertex; return a point to it.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c)
Returns:
a point to the newly created and initialized vertex
Parameters:
thee Pointer to class Gem

void Gem_createEdges ( Gem thee  ) 

Create all of the edges.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c)
Based on a simplex traversal. We also set the edge numbers in the simplices while we we are doing the edge creation.
Returns:
None
Parameters:
thee Pointer to class Gem

EE* Gem_createEE ( Gem thee  ) 

Create a new edge (becoming the new last edge).

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
Pointer to the new created edge
Parameters:
thee Pointer to class Gem

void Gem_createSimplexRings ( Gem thee  ) 

Create all of the simplex rings.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c)
Returns:
None
Parameters:
thee Pointer to class Gem

SS* Gem_createSS ( Gem thee  ) 

Create a new simplex (becoming the new last simplex).

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
a new simplex (becoming the new last simplex).
Parameters:
thee Pointer to class Gem

VV* Gem_createVV ( Gem thee  ) 

Create a new vertex (becoming the new last vertex).

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
Pointer to the new created vertex
Parameters:
thee Pointer to class Gem

Gem* Gem_ctor ( Vmem *  vmem,
PDE tpde 
)

Geometry manager constructor.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c)
Returns:
Pointer to a newly allocated (empty) Gem class
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemgen.c)
Returns:
Success enumeration
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemgen.c)
 *           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.
 * 
Returns:
None
Parameters:
thee Pointer to class Gem

void Gem_delSimplex ( Gem thee,
SS sm,
int  currentQ 
)

Delete a simplex cleanly, maintaining a consecutive list.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemunref.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c)
Returns:
None
Parameters:
thee Pointer to class Gem

void Gem_destroyEE ( Gem thee  ) 

Destroy the last edge.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
None
Parameters:
thee Pointer to class Gem

void Gem_destroySimplexRings ( Gem thee  ) 

Destroy all of the simplex rings.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c)
Returns:
None
Parameters:
thee Pointer to class Gem

void Gem_destroySS ( Gem thee  ) 

Destroy the last simplex.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
None
Parameters:
thee Pointer to class Gem

void Gem_destroyVV ( Gem thee  ) 

Destroy the last vertex.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
None
Parameters:
thee Pointer to class Gem

int Gem_dim ( Gem thee  ) 

Return the extrinsic spatial dimension.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the extrinsic spatial dimension.
Parameters:
thee Pointer to class Gem

int Gem_dimEE ( Gem thee  ) 

Return the number of edges in a simplex.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the number of edges in a simplex
Parameters:
thee Pointer to class Gem

int Gem_dimII ( Gem thee  ) 

Return the extrinsic spatial dimension.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the extrinsic spatial dimension.
Parameters:
thee Pointer to class Gem

int Gem_dimVV ( Gem thee  ) 

Return the number of vertices in a simplex.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the number of vertices in a simplex
Parameters:
thee Pointer to class Gem

void Gem_dtor ( Gem **  thee  ) 

Geometry manager destructor.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c)
Returns:
None
Parameters:
thee Pointer to class Gem

double Gem_edgeLength ( Gem thee,
VV v0,
VV v1 
)

Calculate the edge lengths of a simplex.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemg.c)
Returns:
the edge lengths of a simplex
Parameters:
thee Pointer to class Gem
v0 Pointer to the first vertex
v1 Pointer to the second vertex

double Gem_edgeRatio ( Gem thee,
SS sm 
)

Calculate ratio of longest-to-shortest edge of a simplex.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemg.c)
Returns:
ratio of longest-to-shortest edge of a simplex.
Parameters:
thee Pointer to class Gem
sm Pointer to the simplex

EE* Gem_EE ( Gem thee,
int  i 
)

Return a given edge.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
a given edge
Parameters:
thee Pointer to class Gem
i index for a given edge

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.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c)
Returns:
Pointer to the common edges between two vertices.
Parameters:
thee Pointer to class Gem
v0 Pointer to the first vertex
v1 Pointer to the second vertex
iDid index for creating an edge

SS* Gem_findSimplex ( Gem thee,
VV vx 
)

Find a simplex containing a given vertex.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemgen.c)
Returns:
Pointer to the simplex
Parameters:
thee Pointer to class Gem
vx Pointer to the vertex

EE* Gem_firstEE ( Gem thee  ) 

Return the first edge.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the first edge
Parameters:
thee Pointer to class Gem

SS* Gem_firstSS ( Gem thee  ) 

Return the first simplex.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the first simplex
Parameters:
thee Pointer to class Gem

VV* Gem_firstVV ( Gem thee  ) 

Return the first vertex.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the first vertex
Parameters:
thee Pointer to class Gem

void Gem_flip ( Gem thee,
VV vx 
)

Edge or face flip for the incremental flip algorithm.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemgen.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemchk.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c)
Returns:
None
Parameters:
thee Pointer to class Gem
key 0 --> ?

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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemgen.c)
Returns:
Success enumeration
Parameters:
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

EE* Gem_lastEE ( Gem thee  ) 

Return the last edge.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the last edge
Parameters:
thee Pointer to class Gem

SS* Gem_lastSS ( Gem thee  ) 

Return the last simplex.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the last simplex
Parameters:
thee Pointer to class Gem

VV* Gem_lastVV ( Gem thee  ) 

Return the last vertex.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the last vertex
Parameters:
thee Pointer to class Gem

int Gem_longestEdge ( Gem thee,
SS sm,
int  face,
double *  len 
)

Determine the longest edge of a simplex or a simplex face.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemg.c)
It is critical to have a consistent tie-breaking rule in order to guarantee that recursive refinement procedures:
(1) produce conforming meshes (two simplices will refine the same edge of a shared face)
(2) terminate in finite steps (due to (1)).
Returns:
The permutation map of the longest edge of a simplex or a simplex face.
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemchk.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemchk.c)
Returns:
None
Parameters:
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.

Authors:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemcube.c)
Returns:
None
Parameters:
thee Pointer to class Gem

void Gem_makeIcosahedron ( Gem thee  ) 

Generate a unit icosahedron domain.

Authors:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemcube.c)
Returns:
None
Parameters:
thee Pointer to class Gem

void Gem_makeOctahedron ( Gem thee  ) 

Generate a unit octahedron domain.

Authors:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemcube.c)
Returns:
None
Parameters:
thee Pointer to class Gem

void Gem_markEdges ( Gem thee  ) 

Produce the initial edge markings in all of the simplices.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemg.c)
Returns:
None
Parameters:
thee Pointer to class Gem

int Gem_markRefine ( Gem thee,
int  key,
int  color 
)

Mark simplices to be refined.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemref.c)
Returns:
number of marked simplices
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemchk.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemchk.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemchk.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemchk.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemchk.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemchk.c)
Returns:
None
Parameters:
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

int Gem_newestVertex ( Gem thee,
SS sm,
int  face,
double *  len 
)

Determine the edge of a simplex opposite the newest vertex.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemg.c)
Returns:
The permutation map of the edge of a simplex opposite the newest vertex
Parameters:
thee Pointer to class Gem
sm Pointer to the simplex
face index for the face
len Pointer to the current longest edge length

EE* Gem_nextEE ( Gem thee  ) 

Return the next edge.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the next edge
Parameters:
thee Pointer to class Gem

SS* Gem_nextSS ( Gem thee  ) 

Return the next simplex.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the next simplex
Parameters:
thee Pointer to class Gem

VV* Gem_nextVV ( Gem thee  ) 

Return the next vertex.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the next vertex
Parameters:
thee Pointer to class Gem

int Gem_numBF ( Gem thee  ) 

Return the number of boundary faces.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the number of boundary faces.
Parameters:
thee Pointer to class Gem

void Gem_numBFmm ( Gem thee  ) 

Decrement the number of boundary faces by 1.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
None
Parameters:
thee Pointer to class Gem

void Gem_numBFpp ( Gem thee  ) 

Increment the number of boundary faces by 1.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
None
Parameters:
thee Pointer to class Gem

int Gem_numBV ( Gem thee  ) 

Return the number of boundary vertices.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the number of boundary vertices
Parameters:
thee Pointer to class Gem

void Gem_numBVmm ( Gem thee  ) 

Decrement the number of boundary vertices by 1.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
None
Parameters:
thee Pointer to class Gem

void Gem_numBVpp ( Gem thee  ) 

Increment the number of boundary vertices by 1.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
None
Parameters:
thee Pointer to class Gem

int Gem_numEE ( Gem thee  ) 

Return the number of edge.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the number of edges.
Parameters:
thee Pointer to class Gem

int Gem_numSQ ( Gem thee,
int  currentQ 
)

Return the number of simplices in a given queue.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the number of simplices in a given queue.
Parameters:
thee Pointer to class Gem
currentQ index of a given queue

int Gem_numSS ( Gem thee  ) 

Return the number of simplices.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the number of simplicies
Parameters:
thee Pointer to class Gem

int Gem_numVirtEE ( Gem thee  ) 

Return the logical number of edges in the mesh.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the logical number of edges in the mesh.
Parameters:
thee Pointer to class Gem

int Gem_numVirtFF ( Gem thee  ) 

Return the logical number of faces in the mesh.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the logical number of faces in the mesh.
Parameters:
thee Pointer to class Gem

int Gem_numVirtSS ( Gem thee  ) 

Return the logical number of simplices in the mesh.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the logical number of simplices in the mesh.
Parameters:
thee Pointer to class Gem

int Gem_numVirtVV ( Gem thee  ) 

Return the logical number of vertices in the mesh.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the logical number of vertices in the mesh.
Parameters:
thee Pointer to class Gem

int Gem_numVV ( Gem thee  ) 

Return the number of vertices in the mesh.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the number of vertices in the mesh.
Parameters:
thee Pointer to class Gem

void Gem_octsect ( Gem thee,
SS sm,
int  currentQ 
)

Uniform regular (quadrasection) refinement of a single simplex.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemref.c)
Boundary nodes/edges[faces] are correctly refined.
Returns:
None
Parameters:
thee Pointer to class Gem
sm pointer to the simplex
currentQ index of a given queue

int Gem_orient ( Gem thee,
SS sm 
)

Determine the orientation of the vertices in a simplex.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemgen.c)
Returns:
Success enumeration
Parameters:
thee Pointer to class Gem
sm Pointer to the simplex

EE* Gem_peekFirstEE ( Gem thee  ) 

Peek at the first edge.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
Pointer to the first edge in the list
Parameters:
thee Pointer to class Gem

SS* Gem_peekFirstSS ( Gem thee  ) 

Peek at the first simplex.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
Pointer to the first simplex in the list
Parameters:
thee Pointer to class Gem

VV* Gem_peekFirstVV ( Gem thee  ) 

Peek at the first vertex.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
Pointer to the first vertex in the list
Parameters:
thee Pointer to class Gem

EE* Gem_peekLastEE ( Gem thee  ) 

Peek at the last edge.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
Pointer to the last edge in the list
Parameters:
thee Pointer to class Gem

SS* Gem_peekLastSS ( Gem thee  ) 

Peek at the last simplex.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
Pointer to the last simplex in the list
Parameters:
thee Pointer to class Gem

VV* Gem_peekLastVV ( Gem thee  ) 

Peek at the last vertex.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
Pointer to the last vertex in the list
Parameters:
thee Pointer to class Gem

int Gem_pointInSimplex ( Gem thee,
SS sm,
double  x[] 
)

Determine whether or a not a point is in a simplex.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemgen.c)
Returns:
Success enumeration
Parameters:
thee Pointer to class Gem
sm Pointer to the simplex
x arrary of the point position

int Gem_pointInSimplexVal ( Gem thee,
SS sm,
double  x[],
double  phi[],
double  phix[][3] 
)

Evaluate basis functions at a point in a simplex.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemgen.c)
Returns:
Success enumeration
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemgen.c)
Returns:
None
Parameters:
thee Pointer to class Gem

EE* Gem_prevEE ( Gem thee  ) 

Return the previous edge.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the previous edge
Parameters:
thee Pointer to class Gem

SS* Gem_prevSS ( Gem thee  ) 

Return the previous simplex.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the previous simplex
Parameters:
thee Pointer to class Gem

VV* Gem_prevVV ( Gem thee  ) 

Return the previous vertex.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
the previous vertex
Parameters:
thee Pointer to class Gem

void Gem_ramClear ( Gem thee,
int  key 
)

Check some structures.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemchk.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemio.c)
 *        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.
 * 
Returns:
Success enumeration
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemio.c)
 * 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.
 * 
Returns:
Success enumeration
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemref.c)
Longest Edge, Newest Vertex, or Newest Pair, is used to bisect a single simplex in an asymptotically non-degenerate way in the "bisect[LE,NV,NP]" routines which are called from this routine. Marked simplices are subdivided into 2/4/8 child simplices. A closure algorithm is performed which continues subdivision until a conforming mesh is produced. Boundary nodes/edges[faces] are correctly refined.

We purposely do the following trick in order to facilitate the construction of a prolongation operator after refinement, if it is so desired. We begin the refinement with no edges; only the conforming mesh as described by the list of vertices and the list of simplices using the vertices. When a simplex is to be subdivided, the refinement edge (or edges) is then identified, and then created on the fly. The new vertex which is created by the refinement, namely the midpoint of the edge, is then stored with the newly created edge. The edge is added to the ring of edges around each of its two vertices. This allows our refinement algorithm to easily detect whether or not an edge has already been refined by a naboring simplex by simply traversing the edge lists of the two vertices on the refinement edge. If the edge exists, then it must have already been refined, since it is only created in order to refine it. Moreover, the new vertex at the midpoint of the edge is then also directly available from the edge structure for use in building the children simplices, without having to search for it. (The edge datastructure can be viewed as simply a holding cell for the newly created vertices so that they can be found without any searching.)

How does this help us to later build an appropriate prolongation operator between the original mesh and the final refined mesh? While we begin the refinement with no edges, we end with a list of edges that is precisely the set of edges that were refined. Let us order the function values of a mesh function on the fine mesh (with function values at vertices) in the following order: vertices common to the coarse mesh in the same order as the coarse mesh, followed by vertices at the midpoints of the refined mesh, in the order of the edges in the edge list. The linear prolongation operator (for example) which would linearly interpolate a function from the original coarse mesh to the refined mesh is then a block 2x1 matrix. The upper block is a square identity matrix with number of rows/columns equal to the number of vertices in the original mesh; it is completely clear how to build this upper block. The lower block is a (generally) rectangular matrix, with number of rows equal to the number of edges that were refined. Since we finish refinement with precisely the refined edges in the edge list, he can simply traverse the edge list to build the lower block of the prolongation matrix. In particular, in the linear interpolation case, each row of the lower block will be zero, except for two columns, corresponding to the vertex numbers of the two coarse mesh vertices which lie on the ends of the edge that was refined. A value of 0.5 is then placed in those two columns.

In the case of linear prolongation, the lower block of the prolongation matrix has exactly one row for each edge that was refined, with zeros as every entry except for the two columns corresponding to the vertex numbers that were on each end of the edge that was bisected.

There is an opportunity for a problem with this approach; if an edge is multiply refined, then we must keep track of all of the resulting edges and their parent-child relationships, in order to build the correct interpolation. The lower block of the prolongation matrix will now be slightly more complicated than described above.
Returns:
number of refined simplices
Parameters:
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

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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemref.c)

Note that we MUST determine the type of the new point (interior or boundary) based effectively on EDGE types rather than vertex or face types. It is easy to construct examples where typing based on vertex type can mark a new interior point falsely as a boundary point. Note that typing by the faces of a single simplex which uses the bisection edge can also be fooled in 3D (it is foolproof in 2D). For example, it may be the case in 3D that an edge of a tet touches a boundary, but none of its faces are boundary faces. In this case, the new point would be marked (incorrectly) as an interior point.

The solution to this problem is to determine the type of the new point by using the type of the edge. The only problem we then face is how to do this without actually having edges around. In other words, we must determine the correct edge type on the fly. This can be handled by looking at all faces of all simplices which use the edge, and applying the following rules: (1) If all faces are interior, the edge is interior (3) If at least one face is boundary, the edge is boundary

Note that since we must look at all simplices on the ring around the edge anyway to handle the conformity situation, we don't have to do any additional work to determine the correct edge type. Therefore, we will take this approach at determining the correct edge type on the fly, EVEN IF the edges are always around and their correct types are recorded correctly once and for all when a mesh is built.

This way we can also do lazy edge creation; i.e., create an edge only when it needs to be refined. The lazy edge is then in principle simply a holder for the new point, allowing O(1) access to the new point by other simplices, through the edge rings around their vertices.

Note that lazy edge creation has a serious performance benefit to this routine in particular: if all edges are around, then to find a particular edge, we then always have to search both edge rings associated with each vertex for a common edge. This means we look for the intersection of two sets of five elements on average in 2D, and two sets of fifteen elements on average in 3D. With lazy edge creation, we search only through lists of edges that were created for refinement; these lists are usually a much smaller.

A final advantage of lazy edge creation is that having a list of only the refined edges allows us to efficiently build a prolongation operator between the original mesh and the refined mesh.
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemg.c)
This relies on an embedding of R2 into R3 (or R3 into R4) and breaks e.g. if this is a non-orientable 2-manifold, etc.
Returns:
None
Parameters:
thee Pointer to class Gem

void Gem_reset ( Gem thee,
int  dim,
int  dimII 
)

Reset all of the geometry datastructures.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
None
Parameters:
thee Pointer to class Gem

void Gem_resetSQ ( Gem thee,
int  currentQ 
)

Release all of the simplices in a given queue.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
None
Parameters:
thee Pointer to class Gem
currentQ index of a given queue

void Gem_resetSS ( Gem thee  ) 

Destroy all of the simplices.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
None
Parameters:
thee Pointer to class Gem

void Gem_resetVV ( Gem thee  ) 

Destroy all of the vertices.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
None
Parameters:
thee Pointer to class Gem

void Gem_setNumBF ( Gem thee,
int  val 
)

Set the number of boundary faces.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
None
Parameters:
thee Pointer to class Gem
val value for boundary faces

void Gem_setNumBV ( Gem thee,
int  val 
)

Set the number of boundary vertices.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
None
Parameters:
thee Pointer to class Gem
i index for the logical number of edges

void Gem_setNumVirtFF ( Gem thee,
int  i 
)

Geometry manager constructor.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemg.c)
Returns:
None
Parameters:
thee Pointer to class Gem

double Gem_shapeMeasure ( Gem thee,
SS sm,
double *  f,
double *  g 
)

Calculate the shape quality measure for this simplex.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemg.c)
 *           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.
 * 
Returns:
the shape quality measure for this simplex
Parameters:
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

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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemg.c)
Returns:
None
Parameters:
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

int Gem_shortestEdge ( Gem thee,
SS sm,
int  face,
double *  len 
)

Determine the shortest edge of a simplex or a simplex face.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemg.c)
It is critical to have a consistent tie-breaking rule in order to guarantee that recursive refinement procedures:
(1) produce conforming meshes (two simplices will refine the same edge of a shared face)
(2) terminate in finite steps (due to (1)).
Returns:
The permutation map of the shortest edge of a simplex or a simplex face.
Parameters:
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_simplexInfo ( Gem thee,
SS sm,
TT t 
)

Build the basic master-to-element transformation information.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemg.c)

gchart ==> unified common chart for vertex coordinates
chart[4] ==> individual charts for vertex coordinates

D ==> jacobian determinant of the transformation
Dcook ==> jacobian determinant of cooked trans
faceD[4] ==> face jacobian determinants

ff[3][3], bb[3] ==> affine trans from master to arbitrary el
gg[3][3], cc[3] ==> affine trans from arbitrary el to master

loc[4][3] ==> local ordering of vertices for each face
vx[4][3] ==> vertex coordinate labels
nvec[4][3] ==> normal vectors to the faces
evec[6][3] ==> edge vectors
elen[6] ==> edge vector lengths

dimV ==> number of vertices in the d-simplex
dimE ==> number of edges in the d-simplex
dimF ==> number of faces in the d-simplex
dimS ==> number of simplices in the d-simplex (=1)

sid ==> global simplex ID
vid[4] ==> global vertex IDs
fid[4] ==> global face IDs
eid[6] ==> global edge IDs

stype ==> global simplex type
vtype[4] ==> global vertex types
ftype[4] ==> global face types
etype[6] ==> LOCAL edge types

*s ==> pointer to the simplex
*v[4] ==> pointers to vertices of the simplex
Returns:
None
Parameters:
thee Pointer to class Gem
sm Pointer to a simplex
t Pointer to class TT

double Gem_simplexVolume ( Gem thee,
SS sm 
)

Calculate the determinant of the transformation from the master element to this element.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemg.c)
We just call Gem_simplexInfo to build the basic information, and then we build the transformation and compute the determinant here.
For a manifold, we need to know the orientation of the manifold in order to decide what is counter-clock-wise, and what is clockwise, in terms of vertex orderings. One will lead to a positive volume, and the other to a negative volume, when we compute volume using the determinant of the jacobian of the affine transformation to the master element. We assume here that the uniform chart computed by Gem_simplexInfo is such that the orientation in the chart reflects the correct orientation of the manifold (locally).
Returns:
the determinant of the transformation from the master element to this element.
Parameters:
thee Pointer to class Gem
sm Pointer to the simplex

void Gem_smoothMesh ( Gem thee  ) 

Smooth the mesh using simple Laplace smoothing.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemg.c)
We don't need the simplex rings here, but we need the edge rings.
Returns:
None
Parameters:
thee Pointer to class Gem

void Gem_smoothMeshBnd ( Gem thee  ) 

Smooth the boundary mesh.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemg.c)
Returns:
None
Parameters:
thee Pointer to class Gem

void Gem_smoothMeshLaplace ( Gem thee  ) 

Smooth the mesh using simple Laplace smoothing.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemg.c)
We don't need the simplex rings here, but we need the edge rings.
Returns:
None
Parameters:
thee Pointer to class Gem

void Gem_smoothMeshOpt ( Gem thee  ) 

Smooth the mesh using a volume optimization approach.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemg.c)
Returns:
None
Parameters:
thee Pointer to class Gem

void Gem_speedChk ( Gem thee  ) 

Calculate the cost to traverse the various structures.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemchk.c)
Returns:
None
Parameters:
thee Pointer to class Gem

SS* Gem_SQ ( Gem thee,
int  currentQ,
int  i 
)

Return the simplex at a particular location in the simplex Q.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c)
Returns:
the simplex at a particular location in the simplex Q.
Parameters:
thee Pointer to class Gem
currentQ index of a given queue
i index for the number of simplices in a given queue

SS* Gem_SS ( Gem thee,
int  i 
)

Return a given simplex.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
a given simplex
Parameters:
thee Pointer to class Gem
i Pointer to a given simplex

void Gem_unHangVertices ( Gem thee  ) 

Toss out any hanging vertices.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemunref.c)
Returns:
None
Parameters:
thee Pointer to class Gem

int Gem_unRefine ( Gem thee,
int  rkey,
int  pkey 
)

Un-refine the mesh.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemunref.c)
If (key==0) Simply toss out the marked simplices; this leaves "holes", and we mark all neighbor faces that were revealed as boundary faces.
Returns:
number of unrefined mesh elements
Parameters:
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

VV* Gem_VV ( Gem thee,
int  i 
)

Return a given vertex.

Author:
Michael Holst
Note:
Class Gem: Inlineable methods (gem.c) if !defined(VINLINE_GEM)
Returns:
a given vertex.
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemio.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemdisp.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemio.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemio.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemio.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemio.c)
Returns:
None
Parameters:
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.

Authors:
Nathan Baker, Stephen Bond, and Michael Holst (created using Mike Holst's Gem_writeGMV as template)
Note:
Class Gem: Non-inlineable methods (gemdisp.c)
Returns:
None
Parameters:
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).

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemio.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemdisp.c)
Returns:
None
Parameters:
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).

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemio.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemdisp.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemdisp.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemdisp.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemdisp.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemdisp.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemdisp.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemdisp.c)
Returns:
None
Parameters:
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.

Authors:
Nathan Baker, Jason Suen, and Michael Holst (created using Mike Holst's Gem_writeGMV as template)
Note:
Class Gem: Non-inlineable methods (gemdisp.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemdisp.c)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemdisp.c)
Returns:
None
Parameters:
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.

Authors:
Amit Majumdar and Stephen Bond (created using Mike Holst's Gem_writeGMV as template)
Note:
Class Gem: Non-inlineable methods (gemdisp.c)
Format: Our particular use of the UCD format is as follows

PART 1.1: [# NODES] [# CELLS] [DIM NODEDAT] [DIM CELLDAT] [0]
PART 1.2: [NODE ID] [X COORD] [Y COORD] [Z COORD]
(REPEATED FOR EACH NODE)
PART 1.3: [CELL ID] [MATERIAL] [CELL TYPE] [LIST OF NODE IDS]
(REPEATED FOR EACH CELL)
PART 2.1: [NUM NODE FIELD COMPONENTS] [LIST OF COMPONENT SIZES]
PART 2.2: [COMPONENT LABEL], [COMPONENT UNITS]
(REPEATED FOR EACH NODE DATA COMPONENT)
PART 2.3: [NODE ID] [DATA VALUES]
(REPEATED FOR EACH NODE)

PART 3.1: [NUM CELL FIELD COMPONENTS] [LIST OF COMPONENT SIZES]
PART 3.2: [COMPONENT LABEL], [COMPONENT UNITS]
(REPEATED FOR EACH CELL DATA COMPONENT)
PART 3.3: [CELL ID] [DATA VALUES]
(REPEATED FOR EACH CELL)
Returns:
None
Parameters:
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.

Author:
Michael Holst
Note:
Class Gem: Non-inlineable methods (gemdisp.c)
Returns:
None
Parameters:
thee Pointer to class Gem
sock socket for reading/writing a finite element mesh or mesh function


Generated on Mon Aug 9 11:13:45 2010 for MC by  doxygen 1.5.6