Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
1a23384
Eikonal solve for mixed cell types in R^3
dengwirda Feb 23, 2025
7b037a9
Add is-unique for general sequences
dengwirda Feb 23, 2025
98d0422
Fix rect-dist for nearest scheme
dengwirda Feb 23, 2025
3d191a3
Increase reserve alloc. for hashtable
dengwirda Feb 23, 2025
3caddcd
Add multi-prec. 6x6 determinant
dengwirda Feb 23, 2025
2530527
WIP support for "in-ball" in E^4
dengwirda Feb 23, 2025
7539007
Support for deferred refinement user-opts
dengwirda Feb 23, 2025
bae0609
Update to v1.1.0 user-opt. defaults
dengwirda Feb 23, 2025
dd7253c
Fix buffer overflow in i/o routines
dengwirda Feb 23, 2025
4e21aae
Upgrade compiler + flags support
dengwirda Feb 23, 2025
df5225a
Update mesh complex objects
dengwirda Feb 23, 2025
2506397
Update geometry objects and utilities
dengwirda Feb 23, 2025
74eddb5
Ensure constants are constexpr
dengwirda Feb 23, 2025
1c95b5e
1.1.0 updates to rDT refinement schemes
dengwirda Feb 24, 2025
8614f9a
1.1.0 updates to mesh optim. strategies
dengwirda Feb 26, 2025
52306af
1.1.0 updates to documentation & examples
dengwirda Feb 26, 2025
fa0cfef
std::<math> functions are no longer constexpr
dengwirda Feb 26, 2025
22c1fdb
Fix | vs || usage
dengwirda Feb 26, 2025
d563c1c
Fix auto disambiguation of multiple types
dengwirda Feb 26, 2025
304234f
Fix spatially-variable initial point selection
dengwirda Feb 26, 2025
930249c
Squelch unused variables
dengwirda Feb 26, 2025
4047d6c
Reduce error on -ve h(x) data to warning
dengwirda Feb 26, 2025
48593bd
Update CI workflow
dengwirda Feb 27, 2025
4c11b70
Adjust dual mesh weight optimisation
dengwirda Jul 27, 2025
b5f81c7
Add min/max limits for dual mesh weight optim.
dengwirda Jul 27, 2025
d0f9f4c
Add min/max limits for dual mesh weight optim.
dengwirda Jul 27, 2025
14c170e
Add min/max limits for dual mesh weight optim.
dengwirda Jul 27, 2025
1362b95
Remove discontinued conda build detail
dengwirda Jul 27, 2025
5650f61
Add unit tests for MARCHE in E^3
dengwirda Jul 27, 2025
e2eac64
Update CI workflow
dengwirda Jul 27, 2025
00bb2f4
Simplify README.md
dengwirda Jul 27, 2025
c048284
Squelch compiler warnings
dengwirda Jul 27, 2025
ccb7894
Simplify README.md
dengwirda Jul 27, 2025
4944f66
Update CI workflow
dengwirda Jul 27, 2025
36e4db6
Simplify README.md
dengwirda Jul 27, 2025
4c71306
Simplify README.md
dengwirda Jul 27, 2025
275d7db
Update CI workflow
dengwirda Jul 27, 2025
47c877a
Correct circumball array size
dengwirda Jul 29, 2025
e9f8d67
Update API interface
dengwirda Jul 29, 2025
dae33aa
Force fast stdout for unit tests
dengwirda Jul 29, 2025
05e8951
Ensure rDT face counter is initialised
dengwirda Jul 30, 2025
26120b1
Ensure R^d+1 weight is initialised
dengwirda Jul 30, 2025
c2273db
Update CI workflow
dengwirda Jul 30, 2025
e29bcd7
Simplify README.md
dengwirda Jul 30, 2025
eb99e86
Simplify README.md
dengwirda Jul 30, 2025
77f7a06
Update unit test config.'s
dengwirda Jul 30, 2025
8db4b07
Add indexing hint for element-centred h(x) eval.
dengwirda Aug 11, 2025
125afa4
Update mesh optim. div/zip schedule
dengwirda Aug 11, 2025
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
16 changes: 8 additions & 8 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,14 @@ jobs:
run: |
cd ${{github.workspace}}/uni/build
cmake --build . --config ${{env.BUILD_TYPE}} --target install

- name: Prep. tests for jigsaw
if: startsWith(matrix.config.os, 'windows')
run: |
cd ${{github.workspace}}/uni
cp ../lib/jigsaw.dll .

- name: Eval. tests for jigsaw
run: |
cd ${{github.workspace}}/uni
./test_all

- name: Extra tests for jigsaw
- name: Tests for cmd-jigsaw
run: |
cd ${{github.workspace}}
./bin/jigsaw example.jig
Expand All @@ -109,6 +104,11 @@ jobs:
./bin/jigsaw geo/parts.jig
./bin/jigsaw geo/earth.jig
./bin/jigsaw geo/lakes.jig


