File: gmshc.h

package info (click to toggle)
gmsh 4.7.1%2Bds1-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 95,484 kB
  • sloc: cpp: 566,747; ansic: 150,384; yacc: 7,198; python: 6,130; java: 3,486; lisp: 622; lex: 621; makefile: 613; perl: 571; sh: 439; xml: 415; javascript: 113; pascal: 35; modula3: 32
file content (2788 lines) | stat: -rw-r--r-- 158,792 bytes parent folder | download
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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
/*
 * Gmsh - Copyright (C) 1997-2020 C. Geuzaine, J.-F. Remacle
 *
 * See the LICENSE.txt file for license information. Please report all
 * issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
 */

#ifndef GMSHC_H
#define GMSHC_H

/*
 * This file defines the Gmsh C API (v4.7.1).
 *
 * Do not edit it directly: it is automatically generated by `api/gen.py'.
 *
 * By design, the Gmsh C API is purely functional, and only uses elementary
 * C types. See `tutorial/c' and `demos/api' for examples.
 */

#include <stddef.h>

#define GMSH_API_VERSION "4.7.1"
#define GMSH_API_VERSION_MAJOR 4
#define GMSH_API_VERSION_MINOR 7
#define GMSH_API_VERSION_PATCH 1

#if defined(GMSH_DLL)
#if defined(GMSH_DLL_EXPORT)
#define GMSH_API __declspec(dllexport)
#else
#define GMSH_API __declspec(dllimport)
#endif
#else
#define GMSH_API
#endif

GMSH_API void gmshFree(void *p);
GMSH_API void *gmshMalloc(size_t n);

/* Initialize Gmsh API. This must be called before any call to the other
 * functions in the API. If `argc' and `argv' (or just `argv' in Python or
 * Julia) are provided, they will be handled in the same way as the command
 * line arguments in the Gmsh app. If `readConfigFiles' is set, read system
 * Gmsh configuration files (gmshrc and gmsh-options). Initializing the API
 * sets the options "General.Terminal" to 1 and "General.AbortOnError" to 2. */
GMSH_API void gmshInitialize(int argc, char ** argv,
                             const int readConfigFiles,
                             int * ierr);

/* Finalize the Gmsh API. This must be called when you are done using the Gmsh
 * API. */
GMSH_API void gmshFinalize(int * ierr);

/* Open a file. Equivalent to the `File->Open' menu in the Gmsh app. Handling
 * of the file depends on its extension and/or its contents: opening a file
 * with model data will create a new model. */
GMSH_API void gmshOpen(const char * fileName,
                       int * ierr);

/* Merge a file. Equivalent to the `File->Merge' menu in the Gmsh app.
 * Handling of the file depends on its extension and/or its contents. Merging
 * a file with model data will add the data to the current model. */
GMSH_API void gmshMerge(const char * fileName,
                        int * ierr);

/* Write a file. The export format is determined by the file extension. */
GMSH_API void gmshWrite(const char * fileName,
                        int * ierr);

/* Clear all loaded models and post-processing data, and add a new empty
 * model. */
GMSH_API void gmshClear(int * ierr);

/* Set a numerical option to `value'. `name' is of the form "category.option"
 * or "category[num].option". Available categories and options are listed in
 * the Gmsh reference manual. */
GMSH_API void gmshOptionSetNumber(const char * name,
                                  const double value,
                                  int * ierr);

/* Get the `value' of a numerical option. `name' is of the form
 * "category.option" or "category[num].option". Available categories and
 * options are listed in the Gmsh reference manual. */
GMSH_API void gmshOptionGetNumber(const char * name,
                                  double * value,
                                  int * ierr);

/* Set a string option to `value'. `name' is of the form "category.option" or
 * "category[num].option". Available categories and options are listed in the
 * Gmsh reference manual. */
GMSH_API void gmshOptionSetString(const char * name,
                                  const char * value,
                                  int * ierr);

/* Get the `value' of a string option. `name' is of the form "category.option"
 * or "category[num].option". Available categories and options are listed in
 * the Gmsh reference manual. */
GMSH_API void gmshOptionGetString(const char * name,
                                  char ** value,
                                  int * ierr);

/* Set a color option to the RGBA value (`r', `g', `b', `a'), where where `r',
 * `g', `b' and `a' should be integers between 0 and 255. `name' is of the
 * form "category.option" or "category[num].option". Available categories and
 * options are listed in the Gmsh reference manual, with the "Color." middle
 * string removed. */
GMSH_API void gmshOptionSetColor(const char * name,
                                 const int r,
                                 const int g,
                                 const int b,
                                 const int a,
                                 int * ierr);

/* Get the `r', `g', `b', `a' value of a color option. `name' is of the form
 * "category.option" or "category[num].option". Available categories and
 * options are listed in the Gmsh reference manual, with the "Color." middle
 * string removed. */
GMSH_API void gmshOptionGetColor(const char * name,
                                 int * r,
                                 int * g,
                                 int * b,
                                 int * a,
                                 int * ierr);

/* Add a new model, with name `name', and set it as the current model. */
GMSH_API void gmshModelAdd(const char * name,
                           int * ierr);

/* Remove the current model. */
GMSH_API void gmshModelRemove(int * ierr);

/* List the names of all models. */
GMSH_API void gmshModelList(char *** names, size_t * names_n,
                            int * ierr);

/* Get the name of the current model. */
GMSH_API void gmshModelGetCurrent(char ** name,
                                  int * ierr);

/* Set the current model to the model with name `name'. If several models have
 * the same name, select the one that was added first. */
GMSH_API void gmshModelSetCurrent(const char * name,
                                  int * ierr);

/* Get all the entities in the current model. If `dim' is >= 0, return only
 * the entities of the specified dimension (e.g. points if `dim' == 0). The
 * entities are returned as a vector of (dim, tag) integer pairs. */
GMSH_API void gmshModelGetEntities(int ** dimTags, size_t * dimTags_n,
                                   const int dim,
                                   int * ierr);

/* Set the name of the entity of dimension `dim' and tag `tag'. */
GMSH_API void gmshModelSetEntityName(const int dim,
                                     const int tag,
                                     const char * name,
                                     int * ierr);

/* Get the name of the entity of dimension `dim' and tag `tag'. */
GMSH_API void gmshModelGetEntityName(const int dim,
                                     const int tag,
                                     char ** name,
                                     int * ierr);

/* Get all the physical groups in the current model. If `dim' is >= 0, return
 * only the entities of the specified dimension (e.g. physical points if `dim'
 * == 0). The entities are returned as a vector of (dim, tag) integer pairs. */
GMSH_API void gmshModelGetPhysicalGroups(int ** dimTags, size_t * dimTags_n,
                                         const int dim,
                                         int * ierr);

/* Get the tags of the model entities making up the physical group of
 * dimension `dim' and tag `tag'. */
GMSH_API void gmshModelGetEntitiesForPhysicalGroup(const int dim,
                                                   const int tag,
                                                   int ** tags, size_t * tags_n,
                                                   int * ierr);

/* Get the tags of the physical groups (if any) to which the model entity of
 * dimension `dim' and tag `tag' belongs. */
GMSH_API void gmshModelGetPhysicalGroupsForEntity(const int dim,
                                                  const int tag,
                                                  int ** physicalTags, size_t * physicalTags_n,
                                                  int * ierr);

/* Add a physical group of dimension `dim', grouping the model entities with
 * tags `tags'. Return the tag of the physical group, equal to `tag' if `tag'
 * is positive, or a new tag if `tag' < 0. */
GMSH_API int gmshModelAddPhysicalGroup(const int dim,
                                       int * tags, size_t tags_n,
                                       const int tag,
                                       int * ierr);

/* Remove the physical groups `dimTags' from the current model. If `dimTags'
 * is empty, remove all groups. */
GMSH_API void gmshModelRemovePhysicalGroups(int * dimTags, size_t dimTags_n,
                                            int * ierr);

/* Set the name of the physical group of dimension `dim' and tag `tag'. */
GMSH_API void gmshModelSetPhysicalName(const int dim,
                                       const int tag,
                                       const char * name,
                                       int * ierr);

/* Remove the physical name `name' from the current model. */
GMSH_API void gmshModelRemovePhysicalName(const char * name,
                                          int * ierr);

/* Get the name of the physical group of dimension `dim' and tag `tag'. */
GMSH_API void gmshModelGetPhysicalName(const int dim,
                                       const int tag,
                                       char ** name,
                                       int * ierr);

/* Get the boundary of the model entities `dimTags'. Return in `outDimTags'
 * the boundary of the individual entities (if `combined' is false) or the
 * boundary of the combined geometrical shape formed by all input entities (if
 * `combined' is true). Return tags multiplied by the sign of the boundary
 * entity if `oriented' is true. Apply the boundary operator recursively down
 * to dimension 0 (i.e. to points) if `recursive' is true. */
GMSH_API void gmshModelGetBoundary(int * dimTags, size_t dimTags_n,
                                   int ** outDimTags, size_t * outDimTags_n,
                                   const int combined,
                                   const int oriented,
                                   const int recursive,
                                   int * ierr);

/* Get the model entities in the bounding box defined by the two points
 * (`xmin', `ymin', `zmin') and (`xmax', `ymax', `zmax'). If `dim' is >= 0,
 * return only the entities of the specified dimension (e.g. points if `dim'
 * == 0). */
GMSH_API void gmshModelGetEntitiesInBoundingBox(const double xmin,
                                                const double ymin,
                                                const double zmin,
                                                const double xmax,
                                                const double ymax,
                                                const double zmax,
                                                int ** tags, size_t * tags_n,
                                                const int dim,
                                                int * ierr);

/* Get the bounding box (`xmin', `ymin', `zmin'), (`xmax', `ymax', `zmax') of
 * the model entity of dimension `dim' and tag `tag'. If `dim' and `tag' are
 * negative, get the bounding box of the whole model. */
GMSH_API void gmshModelGetBoundingBox(const int dim,
                                      const int tag,
                                      double * xmin,
                                      double * ymin,
                                      double * zmin,
                                      double * xmax,
                                      double * ymax,
                                      double * zmax,
                                      int * ierr);

/* Get the geometrical dimension of the current model. */
GMSH_API int gmshModelGetDimension(int * ierr);

/* Add a discrete model entity (defined by a mesh) of dimension `dim' in the
 * current model. Return the tag of the new discrete entity, equal to `tag' if
 * `tag' is positive, or a new tag if `tag' < 0. `boundary' specifies the tags
 * of the entities on the boundary of the discrete entity, if any. Specifying
 * `boundary' allows Gmsh to construct the topology of the overall model. */
GMSH_API int gmshModelAddDiscreteEntity(const int dim,
                                        const int tag,
                                        int * boundary, size_t boundary_n,
                                        int * ierr);

/* Remove the entities `dimTags' of the current model. If `recursive' is true,
 * remove all the entities on their boundaries, down to dimension 0. */
GMSH_API void gmshModelRemoveEntities(int * dimTags, size_t dimTags_n,
                                      const int recursive,
                                      int * ierr);

/* Remove the entity name `name' from the current model. */
GMSH_API void gmshModelRemoveEntityName(const char * name,
                                        int * ierr);

/* Get the type of the entity of dimension `dim' and tag `tag'. */
GMSH_API void gmshModelGetType(const int dim,
                               const int tag,
                               char ** entityType,
                               int * ierr);

/* In a partitioned model, get the parent of the entity of dimension `dim' and
 * tag `tag', i.e. from which the entity is a part of, if any. `parentDim' and
 * `parentTag' are set to -1 if the entity has no parent. */
GMSH_API void gmshModelGetParent(const int dim,
                                 const int tag,
                                 int * parentDim,
                                 int * parentTag,
                                 int * ierr);

/* In a partitioned model, return the tags of the partition(s) to which the
 * entity belongs. */
GMSH_API void gmshModelGetPartitions(const int dim,
                                     const int tag,
                                     int ** partitions, size_t * partitions_n,
                                     int * ierr);

/* Evaluate the parametrization of the entity of dimension `dim' and tag `tag'
 * at the parametric coordinates `parametricCoord'. Only valid for `dim' equal
 * to 0 (with empty `parametricCoord'), 1 (with `parametricCoord' containing
 * parametric coordinates on the curve) or 2 (with `parametricCoord'
 * containing pairs of u, v parametric coordinates on the surface,
 * concatenated: [p1u, p1v, p2u, ...]). Return triplets of x, y, z coordinates
 * in `coord', concatenated: [p1x, p1y, p1z, p2x, ...]. */
GMSH_API void gmshModelGetValue(const int dim,
                                const int tag,
                                double * parametricCoord, size_t parametricCoord_n,
                                double ** coord, size_t * coord_n,
                                int * ierr);

/* Evaluate the derivative of the parametrization of the entity of dimension
 * `dim' and tag `tag' at the parametric coordinates `parametricCoord'. Only
 * valid for `dim' equal to 1 (with `parametricCoord' containing parametric
 * coordinates on the curve) or 2 (with `parametricCoord' containing pairs of
 * u, v parametric coordinates on the surface, concatenated: [p1u, p1v, p2u,
 * ...]). For `dim' equal to 1 return the x, y, z components of the derivative
 * with respect to u [d1ux, d1uy, d1uz, d2ux, ...]; for `dim' equal to 2
 * return the x, y, z components of the derivate with respect to u and v:
 * [d1ux, d1uy, d1uz, d1vx, d1vy, d1vz, d2ux, ...]. */
GMSH_API void gmshModelGetDerivative(const int dim,
                                     const int tag,
                                     double * parametricCoord, size_t parametricCoord_n,
                                     double ** derivatives, size_t * derivatives_n,
                                     int * ierr);

/* Evaluate the (maximum) curvature of the entity of dimension `dim' and tag
 * `tag' at the parametric coordinates `parametricCoord'. Only valid for `dim'
 * equal to 1 (with `parametricCoord' containing parametric coordinates on the
 * curve) or 2 (with `parametricCoord' containing pairs of u, v parametric
 * coordinates on the surface, concatenated: [p1u, p1v, p2u, ...]). */
GMSH_API void gmshModelGetCurvature(const int dim,
                                    const int tag,
                                    double * parametricCoord, size_t parametricCoord_n,
                                    double ** curvatures, size_t * curvatures_n,
                                    int * ierr);

/* Evaluate the principal curvatures of the surface with tag `tag' at the
 * parametric coordinates `parametricCoord', as well as their respective
 * directions. `parametricCoord' are given by pair of u and v coordinates,
 * concatenated: [p1u, p1v, p2u, ...]. */
GMSH_API void gmshModelGetPrincipalCurvatures(const int tag,
                                              double * parametricCoord, size_t parametricCoord_n,
                                              double ** curvatureMax, size_t * curvatureMax_n,
                                              double ** curvatureMin, size_t * curvatureMin_n,
                                              double ** directionMax, size_t * directionMax_n,
                                              double ** directionMin, size_t * directionMin_n,
                                              int * ierr);

/* Get the normal to the surface with tag `tag' at the parametric coordinates
 * `parametricCoord'. `parametricCoord' are given by pairs of u and v
 * coordinates, concatenated: [p1u, p1v, p2u, ...]. `normals' are returned as
 * triplets of x, y, z components, concatenated: [n1x, n1y, n1z, n2x, ...]. */
GMSH_API void gmshModelGetNormal(const int tag,
                                 double * parametricCoord, size_t parametricCoord_n,
                                 double ** normals, size_t * normals_n,
                                 int * ierr);

/* Get the parametric coordinates `parametricCoord' for the points `coord' on
 * the entity of dimension `dim' and tag `tag'. `coord' are given as triplets
 * of x, y, z coordinates, concatenated: [p1x, p1y, p1z, p2x, ...].
 * `parametricCoord' returns the parametric coordinates t on the curve (if
 * `dim' = 1) or pairs of u and v coordinates concatenated on the surface (if
 * `dim' = 2), i.e. [p1t, p2t, ...] or [p1u, p1v, p2u, ...]. */
