The fc_mayavi4mesh package displays simplicial meshes or datas on simplicial meshes by using Mayavi
Project description
The fc_mayavi4mesh Python package allows to display simplicial meshes or datas on simplicial meshes by using mayavi (>= 4.6.2) Python package. The simplicial meshes must be given by two arrays : the vertices array and the connectivity array.
Introduction:
Simplicial meshes could be:
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).
A simplicial mesh is given by its vertices array q and its connectivity array me. For demonstration purpose, we used some simplicial meshes provided by the fc-meshtools Python package: they can be load by using the function getMesh2D, getMesh3D or getMesh3Ds of the fc_meshtools.simplicial module.
Documentation is available on fc-mayavi4mesh dedicated web page.
Installation:
The fc_mayavi4mesh Python package is available from the Python Package Index, so to install/upgrade simply type
pip install fc_mayavi4mesh -U
Thereafter, it’s possible to run one of the demo functions
import fc_mayavi4mesh
fc_mayavi4mesh.demos.plot2D()
import fc_mayavi4mesh
fc_mayavi4mesh.demos.plot3D()
import fc_mayavi4mesh
fc_mayavi4mesh.demos.streamline3D01()
Example:
There is a complete source code used to represent a function on a sphere
from mayavi import mlab
from fc_meshtools import simplicial as mshsim
import fc_mayavi4mesh.simplicial as mlab4sim
import numpy as np
q2,me2=mshsim.getMesh3Ds(2)[:2]
q1,me1=mshsim.getMesh3Ds(1)[:2]
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])
mlab.figure(1)
mlab4sim.plot(q2,me2,u2)
mlab4sim.plotmesh(q1,me1,color='Black',line_width=2)
mlab.colorbar()
mlab.figure(2)
mlab4sim.plot(q1,me1,u1,line_width=2,vmin=min(u2),vmax=max(u2))
mlab4sim.plotmesh(q2,me2,color='LightGray',opacity=0.1)
mlab.colorbar()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file fc_mayavi4mesh-0.1.2.tar.gz
.
File metadata
- Download URL: fc_mayavi4mesh-0.1.2.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e550340ff4be9c9a98a67ea2aff8fedb67278743500fb5a2a474524aa43f7a26 |
|
MD5 | 274de9d45e99a269b9f5eba201be7bec |
|
BLAKE2b-256 | 105b495a993413a877653b44edcd4dcf384b65ef9a10dc8a0c8a561f18327d0a |