Skip to content

Commit a3afb93

Browse files
authored
Merge pull request #56 from dengwirda/dev-v1.1.0
Update to jigsaw-1.1.0.x
2 parents f99d8f4 + 125afa4 commit a3afb93

File tree

113 files changed

+6009
-3320
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+6009
-3320
lines changed

.github/workflows/cmake.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,14 @@ jobs:
8888
run: |
8989
cd ${{github.workspace}}/uni/build
9090
cmake --build . --config ${{env.BUILD_TYPE}} --target install
91-
91+
9292
- name: Prep. tests for jigsaw
9393
if: startsWith(matrix.config.os, 'windows')
9494
run: |
9595
cd ${{github.workspace}}/uni
9696
cp ../lib/jigsaw.dll .
9797
98-
- name: Eval. tests for jigsaw
99-
run: |
100-
cd ${{github.workspace}}/uni
101-
./test_all
102-
103-
- name: Extra tests for jigsaw
98+
- name: Tests for cmd-jigsaw
10499
run: |
105100
cd ${{github.workspace}}
106101
./bin/jigsaw example.jig
@@ -109,6 +104,11 @@ jobs:
109104
./bin/jigsaw geo/parts.jig
110105
./bin/jigsaw geo/earth.jig
111106
./bin/jigsaw geo/lakes.jig
112-
107+
108+
- name: Tests for lib-jigsaw
109+
run: |
110+
cd ${{github.workspace}}/uni
111+
./test_all
112+
113113
- name: Clean tests for jigsaw
114114
run: rm -r ${{github.workspace}}/uni/build

README.md

Lines changed: 28 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@
77
<img src = "../master/img/bunny-TRIA4-3.png" width="20%" hspace="0.25%">
88
</p>
99

10-
`JIGSAW` is an unstructured mesh generator and tessellation library; designed to generate high-quality triangulations and polyhedral decompositions of general planar, surface and volumetric domains. `JIGSAW` includes refinement-based algorithms for the construction of new meshes, optimisation-driven techniques for the improvement of existing grids, as well as routines to assemble (restricted) Delaunay tessellations, Voronoi complexes and Power diagrams.
10+
`JIGSAW` is an unstructured mesh generator and tessellation library; designed to generate high-quality triangulations and polyhedral decompositions of general planar, surface and volumetric domains.
1111

12-
This package provides the underlying `c++` source for `JIGSAW`; defining a basic command-line interface and a `c`-format `API`. Higher-level scripting interfaces, supporting a range of additional facilities for file I/O, mesh visualisation and post-processing operations are also available, including for <a href="http://www.mathworks.com">`MATLAB`</a> / <a href="http://www.gnu.org/software/octave">`OCTAVE`</a> <a href="https://github.com/dengwirda/jigsaw-matlab">here</a> and for <a href="https://www.python.org/">`PYTHON`</a> <a href="https://github.com/dengwirda/jigsaw-python">here</a>.
12+
`JIGSAW` includes refinement-based algorithms for constructing new meshes, optimisation-driven techniques for improving existing grids, as well as routines to assemble (restricted) Delaunay tessellations, Voronoi complexes and Power diagrams.
1313

14-
`JIGSAW` is compiled and tested on various `64-bit` `Linux`, `Windows` and `MacOS` platforms using the `g++`, `clang++` and `msvc` compilers.
14+
This package provides the underlying `c++` source for `JIGSAW`; defining a basic command-line interface and a `c`-format `API`. Higher-level scripting interfaces, supporting additional facilities for file I/O, mesh visualisation and post-processing operations are also available, including for <a href="http://www.mathworks.com">`MATLAB`</a> / <a href="http://www.gnu.org/software/octave">`OCTAVE`</a> <a href="https://github.com/dengwirda/jigsaw-matlab">here</a> and for <a href="https://www.python.org/">`PYTHON`</a> <a href="https://github.com/dengwirda/jigsaw-python">here</a>.
15+
16+
`JIGSAW` has been compiled and tested on various `64-bit` `Linux`, `Windows` and `MacOS` platforms using `>=c++17` versions of the `g++`, `clang++` and `msvc` compilers.
1517

1618
### `Code Structure`
1719