GMSH_API void gmshModelGetParametrization(const int dim,
                                          const int tag,
                                          double * coord, size_t coord_n,
                                          double ** parametricCoord, size_t * parametricCoord_n,
                                          int * ierr);

/* Get the `min' and `max' bounds of the parametric coordinates for the entity
 * of dimension `dim' and tag `tag'. */
GMSH_API void gmshModelGetParametrizationBounds(const int dim,
                                                const int tag,
                                                double ** min, size_t * min_n,
                                                double ** max, size_t * max_n,
                                                int * ierr);

/* Check if the parametric coordinates provided in `parametricCoord'
 * correspond to points inside the entitiy of dimension `dim' and tag `tag',
 * and return the number of points inside. This feature is only available for
 * a subset of curves and surfaces, depending on the underyling geometrical
 * representation. */
GMSH_API int gmshModelIsInside(const int dim,
                               const int tag,
                               double * parametricCoord, size_t parametricCoord_n,
                               int * ierr);

/* Get the points `closestCoord' on the entity of dimension `dim' and tag
 * `tag' to the points `coord', by orthogonal projection. `coord' and
 * `closestCoord' are given as triplets of x, y, z coordinates, concatenated:
 * [p1x, p1y, p1z, p2x, ...]. `parametricCoord' returns the parametric
 * coordinates t on the curve (if `dim' = 1) or pairs of u and v coordinates
 * concatenated on the surface (if `dim' = 2), i.e. [p1t, p2t, ...] or [p1u,
 * p1v, p2u, ...]. */
GMSH_API void gmshModelGetClosestPoint(const int dim,
                                       const int tag,
                                       double * coord, size_t coord_n,
                                       double ** closestCoord, size_t * closestCoord_n,
                                       double ** parametricCoord, size_t * parametricCoord_n,
                                       int * ierr);

/* Reparametrize the boundary entity (point or curve, i.e. with `dim' == 0 or
 * `dim' == 1) of tag `tag' on the surface `surfaceTag'. If `dim' == 1,
 * reparametrize all the points corresponding to the parametric coordinates
 * `parametricCoord'. Multiple matches in case of periodic surfaces can be
 * selected with `which'. This feature is only available for a subset of
 * entities, depending on the underyling geometrical representation. */
GMSH_API void gmshModelReparametrizeOnSurface(const int dim,
                                              const int tag,
                                              double * parametricCoord, size_t parametricCoord_n,
                                              const int surfaceTag,
                                              double ** surfaceParametricCoord, size_t * surfaceParametricCoord_n,
                                              const int which,
                                              int * ierr);

/* Set the visibility of the model entities `dimTags' to `value'. Apply the
 * visibility setting recursively if `recursive' is true. */
GMSH_API void gmshModelSetVisibility(int * dimTags, size_t dimTags_n,
                                     const int value,
                                     const int recursive,
                                     int * ierr);

/* Get the visibility of the model entity of dimension `dim' and tag `tag'. */
GMSH_API void gmshModelGetVisibility(const int dim,
                                     const int tag,
                                     int * value,
                                     int * ierr);

/* Set the global visibility of the model per window to `value', where
 * `windowIndex' identifies the window in the window list. */
GMSH_API void gmshModelSetVisibilityPerWindow(const int value,
                                              const int windowIndex,
                                              int * ierr);

/* Set the color of the model entities `dimTags' to the RGBA value (`r', `g',
 * `b', `a'), where `r', `g', `b' and `a' should be integers between 0 and
 * 255. Apply the color setting recursively if `recursive' is true. */
GMSH_API void gmshModelSetColor(int * dimTags, size_t dimTags_n,
                                const int r,
                                const int g,
                                const int b,
                                const int a,
                                const int recursive,
                                int * ierr);

/* Get the color of the model entity of dimension `dim' and tag `tag'. */
GMSH_API void gmshModelGetColor(const int dim,
                                const int tag,
                                int * r,
                                int * g,
                                int * b,
                                int * a,
                                int * ierr);

/* Set the `x', `y', `z' coordinates of a geometrical point. */
GMSH_API void gmshModelSetCoordinates(const int tag,
                                      const double x,
                                      const double y,
                                      const double z,
                                      int * ierr);

/* Generate a mesh of the current model, up to dimension `dim' (0, 1, 2 or 3). */
GMSH_API void gmshModelMeshGenerate(const int dim,
                                    int * ierr);

/* Partition the mesh of the current model into `numPart' partitions. */
GMSH_API void gmshModelMeshPartition(const int numPart,
                                     int * ierr);

/* Unpartition the mesh of the current model. */
GMSH_API void gmshModelMeshUnpartition(int * ierr);

/* Optimize the mesh of the current model using `method' (empty for default
 * tetrahedral mesh optimizer, "Netgen" for Netgen optimizer, "HighOrder" for
 * direct high-order mesh optimizer, "HighOrderElastic" for high-order elastic
 * smoother, "HighOrderFastCurving" for fast curving algorithm, "Laplace2D"
 * for Laplace smoothing, "Relocate2D" and "Relocate3D" for node relocation).
 * If `force' is set apply the optimization also to discrete entities. If
 * `dimTags' is given, only apply the optimizer to the given entities. */
GMSH_API void gmshModelMeshOptimize(const char * method,
                                    const int force,
                                    const int niter,
                                    int * dimTags, size_t dimTags_n,
                                    int * ierr);

/* Recombine the mesh of the current model. */
GMSH_API void gmshModelMeshRecombine(int * ierr);

/* Refine the mesh of the current model by uniformly splitting the elements. */
GMSH_API void gmshModelMeshRefine(int * ierr);

/* Set the order of the elements in the mesh of the current model to `order'. */
GMSH_API void gmshModelMeshSetOrder(const int order,
                                    int * ierr);

/* Get the last entities (if any) where a meshing error occurred. Currently
 * only populated by the new 3D meshing algorithms. */
GMSH_API void gmshModelMeshGetLastEntityError(int ** dimTags, size_t * dimTags_n,
                                              int * ierr);

/* Get the last nodes (if any) where a meshing error occurred. Currently only
 * populated by the new 3D meshing algorithms. */
GMSH_API void gmshModelMeshGetLastNodeError(size_t ** nodeTags, size_t * nodeTags_n,
                                            int * ierr);

/* Clear the mesh, i.e. delete all the nodes and elements, for the entities
 * `dimTags'. if `dimTags' is empty, clear the whole mesh. Note that the mesh
 * of an entity can only be cleared if this entity is not on the boundary of
 * another entity with a non-empty mesh. */
GMSH_API void gmshModelMeshClear(int * dimTags, size_t dimTags_n,
                                 int * ierr);

/* Get the nodes classified on the entity of dimension `dim' and tag `tag'. If
 * `tag' < 0, get the nodes for all entities of dimension `dim'. If `dim' and
 * `tag' are negative, get all the nodes in the mesh. `nodeTags' contains the
 * node tags (their unique, strictly positive identification numbers). `coord'
 * is a vector of length 3 times the length of `nodeTags' that contains the x,
 * y, z coordinates of the nodes, concatenated: [n1x, n1y, n1z, n2x, ...]. If
 * `dim' >= 0 and `returnParamtricCoord' is set, `parametricCoord' contains
 * the parametric coordinates ([u1, u2, ...] or [u1, v1, u2, ...]) of the
 * nodes, if available. The length of `parametricCoord' can be 0 or `dim'
 * times the length of `nodeTags'. If `includeBoundary' is set, also return
 * the nodes classified on the boundary of the entity (which will be
 * reparametrized on the entity if `dim' >= 0 in order to compute their
 * parametric coordinates). */
GMSH_API void gmshModelMeshGetNodes(size_t ** nodeTags, size_t * nodeTags_n,
                                    double ** coord, size_t * coord_n,
                                    double ** parametricCoord, size_t * parametricCoord_n,
                                    const int dim,
                                    const int tag,
                                    const int includeBoundary,
                                    const int returnParametricCoord,
                                    int * ierr);

/* Get the nodes classified on the entity of tag `tag', for all the elements
 * of type `elementType'. The other arguments are treated as in `getNodes'. */
GMSH_API void gmshModelMeshGetNodesByElementType(const int elementType,
                                                 size_t ** nodeTags, size_t * nodeTags_n,
                                                 double ** coord, size_t * coord_n,
                                                 double ** parametricCoord, size_t * parametricCoord_n,
                                                 const int tag,
                                                 const int returnParametricCoord,
                                                 int * ierr);

/* Get the coordinates and the parametric coordinates (if any) of the node
 * with tag `tag'. This function relies on an internal cache (a vector in case
 * of dense node numbering, a map otherwise); for large meshes accessing nodes
 * in bulk is often preferable. */
GMSH_API void gmshModelMeshGetNode(const size_t nodeTag,
                                   double ** coord, size_t * coord_n,
                                   double ** parametricCoord, size_t * parametricCoord_n,
                                   int * ierr);

/* Set the coordinates and the parametric coordinates (if any) of the node
 * with tag `tag'. This function relies on an internal cache (a vector in case
 * of dense node numbering, a map otherwise); for large meshes accessing nodes
 * in bulk is often preferable. */
GMSH_API void gmshModelMeshSetNode(const size_t nodeTag,
                                   double * coord, size_t coord_n,
                                   double * parametricCoord, size_t parametricCoord_n,
                                   int * ierr);

/* Rebuild the node cache. */
GMSH_API void gmshModelMeshRebuildNodeCache(const int onlyIfNecessary,
                                            int * ierr);

/* Rebuild the element cache. */
GMSH_API void gmshModelMeshRebuildElementCache(const int onlyIfNecessary,
                                               int * ierr);

/* Get the nodes from all the elements belonging to the physical group of
 * dimension `dim' and tag `tag'. `nodeTags' contains the node tags; `coord'
 * is a vector of length 3 times the length of `nodeTags' that contains the x,
 * y, z coordinates of the nodes, concatenated: [n1x, n1y, n1z, n2x, ...]. */
GMSH_API void gmshModelMeshGetNodesForPhysicalGroup(const int dim,
                                                    const int tag,
                                                    size_t ** nodeTags, size_t * nodeTags_n,
                                                    double ** coord, size_t * coord_n,
                                                    int * ierr);

/* Add nodes classified on the model entity of dimension `dim' and tag `tag'.
 * `nodeTags' contains the node tags (their unique, strictly positive
 * identification numbers). `coord' is a vector of length 3 times the length
 * of `nodeTags' that contains the x, y, z coordinates of the nodes,
 * concatenated: [n1x, n1y, n1z, n2x, ...]. The optional `parametricCoord'
 * vector contains the parametric coordinates of the nodes, if any. The length
 * of `parametricCoord' can be 0 or `dim' times the length of `nodeTags'. If
 * the `nodeTags' vector is empty, new tags are automatically assigned to the
 * nodes. */
GMSH_API void gmshModelMeshAddNodes(const int dim,
                                    const int tag,
                                    size_t * nodeTags, size_t nodeTags_n,
                                    double * coord, size_t coord_n,
                                    double * parametricCoord, size_t parametricCoord_n,
                                    int * ierr);

/* Reclassify all nodes on their associated model entity, based on the
 * elements. Can be used when importing nodes in bulk (e.g. by associating
 * them all to a single volume), to reclassify them correctly on model
 * surfaces, curves, etc. after the elements have been set. */
GMSH_API void gmshModelMeshReclassifyNodes(int * ierr);

/* Relocate the nodes classified on the entity of dimension `dim' and tag
 * `tag' using their parametric coordinates. If `tag' < 0, relocate the nodes
 * for all entities of dimension `dim'. If `dim' and `tag' are negative,
 * relocate all the nodes in the mesh. */
GMSH_API void gmshModelMeshRelocateNodes(const int dim,
                                         const int tag,
                                         int * ierr);

/* Get the elements classified on the entity of dimension `dim' and tag `tag'.
 * If `tag' < 0, get the elements for all entities of dimension `dim'. If
 * `dim' and `tag' are negative, get all the elements in the mesh.
 * `elementTypes' contains the MSH types of the elements (e.g. `2' for 3-node
 * triangles: see `getElementProperties' to obtain the properties for a given
 * element type). `elementTags' is a vector of the same length as
 * `elementTypes'; each entry is a vector containing the tags (unique,
 * strictly positive identifiers) of the elements of the corresponding type.
 * `nodeTags' is also a vector of the same length as `elementTypes'; each
 * entry is a vector of length equal to the number of elements of the given
 * type times the number N of nodes for this type of element, that contains
 * the node tags of all the elements of the given type, concatenated: [e1n1,
 * e1n2, ..., e1nN, e2n1, ...]. */
GMSH_API void gmshModelMeshGetElements(int ** elementTypes, size_t * elementTypes_n,
                                       size_t *** elementTags, size_t ** elementTags_n, size_t *elementTags_nn,
                                       size_t *** nodeTags, size_t ** nodeTags_n, size_t *nodeTags_nn,
                                       const int dim,
                                       const int tag,
                                       int * ierr);

/* Get the type and node tags of the element with tag `tag'. This function
 * relies on an internal cache (a vector in case of dense element numbering, a
 * map otherwise); for large meshes accessing elements in bulk is often
 * preferable. */
GMSH_API void gmshModelMeshGetElement(const size_t elementTag,
                                      int * elementType,
                                      size_t ** nodeTags, size_t * nodeTags_n,
                                      int * ierr);

/* Search the mesh for an element located at coordinates (`x', `y', `z'). This
 * function performs a search in a spatial octree. If an element is found,
 * return its tag, type and node tags, as well as the local coordinates (`u',
 * `v', `w') within the reference element corresponding to search location. If
 * `dim' is >= 0, only search for elements of the given dimension. If `strict'
 * is not set, use a tolerance to find elements near the search location. */
GMSH_API void gmshModelMeshGetElementByCoordinates(const double x,
                                                   const double y,
                                                   const double z,
                                                   size_t * elementTag,
                                                   int * elementType,
                                                   size_t ** nodeTags, size_t * nodeTags_n,
                                                   double * u,
                                                   double * v,
                                                   double * w,
                                                   const int dim,
                                                   const int strict,
                                                   int * ierr);

/* Search the mesh for element(s) located at coordinates (`x', `y', `z'). This
 * function performs a search in a spatial octree. Return the tags of all
 * found elements in `elementTags'. Additional information about the elements
 * can be accessed through `getElement' and `getLocalCoordinatesInElement'. If
 * `dim' is >= 0, only search for elements of the given dimension. If `strict'
 * is not set, use a tolerance to find elements near the search location. */
GMSH_API void gmshModelMeshGetElementsByCoordinates(const double x,
                                                    const double y,
                                                    const double z,
                                                    size_t ** elementTags, size_t * elementTags_n,
                                                    const int dim,
                                                    const int strict,
                                                    int * ierr);

/* Return the local coordinates (`u', `v', `w') within the element
 * `elementTag' corresponding to the model coordinates (`x', `y', `z'). This
 * function relies on an internal cache (a vector in case of dense element
 * numbering, a map otherwise); for large meshes accessing elements in bulk is
 * often preferable. */
GMSH_API void gmshModelMeshGetLocalCoordinatesInElement(const size_t elementTag,
                                                        const double x,
                                                        const double y,
                                                        const double z,
                                                        double * u,
                                                        double * v,
                                                        double * w,
                                                        int * ierr);

/* Get the types of elements in the entity of dimension `dim' and tag `tag'.
 * If `tag' < 0, get the types for all entities of dimension `dim'. If `dim'
 * and `tag' are negative, get all the types in the mesh. */
GMSH_API void gmshModelMeshGetElementTypes(int ** elementTypes, size_t * elementTypes_n,
                                           const int dim,
                                           const int tag,
                                           int * ierr);

/* Return an element type given its family name `familyName' ("Point", "Line",
 * "Triangle", "Quadrangle", "Tetrahedron", "Pyramid", "Prism", "Hexahedron")
 * and polynomial order `order'. If `serendip' is true, return the
 * corresponding serendip element type (element without interior nodes). */
GMSH_API int gmshModelMeshGetElementType(const char * familyName,
                                         const int order,
                                         const int serendip,
                                         int * ierr);

