Skip to content

Commit 09cc86e

Browse files
authored
Merge pull request dengwirda#11 from dengwirda/dev
Dev
2 parents f7450ae + 4ed26db commit 09cc86e

File tree

92 files changed

+13646
-5654
lines changed

Some content is hidden

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

92 files changed

+13646
-5654
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.inc linguist-language=cpp

README.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
<img src = "../master/img/bunny-TRIA4-3.png">
88
</p>
99

10-
`JIGSAW` is a computational library for unstructured mesh generation; designed to generate high-quality Delaunay triangulations and polyhedral decompositions of general planar, surface and volumetric domains. `JIGSAW` includes both `refinement`-based algorithms for the construction of new meshes, as well as `optimisation`-driven techniques designed to improve existing grids.
10+
`JIGSAW` is a computational library for unstructured mesh generation and tessellation; 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 and Voronoi complexes.
1111

1212
This package provides the underlying `C++` source for `JIGSAW`; defining a basic command-line interface and a `C`-format `API`. A <a href="http://www.mathworks.com">`MATLAB`</a> / <a href="http://www.gnu.org/software/octave">`OCTAVE`</a> based scripting interface, including a range of additional facilities for file I/O, mesh visualisation and post-processing operations can be found <a href="https://github.com/dengwirda/jigsaw-matlab">here</a>.
1313

1414
`JIGSAW` has been compiled and tested on various `64-bit` `Linux` , `Windows` and `Mac` based platforms.
1515

16-
1716
## `Code Structure`
1817

1918
`JIGSAW` is written as a `header-only` library in `C++`. Both a basic command-line interface and a `C`-format `API` are defined:
@@ -37,15 +36,23 @@ The first step is to compile the code! The `JIGSAW` src can be found in <a href=
3736

3837
`JIGSAW` has been successfully built using various versions of the `g++` and `llvm` compilers. Since the build process is a simple one-liner, there's no `make` script - instead:
3938

40-
g++ -std=c++11 -pedantic -Wall -s -O3 -flto -D NDEBUG -static-libstdc++
41-
jigsaw.cpp -o jigsaw64r
39+
g++ -std=c++11 -pedantic -Wall -s -O3 -flto -D NDEBUG
40+
-D __cmd_jigsaw -static-libstdc++ jigsaw.cpp
41+
-o jigsaw64r
42+
43+
will build the main `JIGSAW` cmd-line executable,
44+
45+
g++ -std=c++11 -pedantic -Wall -s -O3 -flto -D NDEBUG
46+
-D __cmd_tripod -static-libstdc++ jigsaw.cpp
47+
-o tripod64r
4248