- name: Tests for lib-jigsaw
run: |
cd ${{github.workspace}}/uni
./test_all

- name: Clean tests for jigsaw
run: rm -r ${{github.workspace}}/uni/build
89 changes: 28 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
<img src = "../master/img/bunny-TRIA4-3.png" width="20%" hspace="0.25%">
</p>

`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.
`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.

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>.
`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.

`JIGSAW` is compiled and tested on various `64-bit` `Linux`, `Windows` and `MacOS` platforms using the `g++`, `clang++` and `msvc` compilers.
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>.

`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.

### `Code Structure`

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

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

### `Getting Started`

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.

### `Building from src`

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.

`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.

`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`.

### `Using cmake`

`JIGSAW` can be built using the <a href="https://cmake.org/">`cmake`</a> utility. To build, follow the steps below:

* Clone or download this repository.
* Navigate to the root `../jigsaw/` directory.
* Make a new temporary directory BUILD.
* cd build
* cmake .. -DCMAKE_BUILD_TYPE=BUILD_MODE
* cmake --build . --config BUILD_MODE --target install EXTRAS
* Delete the temporary BUILD directory.
`JIGSAW` can be built using the <a href="https://cmake.org/">`cmake`</a> utility:

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`.
Navigate to the root ../jigsaw/ directory.
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=BUILD_MODE
cmake --build . --config BUILD_MODE --target install EXTRAS

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`.

`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.
`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.

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`.
See `example.jig` for documentation, as well as the headers in <a href="../master/inc/">`../jigsaw/inc/`</a> for details on the `API`.

### `Using conda`
### `cmd-line Examples`

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

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

Each time you want to use `JIGSAW` simply activate the environment using: `conda activate jigsaw`

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.

### `CMD-line Examples`

After compiling the code, try running the following command-line example to get started:
````
On WIN platforms:

\bin\jigsaw.exe example.jig

On LNX platforms:

/bin/jigsaw example.jig
````
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.
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.

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>.

### `libJIGSAW Scripts`

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>.

The unit-tests can be built using the <a href="https://cmake.org/">`cmake`</a> utility. To build, follow the steps below:

* Navigate to the `../jigsaw/uni/` directory.
* Make a new temporary directory BUILD.
* cd build
* cmake .. -DCMAKE_BUILD_TYPE=BUILD_MODE
* cmake --build . --config BUILD_MODE --target install EXTRAS
* Delete the temporary BUILD directory.
The unit-tests can be built using the <a href="https://cmake.org/">`cmake`</a> utility:

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.
Navigate to the ../jigsaw/uni/ directory.
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=BUILD_MODE
cmake --build . --config BUILD_MODE --target install EXTRAS

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.

