Vega FEM Library (v1.1) User's Manual - University of Southern ...
Vega FEM Library (v1.1) User's Manual - University of Southern ...
Vega FEM Library (v1.1) User's Manual - University of Southern ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Returns a pointer to the specified type <strong>of</strong> object, given its index in the list <strong>of</strong> that type <strong>of</strong> object in the<br />
VolumetricMesh.<br />
void setMaterial(int i, Material & material)<br />
Sets the material at index i in the array <strong>of</strong> materials to material, and copies these material properties to<br />
each mesh element whose containing region lists index i as the material which defines its material properties.<br />
virtual double getElementVolume(int el) = 0<br />
Implementations return the volume <strong>of</strong> the element at index el.<br />
virtual bool containsVertex(int element, Vec3d pos) = 0<br />
Returns whether the element at index i contains the vector pos.<br />
int getClosestElement(Vec3d pos)<br />
int getClosestVertex(Vec3d pos)<br />
int getContainingElement(Vec3d pos)<br />
Returns the index <strong>of</strong> the nearest element, nearest vertex, or containing element <strong>of</strong> pos in the undeformed<br />
mesh. For the third function, -1 is returned if no containing element is found.<br />
void exportMeshGeometry(int * numVertices, double ** vertices,<br />
int * numElements, int * numElementVertices, int ** elements)<br />
Exports the geometric information <strong>of</strong> the mesh to memory arrays. The number <strong>of</strong> vertices, number<br />
<strong>of</strong> elements, and number <strong>of</strong> vertices per element are written to *numVertices, *numElements, and<br />
*numElementVertices. Array *vertices is set to point to a newly-allocated (malloc) array <strong>of</strong> the coordinates<br />
<strong>of</strong> all the vectors, and *elements is set to point to a newly-allocated (malloc) array <strong>of</strong> the indices <strong>of</strong><br />
the vertices constituting each mesh element.<br />
int generateInterpolationWeights(int numTargetLocations,<br />
double * targetLocations, int ** vertices, double ** weights,<br />
double zeroThreshold = -1.0, std::vector * closestElementList = NULL,<br />
int verbose=0)<br />
Generates interpolation information for embedding a (typically higher-resolution) rendering mesh within<br />
a deformable volumetric mesh. Given numTargetLocations points (rendering mesh vertices), with coordinates<br />
specified in the array targetLocations, the function determines which mesh element is closest to<br />
or contains each point. It then expresses each point’s position as a weighted average <strong>of</strong> the coordinates<br />
<strong>of</strong> that element’s vertices, such that the weights sum to one (standard tet barycentric coordinates). Note<br />
that weights may be negative if the point is outside the volumetric mesh. Output arrays *vertices and<br />
*weights are allocated (malloc) inside the function. For each target location, the *vertices array gives the<br />
integer indices <strong>of</strong> VolumetricMesh vertices <strong>of</strong> the mesh element containing the target. The array *weights<br />
gives the barycentric weights. The length <strong>of</strong> both arrays is numElementVertices · numTargetLocations. If<br />
zeroThreshold > 0, then the points that are further than zeroThreshold away from any volumetric mesh<br />
vertex, are assigned weights <strong>of</strong> 0. If closestElementList is not NULL, the closest elements will be returned<br />
in the vector closestElementList. The function returns the number <strong>of</strong> target points which do not lie inside<br />
any element.<br />
static int loadInterpolationWeights(char * filename,<br />
int numTargetLocations, int numElementVertices,<br />
int ** vertices, double ** weights)<br />
static int saveInterpolationWeights(char * filename,<br />
int numTargetLocations, int numElementVertices,<br />
int * vertices, double * weights)<br />
Reads or writes the arrays vertices and weights <strong>of</strong> interpolation information from or to filename.<br />
Returns 0 iff successful.<br />
37