File libluminate/illuminator.c

RCS Header

This is the illuminator.c main file. It has all of the routines which compute the triangulation in a distributed way.


Included Files


Preprocessor definitions

#define PNG_NO_MMX_CODE 1

#define ORBIT2 1

#define IMLIB2_EXISTS 1

#define DPRINTF( fmt, args... )

#define MAX_TRIANGLES 10000000

#define __FUNCT__ "ISurfCreate"

#define __FUNCT__ "ISurfDestroy"

#define __FUNCT__ "ISurfClear"

#define __FUNCT__ "storetri"

#define __FUNCT__ "DrawTetWithPlane"

#define COORD( c1, c2, index )

#define __FUNCT__ "DrawTet"

#define __FUNCT__ "DrawHex"

#define __FUNCT__ "Draw3DBlock"


Global Function Draw3DBlock()

Calculate vertices of isoquant triangle(s) in a 3-D regular array of right regular hexahedra. This loops through a 3-D array and calls DrawHex to calculate the triangulation of each hexahedral cell.

int Draw3DBlock ( ISurface Surf, int xd, int yd, int zd, int xs, int ys, int zs, int xm, int ym, int zm, PetscScalar* minmax, PetscScalar* vals, int skip, int n_quants, PetscScalar* isoquants, PetscScalar* colors )

int Draw3DBlock
Returns 0 or an error code.
ISurface Surf
ISurface object into which to draw this block's isoquants.
int xd
Overall x-width of function value array.
int yd
Overall y-width of function value array.
int zd
Overall z-width of function value array.
int xs
X-index of the start of the array section we'd like to draw.
int ys
Y-index of the start of the array section we'd like to draw.
int zs
Z-index of the start of the array section we'd like to draw.
int xm
X-width of the array section we'd like to draw.
int ym
Y-width of the array section we'd like to draw.
int zm
Z-width of the array section we'd like to draw.
PetscScalar* minmax
Position of block corners: xmin, xmax, ymin, ymax, zmin, zmax.
PetscScalar* vals
The array of function values at vertices.
int skip
Number of interlaced fields in this array.
int n_quants
Number of isoquant surfaces to draw (isoquant values).
PetscScalar* isoquants
Array of function values at which to draw triangles.
PetscScalar* colors
Array of color R,G,B,A quads for each isoquant.

Global Function DrawHex()

This divides a right regular hexahedron into tetrahedra, and loops over them to generate triangles on each one. It calculates edge and whichplane parameters so it can use DrawTetWithPlane directly.

int DrawHex ( ISurface Surf, PetscScalar* coords, PetscScalar* vals, PetscScalar isoquant, PetscScalar* color )

int DrawHex
Returns 0 or an error code.
ISurface Surf
ISurface object into which to draw this hexahedron's isoquant.
PetscScalar* coords
Coordinates of hexahedron corner points: xmin, xmax, ymin, etc.
PetscScalar* vals
Function values at hexahedron corners: f0, f1, f2, etc.
PetscScalar isoquant
Function value at which to draw triangles.
PetscScalar* color
R,G,B,A quad for this hexahedron.

Global Function DrawTet()

This sets the edge and whichplane parameters and then passes everything to DrawTetWithPlane to actually draw the triangle. It is intended for use by developers with distributed arrays based on tetrahedra, e.g. a finite element mesh.

int DrawTet ( ISurface Surf, PetscScalar* coords, PetscScalar* vals, PetscScalar isoquant, PetscScalar* color )

int DrawTet
Returns 0 or an error code.
ISurface Surf
ISurface object into which to draw this tetrahedron's isoquant.
PetscScalar* coords
Coordinates of tetrahedron corner points: x0, y0, z0, x1, etc.
PetscScalar* vals
Function values at tetrahedron corners: f0, f1, f2, f3.
PetscScalar isoquant
Function value at which to draw triangle.
PetscScalar* color
R,G,B,A quad for this tetrahedron.

Global Function ISurfDestroy()

Destructor for ISurface data object.