### `Contributors`

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.
1. [@dengwirda](https://github.com/dengwirda) is `JIGSAW`'s developer and maintainer.
2. [@xylar](https://github.com/xylar) contributed the `cmake` build system and `conda` environment.
3. [@tunnellm](https://github.com/tunnellm) extended the sequential optimisation algorithms to support thread-parallelism.

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

### `References`

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:
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:

`[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.

Expand Down
32 changes: 32 additions & 0 deletions example.jig
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,24 @@
# MESH_ITER = 10000


# ---> MESH_ORPH - {default=true} allow "orphaned" facets
# to remain in the mesh. A K-1 dimensional subcell is
# orphaned if it does not appear in any K-dimensional
# cell, e.g. a surface triangle that is not the face
# of any interior tetrahedron.

# MESH_ORPH = FALSE


# ---> MESH_LOCK - {default=false} prevent the refinement
# of subfaces during subsequent refinement. The
# refinement of a K-dimensional cell is deferred if
# doing so would cause any K-1 dimensional subfaces to
# be refined.

# MESH_LOCK = TRUE


# ---> MESH_TOP1 - {default=false} enforce 1-dim. topolog-
# ical constraints. 1-dim. edges are refined until all
# embedded nodes are "locally 1-manifold", i.e. nodes
Expand Down Expand Up @@ -369,6 +387,20 @@
# OPTM_QLIM = 0.90


# ---> OPTM_WMIN - {default=-7./8.} lower limit on dual
# mesh weights relative to cell radius.
#

# OPTM_WMIN =-0.500


# ---> OPTM_WMAX - {default=+1./80} upper limit on dual
# mesh weights relative to cell radius.
#

# OPTM_WMAX = 0.125


# ---> OPTM_ZIP_ - {default= true} allow for "merge" oper-
# ations on sub-faces.
#
Expand Down
52 changes: 47 additions & 5 deletions inc/jigsaw_jig_t.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
*
--------------------------------------------------------
*
* Last updated: 12 Dec., 2022
* Last updated: 27 Jul., 2025
*
* Copyright 2013-2022
* Copyright 2013-2025
* Darren Engwirda
* [email protected]
* https://github.com/dengwirda
Expand Down Expand Up @@ -209,6 +209,30 @@

indx_t _mesh_iter ;

/*
--------------------------------------------------------
* MESH_ORPH - {default=true} allow "orphaned" facets
* to remain in the mesh. A K-1 dimensional subcell is
* orphaned if it does not appear in any K-dimensional
* cell, e.g. a surface triangle that is not the face
* of any interior tetrahedron.
--------------------------------------------------------
*/

indx_t _mesh_orph ;

/*
--------------------------------------------------------
* MESH_LOCK - {default=false} prevent the refinement
* of subfaces during subsequent refinement. The
* refinement of a K-dimensional cell is deferred if
* doing so would cause any K-1 dimensional subfaces to
* be refined.
--------------------------------------------------------
*/

indx_t _mesh_lock ;

/*
--------------------------------------------------------
* MESH_TOP1 - {default=false} enforce 1-dim. topolog-
Expand Down Expand Up @@ -339,7 +363,7 @@

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

/*
--------------------------------------------------------
* MESH_EPS2 - {default=0.33} max. surface-discretisa-
* MESH_EPS2 - {default=5/12} max. surface-discretisa-
* tion error multiplier for 2-tria elements. 2-tria
* elements are refined until the surface-disc. error
* is less-than EPS2 * HFUN(X).
Expand Down Expand Up @@ -447,14 +471,32 @@

/*
--------------------------------------------------------
* OPTM_QLIM - {default=0.9333} threshold on mesh cost
* OPTM_QLIM - {default=.91667} threshold on mesh cost
* function above which gradient-based optimisation is
* attempted.
--------------------------------------------------------
*/

real_t _optm_qlim ;

/*
--------------------------------------------------------
* OPTM_WMIN - {default=-7./8.} lower limit on dual
* mesh weights relative to cell radius.
--------------------------------------------------------
*/

real_t _optm_wmin ;

/*
--------------------------------------------------------
* OPTM_WMAX - {default=+1./80} upper limit on dual
* mesh weights relative to cell radius.
--------------------------------------------------------
*/

real_t _optm_wmax ;

/*
--------------------------------------------------------
* OPTM_TRIA - {default= true} allow for optimisation
Expand Down
8 changes: 5 additions & 3 deletions inc/lib_jigsaw.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
* JIGSAW: Interface to the JIGSAW meshing library.
--------------------------------------------------------
*
* Last updated: 08 Feb., 2021
* JIGSAW release 1.1.0.x
*
* Copyright 2013-2021
* Last updated: 20 Oct., 2024
*
* Copyright 2013-2024
* Darren Engwirda
* [email protected]
* https://github.com/dengwirda
Expand Down Expand Up @@ -64,7 +66,7 @@
extern "C" {
# endif

# ifdef _WIN32
# if defined(_WIN32) || defined(_WIN64)

# ifdef __lib_jigsaw
# define SHARED __declspec(dllexport)
Expand Down
17 changes: 10 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
function (cfg_compile_options OPT CFG)
# set OPT if compiling with CFG
add_compile_options ("$<$<CONFIG:${CFG}>:${OPT}>")
endfunction ()

Expand Down Expand Up @@ -27,24 +28,26 @@ endif ()
if (DEFINED ICPC_LIKE)
add_compile_options (-pedantic -Wall -Wextra -Wshadow -Wfloat-conversion)
add_compile_options (-fp-model=precise) # needed for adapt-fp
add_compile_options (-fno-math-errno) # no errno checks
add_compile_options (-fno-trapping-math) # no fp exceptions
add_compile_options (-ffinite-math-only) # no explicit nans, etc
cfg_compile_options (-fno-math-errno RELEASE) # no errno checks
cfg_compile_options (-fno-trapping-math RELEASE) # no fp exceptions
cfg_compile_options (-fno-signed-zeros RELEASE) # -0.0 == +0.0
cfg_compile_options (-ffinite-math-only RELEASE) # no explicit nans, etc
endif ()

if (DEFINED MSVC_LIKE)
add_compile_options (/W3)
add_compile_options (/openmp:llvm) # needed for openmp > 2.0
add_compile_options (/fp:precise) # needed for adapt-fp
cfg_compile_options (/GS- RELEASE) # disable buffer checks
cfg_compile_options (/Ot RELEASE) # favour "fast" code
cfg_compile_options (/Ot RELEASE) # favour "fast" code
endif ()

if (DEFINED GCXX_LIKE)
add_compile_options (-pedantic -Wall -Wextra -Wshadow -Wfloat-conversion)
add_compile_options (-fno-math-errno) # no errno checks
add_compile_options (-fno-trapping-math) # no fp exceptions
add_compile_options (-ffinite-math-only) # no explicit nans, etc
cfg_compile_options (-fno-math-errno RELEASE) # no errno checks
cfg_compile_options (-fno-trapping-math RELEASE) # no fp exceptions
cfg_compile_options (-fno-signed-zeros RELEASE) # -0.0 == +0.0
cfg_compile_options (-ffinite-math-only RELEASE) # no explicit nans, etc
endif ()

if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
Expand Down
Loading
Loading