43-
can be used to build a `JIGSAW` executable, while:
49+
will build the `TRIPOD` cmd-line utility (`JIGSAW`'s tessellation infrastructure) and,
4450

45-
g++ -std=c++11 -pedantic -Wall -O3 -flto -fPIC -D NDEBUG -static-libstdc++
46-
jigsaw.cpp -shared -o libjigsaw64r.so
51+
g++ -std=c++11 -pedantic -Wall -O3 -flto -fPIC -D NDEBUG
52+
-D __lib_jigsaw -static-libstdc++ jigsaw.cpp
53+
-shared -o libjigsaw64r.so
4754

48-
can be used to build a `JIGSAW` shared library. See the headers in <a href="../master/inc/">`../jigsaw/inc/`</a> for details on the `API`. The `#define __lib_jigsaw` directive in `jigsaw.cpp` toggles the source between executable and shared-library modes.
55+
will build `JIGSAW` as shared library. See the headers in <a href="../master/jigsaw/inc/">`../jigsaw/inc/`</a> for details on the `API`.
4956

5057
#### `On Windows`
5158

@@ -72,18 +79,17 @@ On LNX-64 platforms:
7279
````
7380
In this example, a high-quality tetrahedral mesh is generated for the 'stanford-bunny' geometry and the result is 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`. Edit `example.jig` for a description of `JIGSAW`'s configuration options.
7481

75-
Additional information, documentation, online tutorials and references are available <a href="http://sites.google.com/site/dengwirda/jigsaw">here</a>. A repository of 3D surface models generated using `JIGSAW` can be found <a href="https://github.com/dengwirda/jigsaw-models">here</a>.
76-
82+
A set of unit-tests and `libjigsaw` example programs are contained in <a href="../master/uni/">`../uni/`</a>. The `JIGSAW-API` is documented via the header files in <a href="../master/inc/">`../inc/`</a>. A repository of 3D surface models generated using `JIGSAW` can be found <a href="https://github.com/dengwirda/jigsaw-models">here</a>.
7783

7884
## `License`
7985

8086
This program may be freely redistributed under the condition that the copyright notices (including this entire header) are not removed, and no compensation is received through use of the software. Private, research, and institutional use is free. You may distribute modified versions of this code `UNDER THE CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR NOTICE IS GIVEN OF THE MODIFICATIONS`. Distribution of this code as part of a commercial system is permissible `ONLY BY DIRECT ARRANGEMENT WITH THE AUTHOR`. (If you are not directly supplying this code to a customer, and you are instead telling them how they can obtain it for free, then you are not required to make any arrangement with me.)
8187

8288
`DISCLAIMER`: Neither I nor: Columbia University, the Massachusetts Institute of Technology, the University of Sydney, nor the National Aeronautics and Space Administration warrant this code in any way whatsoever. This code is provided "as-is" to be used at your own risk.
8389

84-
## `Attribution!`
90+
## `References`
8591

86-
If you make use of `JIGSAW` please make reference to the following. The algorithmic developments behind `JIGSAW` have been the subject of a number of publications, originally stemming from my PhD research at the University of Sydney:
92+
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:
8793

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

inc/jigsaw_const.h

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
2+
/*
3+
--------------------------------------------------------
4+
* Constants for the JIGSAW meshing library.
5+
--------------------------------------------------------
6+
*
7+
* This program may be freely redistributed under the
8+
* condition that the copyright notices (including this
9+
* entire header) are not removed, and no compensation
10+
* is received through use of the software. Private,
11+
* research, and institutional use is free. You may
12+
* distribute modified versions of this code UNDER THE
13+
* CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE
14+
* TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE
15+
* ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE
16+
* MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR
17+
* NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution
18+
* of this code as part of a commercial system is
19+
* permissible ONLY BY DIRECT ARRANGEMENT WITH THE
20+
* AUTHOR. (If you are not directly supplying this
21+
* code to a customer, and you are instead telling them
22+
* how they can obtain it for free, then you are not
23+
* required to make any arrangement with me.)
24+
*
25+
* Disclaimer: Neither I nor: Columbia University, The
26+
* Massachusetts Institute of Technology, The
27+
* University of Sydney, nor The National Aeronautics
28+
* and Space Administration warrant this code in any
29+
* way whatsoever. This code is provided "as-is" to be
30+
* used at your own risk.
31+
*
32+
--------------------------------------------------------
33+
*
34+
* Last updated: 20 December, 2018
35+
*
36+
* Copyright 2013-2018
37+
* Darren Engwirda
38+
* de2363@columbia.edu
39+
* https://github.com/dengwirda/
40+
*
41+
--------------------------------------------------------
42+
*/
43+
44+
/*
45+
--------------------------------------------------------
46+
* return codes for JIGSAW.
47+
--------------------------------------------------------
48+
*/
49+
50+
# define JIGSAW_UNKNOWN_ERROR -1
51+
52+
# define JIGSAW_NO_ERROR +0
53+
54+
# define JIGSAW_FILE_NOT_LOCATED +2
55+
# define JIGSAW_FILE_NOT_CREATED +3
56+
57+
# define JIGSAW_INVALID_ARGUMENT +4
58+
59+
/*
60+
--------------------------------------------------------
61+
* constants for JIGSAW.
62+
--------------------------------------------------------
63+
*/
64+
65+
# define JIGSAW_NULL_FLAG -100
66+
67+
# define JIGSAW_EUCLIDEAN_MESH +100
68+
# define JIGSAW_EUCLIDEAN_GRID +101
69+
# define JIGSAW_EUCLIDEAN_DUAL +102
70+
71+
# define JIGSAW_ELLIPSOID_MESH +200
72+
# define JIGSAW_ELLIPSOID_GRID +201
73+
# define JIGSAW_ELLIPSOID_DUAL +202
74+
75+
# define JIGSAW_POINT_TAG +10
76+
# define JIGSAW_EDGE2_TAG +20
77+
# define JIGSAW_TRIA3_TAG +30
78+
# define JIGSAW_QUAD4_TAG +40
79+
# define JIGSAW_TRIA4_TAG +50
80+
# define JIGSAW_HEXA8_TAG +60
81+
# define JIGSAW_WEDG6_TAG +70
82+
# define JIGSAW_PYRA5_TAG +80
83+
84+
# define JIGSAW_HFUN_RELATIVE +300
85+
# define JIGSAW_HFUN_ABSOLUTE +301
86+
87+
# define JIGSAW_KERN_DELFRONT +400
88+
# define JIGSAW_KERN_DELAUNAY +401
89+
90+
# define JIGSAW_BNDS_TRIACELL +402
91+
# define JIGSAW_BNDS_DUALCELL +403
92+
93+
94+

inc/jigsaw_msh_t.h

Lines changed: 83 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
--------------------------------------------------------
3333
*
34-
* Last updated: 10 June, 2018
34+
* Last updated: 20 December, 2018
3535
*
3636
* Copyright 2013-2018
3737
* Darren Engwirda
@@ -51,32 +51,63 @@
5151
typedef struct
5252
{
5353
real_t _ppos [2] ; // coord.'s
54-
indx_t _itag ;
54+
indx_t _itag ; // ID tag
5555
} jigsaw_VERT2_t ;
5656

5757
typedef struct
5858
{
5959
real_t _ppos [3] ; // coord.'s
60-
indx_t _itag ;
60+
indx_t _itag ; // ID tag
6161
} jigsaw_VERT3_t ;
6262

6363
typedef struct
6464
{
6565
indx_t _node [2] ; // indexing
66-
indx_t _itag ;
66+
indx_t _itag ; // ID tag
6767
} jigsaw_EDGE2_t ;
6868

6969
typedef struct
7070
{
7171
indx_t _node [3] ; // indexing
72-
indx_t _itag ;
72+
indx_t _itag ; // ID tag
7373
} jigsaw_TRIA3_t ;
7474

7575
typedef struct
7676
{
7777
indx_t _node [4] ; // indexing
78-
indx_t _itag ;
78+
indx_t _itag ; // ID tag
79+
} jigsaw_QUAD4_t ;
80+
81+
typedef struct
82+
{
83+
indx_t _node [4] ; // indexing
84+
indx_t _itag ; // ID tag
7985
} jigsaw_TRIA4_t ;
86+
87+
typedef struct
88+
{
89+
indx_t _node [8] ; // indexing
90+
indx_t _itag ; // ID tag
91+
} jigsaw_HEXA8_t ;
92+
93+
typedef struct
94+
{
95+
indx_t _node [6] ; // indexing
96+
indx_t _itag ; // ID tag
97+
} jigsaw_WEDG6_t ;
98+
99+
typedef struct
100+
{
101+
indx_t _node [5] ; // indexing
102+
indx_t _itag ; // ID tag
103+
} jigsaw_PYRA5_t ;
104+
105+
typedef struct
106+
{
107+
indx_t _itag ; // ID tag
108+
indx_t _indx ; // MSH num.
109+
indx_t _kind ; // MSH obj.
110+
} jigsaw_BOUND_t ;
80111

81112
/*------------------------------------------- array types */
82113

@@ -104,12 +135,48 @@
104135
jigsaw_TRIA3_t *_data ;
105136
} jigsaw_TRIA3_array_t ;
106137

138+
typedef struct
139+
{
140+
indx_t _size ;
141+
jigsaw_QUAD4_t *_data ;
142+
} jigsaw_QUAD4_array_t ;
143+
107144
typedef struct
108145
{
109146
indx_t _size ;
110147
jigsaw_TRIA4_t *_data ;
111148
} jigsaw_TRIA4_array_t ;
112149

150+
typedef struct
151+
{
152+
indx_t _size ;
153+
jigsaw_HEXA8_t *_data ;
154+
} jigsaw_HEXA8_array_t ;
155+
156+
typedef struct
157+
{
158+
indx_t _size ;
159+
jigsaw_WEDG6_t *_data ;
160+
} jigsaw_WEDG6_array_t ;
161+
162+
typedef struct
163+
{
164+
indx_t _size ;
165+
jigsaw_PYRA5_t *_data ;
166+
} jigsaw_PYRA5_array_t ;
167+
168+
typedef struct
169+
{
170+
indx_t _size ;
171+
jigsaw_BOUND_t *_data ;
172+
} jigsaw_BOUND_array_t ;
173+
174+
typedef struct
175+
{
176+
indx_t _size ;
177+
indx_t *_data ;
178+
} jigsaw_INDEX_array_t ;
179+
113180
typedef struct
114181
{
115182
indx_t _size ;
@@ -131,16 +198,23 @@
131198
jigsaw_REALS_array_t _power;
132199

133200
jigsaw_EDGE2_array_t _edge2;
201+
134202
jigsaw_TRIA3_array_t _tria3;
203+
jigsaw_QUAD4_array_t _quad4;
204+
135205
jigsaw_TRIA4_array_t _tria4;
206+
jigsaw_HEXA8_array_t _hexa8;
207+
jigsaw_WEDG6_array_t _wedg6;
208+
jigsaw_PYRA5_array_t _pyra5;
136209

210+
jigsaw_BOUND_array_t _bound;
137211

138212
/* if (_flags == ELLIPSOID_MESH) */
139213

140214
jigsaw_REALS_array_t _radii;
141215

142-
143216
/* if (_flags == EUCLIDEAN_GRID) */
217+
/* OR (_flags == ELLIPSOID_GRID) */
144218

145219
jigsaw_REALS_array_t _xgrid;
146220
jigsaw_REALS_array_t _ygrid;
@@ -149,10 +223,11 @@
149223

150224
/* if (_flags == EUCLIDEAN_MESH) */
151225
/* OR (_flags == EUCLIDEAN_GRID) */
226+
/* OR (_flags == ELLIPSOID_MESH) */
227+
/* OR (_flags == ELLIPSOID_GRID) */
152228

153229
jigsaw_REALS_array_t _value;
154230

155-
156231
/* if (_flags == EUCLIDEAN_DUAL) */
157232

158233
/*!! todo: dual-mesh data here!! */

0 commit comments

Comments
 (0)