- Homepage:
https://dengwirda.github.io/
- π« Contact:
[email protected]
- π Iβm currently working on
MPAS-O
,jigsaw-[python|MATLAB]
,SWE-solvers
, ...
* johloh: http://www.spritestitch.com/author/johloh/
JIGSAW is a Delaunay-based unstructured mesh generator for two- and three-dimensional geometries.
License: Other
https://dengwirda.github.io/
[email protected]
MPAS-O
, jigsaw-[python|MATLAB]
, SWE-solvers
, ...* johloh: http://www.spritestitch.com/author/johloh/
=)
Dear Dr.Darren Engwirda:
The mesh quality of Jigsaw is vey high. I want to use the jigsaw to generate a mesh. It is OK to used the lib and dll after the complied. Does the Jigsaw can be used like the way of Eigen that I can put the code in the include path and use it without the compilation?
Many thanks for giving a excellent tool!
Meng
I am installing jigsaw using conda. When I try to execute a *.jig
file I consistently get a segmentation fault. This happens with all of the following versions:
Version 0.9.12 works fine though.
I also tried to compile from source (linux x64) and I still get a segmentation fault.
To be honest, I am not sure if there is some issue with the input files I use though... In case they are of help the input files can be found in this gist
The output is:
#------------------------------------------------------------
#
# ,o, ,o, /
# ` ` e88~88e d88~\ /~~~8e Y88b e /
# 888 888 88 88 C888 88b Y88b d8b /
# 888 888 "8b_d8" Y88b e88~-888 Y888/Y88b/
# 888 888 / 888D C88 888 Y8/ Y8/
# 88P 888 Cb \_88P "8b_-888 Y Y
# \_8" Y8""8D
#
#------------------------------------------------------------
# JIGSAW: an unstructured mesh generation library.
#------------------------------------------------------------
JIGSAW VERSION 0.9.15
Reading CFG. file...
CFG. data summary...
GEOM-FILE = jigsaw-geo.msh
MESH-FILE = jigsaw.msh
HFUN-FILE =
INIT-FILE =
TRIA-FILE =
BNDS-FILE =
GEOM-SEED = 8
GEOM-PHI1 = 6.00e+01
GEOM-PHI2 = 6.00e+01
GEOM-ETA1 = 4.50e+01
GEOM-ETA2 = 4.50e+01
GEOM-FEAT = TRUE
INIT-NEAR = 1.00e-08
HFUN-SCAL = ABSOLUTE
HFUN-HMAX = inf
HFUN-HMIN = 0.00e+00
BNDS-KERN = BND-TRIA
MESH-KERN = DELFRONT
MESH-TOP1 = TRUE
MESH-TOP2 = FALSE
MESH-ITER = MAXINT
MESH-DIMS = 2
MESH-SIZ1 = 1.33e+00
MESH-SIZ2 = 1.31e+00
MESH-SIZ2 = 1.30e+00
MESH-EPS1 = 1.00e+00
MESH-EPS2 = 3.33e-01
MESH-RAD2 = 1.00e+00
MESH-RAD3 = 2.05e+00
MESH-OFF2 = 9.00e-01
MESH-OFF3 = 1.10e+00
MESH-SNK2 = 2.00e-01
MESH-SNK3 = 3.33e-01
MESH-VOL3 = 0.00e+00
OPTM-KERN = ODT+DQDX
OPTM-ITER = 16
OPTM-QTOL = 1.00e-04
OPTM-QLIM = 9.33e-01
OPTM-ZIP_ = TRUE
OPTM-DIV_ = TRUE
OPTM-TRIA = TRUE
OPTM-DUAL = FALSE
Done. (2.23e-04sec)
#------------------------------------------------------------
Reading GEOM file...
Done. (6.31e-04sec)
#------------------------------------------------------------
Forming GEOM data...
GEOM data summary...
EUCLIDEAN-MESH
|NDIMS.| = 2
|COORD.| = 513
|EDGE-2| = 513
|SEEDS.| = 0
|BOUND.| = 0 (0)
Done. (2.66e-04sec)
#------------------------------------------------------------
Forming HFUN data...
HFUN data summary...
CONSTANT-VALUE
.VAL(H). = inf
Done. (7.00e-06sec)
#------------------------------------------------------------
Generate rDT MESH...
#------------------------------------------------------------
# |ITER.| |DEL-1| |DEL-2|
#------------------------------------------------------------
[1] 89693 segmentation fault (core dumped) jigsaw jigsaw.jig
Make jigsaw
return slightly more comprehensive error flags, so that users have a better chance to diagnose what's going on...
JIGSAW_INVALID_ARGUMENT
JIGSAW_INVALID_INDEXING
JIGSAW_INVALID_USEROPTS
JIGSAW_INVALID_ARRAYDIM
I would recommend giving instructions for how to get JIGSAW from conda-forge.
conda config --add channels conda-forge
conda create -n jigsaw jigsaw
Each time you want to use jigsaw:
conda activate jigsaw
Now jigsaw
and tripod
are in your run path and libjigsaw
is in your library path with its include files in your include path.
Try to add support for "non-refinable" edge / face initial conditions. This would be useful when seeking to preserve compatibility between disjoint meshes / data / etc.
This won't always be possible in the rDT
framework (such edges / faces would have to actually be present in the DT
) but would still be useful in many practical cases. Given a sufficiently dense boundary sampling (especially for edges) such constraints should appear in a conforming DT
sense.
Could print warnings at initialisation if edges / faces not recovered in the rDT
?
Hi Darren,
In 2D setting, it seems jigsaw only meshes the regions that is considered "inside." Is there a way of meshing the entire domain? For example, I got the following results by using a number of concentric circles as constraints:
However, I need to mesh the entire domain (e.g. the convex hull in this case). Similar to what Shewchuk's triangle outputs:
As illustrated here, Shewchuk's triangle may produce undesirable cluster of tiny triangles in a few places. Jigsaw seems to provide higher quality triangulation, but is there a way of meshing the entire domain?
Also, possibly related this, when meshing complex domains, jigsaw sometimes output mesh with tiny holes:
Any clue on why is that?
best,
James
Hi Darren, I was wondering if jigsaw has an option (or it could be easy to implement) to return the index of the boundary nodes on a planar grid with specified boundaries.
Hi Darren,
I just find this mesher, and not skilled to use. The quality from jigsaw is well.
But I confuse how to define a hole? When i insert a iner ring, sometime get a hole, sometime cannot.
Is there a value to set?
thank you!
Originally posted by @wjlcqjd in #27 (comment)
I have compiled JIGSAW mesh tool on Linux System and run the 'ex_1.m' script to generate the 'mesh.msh' file. But how to read that *.msh file into the initial and forcing data for running the MPAS-Ocean modelοΌ
Hi Darren,
I am having an issue when creating a grid with given boundary. It will sometimes cross the boundary to create a shortcut. See image below. Anyway that I can avoid that, maybe a flag that I am not familiar with. My configuration is
HFUN_SCAL = ABSOLUTE
HFUN_HMAX = Inf
HFUN_HMIN = 0.0
MESH_DIMS = 2
MESH_TOP1 = TRUE
MESH_EPS1 = 1.0
MESH_RAD2 = 1
GEOM_FEAT = TRUE
In the figure, in red dots, the input geometry and in yellow x that supposed boundary nodes that are wrong due to the highlighted element.
Is it possible to define a mask for structured grid inputs to marche
? This would allow things like "land" boundaries to be embedded.
It should be possible to simply "disallow" certain points / cells to be updated in the fast-marching loop, which should lead to quasi-geodesic solutions around masked boundaries...
Review error handlers at I/O: unspecified files/objects, empty files/objects, etc...
When I run unit test 6 from dev
as part of building/testing the conda package, I get:
test_6: /home/xylar/miniconda3/conda-bld/jigsaw_1561112951683/work/src/libcpp/containers/fixed_array.hpp:190: containers::fixed_array<D, L>::data_type& containers::fixed_array<D, L>::operator[](containers::fixed_array<D, L>::size_type) [with D = int; long unsigned int L = 2; containers::fixed_array<D, L>::data_type = int; containers::fixed_array<D, L>::size_type = long unsigned int]: Assertion `(_pos >= +0 && _pos < _size && "fixed_array[]: out of range!")' failed.
Any idea what's going wrong? I'm going to disable this unit test for now.
Should enable reading of initial distributions in various formats, rather than just euclidean-mesh
.
ellipsoid-mesh
, read in lon-lat
and transform to E^3
.euclidean/ellipsoid-grid
, read structured arrays and convert to unstructured points, possibly with the coord transform too. Should grids induce topology? Maybe not...Dear Dr. Engwirda:
Thanks for your work, I have two problems.
(1) For a volume geometry with internal surface, like a box with a card in it, does it possible to be meshed using jigsaw. The image and file in format of stl are as follows.
(2) The code of Jigsaw is a little advanced for me. I am on a heavy study to under stand the code. Would you please add an example of using load file in the uni-test.
Best regards,
stl file link: https://github.com/GeoGroup/DigiSim/blob/master/mesh.stl
Hi Dr. Engwirda,
I'm hoping to use the Jigsaw as a mesh generator for my FEM simulator. I'm trying to change the edge index in the input file (Square.msh), see 0,1,2,3 in the input *msh file. But nothing changes in the output mesh file.
Is there any way to define the boundary markers in Jigsaw?
mshid=1
ndims=2
point=4
0;0;0
1;0;0
1;1;0
0;1;0
edge2=4
0;1;0
1;2;1
2;3;2
3;0;3
GEOM_FILE=jigsaw/geo/Square.msh
HFUN_HMAX=0.6
MESH_DIMS=2
MESH_FILE=jigsaw/out/Square.msh
MESH_KERN=delfront
MSHID=3;EUCLIDEAN-MESH
NDIMS=2
POINT=9
1.0000000000000000e+00;1.0000000000000000e+00;0
0.0000000000000000e+00;0.0000000000000000e+00;0
1.0000000000000000e+00;0.0000000000000000e+00;0
0.0000000000000000e+00;1.0000000000000000e+00;0
5.0000000000000000e-01;1.0000000000000000e+00;0
1.0000000000000000e+00;5.0000000000000000e-01;0
0.0000000000000000e+00;5.0000000000000000e-01;0
5.0000000000000000e-01;0.0000000000000000e+00;0
5.0000000000000000e-01;5.0000000000000000e-01;0
EDGE2=8
2;5;0
2;7;0
3;4;0
1;6;0
0;4;0
3;6;0
0;5;0
1;7;0
TRIA3=8
0;4;5;0
6;7;8;0
7;5;8;0
4;6;8;0
2;5;7;0
5;4;8;0
4;3;6;0
6;1;7;0
Dear developer,
Jigsaw is an excellent mesh tool that I used ever! Thanks for your great contribution! Below are my questions and suggestions.
Can unsigned
ints
be used everywhere? This would ease any signed
-to-unsigned
conversion issues, but -ve
ints
are currently used to denote certain flags... Would allow x 2
increase in max mesh size, but might increase size of in-mem. data-structures (to mark constrained faces, etc)?
Would be nice to compile quietly with -Wsigned-conversion -Wfloat-conversion -Wshadow
and the equiv. with msvc
, clang++
, etc.
Steps to reproduce:
constexpr auto filename = "MESH-3.msh";
jigsaw_msh_t handle;
jigsaw_init_msh_t(&handle);
jigsaw_load_msh_t(const_cast<char*>(filename), &handle);
std::cout << handle._vert3._data[0]._ppos[0] << '\n'; // output is 0, but probably undefined
The issue:
When you try reading a msh file with NDIMS=3
, the point coordinates aren't read by jigsaw_load_msh_t::msht_reader::push_point
because the bounds check refers to _vert2._size
instead of _vert3._size
. Changing this line
jigsaw/src/liblib/load_msh_t.hpp
Line 208 in a99c834
fixes the problem.
Cheers
Revisit rDT
refinement rules:
Refine boundary facets until their nodes span a common boundary contour. Such contours should be pre-processed from the geometry, being either: topologically disconnected, (piecewise) separated by sharp features, or by different IDtags
. Perhaps other things too?
Support interior mesh selection by reachability to user-defined seed points, as well as current in-polyhedron strategy.
Support meshing of domains defined by (even more) inconsistent geometries: especially those that have not been properly intersected, etc.
@dengwirda, I'm wondering if there should be tags (and releases) for 0.9.15 and 1.0.0 so we can build conda packages for them.
Hello @darren,
I recently checked out JIGSAW and played around with some random shapes. I should first say that you did a really good work! And I hope that you can keep maintaining it!
Now I have some problems to set up JIGSAW so it will not resample the input boundaries and use the points on the boundaries in the resulting mesh. Here is the output of JIGSAW:
What I would like to have is that JIGSAW preserves the input points (the small ones in black) on the boundary in the results, and no resample of the boundaries.
I roughly read the documentation in the source code but could find relevant information. Could you please kindly help?
Many thanks in advance!
Niko
Is there a way to restrict the compilation to the shared library only, to avoid the overhead of compiling the executable binaries?
Dear developer:
Jigsaw
is a very excellent mesh generation library! I use it to generate meshes before finite element calculation. I am not a programmer, but a mechanics researcher. I often use MATLAB language instead of C++ language in my work. I'm just a C++ beginner. Although there is a MATLAB version of jigsaw-matlab
, generating a large number of nodes and units (millions) will spend a lot of time on file i/o, so I want to compile jigsaw
into mex
function. How can I get it?
I use VS2017 and MATLAB R2021a.
I think the tag 0.9.8 should probably have been 0.9.9 based on the version number that appears in the generated meshes and is in version.txt
. It might be worth making the 0.9.9 tag and pointing it to the same commit. I wouldn't delete the 0.9.8 tag because that would likely cause problems. Deleting or modifying tags (even if they're wrong) is frowned upon.
Currently, ellipsoidal-mesh
geometry is defined in terms of "great ellipses". It'd be nice to add support for "small ellipse" arc definitions too, to support, e.g. arcs of constant latitude, etc.
Could do this (perhaps?) by introducing a new edge3
element type, where the 3rd node could be used to determine the plane the arc is inscribed on.
Hello,
I'm trying to generate a mesh using jigsaw with a geometric model that has roughly 16k edges and hitting problems with memory consumption and runtime when enabling mesh_top1
.
The test repo here:
https://github.com/cwsmith/jigsaw_gis/tree/519e7e1437fbabbbe3037cee4212721f079bddb4
contains gis.py
that loads the geometric model (.msh
) and size field (hfun) and runs jigsaw in a few seconds to generate a mesh of 358k triangles that doesn't exactly 'recover' the geometric model edges/vertices in the resulting mesh as mesh_top1
is disabled.
When I add opts.mesh_top1 = True
to gis.py
jigsaw runs out of memory on a gnu/linux machine with 64GB of RAM after about 10mins. The log from the failed run is pasted below.
I'm a novice jigsaw user and am concerned I have a problematic combination of settings and mesh size field that is causing the large memory usage and long runtime. Do you see anything obviously wrong? Any suggestions are appreciated.
Thank you.
Call libJIGSAW: gis
#------------------------------------------------------------
#
# ,o, ,o, /
# ` ` e88~88e d88~\ /~~~8e Y88b e /
# 888 888 88 88 C888 88b Y88b d8b /
# 888 888 "8b_d8" Y88b e88~-888 Y888/Y88b/
# 888 888 / 888D C88 888 Y8/ Y8/
# 88P 888 Cb \_88P "8b_-888 Y Y
# \_8" Y8""8D
#
#------------------------------------------------------------
# JIGSAW: an unstructured mesh generation library.
#------------------------------------------------------------
JIGSAW VERSION 1.0.0
Reading CFG. data...
CFG. data summary...
GEOM-FILE =
MESH-FILE =
HFUN-FILE =
INIT-FILE =
TRIA-FILE =
BNDS-FILE =
NUMTHREAD = 20
GEOM-SEED = 8
GEOM-PHI1 = 6.00e+01
GEOM-PHI2 = 6.00e+01
GEOM-ETA1 = 5.00e+00
GEOM-ETA2 = 5.00e+00
GEOM-FEAT = TRUE
INIT-NEAR = 1.00e-08
HFUN-SCAL = ABSOLUTE
HFUN-HMAX = inf
HFUN-HMIN = 0.00e+00
BNDS-KERN = BND-TRIA
MESH-KERN = DELFRONT
MESH-TOP1 = TRUE
MESH-TOP2 = FALSE
MESH-ITER = MAXINT
MESH-DIMS = 2
MESH-SIZ1 = 1.33e+00
MESH-SIZ2 = 1.31e+00
MESH-SIZ2 = 1.30e+00
MESH-EPS1 = 3.33e-01
MESH-EPS2 = 3.33e-01
MESH-RAD2 = 1.05e+00
MESH-RAD3 = 2.05e+00
MESH-OFF2 = 9.00e-01
MESH-OFF3 = 1.10e+00
MESH-SNK2 = 2.00e-01
MESH-SNK3 = 3.33e-01
MESH-VOL3 = 0.00e+00
OPTM-KERN = ODT+DQDX
OPTM-ITER = 16
OPTM-COST = AREA-LEN
OPTM-BETA = 4.95e-01
OPTM-ZETA = 8.25e-01
OPTM-QTOL = 1.00e-04
OPTM-QLIM = 9.38e-01
OPTM-ZIP_ = TRUE
OPTM-DIV_ = TRUE
OPTM-TRIA = TRUE
OPTM-DUAL = FALSE
Done. (6.90e-05sec)
#------------------------------------------------------------
Reading GEOM data...
Done. (1.36e-03sec)
#------------------------------------------------------------
Forming GEOM data...
GEOM data summary...
EUCLIDEAN-MESH
|NDIMS.| = 2
|COORD.| = 16675
|EDGE-2| = 16674
|SEEDS.| = 0
|BOUND.| = 0 (0)
Done. (3.66e-03sec)
#------------------------------------------------------------
Reading HFUN data...
Done. (1.54e-03sec)
#------------------------------------------------------------
Forming HFUN data...
HFUN data summary...
EUCLIDEAN-GRID
|NDIMS.| = 2
.MIN(H). = 3.00e+03
.MAX(H). = 3.00e+04
|MASKED| = 0
|XGRID.| = 832
|YGRID.| = 1408
Done. (1.15e-03sec)
#------------------------------------------------------------
Generate rDT MESH...
#------------------------------------------------------------
# |ITER.| |DEL-1| |DEL-2|
#------------------------------------------------------------
10000 16485 28345
25000 16485 58345
50000 16485 108345
75000 16485 158345
100000 16807 207745
250000 25094 472549
500000 25236 930619
750000 25321 1389276
1000000 25496 1847653
2500000 25957 4583110
5000000 26593 9142783
7500000 27115 13692413
10000000 27355 18256201
25000000 28722 45592494
50000000 30873 91114451
75000000 32284 136651641
100000000 33472 182152897
250000000 38587 455269920
Terminated
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.