18-
`JIGSAW` is written as a `header-only` library in `c++`. Both a basic command-line interface and a `c`-format `API` are defined:
20+
`JIGSAW` is a header-only `c++` library. Both a basic command-line interface and a `c`-format `API` are defined:
1921

2022
JIGSAW::
2123
├── src -- JIGSAW src code
@@ -28,80 +30,45 @@ This package provides the underlying `c++` source for `JIGSAW`; defining a basic
2830

2931
### `Getting Started`
3032

31-
The first step is to compile and configure the code! `JIGSAW` can either be built directly from src, or installed using the <a href="https://anaconda.org/conda-forge/jigsaw">`conda`</a> package manager.
32-
33-
### `Building from src`
34-
35-
The full `JIGSAW` src can be found in <a href="../master/src/">`../jigsaw/src/`</a>. It has been built using various `c++17` conforming versions of the `g++`, `clang++` and `msvc` compilers.
36-
37-
`JIGSAW` is a `header-only` package - the single main `jigsaw.cpp` file simply `#include`'s the rest of the library directly. `JIGSAW` does not currently dependent on any external packages or libraries.
38-
39-
`JIGSAW` consists of several pieces: `(a)` a set of command-line utilities that read and write mesh data from/to file, and `(b)` a shared library, accessible via a `c`-format `API`.
40-
41-
### `Using cmake`
42-
43-
`JIGSAW` can be built using the <a href="https://cmake.org/">`cmake`</a> utility. To build, follow the steps below:
44-
45-
* Clone or download this repository.
46-
* Navigate to the root `../jigsaw/` directory.
47-
* Make a new temporary directory BUILD.
48-
* cd build
49-
* cmake .. -DCMAKE_BUILD_TYPE=BUILD_MODE
50-
* cmake --build . --config BUILD_MODE --target install EXTRAS
51-
* Delete the temporary BUILD directory.
33+
`JIGSAW` can be built using the <a href="https://cmake.org/">`cmake`</a> utility:
5234

53-
This process will build a series of executables and shared libraries: `jigsaw` itself - the main command-line meshing utility, `tripod` - `JIGSAW`'s tessellation infrastructure, `marche` - a fast-marching solver designed to optimise mesh-spacing configurations, as well as `libjigsaw` - `JIGSAW`'s shared `API`.
35+
Navigate to the root ../jigsaw/ directory.
36+
mkdir build && cd build
37+
cmake .. -DCMAKE_BUILD_TYPE=BUILD_MODE
38+
cmake --build . --config BUILD_MODE --target install EXTRAS
39+
40+
A set of executables and shared libraries is built: `jigsaw` itself - the main command-line meshing utility, `tripod` - `JIGSAW`'s tessellation infrastructure, `marche` - a fast-marching solver designed to optimise mesh-spacing configurations, as well as `libjigsaw` - `JIGSAW`'s shared `API`.
5441

55-
`BUILD_MODE` can be used to select different compiler configurations and should generally either be `Release` or `Debug`. `EXTRAS` can be used to pass additional compile-time arguments, for example `-- -j 4` will build in parallel on supported architectures.
42+
`BUILD_MODE` can be used to select different compiler configurations (either `Release` or `Debug`). `EXTRAS` can be used to pass additional compile-time arguments, for example `-- -j4` will build in parallel on supported architectures.
5643

57-
See `example.jig` for documentation on calling the command-line executables, and the headers in <a href="../master/inc/">`../jigsaw/inc/`</a> for details on the `API`.
44+
See `example.jig` for documentation, as well as the headers in <a href="../master/inc/">`../jigsaw/inc/`</a> for details on the `API`.
5845

59-
### `Using conda`
46+
### `cmd-line Examples`
6047

61-
`JIGSAW` is also available as a `conda` environment. To install and use, follow the steps below:
48+
After compiling the code, try running the following command-line example:
6249

63-
* Ensure you have conda installed. If not, consider miniconda as a lightweight option.
64-
* Add conda-forge as a channel: conda config --add channels conda-forge
65-
* Create a jigsaw environment: conda create -n jigsaw jigsaw
50+
/bin/jigsaw{.exe} example.jig
6651