/* Get the properties of an element of type `elementType': its name
 * (`elementName'), dimension (`dim'), order (`order'), number of nodes
 * (`numNodes'), local coordinates of the nodes in the reference element
 * (`localNodeCoord' vector, of length `dim' times `numNodes') and number of
 * primary (first order) nodes (`numPrimaryNodes'). */
GMSH_API void gmshModelMeshGetElementProperties(const int elementType,
                                                char ** elementName,
                                                int * dim,
                                                int * order,
                                                int * numNodes,
                                                double ** localNodeCoord, size_t * localNodeCoord_n,
                                                int * numPrimaryNodes,
                                                int * ierr);

/* Get the elements of type `elementType' classified on the entity of tag
 * `tag'. If `tag' < 0, get the elements for all entities. `elementTags' is a
 * vector containing the tags (unique, strictly positive identifiers) of the
 * elements of the corresponding type. `nodeTags' is a vector of length equal
 * to the number of elements of the given type times the number N of nodes for
 * this type of element, that contains the node tags of all the elements of
 * the given type, concatenated: [e1n1, e1n2, ..., e1nN, e2n1, ...]. If
 * `numTasks' > 1, only compute and return the part of the data indexed by
 * `task'. */
GMSH_API void gmshModelMeshGetElementsByType(const int elementType,
                                             size_t ** elementTags, size_t * elementTags_n,
                                             size_t ** nodeTags, size_t * nodeTags_n,
                                             const int tag,
                                             const size_t task,
                                             const size_t numTasks,
                                             int * ierr);

/* Preallocate data before calling `getElementsByType' with `numTasks' > 1.
 * For C and C++ only. */
GMSH_API void gmshModelMeshPreallocateElementsByType(const int elementType,
                                                     const int elementTag,
                                                     const int nodeTag,
                                                     size_t ** elementTags, size_t * elementTags_n,
                                                     size_t ** nodeTags, size_t * nodeTags_n,
                                                     const int tag,
                                                     int * ierr);

/* Add elements classified on the entity of dimension `dim' and tag `tag'.
 * `types' contains the MSH types of the elements (e.g. `2' for 3-node
 * triangles: see the Gmsh reference manual). `elementTags' is a vector of the
 * same length as `types'; each entry is a vector containing the tags (unique,
 * strictly positive identifiers) of the elements of the corresponding type.
 * `nodeTags' is also a vector of the same length as `types'; each entry is a
 * vector of length equal to the number of elements of the given type times
 * the number N of nodes per element, that contains the node tags of all the
 * elements of the given type, concatenated: [e1n1, e1n2, ..., e1nN, e2n1,
 * ...]. */
GMSH_API void gmshModelMeshAddElements(const int dim,
                                       const int tag,
                                       int * elementTypes, size_t elementTypes_n,
                                       const size_t ** elementTags, const size_t * elementTags_n, size_t elementTags_nn,
                                       const size_t ** nodeTags, const size_t * nodeTags_n, size_t nodeTags_nn,
                                       int * ierr);

/* Add elements of type `elementType' classified on the entity of tag `tag'.
 * `elementTags' contains the tags (unique, strictly positive identifiers) of
 * the elements of the corresponding type. `nodeTags' is a vector of length
 * equal to the number of elements times the number N of nodes per element,
 * that contains the node tags of all the elements, concatenated: [e1n1, e1n2,
 * ..., e1nN, e2n1, ...]. If the `elementTag' vector is empty, new tags are
 * automatically assigned to the elements. */
GMSH_API void gmshModelMeshAddElementsByType(const int tag,
                                             const int elementType,
                                             size_t * elementTags, size_t elementTags_n,
                                             size_t * nodeTags, size_t nodeTags_n,
                                             int * ierr);

/* Get the numerical quadrature information for the given element type
 * `elementType' and integration rule `integrationType' (e.g. "Gauss4" for a
 * Gauss quadrature suited for integrating 4th order polynomials).
 * `localCoord' contains the u, v, w coordinates of the G integration points
 * in the reference element: [g1u, g1v, g1w, ..., gGu, gGv, gGw]. `weights'
 * contains the associated weights: [g1q, ..., gGq]. */
GMSH_API void gmshModelMeshGetIntegrationPoints(const int elementType,
                                                const char * integrationType,
                                                double ** localCoord, size_t * localCoord_n,
                                                double ** weights, size_t * weights_n,
                                                int * ierr);

/* Get the Jacobians of all the elements of type `elementType' classified on
 * the entity of tag `tag', at the G evaluation points `localCoord' given as
 * concatenated triplets of coordinates in the reference element [g1u, g1v,
 * g1w, ..., gGu, gGv, gGw]. Data is returned by element, with elements in the
 * same order as in `getElements' and `getElementsByType'. `jacobians'
 * contains for each element the 9 entries of the 3x3 Jacobian matrix at each
 * evaluation point. The matrix is returned by column: [e1g1Jxu, e1g1Jyu,
 * e1g1Jzu, e1g1Jxv, ..., e1g1Jzw, e1g2Jxu, ..., e1gGJzw, e2g1Jxu, ...], with
 * Jxu=dx/du, Jyu=dy/du, etc. `determinants' contains for each element the
 * determinant of the Jacobian matrix at each evaluation point: [e1g1, e1g2,
 * ... e1gG, e2g1, ...]. `coord' contains for each element the x, y, z
 * coordinates of the evaluation points. If `tag' < 0, get the Jacobian data
 * for all entities. If `numTasks' > 1, only compute and return the part of
 * the data indexed by `task'. */
GMSH_API void gmshModelMeshGetJacobians(const int elementType,
                                        double * localCoord, size_t localCoord_n,
                                        double ** jacobians, size_t * jacobians_n,
                                        double ** determinants, size_t * determinants_n,
                                        double ** coord, size_t * coord_n,
                                        const int tag,
                                        const size_t task,
                                        const size_t numTasks,
                                        int * ierr);

/* Preallocate data before calling `getJacobians' with `numTasks' > 1. For C
 * and C++ only. */
GMSH_API void gmshModelMeshPreallocateJacobians(const int elementType,
                                                const int numEvaluationPoints,
                                                const int allocateJacobians,
                                                const int allocateDeterminants,
                                                const int allocateCoord,
                                                double ** jacobians, size_t * jacobians_n,
                                                double ** determinants, size_t * determinants_n,
                                                double ** coord, size_t * coord_n,
                                                const int tag,
                                                int * ierr);

/* Get the Jacobian for a single element `elementTag', at the G evaluation
 * points `localCoord' given as concatenated triplets of coordinates in the
 * reference element [g1u, g1v, g1w, ..., gGu, gGv, gGw]. `jacobians' contains
 * the 9 entries of the 3x3 Jacobian matrix at each evaluation point. The
 * matrix is returned by column: [e1g1Jxu, e1g1Jyu, e1g1Jzu, e1g1Jxv, ...,
 * e1g1Jzw, e1g2Jxu, ..., e1gGJzw, e2g1Jxu, ...], with Jxu=dx/du, Jyu=dy/du,
 * etc. `determinants' contains the determinant of the Jacobian matrix at each
 * evaluation point. `coord' contains the x, y, z coordinates of the
 * evaluation points. This function relies on an internal cache (a vector in
 * case of dense element numbering, a map otherwise); for large meshes
 * accessing Jacobians in bulk is often preferable. */
GMSH_API void gmshModelMeshGetJacobian(const size_t elementTag,
                                       double * localCoord, size_t localCoord_n,
                                       double ** jacobians, size_t * jacobians_n,
                                       double ** determinants, size_t * determinants_n,
                                       double ** coord, size_t * coord_n,
                                       int * ierr);

/* Get the basis functions of the element of type `elementType' at the
 * evaluation points `localCoord' (given as concatenated triplets of
 * coordinates in the reference element [g1u, g1v, g1w, ..., gGu, gGv, gGw]),
 * for the function space `functionSpaceType' (e.g. "Lagrange" or
 * "GradLagrange" for Lagrange basis functions or their gradient, in the u, v,
 * w coordinates of the reference element; or "H1Legendre3" or
 * "GradH1Legendre3" for 3rd order hierarchical H1 Legendre functions).
 * `numComponents' returns the number C of components of a basis function.
 * `basisFunctions' returns the value of the N basis functions at the
 * evaluation points, i.e. [g1f1, g1f2, ..., g1fN, g2f1, ...] when C == 1 or
 * [g1f1u, g1f1v, g1f1w, g1f2u, ..., g1fNw, g2f1u, ...] when C == 3. For basis
 * functions that depend on the orientation of the elements, all values for
 * the first orientation are returned first, followed by values for the
 * second, etc. `numOrientations' returns the overall number of orientations.
 * If `wantedOrientations' is not empty, only return the values for the
 * desired orientation indices. */
GMSH_API void gmshModelMeshGetBasisFunctions(const int elementType,
                                             double * localCoord, size_t localCoord_n,
                                             const char * functionSpaceType,
                                             int * numComponents,
                                             double ** basisFunctions, size_t * basisFunctions_n,
                                             int * numOrientations,
                                             int * wantedOrientations, size_t wantedOrientations_n,
                                             int * ierr);

/* Get the orientation index of the elements of type `elementType' in the
 * entity of tag `tag'. The arguments have the same meaning as in
 * `getBasisFunctions'. `basisFunctionsOrientation' is a vector giving for
 * each element the orientation index in the values returned by
 * `getBasisFunctions'. For Lagrange basis functions the call is superfluous
 * as it will return a vector of zeros. */
GMSH_API void gmshModelMeshGetBasisFunctionsOrientationForElements(const int elementType,
                                                                   const char * functionSpaceType,
                                                                   int ** basisFunctionsOrientation, size_t * basisFunctionsOrientation_n,
                                                                   const int tag,
                                                                   const size_t task,
                                                                   const size_t numTasks,
                                                                   int * ierr);

/* Get the orientation of a single element `elementTag'. */
GMSH_API void gmshModelMeshGetBasisFunctionsOrientationForElement(const size_t elementTag,
                                                                  const char * functionSpaceType,
                                                                  int * basisFunctionsOrientation,
                                                                  int * ierr);

/* Get the number of possible orientations for elements of type `elementType'
 * and function space named `functionSpaceType'. */
GMSH_API int gmshModelMeshGetNumberOfOrientations(const int elementType,
                                                  const char * functionSpaceType,
                                                  int * ierr);

/* Preallocate data before calling `getBasisFunctionsOrientationForElements'
 * with `numTasks' > 1. For C and C++ only. */
GMSH_API void gmshModelMeshPreallocateBasisFunctionsOrientationForElements(const int elementType,
                                                                           int ** basisFunctionsOrientation, size_t * basisFunctionsOrientation_n,
                                                                           const int tag,
                                                                           int * ierr);

/* Get the global edge identifier `edgeNum' for an input list of node pairs,
 * concatenated in the vector `edgeNodes'.  Warning: this is an experimental
 * feature and will probably change in a future release. */
GMSH_API void gmshModelMeshGetEdgeNumber(int * edgeNodes, size_t edgeNodes_n,
                                         int ** edgeNum, size_t * edgeNum_n,
                                         int * ierr);

/* Get the local multipliers (to guarantee H(curl)-conformity) of the order 0
 * H(curl) basis functions. Warning: this is an experimental feature and will
 * probably change in a future release. */
GMSH_API void gmshModelMeshGetLocalMultipliersForHcurl0(const int elementType,
                                                        int ** localMultipliers, size_t * localMultipliers_n,
                                                        const int tag,
                                                        int * ierr);

/* Generate the `keys' for the elements of type `elementType' in the entity of
 * tag `tag', for the `functionSpaceType' function space. Each key uniquely
 * identifies a basis function in the function space. If `returnCoord' is set,
 * the `coord' vector contains the x, y, z coordinates locating basis
 * functions for sorting purposes. Warning: this is an experimental feature
 * and will probably change in a future release. */
GMSH_API void gmshModelMeshGetKeysForElements(const int elementType,
                                              const char * functionSpaceType,
                                              int ** keys, size_t * keys_n,
                                              double ** coord, size_t * coord_n,
                                              const int tag,
                                              const int returnCoord,
                                              int * ierr);

/* Get the keys for a single element `elementTag'. */
GMSH_API void gmshModelMeshGetKeysForElement(const size_t elementTag,
                                             const char * functionSpaceType,
                                             int ** keys, size_t * keys_n,
                                             double ** coord, size_t * coord_n,
                                             const int returnCoord,
                                             int * ierr);

/* Get the number of keys by elements of type `elementType' for function space
 * named `functionSpaceType'. */
GMSH_API int gmshModelMeshGetNumberOfKeysForElements(const int elementType,
                                                     const char * functionSpaceType,
                                                     int * ierr);

/* Get information about the `keys'. `infoKeys' returns information about the
 * functions associated with the `keys'. `infoKeys[0].first' describes the
 * type of function (0 for  vertex function, 1 for edge function, 2 for face
 * function and 3 for bubble function). `infoKeys[0].second' gives the order
 * of the function associated with the key. Warning: this is an experimental
 * feature and will probably change in a future release. */
GMSH_API void gmshModelMeshGetInformationForElements(int * keys, size_t keys_n,
                                                     const int elementType,
                                                     const char * functionSpaceType,
                                                     int ** infoKeys, size_t * infoKeys_n,
                                                     int * ierr);

/* Get the barycenters of all elements of type `elementType' classified on the
 * entity of tag `tag'. If `primary' is set, only the primary nodes of the
 * elements are taken into account for the barycenter calculation. If `fast'
 * is set, the function returns the sum of the primary node coordinates
 * (without normalizing by the number of nodes). If `tag' < 0, get the
 * barycenters for all entities. If `numTasks' > 1, only compute and return
 * the part of the data indexed by `task'. */
GMSH_API void gmshModelMeshGetBarycenters(const int elementType,
                                          const int tag,
                                          const int fast,
                                          const int primary,
                                          double ** barycenters, size_t * barycenters_n,
                                          const size_t task,
                                          const size_t numTasks,
                                          int * ierr);

/* Preallocate data before calling `getBarycenters' with `numTasks' > 1. For C
 * and C++ only. */
GMSH_API void gmshModelMeshPreallocateBarycenters(const int elementType,
                                                  double ** barycenters, size_t * barycenters_n,
                                                  const int tag,
                                                  int * ierr);

/* Get the nodes on the edges of all elements of type `elementType' classified
 * on the entity of tag `tag'. `nodeTags' contains the node tags of the edges
 * for all the elements: [e1a1n1, e1a1n2, e1a2n1, ...]. Data is returned by
 * element, with elements in the same order as in `getElements' and
 * `getElementsByType'. If `primary' is set, only the primary (begin/end)
 * nodes of the edges are returned. If `tag' < 0, get the edge nodes for all
 * entities. If `numTasks' > 1, only compute and return the part of the data
 * indexed by `task'. */
GMSH_API void gmshModelMeshGetElementEdgeNodes(const int elementType,
                                               size_t ** nodeTags, size_t * nodeTags_n,
                                               const int tag,
                                               const int primary,
                                               const size_t task,
                                               const size_t numTasks,
                                               int * ierr);

/* Get the nodes on the faces of type `faceType' (3 for triangular faces, 4
 * for quadrangular faces) of all elements of type `elementType' classified on
 * the entity of tag `tag'. `nodeTags' contains the node tags of the faces for
 * all elements: [e1f1n1, ..., e1f1nFaceType, e1f2n1, ...]. Data is returned
 * by element, with elements in the same order as in `getElements' and
 * `getElementsByType'. If `primary' is set, only the primary (corner) nodes
 * of the faces are returned. If `tag' < 0, get the face nodes for all
 * entities. If `numTasks' > 1, only compute and return the part of the data
 * indexed by `task'. */
GMSH_API void gmshModelMeshGetElementFaceNodes(const int elementType,
                                               const int faceType,
                                               size_t ** nodeTags, size_t * nodeTags_n,
                                               const int tag,
                                               const int primary,
                                               const size_t task,
                                               const size_t numTasks,
                                               int * ierr);

