DualMesh 
Python module for generating dual meshes.
Requirements
- meshio >= 4.0
- numpy >= 1.16.3
Installation
Either install using pip
pip install dualmesh
or copy the file dualmesh.py from the dualmesh directory in this repository.
Example
We can go through the example of using dual_mesh.py module.
First, we import all the needed modules
# For opening a mesh file
import meshio
# For generating a dual mesh
import dualmesh as dm
# For plotting both the mesh and dual mesh
import matplotlib.pyplot as plt
We load the mesh for which we want a dual mesh
msh = meshio.read("example.msh")
We get the dual mesh object using dual_mesh.py
dual_msh = dm.get_dual(msh, order=True)
We use matplotlib to plot the original mesh
fig, ax = plt.subplots()
ax.triplot(msh.points[:, 0], msh.points[:, 1], msh.cells["triangle"])
We loop over the polygons (cells) in the dual mesh and we plot them
for cell in dual_msh.cells["polygon"]:
# We get the coordinates of the current polygon.
# We repeat one of the points, so that when plotted, we get a complete polygon
cell_points = dual_msh.points[cell + [cell[0]]]
# We plot the points of the current polygon
ax.plot(cell_points[:, 0], cell_points[:, 1], ":", color="black")
And finally we add the legend and save the resulting figure
# We add a legend to the figure
fig.legend([ax.lines[0], ax.lines[-1]], ["Mesh", "Dual mesh"])
# We save the resulting figure
fig.savefig("example.png")
Metadata
Release files for dualmesh 0.14.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dualmesh-0.14.0.tar.gz | 3.3 kB | Without provenance | Details for dualmesh-0.14.0.tar.gz |
Release files / dualmesh-0.14.0.tar.gz
| Download URL | dualmesh-0.14.0.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4b69fe02d54d31e56e7bcec04bf65ca5a388a0454cbeb3494e57a5a37942459d
|
|
BLAKE2b-256 checksum How to use checksums |
794bbce306fec23a8ecbb1c110b8d2027a5c91e3d36756b46076b7935b2638df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
|
Security for dualmesh 0.14.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.