Back to 3D Visualization (VTK)
vtk.femgrid
Visualize FEM unstructured grid
Syntax
vtk.femgrid(nodes, elements, elementTypes) vtk.femgrid(nodes, elements, elementTypes, scalars)
Description
Creates a VTK unstructured grid visualization for finite element meshes. Nodes is an Nx3 matrix of coordinates. Elements defines cell connectivity. ElementTypes specifies VTK cell types (10=tetra, 12=hex, 5=tri, 9=quad).
Parameters
| Name | Description |
|---|---|
| nodes | Nx3 matrix of node coordinates |
| elements | Cell connectivity in VTK format [npts, n1, n2, ...] |
| elementTypes | Array of VTK cell type codes for each element |
| scalars(optional) | Per-node or per-cell scalar field (e.g., stress, temperature) |
Returns
null (renders FEM mesh inline)
Examples
Try It
>> % Create a simple tetrahedral mesh nodes = [0 0 0; 1 0 0; 0.5 1 0; 0.5 0.5 1]; elements = [4 0 1 2 3]; % one tetrahedron types = [10]; % VTK_TETRA vtk.femgrid(nodes, elements, types)