/* Get the ghost elements `elementTags' and their associated `partitions'
 * stored in the ghost entity of dimension `dim' and tag `tag'. */
GMSH_API void gmshModelMeshGetGhostElements(const int dim,
                                            const int tag,
                                            size_t ** elementTags, size_t * elementTags_n,
                                            int ** partitions, size_t * partitions_n,
                                            int * ierr);

/* Set a mesh size constraint on the model entities `dimTags'. Currently only
 * entities of dimension 0 (points) are handled. */
GMSH_API void gmshModelMeshSetSize(int * dimTags, size_t dimTags_n,
                                   const double size,
                                   int * ierr);

/* Set mesh size constraints at the given parametric points `parametricCoord'
 * on the model entity of dimension `dim' and tag `tag'. Currently only
 * entities of dimension 1 (lines) are handled. */
GMSH_API void gmshModelMeshSetSizeAtParametricPoints(const int dim,
                                                     const int tag,
                                                     double * parametricCoord, size_t parametricCoord_n,
                                                     double * sizes, size_t sizes_n,
                                                     int * ierr);

/* Set a global mesh size callback. The callback should take 5 arguments
 * (`dim', `tag', `x', `y' and `z') and return the value of the mesh size at
 * coordinates (`x', `y', `z'). */
GMSH_API void gmshModelMeshSetSizeCallback(double (*callback)(int dim, int tag, double x, double y, double z, void * data), void * callback_data,
                                           int * ierr);

/* Remove the global mesh size callback. */
GMSH_API void gmshModelMeshRemoveSizeCallback(int * ierr);

/* Set a transfinite meshing constraint on the curve `tag', with `numNodes'
 * nodes distributed according to `meshType' and `coef'. Currently supported
 * types are "Progression" (geometrical progression with power `coef') and
 * "Bump" (refinement toward both extremities of the curve). */
GMSH_API void gmshModelMeshSetTransfiniteCurve(const int tag,
                                               const int numNodes,
                                               const char * meshType,
                                               const double coef,
                                               int * ierr);

/* Set a transfinite meshing constraint on the surface `tag'. `arrangement'
 * describes the arrangement of the triangles when the surface is not flagged
 * as recombined: currently supported values are "Left", "Right",
 * "AlternateLeft" and "AlternateRight". `cornerTags' can be used to specify
 * the (3 or 4) corners of the transfinite interpolation explicitly;
 * specifying the corners explicitly is mandatory if the surface has more that
 * 3 or 4 points on its boundary. */
GMSH_API void gmshModelMeshSetTransfiniteSurface(const int tag,
                                                 const char * arrangement,
                                                 int * cornerTags, size_t cornerTags_n,
                                                 int * ierr);

/* Set a transfinite meshing constraint on the surface `tag'. `cornerTags' can
 * be used to specify the (6 or 8) corners of the transfinite interpolation
 * explicitly. */
GMSH_API void gmshModelMeshSetTransfiniteVolume(const int tag,
                                                int * cornerTags, size_t cornerTags_n,
                                                int * ierr);

/* Set transfinite meshing constraints on the model entities in `dimTag'.
 * Transfinite meshing constraints are added to the curves of the quadrangular
 * surfaces and to the faces of 6-sided volumes. Quadragular faces with a
 * corner angle superior to `cornerAngle' (in radians) are ignored. The number
 * of points is automatically determined from the sizing constraints. If
 * `dimTag' is empty, the constraints are applied to all entities in the
 * model. If `recombine' is true, the recombine flag is automatically set on
 * the transfinite surfaces. */
GMSH_API void gmshModelMeshSetTransfiniteAutomatic(int * dimTags, size_t dimTags_n,
                                                   const double cornerAngle,
                                                   const int recombine,
                                                   int * ierr);

/* Set a recombination meshing constraint on the model entity of dimension
 * `dim' and tag `tag'. Currently only entities of dimension 2 (to recombine
 * triangles into quadrangles) are supported. */
GMSH_API void gmshModelMeshSetRecombine(const int dim,
                                        const int tag,
                                        int * ierr);

/* Set a smoothing meshing constraint on the model entity of dimension `dim'
 * and tag `tag'. `val' iterations of a Laplace smoother are applied. */
GMSH_API void gmshModelMeshSetSmoothing(const int dim,
                                        const int tag,
                                        const int val,
                                        int * ierr);

/* Set a reverse meshing constraint on the model entity of dimension `dim' and
 * tag `tag'. If `val' is true, the mesh orientation will be reversed with
 * respect to the natural mesh orientation (i.e. the orientation consistent
 * with the orientation of the geometry). If `val' is false, the mesh is left
 * as-is. */
GMSH_API void gmshModelMeshSetReverse(const int dim,
                                      const int tag,
                                      const int val,
                                      int * ierr);

/* Set the meshing algorithm on the model entity of dimension `dim' and tag
 * `tag'. Currently only supported for `dim' == 2. */
GMSH_API void gmshModelMeshSetAlgorithm(const int dim,
                                        const int tag,
                                        const int val,
                                        int * ierr);

/* Force the mesh size to be extended from the boundary, or not, for the model
 * entity of dimension `dim' and tag `tag'. Currently only supported for `dim'
 * == 2. */
GMSH_API void gmshModelMeshSetSizeFromBoundary(const int dim,
                                               const int tag,
                                               const int val,
                                               int * ierr);

/* Set a compound meshing constraint on the model entities of dimension `dim'
 * and tags `tags'. During meshing, compound entities are treated as a single
 * discrete entity, which is automatically reparametrized. */
GMSH_API void gmshModelMeshSetCompound(const int dim,
                                       int * tags, size_t tags_n,
                                       int * ierr);

/* Set meshing constraints on the bounding surfaces of the volume of tag `tag'
 * so that all surfaces are oriented with outward pointing normals. Currently
 * only available with the OpenCASCADE kernel, as it relies on the STL
 * triangulation. */
GMSH_API void gmshModelMeshSetOutwardOrientation(const int tag,
                                                 int * ierr);

/* Embed the model entities of dimension `dim' and tags `tags' in the
 * (`inDim', `inTag') model entity. The dimension `dim' can 0, 1 or 2 and must
 * be strictly smaller than `inDim', which must be either 2 or 3. The embedded
 * entities should not be part of the boundary of the entity `inTag', whose
 * mesh will conform to the mesh of the embedded entities. */
GMSH_API void gmshModelMeshEmbed(const int dim,
                                 int * tags, size_t tags_n,
                                 const int inDim,
                                 const int inTag,
                                 int * ierr);

/* Remove embedded entities from the model entities `dimTags'. if `dim' is >=
 * 0, only remove embedded entities of the given dimension (e.g. embedded
 * points if `dim' == 0). */
GMSH_API void gmshModelMeshRemoveEmbedded(int * dimTags, size_t dimTags_n,
                                          const int dim,
                                          int * ierr);

/* Reorder the elements of type `elementType' classified on the entity of tag
 * `tag' according to `ordering'. */
GMSH_API void gmshModelMeshReorderElements(const int elementType,
                                           const int tag,
                                           size_t * ordering, size_t ordering_n,
                                           int * ierr);

/* Renumber the node tags in a continuous sequence. */
GMSH_API void gmshModelMeshRenumberNodes(int * ierr);

/* Renumber the element tags in a continuous sequence. */
GMSH_API void gmshModelMeshRenumberElements(int * ierr);

/* Set the meshes of the entities of dimension `dim' and tag `tags' as
 * periodic copies of the meshes of entities `tagsMaster', using the affine
 * transformation specified in `affineTransformation' (16 entries of a 4x4
 * matrix, by row). If used after meshing, generate the periodic node
 * correspondence information assuming the meshes of entities `tags'
 * effectively match the meshes of entities `tagsMaster' (useful for
 * structured and extruded meshes). Currently only available for @code{dim} ==
 * 1 and @code{dim} == 2. */
GMSH_API void gmshModelMeshSetPeriodic(const int dim,
                                       int * tags, size_t tags_n,
                                       int * tagsMaster, size_t tagsMaster_n,
                                       double * affineTransform, size_t affineTransform_n,
                                       int * ierr);

/* Get the master entity `tagMaster', the node tags `nodeTags' and their
 * corresponding master node tags `nodeTagsMaster', and the affine transform
 * `affineTransform' for the entity of dimension `dim' and tag `tag'. If
 * `includeHighOrderNodes' is set, include high-order nodes in the returned
 * data. */
GMSH_API void gmshModelMeshGetPeriodicNodes(const int dim,
                                            const int tag,
                                            int * tagMaster,
                                            size_t ** nodeTags, size_t * nodeTags_n,
                                            size_t ** nodeTagsMaster, size_t * nodeTagsMaster_n,
                                            double ** affineTransform, size_t * affineTransform_n,
                                            const int includeHighOrderNodes,
                                            int * ierr);

/* Remove duplicate nodes in the mesh of the current model. */
GMSH_API void gmshModelMeshRemoveDuplicateNodes(int * ierr);

/* Split (into two triangles) all quadrangles in surface `tag' whose quality
 * is lower than `quality'. If `tag' < 0, split quadrangles in all surfaces. */
GMSH_API void gmshModelMeshSplitQuadrangles(const double quality,
                                            const int tag,
                                            int * ierr);

/* Classify ("color") the surface mesh based on the angle threshold `angle'
 * (in radians), and create new discrete surfaces, curves and points
 * accordingly. If `boundary' is set, also create discrete curves on the
 * boundary if the surface is open. If `forReparametrization' is set, create
 * edges and surfaces that can be reparametrized using a single map. If
 * `curveAngle' is less than Pi, also force curves to be split according to
 * `curveAngle'. */
GMSH_API void gmshModelMeshClassifySurfaces(const double angle,
                                            const int boundary,
                                            const int forReparametrization,
                                            const double curveAngle,
                                            int * ierr);

/* Create a geometry for the discrete entities `dimTags' (represented solely
 * by a mesh, without an underlying CAD description), i.e. create a
 * parametrization for discrete curves and surfaces, assuming that each can be
 * parametrized with a single map. If `dimTags' is empty, create a geometry
 * for all the discrete entities. */
GMSH_API void gmshModelMeshCreateGeometry(int * dimTags, size_t dimTags_n,
                                          int * ierr);

/* Create a boundary representation from the mesh if the model does not have
 * one (e.g. when imported from mesh file formats with no BRep representation
 * of the underlying model). If `makeSimplyConnected' is set, enforce simply
 * connected discrete surfaces and volumes. If `exportDiscrete' is set, clear
 * any built-in CAD kernel entities and export the discrete entities in the
 * built-in CAD kernel. */
GMSH_API void gmshModelMeshCreateTopology(const int makeSimplyConnected,
                                          const int exportDiscrete,
                                          int * ierr);

/* Compute a basis representation for homology spaces after a mesh has been
 * generated. The computation domain is given in a list of physical group tags
 * `domainTags'; if empty, the whole mesh is the domain. The computation
 * subdomain for relative homology computation is given in a list of physical
 * group tags `subdomainTags'; if empty, absolute homology is computed. The
 * dimensions homology bases to be computed are given in the list `dim'; if
 * empty, all bases are computed. Resulting basis representation chains are
 * stored as physical groups in the mesh. */
GMSH_API void gmshModelMeshComputeHomology(int * domainTags, size_t domainTags_n,
                                           int * subdomainTags, size_t subdomainTags_n,
                                           int * dims, size_t dims_n,
                                           int * ierr);

/* Compute a basis representation for cohomology spaces after a mesh has been
 * generated. The computation domain is given in a list of physical group tags
 * `domainTags'; if empty, the whole mesh is the domain. The computation
 * subdomain for relative cohomology computation is given in a list of
 * physical group tags `subdomainTags'; if empty, absolute cohomology is
 * computed. The dimensions homology bases to be computed are given in the
 * list `dim'; if empty, all bases are computed. Resulting basis
 * representation cochains are stored as physical groups in the mesh. */
GMSH_API void gmshModelMeshComputeCohomology(int * domainTags, size_t domainTags_n,
                                             int * subdomainTags, size_t subdomainTags_n,
                                             int * dims, size_t dims_n,
                                             int * ierr);

/* Compute a cross field for the current mesh. The function creates 3 views:
 * the H function, the Theta function and cross directions. Return the tags of
 * the views */
GMSH_API void gmshModelMeshComputeCrossField(int ** viewTags, size_t * viewTags_n,
                                             int * ierr);

/* Add a new mesh size field of type `fieldType'. If `tag' is positive, assign
 * the tag explicitly; otherwise a new tag is assigned automatically. Return
 * the field tag. */
GMSH_API int gmshModelMeshFieldAdd(const char * fieldType,
                                   const int tag,
                                   int * ierr);

/* Remove the field with tag `tag'. */
GMSH_API void gmshModelMeshFieldRemove(const int tag,
                                       int * ierr);

/* Set the numerical option `option' to value `value' for field `tag'. */
GMSH_API void gmshModelMeshFieldSetNumber(const int tag,
                                          const char * option,
                                          const double value,
                                          int * ierr);

/* Set the string option `option' to value `value' for field `tag'. */
GMSH_API void gmshModelMeshFieldSetString(const int tag,
                                          const char * option,
                                          const char * value,
                                          int * ierr);

/* Set the numerical list option `option' to value `value' for field `tag'. */
GMSH_API void gmshModelMeshFieldSetNumbers(const int tag,
                                           const char * option,
                                           double * value, size_t value_n,
                                           int * ierr);

/* Set the field `tag' as the background mesh size field. */
GMSH_API void gmshModelMeshFieldSetAsBackgroundMesh(const int tag,
                                                    int * ierr);

/* Set the field `tag' as a boundary layer size field. */
GMSH_API void gmshModelMeshFieldSetAsBoundaryLayer(const int tag,
                                                   int * ierr);

/* Add a geometrical point in the built-in CAD representation, at coordinates
 * (`x', `y', `z'). If `meshSize' is > 0, add a meshing constraint at that
 * point. If `tag' is positive, set the tag explicitly; otherwise a new tag is
 * selected automatically. Return the tag of the point. (Note that the point
 * will be added in the current model only after `synchronize' is called. This
 * behavior holds for all the entities added in the geo module.) */
GMSH_API int gmshModelGeoAddPoint(const double x,
                                  const double y,
                                  const double z,
                                  const double meshSize,
                                  const int tag,
                                  int * ierr);

/* Add a straight line segment in the built-in CAD representation, between the
 * two points with tags `startTag' and `endTag'. If `tag' is positive, set the
 * tag explicitly; otherwise a new tag is selected automatically. Return the
 * tag of the line. */
GMSH_API int gmshModelGeoAddLine(const int startTag,
                                 const int endTag,
                                 const int tag,
                                 int * ierr);

/* Add a circle arc (strictly smaller than Pi) in the built-in CAD
 * representation, between the two points with tags `startTag' and `endTag',
 * and with center `centerTag'. If `tag' is positive, set the tag explicitly;
 * otherwise a new tag is selected automatically. If (`nx', `ny', `nz') != (0,
 * 0, 0), explicitly set the plane of the circle arc. Return the tag of the
 * circle arc. */
GMSH_API int gmshModelGeoAddCircleArc(const int startTag,
                                      const int centerTag,
                                      const int endTag,
                                      const int tag,
                                      const double nx,
                                      const double ny,
                                      const double nz,
                                      int * ierr);

/* Add an ellipse arc (strictly smaller than Pi) in the built-in CAD
 * representation, between the two points `startTag' and `endTag', and with
 * center `centerTag' and major axis point `majorTag'. If `tag' is positive,
 * set the tag explicitly; otherwise a new tag is selected automatically. If
 * (`nx', `ny', `nz') != (0, 0, 0), explicitly set the plane of the circle
 * arc. Return the tag of the ellipse arc. */
GMSH_API int gmshModelGeoAddEllipseArc(const int startTag,
                                       const int centerTag,
                                       const int majorTag,
                                       const int endTag,
                                       const int tag,
                                       const double nx,
                                       const double ny,
                                       const double nz,
                                       int * ierr);