67-
Each time you want to use `JIGSAW` simply activate the environment using: `conda activate jigsaw`
68-
69-
Once activated, the various `JIGSAW` command-line utilities will be available in your run path, `JIGSAW`'s shared library (`libjigsaw`) will be available in your library path and its include files in your include path.
70-
71-
### `CMD-line Examples`
72-
73-
After compiling the code, try running the following command-line example to get started:
74-
````
75-
On WIN platforms:
76-
77-
\bin\jigsaw.exe example.jig
78-
79-
On LNX platforms:
80-
81-
/bin/jigsaw example.jig
82-
````
83-
In this example, a high-quality tetrahedral mesh is generated for the 'stanford-bunny' geometry and the result written to file. The input geometry is specified as a triangulated surface, and is read from `../jigsaw/geo/bunny.msh`. The volume and surface mesh outputs are written to `../jigsaw/out/bunny.msh`. See the `example.jig` text-file for a description of `JIGSAW`'s configuration options.
52+
In this example, a high-quality tetrahedral mesh is generated for the `stanford-bunny` geometry. The input geometry is specified as a triangulated surface, and is read from `../jigsaw/geo/bunny.msh`. The volume and surface mesh outputs are written to `../jigsaw/out/bunny.msh`. See the `example.jig` text-file for a description of `JIGSAW`'s configuration options.
8453

8554
A repository of additional surface models generated using `JIGSAW` can be found <a href="https://github.com/dengwirda/jigsaw-models">here</a>. A description of the `*.jig` and `*.msh` input file formats can be found in the <a href="https://github.com/dengwirda/jigsaw/wiki">wiki</a>.
8655

8756
### `libJIGSAW Scripts`
8857

8958
A set of unit-tests and `libjigsaw` example programs are contained in <a href="../master/uni/">`../jigsaw/uni/`</a>. The `JIGSAW-API` is documented via the header files in <a href="../master/inc/">`../jigsaw/inc/`</a>.
9059

91-
The unit-tests can be built using the <a href="https://cmake.org/">`cmake`</a> utility. To build, follow the steps below:
92-
93-
* Navigate to the `../jigsaw/uni/` directory.
94-
* Make a new temporary directory BUILD.
95-
* cd build
96-
* cmake .. -DCMAKE_BUILD_TYPE=BUILD_MODE
97-
* cmake --build . --config BUILD_MODE --target install EXTRAS
98-
* Delete the temporary BUILD directory.
60+
The unit-tests can be built using the <a href="https://cmake.org/">`cmake`</a> utility:
9961

100-
This process will build the unit-tests as a series of executables in <a href="../master/uni/">`../jigsaw/uni/`</a>. `BUILD_MODE` is a compiler configuration flag: either `Release` or `Debug`. `EXTRAS` can be used to pass additional compile-time arguments.
62+
Navigate to the ../jigsaw/uni/ directory.
63+
mkdir build && cd build
64+
cmake .. -DCMAKE_BUILD_TYPE=BUILD_MODE
65+
cmake --build . --config BUILD_MODE --target install EXTRAS
66+
67+
This process will build the unit-tests as a set of executables in <a href="../master/uni/">`../jigsaw/uni/`</a>. `BUILD_MODE` is a compiler configuration flag (either `Release` or `Debug`). `EXTRAS` can be used to pass additional compile-time arguments.
10168

10269
### `Contributors`
10370

