Skip to content

Commit 033bf10

Browse files
authored
Merge pull request #28 from dengwirda/dev
Update to jigsaw-1.1.0.x
2 parents 5729a38 + e4b2c37 commit 033bf10

File tree

130 files changed

+6463
-3440
lines changed

Some content is hidden

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

130 files changed

+6463
-3440
lines changed

.github/workflows/setup.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
os: [ubuntu-latest, macos-latest, windows-latest]
15-
python-version: ["3.10"]
15+
python-version: ["3.12"]
1616

1717
steps:
1818
- uses: actions/checkout@v3
@@ -57,7 +57,9 @@ jobs:
5757
pip install -r requirements.txt
5858
5959
- name: Build jigsaw-python
60-
run: python setup.py build_external install
60+
run: |
61+
python build.py
62+
pip install .
6163
6264
- name: Eval. jigsaw-python
6365
run: python example.py --IDnumber=-1

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
<img src = "../master/external/jigsaw/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.
11+
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.
1113

1214
This package provides a <a href="http://www.python.org">`Python`</a> based scripting interface to the underlying `JIGSAW` mesh generator, including a range of additional facilities for file I/O, mesh visualisation and post-processing operations.
1315

@@ -17,17 +19,17 @@ This package provides a <a href="http://www.python.org">`Python`</a> based scrip
1719

1820
Ensure you have a c++ compiler and the cmake utility installed.
1921
Clone/download + unpack this repository.
20-
python3 setup.py build_external
21-
python3 setup.py install
22+
python3 build.py
23+
pip3 install .
2224
python3 example.py --IDnumber=0
2325

24-
Note: installation of `JIGSAW` requires a `c++` compiler and the `cmake` utility. `JIGSAW` may also be installed as a `conda` package. See <a href="https://github.com/dengwirda/jigsaw">here</a> for details.
26+
Note: installation of `JIGSAW` requires a `c++` compiler and the `cmake` utility.
2527

2628
### `Function Listing`
2729

2830
See `jigsawpy` for a description of the various functions available.
2931

30-
setup.py - compile and install JIGSAW's c++ backend using cmake.
32+
build.py - compile and install JIGSAW's c++ backend using cmake.
3133
example.py - a list of demo programs.
3234

3335
jigsaw.py - cmd-line interface to JIGSAW's backend
@@ -75,7 +77,7 @@ This program may be freely redistributed under the condition that the copyright
7577

7678
### `References`
7779

78-
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:
80+
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:
7981

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

build.py

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
2+
import os
3+
import subprocess
4+
import shutil
5+
6+
HERE = os.path.abspath(os.path.dirname(__file__))
7+
8+
def build_external():
9+
#-- The actual cmake-based build steps for JIGSAW
10+
11+
cwd_pointer = os.getcwd()
12+
13+
try:
14+
print("cmake config. for jigsaw...")
15+
16+
source_path = os.path.join(
17+
HERE, "external", "jigsaw")
18+
19+
builds_path = \
20+
os.path.join(source_path, "tmp")
21+
22+
os.makedirs(builds_path, exist_ok=True)
23+
24+
exesrc_path = \
25+
os.path.join(source_path, "bin")
26+
27+
libsrc_path = \
28+
os.path.join(source_path, "lib")
29+
30+
exedst_path = os.path.join(
31+
HERE, "jigsawpy", "_bin")
32+
33+
libdst_path = os.path.join(
34+
HERE, "jigsawpy", "_lib")
35+
36+
shutil.rmtree(
37+
exedst_path, ignore_errors=True)
38+
shutil.rmtree(
39+
libdst_path, ignore_errors=True)
40+
41+
os.chdir(builds_path)
42+
43+
config_call = [
44+
"cmake",
45+
"..", "-DCMAKE_BUILD_TYPE=Release"]
46+
47+
subprocess.run(config_call, check=True)
48+
49+
print("cmake compile for jigsaw...")
50+
51+
try:
52+
compilecall = [
53+
"cmake", "--build", ".",
54+
"--config", "Release",
55+
"--target", "install",
56+
"--parallel", "4"
57+
]
58+
subprocess.run(
59+
compilecall, check=True)
60+
61+
except:
62+
compilecall = [
63+
"cmake", "--build", ".",
64+
"--config", "Release",
65+
"--target", "install"
66+
]
67+
subprocess.run(
68+
compilecall, check=True)
69+
70+
print("cmake cleanup for jigsaw...")
71+
72+
shutil.copytree(exesrc_path, exedst_path)
73+
shutil.copytree(libsrc_path, libdst_path)
74+
75+
finally:
76+
os.chdir(cwd_pointer)
77+
78+
shutil.rmtree(builds_path)
79+
80+
81+
if (__name__ == "__main__"): build_external()
82+

external/jigsaw/.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

external/jigsaw/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

external/jigsaw/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
#

0 commit comments

Comments
 (0)