/* Add a spline (Catmull-Rom) curve in the built-in CAD representation, going
 * through the points `pointTags'. If `tag' is positive, set the tag
 * explicitly; otherwise a new tag is selected automatically. Create a
 * periodic curve if the first and last points are the same. Return the tag of
 * the spline curve. */
GMSH_API int gmshModelGeoAddSpline(int * pointTags, size_t pointTags_n,
                                   const int tag,
                                   int * ierr);

/* Add a cubic b-spline curve in the built-in CAD representation, with
 * `pointTags' control points. If `tag' is positive, set the tag explicitly;
 * otherwise a new tag is selected automatically. Creates a periodic curve if
 * the first and last points are the same. Return the tag of the b-spline
 * curve. */
GMSH_API int gmshModelGeoAddBSpline(int * pointTags, size_t pointTags_n,
                                    const int tag,
                                    int * ierr);

/* Add a Bezier curve in the built-in CAD representation, with `pointTags'
 * control points. If `tag' is positive, set the tag explicitly; otherwise a
 * new tag is selected automatically.  Return the tag of the Bezier curve. */
GMSH_API int gmshModelGeoAddBezier(int * pointTags, size_t pointTags_n,
                                   const int tag,
                                   int * ierr);

/* Add a polyline curve in the built-in CAD representation, going through the
 * points `pointTags'. If `tag' is positive, set the tag explicitly; otherwise
 * a new tag is selected automatically. Create a periodic curve if the first
 * and last points are the same. Return the tag of the polyline curve. */
GMSH_API int gmshModelGeoAddPolyline(int * pointTags, size_t pointTags_n,
                                     const int tag,
                                     int * ierr);

/* Add a spline (Catmull-Rom) curve in the built-in CAD representation, going
 * through points sampling the curves in `curveTags'. The density of sampling
 * points on each curve is governed by `numIntervals'. If `tag' is positive,
 * set the tag explicitly; otherwise a new tag is selected automatically.
 * Return the tag of the spline. */
GMSH_API int gmshModelGeoAddCompoundSpline(int * curveTags, size_t curveTags_n,
                                           const int numIntervals,
                                           const int tag,
                                           int * ierr);

/* Add a b-spline curve in the built-in CAD representation, with control
 * points sampling the curves in `curveTags'. The density of sampling points
 * on each curve is governed by `numIntervals'. If `tag' is positive, set the
 * tag explicitly; otherwise a new tag is selected automatically. Return the
 * tag of the b-spline. */
GMSH_API int gmshModelGeoAddCompoundBSpline(int * curveTags, size_t curveTags_n,
                                            const int numIntervals,
                                            const int tag,
                                            int * ierr);

/* Add a curve loop (a closed wire) in the built-in CAD representation, formed
 * by the curves `curveTags'. `curveTags' should contain (signed) tags of
 * model entities of dimension 1 forming a closed loop: a negative tag
 * signifies that the underlying curve is considered with reversed
 * orientation. If `tag' is positive, set the tag explicitly; otherwise a new
 * tag is selected automatically. If `reorient' is set, automatically reorient
 * the curves if necessary. Return the tag of the curve loop. */
GMSH_API int gmshModelGeoAddCurveLoop(int * curveTags, size_t curveTags_n,
                                      const int tag,
                                      const int reorient,
                                      int * ierr);

/* Add a plane surface in the built-in CAD representation, defined by one or
 * more curve loops `wireTags'. The first curve loop defines the exterior
 * contour; additional curve loop define holes. If `tag' is positive, set the
 * tag explicitly; otherwise a new tag is selected automatically. Return the
 * tag of the surface. */
GMSH_API int gmshModelGeoAddPlaneSurface(int * wireTags, size_t wireTags_n,
                                         const int tag,
                                         int * ierr);

/* Add a surface in the built-in CAD representation, filling the curve loops
 * in `wireTags' using transfinite interpolation. Currently only a single
 * curve loop is supported; this curve loop should be composed by 3 or 4
 * curves only. If `tag' is positive, set the tag explicitly; otherwise a new
 * tag is selected automatically. Return the tag of the surface. */
GMSH_API int gmshModelGeoAddSurfaceFilling(int * wireTags, size_t wireTags_n,
                                           const int tag,
                                           const int sphereCenterTag,
                                           int * ierr);

/* Add a surface loop (a closed shell) formed by `surfaceTags' in the built-in
 * CAD representation.  If `tag' is positive, set the tag explicitly;
 * otherwise a new tag is selected automatically. Return the tag of the shell. */
GMSH_API int gmshModelGeoAddSurfaceLoop(int * surfaceTags, size_t surfaceTags_n,
                                        const int tag,
                                        int * ierr);

/* Add a volume (a region) in the built-in CAD representation, defined by one
 * or more shells `shellTags'. The first surface loop defines the exterior
 * boundary; additional surface loop define holes. If `tag' is positive, set
 * the tag explicitly; otherwise a new tag is selected automatically. Return
 * the tag of the volume. */
GMSH_API int gmshModelGeoAddVolume(int * shellTags, size_t shellTags_n,
                                   const int tag,
                                   int * ierr);

/* Extrude the entities `dimTags' in the built-in CAD representation, using a
 * translation along (`dx', `dy', `dz'). Return extruded entities in
 * `outDimTags'. If `numElements' is not empty, also extrude the mesh: the
 * entries in `numElements' give the number of elements in each layer. If
 * `height' is not empty, it provides the (cumulative) height of the different
 * layers, normalized to 1. If `dx' == `dy' == `dz' == 0, the entities are
 * extruded along their normal. */
GMSH_API void gmshModelGeoExtrude(int * dimTags, size_t dimTags_n,
                                  const double dx,
                                  const double dy,
                                  const double dz,
                                  int ** outDimTags, size_t * outDimTags_n,
                                  int * numElements, size_t numElements_n,
                                  double * heights, size_t heights_n,
                                  const int recombine,
                                  int * ierr);

/* Extrude the entities `dimTags' in the built-in CAD representation, using a
 * rotation of `angle' radians around the axis of revolution defined by the
 * point (`x', `y', `z') and the direction (`ax', `ay', `az'). The angle
 * should be strictly smaller than Pi. Return extruded entities in
 * `outDimTags'. If `numElements' is not empty, also extrude the mesh: the
 * entries in `numElements' give the number of elements in each layer. If
 * `height' is not empty, it provides the (cumulative) height of the different
 * layers, normalized to 1. */
GMSH_API void gmshModelGeoRevolve(int * dimTags, size_t dimTags_n,
                                  const double x,
                                  const double y,
                                  const double z,
                                  const double ax,
                                  const double ay,
                                  const double az,
                                  const double angle,
                                  int ** outDimTags, size_t * outDimTags_n,
                                  int * numElements, size_t numElements_n,
                                  double * heights, size_t heights_n,
                                  const int recombine,
                                  int * ierr);

/* Extrude the entities `dimTags' in the built-in CAD representation, using a
 * combined translation and rotation of `angle' radians, along (`dx', `dy',
 * `dz') and around the axis of revolution defined by the point (`x', `y',
 * `z') and the direction (`ax', `ay', `az'). The angle should be strictly
 * smaller than Pi. Return extruded entities in `outDimTags'. If `numElements'
 * is not empty, also extrude the mesh: the entries in `numElements' give the
 * number of elements in each layer. If `height' is not empty, it provides the
 * (cumulative) height of the different layers, normalized to 1. */
GMSH_API void gmshModelGeoTwist(int * dimTags, size_t dimTags_n,
                                const double x,
                                const double y,
                                const double z,
                                const double dx,
                                const double dy,
                                const double dz,
                                const double ax,
                                const double ay,
                                const double az,
                                const double angle,
                                int ** outDimTags, size_t * outDimTags_n,
                                int * numElements, size_t numElements_n,
                                double * heights, size_t heights_n,
                                const int recombine,
                                int * ierr);

/* Translate the entities `dimTags' in the built-in CAD representation along
 * (`dx', `dy', `dz'). */
GMSH_API void gmshModelGeoTranslate(int * dimTags, size_t dimTags_n,
                                    const double dx,
                                    const double dy,
                                    const double dz,
                                    int * ierr);

/* Rotate the entities `dimTags' in the built-in CAD representation by `angle'
 * radians around the axis of revolution defined by the point (`x', `y', `z')
 * and the direction (`ax', `ay', `az'). */
GMSH_API void gmshModelGeoRotate(int * dimTags, size_t dimTags_n,
                                 const double x,
                                 const double y,
                                 const double z,
                                 const double ax,
                                 const double ay,
                                 const double az,
                                 const double angle,
                                 int * ierr);

/* Scale the entities `dimTag' in the built-in CAD representation by factors
 * `a', `b' and `c' along the three coordinate axes; use (`x', `y', `z') as
 * the center of the homothetic transformation. */
GMSH_API void gmshModelGeoDilate(int * dimTags, size_t dimTags_n,
                                 const double x,
                                 const double y,
                                 const double z,
                                 const double a,
                                 const double b,
                                 const double c,
                                 int * ierr);

/* Mirror the entities `dimTag' in the built-in CAD representation, with
 * respect to the plane of equation `a' * x + `b' * y + `c' * z + `d' = 0. */
GMSH_API void gmshModelGeoMirror(int * dimTags, size_t dimTags_n,
                                 const double a,
                                 const double b,
                                 const double c,
                                 const double d,
                                 int * ierr);

/* Mirror the entities `dimTag' in the built-in CAD representation, with
 * respect to the plane of equation `a' * x + `b' * y + `c' * z + `d' = 0.
 * (This is a synonym for `mirror', which will be deprecated in a future
 * release.) */
GMSH_API void gmshModelGeoSymmetrize(int * dimTags, size_t dimTags_n,
                                     const double a,
                                     const double b,
                                     const double c,
                                     const double d,
                                     int * ierr);

/* Copy the entities `dimTags' in the built-in CAD representation; the new
 * entities are returned in `outDimTags'. */
GMSH_API void gmshModelGeoCopy(int * dimTags, size_t dimTags_n,
                               int ** outDimTags, size_t * outDimTags_n,
                               int * ierr);

/* Remove the entities `dimTags' in the built-in CAD representation. If
 * `recursive' is true, remove all the entities on their boundaries, down to
 * dimension 0. */
GMSH_API void gmshModelGeoRemove(int * dimTags, size_t dimTags_n,
                                 const int recursive,
                                 int * ierr);

/* Remove all duplicate entities in the built-in CAD representation (different
 * entities at the same geometrical location). */
GMSH_API void gmshModelGeoRemoveAllDuplicates(int * ierr);

/* Split the curve of tag `tag' in the built-in CAD representation, on the
 * control points `pointTags'. Return the tags `curveTags' of the newly
 * created curves. */
GMSH_API void gmshModelGeoSplitCurve(const int tag,
                                     int * pointTags, size_t pointTags_n,
                                     int ** curveTags, size_t * curveTags_n,
                                     int * ierr);

/* Get the maximum tag of entities of dimension `dim' in the built-in CAD
 * representation. */
GMSH_API int gmshModelGeoGetMaxTag(const int dim,
                                   int * ierr);

/* Set the maximum tag `maxTag' for entities of dimension `dim' in the built-
 * in CAD representation. */
GMSH_API void gmshModelGeoSetMaxTag(const int dim,
                                    const int maxTag,
                                    int * ierr);

/* Add a physical group of dimension `dim', grouping the entities with tags
 * `tags' in the built-in CAD representation. Return the tag of the physical
 * group, equal to `tag' if `tag' is positive, or a new tag if `tag' < 0. */
GMSH_API int gmshModelGeoAddPhysicalGroup(const int dim,
                                          int * tags, size_t tags_n,
                                          const int tag,
                                          int * ierr);

/* Remove the physical groups `dimTags' from the built-in CAD representation.
 * If `dimTags' is empty, remove all groups. */
GMSH_API void gmshModelGeoRemovePhysicalGroups(int * dimTags, size_t dimTags_n,
                                               int * ierr);

/* Synchronize the built-in CAD representation with the current Gmsh model.
 * This can be called at any time, but since it involves a non trivial amount
 * of processing, the number of synchronization points should normally be
 * minimized. Without synchronization the entities in the built-in CAD
 * representation are not available to any function outside of the built-in
 * CAD kernel functions. */
GMSH_API void gmshModelGeoSynchronize(int * ierr);

/* Set a mesh size constraint on the entities `dimTags' in the built-in CAD
 * kernel representation. Currently only entities of dimension 0 (points) are
 * handled. */
GMSH_API void gmshModelGeoMeshSetSize(int * dimTags, size_t dimTags_n,
                                      const double size,
                                      int * ierr);

/* Set a transfinite meshing constraint on the curve `tag' in the built-in CAD
 * kernel representation, with `numNodes' nodes distributed according to
 * `meshType' and `coef'. Currently supported types are "Progression"
 * (geometrical progression with power `coef') and "Bump" (refinement toward
 * both extremities of the curve). */
GMSH_API void gmshModelGeoMeshSetTransfiniteCurve(const int tag,
                                                  const int nPoints,
                                                  const char * meshType,
                                                  const double coef,
                                                  int * ierr);

/* Set a transfinite meshing constraint on the surface `tag' in the built-in
 * CAD kernel representation. `arrangement' describes the arrangement of the
 * triangles when the surface is not flagged as recombined: currently
 * supported values are "Left", "Right", "AlternateLeft" and "AlternateRight".
 * `cornerTags' can be used to specify the (3 or 4) corners of the transfinite
 * interpolation explicitly; specifying the corners explicitly is mandatory if
 * the surface has more that 3 or 4 points on its boundary. */
GMSH_API void gmshModelGeoMeshSetTransfiniteSurface(const int tag,
                                                    const char * arrangement,
                                                    int * cornerTags, size_t cornerTags_n,
                                                    int * ierr);

/* Set a transfinite meshing constraint on the surface `tag' in the built-in
 * CAD kernel representation. `cornerTags' can be used to specify the (6 or 8)
 * corners of the transfinite interpolation explicitly. */
GMSH_API void gmshModelGeoMeshSetTransfiniteVolume(const int tag,
                                                   int * cornerTags, size_t cornerTags_n,
                                                   int * ierr);

/* Set a recombination meshing constraint on the entity of dimension `dim' and
 * tag `tag' in the built-in CAD kernel representation. Currently only
 * entities of dimension 2 (to recombine triangles into quadrangles) are
 * supported. */
GMSH_API void gmshModelGeoMeshSetRecombine(const int dim,
                                           const int tag,
                                           const double angle,
                                           int * ierr);

/* Set a smoothing meshing constraint on the entity of dimension `dim' and tag
 * `tag' in the built-in CAD kernel representation. `val' iterations of a
 * Laplace smoother are applied. */
GMSH_API void gmshModelGeoMeshSetSmoothing(const int dim,
                                           const int tag,
                                           const int val,
                                           int * ierr);

/* Set a reverse meshing constraint on the entity of dimension `dim' and tag
 * `tag' in the built-in CAD kernel representation. If `val' is true, the mesh
 * orientation will be reversed with respect to the natural mesh orientation
 * (i.e. the orientation consistent with the orientation of the geometry). If
 * `val' is false, the mesh is left as-is. */
GMSH_API void gmshModelGeoMeshSetReverse(const int dim,
                                         const int tag,
                                         const int val,
                                         int * ierr);

/* Set the meshing algorithm on the entity of dimension `dim' and tag `tag' in
 * the built-in CAD kernel representation. Currently only supported for `dim'
 * == 2. */
GMSH_API void gmshModelGeoMeshSetAlgorithm(const int dim,
                                           const int tag,
                                           const int val,
                                           int * ierr);

/* Force the mesh size to be extended from the boundary, or not, for the
 * entity of dimension `dim' and tag `tag' in the built-in CAD kernel
 * representation. Currently only supported for `dim' == 2. */
GMSH_API void gmshModelGeoMeshSetSizeFromBoundary(const int dim,
                                                  const int tag,
                                                  const int val,
                                                  int * ierr);

