Skip to content
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
8994899
Refactor package structure and modernize dependencies
popersson Dec 31, 2025
9e4858f
show function for DMesh
popersson Dec 31, 2025
7ba3fa3
Default Int32
popersson Dec 31, 2025
0ba197b
Major documentation update: New file structure, automated scripts for…
popersson Dec 31, 2025
07770b5
Plots extension, updated examples and docs.
popersson Dec 31, 2025
6645d26
examples moved to the examples/ directory
popersson Jan 1, 2026
22ad022
Rename obscure vector short-hands to more common Point2, Index2, Index3
popersson Jan 6, 2026
86a9e07
Fixed live-plotting with internal do-nothing function and warning.
popersson Jan 6, 2026
7f11857
CairoMakie and GLMakie support.
popersson Jan 7, 2026
040ce74
Rename Point2 -> Point2d to be consistent with GeometryBasics
popersson Jan 7, 2026
dde65ad
Minor plotting tweaks.
popersson Jan 7, 2026
9344bb3
Major Gemini pass on the doc strings
popersson Jan 7, 2026
c35ba9e
Various improvements of meshutils.
popersson Jan 7, 2026
ed82a6a
Rewriting of README and first section of docs.
popersson Jan 8, 2026
418025e
Minor docs update.
popersson Jan 8, 2026
7d72ef1
Fix inconsistent figure sizes in docs.
popersson Jan 8, 2026
a27569c
New subsection outlines.
popersson Jan 8, 2026
70ffd4e
Added implicit function example.
popersson Jan 20, 2026
a6ed80b
Remove CairoMakie from doc build.
popersson Jan 20, 2026
d8be8e4
Run all scripts in examples/ as part of the unit tests.
popersson Jan 20, 2026
9a8bcfd
Relicense project from GPL to MIT
popersson Jan 20, 2026
eb38535
Added more unit tests for distmesh2d
popersson Jan 21, 2026
a18446a
More docs and docstring examples.
popersson Jan 21, 2026
80d9f97
Many minor changes to docs and examples.
popersson Jan 21, 2026
e14ef73
Another try on CairoMakie for all docs.
popersson Jan 21, 2026
6e9b036
CI build docs on new dev branch.
popersson Jan 21, 2026
f5b09ce
Add Literate.jl dependency.
popersson Jan 21, 2026
156c907
Added StaticArrays dependency.
popersson Jan 21, 2026
c563daa
Resolve case-insensitive name conflict (for Windows/MacOS).
popersson Jan 21, 2026
2db7d0b
Mesh utilities: Improvements, name changes, docstrings.
popersson Jan 21, 2026
ea0c1c5
Figure size updates in docs.
popersson Jan 22, 2026
c81a833
Remove legacy N-D code and finalize v0.2.0 transition
popersson Jan 22, 2026
1c0feb2
Adding back weak dependency on GeometryBasics (for the GLMakie extens…
popersson Jan 22, 2026
8ba401f
Merge branch 'master' into v0.2-revamp
ViralBShah Jan 22, 2026
dad2ad0
Adding missing GeometryBasics dependency in main Project.toml.
popersson Jan 23, 2026
f87eb49
Add examples environment with frozen dependencies
popersson Jan 23, 2026
3c037f6
Merge branch 'master' into v0.2-revamp
ViralBShah Jan 24, 2026
6188528
Use v1 of Documenter always.
ViralBShah Jan 24, 2026
9626a63
Merge branch 'v0.2-revamp' of github.com:JuliaGeometry/DistMesh.jl in…
ViralBShah Jan 24, 2026
7d81f5a
Update examples/002-naca_airfoil.jl
ViralBShah Jan 24, 2026
24a1c47
Update examples/002-naca_airfoil.jl
ViralBShah Jan 24, 2026
95a7f00
Update .github/workflows/ci.yml
ViralBShah Jan 24, 2026
eb5a894
Revert "Update .github/workflows/ci.yml"
ViralBShah Jan 24, 2026
43382c4
Address Copilot feedback: fix unreachable code and edge cases
popersson Jan 27, 2026
bbc6cef
Remove examples manifest and move readme image to docs assets
popersson Jan 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ env:
JULIA_NUM_THREADS: 2
on:
push:
branches: [master]
tags: ['*']
pull_request:
workflow_dispatch:
branches:
- master
- 'v0.2-revamp'
tags: '*'
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
*.jl.mem
*.jl.*.mem
.DS_Store
/Manifest.toml
Manifest.toml
/dev/
/docs/build/
/docs/site/
/docs/src/examples.md
/docs/src/*.jl
318 changes: 21 additions & 297 deletions LICENSE

Large diffs are not rendered by default.

35 changes: 25 additions & 10 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,37 @@
name = "DistMesh"
uuid = "f7ee28b6-bfbf-11e9-3e31-8961b86f052c"
authors = ["Steve Kelly <kd2cca@gmail.com>"]
version = "0.1.0"
license = "MIT"
version = "0.2.0"
authors = ["Per-Olof Persson <persson@berkeley.edu>"]

[deps]
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
Delaunator = "466f8f70-d5e3-4806-ac0b-a54b75a91218"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
TetGen = "c5d3f3f7-f850-59f6-8a2e-ffc6dc1317ea"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

[weakdeps]
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"

[extensions]
DistMeshCairoMakieExt = "CairoMakie"
DistMeshGLMakieExt = ["GLMakie", "GeometryBasics"]
DistMeshPlotsExt = "Plots"

[compat]
julia = "1.6"
GeometryBasics = "0.4"
TetGen = "1"
CairoMakie = "0.15"
Delaunator = "0.1"
GLMakie = "0.11, 0.12, 0.13"
LinearAlgebra = "1"
Plots = "1"
StaticArrays = "1.9"
julia = "1.10"

[extras]
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TetGen = "c5d3f3f7-f850-59f6-8a2e-ffc6dc1317ea"

[targets]
test = ["Test", "GeometryBasics", "TetGen"]
test = ["Test", "CairoMakie"]
64 changes: 60 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,66 @@
# DistMesh
# DistMesh.jl

[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://distmesh.juliageometry.org/dev)
[![Codecov](https://codecov.io/gh/juliageometry/DistMesh.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/juliageometry/DistMesh.jl)

The package provides a Julia port of the [DistMesh](http://persson.berkeley.edu/distmesh/) algorithm developed by [Per-Olof Persson](http://persson.berkeley.edu/).
**DistMesh.jl** is a Julia generator for unstructured triangular and tetrahedral meshes. It uses [Signed Distance Functions](https://en.wikipedia.org/wiki/Signed_distance_function) (SDFs) to define geometries, enabling the generation of high-quality, isotropic meshes for complex shapes defined by simple mathematical functions.

There have been several improvements made to improve performance and output quality from the original Matlab version.
Primary use cases include Finite Element Analysis (FEA), computational fluid dynamics, and geometric modeling.

[Technical Report](https://sjkellyorg.files.wordpress.com/2020/11/distmesh_sjkelly.pdf)
---

## Note on Version 0.2.0

Version 0.2.0 represents a major rewrite of `DistMesh.jl`, focusing on replicating the original 2D code but with better performance, native Julia implementations, and integration with the Makie/Plots ecosystems. **This version is now fully MIT licensed.**

**Legacy Support:** The original N-dimensional meshing code port has been retired in this version to allow for a cleaner architecture. If you require the legacy `distmeshnd` functionality, please pin your package version to v0.1:

```julia
] add DistMesh@0.1
```

---

## Quick Start

The core function `distmesh2d` generates a mesh based on a distance function, a relative size function, an initial edge length, and a bounding box.

The code below generates a mesh of the unit circle:

```julia
using DistMesh

# Generate mesh: Distance function, size function, resolution, bounding box
msh = distmesh2d(dcircle, huniform, 0.2, ((-1,-1), (1,1)))
```

```text
DMesh: 2D, 88 nodes, 143 triangle elements
```

Optionally, the mesh can be visualized using various plotting packages:

```julia
using GLMakie # or Plots, or CairoMakie

plot(msh)
```

![Triangular mesh of the unit circle](circle_mesh.png)

For more details and extensive examples, please see the [DistMesh documentation](https://distmesh.juliageometry.org).

---

## Background

This package is a Julia port of the [DistMesh](http://persson.berkeley.edu/distmesh/) algorithm developed by [Per-Olof Persson](http://persson.berkeley.edu/). Significant improvements have been made to performance and type stability compared to the original MATLAB implementation. The algorithm is described in the following publications:

* P.-O. Persson, G. Strang, *[A Simple Mesh Generator in MATLAB](https://persson.berkeley.edu/distmesh/persson04mesh.pdf)*. SIAM Review, Volume 46 (2), pp. 329-345, June 2004.
* P.-O. Persson, *[Mesh Generation for Implicit Geometries](https://persson.berkeley.edu/thesis/persson-thesis-color.pdf)*. Ph.D. thesis, Department of Mathematics, MIT, Dec 2004.

---

## Related Packages

Several other implementations of the DistMesh algorithm exist in the Julia ecosystem, including [DistMesh-Julia](https://github.com/precise-simulation/distmesh-julia) and [DistMesh2D.jl](https://juliapackages.com/p/distmesh2d). Please consider checking these packages if DistMesh.jl does not meet your specific requirements.
3 changes: 0 additions & 3 deletions bench/.gitignore

This file was deleted.

90 changes: 0 additions & 90 deletions bench/benchmarks.jl

This file was deleted.

12 changes: 0 additions & 12 deletions bench/hilbert_perf.jl

This file was deleted.

76 changes: 0 additions & 76 deletions bench/perf.jl

This file was deleted.

12 changes: 0 additions & 12 deletions bench/profile.jl

This file was deleted.

31 changes: 0 additions & 31 deletions bench/util.jl

This file was deleted.

Binary file added circle_mesh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
[deps]
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
DistMesh = "f7ee28b6-bfbf-11e9-3e31-8961b86f052c"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

[compat]
CairoMakie = "0.15"
Documenter = "1"
Loading