image thumbnail

meshplot: Fast FEM mesh visualization using VTK (OpenGL)

バージョン 1.0.1 (476 KB) 作成者: Carlos Souto
A function for visualizing finite element meshes with optional nodal scalar fields using Python and VTK (OpenGL). Code is documented.

ダウンロード 59 件

更新 2022/3/31

ライセンスの表示

A function for visualizing finite element meshes with optional nodal scalar fields using Python and VTK (OpenGL). Code is documented.
Requirments:
1) Python. You can install Python from https://www.python.org/downloads/.
2) VTK (Python package). Once Python is installed, you can install the VTK package by running the command pip install vtk from the command prompt.
Note: if pip install vtk does not work, you may have a Python version that is too recent and VTK may not yet be available for your version (install an older version of Python to proceed).
You can call meshplot like so:
% plot the mesh only
meshplot(nodes, elements);
% plot the mesh with a nodal scalar field
meshplot(nodes, elements, scalars);
% plot the mesh with a nodal scalar field and specify the scalar range
meshplot(nodes, elements, scalars, [100 400]);
% specify optional arguments
meshplot(nodes, elements, scalars, 'ShowLines', false, 'Colormap', jet(32), 'Title', 'Stress (MPa)');
nodes is a n-by-3 matrix containing the (x, y, z) coordinates of each node, where n is the number of nodes.
nodes = [
x1, y1, z1
x2, y2, z2
...
xn, yn, zn
];
elements is a 1D struct array containing the element data with the following fields:
  • elements(i).NodeIndices: a vector containing the node indices (connectivity) of the i-th element.
  • elements(i).CellType: the VTK cell type (vtkCellType.VTK_QUAD, vtkCellType.VTK_TETRA, etc.); see vtkCellType.m for the full list.
% (example) defining the 5th element
elements(5).NodeIndices = [14, 2, 15, 213];
elements(5).CellType = vtkCellType.VTK_QUAD;
scalars (optional) is a vector with length n containing the values of the nodal scalar field, where n is the number of nodes.
scalars = [v1, v2, ..., vn];

引用

Carlos Souto (2022). meshplot: Fast FEM mesh visualization using VTK (OpenGL) (https://www.mathworks.com/matlabcentral/fileexchange/99024-meshplot-fast-fem-mesh-visualization-using-vtk-opengl), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2021a
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
タグ タグの追加

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!