/* Add a geometrical point in the OpenCASCADE CAD representation, at
 * coordinates (`x', `y', `z'). If `meshSize' is > 0, add a meshing constraint
 * at that point. If `tag' is positive, set the tag explicitly; otherwise a
 * new tag is selected automatically. Return the tag of the point. (Note that
 * the point will be added in the current model only after `synchronize' is
 * called. This behavior holds for all the entities added in the occ module.) */
GMSH_API int gmshModelOccAddPoint(const double x,
                                  const double y,
                                  const double z,
                                  const double meshSize,
                                  const int tag,
                                  int * ierr);

/* Add a straight line segment in the OpenCASCADE CAD representation, between
 * the two points with tags `startTag' and `endTag'. If `tag' is positive, set
 * the tag explicitly; otherwise a new tag is selected automatically. Return
 * the tag of the line. */
GMSH_API int gmshModelOccAddLine(const int startTag,
                                 const int endTag,
                                 const int tag,
                                 int * ierr);

/* Add a circle arc in the OpenCASCADE CAD representation, between the two
 * points with tags `startTag' and `endTag', with center `centerTag'. If `tag'
 * is positive, set the tag explicitly; otherwise a new tag is selected
 * automatically. Return the tag of the circle arc. */
GMSH_API int gmshModelOccAddCircleArc(const int startTag,
                                      const int centerTag,
                                      const int endTag,
                                      const int tag,
                                      int * ierr);

/* Add a circle of center (`x', `y', `z') and radius `r' in the OpenCASCADE
 * CAD representation. If `tag' is positive, set the tag explicitly; otherwise
 * a new tag is selected automatically. If `angle1' and `angle2' are
 * specified, create a circle arc between the two angles. Return the tag of
 * the circle. */
GMSH_API int gmshModelOccAddCircle(const double x,
                                   const double y,
                                   const double z,
                                   const double r,
                                   const int tag,
                                   const double angle1,
                                   const double angle2,
                                   int * ierr);

/* Add an ellipse arc in the OpenCASCADE CAD representation, between the two
 * points `startTag' and `endTag', and with center `centerTag' and major axis
 * point `majorTag'. If `tag' is positive, set the tag explicitly; otherwise a
 * new tag is selected automatically. Return the tag of the ellipse arc. Note
 * that OpenCASCADE does not allow creating ellipse arcs with the major radius
 * smaller than the minor radius. */
GMSH_API int gmshModelOccAddEllipseArc(const int startTag,
                                       const int centerTag,
                                       const int majorTag,
                                       const int endTag,
                                       const int tag,
                                       int * ierr);

/* Add an ellipse of center (`x', `y', `z') and radii `r1' and `r2' along the
 * x- and y-axes, respectively, in the OpenCASCADE CAD representation. If
 * `tag' is positive, set the tag explicitly; otherwise a new tag is selected
 * automatically. If `angle1' and `angle2' are specified, create an ellipse
 * arc between the two angles. Return the tag of the ellipse. Note that
 * OpenCASCADE does not allow creating ellipses with the major radius (along
 * the x-axis) smaller than or equal to the minor radius (along the y-axis):
 * rotate the shape or use `addCircle' in such cases. */
GMSH_API int gmshModelOccAddEllipse(const double x,
                                    const double y,
                                    const double z,
                                    const double r1,
                                    const double r2,
                                    const int tag,
                                    const double angle1,
                                    const double angle2,
                                    int * ierr);

/* Add a spline (C2 b-spline) curve in the OpenCASCADE CAD representation,
 * going through the points `pointTags'. If `tag' is positive, set the tag
 * explicitly; otherwise a new tag is selected automatically. Create a
 * periodic curve if the first and last points are the same. Return the tag of
 * the spline curve. */
GMSH_API int gmshModelOccAddSpline(int * pointTags, size_t pointTags_n,
                                   const int tag,
                                   int * ierr);

/* Add a b-spline curve of degree `degree' in the OpenCASCADE CAD
 * representation, with `pointTags' control points. If `weights', `knots' or
 * `multiplicities' are not provided, default parameters are computed
 * automatically. If `tag' is positive, set the tag explicitly; otherwise a
 * new tag is selected automatically. Create a periodic curve if the first and
 * last points are the same. Return the tag of the b-spline curve. */
GMSH_API int gmshModelOccAddBSpline(int * pointTags, size_t pointTags_n,
                                    const int tag,
                                    const int degree,
                                    double * weights, size_t weights_n,
                                    double * knots, size_t knots_n,
                                    int * multiplicities, size_t multiplicities_n,
                                    int * ierr);

/* Add a Bezier curve in the OpenCASCADE CAD representation, with `pointTags'
 * control points. If `tag' is positive, set the tag explicitly; otherwise a
 * new tag is selected automatically. Return the tag of the Bezier curve. */
GMSH_API int gmshModelOccAddBezier(int * pointTags, size_t pointTags_n,
                                   const int tag,
                                   int * ierr);

/* Add a wire (open or closed) in the OpenCASCADE CAD representation, formed
 * by the curves `curveTags'. Note that an OpenCASCADE wire can be made of
 * curves that share geometrically identical (but topologically different)
 * points. If `tag' is positive, set the tag explicitly; otherwise a new tag
 * is selected automatically. Return the tag of the wire. */
GMSH_API int gmshModelOccAddWire(int * curveTags, size_t curveTags_n,
                                 const int tag,
                                 const int checkClosed,
                                 int * ierr);

/* Add a curve loop (a closed wire) in the OpenCASCADE CAD representation,
 * formed by the curves `curveTags'. `curveTags' should contain tags of curves
 * forming a closed loop. Note that an OpenCASCADE curve loop can be made of
 * curves that share geometrically identical (but topologically different)
 * points. If `tag' is positive, set the tag explicitly; otherwise a new tag
 * is selected automatically. Return the tag of the curve loop. */
GMSH_API int gmshModelOccAddCurveLoop(int * curveTags, size_t curveTags_n,
                                      const int tag,
                                      int * ierr);

/* Add a rectangle in the OpenCASCADE CAD representation, with lower left
 * corner at (`x', `y', `z') and upper right corner at (`x' + `dx', `y' +
 * `dy', `z'). If `tag' is positive, set the tag explicitly; otherwise a new
 * tag is selected automatically. Round the corners if `roundedRadius' is
 * nonzero. Return the tag of the rectangle. */
GMSH_API int gmshModelOccAddRectangle(const double x,
                                      const double y,
                                      const double z,
                                      const double dx,
                                      const double dy,
                                      const int tag,
                                      const double roundedRadius,
                                      int * ierr);

/* Add a disk in the OpenCASCADE CAD representation, with center (`xc', `yc',
 * `zc') and radius `rx' along the x-axis and `ry' along the y-axis. If `tag'
 * is positive, set the tag explicitly; otherwise a new tag is selected
 * automatically. Return the tag of the disk. */
GMSH_API int gmshModelOccAddDisk(const double xc,
                                 const double yc,
                                 const double zc,
                                 const double rx,
                                 const double ry,
                                 const int tag,
                                 int * ierr);

/* Add a plane surface in the OpenCASCADE CAD representation, defined by one
 * or more curve loops (or closed wires) `wireTags'. The first curve loop
 * defines the exterior contour; additional curve loop define holes. If `tag'
 * is positive, set the tag explicitly; otherwise a new tag is selected
 * automatically. Return the tag of the surface. */
GMSH_API int gmshModelOccAddPlaneSurface(int * wireTags, size_t wireTags_n,
                                         const int tag,
                                         int * ierr);

/* Add a surface in the OpenCASCADE CAD representation, filling the curve loop
 * `wireTag'. If `tag' is positive, set the tag explicitly; otherwise a new
 * tag is selected automatically. Return the tag of the surface. If
 * `pointTags' are provided, force the surface to pass through the given
 * points. */
GMSH_API int gmshModelOccAddSurfaceFilling(const int wireTag,
                                           const int tag,
                                           int * pointTags, size_t pointTags_n,
                                           int * ierr);

/* Add a BSpline surface in the OpenCASCADE CAD representation, filling the
 * curve loop `wireTag'. The curve loop should be made of 2, 3 or 4 BSpline
 * curves. The optional `type' argument specifies the type of filling:
 * "Stretch" creates the flattest patch, "Curved" (the default) creates the
 * most rounded patch, and "Coons" creates a rounded patch with less depth
 * than "Curved". If `tag' is positive, set the tag explicitly; otherwise a
 * new tag is selected automatically. Return the tag of the surface. */
GMSH_API int gmshModelOccAddBSplineFilling(const int wireTag,
                                           const int tag,
                                           const char * type,
                                           int * ierr);

/* Add a Bezier surface in the OpenCASCADE CAD representation, filling the
 * curve loop `wireTag'. The curve loop should be made of 2, 3 or 4 Bezier
 * curves. The optional `type' argument specifies the type of filling:
 * "Stretch" creates the flattest patch, "Curved" (the default) creates the
 * most rounded patch, and "Coons" creates a rounded patch with less depth
 * than "Curved". If `tag' is positive, set the tag explicitly; otherwise a
 * new tag is selected automatically. Return the tag of the surface. */
GMSH_API int gmshModelOccAddBezierFilling(const int wireTag,
                                          const int tag,
                                          const char * type,
                                          int * ierr);

/* Add a b-spline surface of degree `degreeU' x `degreeV' in the OpenCASCADE
 * CAD representation, with `pointTags' control points given as a single
 * vector [Pu1v1, ... Pu`numPointsU'v1, Pu1v2, ...]. If `weights', `knotsU',
 * `knotsV', `multiplicitiesU' or `multiplicitiesV' are not provided, default
 * parameters are computed automatically. If `tag' is positive, set the tag
 * explicitly; otherwise a new tag is selected automatically. Return the tag
 * of the b-spline surface. */
GMSH_API int gmshModelOccAddBSplineSurface(int * pointTags, size_t pointTags_n,
                                           const int numPointsU,
                                           const int tag,
                                           const int degreeU,
                                           const int degreeV,
                                           double * weights, size_t weights_n,
                                           double * knotsU, size_t knotsU_n,
                                           double * knotsV, size_t knotsV_n,
                                           int * multiplicitiesU, size_t multiplicitiesU_n,
                                           int * multiplicitiesV, size_t multiplicitiesV_n,
                                           int * ierr);

/* Add a Bezier surface in the OpenCASCADE CAD representation, with
 * `pointTags' control points given as a single vector [Pu1v1, ...
 * Pu`numPointsU'v1, Pu1v2, ...]. If `tag' is positive, set the tag
 * explicitly; otherwise a new tag is selected automatically. Return the tag
 * of the b-spline surface. */
GMSH_API int gmshModelOccAddBezierSurface(int * pointTags, size_t pointTags_n,
                                          const int numPointsU,
                                          const int tag,
                                          int * ierr);

/* Add a surface loop (a closed shell) in the OpenCASCADE CAD representation,
 * formed by `surfaceTags'.  If `tag' is positive, set the tag explicitly;
 * otherwise a new tag is selected automatically. Return the tag of the
 * surface loop. Setting `sewing' allows to build a shell made of surfaces
 * that share geometrically identical (but topologically different) curves. */
GMSH_API int gmshModelOccAddSurfaceLoop(int * surfaceTags, size_t surfaceTags_n,
                                        const int tag,
                                        const int sewing,
                                        int * ierr);

/* Add a volume (a region) in the OpenCASCADE CAD representation, defined by
 * one or more surface loops `shellTags'. The first surface loop defines the
 * exterior boundary; additional surface loop define holes. If `tag' is
 * positive, set the tag explicitly; otherwise a new tag is selected
 * automatically. Return the tag of the volume. */
GMSH_API int gmshModelOccAddVolume(int * shellTags, size_t shellTags_n,
                                   const int tag,
                                   int * ierr);

/* Add a sphere of center (`xc', `yc', `zc') and radius `r' in the OpenCASCADE
 * CAD representation. The optional `angle1' and `angle2' arguments define the
 * polar angle opening (from -Pi/2 to Pi/2). The optional `angle3' argument
 * defines the azimuthal opening (from 0 to 2*Pi). If `tag' is positive, set
 * the tag explicitly; otherwise a new tag is selected automatically. Return
 * the tag of the sphere. */
GMSH_API int gmshModelOccAddSphere(const double xc,
                                   const double yc,
                                   const double zc,
                                   const double radius,
                                   const int tag,
                                   const double angle1,
                                   const double angle2,
                                   const double angle3,
                                   int * ierr);

/* Add a parallelepipedic box in the OpenCASCADE CAD representation, defined
 * by a point (`x', `y', `z') and the extents along the x-, y- and z-axes. If
 * `tag' is positive, set the tag explicitly; otherwise a new tag is selected
 * automatically. Return the tag of the box. */
GMSH_API int gmshModelOccAddBox(const double x,
                                const double y,
                                const double z,
                                const double dx,
                                const double dy,
                                const double dz,
                                const int tag,
                                int * ierr);

/* Add a cylinder in the OpenCASCADE CAD representation, defined by the center
 * (`x', `y', `z') of its first circular face, the 3 components (`dx', `dy',
 * `dz') of the vector defining its axis and its radius `r'. The optional
 * `angle' argument defines the angular opening (from 0 to 2*Pi). If `tag' is
 * positive, set the tag explicitly; otherwise a new tag is selected
 * automatically. Return the tag of the cylinder. */
GMSH_API int gmshModelOccAddCylinder(const double x,
                                     const double y,
                                     const double z,
                                     const double dx,
                                     const double dy,
                                     const double dz,
                                     const double r,
                                     const int tag,
                                     const double angle,
                                     int * ierr);

/* Add a cone in the OpenCASCADE CAD representation, defined by the center
 * (`x', `y', `z') of its first circular face, the 3 components of the vector
 * (`dx', `dy', `dz') defining its axis and the two radii `r1' and `r2' of the
 * faces (these radii can be zero). If `tag' is positive, set the tag
 * explicitly; otherwise a new tag is selected automatically. `angle' defines
 * the optional angular opening (from 0 to 2*Pi). Return the tag of the cone. */
GMSH_API int gmshModelOccAddCone(const double x,
                                 const double y,
                                 const double z,
                                 const double dx,
                                 const double dy,
                                 const double dz,
                                 const double r1,
                                 const double r2,
                                 const int tag,
                                 const double angle,
                                 int * ierr);

/* Add a right angular wedge in the OpenCASCADE CAD representation, defined by
 * the right-angle point (`x', `y', `z') and the 3 extends along the x-, y-
 * and z-axes (`dx', `dy', `dz'). If `tag' is positive, set the tag
 * explicitly; otherwise a new tag is selected automatically. The optional
 * argument `ltx' defines the top extent along the x-axis. Return the tag of
 * the wedge. */
GMSH_API int gmshModelOccAddWedge(const double x,
                                  const double y,
                                  const double z,
                                  const double dx,
                                  const double dy,
                                  const double dz,
                                  const int tag,
                                  const double ltx,
                                  int * ierr);

/* Add a torus in the OpenCASCADE CAD representation, defined by its center
 * (`x', `y', `z') and its 2 radii `r' and `r2'. If `tag' is positive, set the
 * tag explicitly; otherwise a new tag is selected automatically. The optional
 * argument `angle' defines the angular opening (from 0 to 2*Pi). Return the
 * tag of the wedge. */
GMSH_API int gmshModelOccAddTorus(const double x,
                                  const double y,
                                  const double z,
                                  const double r1,
                                  const double r2,
                                  const int tag,
                                  const double angle,
                                  int * ierr);

/* Add a volume (if the optional argument `makeSolid' is set) or surfaces in
 * the OpenCASCADE CAD representation, defined through the open or closed
 * wires `wireTags'. If `tag' is positive, set the tag explicitly; otherwise a
 * new tag is selected automatically. The new entities are returned in
 * `outDimTags'. If the optional argument `makeRuled' is set, the surfaces
 * created on the boundary are forced to be ruled surfaces. If `maxDegree' is
 * positive, set the maximal degree of resulting surface. */
