-
Notifications
You must be signed in to change notification settings - Fork 7
v0.2.0: Major Revamp & Modernization #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- Moved legacy 3D code to submodule `src/distmeshnd/`
- Created `src/dmesh.jl` for new `DMesh` types and utilities
- Updated `Project.toml`:
- Bumped Julia compat to 1.10
- Added new dependencies
- Updated tests to use `DistMeshND` alias for internal legacy functions
… examples/, and Literate.jl.
Live plotting support.
Fix triangule orientation of Delaunator's delaunay.
Default fig size 600x600 instead of 800x800.
Revert Makie figure size to default.
Updates the LICENSE file to the standard MIT License and adds the license metadata to Project.toml. This change is part of the package modernization to align DistMesh.jl with the broader Julia ecosystem. Note: This re-licensing covers legacy code copyrighted by Steve Kelly; the change is being coordinated with the authors and is pending final confirmation.
Version updates on Makie in Project.toml.
This commit officially retires the legacy `distmeshnd` module to establish a clean slate for version 0.2.0. Major Changes: - Removed `src/distmeshnd/` and `bench/` directories. - Removed legacy exports (`distmeshnd`, `HUniform`, `DistMeshSetup`) from the main module. - Cleaned `Project.toml` dependencies (removed packages used only by legacy code). - Updated `test/runtests.jl` to exclude legacy test suites. Documentation & Licensing: - Switched `LICENSE` to standard MIT (removed previous dual-copyright notices). - Updated `Project.toml` authors list. - Updated README.md with a "Legacy Support" notice advising users to pin v0.1 for old functionality. - Removed documentation pages and references related to the legacy implementation.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #30 +/- ##
===========================================
- Coverage 86.84% 63.59% -23.25%
===========================================
Files 8 8
Lines 380 228 -152
===========================================
- Hits 330 145 -185
- Misses 50 83 +33 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Thanks @popersson. This looks amazing. @oscardssmith Would you be able to take a quick look here and see if you like the dependencies being used (as in they are the well maintained ones). They look pretty solid to me. Any other comments you may have overall would be valuable. @sjkelly We discussed this overhaul a while ago, and you may overall like seeing it. I think it should be ok to move the license to MIT since the entire codebase is overhauled, and it is by the original author of DistMesh anyways. |
|
I feel the best thing would be to merge this quickly and then iteratively fix on master with multiple small PRs. |
|
deps look reasonable to me. |
|
We should have a Project.toml in |
|
@ViralBShah Done! I’ve added a Project.toml and Manifest.toml to the examples/ directory. It is set up to use GLMakie (since these are interactive examples) and points to the local DistMesh development version. I included the Manifest.toml so the environment is frozen and can be run immediately for anyone cloning the repo. |
|
In general, it is not a good idea to have a Manifest.toml checked in - and best to have the bounds you need in Project.toml. I suggest we keep only a Project.toml, and only check in a Manifest.toml later should things become too problematic to get running. The top level project should generally be set up to run with Project.toml, so that dependencies can be resolved by Pkg when it is being used with other packages. There is also a circle_mesh.png file that is checked in the project root directory. Is it required? If so, perhaps it should be moved to a subdirectory. |
|
With the Project.toml in examples, I am able to run both the examples. It feels quite snappy. |
|
@asinghvi17 Any thoughts on this revamp? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR represents a major version bump (v0.1 → v0.2) that fundamentally restructures DistMesh.jl with a focus on 2D meshing. The package transitions from GPL v2 to MIT licensing and replaces the N-dimensional meshing implementation with a cleaner, more performant 2D-focused architecture.
Changes:
- Complete rewrite of the 2D meshing algorithm using native Julia implementations with StaticArrays and Delaunator
- Removal of legacy 3D/N-dimensional meshing code (
distmeshnd, quality metrics, Hilbert sorting, TetGen integration) - New plotting integration via package extensions for Plots.jl, GLMakie, and CairoMakie
- Comprehensive documentation overhaul with new examples and API reference
- New mesh data structure (
DMesh) with utility functions for mesh validation and cleanup
Reviewed changes
Copilot reviewed 34 out of 37 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| LICENSE | Changed from GPL v2 to MIT license |
| Project.toml | Updated dependencies, added extensions for plotting backends, increased minimum Julia version to 1.10 |
| README.md | Completely rewritten with quick start guide and migration notes for v0.1 users |
| src/DistMesh.jl | Streamlined module with new 2D-focused architecture |
| src/dmesh.jl | New DMesh type for mesh representation with iteration support |
| src/distmesh2d.jl | New 2D meshing implementation with improved algorithm |
| src/distfuncs.jl | Distance function library (circles, rectangles, polygons, CSG operations) |
| src/meshutils.jl | Mesh utilities including Delaunay wrapper, element quality/volume calculations, cleanup |
| src/{distmeshnd,quality,tetgen,diff,decompositions,hilbertsort,pointdistribution}.jl | Removed legacy 3D/ND code |
| ext/*.jl | New plotting extensions for Plots, GLMakie, and CairoMakie |
| test/runtests.jl | Replaced legacy 3D tests with 2D mesh validation and example execution tests |
| test/vals.jl | Removed legacy test data |
| docs/* | Complete documentation rewrite with examples and API reference |
| examples/*.jl | New example scripts for polygon and NACA airfoil meshing |
| bench/* | Removed all benchmark scripts |
| .github/workflows/ci.yml | Minor updates to CI configuration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| scaling = maximum(norm.(p)) | ||
| pp = [snap.(p1, scaling) for p1 in p] |
Copilot
AI
Jan 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential division by zero: If all nodes in the mesh are at the origin (or very close to it), maximum(norm.(p)) on line 157 could be zero or near-zero, leading to numerical issues in the snap function on line 158. Consider adding a check for this edge case or using a minimum threshold for scaling.
| d = project_nodes!(p, dfcn, deps) | ||
|
|
||
| # Terminate if small (interior) node movements | ||
| converged = maximum(norm.(dp[d.<-geps])) < dptol |
Copilot
AI
Jan 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential error on empty mesh: If dp[d.<-geps] results in an empty array (e.g., when all nodes are outside the domain in an iteration), maximum() will throw an error. Consider adding a check or using isempty() before calling maximum(), or provide a default value using maximum(...; init=0.0).
| converged = maximum(norm.(dp[d.<-geps])) < dptol | |
| converged = maximum(norm.(dp[d .< -geps]); init = 0.0) < dptol |
| numerator = (b + c - a) * (c + a - b) * (a + b - c) | ||
| return 8 * (s - a) * (s - b) * (s - c) / (a * b * c) |
Copilot
AI
Jan 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent quality formula: The comment states "Quality = 2*r/R" but the implementation on line 97 calculates 8 * (s - a) * (s - b) * (s - c) / (a * b * c). While these may be equivalent formulas, the implementation doesn't match the simplified formula derivation shown in the comments. The numerator variable on line 96 is calculated but never used. Consider either removing the unused variable or clarifying the formula equivalence in the comments.
| elseif length(el) == 4 && length(el[1]) == 2 # Example: Quad (2D) logic check | ||
| # Quad logic | ||
| error("2D Quadrilaterals not yet implemented") |
Copilot
AI
Jan 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unreachable code: The condition on line 59 elseif length(el) == 4 && length(el[1]) == 2 can never be reached because the previous condition on line 56 elseif length(el) == 4 will match first. If both 3D tetrahedra and 2D quads need to be distinguished, check the dimension of the first element before checking the element count, or reorder the conditions.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This reverts commit 95a7f00.
v0.2.0: Major Revamp, Modernization, and MIT License
Overview
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.The original N-dimensional meshing code port (legacy
distmeshnd) has been retired to allow for a cleaner architecture and licensing model.src/distmeshnd/andbench/directories.distmeshnd,HUniform, andDistMeshSetup.] add DistMesh@0.1