104-
1. [@dengwirda](https://github.com/dengwirda) is `JIGSAW`'s developer and maintainer --- this work was originally the focus of my PhD at the University of Sydney.
71+
1. [@dengwirda](https://github.com/dengwirda) is `JIGSAW`'s developer and maintainer.
10572
2. [@xylar](https://github.com/xylar) contributed the `cmake` build system and `conda` environment.
10673
3. [@tunnellm](https://github.com/tunnellm) extended the sequential optimisation algorithms to support thread-parallelism.
10774

@@ -120,7 +87,7 @@ This program may be freely redistributed under the condition that the copyright
12087

12188
### `References`
12289

123-
There are a number of publications that describe the algorithms used in `JIGSAW` in detail. If you make use of `JIGSAW` in your work, please consider including a reference to the following:
90+
There are a number of publications that describe the algorithms used in `JIGSAW` in detail. If you make use of `JIGSAW` in your work, please include references as appropriate:
12491

12592
`[1]` - Darren Engwirda: Generalised primal-dual grids for unstructured co-volume schemes, J. Comp. Phys., 375, pp. 155-176, https://doi.org/10.1016/j.jcp.2018.07.025, 2018.
12693

example.jig

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,24 @@
184184
# MESH_ITER = 10000
185185

186186

187+
# ---> MESH_ORPH - {default=true} allow "orphaned" facets
188+
# to remain in the mesh. A K-1 dimensional subcell is
189+
# orphaned if it does not appear in any K-dimensional
190+
# cell, e.g. a surface triangle that is not the face
191+
# of any interior tetrahedron.
192+
193+
# MESH_ORPH = FALSE
194+
195+
196+
# ---> MESH_LOCK - {default=false} prevent the refinement
197+
# of subfaces during subsequent refinement. The
198+
# refinement of a K-dimensional cell is deferred if
199+
# doing so would cause any K-1 dimensional subfaces to
200+
# be refined.
201+
202+
# MESH_LOCK = TRUE
203+
204+
187205
# ---> MESH_TOP1 - {default=false} enforce 1-dim. topolog-
188206
# ical constraints. 1-dim. edges are refined until all
189207
# embedded nodes are "locally 1-manifold", i.e. nodes
@@ -369,6 +387,20 @@
369387
# OPTM_QLIM = 0.90
370388

371389

390+
# ---> OPTM_WMIN - {default=-7./8.} lower limit on dual
391+
# mesh weights relative to cell radius.
392+
#
393+
394+
# OPTM_WMIN =-0.500
395+
396+
397+
# ---> OPTM_WMAX - {default=+1./80} upper limit on dual
398+
# mesh weights relative to cell radius.
399+
#
400+
401+
# OPTM_WMAX = 0.125
402+
403+
372404
# ---> OPTM_ZIP_ - {default= true} allow for "merge" oper-
373405
# ations on sub-faces.
374406
#

inc/jigsaw_jig_t.h

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
*
3636
--------------------------------------------------------
3737
*
38-
* Last updated: 12 Dec., 2022
38+
* Last updated: 27 Jul., 2025
3939
*
40-
* Copyright 2013-2022
40+
* Copyright 2013-2025
4141
* Darren Engwirda
4242
4343
* https://github.com/dengwirda
@@ -209,6 +209,30 @@
209209

210210
indx_t _mesh_iter ;
211211

212+
/*
213+
--------------------------------------------------------
214+
* MESH_ORPH - {default=true} allow "orphaned" facets
215+
* to remain in the mesh. A K-1 dimensional subcell is
216+
* orphaned if it does not appear in any K-dimensional
217+
* cell, e.g. a surface triangle that is not the face
218+
* of any interior tetrahedron.
219+
--------------------------------------------------------
220+
*/
221+
222+
indx_t _mesh_orph ;
223+
224+
/*
225+
--------------------------------------------------------
226+
* MESH_LOCK - {default=false} prevent the refinement
227+
* of subfaces during subsequent refinement. The
228+
* refinement of a K-dimensional cell is deferred if
229+
* doing so would cause any K-1 dimensional subfaces to
230+
* be refined.
231+
--------------------------------------------------------
232+
*/
233+
234+
indx_t _mesh_lock ;
235+
212236
/*
213237
--------------------------------------------------------
214238
* MESH_TOP1 - {default=false} enforce 1-dim. topolog-
@@ -339,7 +363,7 @@
339363

340364
/*
341365
--------------------------------------------------------
342-
* MESH_EPS1 - {default=0.33} max. surface-discretisa-
366+
* MESH_EPS1 - {default=5/12} max. surface-discretisa-
343367
* tion error multiplier for 1-edge elements. 1-edge
344368
* elements are refined until the surface-disc. error
345369
* is less-than EPS1 * HFUN(X).
@@ -350,7 +374,7 @@
350374

351375
/*
352376
--------------------------------------------------------
353-
* MESH_EPS2 - {default=0.33} max. surface-discretisa-
377+
* MESH_EPS2 - {default=5/12} max. surface-discretisa-
354378
* tion error multiplier for 2-tria elements. 2-tria
355379
* elements are refined until the surface-disc. error
356380
* is less-than EPS2 * HFUN(X).
@@ -447,14 +471,32 @@
447471

448472
/*
449473
--------------------------------------------------------
450-
* OPTM_QLIM - {default=0.9333} threshold on mesh cost
474+
* OPTM_QLIM - {default=.91667} threshold on mesh cost
451475
* function above which gradient-based optimisation is
452476
* attempted.
453477
--------------------------------------------------------
454478
*/
455479

456480
real_t _optm_qlim ;
457481

482+
/*
483+
--------------------------------------------------------
484+
* OPTM_WMIN - {default=-7./8.} lower limit on dual
485+
* mesh weights relative to cell radius.
486+
--------------------------------------------------------
487+
*/
488+
489+
real_t _optm_wmin ;
490+
491+
/*
492+
--------------------------------------------------------
493+
* OPTM_WMAX - {default=+1./80} upper limit on dual
494+
* mesh weights relative to cell radius.
495+
--------------------------------------------------------
496+
*/
497+
498+
real_t _optm_wmax ;
499+
458500
/*
459501
--------------------------------------------------------
460502
* OPTM_TRIA - {default= true} allow for optimisation

inc/lib_jigsaw.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
* JIGSAW: Interface to the JIGSAW meshing library.
1515
--------------------------------------------------------
1616
*
17-
* Last updated: 08 Feb., 2021
17+
* JIGSAW release 1.1.0.x
1818
*
19-
* Copyright 2013-2021
19+
* Last updated: 20 Oct., 2024
20+
*
21+
* Copyright 2013-2024
2022
* Darren Engwirda
2123
2224
* https://github.com/dengwirda
@@ -64,7 +66,7 @@
6466
extern "C" {
6567
# endif
6668

67-
# ifdef _WIN32
69+
# if defined(_WIN32) || defined(_WIN64)
6870

6971
# ifdef __lib_jigsaw
7072
# define SHARED __declspec(dllexport)

src/CMakeLists.txt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
function (cfg_compile_options OPT CFG)
2+
# set OPT if compiling with CFG
23
add_compile_options ("$<$<CONFIG:${CFG}>:${OPT}>")
34
endfunction ()
45

@@ -27,24 +28,26 @@ endif ()
2728
if (DEFINED ICPC_LIKE)
2829
add_compile_options (-pedantic -Wall -Wextra -Wshadow -Wfloat-conversion)
2930
add_compile_options (-fp-model=precise) # needed for adapt-fp
30-
add_compile_options (-fno-math-errno) # no errno checks
31-
add_compile_options (-fno-trapping-math) # no fp exceptions
32-
add_compile_options (-ffinite-math-only) # no explicit nans, etc
31+
cfg_compile_options (-fno-math-errno RELEASE) # no errno checks
32+
cfg_compile_options (-fno-trapping-math RELEASE) # no fp exceptions
33+
cfg_compile_options (-fno-signed-zeros RELEASE) # -0.0 == +0.0
34+
cfg_compile_options (-ffinite-math-only RELEASE) # no explicit nans, etc
3335
endif ()
3436

3537
if (DEFINED MSVC_LIKE)
3638
add_compile_options (/W3)
3739
add_compile_options (/openmp:llvm) # needed for openmp > 2.0
3840
add_compile_options (/fp:precise) # needed for adapt-fp
3941
cfg_compile_options (/GS- RELEASE) # disable buffer checks
40-
cfg_compile_options (/Ot RELEASE) # favour "fast" code
42+
cfg_compile_options (/Ot RELEASE) # favour "fast" code
4143
endif ()
4244

4345
if (DEFINED GCXX_LIKE)
4446
add_compile_options (-pedantic -Wall -Wextra -Wshadow -Wfloat-conversion)
45-
add_compile_options (-fno-math-errno) # no errno checks
46-
add_compile_options (-fno-trapping-math) # no fp exceptions
47-
add_compile_options (-ffinite-math-only) # no explicit nans, etc
47+
cfg_compile_options (-fno-math-errno RELEASE) # no errno checks
48+
cfg_compile_options (-fno-trapping-math RELEASE) # no fp exceptions
49+
cfg_compile_options (-fno-signed-zeros RELEASE) # -0.0 == +0.0
50+
cfg_compile_options (-ffinite-math-only RELEASE) # no explicit nans, etc
4851
endif ()
4952

5053
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

0 commit comments

Comments
 (0)