GMSH_API void gmshModelOccAddThruSections(int * wireTags, size_t wireTags_n,
                                          int ** outDimTags, size_t * outDimTags_n,
                                          const int tag,
                                          const int makeSolid,
                                          const int makeRuled,
                                          const int maxDegree,
                                          int * ierr);

/* Add a hollowed volume in the OpenCASCADE CAD representation, built from an
 * initial volume `volumeTag' and a set of faces from this volume
 * `excludeSurfaceTags', which are to be removed. The remaining faces of the
 * volume become the walls of the hollowed solid, with thickness `offset'. If
 * `tag' is positive, set the tag explicitly; otherwise a new tag is selected
 * automatically. */
GMSH_API void gmshModelOccAddThickSolid(const int volumeTag,
                                        int * excludeSurfaceTags, size_t excludeSurfaceTags_n,
                                        const double offset,
                                        int ** outDimTags, size_t * outDimTags_n,
                                        const int tag,
                                        int * ierr);

/* Extrude the entities `dimTags' in the OpenCASCADE CAD representation, using
 * a translation along (`dx', `dy', `dz'). Return extruded entities in
 * `outDimTags'. If `numElements' is not empty, also extrude the mesh: the
 * entries in `numElements' give the number of elements in each layer. If
 * `height' is not empty, it provides the (cumulative) height of the different
 * layers, normalized to 1. */
GMSH_API void gmshModelOccExtrude(int * dimTags, size_t dimTags_n,
                                  const double dx,
                                  const double dy,
                                  const double dz,
                                  int ** outDimTags, size_t * outDimTags_n,
                                  int * numElements, size_t numElements_n,
                                  double * heights, size_t heights_n,
                                  const int recombine,
                                  int * ierr);

/* Extrude the entities `dimTags' in the OpenCASCADE CAD representation, using
 * a rotation of `angle' radians around the axis of revolution defined by the
 * point (`x', `y', `z') and the direction (`ax', `ay', `az'). Return extruded
 * entities in `outDimTags'. If `numElements' is not empty, also extrude the
 * mesh: the entries in `numElements' give the number of elements in each
 * layer. If `height' is not empty, it provides the (cumulative) height of the
 * different layers, normalized to 1. When the mesh is extruded the angle
 * should be strictly smaller than 2*Pi. */
GMSH_API void gmshModelOccRevolve(int * dimTags, size_t dimTags_n,
                                  const double x,
                                  const double y,
                                  const double z,
                                  const double ax,
                                  const double ay,
                                  const double az,
                                  const double angle,
                                  int ** outDimTags, size_t * outDimTags_n,
                                  int * numElements, size_t numElements_n,
                                  double * heights, size_t heights_n,
                                  const int recombine,
                                  int * ierr);

/* Add a pipe in the OpenCASCADE CAD representation, by extruding the entities
 * `dimTags' along the wire `wireTag'. Return the pipe in `outDimTags'. */
GMSH_API void gmshModelOccAddPipe(int * dimTags, size_t dimTags_n,
                                  const int wireTag,
                                  int ** outDimTags, size_t * outDimTags_n,
                                  int * ierr);

/* Fillet the volumes `volumeTags' on the curves `curveTags' with radii
 * `radii'. The `radii' vector can either contain a single radius, as many
 * radii as `curveTags', or twice as many as `curveTags' (in which case
 * different radii are provided for the begin and end points of the curves).
 * Return the filleted entities in `outDimTags'. Remove the original volume if
 * `removeVolume' is set. */
GMSH_API void gmshModelOccFillet(int * volumeTags, size_t volumeTags_n,
                                 int * curveTags, size_t curveTags_n,
                                 double * radii, size_t radii_n,
                                 int ** outDimTags, size_t * outDimTags_n,
                                 const int removeVolume,
                                 int * ierr);

/* Chamfer the volumes `volumeTags' on the curves `curveTags' with distances
 * `distances' measured on surfaces `surfaceTags'. The `distances' vector can
 * either contain a single distance, as many distances as `curveTags' and
 * `surfaceTags', or twice as many as `curveTags' and `surfaceTags' (in which
 * case the first in each pair is measured on the corresponding surface in
 * `surfaceTags', the other on the other adjacent surface). Return the
 * chamfered entities in `outDimTags'. Remove the original volume if
 * `removeVolume' is set. */
GMSH_API void gmshModelOccChamfer(int * volumeTags, size_t volumeTags_n,
                                  int * curveTags, size_t curveTags_n,
                                  int * surfaceTags, size_t surfaceTags_n,
                                  double * distances, size_t distances_n,
                                  int ** outDimTags, size_t * outDimTags_n,
                                  const int removeVolume,
                                  int * ierr);

/* Compute the boolean union (the fusion) of the entities `objectDimTags' and
 * `toolDimTags' in the OpenCASCADE CAD representation. Return the resulting
 * entities in `outDimTags'. If `tag' is positive, try to set the tag
 * explicitly (only valid if the boolean operation results in a single
 * entity). Remove the object if `removeObject' is set. Remove the tool if
 * `removeTool' is set. */
GMSH_API void gmshModelOccFuse(int * objectDimTags, size_t objectDimTags_n,
                               int * toolDimTags, size_t toolDimTags_n,
                               int ** outDimTags, size_t * outDimTags_n,
                               int *** outDimTagsMap, size_t ** outDimTagsMap_n, size_t *outDimTagsMap_nn,
                               const int tag,
                               const int removeObject,
                               const int removeTool,
                               int * ierr);

/* Compute the boolean intersection (the common parts) of the entities
 * `objectDimTags' and `toolDimTags' in the OpenCASCADE CAD representation.
 * Return the resulting entities in `outDimTags'. If `tag' is positive, try to
 * set the tag explicitly (only valid if the boolean operation results in a
 * single entity). Remove the object if `removeObject' is set. Remove the tool
 * if `removeTool' is set. */
GMSH_API void gmshModelOccIntersect(int * objectDimTags, size_t objectDimTags_n,
                                    int * toolDimTags, size_t toolDimTags_n,
                                    int ** outDimTags, size_t * outDimTags_n,
                                    int *** outDimTagsMap, size_t ** outDimTagsMap_n, size_t *outDimTagsMap_nn,
                                    const int tag,
                                    const int removeObject,
                                    const int removeTool,
                                    int * ierr);

/* Compute the boolean difference between the entities `objectDimTags' and
 * `toolDimTags' in the OpenCASCADE CAD representation. Return the resulting
 * entities in `outDimTags'. If `tag' is positive, try to set the tag
 * explicitly (only valid if the boolean operation results in a single
 * entity). Remove the object if `removeObject' is set. Remove the tool if
 * `removeTool' is set. */
GMSH_API void gmshModelOccCut(int * objectDimTags, size_t objectDimTags_n,
                              int * toolDimTags, size_t toolDimTags_n,
                              int ** outDimTags, size_t * outDimTags_n,
                              int *** outDimTagsMap, size_t ** outDimTagsMap_n, size_t *outDimTagsMap_nn,
                              const int tag,
                              const int removeObject,
                              const int removeTool,
                              int * ierr);

/* Compute the boolean fragments (general fuse) of the entities
 * `objectDimTags' and `toolDimTags' in the OpenCASCADE CAD representation.
 * Return the resulting entities in `outDimTags'. If `tag' is positive, try to
 * set the tag explicitly (only valid if the boolean operation results in a
 * single entity). Remove the object if `removeObject' is set. Remove the tool
 * if `removeTool' is set. */
GMSH_API void gmshModelOccFragment(int * objectDimTags, size_t objectDimTags_n,
                                   int * toolDimTags, size_t toolDimTags_n,
                                   int ** outDimTags, size_t * outDimTags_n,
                                   int *** outDimTagsMap, size_t ** outDimTagsMap_n, size_t *outDimTagsMap_nn,
                                   const int tag,
                                   const int removeObject,
                                   const int removeTool,
                                   int * ierr);

/* Translate the entities `dimTags' in the OpenCASCADE CAD representation
 * along (`dx', `dy', `dz'). */
GMSH_API void gmshModelOccTranslate(int * dimTags, size_t dimTags_n,
                                    const double dx,
                                    const double dy,
                                    const double dz,
                                    int * ierr);

/* Rotate the entities `dimTags' in the OpenCASCADE CAD representation by
 * `angle' radians around the axis of revolution defined by the point (`x',
 * `y', `z') and the direction (`ax', `ay', `az'). */
GMSH_API void gmshModelOccRotate(int * dimTags, size_t dimTags_n,
                                 const double x,
                                 const double y,
                                 const double z,
                                 const double ax,
                                 const double ay,
                                 const double az,
                                 const double angle,
                                 int * ierr);

/* Scale the entities `dimTags' in the OpenCASCADE CAD representation by
 * factors `a', `b' and `c' along the three coordinate axes; use (`x', `y',
 * `z') as the center of the homothetic transformation. */
GMSH_API void gmshModelOccDilate(int * dimTags, size_t dimTags_n,
                                 const double x,
                                 const double y,
                                 const double z,
                                 const double a,
                                 const double b,
                                 const double c,
                                 int * ierr);

/* Mirror the entities `dimTags' in the OpenCASCADE CAD representation, with
 * respect to the plane of equation `a' * x + `b' * y + `c' * z + `d' = 0. */
GMSH_API void gmshModelOccMirror(int * dimTags, size_t dimTags_n,
                                 const double a,
                                 const double b,
                                 const double c,
                                 const double d,
                                 int * ierr);

/* Mirror the entities `dimTags' in the OpenCASCADE CAD representation, with
 * respect to the plane of equation `a' * x + `b' * y + `c' * z + `d' = 0.
 * (This is a synonym for `mirror', which will be deprecated in a future
 * release.) */
GMSH_API void gmshModelOccSymmetrize(int * dimTags, size_t dimTags_n,
                                     const double a,
                                     const double b,
                                     const double c,
                                     const double d,
                                     int * ierr);

/* Apply a general affine transformation matrix `a' (16 entries of a 4x4
 * matrix, by row; only the 12 first can be provided for convenience) to the
 * entities `dimTags' in the OpenCASCADE CAD representation. */
GMSH_API void gmshModelOccAffineTransform(int * dimTags, size_t dimTags_n,
                                          double * a, size_t a_n,
                                          int * ierr);

/* Copy the entities `dimTags' in the OpenCASCADE CAD representation; the new
 * entities are returned in `outDimTags'. */
GMSH_API void gmshModelOccCopy(int * dimTags, size_t dimTags_n,
                               int ** outDimTags, size_t * outDimTags_n,
                               int * ierr);

/* Remove the entities `dimTags' in the OpenCASCADE CAD representation. If
 * `recursive' is true, remove all the entities on their boundaries, down to
 * dimension 0. */
GMSH_API void gmshModelOccRemove(int * dimTags, size_t dimTags_n,
                                 const int recursive,
                                 int * ierr);

/* Remove all duplicate entities in the OpenCASCADE CAD representation
 * (different entities at the same geometrical location) after intersecting
 * (using boolean fragments) all highest dimensional entities. */
GMSH_API void gmshModelOccRemoveAllDuplicates(int * ierr);

/* Apply various healing procedures to the entities `dimTags' (or to all the
 * entities in the model if `dimTags' is empty) in the OpenCASCADE CAD
 * representation. Return the healed entities in `outDimTags'. Available
 * healing options are listed in the Gmsh reference manual. */
GMSH_API void gmshModelOccHealShapes(int ** outDimTags, size_t * outDimTags_n,
                                     int * dimTags, size_t dimTags_n,
                                     const double tolerance,
                                     const int fixDegenerated,
                                     const int fixSmallEdges,
                                     const int fixSmallFaces,
                                     const int sewFaces,
                                     const int makeSolids,
                                     int * ierr);

/* Import BREP, STEP or IGES shapes from the file `fileName' in the
 * OpenCASCADE CAD representation. The imported entities are returned in
 * `outDimTags'. If the optional argument `highestDimOnly' is set, only import
 * the highest dimensional entities in the file. The optional argument
 * `format' can be used to force the format of the file (currently "brep",
 * "step" or "iges"). */
GMSH_API void gmshModelOccImportShapes(const char * fileName,
                                       int ** outDimTags, size_t * outDimTags_n,
                                       const int highestDimOnly,
                                       const char * format,
                                       int * ierr);

/* Imports an OpenCASCADE `shape' by providing a pointer to a native
 * OpenCASCADE `TopoDS_Shape' object (passed as a pointer to void). The
 * imported entities are returned in `outDimTags'. If the optional argument
 * `highestDimOnly' is set, only import the highest dimensional entities in
 * `shape'. For C and C++ only. Warning: this function is unsafe, as providing
 * an invalid pointer will lead to undefined behavior. */
GMSH_API void gmshModelOccImportShapesNativePointer(const void * shape,
                                                    int ** outDimTags, size_t * outDimTags_n,
                                                    const int highestDimOnly,
                                                    int * ierr);

/* Get all the OpenCASCADE entities. If `dim' is >= 0, return only the
 * entities of the specified dimension (e.g. points if `dim' == 0). The
 * entities are returned as a vector of (dim, tag) integer pairs. */
GMSH_API void gmshModelOccGetEntities(int ** dimTags, size_t * dimTags_n,
                                      const int dim,
                                      int * ierr);

/* Get the OpenCASCADE entities in the bounding box defined by the two points
 * (`xmin', `ymin', `zmin') and (`xmax', `ymax', `zmax'). If `dim' is >= 0,
 * return only the entities of the specified dimension (e.g. points if `dim'
 * == 0). */
GMSH_API void gmshModelOccGetEntitiesInBoundingBox(const double xmin,
                                                   const double ymin,
                                                   const double zmin,
                                                   const double xmax,
                                                   const double ymax,
                                                   const double zmax,
                                                   int ** tags, size_t * tags_n,
                                                   const int dim,
                                                   int * ierr);

/* Get the bounding box (`xmin', `ymin', `zmin'), (`xmax', `ymax', `zmax') of
 * the OpenCASCADE entity of dimension `dim' and tag `tag'. */
GMSH_API void gmshModelOccGetBoundingBox(const int dim,
                                         const int tag,
                                         double * xmin,
                                         double * ymin,
                                         double * zmin,
                                         double * xmax,
                                         double * ymax,
                                         double * zmax,
                                         int * ierr);

/* Get the mass of the OpenCASCADE entity of dimension `dim' and tag `tag'. */
GMSH_API void gmshModelOccGetMass(const int dim,
                                  const int tag,
                                  double * mass,
                                  int * ierr);

/* Get the center of mass of the OpenCASCADE entity of dimension `dim' and tag
 * `tag'. */
GMSH_API void gmshModelOccGetCenterOfMass(const int dim,
                                          const int tag,
                                          double * x,
                                          double * y,
                                          double * z,
                                          int * ierr);

/* Get the matrix of inertia (by row) of the OpenCASCADE entity of dimension
 * `dim' and tag `tag'. */
GMSH_API void gmshModelOccGetMatrixOfInertia(const int dim,
                                             const int tag,
                                             double ** mat, size_t * mat_n,
                                             int * ierr);

/* Get the maximum tag of entities of dimension `dim' in the OpenCASCADE CAD
 * representation. */
GMSH_API int gmshModelOccGetMaxTag(const int dim,
                                   int * ierr);

/* Set the maximum tag `maxTag' for entities of dimension `dim' in the
 * OpenCASCADE CAD representation. */
GMSH_API void gmshModelOccSetMaxTag(const int dim,
                                    const int maxTag,
                                    int * ierr);

/* Synchronize the OpenCASCADE CAD representation with the current Gmsh model.
 * This can be called at any time, but since it involves a non trivial amount
 * of processing, the number of synchronization points should normally be
 * minimized. Without synchronization the entities in the OpenCASCADE CAD
 * representation are not available to any function outside of the OpenCASCADE
 * CAD kernel functions. */
GMSH_API void gmshModelOccSynchronize(int * ierr);

/* Set a mesh size constraint on the entities `dimTags' in the OpenCASCADE CAD
 * representation. Currently only entities of dimension 0 (points) are
 * handled. */
