├── CHANGELOG.md └── README.md /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | ## [0.16.3] - 2021-07-13 9 | 10 | ### Changed 11 | 12 | - Fixed computation of `genus` and `euler_characteristic` 13 | 14 | ## [0.16.0] - 2021-04-15 15 | 16 | ### Changed 17 | 18 | - `mesh.cells` is now a function; e.g., `mesh.cells["points"]` is now 19 | `mesh.cells("points")` 20 | - `mesh.idx_hierarchy` is deprecated in favor of `mesh.idx[-1]` (the new `idx` list 21 | contains more index magic) 22 | 23 | ## [0.14.0] - 2020-11-05 24 | 25 | ### Changed 26 | 27 | - `node_coords` is now `points` 28 | - `mesh_tri`: fixed inconsistent state after setting the points 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
Fast tools for simplex meshes.
4 | 5 | 6 | [](https://pypi.org/project/meshplex/) 7 | [](https://pypi.org/project/meshplex/) 8 | [](https://github.com/nschloe/meshplex) 9 | [](https://pypistats.org/packages/meshplex) 10 | 11 | [](https://discord.gg/hnTJ5MRX2Y) 12 | 13 | Compute all sorts of interesting points, areas, and volumes in simplex 14 | (triangle, tetrahedral, n-simplex) meshes of any dimension, with a focus on 15 | efficiency. Useful in many contexts, e.g., finite-element and finite-volume 16 | computations. 17 | 18 | ### Installation 19 | 20 | Install meshplex [from PyPI](https://pypi.org/project/meshplex/) with 21 | 22 | ``` 23 | pip install meshplex 24 | ``` 25 | 26 | For full usage of meshplex, you require a license. Licenses for personal and 27 | academic use can be purchased 28 | [here](https://buy.stripe.com/5kA3eV8t8af83iE9AE). For more info, see 29 | [here](https://github.com/meshpro). 30 | 31 | ### Quickstart 32 | 33 | meshplex can compute the following data: 34 | 35 | ```python 36 | import meshplex 37 | 38 | # create a simple Mesh instance 39 | points = [[0.0, 0.0], [1.0, 0.0], [0.0, 1.0]] 40 | cells = [[0, 1, 2]] 41 | mesh = meshplex.Mesh(points, cells) 42 | # or read it from a file 43 | # mesh = meshplex.read("pacman.vtk") 44 | 45 | # triangle volumes, heights 46 | print(mesh.cell_volumes) 47 | print(mesh.signed_cell_volumes) 48 | print(mesh.cell_heights) 49 | 50 | # circumcenters, centroids, incenters 51 | print(mesh.cell_circumcenters) 52 | print(mesh.cell_centroids) 53 | print(mesh.cell_incenters) 54 | 55 | # circumradius, inradius, cell quality 56 | print(mesh.cell_circumradius) 57 | print(mesh.cell_inradius) 58 | print(mesh.q_radius_ratio) # d * inradius / circumradius (min 0, max 1) 59 | 60 | # control volumes, centroids 61 | print(mesh.control_volumes) 62 | print(mesh.control_volume_centroids) 63 | 64 | # covolume/edge length ratios 65 | print(mesh.ce_ratios) 66 | 67 | # count Delaunay violations 68 | print(mesh.num_delaunay_violations) 69 | 70 | # get all boundary angles in radians 71 | print(mesh.outside_boundary_angles_radians) 72 | 73 | # removes some cells 74 | mesh.remove_cells([0]) 75 | ``` 76 | 77 | For triangular meshes (`MeshTri`), meshplex also has some mesh manipulation routines: 78 | 79 | 80 | 81 | ```python 82 | mesh.show() # show the mesh 83 | mesh.angles # compute angles 84 | mesh.flip_until_delaunay() # flips edges until the mesh is Delaunay 85 | ``` 86 | 87 | For a documentation of all classes and functions, see 88 | [readthedocs](https://meshplex.readthedocs.io/). 89 | 90 | (For mesh creation, check out 91 | [this list](https://github.com/nschloe/awesome-scientific-computing#meshing)). 92 | 93 | ### Plotting 94 | 95 | #### Triangles 96 | 97 |