-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathlib_jigsaw.h
346 lines (275 loc) · 8.27 KB
/
lib_jigsaw.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
/*
--------------------------------------------------------
*
* ,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: Interface to the JIGSAW meshing library.
--------------------------------------------------------
*
* Last updated: 08 Feb., 2021
*
* Copyright 2013-2021
* Darren Engwirda
* d.engwirda@gmail.com
* https://github.com/dengwirda
*
--------------------------------------------------------
*
* 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.)
*
* Disclaimer: Neither I nor THE CONTRIBUTORS warrant
* this code in any way whatsoever. This code is
* provided "as-is" to be used at your own risk.
*
* THE CONTRIBUTORS include:
* (a) The University of Sydney
* (b) The Massachusetts Institute of Technology
* (c) Columbia University
* (d) The National Aeronautics & Space Administration
* (e) Los Alamos National Laboratory
*
--------------------------------------------------------
*/
# pragma once
# ifndef __LIB_JIGSAW__
# define __LIB_JIGSAW__
# ifdef __cplusplus
extern "C" {
# endif
# ifdef _WIN32
# ifdef __lib_jigsaw
# define SHARED __declspec(dllexport)
# else
# define SHARED __declspec(dllimport)
# endif
# else
# define SHARED
# endif
# include "stdint.h"
# include "stddef.h"
typedef int32_t indx_t ; // yes, 32 bit ints,
// but, 64 bit ptrs!
typedef double real_t ;
typedef float fp32_t ;
# include "jigsaw_const.h"
# include "jigsaw_jig_t.h"
# include "jigsaw_msh_t.h"
/*
--------------------------------------------------------
* generate mesh via JIGSAW.
--------------------------------------------------------
*/
# define jigsaw_make_mesh jigsaw
SHARED indx_t jigsaw (
/* JCFG (REQUIRED): settings obj. definition.
*/
jigsaw_jig_t *_jcfg,
/* GEOM (REQUIRED): geometry obj. definition.
*/
jigsaw_msh_t *_geom,
/* INIT (OPTIONAL): initial tria. definition.
* => NULL for empty IC's.
*/
jigsaw_msh_t *_init,
/* HFUN (OPTIONAL): mesh-spacing function h(x).
* => NULL for empty h(x).
*/
jigsaw_msh_t *_hfun,
/* MESH (REQUIRED): output mesh data-structure.
*/
jigsaw_msh_t *_mesh
) ;
/*
--------------------------------------------------------
* compute rDT's via TRIPOD.
--------------------------------------------------------
*/
SHARED indx_t tripod (
/* JCFG (REQUIRED): settings obj. definition.
*/
jigsaw_jig_t *_jcfg,
/* INIT (REQUIRED): initial point definition.
*/
jigsaw_msh_t *_init,
/* GEOM (OPTIONAL): geometry obj. definition.
* => NULL for empty GEOM.
*/
jigsaw_msh_t *_geom,
/* MESH (REQUIRED): output mesh data-structure.
*/
jigsaw_msh_t *_mesh
) ;
/*
--------------------------------------------------------
* limit |df/dx| via MARCHE.
--------------------------------------------------------
*/
SHARED indx_t marche (
/* JCFG (REQUIRED): settings obj. definition.
*/
jigsaw_jig_t *_jcfg,
/* FFUN (REQUIRED): apply limiter to |df/dx|.
*/
jigsaw_msh_t *_ffun
) ;
/*
--------------------------------------------------------
* setup objects for JIGSAW.
--------------------------------------------------------
*/
SHARED void jigsaw_init_msh_t (
jigsaw_msh_t *_mesh
) ;
SHARED void jigsaw_init_jig_t (
jigsaw_jig_t *_jjig
) ;
/*
--------------------------------------------------------
* parse-to-file for JIGSAW.
--------------------------------------------------------
*/
/*
SHARED indx_t jigsaw_save_msh_t (
char *_file,
jigsaw_msh_t *_mesh
) ;
*/
SHARED indx_t jigsaw_save_jig_t (
char *_file,
jigsaw_jig_t *_jjig
) ;
SHARED indx_t jigsaw_load_msh_t (
char *_file,
jigsaw_msh_t *_mesh
) ;
SHARED indx_t jigsaw_load_jig_t (
char *_file,
jigsaw_jig_t *_jjig
) ;
/*
--------------------------------------------------------
* alloc objects for JIGSAW.
--------------------------------------------------------
*/
SHARED void jigsaw_alloc_vert2 (
jigsaw_VERT2_array_t *_xsrc ,
size_t _size
) ;
SHARED void jigsaw_alloc_vert3 (
jigsaw_VERT3_array_t *_xsrc ,
size_t _size
) ;
SHARED void jigsaw_alloc_edge2 (
jigsaw_EDGE2_array_t *_xsrc ,
size_t _size
) ;
SHARED void jigsaw_alloc_tria3 (
jigsaw_TRIA3_array_t *_xsrc ,
size_t _size
) ;
SHARED void jigsaw_alloc_quad4 (
jigsaw_QUAD4_array_t *_xsrc ,
size_t _size
) ;
SHARED void jigsaw_alloc_tria4 (
jigsaw_TRIA4_array_t *_xsrc ,
size_t _size
) ;
SHARED void jigsaw_alloc_hexa8 (
jigsaw_HEXA8_array_t *_xsrc ,
size_t _size
) ;
SHARED void jigsaw_alloc_wedg6 (
jigsaw_WEDG6_array_t *_xsrc ,
size_t _size
) ;
SHARED void jigsaw_alloc_pyra5 (
jigsaw_PYRA5_array_t *_xsrc ,
size_t _size
) ;
SHARED void jigsaw_alloc_bound (
jigsaw_BOUND_array_t *_xsrc ,
size_t _size
) ;
SHARED void jigsaw_alloc_index (
jigsaw_INDEX_array_t *_xsrc ,
size_t _size
) ;
SHARED void jigsaw_alloc_reals (
jigsaw_REALS_array_t *_xsrc ,
size_t _size
) ;
SHARED void jigsaw_alloc_flt32 (
jigsaw_FLT32_array_t *_xsrc ,
size_t _size
) ;
SHARED void jigsaw_free_msh_t (
jigsaw_msh_t *_mesh
) ;
SHARED void jigsaw_free_vert2 (
jigsaw_VERT2_array_t *_xsrc
) ;
SHARED void jigsaw_free_vert3 (
jigsaw_VERT3_array_t *_xsrc
) ;
SHARED void jigsaw_free_edge2 (
jigsaw_EDGE2_array_t *_xsrc
) ;
SHARED void jigsaw_free_tria3 (
jigsaw_TRIA3_array_t *_xsrc
) ;
SHARED void jigsaw_free_quad4 (
jigsaw_QUAD4_array_t *_xsrc
) ;
SHARED void jigsaw_free_tria4 (
jigsaw_TRIA4_array_t *_xsrc
) ;
SHARED void jigsaw_free_hexa8 (
jigsaw_HEXA8_array_t *_xsrc
) ;
SHARED void jigsaw_free_wedg6 (
jigsaw_WEDG6_array_t *_xsrc
) ;
SHARED void jigsaw_free_pyra5 (
jigsaw_PYRA5_array_t *_xsrc
) ;
SHARED void jigsaw_free_bound (
jigsaw_BOUND_array_t *_xsrc
) ;
SHARED void jigsaw_free_index (
jigsaw_INDEX_array_t *_xsrc
) ;
SHARED void jigsaw_free_reals (
jigsaw_REALS_array_t *_xsrc
) ;
SHARED void jigsaw_free_flt32 (
jigsaw_FLT32_array_t *_xsrc
) ;
# ifdef __cplusplus
}
# endif
# undef SHARED
# endif // __LIB_JIGSAW__