int ISurfDestroy ( ISurface Surf )

int ISurfDestroy
Returns zero or an error code.
ISurface Surf
ISurface object to destroy.

Global Function SurfClear()

Clear out an isurface data object without freeing its memory.

int SurfClear ( ISurface Surf )

int SurfClear
Returns zero or an error code.
ISurface Surf
ISurface object to clear out.

Global Function SurfCreate()

Constructor for ISurface data object.

int SurfCreate ( ISurface* newsurf )

int SurfCreate
Returns zero or an error code.
Surf *newsurf Address in which to put the new ISurface object.


Local Function DrawTetWithPlane()

This function calculates triangle vertices for an isoquant surface in a linear tetrahedron, using the whichplane information supplied by the routine calling this one, and "draws" them using storetri(). This is really an internal function, not intended to be called by user programs. It is used by DrawTet() and DrawHex().

static inline int DrawTetWithPlane ( PetscScalar x0, PetscScalar y0, PetscScalar z0, PetscScalar f0, PetscScalar x1, PetscScalar y1, PetscScalar z1, PetscScalar f1, PetscScalar x2, PetscScalar y2, PetscScalar z2, PetscScalar f2, PetscScalar x3, PetscScalar y3, PetscScalar z3, PetscScalar f3, PetscScalar isoquant, PetscScalar edge0, PetscScalar edge1, PetscScalar edge3, int whichplane, PetscScalar* color, struct isurface* thesurf )

int DrawTetWithPlane
Returns 0 or an error code.
PetscScalar x0
X-coordinate of vertex 0.
PetscScalar y0
Y-coordinate of vertex 0.
PetscScalar z0
Z-coordinate of vertex 0.
PetscScalar f0
Function value at vertex 0.
PetscScalar x1
X-coordinate of vertex 1.
PetscScalar y1
Y-coordinate of vertex 1.
PetscScalar z1
Z-coordinate of vertex 1.
PetscScalar f1
Function value at vertex 1.
PetscScalar x2
X-coordinate of vertex 2.
PetscScalar y2
Y-coordinate of vertex 2.
PetscScalar z2
Z-coordinate of vertex 2.
PetscScalar f2
Function value at vertex 2.
PetscScalar x3
X-coordinate of vertex 3.
PetscScalar y3
Y-coordinate of vertex 3.
PetscScalar z3
Z-coordinate of vertex 3.
PetscScalar f3
Function value at vertex 3.
PetscScalar isoquant
Function value at which to draw triangle.
PetscScalar edge0
Normalized intercept at edge 0, 0. at node 0, 1. at node 1.
PetscScalar edge1
Normalized intercept at edge 1, 0. at node 1, 1. at node 2.
PetscScalar edge3
Normalized intercept at edge 3, 0. at node 0, 1. at node 3.
int whichplane
Index of which edge intercept(s) is between zero and 1.
PetscScalar* color
R,G,B,A quad for this tetrahedron.
struct isurface* thesurf
ISurface object to put the triangles in.

Local Function storetri()

This little inline routine just implements triangle storage.

static inline int storetri ( PetscScalar x0, PetscScalar y0, PetscScalar z0, PetscScalar x1, PetscScalar y1, PetscScalar z1, PetscScalar x2, PetscScalar y2, PetscScalar z2, PetscScalar* color, struct isurface* thesurf )

int storetri
Returns 0 or an error code.
PetscScalar x0
X-coordinate of corner 0.
PetscScalar y0
Y-coordinate of corner 0.
PetscScalar z0
Z-coordinate of corner 0.
PetscScalar x1
X-coordinate of corner 1.
PetscScalar y1
Y-coordinate of corner 1.
PetscScalar z1
Z-coordinate of corner 1.
PetscScalar x2
X-coordinate of corner 2.
PetscScalar y2
Y-coordinate of corner 2.
PetscScalar z2
Z-coordinate of corner 2.
PetscScalar* color
R,G,B,A quad for this triangle.
struct isurface* thesurf
ISurface object to put the triangles in.