GMSH_API void gmshModelOccMeshSetSize(int * dimTags, size_t dimTags_n,
                                      const double size,
                                      int * ierr);

/* Add a new post-processing view, with name `name'. If `tag' is positive use
 * it (and remove the view with that tag if it already exists), otherwise
 * associate a new tag. Return the view tag. */
GMSH_API int gmshViewAdd(const char * name,
                         const int tag,
                         int * ierr);

/* Remove the view with tag `tag'. */
GMSH_API void gmshViewRemove(const int tag,
                             int * ierr);

/* Get the index of the view with tag `tag' in the list of currently loaded
 * views. This dynamic index (it can change when views are removed) is used to
 * access view options. */
GMSH_API int gmshViewGetIndex(const int tag,
                              int * ierr);

/* Get the tags of all views. */
GMSH_API void gmshViewGetTags(int ** tags, size_t * tags_n,
                              int * ierr);

/* Add model-based post-processing data to the view with tag `tag'.
 * `modelName' identifies the model the data is attached to. `dataType'
 * specifies the type of data, currently either "NodeData", "ElementData" or
 * "ElementNodeData". `step' specifies the identifier (>= 0) of the data in a
 * sequence. `tags' gives the tags of the nodes or elements in the mesh to
 * which the data is associated. `data' is a vector of the same length as
 * `tags': each entry is the vector of double precision numbers representing
 * the data associated with the corresponding tag. The optional `time'
 * argument associate a time value with the data. `numComponents' gives the
 * number of data components (1 for scalar data, 3 for vector data, etc.) per
 * entity; if negative, it is automatically inferred (when possible) from the
 * input data. `partition' allows to specify data in several sub-sets. */
GMSH_API void gmshViewAddModelData(const int tag,
                                   const int step,
                                   const char * modelName,
                                   const char * dataType,
                                   size_t * tags, size_t tags_n,
                                   const double ** data, const size_t * data_n, size_t data_nn,
                                   const double time,
                                   const int numComponents,
                                   const int partition,
                                   int * ierr);

/* Add homogeneous model-based post-processing data to the view with tag
 * `tag'. The arguments have the same meaning as in `addModelData', except
 * that `data' is supposed to be homogeneous and is thus flattened in a single
 * vector. For data types that can lead to different data sizes per tag (like
 * "ElementNodeData"), the data should be padded. */
GMSH_API void gmshViewAddHomogeneousModelData(const int tag,
                                              const int step,
                                              const char * modelName,
                                              const char * dataType,
                                              size_t * tags, size_t tags_n,
                                              double * data, size_t data_n,
                                              const double time,
                                              const int numComponents,
                                              const int partition,
                                              int * ierr);

/* Get model-based post-processing data from the view with tag `tag' at step
 * `step'. Return the `data' associated to the nodes or the elements with tags
 * `tags', as well as the `dataType' and the number of components
 * `numComponents'. */
GMSH_API void gmshViewGetModelData(const int tag,
                                   const int step,
                                   char ** dataType,
                                   size_t ** tags, size_t * tags_n,
                                   double *** data, size_t ** data_n, size_t *data_nn,
                                   double * time,
                                   int * numComponents,
                                   int * ierr);

/* Get homogeneous model-based post-processing data from the view with tag
 * `tag' at step `step'. The arguments have the same meaning as in
 * `getModelData', except that `data' is returned flattened in a single
 * vector, with the appropriate padding if necessary. */
GMSH_API void gmshViewGetHomogeneousModelData(const int tag,
                                              const int step,
                                              char ** dataType,
                                              size_t ** tags, size_t * tags_n,
                                              double ** data, size_t * data_n,
                                              double * time,
                                              int * numComponents,
                                              int * ierr);

/* Add list-based post-processing data to the view with tag `tag'. List-based
 * datasets are independent from any model and any mesh. `dataType' identifies
 * the data by concatenating the field type ("S" for scalar, "V" for vector,
 * "T" for tensor) and the element type ("P" for point, "L" for line, "T" for
 * triangle, "S" for tetrahedron, "I" for prism, "H" for hexaHedron, "Y" for
 * pyramid). For example `dataType' should be "ST" for a scalar field on
 * triangles. `numEle' gives the number of elements in the data. `data'
 * contains the data for the `numEle' elements, concatenated, with node
 * coordinates followed by values per node, repeated for each step: [e1x1,
 * ..., e1xn, e1y1, ..., e1yn, e1z1, ..., e1zn, e1v1..., e1vN, e2x1, ...]. */
GMSH_API void gmshViewAddListData(const int tag,
                                  const char * dataType,
                                  const int numEle,
                                  double * data, size_t data_n,
                                  int * ierr);

/* Get list-based post-processing data from the view with tag `tag'. Return
 * the types `dataTypes', the number of elements `numElements' for each data
 * type and the `data' for each data type. */
GMSH_API void gmshViewGetListData(const int tag,
                                  char *** dataType, size_t * dataType_n,
                                  int ** numElements, size_t * numElements_n,
                                  double *** data, size_t ** data_n, size_t *data_nn,
                                  int * ierr);

/* Add a string to a list-based post-processing view with tag `tag'. If
 * `coord' contains 3 coordinates the string is positioned in the 3D model
 * space ("3D string"); if it contains 2 coordinates it is positioned in the
 * 2D graphics viewport ("2D string"). `data' contains one or more (for
 * multistep views) strings. `style' contains key-value pairs of styling
 * parameters, concatenated. Available keys are "Font" (possible values:
 * "Times-Roman", "Times-Bold", "Times-Italic", "Times-BoldItalic",
 * "Helvetica", "Helvetica-Bold", "Helvetica-Oblique", "Helvetica-
 * BoldOblique", "Courier", "Courier-Bold", "Courier-Oblique", "Courier-
 * BoldOblique", "Symbol", "ZapfDingbats", "Screen"), "FontSize" and "Align"
 * (possible values: "Left" or "BottomLeft", "Center" or "BottomCenter",
 * "Right" or "BottomRight", "TopLeft", "TopCenter", "TopRight", "CenterLeft",
 * "CenterCenter", "CenterRight"). */
GMSH_API void gmshViewAddListDataString(const int tag,
                                        double * coord, size_t coord_n,
                                        char ** data, size_t data_n,
                                        char ** style, size_t style_n,
                                        int * ierr);

/* Get list-based post-processing data strings (2D strings if `dim' = 2, 3D
 * strings if `dim' = 3) from the view with tag `tag'. Return the coordinates
 * in `coord', the strings in `data' and the styles in `style'. */
GMSH_API void gmshViewGetListDataStrings(const int tag,
                                         const int dim,
                                         double ** coord, size_t * coord_n,
                                         char *** data, size_t * data_n,
                                         char *** style, size_t * style_n,
                                         int * ierr);

/* Set interpolation matrices for the element family `type' ("Line",
 * "Triangle", "Quadrangle", "Tetrahedron", "Hexahedron", "Prism", "Pyramid")
 * in the view `tag'. The approximation of the values over an element is
 * written as a linear combination of `d' basis functions f_i(u, v, w) =
 * sum_(j = 0, ..., `d' - 1) `coef'[i][j] u^`exp'[j][0] v^`exp'[j][1]
 * w^`exp'[j][2], i = 0, ..., `d'-1, with u, v, w the coordinates in the
 * reference element. The `coef' matrix (of size `d' x `d') and the `exp'
 * matrix (of size `d' x 3) are stored as vectors, by row. If `dGeo' is
 * positive, use `coefGeo' and `expGeo' to define the interpolation of the x,
 * y, z coordinates of the element in terms of the u, v, w coordinates, in
 * exactly the same way. If `d' < 0, remove the interpolation matrices. */
GMSH_API void gmshViewSetInterpolationMatrices(const int tag,
                                               const char * type,
                                               const int d,
                                               double * coef, size_t coef_n,
                                               double * exp, size_t exp_n,
                                               const int dGeo,
                                               double * coefGeo, size_t coefGeo_n,
                                               double * expGeo, size_t expGeo_n,
                                               int * ierr);

/* Add a post-processing view as an `alias' of the reference view with tag
 * `refTag'. If `copyOptions' is set, copy the options of the reference view.
 * If `tag' is positive use it (and remove the view with that tag if it
 * already exists), otherwise associate a new tag. Return the view tag. */
GMSH_API int gmshViewAddAlias(const int refTag,
                              const int copyOptions,
                              const int tag,
                              int * ierr);

/* Copy the options from the view with tag `refTag' to the view with tag
 * `tag'. */
GMSH_API void gmshViewCopyOptions(const int refTag,
                                  const int tag,
                                  int * ierr);

/* Combine elements (if `what' == "elements") or steps (if `what' == "steps")
 * of all views (`how' == "all"), all visible views (`how' == "visible") or
 * all views having the same name (`how' == "name"). Remove original views if
 * `remove' is set. */
GMSH_API void gmshViewCombine(const char * what,
                              const char * how,
                              const int remove,
                              const int copyOptions,
                              int * ierr);

/* Probe the view `tag' for its `value' at point (`x', `y', `z'). Return only
 * the value at step `step' is `step' is positive. Return only values with
 * `numComp' if `numComp' is positive. Return the gradient of the `value' if
 * `gradient' is set. Probes with a geometrical tolerance (in the reference
 * unit cube) of `tolerance' if `tolerance' is not zero. Return the result
 * from the element described by its coordinates if `xElementCoord',
 * `yElementCoord' and `zElementCoord' are provided. */
GMSH_API void gmshViewProbe(const int tag,
                            const double x,
                            const double y,
                            const double z,
                            double ** value, size_t * value_n,
                            const int step,
                            const int numComp,
                            const int gradient,
                            const double tolerance,
                            double * xElemCoord, size_t xElemCoord_n,
                            double * yElemCoord, size_t yElemCoord_n,
                            double * zElemCoord, size_t zElemCoord_n,
                            int * ierr);

/* Write the view to a file `fileName'. The export format is determined by the
 * file extension. Append to the file if `append' is set. */
GMSH_API void gmshViewWrite(const int tag,
                            const char * fileName,
                            const int append,
                            int * ierr);

/* Set the global visibility of the view `tag' per window to `value', where
 * `windowIndex' identifies the window in the window list. */
GMSH_API void gmshViewSetVisibilityPerWindow(const int tag,
                                             const int value,
                                             const int windowIndex,
                                             int * ierr);

/* Set the numerical option `option' to the value `value' for plugin `name'. */
GMSH_API void gmshPluginSetNumber(const char * name,
                                  const char * option,
                                  const double value,
                                  int * ierr);

/* Set the string option `option' to the value `value' for plugin `name'. */
GMSH_API void gmshPluginSetString(const char * name,
                                  const char * option,
                                  const char * value,
                                  int * ierr);

/* Run the plugin `name'. */
GMSH_API void gmshPluginRun(const char * name,
                            int * ierr);

/* Draw all the OpenGL scenes. */
GMSH_API void gmshGraphicsDraw(int * ierr);

/* Create the FLTK graphical user interface. Can only be called in the main
 * thread. */
GMSH_API void gmshFltkInitialize(int * ierr);

/* Wait at most `time' seconds for user interface events and return. If `time'
 * < 0, wait indefinitely. First automatically create the user interface if it
 * has not yet been initialized. Can only be called in the main thread. */
GMSH_API void gmshFltkWait(const double time,
                           int * ierr);

/* Update the user interface (potentially creating new widgets and windows).
 * First automatically create the user interface if it has not yet been
 * initialized. Can only be called in the main thread: use `awake("update")'
 * to trigger an update of the user interface from another thread. */
GMSH_API void gmshFltkUpdate(int * ierr);

/* Awake the main user interface thread and process pending events, and
 * optionally perform an action (currently the only `action' allowed is
 * "update"). */
GMSH_API void gmshFltkAwake(const char * action,
                            int * ierr);

/* Block the current thread until it can safely modify the user interface. */
GMSH_API void gmshFltkLock(int * ierr);

/* Release the lock that was set using lock. */
GMSH_API void gmshFltkUnlock(int * ierr);

/* Run the event loop of the graphical user interface, i.e. repeatedly call
 * `wait()'. First automatically create the user interface if it has not yet
 * been initialized. Can only be called in the main thread. */
GMSH_API void gmshFltkRun(int * ierr);

/* Check if the user interface is available (e.g. to detect if it has been
 * closed). */
GMSH_API int gmshFltkIsAvailable(int * ierr);

/* Select entities in the user interface. If `dim' is >= 0, return only the
 * entities of the specified dimension (e.g. points if `dim' == 0). */
GMSH_API int gmshFltkSelectEntities(int ** dimTags, size_t * dimTags_n,
                                    const int dim,
                                    int * ierr);

/* Select elements in the user interface. */
GMSH_API int gmshFltkSelectElements(size_t ** elementTags, size_t * elementTags_n,
                                    int * ierr);

/* Select views in the user interface. */
GMSH_API int gmshFltkSelectViews(int ** viewTags, size_t * viewTags_n,
                                 int * ierr);

/* Split the current window horizontally (if `how' = "h") or vertically (if
 * `how' = "v"), using ratio `ratio'. If `how' = "u", restore a single window. */
GMSH_API void gmshFltkSplitCurrentWindow(const char * how,
                                         const double ratio,
                                         int * ierr);

/* Set the current window by speficying its index (starting at 0) in the list
 * of all windows. When new windows are created by splits, new windows are
 * appended at the end of the list. */
GMSH_API void gmshFltkSetCurrentWindow(const int windowIndex,
                                       int * ierr);

/* Set one or more parameters in the ONELAB database, encoded in `format'. */
GMSH_API void gmshOnelabSet(const char * data,
                            const char * format,
                            int * ierr);

/* Get all the parameters (or a single one if `name' is specified) from the
 * ONELAB database, encoded in `format'. */
GMSH_API void gmshOnelabGet(char ** data,
                            const char * name,
                            const char * format,
                            int * ierr);

/* Set the value of the number parameter `name' in the ONELAB database. Create
 * the parameter if it does not exist; update the value if the parameter
 * exists. */
GMSH_API void gmshOnelabSetNumber(const char * name,
                                  double * value, size_t value_n,
                                  int * ierr);

/* Set the value of the string parameter `name' in the ONELAB database. Create
 * the parameter if it does not exist; update the value if the parameter
 * exists. */
GMSH_API void gmshOnelabSetString(const char * name,
                                  char ** value, size_t value_n,
                                  int * ierr);

/* Get the value of the number parameter `name' from the ONELAB database.
 * Return an empty vector if the parameter does not exist. */
GMSH_API void gmshOnelabGetNumber(const char * name,
                                  double ** value, size_t * value_n,
                                  int * ierr);

/* Get the value of the string parameter `name' from the ONELAB database.
 * Return an empty vector if the parameter does not exist. */
GMSH_API void gmshOnelabGetString(const char * name,
                                  char *** value, size_t * value_n,
                                  int * ierr);

/* Clear the ONELAB database, or remove a single parameter if `name' is given. */
GMSH_API void gmshOnelabClear(const char * name,
                              int * ierr);

/* Run a ONELAB client. If `name' is provided, create a new ONELAB client with
 * name `name' and executes `command'. If not, try to run a client that might
 * be linked to the processed input files. */
GMSH_API void gmshOnelabRun(const char * name,
                            const char * command,
                            int * ierr);

/* Write a `message'. `level' can be "info", "warning" or "error". */
GMSH_API void gmshLoggerWrite(const char * message,
                              const char * level,
                              int * ierr);

/* Start logging messages. */
GMSH_API void gmshLoggerStart(int * ierr);

/* Get logged messages. */
GMSH_API void gmshLoggerGet(char *** log, size_t * log_n,
                            int * ierr);

/* Stop logging messages. */
GMSH_API void gmshLoggerStop(int * ierr);

/* Return wall clock time. */
GMSH_API double gmshLoggerGetWallTime(int * ierr);

/* Return CPU time. */
GMSH_API double gmshLoggerGetCpuTime(int * ierr);

/* Return last error message, if any. */
GMSH_API void gmshLoggerGetLastError(char ** error,
                                     int * ierr);

#endif