The fc_meshtools Python package contains some simplicial meshes given by their vertices array q and connectivity array me. Theses meshes can be easily used in other Python codes for debugging or testing purpose.
A simplicial mesh is given by its vertices array q and its connectivity array me. For demonstration purpose, some simplicial meshes are given in this package and stored in the fc_meshtools/data directory. They can be load by using the functions getMesh2D, getMesh3D or getMesh3Ds of the fc_meshtools.simplicial module. Here are the kind of simplicial meshes present in this package:
- a triangular mesh in dimension 2, made with 2-simplices (ie. triangles),
- a tetrahedral mesh in dimension 3, made with 3-simplices (ie. tetrahedron),
- a triangular mesh in dimension 3 (surface mesh), made with 2-simplices,
- a line mesh in dimension 2 or 3 made with 1-simplices (ie. lines).
One can go to the dedicated web page fc_meshtools for more informations.
The fc_meshtools Python package is available from the Python Package Index, so to install/upgrade simply type
pip install fc_meshtools -U
Thereafter, it's possible to run one of the demo functions
import fc_meshtools fc_meshtools.demos.plot3D()
![]() |
![]() |
![]() |
import fc_meshtools fc_meshtools.demos.plot2D()
![]() |
![]() |
![]() |
There is a complete source code used to represent the function
on the upper half of a sphere.
import matplotlib.pyplot as plt from fc_tools.Matplotlib import set_axes_equal import fc_meshtools as plt4sim from fc_meshtools.demos import getMesh3Ds import numpy as np q2,me2=getMesh3Ds(2) q1,me1=getMesh3Ds(1) f=lambda x,y,z: np.cos(3*x-1)*np.sin(2*y-2)*np.sin(3*z) u2=f(q2[:,0],q2[:,1],q2[:,2]) u1=f(q1[:,0],q1[:,1],q1[:,2]) plt.ion() plt.figure(1) pp=plt4sim.plot(q2,me2,u2) plt4sim.plotmesh(q1,me1,color='Black',linewidths=2) plt.colorbar(pp) plt.axis('off') set_axes_equal() plt.figure(2) pp=plt4sim.plot(q1,me1,u1,linewidths=2,vmin=min(u2),vmax=max(u2)) plt4sim.plotmesh(q2,me2,color='LightGray',alpha=0.1) plt.colorbar(pp) plt.axis('off') set_axes_equal()
![]() |
![]() |