1 // Gmsh - Copyright (C) 1997-2021 C. Geuzaine, J.-F. Remacle
2 //
3 // See the LICENSE.txt file in the Gmsh root directory for license information.
4 // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
5
6 #include <string.h>
7 #include <stdlib.h>
8 #include "gmsh.h"
9
10 extern "C" {
11 #include "gmshc.h"
12 }
13
gmshMalloc(size_t n)14 GMSH_API void *gmshMalloc(size_t n)
15 {
16 return malloc(n);
17 }
18
gmshFree(void * p)19 GMSH_API void gmshFree(void *p)
20 {
21 if(p) free(p);
22 }
23
24 template<typename t>
vector2ptr(const std::vector<t> & v,t ** p,size_t * size)25 void vector2ptr(const std::vector<t> &v, t **p, size_t *size)
26 {
27 *p = (t*)gmshMalloc(sizeof(t) * v.size());
28 for(size_t i = 0; i < v.size(); ++i){
29 (*p)[i] = v[i];
30 }
31 *size = v.size();
32 }
33
vectorpair2intptr(const gmsh::vectorpair & v,int ** p,size_t * size)34 void vectorpair2intptr(const gmsh::vectorpair &v, int **p, size_t *size)
35 {
36 *p = (int*)gmshMalloc(sizeof(int) * v.size() * 2);
37 for(size_t i = 0; i < v.size(); ++i){
38 (*p)[i * 2 + 0] = v[i].first;
39 (*p)[i * 2 + 1] = v[i].second;
40 }
41 *size = v.size() * 2;
42 }
43
vectorstring2charptrptr(const std::vector<std::string> & v,char *** p,size_t * size)44 void vectorstring2charptrptr(const std::vector<std::string> &v, char ***p, size_t *size)
45 {
46 *p = (char**)gmshMalloc(sizeof(char*) * v.size());
47 for(size_t i = 0; i < v.size(); ++i){
48 (*p)[i] = (char*)gmshMalloc(sizeof(char) * (v[i].size() + 1));
49 for(size_t j = 0; j < v[i].size(); j++) (*p)[i][j] = v[i][j];
50 (*p)[i][v[i].size()] = '\0';
51 }
52 *size = v.size();
53 }
54
55 template<typename t>
vectorvector2ptrptr(const std::vector<std::vector<t>> & v,t *** p,size_t ** size,size_t * sizeSize)56 void vectorvector2ptrptr(const std::vector<std::vector<t> > &v, t ***p, size_t **size, size_t *sizeSize)
57 {
58 *p = (t**)gmshMalloc(sizeof(t*) * v.size());
59 *size = (size_t*)gmshMalloc(sizeof(size_t) * v.size());
60 for(size_t i = 0; i < v.size(); ++i)
61 vector2ptr(v[i], &((*p)[i]), &((*size)[i]));
62 *sizeSize = v.size();
63 }
64
vectorvectorpair2intptrptr(const std::vector<gmsh::vectorpair> & v,int *** p,size_t ** size,size_t * sizeSize)65 void vectorvectorpair2intptrptr(const std::vector<gmsh::vectorpair > &v, int ***p, size_t **size, size_t *sizeSize)
66 {
67 *p = (int**)gmshMalloc(sizeof(int*) * v.size());
68 *size = (size_t*)gmshMalloc(sizeof(size_t) * v.size());
69 for(size_t i = 0; i < v.size(); ++i)
70 vectorpair2intptr(v[i], &(*p)[i], &((*size)[i]));
71 *sizeSize = v.size();
72 }
73
gmshInitialize(int argc,char ** argv,const int readConfigFiles,const int run,int * ierr)74 GMSH_API void gmshInitialize(int argc, char ** argv, const int readConfigFiles, const int run, int * ierr)
75 {
76 if(ierr) *ierr = 0;
77 try {
78 gmsh::initialize(argc, argv, readConfigFiles, run);
79 }
80 catch(...){
81 if(ierr) *ierr = 1;
82 }
83 }
84
gmshFinalize(int * ierr)85 GMSH_API void gmshFinalize(int * ierr)
86 {
87 if(ierr) *ierr = 0;
88 try {
89 gmsh::finalize();
90 }
91 catch(...){
92 if(ierr) *ierr = 1;
93 }
94 }
95
gmshOpen(const char * fileName,int * ierr)96 GMSH_API void gmshOpen(const char * fileName, int * ierr)
97 {
98 if(ierr) *ierr = 0;
99 try {
100 gmsh::open(fileName);
101 }
102 catch(...){
103 if(ierr) *ierr = 1;
104 }
105 }
106
gmshMerge(const char * fileName,int * ierr)107 GMSH_API void gmshMerge(const char * fileName, int * ierr)
108 {
109 if(ierr) *ierr = 0;
110 try {
111 gmsh::merge(fileName);
112 }
113 catch(...){
114 if(ierr) *ierr = 1;
115 }
116 }
117
gmshWrite(const char * fileName,int * ierr)118 GMSH_API void gmshWrite(const char * fileName, int * ierr)
119 {
120 if(ierr) *ierr = 0;
121 try {
122 gmsh::write(fileName);
123 }
124 catch(...){
125 if(ierr) *ierr = 1;
126 }
127 }
128
gmshClear(int * ierr)129 GMSH_API void gmshClear(int * ierr)
130 {
131 if(ierr) *ierr = 0;
132 try {
133 gmsh::clear();
134 }
135 catch(...){
136 if(ierr) *ierr = 1;
137 }
138 }
139
gmshOptionSetNumber(const char * name,const double value,int * ierr)140 GMSH_API void gmshOptionSetNumber(const char * name, const double value, int * ierr)
141 {
142 if(ierr) *ierr = 0;
143 try {
144 gmsh::option::setNumber(name, value);
145 }
146 catch(...){
147 if(ierr) *ierr = 1;
148 }
149 }
150
gmshOptionGetNumber(const char * name,double * value,int * ierr)151 GMSH_API void gmshOptionGetNumber(const char * name, double * value, int * ierr)
152 {
153 if(ierr) *ierr = 0;
154 try {
155 gmsh::option::getNumber(name, *value);
156 }
157 catch(...){
158 if(ierr) *ierr = 1;
159 }
160 }
161
gmshOptionSetString(const char * name,const char * value,int * ierr)162 GMSH_API void gmshOptionSetString(const char * name, const char * value, int * ierr)
163 {
164 if(ierr) *ierr = 0;
165 try {
166 gmsh::option::setString(name, value);
167 }
168 catch(...){
169 if(ierr) *ierr = 1;
170 }
171 }
172
gmshOptionGetString(const char * name,char ** value,int * ierr)173 GMSH_API void gmshOptionGetString(const char * name, char ** value, int * ierr)
174 {
175 if(ierr) *ierr = 0;
176 try {
177 std::string api_value_;
178 gmsh::option::getString(name, api_value_);
179 *value = strdup(api_value_.c_str());
180 }
181 catch(...){
182 if(ierr) *ierr = 1;
183 }
184 }
185
gmshOptionSetColor(const char * name,const int r,const int g,const int b,const int a,int * ierr)186 GMSH_API void gmshOptionSetColor(const char * name, const int r, const int g, const int b, const int a, int * ierr)
187 {
188 if(ierr) *ierr = 0;
189 try {
190 gmsh::option::setColor(name, r, g, b, a);
191 }
192 catch(...){
193 if(ierr) *ierr = 1;
194 }
195 }
196
gmshOptionGetColor(const char * name,int * r,int * g,int * b,int * a,int * ierr)197 GMSH_API void gmshOptionGetColor(const char * name, int * r, int * g, int * b, int * a, int * ierr)
198 {
199 if(ierr) *ierr = 0;
200 try {
201 gmsh::option::getColor(name, *r, *g, *b, *a);
202 }
203 catch(...){
204 if(ierr) *ierr = 1;
205 }
206 }
207
gmshModelAdd(const char * name,int * ierr)208 GMSH_API void gmshModelAdd(const char * name, int * ierr)
209 {
210 if(ierr) *ierr = 0;
211 try {
212 gmsh::model::add(name);
213 }
214 catch(...){
215 if(ierr) *ierr = 1;
216 }
217 }
218
gmshModelRemove(int * ierr)219 GMSH_API void gmshModelRemove(int * ierr)
220 {
221 if(ierr) *ierr = 0;
222 try {
223 gmsh::model::remove();
224 }
225 catch(...){
226 if(ierr) *ierr = 1;
227 }
228 }
229
gmshModelList(char *** names,size_t * names_n,int * ierr)230 GMSH_API void gmshModelList(char *** names, size_t * names_n, int * ierr)
231 {
232 if(ierr) *ierr = 0;
233 try {
234 std::vector<std::string> api_names_;
235 gmsh::model::list(api_names_);
236 vectorstring2charptrptr(api_names_, names, names_n);
237 }
238 catch(...){
239 if(ierr) *ierr = 1;
240 }
241 }
242
gmshModelGetCurrent(char ** name,int * ierr)243 GMSH_API void gmshModelGetCurrent(char ** name, int * ierr)
244 {
245 if(ierr) *ierr = 0;
246 try {
247 std::string api_name_;
248 gmsh::model::getCurrent(api_name_);
249 *name = strdup(api_name_.c_str());
250 }
251 catch(...){
252 if(ierr) *ierr = 1;
253 }
254 }
255
gmshModelSetCurrent(const char * name,int * ierr)256 GMSH_API void gmshModelSetCurrent(const char * name, int * ierr)
257 {
258 if(ierr) *ierr = 0;
259 try {
260 gmsh::model::setCurrent(name);
261 }
262 catch(...){
263 if(ierr) *ierr = 1;
264 }
265 }
266
gmshModelGetFileName(char ** fileName,int * ierr)267 GMSH_API void gmshModelGetFileName(char ** fileName, int * ierr)
268 {
269 if(ierr) *ierr = 0;
270 try {
271 std::string api_fileName_;
272 gmsh::model::getFileName(api_fileName_);
273 *fileName = strdup(api_fileName_.c_str());
274 }
275 catch(...){
276 if(ierr) *ierr = 1;
277 }
278 }
279
gmshModelSetFileName(const char * fileName,int * ierr)280 GMSH_API void gmshModelSetFileName(const char * fileName, int * ierr)
281 {
282 if(ierr) *ierr = 0;
283 try {
284 gmsh::model::setFileName(fileName);
285 }
286 catch(...){
287 if(ierr) *ierr = 1;
288 }
289 }
290
gmshModelGetEntities(int ** dimTags,size_t * dimTags_n,const int dim,int * ierr)291 GMSH_API void gmshModelGetEntities(int ** dimTags, size_t * dimTags_n, const int dim, int * ierr)
292 {
293 if(ierr) *ierr = 0;
294 try {
295 gmsh::vectorpair api_dimTags_;
296 gmsh::model::getEntities(api_dimTags_, dim);
297 vectorpair2intptr(api_dimTags_, dimTags, dimTags_n);
298 }
299 catch(...){
300 if(ierr) *ierr = 1;
301 }
302 }
303
gmshModelSetEntityName(const int dim,const int tag,const char * name,int * ierr)304 GMSH_API void gmshModelSetEntityName(const int dim, const int tag, const char * name, int * ierr)
305 {
306 if(ierr) *ierr = 0;
307 try {
308 gmsh::model::setEntityName(dim, tag, name);
309 }
310 catch(...){
311 if(ierr) *ierr = 1;
312 }
313 }
314
gmshModelGetEntityName(const int dim,const int tag,char ** name,int * ierr)315 GMSH_API void gmshModelGetEntityName(const int dim, const int tag, char ** name, int * ierr)
316 {
317 if(ierr) *ierr = 0;
318 try {
319 std::string api_name_;
320 gmsh::model::getEntityName(dim, tag, api_name_);
321 *name = strdup(api_name_.c_str());
322 }
323 catch(...){
324 if(ierr) *ierr = 1;
325 }
326 }
327
gmshModelGetPhysicalGroups(int ** dimTags,size_t * dimTags_n,const int dim,int * ierr)328 GMSH_API void gmshModelGetPhysicalGroups(int ** dimTags, size_t * dimTags_n, const int dim, int * ierr)
329 {
330 if(ierr) *ierr = 0;
331 try {
332 gmsh::vectorpair api_dimTags_;
333 gmsh::model::getPhysicalGroups(api_dimTags_, dim);
334 vectorpair2intptr(api_dimTags_, dimTags, dimTags_n);
335 }
336 catch(...){
337 if(ierr) *ierr = 1;
338 }
339 }
340
gmshModelGetEntitiesForPhysicalGroup(const int dim,const int tag,int ** tags,size_t * tags_n,int * ierr)341 GMSH_API void gmshModelGetEntitiesForPhysicalGroup(const int dim, const int tag, int ** tags, size_t * tags_n, int * ierr)
342 {
343 if(ierr) *ierr = 0;
344 try {
345 std::vector<int> api_tags_;
346 gmsh::model::getEntitiesForPhysicalGroup(dim, tag, api_tags_);
347 vector2ptr(api_tags_, tags, tags_n);
348 }
349 catch(...){
350 if(ierr) *ierr = 1;
351 }
352 }
353
gmshModelGetPhysicalGroupsForEntity(const int dim,const int tag,int ** physicalTags,size_t * physicalTags_n,int * ierr)354 GMSH_API void gmshModelGetPhysicalGroupsForEntity(const int dim, const int tag, int ** physicalTags, size_t * physicalTags_n, int * ierr)
355 {
356 if(ierr) *ierr = 0;
357 try {
358 std::vector<int> api_physicalTags_;
359 gmsh::model::getPhysicalGroupsForEntity(dim, tag, api_physicalTags_);
360 vector2ptr(api_physicalTags_, physicalTags, physicalTags_n);
361 }
362 catch(...){
363 if(ierr) *ierr = 1;
364 }
365 }
366
gmshModelAddPhysicalGroup(const int dim,int * tags,size_t tags_n,const int tag,int * ierr)367 GMSH_API int gmshModelAddPhysicalGroup(const int dim, int * tags, size_t tags_n, const int tag, int * ierr)
368 {
369 int result_api_ = 0;
370 if(ierr) *ierr = 0;
371 try {
372 std::vector<int> api_tags_(tags, tags + tags_n);
373 result_api_ = gmsh::model::addPhysicalGroup(dim, api_tags_, tag);
374 }
375 catch(...){
376 if(ierr) *ierr = 1;
377 }
378 return result_api_;
379 }
380
gmshModelRemovePhysicalGroups(int * dimTags,size_t dimTags_n,int * ierr)381 GMSH_API void gmshModelRemovePhysicalGroups(int * dimTags, size_t dimTags_n, int * ierr)
382 {
383 if(ierr) *ierr = 0;
384 try {
385 gmsh::vectorpair api_dimTags_(dimTags_n/2);
386 for(size_t i = 0; i < dimTags_n/2; ++i){
387 api_dimTags_[i].first = dimTags[i * 2 + 0];
388 api_dimTags_[i].second = dimTags[i * 2 + 1];
389 }
390 gmsh::model::removePhysicalGroups(api_dimTags_);
391 }
392 catch(...){
393 if(ierr) *ierr = 1;
394 }
395 }
396
gmshModelSetPhysicalName(const int dim,const int tag,const char * name,int * ierr)397 GMSH_API void gmshModelSetPhysicalName(const int dim, const int tag, const char * name, int * ierr)
398 {
399 if(ierr) *ierr = 0;
400 try {
401 gmsh::model::setPhysicalName(dim, tag, name);
402 }
403 catch(...){
404 if(ierr) *ierr = 1;
405 }
406 }
407
gmshModelRemovePhysicalName(const char * name,int * ierr)408 GMSH_API void gmshModelRemovePhysicalName(const char * name, int * ierr)
409 {
410 if(ierr) *ierr = 0;
411 try {
412 gmsh::model::removePhysicalName(name);
413 }
414 catch(...){
415 if(ierr) *ierr = 1;
416 }
417 }
418
gmshModelGetPhysicalName(const int dim,const int tag,char ** name,int * ierr)419 GMSH_API void gmshModelGetPhysicalName(const int dim, const int tag, char ** name, int * ierr)
420 {
421 if(ierr) *ierr = 0;
422 try {
423 std::string api_name_;
424 gmsh::model::getPhysicalName(dim, tag, api_name_);
425 *name = strdup(api_name_.c_str());
426 }
427 catch(...){
428 if(ierr) *ierr = 1;
429 }
430 }
431
gmshModelSetTag(const int dim,const int tag,const int newTag,int * ierr)432 GMSH_API void gmshModelSetTag(const int dim, const int tag, const int newTag, int * ierr)
433 {
434 if(ierr) *ierr = 0;
435 try {
436 gmsh::model::setTag(dim, tag, newTag);
437 }
438 catch(...){
439 if(ierr) *ierr = 1;
440 }
441 }
442
gmshModelGetBoundary(int * dimTags,size_t dimTags_n,int ** outDimTags,size_t * outDimTags_n,const int combined,const int oriented,const int recursive,int * ierr)443 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)
444 {
445 if(ierr) *ierr = 0;
446 try {
447 gmsh::vectorpair api_dimTags_(dimTags_n/2);
448 for(size_t i = 0; i < dimTags_n/2; ++i){
449 api_dimTags_[i].first = dimTags[i * 2 + 0];
450 api_dimTags_[i].second = dimTags[i * 2 + 1];
451 }
452 gmsh::vectorpair api_outDimTags_;
453 gmsh::model::getBoundary(api_dimTags_, api_outDimTags_, combined, oriented, recursive);
454 vectorpair2intptr(api_outDimTags_, outDimTags, outDimTags_n);
455 }
456 catch(...){
457 if(ierr) *ierr = 1;
458 }
459 }
460
gmshModelGetAdjacencies(const int dim,const int tag,int ** upward,size_t * upward_n,int ** downward,size_t * downward_n,int * ierr)461 GMSH_API void gmshModelGetAdjacencies(const int dim, const int tag, int ** upward, size_t * upward_n, int ** downward, size_t * downward_n, int * ierr)
462 {
463 if(ierr) *ierr = 0;
464 try {
465 std::vector<int> api_upward_;
466 std::vector<int> api_downward_;
467 gmsh::model::getAdjacencies(dim, tag, api_upward_, api_downward_);
468 vector2ptr(api_upward_, upward, upward_n);
469 vector2ptr(api_downward_, downward, downward_n);
470 }
471 catch(...){
472 if(ierr) *ierr = 1;
473 }
474 }
475
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)476 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)
477 {
478 if(ierr) *ierr = 0;
479 try {
480 gmsh::vectorpair api_tags_;
481 gmsh::model::getEntitiesInBoundingBox(xmin, ymin, zmin, xmax, ymax, zmax, api_tags_, dim);
482 vectorpair2intptr(api_tags_, tags, tags_n);
483 }
484 catch(...){
485 if(ierr) *ierr = 1;
486 }
487 }
488
gmshModelGetBoundingBox(const int dim,const int tag,double * xmin,double * ymin,double * zmin,double * xmax,double * ymax,double * zmax,int * ierr)489 GMSH_API void gmshModelGetBoundingBox(const int dim, const int tag, double * xmin, double * ymin, double * zmin, double * xmax, double * ymax, double * zmax, int * ierr)
490 {
491 if(ierr) *ierr = 0;
492 try {
493 gmsh::model::getBoundingBox(dim, tag, *xmin, *ymin, *zmin, *xmax, *ymax, *zmax);
494 }
495 catch(...){
496 if(ierr) *ierr = 1;
497 }
498 }
499
gmshModelGetDimension(int * ierr)500 GMSH_API int gmshModelGetDimension(int * ierr)
501 {
502 int result_api_ = 0;
503 if(ierr) *ierr = 0;
504 try {
505 result_api_ = gmsh::model::getDimension();
506 }
507 catch(...){
508 if(ierr) *ierr = 1;
509 }
510 return result_api_;
511 }
512
gmshModelAddDiscreteEntity(const int dim,const int tag,int * boundary,size_t boundary_n,int * ierr)513 GMSH_API int gmshModelAddDiscreteEntity(const int dim, const int tag, int * boundary, size_t boundary_n, int * ierr)
514 {
515 int result_api_ = 0;
516 if(ierr) *ierr = 0;
517 try {
518 std::vector<int> api_boundary_(boundary, boundary + boundary_n);
519 result_api_ = gmsh::model::addDiscreteEntity(dim, tag, api_boundary_);
520 }
521 catch(...){
522 if(ierr) *ierr = 1;
523 }
524 return result_api_;
525 }
526
gmshModelRemoveEntities(int * dimTags,size_t dimTags_n,const int recursive,int * ierr)527 GMSH_API void gmshModelRemoveEntities(int * dimTags, size_t dimTags_n, const int recursive, int * ierr)
528 {
529 if(ierr) *ierr = 0;
530 try {
531 gmsh::vectorpair api_dimTags_(dimTags_n/2);
532 for(size_t i = 0; i < dimTags_n/2; ++i){
533 api_dimTags_[i].first = dimTags[i * 2 + 0];
534 api_dimTags_[i].second = dimTags[i * 2 + 1];
535 }
536 gmsh::model::removeEntities(api_dimTags_, recursive);
537 }
538 catch(...){
539 if(ierr) *ierr = 1;
540 }
541 }
542
gmshModelRemoveEntityName(const char * name,int * ierr)543 GMSH_API void gmshModelRemoveEntityName(const char * name, int * ierr)
544 {
545 if(ierr) *ierr = 0;
546 try {
547 gmsh::model::removeEntityName(name);
548 }
549 catch(...){
550 if(ierr) *ierr = 1;
551 }
552 }
553
gmshModelGetType(const int dim,const int tag,char ** entityType,int * ierr)554 GMSH_API void gmshModelGetType(const int dim, const int tag, char ** entityType, int * ierr)
555 {
556 if(ierr) *ierr = 0;
557 try {
558 std::string api_entityType_;
559 gmsh::model::getType(dim, tag, api_entityType_);
560 *entityType = strdup(api_entityType_.c_str());
561 }
562 catch(...){
563 if(ierr) *ierr = 1;
564 }
565 }
566
gmshModelGetParent(const int dim,const int tag,int * parentDim,int * parentTag,int * ierr)567 GMSH_API void gmshModelGetParent(const int dim, const int tag, int * parentDim, int * parentTag, int * ierr)
568 {
569 if(ierr) *ierr = 0;
570 try {
571 gmsh::model::getParent(dim, tag, *parentDim, *parentTag);
572 }
573 catch(...){
574 if(ierr) *ierr = 1;
575 }
576 }
577
gmshModelGetNumberOfPartitions(int * ierr)578 GMSH_API int gmshModelGetNumberOfPartitions(int * ierr)
579 {
580 int result_api_ = 0;
581 if(ierr) *ierr = 0;
582 try {
583 result_api_ = gmsh::model::getNumberOfPartitions();
584 }
585 catch(...){
586 if(ierr) *ierr = 1;
587 }
588 return result_api_;
589 }
590
gmshModelGetPartitions(const int dim,const int tag,int ** partitions,size_t * partitions_n,int * ierr)591 GMSH_API void gmshModelGetPartitions(const int dim, const int tag, int ** partitions, size_t * partitions_n, int * ierr)
592 {
593 if(ierr) *ierr = 0;
594 try {
595 std::vector<int> api_partitions_;
596 gmsh::model::getPartitions(dim, tag, api_partitions_);
597 vector2ptr(api_partitions_, partitions, partitions_n);
598 }
599 catch(...){
600 if(ierr) *ierr = 1;
601 }
602 }
603
gmshModelGetValue(const int dim,const int tag,double * parametricCoord,size_t parametricCoord_n,double ** coord,size_t * coord_n,int * ierr)604 GMSH_API void gmshModelGetValue(const int dim, const int tag, double * parametricCoord, size_t parametricCoord_n, double ** coord, size_t * coord_n, int * ierr)
605 {
606 if(ierr) *ierr = 0;
607 try {
608 std::vector<double> api_parametricCoord_(parametricCoord, parametricCoord + parametricCoord_n);
609 std::vector<double> api_coord_;
610 gmsh::model::getValue(dim, tag, api_parametricCoord_, api_coord_);
611 vector2ptr(api_coord_, coord, coord_n);
612 }
613 catch(...){
614 if(ierr) *ierr = 1;
615 }
616 }
617
gmshModelGetDerivative(const int dim,const int tag,double * parametricCoord,size_t parametricCoord_n,double ** derivatives,size_t * derivatives_n,int * ierr)618 GMSH_API void gmshModelGetDerivative(const int dim, const int tag, double * parametricCoord, size_t parametricCoord_n, double ** derivatives, size_t * derivatives_n, int * ierr)
619 {
620 if(ierr) *ierr = 0;
621 try {
622 std::vector<double> api_parametricCoord_(parametricCoord, parametricCoord + parametricCoord_n);
623 std::vector<double> api_derivatives_;
624 gmsh::model::getDerivative(dim, tag, api_parametricCoord_, api_derivatives_);
625 vector2ptr(api_derivatives_, derivatives, derivatives_n);
626 }
627 catch(...){
628 if(ierr) *ierr = 1;
629 }
630 }
631
gmshModelGetSecondDerivative(const int dim,const int tag,double * parametricCoord,size_t parametricCoord_n,double ** derivatives,size_t * derivatives_n,int * ierr)632 GMSH_API void gmshModelGetSecondDerivative(const int dim, const int tag, double * parametricCoord, size_t parametricCoord_n, double ** derivatives, size_t * derivatives_n, int * ierr)
633 {
634 if(ierr) *ierr = 0;
635 try {
636 std::vector<double> api_parametricCoord_(parametricCoord, parametricCoord + parametricCoord_n);
637 std::vector<double> api_derivatives_;
638 gmsh::model::getSecondDerivative(dim, tag, api_parametricCoord_, api_derivatives_);
639 vector2ptr(api_derivatives_, derivatives, derivatives_n);
640 }
641 catch(...){
642 if(ierr) *ierr = 1;
643 }
644 }
645
gmshModelGetCurvature(const int dim,const int tag,double * parametricCoord,size_t parametricCoord_n,double ** curvatures,size_t * curvatures_n,int * ierr)646 GMSH_API void gmshModelGetCurvature(const int dim, const int tag, double * parametricCoord, size_t parametricCoord_n, double ** curvatures, size_t * curvatures_n, int * ierr)
647 {
648 if(ierr) *ierr = 0;
649 try {
650 std::vector<double> api_parametricCoord_(parametricCoord, parametricCoord + parametricCoord_n);
651 std::vector<double> api_curvatures_;
652 gmsh::model::getCurvature(dim, tag, api_parametricCoord_, api_curvatures_);
653 vector2ptr(api_curvatures_, curvatures, curvatures_n);
654 }
655 catch(...){
656 if(ierr) *ierr = 1;
657 }
658 }
659
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)660 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)
661 {
662 if(ierr) *ierr = 0;
663 try {
664 std::vector<double> api_parametricCoord_(parametricCoord, parametricCoord + parametricCoord_n);
665 std::vector<double> api_curvatureMax_;
666 std::vector<double> api_curvatureMin_;
667 std::vector<double> api_directionMax_;
668 std::vector<double> api_directionMin_;
669 gmsh::model::getPrincipalCurvatures(tag, api_parametricCoord_, api_curvatureMax_, api_curvatureMin_, api_directionMax_, api_directionMin_);
670 vector2ptr(api_curvatureMax_, curvatureMax, curvatureMax_n);
671 vector2ptr(api_curvatureMin_, curvatureMin, curvatureMin_n);
672 vector2ptr(api_directionMax_, directionMax, directionMax_n);
673 vector2ptr(api_directionMin_, directionMin, directionMin_n);
674 }
675 catch(...){
676 if(ierr) *ierr = 1;
677 }
678 }
679
gmshModelGetNormal(const int tag,double * parametricCoord,size_t parametricCoord_n,double ** normals,size_t * normals_n,int * ierr)680 GMSH_API void gmshModelGetNormal(const int tag, double * parametricCoord, size_t parametricCoord_n, double ** normals, size_t * normals_n, int * ierr)
681 {
682 if(ierr) *ierr = 0;
683 try {
684 std::vector<double> api_parametricCoord_(parametricCoord, parametricCoord + parametricCoord_n);
685 std::vector<double> api_normals_;
686 gmsh::model::getNormal(tag, api_parametricCoord_, api_normals_);
687 vector2ptr(api_normals_, normals, normals_n);
688 }
689 catch(...){
690 if(ierr) *ierr = 1;
691 }
692 }
693
gmshModelGetParametrization(const int dim,const int tag,double * coord,size_t coord_n,double ** parametricCoord,size_t * parametricCoord_n,int * ierr)694 GMSH_API void gmshModelGetParametrization(const int dim, const int tag, double * coord, size_t coord_n, double ** parametricCoord, size_t * parametricCoord_n, int * ierr)
695 {
696 if(ierr) *ierr = 0;
697 try {
698 std::vector<double> api_coord_(coord, coord + coord_n);
699 std::vector<double> api_parametricCoord_;
700 gmsh::model::getParametrization(dim, tag, api_coord_, api_parametricCoord_);
701 vector2ptr(api_parametricCoord_, parametricCoord, parametricCoord_n);
702 }
703 catch(...){
704 if(ierr) *ierr = 1;
705 }
706 }
707
gmshModelGetParametrizationBounds(const int dim,const int tag,double ** min,size_t * min_n,double ** max,size_t * max_n,int * ierr)708 GMSH_API void gmshModelGetParametrizationBounds(const int dim, const int tag, double ** min, size_t * min_n, double ** max, size_t * max_n, int * ierr)
709 {
710 if(ierr) *ierr = 0;
711 try {
712 std::vector<double> api_min_;
713 std::vector<double> api_max_;
714 gmsh::model::getParametrizationBounds(dim, tag, api_min_, api_max_);
715 vector2ptr(api_min_, min, min_n);
716 vector2ptr(api_max_, max, max_n);
717 }
718 catch(...){
719 if(ierr) *ierr = 1;
720 }
721 }
722
gmshModelIsInside(const int dim,const int tag,double * coord,size_t coord_n,const int parametric,int * ierr)723 GMSH_API int gmshModelIsInside(const int dim, const int tag, double * coord, size_t coord_n, const int parametric, int * ierr)
724 {
725 int result_api_ = 0;
726 if(ierr) *ierr = 0;
727 try {
728 std::vector<double> api_coord_(coord, coord + coord_n);
729 result_api_ = gmsh::model::isInside(dim, tag, api_coord_, parametric);
730 }
731 catch(...){
732 if(ierr) *ierr = 1;
733 }
734 return result_api_;
735 }
736
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)737 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)
738 {
739 if(ierr) *ierr = 0;
740 try {
741 std::vector<double> api_coord_(coord, coord + coord_n);
742 std::vector<double> api_closestCoord_;
743 std::vector<double> api_parametricCoord_;
744 gmsh::model::getClosestPoint(dim, tag, api_coord_, api_closestCoord_, api_parametricCoord_);
745 vector2ptr(api_closestCoord_, closestCoord, closestCoord_n);
746 vector2ptr(api_parametricCoord_, parametricCoord, parametricCoord_n);
747 }
748 catch(...){
749 if(ierr) *ierr = 1;
750 }
751 }
752
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)753 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)
754 {
755 if(ierr) *ierr = 0;
756 try {
757 std::vector<double> api_parametricCoord_(parametricCoord, parametricCoord + parametricCoord_n);
758 std::vector<double> api_surfaceParametricCoord_;
759 gmsh::model::reparametrizeOnSurface(dim, tag, api_parametricCoord_, surfaceTag, api_surfaceParametricCoord_, which);
760 vector2ptr(api_surfaceParametricCoord_, surfaceParametricCoord, surfaceParametricCoord_n);
761 }
762 catch(...){
763 if(ierr) *ierr = 1;
764 }
765 }
766
gmshModelSetVisibility(int * dimTags,size_t dimTags_n,const int value,const int recursive,int * ierr)767 GMSH_API void gmshModelSetVisibility(int * dimTags, size_t dimTags_n, const int value, const int recursive, int * ierr)
768 {
769 if(ierr) *ierr = 0;
770 try {
771 gmsh::vectorpair api_dimTags_(dimTags_n/2);
772 for(size_t i = 0; i < dimTags_n/2; ++i){
773 api_dimTags_[i].first = dimTags[i * 2 + 0];
774 api_dimTags_[i].second = dimTags[i * 2 + 1];
775 }
776 gmsh::model::setVisibility(api_dimTags_, value, recursive);
777 }
778 catch(...){
779 if(ierr) *ierr = 1;
780 }
781 }
782
gmshModelGetVisibility(const int dim,const int tag,int * value,int * ierr)783 GMSH_API void gmshModelGetVisibility(const int dim, const int tag, int * value, int * ierr)
784 {
785 if(ierr) *ierr = 0;
786 try {
787 gmsh::model::getVisibility(dim, tag, *value);
788 }
789 catch(...){
790 if(ierr) *ierr = 1;
791 }
792 }
793
gmshModelSetVisibilityPerWindow(const int value,const int windowIndex,int * ierr)794 GMSH_API void gmshModelSetVisibilityPerWindow(const int value, const int windowIndex, int * ierr)
795 {
796 if(ierr) *ierr = 0;
797 try {
798 gmsh::model::setVisibilityPerWindow(value, windowIndex);
799 }
800 catch(...){
801 if(ierr) *ierr = 1;
802 }
803 }
804
gmshModelSetColor(int * dimTags,size_t dimTags_n,const int r,const int g,const int b,const int a,const int recursive,int * ierr)805 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)
806 {
807 if(ierr) *ierr = 0;
808 try {
809 gmsh::vectorpair api_dimTags_(dimTags_n/2);
810 for(size_t i = 0; i < dimTags_n/2; ++i){
811 api_dimTags_[i].first = dimTags[i * 2 + 0];
812 api_dimTags_[i].second = dimTags[i * 2 + 1];
813 }
814 gmsh::model::setColor(api_dimTags_, r, g, b, a, recursive);
815 }
816 catch(...){
817 if(ierr) *ierr = 1;
818 }
819 }
820
gmshModelGetColor(const int dim,const int tag,int * r,int * g,int * b,int * a,int * ierr)821 GMSH_API void gmshModelGetColor(const int dim, const int tag, int * r, int * g, int * b, int * a, int * ierr)
822 {
823 if(ierr) *ierr = 0;
824 try {
825 gmsh::model::getColor(dim, tag, *r, *g, *b, *a);
826 }
827 catch(...){
828 if(ierr) *ierr = 1;
829 }
830 }
831
gmshModelSetCoordinates(const int tag,const double x,const double y,const double z,int * ierr)832 GMSH_API void gmshModelSetCoordinates(const int tag, const double x, const double y, const double z, int * ierr)
833 {
834 if(ierr) *ierr = 0;
835 try {
836 gmsh::model::setCoordinates(tag, x, y, z);
837 }
838 catch(...){
839 if(ierr) *ierr = 1;
840 }
841 }
842
gmshModelMeshGenerate(const int dim,int * ierr)843 GMSH_API void gmshModelMeshGenerate(const int dim, int * ierr)
844 {
845 if(ierr) *ierr = 0;
846 try {
847 gmsh::model::mesh::generate(dim);
848 }
849 catch(...){
850 if(ierr) *ierr = 1;
851 }
852 }
853
gmshModelMeshPartition(const int numPart,size_t * elementTags,size_t elementTags_n,int * partitions,size_t partitions_n,int * ierr)854 GMSH_API void gmshModelMeshPartition(const int numPart, size_t * elementTags, size_t elementTags_n, int * partitions, size_t partitions_n, int * ierr)
855 {
856 if(ierr) *ierr = 0;
857 try {
858 std::vector<std::size_t> api_elementTags_(elementTags, elementTags + elementTags_n);
859 std::vector<int> api_partitions_(partitions, partitions + partitions_n);
860 gmsh::model::mesh::partition(numPart, api_elementTags_, api_partitions_);
861 }
862 catch(...){
863 if(ierr) *ierr = 1;
864 }
865 }
866
gmshModelMeshUnpartition(int * ierr)867 GMSH_API void gmshModelMeshUnpartition(int * ierr)
868 {
869 if(ierr) *ierr = 0;
870 try {
871 gmsh::model::mesh::unpartition();
872 }
873 catch(...){
874 if(ierr) *ierr = 1;
875 }
876 }
877
gmshModelMeshOptimize(const char * method,const int force,const int niter,int * dimTags,size_t dimTags_n,int * ierr)878 GMSH_API void gmshModelMeshOptimize(const char * method, const int force, const int niter, int * dimTags, size_t dimTags_n, int * ierr)
879 {
880 if(ierr) *ierr = 0;
881 try {
882 gmsh::vectorpair api_dimTags_(dimTags_n/2);
883 for(size_t i = 0; i < dimTags_n/2; ++i){
884 api_dimTags_[i].first = dimTags[i * 2 + 0];
885 api_dimTags_[i].second = dimTags[i * 2 + 1];
886 }
887 gmsh::model::mesh::optimize(method, force, niter, api_dimTags_);
888 }
889 catch(...){
890 if(ierr) *ierr = 1;
891 }
892 }
893
gmshModelMeshRecombine(int * ierr)894 GMSH_API void gmshModelMeshRecombine(int * ierr)
895 {
896 if(ierr) *ierr = 0;
897 try {
898 gmsh::model::mesh::recombine();
899 }
900 catch(...){
901 if(ierr) *ierr = 1;
902 }
903 }
904
gmshModelMeshRefine(int * ierr)905 GMSH_API void gmshModelMeshRefine(int * ierr)
906 {
907 if(ierr) *ierr = 0;
908 try {
909 gmsh::model::mesh::refine();
910 }
911 catch(...){
912 if(ierr) *ierr = 1;
913 }
914 }
915
gmshModelMeshSetOrder(const int order,int * ierr)916 GMSH_API void gmshModelMeshSetOrder(const int order, int * ierr)
917 {
918 if(ierr) *ierr = 0;
919 try {
920 gmsh::model::mesh::setOrder(order);
921 }
922 catch(...){
923 if(ierr) *ierr = 1;
924 }
925 }
926
gmshModelMeshGetLastEntityError(int ** dimTags,size_t * dimTags_n,int * ierr)927 GMSH_API void gmshModelMeshGetLastEntityError(int ** dimTags, size_t * dimTags_n, int * ierr)
928 {
929 if(ierr) *ierr = 0;
930 try {
931 gmsh::vectorpair api_dimTags_;
932 gmsh::model::mesh::getLastEntityError(api_dimTags_);
933 vectorpair2intptr(api_dimTags_, dimTags, dimTags_n);
934 }
935 catch(...){
936 if(ierr) *ierr = 1;
937 }
938 }
939
gmshModelMeshGetLastNodeError(size_t ** nodeTags,size_t * nodeTags_n,int * ierr)940 GMSH_API void gmshModelMeshGetLastNodeError(size_t ** nodeTags, size_t * nodeTags_n, int * ierr)
941 {
942 if(ierr) *ierr = 0;
943 try {
944 std::vector<std::size_t> api_nodeTags_;
945 gmsh::model::mesh::getLastNodeError(api_nodeTags_);
946 vector2ptr(api_nodeTags_, nodeTags, nodeTags_n);
947 }
948 catch(...){
949 if(ierr) *ierr = 1;
950 }
951 }
952
gmshModelMeshClear(int * dimTags,size_t dimTags_n,int * ierr)953 GMSH_API void gmshModelMeshClear(int * dimTags, size_t dimTags_n, int * ierr)
954 {
955 if(ierr) *ierr = 0;
956 try {
957 gmsh::vectorpair api_dimTags_(dimTags_n/2);
958 for(size_t i = 0; i < dimTags_n/2; ++i){
959 api_dimTags_[i].first = dimTags[i * 2 + 0];
960 api_dimTags_[i].second = dimTags[i * 2 + 1];
961 }
962 gmsh::model::mesh::clear(api_dimTags_);
963 }
964 catch(...){
965 if(ierr) *ierr = 1;
966 }
967 }
968
gmshModelMeshReverse(int * dimTags,size_t dimTags_n,int * ierr)969 GMSH_API void gmshModelMeshReverse(int * dimTags, size_t dimTags_n, int * ierr)
970 {
971 if(ierr) *ierr = 0;
972 try {
973 gmsh::vectorpair api_dimTags_(dimTags_n/2);
974 for(size_t i = 0; i < dimTags_n/2; ++i){
975 api_dimTags_[i].first = dimTags[i * 2 + 0];
976 api_dimTags_[i].second = dimTags[i * 2 + 1];
977 }
978 gmsh::model::mesh::reverse(api_dimTags_);
979 }
980 catch(...){
981 if(ierr) *ierr = 1;
982 }
983 }
984
gmshModelMeshAffineTransform(double * affineTransform,size_t affineTransform_n,int * dimTags,size_t dimTags_n,int * ierr)985 GMSH_API void gmshModelMeshAffineTransform(double * affineTransform, size_t affineTransform_n, int * dimTags, size_t dimTags_n, int * ierr)
986 {
987 if(ierr) *ierr = 0;
988 try {
989 std::vector<double> api_affineTransform_(affineTransform, affineTransform + affineTransform_n);
990 gmsh::vectorpair api_dimTags_(dimTags_n/2);
991 for(size_t i = 0; i < dimTags_n/2; ++i){
992 api_dimTags_[i].first = dimTags[i * 2 + 0];
993 api_dimTags_[i].second = dimTags[i * 2 + 1];
994 }
995 gmsh::model::mesh::affineTransform(api_affineTransform_, api_dimTags_);
996 }
997 catch(...){
998 if(ierr) *ierr = 1;
999 }
1000 }
1001
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)1002 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)
1003 {
1004 if(ierr) *ierr = 0;
1005 try {
1006 std::vector<std::size_t> api_nodeTags_;
1007 std::vector<double> api_coord_;
1008 std::vector<double> api_parametricCoord_;
1009 gmsh::model::mesh::getNodes(api_nodeTags_, api_coord_, api_parametricCoord_, dim, tag, includeBoundary, returnParametricCoord);
1010 vector2ptr(api_nodeTags_, nodeTags, nodeTags_n);
1011 vector2ptr(api_coord_, coord, coord_n);
1012 vector2ptr(api_parametricCoord_, parametricCoord, parametricCoord_n);
1013 }
1014 catch(...){
1015 if(ierr) *ierr = 1;
1016 }
1017 }
1018
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)1019 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)
1020 {
1021 if(ierr) *ierr = 0;
1022 try {
1023 std::vector<std::size_t> api_nodeTags_;
1024 std::vector<double> api_coord_;
1025 std::vector<double> api_parametricCoord_;
1026 gmsh::model::mesh::getNodesByElementType(elementType, api_nodeTags_, api_coord_, api_parametricCoord_, tag, returnParametricCoord);
1027 vector2ptr(api_nodeTags_, nodeTags, nodeTags_n);
1028 vector2ptr(api_coord_, coord, coord_n);
1029 vector2ptr(api_parametricCoord_, parametricCoord, parametricCoord_n);
1030 }
1031 catch(...){
1032 if(ierr) *ierr = 1;
1033 }
1034 }
1035
gmshModelMeshGetNode(const size_t nodeTag,double ** coord,size_t * coord_n,double ** parametricCoord,size_t * parametricCoord_n,int * dim,int * tag,int * ierr)1036 GMSH_API void gmshModelMeshGetNode(const size_t nodeTag, double ** coord, size_t * coord_n, double ** parametricCoord, size_t * parametricCoord_n, int * dim, int * tag, int * ierr)
1037 {
1038 if(ierr) *ierr = 0;
1039 try {
1040 std::vector<double> api_coord_;
1041 std::vector<double> api_parametricCoord_;
1042 gmsh::model::mesh::getNode(nodeTag, api_coord_, api_parametricCoord_, *dim, *tag);
1043 vector2ptr(api_coord_, coord, coord_n);
1044 vector2ptr(api_parametricCoord_, parametricCoord, parametricCoord_n);
1045 }
1046 catch(...){
1047 if(ierr) *ierr = 1;
1048 }
1049 }
1050
gmshModelMeshSetNode(const size_t nodeTag,double * coord,size_t coord_n,double * parametricCoord,size_t parametricCoord_n,int * ierr)1051 GMSH_API void gmshModelMeshSetNode(const size_t nodeTag, double * coord, size_t coord_n, double * parametricCoord, size_t parametricCoord_n, int * ierr)
1052 {
1053 if(ierr) *ierr = 0;
1054 try {
1055 std::vector<double> api_coord_(coord, coord + coord_n);
1056 std::vector<double> api_parametricCoord_(parametricCoord, parametricCoord + parametricCoord_n);
1057 gmsh::model::mesh::setNode(nodeTag, api_coord_, api_parametricCoord_);
1058 }
1059 catch(...){
1060 if(ierr) *ierr = 1;
1061 }
1062 }
1063
gmshModelMeshRebuildNodeCache(const int onlyIfNecessary,int * ierr)1064 GMSH_API void gmshModelMeshRebuildNodeCache(const int onlyIfNecessary, int * ierr)
1065 {
1066 if(ierr) *ierr = 0;
1067 try {
1068 gmsh::model::mesh::rebuildNodeCache(onlyIfNecessary);
1069 }
1070 catch(...){
1071 if(ierr) *ierr = 1;
1072 }
1073 }
1074
gmshModelMeshRebuildElementCache(const int onlyIfNecessary,int * ierr)1075 GMSH_API void gmshModelMeshRebuildElementCache(const int onlyIfNecessary, int * ierr)
1076 {
1077 if(ierr) *ierr = 0;
1078 try {
1079 gmsh::model::mesh::rebuildElementCache(onlyIfNecessary);
1080 }
1081 catch(...){
1082 if(ierr) *ierr = 1;
1083 }
1084 }
1085
gmshModelMeshGetNodesForPhysicalGroup(const int dim,const int tag,size_t ** nodeTags,size_t * nodeTags_n,double ** coord,size_t * coord_n,int * ierr)1086 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)
1087 {
1088 if(ierr) *ierr = 0;
1089 try {
1090 std::vector<std::size_t> api_nodeTags_;
1091 std::vector<double> api_coord_;
1092 gmsh::model::mesh::getNodesForPhysicalGroup(dim, tag, api_nodeTags_, api_coord_);
1093 vector2ptr(api_nodeTags_, nodeTags, nodeTags_n);
1094 vector2ptr(api_coord_, coord, coord_n);
1095 }
1096 catch(...){
1097 if(ierr) *ierr = 1;
1098 }
1099 }
1100
gmshModelMeshGetMaxNodeTag(size_t * maxTag,int * ierr)1101 GMSH_API void gmshModelMeshGetMaxNodeTag(size_t * maxTag, int * ierr)
1102 {
1103 if(ierr) *ierr = 0;
1104 try {
1105 gmsh::model::mesh::getMaxNodeTag(*maxTag);
1106 }
1107 catch(...){
1108 if(ierr) *ierr = 1;
1109 }
1110 }
1111
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)1112 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)
1113 {
1114 if(ierr) *ierr = 0;
1115 try {
1116 std::vector<std::size_t> api_nodeTags_(nodeTags, nodeTags + nodeTags_n);
1117 std::vector<double> api_coord_(coord, coord + coord_n);
1118 std::vector<double> api_parametricCoord_(parametricCoord, parametricCoord + parametricCoord_n);
1119 gmsh::model::mesh::addNodes(dim, tag, api_nodeTags_, api_coord_, api_parametricCoord_);
1120 }
1121 catch(...){
1122 if(ierr) *ierr = 1;
1123 }
1124 }
1125
gmshModelMeshReclassifyNodes(int * ierr)1126 GMSH_API void gmshModelMeshReclassifyNodes(int * ierr)
1127 {
1128 if(ierr) *ierr = 0;
1129 try {
1130 gmsh::model::mesh::reclassifyNodes();
1131 }
1132 catch(...){
1133 if(ierr) *ierr = 1;
1134 }
1135 }
1136
gmshModelMeshRelocateNodes(const int dim,const int tag,int * ierr)1137 GMSH_API void gmshModelMeshRelocateNodes(const int dim, const int tag, int * ierr)
1138 {
1139 if(ierr) *ierr = 0;
1140 try {
1141 gmsh::model::mesh::relocateNodes(dim, tag);
1142 }
1143 catch(...){
1144 if(ierr) *ierr = 1;
1145 }
1146 }
1147
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)1148 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)
1149 {
1150 if(ierr) *ierr = 0;
1151 try {
1152 std::vector<int> api_elementTypes_;
1153 std::vector<std::vector<std::size_t> > api_elementTags_;
1154 std::vector<std::vector<std::size_t> > api_nodeTags_;
1155 gmsh::model::mesh::getElements(api_elementTypes_, api_elementTags_, api_nodeTags_, dim, tag);
1156 vector2ptr(api_elementTypes_, elementTypes, elementTypes_n);
1157 vectorvector2ptrptr(api_elementTags_, elementTags, elementTags_n, elementTags_nn);
1158 vectorvector2ptrptr(api_nodeTags_, nodeTags, nodeTags_n, nodeTags_nn);
1159 }
1160 catch(...){
1161 if(ierr) *ierr = 1;
1162 }
1163 }
1164
gmshModelMeshGetElement(const size_t elementTag,int * elementType,size_t ** nodeTags,size_t * nodeTags_n,int * dim,int * tag,int * ierr)1165 GMSH_API void gmshModelMeshGetElement(const size_t elementTag, int * elementType, size_t ** nodeTags, size_t * nodeTags_n, int * dim, int * tag, int * ierr)
1166 {
1167 if(ierr) *ierr = 0;
1168 try {
1169 std::vector<std::size_t> api_nodeTags_;
1170 gmsh::model::mesh::getElement(elementTag, *elementType, api_nodeTags_, *dim, *tag);
1171 vector2ptr(api_nodeTags_, nodeTags, nodeTags_n);
1172 }
1173 catch(...){
1174 if(ierr) *ierr = 1;
1175 }
1176 }
1177
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)1178 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)
1179 {
1180 if(ierr) *ierr = 0;
1181 try {
1182 std::vector<std::size_t> api_nodeTags_;
1183 gmsh::model::mesh::getElementByCoordinates(x, y, z, *elementTag, *elementType, api_nodeTags_, *u, *v, *w, dim, strict);
1184 vector2ptr(api_nodeTags_, nodeTags, nodeTags_n);
1185 }
1186 catch(...){
1187 if(ierr) *ierr = 1;
1188 }
1189 }
1190
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)1191 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)
1192 {
1193 if(ierr) *ierr = 0;
1194 try {
1195 std::vector<std::size_t> api_elementTags_;
1196 gmsh::model::mesh::getElementsByCoordinates(x, y, z, api_elementTags_, dim, strict);
1197 vector2ptr(api_elementTags_, elementTags, elementTags_n);
1198 }
1199 catch(...){
1200 if(ierr) *ierr = 1;
1201 }
1202 }
1203
gmshModelMeshGetLocalCoordinatesInElement(const size_t elementTag,const double x,const double y,const double z,double * u,double * v,double * w,int * ierr)1204 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)
1205 {
1206 if(ierr) *ierr = 0;
1207 try {
1208 gmsh::model::mesh::getLocalCoordinatesInElement(elementTag, x, y, z, *u, *v, *w);
1209 }
1210 catch(...){
1211 if(ierr) *ierr = 1;
1212 }
1213 }
1214
gmshModelMeshGetElementTypes(int ** elementTypes,size_t * elementTypes_n,const int dim,const int tag,int * ierr)1215 GMSH_API void gmshModelMeshGetElementTypes(int ** elementTypes, size_t * elementTypes_n, const int dim, const int tag, int * ierr)
1216 {
1217 if(ierr) *ierr = 0;
1218 try {
1219 std::vector<int> api_elementTypes_;
1220 gmsh::model::mesh::getElementTypes(api_elementTypes_, dim, tag);
1221 vector2ptr(api_elementTypes_, elementTypes, elementTypes_n);
1222 }
1223 catch(...){
1224 if(ierr) *ierr = 1;
1225 }
1226 }
1227
gmshModelMeshGetElementType(const char * familyName,const int order,const int serendip,int * ierr)1228 GMSH_API int gmshModelMeshGetElementType(const char * familyName, const int order, const int serendip, int * ierr)
1229 {
1230 int result_api_ = 0;
1231 if(ierr) *ierr = 0;
1232 try {
1233 result_api_ = gmsh::model::mesh::getElementType(familyName, order, serendip);
1234 }
1235 catch(...){
1236 if(ierr) *ierr = 1;
1237 }
1238 return result_api_;
1239 }
1240
gmshModelMeshGetElementProperties(const int elementType,char ** elementName,int * dim,int * order,int * numNodes,double ** localNodeCoord,size_t * localNodeCoord_n,int * numPrimaryNodes,int * ierr)1241 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)
1242 {
1243 if(ierr) *ierr = 0;
1244 try {
1245 std::string api_elementName_;
1246 std::vector<double> api_localNodeCoord_;
1247 gmsh::model::mesh::getElementProperties(elementType, api_elementName_, *dim, *order, *numNodes, api_localNodeCoord_, *numPrimaryNodes);
1248 *elementName = strdup(api_elementName_.c_str());
1249 vector2ptr(api_localNodeCoord_, localNodeCoord, localNodeCoord_n);
1250 }
1251 catch(...){
1252 if(ierr) *ierr = 1;
1253 }
1254 }
1255
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)1256 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)
1257 {
1258 if(ierr) *ierr = 0;
1259 try {
1260 std::vector<std::size_t> api_elementTags_;
1261 std::vector<std::size_t> api_nodeTags_;
1262 gmsh::model::mesh::getElementsByType(elementType, api_elementTags_, api_nodeTags_, tag, task, numTasks);
1263 vector2ptr(api_elementTags_, elementTags, elementTags_n);
1264 vector2ptr(api_nodeTags_, nodeTags, nodeTags_n);
1265 }
1266 catch(...){
1267 if(ierr) *ierr = 1;
1268 }
1269 }
1270
gmshModelMeshGetMaxElementTag(size_t * maxTag,int * ierr)1271 GMSH_API void gmshModelMeshGetMaxElementTag(size_t * maxTag, int * ierr)
1272 {
1273 if(ierr) *ierr = 0;
1274 try {
1275 gmsh::model::mesh::getMaxElementTag(*maxTag);
1276 }
1277 catch(...){
1278 if(ierr) *ierr = 1;
1279 }
1280 }
1281
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)1282 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)
1283 {
1284 if(ierr) *ierr = 0;
1285 try {
1286 std::vector<std::size_t> api_elementTags_;
1287 std::vector<std::size_t> api_nodeTags_;
1288 gmsh::model::mesh::preallocateElementsByType(elementType, elementTag, nodeTag, api_elementTags_, api_nodeTags_, tag);
1289 vector2ptr(api_elementTags_, elementTags, elementTags_n);
1290 vector2ptr(api_nodeTags_, nodeTags, nodeTags_n);
1291 }
1292 catch(...){
1293 if(ierr) *ierr = 1;
1294 }
1295 }
1296
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)1297 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)
1298 {
1299 if(ierr) *ierr = 0;
1300 try {
1301 std::vector<int> api_elementTypes_(elementTypes, elementTypes + elementTypes_n);
1302 std::vector<std::vector<std::size_t> > api_elementTags_(elementTags_nn);
1303 for(size_t i = 0; i < elementTags_nn; ++i)
1304 api_elementTags_[i] = std::vector<std::size_t>(elementTags[i], elementTags[i] + elementTags_n[i]);
1305 std::vector<std::vector<std::size_t> > api_nodeTags_(nodeTags_nn);
1306 for(size_t i = 0; i < nodeTags_nn; ++i)
1307 api_nodeTags_[i] = std::vector<std::size_t>(nodeTags[i], nodeTags[i] + nodeTags_n[i]);
1308 gmsh::model::mesh::addElements(dim, tag, api_elementTypes_, api_elementTags_, api_nodeTags_);
1309 }
1310 catch(...){
1311 if(ierr) *ierr = 1;
1312 }
1313 }
1314
gmshModelMeshAddElementsByType(const int tag,const int elementType,size_t * elementTags,size_t elementTags_n,size_t * nodeTags,size_t nodeTags_n,int * ierr)1315 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)
1316 {
1317 if(ierr) *ierr = 0;
1318 try {
1319 std::vector<std::size_t> api_elementTags_(elementTags, elementTags + elementTags_n);
1320 std::vector<std::size_t> api_nodeTags_(nodeTags, nodeTags + nodeTags_n);
1321 gmsh::model::mesh::addElementsByType(tag, elementType, api_elementTags_, api_nodeTags_);
1322 }
1323 catch(...){
1324 if(ierr) *ierr = 1;
1325 }
1326 }
1327
gmshModelMeshGetIntegrationPoints(const int elementType,const char * integrationType,double ** localCoord,size_t * localCoord_n,double ** weights,size_t * weights_n,int * ierr)1328 GMSH_API void gmshModelMeshGetIntegrationPoints(const int elementType, const char * integrationType, double ** localCoord, size_t * localCoord_n, double ** weights, size_t * weights_n, int * ierr)
1329 {
1330 if(ierr) *ierr = 0;
1331 try {
1332 std::vector<double> api_localCoord_;
1333 std::vector<double> api_weights_;
1334 gmsh::model::mesh::getIntegrationPoints(elementType, integrationType, api_localCoord_, api_weights_);
1335 vector2ptr(api_localCoord_, localCoord, localCoord_n);
1336 vector2ptr(api_weights_, weights, weights_n);
1337 }
1338 catch(...){
1339 if(ierr) *ierr = 1;
1340 }
1341 }
1342
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)1343 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)
1344 {
1345 if(ierr) *ierr = 0;
1346 try {
1347 std::vector<double> api_localCoord_(localCoord, localCoord + localCoord_n);
1348 std::vector<double> api_jacobians_;
1349 std::vector<double> api_determinants_;
1350 std::vector<double> api_coord_;
1351 gmsh::model::mesh::getJacobians(elementType, api_localCoord_, api_jacobians_, api_determinants_, api_coord_, tag, task, numTasks);
1352 vector2ptr(api_jacobians_, jacobians, jacobians_n);
1353 vector2ptr(api_determinants_, determinants, determinants_n);
1354 vector2ptr(api_coord_, coord, coord_n);
1355 }
1356 catch(...){
1357 if(ierr) *ierr = 1;
1358 }
1359 }
1360
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)1361 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)
1362 {
1363 if(ierr) *ierr = 0;
1364 try {
1365 std::vector<double> api_jacobians_;
1366 std::vector<double> api_determinants_;
1367 std::vector<double> api_coord_;
1368 gmsh::model::mesh::preallocateJacobians(elementType, numEvaluationPoints, allocateJacobians, allocateDeterminants, allocateCoord, api_jacobians_, api_determinants_, api_coord_, tag);
1369 vector2ptr(api_jacobians_, jacobians, jacobians_n);
1370 vector2ptr(api_determinants_, determinants, determinants_n);
1371 vector2ptr(api_coord_, coord, coord_n);
1372 }
1373 catch(...){
1374 if(ierr) *ierr = 1;
1375 }
1376 }
1377
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)1378 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)
1379 {
1380 if(ierr) *ierr = 0;
1381 try {
1382 std::vector<double> api_localCoord_(localCoord, localCoord + localCoord_n);
1383 std::vector<double> api_jacobians_;
1384 std::vector<double> api_determinants_;
1385 std::vector<double> api_coord_;
1386 gmsh::model::mesh::getJacobian(elementTag, api_localCoord_, api_jacobians_, api_determinants_, api_coord_);
1387 vector2ptr(api_jacobians_, jacobians, jacobians_n);
1388 vector2ptr(api_determinants_, determinants, determinants_n);
1389 vector2ptr(api_coord_, coord, coord_n);
1390 }
1391 catch(...){
1392 if(ierr) *ierr = 1;
1393 }
1394 }
1395
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)1396 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)
1397 {
1398 if(ierr) *ierr = 0;
1399 try {
1400 std::vector<double> api_localCoord_(localCoord, localCoord + localCoord_n);
1401 std::vector<double> api_basisFunctions_;
1402 std::vector<int> api_wantedOrientations_(wantedOrientations, wantedOrientations + wantedOrientations_n);
1403 gmsh::model::mesh::getBasisFunctions(elementType, api_localCoord_, functionSpaceType, *numComponents, api_basisFunctions_, *numOrientations, api_wantedOrientations_);
1404 vector2ptr(api_basisFunctions_, basisFunctions, basisFunctions_n);
1405 }
1406 catch(...){
1407 if(ierr) *ierr = 1;
1408 }
1409 }
1410
gmshModelMeshGetBasisFunctionsOrientation(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)1411 GMSH_API void gmshModelMeshGetBasisFunctionsOrientation(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)
1412 {
1413 if(ierr) *ierr = 0;
1414 try {
1415 std::vector<int> api_basisFunctionsOrientation_;
1416 gmsh::model::mesh::getBasisFunctionsOrientation(elementType, functionSpaceType, api_basisFunctionsOrientation_, tag, task, numTasks);
1417 vector2ptr(api_basisFunctionsOrientation_, basisFunctionsOrientation, basisFunctionsOrientation_n);
1418 }
1419 catch(...){
1420 if(ierr) *ierr = 1;
1421 }
1422 }
1423
gmshModelMeshGetBasisFunctionsOrientationForElement(const size_t elementTag,const char * functionSpaceType,int * basisFunctionsOrientation,int * ierr)1424 GMSH_API void gmshModelMeshGetBasisFunctionsOrientationForElement(const size_t elementTag, const char * functionSpaceType, int * basisFunctionsOrientation, int * ierr)
1425 {
1426 if(ierr) *ierr = 0;
1427 try {
1428 gmsh::model::mesh::getBasisFunctionsOrientationForElement(elementTag, functionSpaceType, *basisFunctionsOrientation);
1429 }
1430 catch(...){
1431 if(ierr) *ierr = 1;
1432 }
1433 }
1434
gmshModelMeshGetNumberOfOrientations(const int elementType,const char * functionSpaceType,int * ierr)1435 GMSH_API int gmshModelMeshGetNumberOfOrientations(const int elementType, const char * functionSpaceType, int * ierr)
1436 {
1437 int result_api_ = 0;
1438 if(ierr) *ierr = 0;
1439 try {
1440 result_api_ = gmsh::model::mesh::getNumberOfOrientations(elementType, functionSpaceType);
1441 }
1442 catch(...){
1443 if(ierr) *ierr = 1;
1444 }
1445 return result_api_;
1446 }
1447
gmshModelMeshPreallocateBasisFunctionsOrientation(const int elementType,int ** basisFunctionsOrientation,size_t * basisFunctionsOrientation_n,const int tag,int * ierr)1448 GMSH_API void gmshModelMeshPreallocateBasisFunctionsOrientation(const int elementType, int ** basisFunctionsOrientation, size_t * basisFunctionsOrientation_n, const int tag, int * ierr)
1449 {
1450 if(ierr) *ierr = 0;
1451 try {
1452 std::vector<int> api_basisFunctionsOrientation_;
1453 gmsh::model::mesh::preallocateBasisFunctionsOrientation(elementType, api_basisFunctionsOrientation_, tag);
1454 vector2ptr(api_basisFunctionsOrientation_, basisFunctionsOrientation, basisFunctionsOrientation_n);
1455 }
1456 catch(...){
1457 if(ierr) *ierr = 1;
1458 }
1459 }
1460
gmshModelMeshGetEdges(size_t * nodeTags,size_t nodeTags_n,size_t ** edgeTags,size_t * edgeTags_n,int ** edgeOrientations,size_t * edgeOrientations_n,int * ierr)1461 GMSH_API void gmshModelMeshGetEdges(size_t * nodeTags, size_t nodeTags_n, size_t ** edgeTags, size_t * edgeTags_n, int ** edgeOrientations, size_t * edgeOrientations_n, int * ierr)
1462 {
1463 if(ierr) *ierr = 0;
1464 try {
1465 std::vector<std::size_t> api_nodeTags_(nodeTags, nodeTags + nodeTags_n);
1466 std::vector<std::size_t> api_edgeTags_;
1467 std::vector<int> api_edgeOrientations_;
1468 gmsh::model::mesh::getEdges(api_nodeTags_, api_edgeTags_, api_edgeOrientations_);
1469 vector2ptr(api_edgeTags_, edgeTags, edgeTags_n);
1470 vector2ptr(api_edgeOrientations_, edgeOrientations, edgeOrientations_n);
1471 }
1472 catch(...){
1473 if(ierr) *ierr = 1;
1474 }
1475 }
1476
gmshModelMeshGetFaces(const int faceType,size_t * nodeTags,size_t nodeTags_n,size_t ** faceTags,size_t * faceTags_n,int ** faceOrientations,size_t * faceOrientations_n,int * ierr)1477 GMSH_API void gmshModelMeshGetFaces(const int faceType, size_t * nodeTags, size_t nodeTags_n, size_t ** faceTags, size_t * faceTags_n, int ** faceOrientations, size_t * faceOrientations_n, int * ierr)
1478 {
1479 if(ierr) *ierr = 0;
1480 try {
1481 std::vector<std::size_t> api_nodeTags_(nodeTags, nodeTags + nodeTags_n);
1482 std::vector<std::size_t> api_faceTags_;
1483 std::vector<int> api_faceOrientations_;
1484 gmsh::model::mesh::getFaces(faceType, api_nodeTags_, api_faceTags_, api_faceOrientations_);
1485 vector2ptr(api_faceTags_, faceTags, faceTags_n);
1486 vector2ptr(api_faceOrientations_, faceOrientations, faceOrientations_n);
1487 }
1488 catch(...){
1489 if(ierr) *ierr = 1;
1490 }
1491 }
1492
gmshModelMeshCreateEdges(int * dimTags,size_t dimTags_n,int * ierr)1493 GMSH_API void gmshModelMeshCreateEdges(int * dimTags, size_t dimTags_n, int * ierr)
1494 {
1495 if(ierr) *ierr = 0;
1496 try {
1497 gmsh::vectorpair api_dimTags_(dimTags_n/2);
1498 for(size_t i = 0; i < dimTags_n/2; ++i){
1499 api_dimTags_[i].first = dimTags[i * 2 + 0];
1500 api_dimTags_[i].second = dimTags[i * 2 + 1];
1501 }
1502 gmsh::model::mesh::createEdges(api_dimTags_);
1503 }
1504 catch(...){
1505 if(ierr) *ierr = 1;
1506 }
1507 }
1508
gmshModelMeshCreateFaces(int * dimTags,size_t dimTags_n,int * ierr)1509 GMSH_API void gmshModelMeshCreateFaces(int * dimTags, size_t dimTags_n, int * ierr)
1510 {
1511 if(ierr) *ierr = 0;
1512 try {
1513 gmsh::vectorpair api_dimTags_(dimTags_n/2);
1514 for(size_t i = 0; i < dimTags_n/2; ++i){
1515 api_dimTags_[i].first = dimTags[i * 2 + 0];
1516 api_dimTags_[i].second = dimTags[i * 2 + 1];
1517 }
1518 gmsh::model::mesh::createFaces(api_dimTags_);
1519 }
1520 catch(...){
1521 if(ierr) *ierr = 1;
1522 }
1523 }
1524
gmshModelMeshGetAllEdges(size_t ** edgeTags,size_t * edgeTags_n,size_t ** edgeNodes,size_t * edgeNodes_n,int * ierr)1525 GMSH_API void gmshModelMeshGetAllEdges(size_t ** edgeTags, size_t * edgeTags_n, size_t ** edgeNodes, size_t * edgeNodes_n, int * ierr)
1526 {
1527 if(ierr) *ierr = 0;
1528 try {
1529 std::vector<std::size_t> api_edgeTags_;
1530 std::vector<std::size_t> api_edgeNodes_;
1531 gmsh::model::mesh::getAllEdges(api_edgeTags_, api_edgeNodes_);
1532 vector2ptr(api_edgeTags_, edgeTags, edgeTags_n);
1533 vector2ptr(api_edgeNodes_, edgeNodes, edgeNodes_n);
1534 }
1535 catch(...){
1536 if(ierr) *ierr = 1;
1537 }
1538 }
1539
gmshModelMeshGetAllFaces(const int faceType,size_t ** faceTags,size_t * faceTags_n,size_t ** faceNodes,size_t * faceNodes_n,int * ierr)1540 GMSH_API void gmshModelMeshGetAllFaces(const int faceType, size_t ** faceTags, size_t * faceTags_n, size_t ** faceNodes, size_t * faceNodes_n, int * ierr)
1541 {
1542 if(ierr) *ierr = 0;
1543 try {
1544 std::vector<std::size_t> api_faceTags_;
1545 std::vector<std::size_t> api_faceNodes_;
1546 gmsh::model::mesh::getAllFaces(faceType, api_faceTags_, api_faceNodes_);
1547 vector2ptr(api_faceTags_, faceTags, faceTags_n);
1548 vector2ptr(api_faceNodes_, faceNodes, faceNodes_n);
1549 }
1550 catch(...){
1551 if(ierr) *ierr = 1;
1552 }
1553 }
1554
gmshModelMeshAddEdges(size_t * edgeTags,size_t edgeTags_n,size_t * edgeNodes,size_t edgeNodes_n,int * ierr)1555 GMSH_API void gmshModelMeshAddEdges(size_t * edgeTags, size_t edgeTags_n, size_t * edgeNodes, size_t edgeNodes_n, int * ierr)
1556 {
1557 if(ierr) *ierr = 0;
1558 try {
1559 std::vector<std::size_t> api_edgeTags_(edgeTags, edgeTags + edgeTags_n);
1560 std::vector<std::size_t> api_edgeNodes_(edgeNodes, edgeNodes + edgeNodes_n);
1561 gmsh::model::mesh::addEdges(api_edgeTags_, api_edgeNodes_);
1562 }
1563 catch(...){
1564 if(ierr) *ierr = 1;
1565 }
1566 }
1567
gmshModelMeshAddFaces(const int faceType,size_t * faceTags,size_t faceTags_n,size_t * faceNodes,size_t faceNodes_n,int * ierr)1568 GMSH_API void gmshModelMeshAddFaces(const int faceType, size_t * faceTags, size_t faceTags_n, size_t * faceNodes, size_t faceNodes_n, int * ierr)
1569 {
1570 if(ierr) *ierr = 0;
1571 try {
1572 std::vector<std::size_t> api_faceTags_(faceTags, faceTags + faceTags_n);
1573 std::vector<std::size_t> api_faceNodes_(faceNodes, faceNodes + faceNodes_n);
1574 gmsh::model::mesh::addFaces(faceType, api_faceTags_, api_faceNodes_);
1575 }
1576 catch(...){
1577 if(ierr) *ierr = 1;
1578 }
1579 }
1580
gmshModelMeshGetKeys(const int elementType,const char * functionSpaceType,int ** typeKeys,size_t * typeKeys_n,size_t ** entityKeys,size_t * entityKeys_n,double ** coord,size_t * coord_n,const int tag,const int returnCoord,int * ierr)1581 GMSH_API void gmshModelMeshGetKeys(const int elementType, const char * functionSpaceType, int ** typeKeys, size_t * typeKeys_n, size_t ** entityKeys, size_t * entityKeys_n, double ** coord, size_t * coord_n, const int tag, const int returnCoord, int * ierr)
1582 {
1583 if(ierr) *ierr = 0;
1584 try {
1585 std::vector<int> api_typeKeys_;
1586 std::vector<std::size_t> api_entityKeys_;
1587 std::vector<double> api_coord_;
1588 gmsh::model::mesh::getKeys(elementType, functionSpaceType, api_typeKeys_, api_entityKeys_, api_coord_, tag, returnCoord);
1589 vector2ptr(api_typeKeys_, typeKeys, typeKeys_n);
1590 vector2ptr(api_entityKeys_, entityKeys, entityKeys_n);
1591 vector2ptr(api_coord_, coord, coord_n);
1592 }
1593 catch(...){
1594 if(ierr) *ierr = 1;
1595 }
1596 }
1597
gmshModelMeshGetKeysForElement(const size_t elementTag,const char * functionSpaceType,int ** typeKeys,size_t * typeKeys_n,size_t ** entityKeys,size_t * entityKeys_n,double ** coord,size_t * coord_n,const int returnCoord,int * ierr)1598 GMSH_API void gmshModelMeshGetKeysForElement(const size_t elementTag, const char * functionSpaceType, int ** typeKeys, size_t * typeKeys_n, size_t ** entityKeys, size_t * entityKeys_n, double ** coord, size_t * coord_n, const int returnCoord, int * ierr)
1599 {
1600 if(ierr) *ierr = 0;
1601 try {
1602 std::vector<int> api_typeKeys_;
1603 std::vector<std::size_t> api_entityKeys_;
1604 std::vector<double> api_coord_;
1605 gmsh::model::mesh::getKeysForElement(elementTag, functionSpaceType, api_typeKeys_, api_entityKeys_, api_coord_, returnCoord);
1606 vector2ptr(api_typeKeys_, typeKeys, typeKeys_n);
1607 vector2ptr(api_entityKeys_, entityKeys, entityKeys_n);
1608 vector2ptr(api_coord_, coord, coord_n);
1609 }
1610 catch(...){
1611 if(ierr) *ierr = 1;
1612 }
1613 }
1614
gmshModelMeshGetNumberOfKeys(const int elementType,const char * functionSpaceType,int * ierr)1615 GMSH_API int gmshModelMeshGetNumberOfKeys(const int elementType, const char * functionSpaceType, int * ierr)
1616 {
1617 int result_api_ = 0;
1618 if(ierr) *ierr = 0;
1619 try {
1620 result_api_ = gmsh::model::mesh::getNumberOfKeys(elementType, functionSpaceType);
1621 }
1622 catch(...){
1623 if(ierr) *ierr = 1;
1624 }
1625 return result_api_;
1626 }
1627
gmshModelMeshGetKeysInformation(int * typeKeys,size_t typeKeys_n,size_t * entityKeys,size_t entityKeys_n,const int elementType,const char * functionSpaceType,int ** infoKeys,size_t * infoKeys_n,int * ierr)1628 GMSH_API void gmshModelMeshGetKeysInformation(int * typeKeys, size_t typeKeys_n, size_t * entityKeys, size_t entityKeys_n, const int elementType, const char * functionSpaceType, int ** infoKeys, size_t * infoKeys_n, int * ierr)
1629 {
1630 if(ierr) *ierr = 0;
1631 try {
1632 std::vector<int> api_typeKeys_(typeKeys, typeKeys + typeKeys_n);
1633 std::vector<std::size_t> api_entityKeys_(entityKeys, entityKeys + entityKeys_n);
1634 gmsh::vectorpair api_infoKeys_;
1635 gmsh::model::mesh::getKeysInformation(api_typeKeys_, api_entityKeys_, elementType, functionSpaceType, api_infoKeys_);
1636 vectorpair2intptr(api_infoKeys_, infoKeys, infoKeys_n);
1637 }
1638 catch(...){
1639 if(ierr) *ierr = 1;
1640 }
1641 }
1642
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)1643 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)
1644 {
1645 if(ierr) *ierr = 0;
1646 try {
1647 std::vector<double> api_barycenters_;
1648 gmsh::model::mesh::getBarycenters(elementType, tag, fast, primary, api_barycenters_, task, numTasks);
1649 vector2ptr(api_barycenters_, barycenters, barycenters_n);
1650 }
1651 catch(...){
1652 if(ierr) *ierr = 1;
1653 }
1654 }
1655
gmshModelMeshPreallocateBarycenters(const int elementType,double ** barycenters,size_t * barycenters_n,const int tag,int * ierr)1656 GMSH_API void gmshModelMeshPreallocateBarycenters(const int elementType, double ** barycenters, size_t * barycenters_n, const int tag, int * ierr)
1657 {
1658 if(ierr) *ierr = 0;
1659 try {
1660 std::vector<double> api_barycenters_;
1661 gmsh::model::mesh::preallocateBarycenters(elementType, api_barycenters_, tag);
1662 vector2ptr(api_barycenters_, barycenters, barycenters_n);
1663 }
1664 catch(...){
1665 if(ierr) *ierr = 1;
1666 }
1667 }
1668
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)1669 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)
1670 {
1671 if(ierr) *ierr = 0;
1672 try {
1673 std::vector<std::size_t> api_nodeTags_;
1674 gmsh::model::mesh::getElementEdgeNodes(elementType, api_nodeTags_, tag, primary, task, numTasks);
1675 vector2ptr(api_nodeTags_, nodeTags, nodeTags_n);
1676 }
1677 catch(...){
1678 if(ierr) *ierr = 1;
1679 }
1680 }
1681
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)1682 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)
1683 {
1684 if(ierr) *ierr = 0;
1685 try {
1686 std::vector<std::size_t> api_nodeTags_;
1687 gmsh::model::mesh::getElementFaceNodes(elementType, faceType, api_nodeTags_, tag, primary, task, numTasks);
1688 vector2ptr(api_nodeTags_, nodeTags, nodeTags_n);
1689 }
1690 catch(...){
1691 if(ierr) *ierr = 1;
1692 }
1693 }
1694
gmshModelMeshGetGhostElements(const int dim,const int tag,size_t ** elementTags,size_t * elementTags_n,int ** partitions,size_t * partitions_n,int * ierr)1695 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)
1696 {
1697 if(ierr) *ierr = 0;
1698 try {
1699 std::vector<std::size_t> api_elementTags_;
1700 std::vector<int> api_partitions_;
1701 gmsh::model::mesh::getGhostElements(dim, tag, api_elementTags_, api_partitions_);
1702 vector2ptr(api_elementTags_, elementTags, elementTags_n);
1703 vector2ptr(api_partitions_, partitions, partitions_n);
1704 }
1705 catch(...){
1706 if(ierr) *ierr = 1;
1707 }
1708 }
1709
gmshModelMeshSetSize(int * dimTags,size_t dimTags_n,const double size,int * ierr)1710 GMSH_API void gmshModelMeshSetSize(int * dimTags, size_t dimTags_n, const double size, int * ierr)
1711 {
1712 if(ierr) *ierr = 0;
1713 try {
1714 gmsh::vectorpair api_dimTags_(dimTags_n/2);
1715 for(size_t i = 0; i < dimTags_n/2; ++i){
1716 api_dimTags_[i].first = dimTags[i * 2 + 0];
1717 api_dimTags_[i].second = dimTags[i * 2 + 1];
1718 }
1719 gmsh::model::mesh::setSize(api_dimTags_, size);
1720 }
1721 catch(...){
1722 if(ierr) *ierr = 1;
1723 }
1724 }
1725
gmshModelMeshGetSizes(int * dimTags,size_t dimTags_n,double ** sizes,size_t * sizes_n,int * ierr)1726 GMSH_API void gmshModelMeshGetSizes(int * dimTags, size_t dimTags_n, double ** sizes, size_t * sizes_n, int * ierr)
1727 {
1728 if(ierr) *ierr = 0;
1729 try {
1730 gmsh::vectorpair api_dimTags_(dimTags_n/2);
1731 for(size_t i = 0; i < dimTags_n/2; ++i){
1732 api_dimTags_[i].first = dimTags[i * 2 + 0];
1733 api_dimTags_[i].second = dimTags[i * 2 + 1];
1734 }
1735 std::vector<double> api_sizes_;
1736 gmsh::model::mesh::getSizes(api_dimTags_, api_sizes_);
1737 vector2ptr(api_sizes_, sizes, sizes_n);
1738 }
1739 catch(...){
1740 if(ierr) *ierr = 1;
1741 }
1742 }
1743
gmshModelMeshSetSizeAtParametricPoints(const int dim,const int tag,double * parametricCoord,size_t parametricCoord_n,double * sizes,size_t sizes_n,int * ierr)1744 GMSH_API void gmshModelMeshSetSizeAtParametricPoints(const int dim, const int tag, double * parametricCoord, size_t parametricCoord_n, double * sizes, size_t sizes_n, int * ierr)
1745 {
1746 if(ierr) *ierr = 0;
1747 try {
1748 std::vector<double> api_parametricCoord_(parametricCoord, parametricCoord + parametricCoord_n);
1749 std::vector<double> api_sizes_(sizes, sizes + sizes_n);
1750 gmsh::model::mesh::setSizeAtParametricPoints(dim, tag, api_parametricCoord_, api_sizes_);
1751 }
1752 catch(...){
1753 if(ierr) *ierr = 1;
1754 }
1755 }
1756
gmshModelMeshSetSizeCallback(double (* callback)(int dim,int tag,double x,double y,double z,double lc,void * data),void * callback_data,int * ierr)1757 GMSH_API void gmshModelMeshSetSizeCallback(double (*callback)(int dim, int tag, double x, double y, double z, double lc, void * data), void * callback_data, int * ierr)
1758 {
1759 if(ierr) *ierr = 0;
1760 try {
1761 gmsh::model::mesh::setSizeCallback(std::bind(callback, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6, callback_data));
1762 }
1763 catch(...){
1764 if(ierr) *ierr = 1;
1765 }
1766 }
1767
gmshModelMeshRemoveSizeCallback(int * ierr)1768 GMSH_API void gmshModelMeshRemoveSizeCallback(int * ierr)
1769 {
1770 if(ierr) *ierr = 0;
1771 try {
1772 gmsh::model::mesh::removeSizeCallback();
1773 }
1774 catch(...){
1775 if(ierr) *ierr = 1;
1776 }
1777 }
1778
gmshModelMeshSetTransfiniteCurve(const int tag,const int numNodes,const char * meshType,const double coef,int * ierr)1779 GMSH_API void gmshModelMeshSetTransfiniteCurve(const int tag, const int numNodes, const char * meshType, const double coef, int * ierr)
1780 {
1781 if(ierr) *ierr = 0;
1782 try {
1783 gmsh::model::mesh::setTransfiniteCurve(tag, numNodes, meshType, coef);
1784 }
1785 catch(...){
1786 if(ierr) *ierr = 1;
1787 }
1788 }
1789
gmshModelMeshSetTransfiniteSurface(const int tag,const char * arrangement,int * cornerTags,size_t cornerTags_n,int * ierr)1790 GMSH_API void gmshModelMeshSetTransfiniteSurface(const int tag, const char * arrangement, int * cornerTags, size_t cornerTags_n, int * ierr)
1791 {
1792 if(ierr) *ierr = 0;
1793 try {
1794 std::vector<int> api_cornerTags_(cornerTags, cornerTags + cornerTags_n);
1795 gmsh::model::mesh::setTransfiniteSurface(tag, arrangement, api_cornerTags_);
1796 }
1797 catch(...){
1798 if(ierr) *ierr = 1;
1799 }
1800 }
1801
gmshModelMeshSetTransfiniteVolume(const int tag,int * cornerTags,size_t cornerTags_n,int * ierr)1802 GMSH_API void gmshModelMeshSetTransfiniteVolume(const int tag, int * cornerTags, size_t cornerTags_n, int * ierr)
1803 {
1804 if(ierr) *ierr = 0;
1805 try {
1806 std::vector<int> api_cornerTags_(cornerTags, cornerTags + cornerTags_n);
1807 gmsh::model::mesh::setTransfiniteVolume(tag, api_cornerTags_);
1808 }
1809 catch(...){
1810 if(ierr) *ierr = 1;
1811 }
1812 }
1813
gmshModelMeshSetTransfiniteAutomatic(int * dimTags,size_t dimTags_n,const double cornerAngle,const int recombine,int * ierr)1814 GMSH_API void gmshModelMeshSetTransfiniteAutomatic(int * dimTags, size_t dimTags_n, const double cornerAngle, const int recombine, int * ierr)
1815 {
1816 if(ierr) *ierr = 0;
1817 try {
1818 gmsh::vectorpair api_dimTags_(dimTags_n/2);
1819 for(size_t i = 0; i < dimTags_n/2; ++i){
1820 api_dimTags_[i].first = dimTags[i * 2 + 0];
1821 api_dimTags_[i].second = dimTags[i * 2 + 1];
1822 }
1823 gmsh::model::mesh::setTransfiniteAutomatic(api_dimTags_, cornerAngle, recombine);
1824 }
1825 catch(...){
1826 if(ierr) *ierr = 1;
1827 }
1828 }
1829
gmshModelMeshSetRecombine(const int dim,const int tag,int * ierr)1830 GMSH_API void gmshModelMeshSetRecombine(const int dim, const int tag, int * ierr)
1831 {
1832 if(ierr) *ierr = 0;
1833 try {
1834 gmsh::model::mesh::setRecombine(dim, tag);
1835 }
1836 catch(...){
1837 if(ierr) *ierr = 1;
1838 }
1839 }
1840
gmshModelMeshSetSmoothing(const int dim,const int tag,const int val,int * ierr)1841 GMSH_API void gmshModelMeshSetSmoothing(const int dim, const int tag, const int val, int * ierr)
1842 {
1843 if(ierr) *ierr = 0;
1844 try {
1845 gmsh::model::mesh::setSmoothing(dim, tag, val);
1846 }
1847 catch(...){
1848 if(ierr) *ierr = 1;
1849 }
1850 }
1851
gmshModelMeshSetReverse(const int dim,const int tag,const int val,int * ierr)1852 GMSH_API void gmshModelMeshSetReverse(const int dim, const int tag, const int val, int * ierr)
1853 {
1854 if(ierr) *ierr = 0;
1855 try {
1856 gmsh::model::mesh::setReverse(dim, tag, val);
1857 }
1858 catch(...){
1859 if(ierr) *ierr = 1;
1860 }
1861 }
1862
gmshModelMeshSetAlgorithm(const int dim,const int tag,const int val,int * ierr)1863 GMSH_API void gmshModelMeshSetAlgorithm(const int dim, const int tag, const int val, int * ierr)
1864 {
1865 if(ierr) *ierr = 0;
1866 try {
1867 gmsh::model::mesh::setAlgorithm(dim, tag, val);
1868 }
1869 catch(...){
1870 if(ierr) *ierr = 1;
1871 }
1872 }
1873
gmshModelMeshSetSizeFromBoundary(const int dim,const int tag,const int val,int * ierr)1874 GMSH_API void gmshModelMeshSetSizeFromBoundary(const int dim, const int tag, const int val, int * ierr)
1875 {
1876 if(ierr) *ierr = 0;
1877 try {
1878 gmsh::model::mesh::setSizeFromBoundary(dim, tag, val);
1879 }
1880 catch(...){
1881 if(ierr) *ierr = 1;
1882 }
1883 }
1884
gmshModelMeshSetCompound(const int dim,int * tags,size_t tags_n,int * ierr)1885 GMSH_API void gmshModelMeshSetCompound(const int dim, int * tags, size_t tags_n, int * ierr)
1886 {
1887 if(ierr) *ierr = 0;
1888 try {
1889 std::vector<int> api_tags_(tags, tags + tags_n);
1890 gmsh::model::mesh::setCompound(dim, api_tags_);
1891 }
1892 catch(...){
1893 if(ierr) *ierr = 1;
1894 }
1895 }
1896
gmshModelMeshSetOutwardOrientation(const int tag,int * ierr)1897 GMSH_API void gmshModelMeshSetOutwardOrientation(const int tag, int * ierr)
1898 {
1899 if(ierr) *ierr = 0;
1900 try {
1901 gmsh::model::mesh::setOutwardOrientation(tag);
1902 }
1903 catch(...){
1904 if(ierr) *ierr = 1;
1905 }
1906 }
1907
gmshModelMeshRemoveConstraints(int * dimTags,size_t dimTags_n,int * ierr)1908 GMSH_API void gmshModelMeshRemoveConstraints(int * dimTags, size_t dimTags_n, int * ierr)
1909 {
1910 if(ierr) *ierr = 0;
1911 try {
1912 gmsh::vectorpair api_dimTags_(dimTags_n/2);
1913 for(size_t i = 0; i < dimTags_n/2; ++i){
1914 api_dimTags_[i].first = dimTags[i * 2 + 0];
1915 api_dimTags_[i].second = dimTags[i * 2 + 1];
1916 }
1917 gmsh::model::mesh::removeConstraints(api_dimTags_);
1918 }
1919 catch(...){
1920 if(ierr) *ierr = 1;
1921 }
1922 }
1923
gmshModelMeshEmbed(const int dim,int * tags,size_t tags_n,const int inDim,const int inTag,int * ierr)1924 GMSH_API void gmshModelMeshEmbed(const int dim, int * tags, size_t tags_n, const int inDim, const int inTag, int * ierr)
1925 {
1926 if(ierr) *ierr = 0;
1927 try {
1928 std::vector<int> api_tags_(tags, tags + tags_n);
1929 gmsh::model::mesh::embed(dim, api_tags_, inDim, inTag);
1930 }
1931 catch(...){
1932 if(ierr) *ierr = 1;
1933 }
1934 }
1935
gmshModelMeshRemoveEmbedded(int * dimTags,size_t dimTags_n,const int dim,int * ierr)1936 GMSH_API void gmshModelMeshRemoveEmbedded(int * dimTags, size_t dimTags_n, const int dim, int * ierr)
1937 {
1938 if(ierr) *ierr = 0;
1939 try {
1940 gmsh::vectorpair api_dimTags_(dimTags_n/2);
1941 for(size_t i = 0; i < dimTags_n/2; ++i){
1942 api_dimTags_[i].first = dimTags[i * 2 + 0];
1943 api_dimTags_[i].second = dimTags[i * 2 + 1];
1944 }
1945 gmsh::model::mesh::removeEmbedded(api_dimTags_, dim);
1946 }
1947 catch(...){
1948 if(ierr) *ierr = 1;
1949 }
1950 }
1951
gmshModelMeshGetEmbedded(const int dim,const int tag,int ** dimTags,size_t * dimTags_n,int * ierr)1952 GMSH_API void gmshModelMeshGetEmbedded(const int dim, const int tag, int ** dimTags, size_t * dimTags_n, int * ierr)
1953 {
1954 if(ierr) *ierr = 0;
1955 try {
1956 gmsh::vectorpair api_dimTags_;
1957 gmsh::model::mesh::getEmbedded(dim, tag, api_dimTags_);
1958 vectorpair2intptr(api_dimTags_, dimTags, dimTags_n);
1959 }
1960 catch(...){
1961 if(ierr) *ierr = 1;
1962 }
1963 }
1964
gmshModelMeshReorderElements(const int elementType,const int tag,size_t * ordering,size_t ordering_n,int * ierr)1965 GMSH_API void gmshModelMeshReorderElements(const int elementType, const int tag, size_t * ordering, size_t ordering_n, int * ierr)
1966 {
1967 if(ierr) *ierr = 0;
1968 try {
1969 std::vector<std::size_t> api_ordering_(ordering, ordering + ordering_n);
1970 gmsh::model::mesh::reorderElements(elementType, tag, api_ordering_);
1971 }
1972 catch(...){
1973 if(ierr) *ierr = 1;
1974 }
1975 }
1976
gmshModelMeshRenumberNodes(int * ierr)1977 GMSH_API void gmshModelMeshRenumberNodes(int * ierr)
1978 {
1979 if(ierr) *ierr = 0;
1980 try {
1981 gmsh::model::mesh::renumberNodes();
1982 }
1983 catch(...){
1984 if(ierr) *ierr = 1;
1985 }
1986 }
1987
gmshModelMeshRenumberElements(int * ierr)1988 GMSH_API void gmshModelMeshRenumberElements(int * ierr)
1989 {
1990 if(ierr) *ierr = 0;
1991 try {
1992 gmsh::model::mesh::renumberElements();
1993 }
1994 catch(...){
1995 if(ierr) *ierr = 1;
1996 }
1997 }
1998
gmshModelMeshSetPeriodic(const int dim,int * tags,size_t tags_n,int * tagsMaster,size_t tagsMaster_n,double * affineTransform,size_t affineTransform_n,int * ierr)1999 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)
2000 {
2001 if(ierr) *ierr = 0;
2002 try {
2003 std::vector<int> api_tags_(tags, tags + tags_n);
2004 std::vector<int> api_tagsMaster_(tagsMaster, tagsMaster + tagsMaster_n);
2005 std::vector<double> api_affineTransform_(affineTransform, affineTransform + affineTransform_n);
2006 gmsh::model::mesh::setPeriodic(dim, api_tags_, api_tagsMaster_, api_affineTransform_);
2007 }
2008 catch(...){
2009 if(ierr) *ierr = 1;
2010 }
2011 }
2012
gmshModelMeshGetPeriodic(const int dim,int * tags,size_t tags_n,int ** tagMaster,size_t * tagMaster_n,int * ierr)2013 GMSH_API void gmshModelMeshGetPeriodic(const int dim, int * tags, size_t tags_n, int ** tagMaster, size_t * tagMaster_n, int * ierr)
2014 {
2015 if(ierr) *ierr = 0;
2016 try {
2017 std::vector<int> api_tags_(tags, tags + tags_n);
2018 std::vector<int> api_tagMaster_;
2019 gmsh::model::mesh::getPeriodic(dim, api_tags_, api_tagMaster_);
2020 vector2ptr(api_tagMaster_, tagMaster, tagMaster_n);
2021 }
2022 catch(...){
2023 if(ierr) *ierr = 1;
2024 }
2025 }
2026
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)2027 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)
2028 {
2029 if(ierr) *ierr = 0;
2030 try {
2031 std::vector<std::size_t> api_nodeTags_;
2032 std::vector<std::size_t> api_nodeTagsMaster_;
2033 std::vector<double> api_affineTransform_;
2034 gmsh::model::mesh::getPeriodicNodes(dim, tag, *tagMaster, api_nodeTags_, api_nodeTagsMaster_, api_affineTransform_, includeHighOrderNodes);
2035 vector2ptr(api_nodeTags_, nodeTags, nodeTags_n);
2036 vector2ptr(api_nodeTagsMaster_, nodeTagsMaster, nodeTagsMaster_n);
2037 vector2ptr(api_affineTransform_, affineTransform, affineTransform_n);
2038 }
2039 catch(...){
2040 if(ierr) *ierr = 1;
2041 }
2042 }
2043
gmshModelMeshGetPeriodicKeys(const int elementType,const char * functionSpaceType,const int tag,int * tagMaster,int ** typeKeys,size_t * typeKeys_n,int ** typeKeysMaster,size_t * typeKeysMaster_n,size_t ** entityKeys,size_t * entityKeys_n,size_t ** entityKeysMaster,size_t * entityKeysMaster_n,double ** coord,size_t * coord_n,double ** coordMaster,size_t * coordMaster_n,const int returnCoord,int * ierr)2044 GMSH_API void gmshModelMeshGetPeriodicKeys(const int elementType, const char * functionSpaceType, const int tag, int * tagMaster, int ** typeKeys, size_t * typeKeys_n, int ** typeKeysMaster, size_t * typeKeysMaster_n, size_t ** entityKeys, size_t * entityKeys_n, size_t ** entityKeysMaster, size_t * entityKeysMaster_n, double ** coord, size_t * coord_n, double ** coordMaster, size_t * coordMaster_n, const int returnCoord, int * ierr)
2045 {
2046 if(ierr) *ierr = 0;
2047 try {
2048 std::vector<int> api_typeKeys_;
2049 std::vector<int> api_typeKeysMaster_;
2050 std::vector<std::size_t> api_entityKeys_;
2051 std::vector<std::size_t> api_entityKeysMaster_;
2052 std::vector<double> api_coord_;
2053 std::vector<double> api_coordMaster_;
2054 gmsh::model::mesh::getPeriodicKeys(elementType, functionSpaceType, tag, *tagMaster, api_typeKeys_, api_typeKeysMaster_, api_entityKeys_, api_entityKeysMaster_, api_coord_, api_coordMaster_, returnCoord);
2055 vector2ptr(api_typeKeys_, typeKeys, typeKeys_n);
2056 vector2ptr(api_typeKeysMaster_, typeKeysMaster, typeKeysMaster_n);
2057 vector2ptr(api_entityKeys_, entityKeys, entityKeys_n);
2058 vector2ptr(api_entityKeysMaster_, entityKeysMaster, entityKeysMaster_n);
2059 vector2ptr(api_coord_, coord, coord_n);
2060 vector2ptr(api_coordMaster_, coordMaster, coordMaster_n);
2061 }
2062 catch(...){
2063 if(ierr) *ierr = 1;
2064 }
2065 }
2066
gmshModelMeshRemoveDuplicateNodes(int * ierr)2067 GMSH_API void gmshModelMeshRemoveDuplicateNodes(int * ierr)
2068 {
2069 if(ierr) *ierr = 0;
2070 try {
2071 gmsh::model::mesh::removeDuplicateNodes();
2072 }
2073 catch(...){
2074 if(ierr) *ierr = 1;
2075 }
2076 }
2077
gmshModelMeshSplitQuadrangles(const double quality,const int tag,int * ierr)2078 GMSH_API void gmshModelMeshSplitQuadrangles(const double quality, const int tag, int * ierr)
2079 {
2080 if(ierr) *ierr = 0;
2081 try {
2082 gmsh::model::mesh::splitQuadrangles(quality, tag);
2083 }
2084 catch(...){
2085 if(ierr) *ierr = 1;
2086 }
2087 }
2088
gmshModelMeshClassifySurfaces(const double angle,const int boundary,const int forReparametrization,const double curveAngle,const int exportDiscrete,int * ierr)2089 GMSH_API void gmshModelMeshClassifySurfaces(const double angle, const int boundary, const int forReparametrization, const double curveAngle, const int exportDiscrete, int * ierr)
2090 {
2091 if(ierr) *ierr = 0;
2092 try {
2093 gmsh::model::mesh::classifySurfaces(angle, boundary, forReparametrization, curveAngle, exportDiscrete);
2094 }
2095 catch(...){
2096 if(ierr) *ierr = 1;
2097 }
2098 }
2099
gmshModelMeshCreateGeometry(int * dimTags,size_t dimTags_n,int * ierr)2100 GMSH_API void gmshModelMeshCreateGeometry(int * dimTags, size_t dimTags_n, int * ierr)
2101 {
2102 if(ierr) *ierr = 0;
2103 try {
2104 gmsh::vectorpair api_dimTags_(dimTags_n/2);
2105 for(size_t i = 0; i < dimTags_n/2; ++i){
2106 api_dimTags_[i].first = dimTags[i * 2 + 0];
2107 api_dimTags_[i].second = dimTags[i * 2 + 1];
2108 }
2109 gmsh::model::mesh::createGeometry(api_dimTags_);
2110 }
2111 catch(...){
2112 if(ierr) *ierr = 1;
2113 }
2114 }
2115
gmshModelMeshCreateTopology(const int makeSimplyConnected,const int exportDiscrete,int * ierr)2116 GMSH_API void gmshModelMeshCreateTopology(const int makeSimplyConnected, const int exportDiscrete, int * ierr)
2117 {
2118 if(ierr) *ierr = 0;
2119 try {
2120 gmsh::model::mesh::createTopology(makeSimplyConnected, exportDiscrete);
2121 }
2122 catch(...){
2123 if(ierr) *ierr = 1;
2124 }
2125 }
2126
gmshModelMeshComputeHomology(int * domainTags,size_t domainTags_n,int * subdomainTags,size_t subdomainTags_n,int * dims,size_t dims_n,int * ierr)2127 GMSH_API void gmshModelMeshComputeHomology(int * domainTags, size_t domainTags_n, int * subdomainTags, size_t subdomainTags_n, int * dims, size_t dims_n, int * ierr)
2128 {
2129 if(ierr) *ierr = 0;
2130 try {
2131 std::vector<int> api_domainTags_(domainTags, domainTags + domainTags_n);
2132 std::vector<int> api_subdomainTags_(subdomainTags, subdomainTags + subdomainTags_n);
2133 std::vector<int> api_dims_(dims, dims + dims_n);
2134 gmsh::model::mesh::computeHomology(api_domainTags_, api_subdomainTags_, api_dims_);
2135 }
2136 catch(...){
2137 if(ierr) *ierr = 1;
2138 }
2139 }
2140
gmshModelMeshComputeCohomology(int * domainTags,size_t domainTags_n,int * subdomainTags,size_t subdomainTags_n,int * dims,size_t dims_n,int * ierr)2141 GMSH_API void gmshModelMeshComputeCohomology(int * domainTags, size_t domainTags_n, int * subdomainTags, size_t subdomainTags_n, int * dims, size_t dims_n, int * ierr)
2142 {
2143 if(ierr) *ierr = 0;
2144 try {
2145 std::vector<int> api_domainTags_(domainTags, domainTags + domainTags_n);
2146 std::vector<int> api_subdomainTags_(subdomainTags, subdomainTags + subdomainTags_n);
2147 std::vector<int> api_dims_(dims, dims + dims_n);
2148 gmsh::model::mesh::computeCohomology(api_domainTags_, api_subdomainTags_, api_dims_);
2149 }
2150 catch(...){
2151 if(ierr) *ierr = 1;
2152 }
2153 }
2154
gmshModelMeshComputeCrossField(int ** viewTags,size_t * viewTags_n,int * ierr)2155 GMSH_API void gmshModelMeshComputeCrossField(int ** viewTags, size_t * viewTags_n, int * ierr)
2156 {
2157 if(ierr) *ierr = 0;
2158 try {
2159 std::vector<int> api_viewTags_;
2160 gmsh::model::mesh::computeCrossField(api_viewTags_);
2161 vector2ptr(api_viewTags_, viewTags, viewTags_n);
2162 }
2163 catch(...){
2164 if(ierr) *ierr = 1;
2165 }
2166 }
2167
gmshModelMeshTriangulate(double * coord,size_t coord_n,size_t ** tri,size_t * tri_n,int * ierr)2168 GMSH_API void gmshModelMeshTriangulate(double * coord, size_t coord_n, size_t ** tri, size_t * tri_n, int * ierr)
2169 {
2170 if(ierr) *ierr = 0;
2171 try {
2172 std::vector<double> api_coord_(coord, coord + coord_n);
2173 std::vector<std::size_t> api_tri_;
2174 gmsh::model::mesh::triangulate(api_coord_, api_tri_);
2175 vector2ptr(api_tri_, tri, tri_n);
2176 }
2177 catch(...){
2178 if(ierr) *ierr = 1;
2179 }
2180 }
2181
gmshModelMeshTetrahedralize(double * coord,size_t coord_n,size_t ** tetra,size_t * tetra_n,int * ierr)2182 GMSH_API void gmshModelMeshTetrahedralize(double * coord, size_t coord_n, size_t ** tetra, size_t * tetra_n, int * ierr)
2183 {
2184 if(ierr) *ierr = 0;
2185 try {
2186 std::vector<double> api_coord_(coord, coord + coord_n);
2187 std::vector<std::size_t> api_tetra_;
2188 gmsh::model::mesh::tetrahedralize(api_coord_, api_tetra_);
2189 vector2ptr(api_tetra_, tetra, tetra_n);
2190 }
2191 catch(...){
2192 if(ierr) *ierr = 1;
2193 }
2194 }
2195
gmshModelMeshFieldAdd(const char * fieldType,const int tag,int * ierr)2196 GMSH_API int gmshModelMeshFieldAdd(const char * fieldType, const int tag, int * ierr)
2197 {
2198 int result_api_ = 0;
2199 if(ierr) *ierr = 0;
2200 try {
2201 result_api_ = gmsh::model::mesh::field::add(fieldType, tag);
2202 }
2203 catch(...){
2204 if(ierr) *ierr = 1;
2205 }
2206 return result_api_;
2207 }
2208
gmshModelMeshFieldRemove(const int tag,int * ierr)2209 GMSH_API void gmshModelMeshFieldRemove(const int tag, int * ierr)
2210 {
2211 if(ierr) *ierr = 0;
2212 try {
2213 gmsh::model::mesh::field::remove(tag);
2214 }
2215 catch(...){
2216 if(ierr) *ierr = 1;
2217 }
2218 }
2219
gmshModelMeshFieldList(int ** tags,size_t * tags_n,int * ierr)2220 GMSH_API void gmshModelMeshFieldList(int ** tags, size_t * tags_n, int * ierr)
2221 {
2222 if(ierr) *ierr = 0;
2223 try {
2224 std::vector<int> api_tags_;
2225 gmsh::model::mesh::field::list(api_tags_);
2226 vector2ptr(api_tags_, tags, tags_n);
2227 }
2228 catch(...){
2229 if(ierr) *ierr = 1;
2230 }
2231 }
2232
gmshModelMeshFieldGetType(const int tag,char ** fileType,int * ierr)2233 GMSH_API void gmshModelMeshFieldGetType(const int tag, char ** fileType, int * ierr)
2234 {
2235 if(ierr) *ierr = 0;
2236 try {
2237 std::string api_fileType_;
2238 gmsh::model::mesh::field::getType(tag, api_fileType_);
2239 *fileType = strdup(api_fileType_.c_str());
2240 }
2241 catch(...){
2242 if(ierr) *ierr = 1;
2243 }
2244 }
2245
gmshModelMeshFieldSetNumber(const int tag,const char * option,const double value,int * ierr)2246 GMSH_API void gmshModelMeshFieldSetNumber(const int tag, const char * option, const double value, int * ierr)
2247 {
2248 if(ierr) *ierr = 0;
2249 try {
2250 gmsh::model::mesh::field::setNumber(tag, option, value);
2251 }
2252 catch(...){
2253 if(ierr) *ierr = 1;
2254 }
2255 }
2256
gmshModelMeshFieldGetNumber(const int tag,const char * option,double * value,int * ierr)2257 GMSH_API void gmshModelMeshFieldGetNumber(const int tag, const char * option, double * value, int * ierr)
2258 {
2259 if(ierr) *ierr = 0;
2260 try {
2261 gmsh::model::mesh::field::getNumber(tag, option, *value);
2262 }
2263 catch(...){
2264 if(ierr) *ierr = 1;
2265 }
2266 }
2267
gmshModelMeshFieldSetString(const int tag,const char * option,const char * value,int * ierr)2268 GMSH_API void gmshModelMeshFieldSetString(const int tag, const char * option, const char * value, int * ierr)
2269 {
2270 if(ierr) *ierr = 0;
2271 try {
2272 gmsh::model::mesh::field::setString(tag, option, value);
2273 }
2274 catch(...){
2275 if(ierr) *ierr = 1;
2276 }
2277 }
2278
gmshModelMeshFieldGetString(const int tag,const char * option,char ** value,int * ierr)2279 GMSH_API void gmshModelMeshFieldGetString(const int tag, const char * option, char ** value, int * ierr)
2280 {
2281 if(ierr) *ierr = 0;
2282 try {
2283 std::string api_value_;
2284 gmsh::model::mesh::field::getString(tag, option, api_value_);
2285 *value = strdup(api_value_.c_str());
2286 }
2287 catch(...){
2288 if(ierr) *ierr = 1;
2289 }
2290 }
2291
gmshModelMeshFieldSetNumbers(const int tag,const char * option,double * value,size_t value_n,int * ierr)2292 GMSH_API void gmshModelMeshFieldSetNumbers(const int tag, const char * option, double * value, size_t value_n, int * ierr)
2293 {
2294 if(ierr) *ierr = 0;
2295 try {
2296 std::vector<double> api_value_(value, value + value_n);
2297 gmsh::model::mesh::field::setNumbers(tag, option, api_value_);
2298 }
2299 catch(...){
2300 if(ierr) *ierr = 1;
2301 }
2302 }
2303
gmshModelMeshFieldGetNumbers(const int tag,const char * option,double ** value,size_t * value_n,int * ierr)2304 GMSH_API void gmshModelMeshFieldGetNumbers(const int tag, const char * option, double ** value, size_t * value_n, int * ierr)
2305 {
2306 if(ierr) *ierr = 0;
2307 try {
2308 std::vector<double> api_value_;
2309 gmsh::model::mesh::field::getNumbers(tag, option, api_value_);
2310 vector2ptr(api_value_, value, value_n);
2311 }
2312 catch(...){
2313 if(ierr) *ierr = 1;
2314 }
2315 }
2316
gmshModelMeshFieldSetAsBackgroundMesh(const int tag,int * ierr)2317 GMSH_API void gmshModelMeshFieldSetAsBackgroundMesh(const int tag, int * ierr)
2318 {
2319 if(ierr) *ierr = 0;
2320 try {
2321 gmsh::model::mesh::field::setAsBackgroundMesh(tag);
2322 }
2323 catch(...){
2324 if(ierr) *ierr = 1;
2325 }
2326 }
2327
gmshModelMeshFieldSetAsBoundaryLayer(const int tag,int * ierr)2328 GMSH_API void gmshModelMeshFieldSetAsBoundaryLayer(const int tag, int * ierr)
2329 {
2330 if(ierr) *ierr = 0;
2331 try {
2332 gmsh::model::mesh::field::setAsBoundaryLayer(tag);
2333 }
2334 catch(...){
2335 if(ierr) *ierr = 1;
2336 }
2337 }
2338
gmshModelGeoAddPoint(const double x,const double y,const double z,const double meshSize,const int tag,int * ierr)2339 GMSH_API int gmshModelGeoAddPoint(const double x, const double y, const double z, const double meshSize, const int tag, int * ierr)
2340 {
2341 int result_api_ = 0;
2342 if(ierr) *ierr = 0;
2343 try {
2344 result_api_ = gmsh::model::geo::addPoint(x, y, z, meshSize, tag);
2345 }
2346 catch(...){
2347 if(ierr) *ierr = 1;
2348 }
2349 return result_api_;
2350 }
2351
gmshModelGeoAddLine(const int startTag,const int endTag,const int tag,int * ierr)2352 GMSH_API int gmshModelGeoAddLine(const int startTag, const int endTag, const int tag, int * ierr)
2353 {
2354 int result_api_ = 0;
2355 if(ierr) *ierr = 0;
2356 try {
2357 result_api_ = gmsh::model::geo::addLine(startTag, endTag, tag);
2358 }
2359 catch(...){
2360 if(ierr) *ierr = 1;
2361 }
2362 return result_api_;
2363 }
2364
gmshModelGeoAddCircleArc(const int startTag,const int centerTag,const int endTag,const int tag,const double nx,const double ny,const double nz,int * ierr)2365 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)
2366 {
2367 int result_api_ = 0;
2368 if(ierr) *ierr = 0;
2369 try {
2370 result_api_ = gmsh::model::geo::addCircleArc(startTag, centerTag, endTag, tag, nx, ny, nz);
2371 }
2372 catch(...){
2373 if(ierr) *ierr = 1;
2374 }
2375 return result_api_;
2376 }
2377
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)2378 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)
2379 {
2380 int result_api_ = 0;
2381 if(ierr) *ierr = 0;
2382 try {
2383 result_api_ = gmsh::model::geo::addEllipseArc(startTag, centerTag, majorTag, endTag, tag, nx, ny, nz);
2384 }
2385 catch(...){
2386 if(ierr) *ierr = 1;
2387 }
2388 return result_api_;
2389 }
2390
gmshModelGeoAddSpline(int * pointTags,size_t pointTags_n,const int tag,int * ierr)2391 GMSH_API int gmshModelGeoAddSpline(int * pointTags, size_t pointTags_n, const int tag, int * ierr)
2392 {
2393 int result_api_ = 0;
2394 if(ierr) *ierr = 0;
2395 try {
2396 std::vector<int> api_pointTags_(pointTags, pointTags + pointTags_n);
2397 result_api_ = gmsh::model::geo::addSpline(api_pointTags_, tag);
2398 }
2399 catch(...){
2400 if(ierr) *ierr = 1;
2401 }
2402 return result_api_;
2403 }
2404
gmshModelGeoAddBSpline(int * pointTags,size_t pointTags_n,const int tag,int * ierr)2405 GMSH_API int gmshModelGeoAddBSpline(int * pointTags, size_t pointTags_n, const int tag, int * ierr)
2406 {
2407 int result_api_ = 0;
2408 if(ierr) *ierr = 0;
2409 try {
2410 std::vector<int> api_pointTags_(pointTags, pointTags + pointTags_n);
2411 result_api_ = gmsh::model::geo::addBSpline(api_pointTags_, tag);
2412 }
2413 catch(...){
2414 if(ierr) *ierr = 1;
2415 }
2416 return result_api_;
2417 }
2418
gmshModelGeoAddBezier(int * pointTags,size_t pointTags_n,const int tag,int * ierr)2419 GMSH_API int gmshModelGeoAddBezier(int * pointTags, size_t pointTags_n, const int tag, int * ierr)
2420 {
2421 int result_api_ = 0;
2422 if(ierr) *ierr = 0;
2423 try {
2424 std::vector<int> api_pointTags_(pointTags, pointTags + pointTags_n);
2425 result_api_ = gmsh::model::geo::addBezier(api_pointTags_, tag);
2426 }
2427 catch(...){
2428 if(ierr) *ierr = 1;
2429 }
2430 return result_api_;
2431 }
2432
gmshModelGeoAddPolyline(int * pointTags,size_t pointTags_n,const int tag,int * ierr)2433 GMSH_API int gmshModelGeoAddPolyline(int * pointTags, size_t pointTags_n, const int tag, int * ierr)
2434 {
2435 int result_api_ = 0;
2436 if(ierr) *ierr = 0;
2437 try {
2438 std::vector<int> api_pointTags_(pointTags, pointTags + pointTags_n);
2439 result_api_ = gmsh::model::geo::addPolyline(api_pointTags_, tag);
2440 }
2441 catch(...){
2442 if(ierr) *ierr = 1;
2443 }
2444 return result_api_;
2445 }
2446
gmshModelGeoAddCompoundSpline(int * curveTags,size_t curveTags_n,const int numIntervals,const int tag,int * ierr)2447 GMSH_API int gmshModelGeoAddCompoundSpline(int * curveTags, size_t curveTags_n, const int numIntervals, const int tag, int * ierr)
2448 {
2449 int result_api_ = 0;
2450 if(ierr) *ierr = 0;
2451 try {
2452 std::vector<int> api_curveTags_(curveTags, curveTags + curveTags_n);
2453 result_api_ = gmsh::model::geo::addCompoundSpline(api_curveTags_, numIntervals, tag);
2454 }
2455 catch(...){
2456 if(ierr) *ierr = 1;
2457 }
2458 return result_api_;
2459 }
2460
gmshModelGeoAddCompoundBSpline(int * curveTags,size_t curveTags_n,const int numIntervals,const int tag,int * ierr)2461 GMSH_API int gmshModelGeoAddCompoundBSpline(int * curveTags, size_t curveTags_n, const int numIntervals, const int tag, int * ierr)
2462 {
2463 int result_api_ = 0;
2464 if(ierr) *ierr = 0;
2465 try {
2466 std::vector<int> api_curveTags_(curveTags, curveTags + curveTags_n);
2467 result_api_ = gmsh::model::geo::addCompoundBSpline(api_curveTags_, numIntervals, tag);
2468 }
2469 catch(...){
2470 if(ierr) *ierr = 1;
2471 }
2472 return result_api_;
2473 }
2474
gmshModelGeoAddCurveLoop(int * curveTags,size_t curveTags_n,const int tag,const int reorient,int * ierr)2475 GMSH_API int gmshModelGeoAddCurveLoop(int * curveTags, size_t curveTags_n, const int tag, const int reorient, int * ierr)
2476 {
2477 int result_api_ = 0;
2478 if(ierr) *ierr = 0;
2479 try {
2480 std::vector<int> api_curveTags_(curveTags, curveTags + curveTags_n);
2481 result_api_ = gmsh::model::geo::addCurveLoop(api_curveTags_, tag, reorient);
2482 }
2483 catch(...){
2484 if(ierr) *ierr = 1;
2485 }
2486 return result_api_;
2487 }
2488
gmshModelGeoAddCurveLoops(int * curveTags,size_t curveTags_n,int ** tags,size_t * tags_n,int * ierr)2489 GMSH_API void gmshModelGeoAddCurveLoops(int * curveTags, size_t curveTags_n, int ** tags, size_t * tags_n, int * ierr)
2490 {
2491 if(ierr) *ierr = 0;
2492 try {
2493 std::vector<int> api_curveTags_(curveTags, curveTags + curveTags_n);
2494 std::vector<int> api_tags_;
2495 gmsh::model::geo::addCurveLoops(api_curveTags_, api_tags_);
2496 vector2ptr(api_tags_, tags, tags_n);
2497 }
2498 catch(...){
2499 if(ierr) *ierr = 1;
2500 }
2501 }
2502
gmshModelGeoAddPlaneSurface(int * wireTags,size_t wireTags_n,const int tag,int * ierr)2503 GMSH_API int gmshModelGeoAddPlaneSurface(int * wireTags, size_t wireTags_n, const int tag, int * ierr)
2504 {
2505 int result_api_ = 0;
2506 if(ierr) *ierr = 0;
2507 try {
2508 std::vector<int> api_wireTags_(wireTags, wireTags + wireTags_n);
2509 result_api_ = gmsh::model::geo::addPlaneSurface(api_wireTags_, tag);
2510 }
2511 catch(...){
2512 if(ierr) *ierr = 1;
2513 }
2514 return result_api_;
2515 }
2516
gmshModelGeoAddSurfaceFilling(int * wireTags,size_t wireTags_n,const int tag,const int sphereCenterTag,int * ierr)2517 GMSH_API int gmshModelGeoAddSurfaceFilling(int * wireTags, size_t wireTags_n, const int tag, const int sphereCenterTag, int * ierr)
2518 {
2519 int result_api_ = 0;
2520 if(ierr) *ierr = 0;
2521 try {
2522 std::vector<int> api_wireTags_(wireTags, wireTags + wireTags_n);
2523 result_api_ = gmsh::model::geo::addSurfaceFilling(api_wireTags_, tag, sphereCenterTag);
2524 }
2525 catch(...){
2526 if(ierr) *ierr = 1;
2527 }
2528 return result_api_;
2529 }
2530
gmshModelGeoAddSurfaceLoop(int * surfaceTags,size_t surfaceTags_n,const int tag,int * ierr)2531 GMSH_API int gmshModelGeoAddSurfaceLoop(int * surfaceTags, size_t surfaceTags_n, const int tag, int * ierr)
2532 {
2533 int result_api_ = 0;
2534 if(ierr) *ierr = 0;
2535 try {
2536 std::vector<int> api_surfaceTags_(surfaceTags, surfaceTags + surfaceTags_n);
2537 result_api_ = gmsh::model::geo::addSurfaceLoop(api_surfaceTags_, tag);
2538 }
2539 catch(...){
2540 if(ierr) *ierr = 1;
2541 }
2542 return result_api_;
2543 }
2544
gmshModelGeoAddVolume(int * shellTags,size_t shellTags_n,const int tag,int * ierr)2545 GMSH_API int gmshModelGeoAddVolume(int * shellTags, size_t shellTags_n, const int tag, int * ierr)
2546 {
2547 int result_api_ = 0;
2548 if(ierr) *ierr = 0;
2549 try {
2550 std::vector<int> api_shellTags_(shellTags, shellTags + shellTags_n);
2551 result_api_ = gmsh::model::geo::addVolume(api_shellTags_, tag);
2552 }
2553 catch(...){
2554 if(ierr) *ierr = 1;
2555 }
2556 return result_api_;
2557 }
2558
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)2559 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)
2560 {
2561 if(ierr) *ierr = 0;
2562 try {
2563 gmsh::vectorpair api_dimTags_(dimTags_n/2);
2564 for(size_t i = 0; i < dimTags_n/2; ++i){
2565 api_dimTags_[i].first = dimTags[i * 2 + 0];
2566 api_dimTags_[i].second = dimTags[i * 2 + 1];
2567 }
2568 gmsh::vectorpair api_outDimTags_;
2569 std::vector<int> api_numElements_(numElements, numElements + numElements_n);
2570 std::vector<double> api_heights_(heights, heights + heights_n);
2571 gmsh::model::geo::extrude(api_dimTags_, dx, dy, dz, api_outDimTags_, api_numElements_, api_heights_, recombine);
2572 vectorpair2intptr(api_outDimTags_, outDimTags, outDimTags_n);
2573 }
2574 catch(...){
2575 if(ierr) *ierr = 1;
2576 }
2577 }
2578
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)2579 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)
2580 {
2581 if(ierr) *ierr = 0;
2582 try {
2583 gmsh::vectorpair api_dimTags_(dimTags_n/2);
2584 for(size_t i = 0; i < dimTags_n/2; ++i){
2585 api_dimTags_[i].first = dimTags[i * 2 + 0];
2586 api_dimTags_[i].second = dimTags[i * 2 + 1];
2587 }
2588 gmsh::vectorpair api_outDimTags_;
2589 std::vector<int> api_numElements_(numElements, numElements + numElements_n);
2590 std::vector<double> api_heights_(heights, heights + heights_n);
2591 gmsh::model::geo::revolve(api_dimTags_, x, y, z, ax, ay, az, angle, api_outDimTags_, api_numElements_, api_heights_, recombine);
2592 vectorpair2intptr(api_outDimTags_, outDimTags, outDimTags_n);
2593 }
2594 catch(...){
2595 if(ierr) *ierr = 1;
2596 }
2597 }
2598
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)2599 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)
2600 {
2601 if(ierr) *ierr = 0;
2602 try {
2603 gmsh::vectorpair api_dimTags_(dimTags_n/2);
2604 for(size_t i = 0; i < dimTags_n/2; ++i){
2605 api_dimTags_[i].first = dimTags[i * 2 + 0];
2606 api_dimTags_[i].second = dimTags[i * 2 + 1];
2607 }
2608 gmsh::vectorpair api_outDimTags_;
2609 std::vector<int> api_numElements_(numElements, numElements + numElements_n);
2610 std::vector<double> api_heights_(heights, heights + heights_n);
2611 gmsh::model::geo::twist(api_dimTags_, x, y, z, dx, dy, dz, ax, ay, az, angle, api_outDimTags_, api_numElements_, api_heights_, recombine);
2612 vectorpair2intptr(api_outDimTags_, outDimTags, outDimTags_n);
2613 }
2614 catch(...){
2615 if(ierr) *ierr = 1;
2616 }
2617 }
2618
gmshModelGeoExtrudeBoundaryLayer(int * dimTags,size_t dimTags_n,int ** outDimTags,size_t * outDimTags_n,int * numElements,size_t numElements_n,double * heights,size_t heights_n,const int recombine,const int second,const int viewIndex,int * ierr)2619 GMSH_API void gmshModelGeoExtrudeBoundaryLayer(int * dimTags, size_t dimTags_n, int ** outDimTags, size_t * outDimTags_n, int * numElements, size_t numElements_n, double * heights, size_t heights_n, const int recombine, const int second, const int viewIndex, int * ierr)
2620 {
2621 if(ierr) *ierr = 0;
2622 try {
2623 gmsh::vectorpair api_dimTags_(dimTags_n/2);
2624 for(size_t i = 0; i < dimTags_n/2; ++i){
2625 api_dimTags_[i].first = dimTags[i * 2 + 0];
2626 api_dimTags_[i].second = dimTags[i * 2 + 1];
2627 }
2628 gmsh::vectorpair api_outDimTags_;
2629 std::vector<int> api_numElements_(numElements, numElements + numElements_n);
2630 std::vector<double> api_heights_(heights, heights + heights_n);
2631 gmsh::model::geo::extrudeBoundaryLayer(api_dimTags_, api_outDimTags_, api_numElements_, api_heights_, recombine, second, viewIndex);
2632 vectorpair2intptr(api_outDimTags_, outDimTags, outDimTags_n);
2633 }
2634 catch(...){
2635 if(ierr) *ierr = 1;
2636 }
2637 }
2638
gmshModelGeoTranslate(int * dimTags,size_t dimTags_n,const double dx,const double dy,const double dz,int * ierr)2639 GMSH_API void gmshModelGeoTranslate(int * dimTags, size_t dimTags_n, const double dx, const double dy, const double dz, int * ierr)
2640 {
2641 if(ierr) *ierr = 0;
2642 try {
2643 gmsh::vectorpair api_dimTags_(dimTags_n/2);
2644 for(size_t i = 0; i < dimTags_n/2; ++i){
2645 api_dimTags_[i].first = dimTags[i * 2 + 0];
2646 api_dimTags_[i].second = dimTags[i * 2 + 1];
2647 }
2648 gmsh::model::geo::translate(api_dimTags_, dx, dy, dz);
2649 }
2650 catch(...){
2651 if(ierr) *ierr = 1;
2652 }
2653 }
2654
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)2655 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)
2656 {
2657 if(ierr) *ierr = 0;
2658 try {
2659 gmsh::vectorpair api_dimTags_(dimTags_n/2);
2660 for(size_t i = 0; i < dimTags_n/2; ++i){
2661 api_dimTags_[i].first = dimTags[i * 2 + 0];
2662 api_dimTags_[i].second = dimTags[i * 2 + 1];
2663 }
2664 gmsh::model::geo::rotate(api_dimTags_, x, y, z, ax, ay, az, angle);
2665 }
2666 catch(...){
2667 if(ierr) *ierr = 1;
2668 }
2669 }
2670
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)2671 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)
2672 {
2673 if(ierr) *ierr = 0;
2674 try {
2675 gmsh::vectorpair api_dimTags_(dimTags_n/2);
2676 for(size_t i = 0; i < dimTags_n/2; ++i){
2677 api_dimTags_[i].first = dimTags[i * 2 + 0];
2678 api_dimTags_[i].second = dimTags[i * 2 + 1];
2679 }
2680 gmsh::model::geo::dilate(api_dimTags_, x, y, z, a, b, c);
2681 }
2682 catch(...){
2683 if(ierr) *ierr = 1;
2684 }
2685 }
2686
gmshModelGeoMirror(int * dimTags,size_t dimTags_n,const double a,const double b,const double c,const double d,int * ierr)2687 GMSH_API void gmshModelGeoMirror(int * dimTags, size_t dimTags_n, const double a, const double b, const double c, const double d, int * ierr)
2688 {
2689 if(ierr) *ierr = 0;
2690 try {
2691 gmsh::vectorpair api_dimTags_(dimTags_n/2);
2692 for(size_t i = 0; i < dimTags_n/2; ++i){
2693 api_dimTags_[i].first = dimTags[i * 2 + 0];
2694 api_dimTags_[i].second = dimTags[i * 2 + 1];
2695 }
2696 gmsh::model::geo::mirror(api_dimTags_, a, b, c, d);
2697 }
2698 catch(...){
2699 if(ierr) *ierr = 1;
2700 }
2701 }
2702
gmshModelGeoSymmetrize(int * dimTags,size_t dimTags_n,const double a,const double b,const double c,const double d,int * ierr)2703 GMSH_API void gmshModelGeoSymmetrize(int * dimTags, size_t dimTags_n, const double a, const double b, const double c, const double d, int * ierr)
2704 {
2705 if(ierr) *ierr = 0;
2706 try {
2707 gmsh::vectorpair api_dimTags_(dimTags_n/2);
2708 for(size_t i = 0; i < dimTags_n/2; ++i){
2709 api_dimTags_[i].first = dimTags[i * 2 + 0];
2710 api_dimTags_[i].second = dimTags[i * 2 + 1];
2711 }
2712 gmsh::model::geo::symmetrize(api_dimTags_, a, b, c, d);
2713 }
2714 catch(...){
2715 if(ierr) *ierr = 1;
2716 }
2717 }
2718
gmshModelGeoCopy(int * dimTags,size_t dimTags_n,int ** outDimTags,size_t * outDimTags_n,int * ierr)2719 GMSH_API void gmshModelGeoCopy(int * dimTags, size_t dimTags_n, int ** outDimTags, size_t * outDimTags_n, int * ierr)
2720 {
2721 if(ierr) *ierr = 0;
2722 try {
2723 gmsh::vectorpair api_dimTags_(dimTags_n/2);
2724 for(size_t i = 0; i < dimTags_n/2; ++i){
2725 api_dimTags_[i].first = dimTags[i * 2 + 0];
2726 api_dimTags_[i].second = dimTags[i * 2 + 1];
2727 }
2728 gmsh::vectorpair api_outDimTags_;
2729 gmsh::model::geo::copy(api_dimTags_, api_outDimTags_);
2730 vectorpair2intptr(api_outDimTags_, outDimTags, outDimTags_n);
2731 }
2732 catch(...){
2733 if(ierr) *ierr = 1;
2734 }
2735 }
2736
gmshModelGeoRemove(int * dimTags,size_t dimTags_n,const int recursive,int * ierr)2737 GMSH_API void gmshModelGeoRemove(int * dimTags, size_t dimTags_n, const int recursive, int * ierr)
2738 {
2739 if(ierr) *ierr = 0;
2740 try {
2741 gmsh::vectorpair api_dimTags_(dimTags_n/2);
2742 for(size_t i = 0; i < dimTags_n/2; ++i){
2743 api_dimTags_[i].first = dimTags[i * 2 + 0];
2744 api_dimTags_[i].second = dimTags[i * 2 + 1];
2745 }
2746 gmsh::model::geo::remove(api_dimTags_, recursive);
2747 }
2748 catch(...){
2749 if(ierr) *ierr = 1;
2750 }
2751 }
2752
gmshModelGeoRemoveAllDuplicates(int * ierr)2753 GMSH_API void gmshModelGeoRemoveAllDuplicates(int * ierr)
2754 {
2755 if(ierr) *ierr = 0;
2756 try {
2757 gmsh::model::geo::removeAllDuplicates();
2758 }
2759 catch(...){
2760 if(ierr) *ierr = 1;
2761 }
2762 }
2763
gmshModelGeoSplitCurve(const int tag,int * pointTags,size_t pointTags_n,int ** curveTags,size_t * curveTags_n,int * ierr)2764 GMSH_API void gmshModelGeoSplitCurve(const int tag, int * pointTags, size_t pointTags_n, int ** curveTags, size_t * curveTags_n, int * ierr)
2765 {
2766 if(ierr) *ierr = 0;
2767 try {
2768 std::vector<int> api_pointTags_(pointTags, pointTags + pointTags_n);
2769 std::vector<int> api_curveTags_;
2770 gmsh::model::geo::splitCurve(tag, api_pointTags_, api_curveTags_);
2771 vector2ptr(api_curveTags_, curveTags, curveTags_n);
2772 }
2773 catch(...){
2774 if(ierr) *ierr = 1;
2775 }
2776 }
2777
gmshModelGeoGetMaxTag(const int dim,int * ierr)2778 GMSH_API int gmshModelGeoGetMaxTag(const int dim, int * ierr)
2779 {
2780 int result_api_ = 0;
2781 if(ierr) *ierr = 0;
2782 try {
2783 result_api_ = gmsh::model::geo::getMaxTag(dim);
2784 }
2785 catch(...){
2786 if(ierr) *ierr = 1;
2787 }
2788 return result_api_;
2789 }
2790
gmshModelGeoSetMaxTag(const int dim,const int maxTag,int * ierr)2791 GMSH_API void gmshModelGeoSetMaxTag(const int dim, const int maxTag, int * ierr)
2792 {
2793 if(ierr) *ierr = 0;
2794 try {
2795 gmsh::model::geo::setMaxTag(dim, maxTag);
2796 }
2797 catch(...){
2798 if(ierr) *ierr = 1;
2799 }
2800 }
2801
gmshModelGeoAddPhysicalGroup(const int dim,int * tags,size_t tags_n,const int tag,int * ierr)2802 GMSH_API int gmshModelGeoAddPhysicalGroup(const int dim, int * tags, size_t tags_n, const int tag, int * ierr)
2803 {
2804 int result_api_ = 0;
2805 if(ierr) *ierr = 0;
2806 try {
2807 std::vector<int> api_tags_(tags, tags + tags_n);
2808 result_api_ = gmsh::model::geo::addPhysicalGroup(dim, api_tags_, tag);
2809 }
2810 catch(...){
2811 if(ierr) *ierr = 1;
2812 }
2813 return result_api_;
2814 }
2815
gmshModelGeoRemovePhysicalGroups(int * dimTags,size_t dimTags_n,int * ierr)2816 GMSH_API void gmshModelGeoRemovePhysicalGroups(int * dimTags, size_t dimTags_n, int * ierr)
2817 {
2818 if(ierr) *ierr = 0;
2819 try {
2820 gmsh::vectorpair api_dimTags_(dimTags_n/2);
2821 for(size_t i = 0; i < dimTags_n/2; ++i){
2822 api_dimTags_[i].first = dimTags[i * 2 + 0];
2823 api_dimTags_[i].second = dimTags[i * 2 + 1];
2824 }
2825 gmsh::model::geo::removePhysicalGroups(api_dimTags_);
2826 }
2827 catch(...){
2828 if(ierr) *ierr = 1;
2829 }
2830 }
2831
gmshModelGeoSynchronize(int * ierr)2832 GMSH_API void gmshModelGeoSynchronize(int * ierr)
2833 {
2834 if(ierr) *ierr = 0;
2835 try {
2836 gmsh::model::geo::synchronize();
2837 }
2838 catch(...){
2839 if(ierr) *ierr = 1;
2840 }
2841 }
2842
gmshModelGeoMeshSetSize(int * dimTags,size_t dimTags_n,const double size,int * ierr)2843 GMSH_API void gmshModelGeoMeshSetSize(int * dimTags, size_t dimTags_n, const double size, int * ierr)
2844 {
2845 if(ierr) *ierr = 0;
2846 try {
2847 gmsh::vectorpair api_dimTags_(dimTags_n/2);
2848 for(size_t i = 0; i < dimTags_n/2; ++i){
2849 api_dimTags_[i].first = dimTags[i * 2 + 0];
2850 api_dimTags_[i].second = dimTags[i * 2 + 1];
2851 }
2852 gmsh::model::geo::mesh::setSize(api_dimTags_, size);
2853 }
2854 catch(...){
2855 if(ierr) *ierr = 1;
2856 }
2857 }
2858
gmshModelGeoMeshSetTransfiniteCurve(const int tag,const int nPoints,const char * meshType,const double coef,int * ierr)2859 GMSH_API void gmshModelGeoMeshSetTransfiniteCurve(const int tag, const int nPoints, const char * meshType, const double coef, int * ierr)
2860 {
2861 if(ierr) *ierr = 0;
2862 try {
2863 gmsh::model::geo::mesh::setTransfiniteCurve(tag, nPoints, meshType, coef);
2864 }
2865 catch(...){
2866 if(ierr) *ierr = 1;
2867 }
2868 }
2869
gmshModelGeoMeshSetTransfiniteSurface(const int tag,const char * arrangement,int * cornerTags,size_t cornerTags_n,int * ierr)2870 GMSH_API void gmshModelGeoMeshSetTransfiniteSurface(const int tag, const char * arrangement, int * cornerTags, size_t cornerTags_n, int * ierr)
2871 {
2872 if(ierr) *ierr = 0;
2873 try {
2874 std::vector<int> api_cornerTags_(cornerTags, cornerTags + cornerTags_n);
2875 gmsh::model::geo::mesh::setTransfiniteSurface(tag, arrangement, api_cornerTags_);
2876 }
2877 catch(...){
2878 if(ierr) *ierr = 1;
2879 }
2880 }
2881
gmshModelGeoMeshSetTransfiniteVolume(const int tag,int * cornerTags,size_t cornerTags_n,int * ierr)2882 GMSH_API void gmshModelGeoMeshSetTransfiniteVolume(const int tag, int * cornerTags, size_t cornerTags_n, int * ierr)
2883 {
2884 if(ierr) *ierr = 0;
2885 try {
2886 std::vector<int> api_cornerTags_(cornerTags, cornerTags + cornerTags_n);
2887 gmsh::model::geo::mesh::setTransfiniteVolume(tag, api_cornerTags_);
2888 }
2889 catch(...){
2890 if(ierr) *ierr = 1;
2891 }
2892 }
2893
gmshModelGeoMeshSetRecombine(const int dim,const int tag,const double angle,int * ierr)2894 GMSH_API void gmshModelGeoMeshSetRecombine(const int dim, const int tag, const double angle, int * ierr)
2895 {
2896 if(ierr) *ierr = 0;
2897 try {
2898 gmsh::model::geo::mesh::setRecombine(dim, tag, angle);
2899 }
2900 catch(...){
2901 if(ierr) *ierr = 1;
2902 }
2903 }
2904
gmshModelGeoMeshSetSmoothing(const int dim,const int tag,const int val,int * ierr)2905 GMSH_API void gmshModelGeoMeshSetSmoothing(const int dim, const int tag, const int val, int * ierr)
2906 {
2907 if(ierr) *ierr = 0;
2908 try {
2909 gmsh::model::geo::mesh::setSmoothing(dim, tag, val);
2910 }
2911 catch(...){
2912 if(ierr) *ierr = 1;
2913 }
2914 }
2915
gmshModelGeoMeshSetReverse(const int dim,const int tag,const int val,int * ierr)2916 GMSH_API void gmshModelGeoMeshSetReverse(const int dim, const int tag, const int val, int * ierr)
2917 {
2918 if(ierr) *ierr = 0;
2919 try {
2920 gmsh::model::geo::mesh::setReverse(dim, tag, val);
2921 }
2922 catch(...){
2923 if(ierr) *ierr = 1;
2924 }
2925 }
2926
gmshModelGeoMeshSetAlgorithm(const int dim,const int tag,const int val,int * ierr)2927 GMSH_API void gmshModelGeoMeshSetAlgorithm(const int dim, const int tag, const int val, int * ierr)
2928 {
2929 if(ierr) *ierr = 0;
2930 try {
2931 gmsh::model::geo::mesh::setAlgorithm(dim, tag, val);
2932 }
2933 catch(...){
2934 if(ierr) *ierr = 1;
2935 }
2936 }
2937
gmshModelGeoMeshSetSizeFromBoundary(const int dim,const int tag,const int val,int * ierr)2938 GMSH_API void gmshModelGeoMeshSetSizeFromBoundary(const int dim, const int tag, const int val, int * ierr)
2939 {
2940 if(ierr) *ierr = 0;
2941 try {
2942 gmsh::model::geo::mesh::setSizeFromBoundary(dim, tag, val);
2943 }
2944 catch(...){
2945 if(ierr) *ierr = 1;
2946 }
2947 }
2948
gmshModelOccAddPoint(const double x,const double y,const double z,const double meshSize,const int tag,int * ierr)2949 GMSH_API int gmshModelOccAddPoint(const double x, const double y, const double z, const double meshSize, const int tag, int * ierr)
2950 {
2951 int result_api_ = 0;
2952 if(ierr) *ierr = 0;
2953 try {
2954 result_api_ = gmsh::model::occ::addPoint(x, y, z, meshSize, tag);
2955 }
2956 catch(...){
2957 if(ierr) *ierr = 1;
2958 }
2959 return result_api_;
2960 }
2961
gmshModelOccAddLine(const int startTag,const int endTag,const int tag,int * ierr)2962 GMSH_API int gmshModelOccAddLine(const int startTag, const int endTag, const int tag, int * ierr)
2963 {
2964 int result_api_ = 0;
2965 if(ierr) *ierr = 0;
2966 try {
2967 result_api_ = gmsh::model::occ::addLine(startTag, endTag, tag);
2968 }
2969 catch(...){
2970 if(ierr) *ierr = 1;
2971 }
2972 return result_api_;
2973 }
2974
gmshModelOccAddCircleArc(const int startTag,const int centerTag,const int endTag,const int tag,int * ierr)2975 GMSH_API int gmshModelOccAddCircleArc(const int startTag, const int centerTag, const int endTag, const int tag, int * ierr)
2976 {
2977 int result_api_ = 0;
2978 if(ierr) *ierr = 0;
2979 try {
2980 result_api_ = gmsh::model::occ::addCircleArc(startTag, centerTag, endTag, tag);
2981 }
2982 catch(...){
2983 if(ierr) *ierr = 1;
2984 }
2985 return result_api_;
2986 }
2987
gmshModelOccAddCircle(const double x,const double y,const double z,const double r,const int tag,const double angle1,const double angle2,int * ierr)2988 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)
2989 {
2990 int result_api_ = 0;
2991 if(ierr) *ierr = 0;
2992 try {
2993 result_api_ = gmsh::model::occ::addCircle(x, y, z, r, tag, angle1, angle2);
2994 }
2995 catch(...){
2996 if(ierr) *ierr = 1;
2997 }
2998 return result_api_;
2999 }
3000
gmshModelOccAddEllipseArc(const int startTag,const int centerTag,const int majorTag,const int endTag,const int tag,int * ierr)3001 GMSH_API int gmshModelOccAddEllipseArc(const int startTag, const int centerTag, const int majorTag, const int endTag, const int tag, int * ierr)
3002 {
3003 int result_api_ = 0;
3004 if(ierr) *ierr = 0;
3005 try {
3006 result_api_ = gmsh::model::occ::addEllipseArc(startTag, centerTag, majorTag, endTag, tag);
3007 }
3008 catch(...){
3009 if(ierr) *ierr = 1;
3010 }
3011 return result_api_;
3012 }
3013
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)3014 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)
3015 {
3016 int result_api_ = 0;
3017 if(ierr) *ierr = 0;
3018 try {
3019 result_api_ = gmsh::model::occ::addEllipse(x, y, z, r1, r2, tag, angle1, angle2);
3020 }
3021 catch(...){
3022 if(ierr) *ierr = 1;
3023 }
3024 return result_api_;
3025 }
3026
gmshModelOccAddSpline(int * pointTags,size_t pointTags_n,const int tag,int * ierr)3027 GMSH_API int gmshModelOccAddSpline(int * pointTags, size_t pointTags_n, const int tag, int * ierr)
3028 {
3029 int result_api_ = 0;
3030 if(ierr) *ierr = 0;
3031 try {
3032 std::vector<int> api_pointTags_(pointTags, pointTags + pointTags_n);
3033 result_api_ = gmsh::model::occ::addSpline(api_pointTags_, tag);
3034 }
3035 catch(...){
3036 if(ierr) *ierr = 1;
3037 }
3038 return result_api_;
3039 }
3040
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)3041 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)
3042 {
3043 int result_api_ = 0;
3044 if(ierr) *ierr = 0;
3045 try {
3046 std::vector<int> api_pointTags_(pointTags, pointTags + pointTags_n);
3047 std::vector<double> api_weights_(weights, weights + weights_n);
3048 std::vector<double> api_knots_(knots, knots + knots_n);
3049 std::vector<int> api_multiplicities_(multiplicities, multiplicities + multiplicities_n);
3050 result_api_ = gmsh::model::occ::addBSpline(api_pointTags_, tag, degree, api_weights_, api_knots_, api_multiplicities_);
3051 }
3052 catch(...){
3053 if(ierr) *ierr = 1;
3054 }
3055 return result_api_;
3056 }
3057
gmshModelOccAddBezier(int * pointTags,size_t pointTags_n,const int tag,int * ierr)3058 GMSH_API int gmshModelOccAddBezier(int * pointTags, size_t pointTags_n, const int tag, int * ierr)
3059 {
3060 int result_api_ = 0;
3061 if(ierr) *ierr = 0;
3062 try {
3063 std::vector<int> api_pointTags_(pointTags, pointTags + pointTags_n);
3064 result_api_ = gmsh::model::occ::addBezier(api_pointTags_, tag);
3065 }
3066 catch(...){
3067 if(ierr) *ierr = 1;
3068 }
3069 return result_api_;
3070 }
3071
gmshModelOccAddWire(int * curveTags,size_t curveTags_n,const int tag,const int checkClosed,int * ierr)3072 GMSH_API int gmshModelOccAddWire(int * curveTags, size_t curveTags_n, const int tag, const int checkClosed, int * ierr)
3073 {
3074 int result_api_ = 0;
3075 if(ierr) *ierr = 0;
3076 try {
3077 std::vector<int> api_curveTags_(curveTags, curveTags + curveTags_n);
3078 result_api_ = gmsh::model::occ::addWire(api_curveTags_, tag, checkClosed);
3079 }
3080 catch(...){
3081 if(ierr) *ierr = 1;
3082 }
3083 return result_api_;
3084 }
3085
gmshModelOccAddCurveLoop(int * curveTags,size_t curveTags_n,const int tag,int * ierr)3086 GMSH_API int gmshModelOccAddCurveLoop(int * curveTags, size_t curveTags_n, const int tag, int * ierr)
3087 {
3088 int result_api_ = 0;
3089 if(ierr) *ierr = 0;
3090 try {
3091 std::vector<int> api_curveTags_(curveTags, curveTags + curveTags_n);
3092 result_api_ = gmsh::model::occ::addCurveLoop(api_curveTags_, tag);
3093 }
3094 catch(...){
3095 if(ierr) *ierr = 1;
3096 }
3097 return result_api_;
3098 }
3099
gmshModelOccAddRectangle(const double x,const double y,const double z,const double dx,const double dy,const int tag,const double roundedRadius,int * ierr)3100 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)
3101 {
3102 int result_api_ = 0;
3103 if(ierr) *ierr = 0;
3104 try {
3105 result_api_ = gmsh::model::occ::addRectangle(x, y, z, dx, dy, tag, roundedRadius);
3106 }
3107 catch(...){
3108 if(ierr) *ierr = 1;
3109 }
3110 return result_api_;
3111 }
3112
gmshModelOccAddDisk(const double xc,const double yc,const double zc,const double rx,const double ry,const int tag,int * ierr)3113 GMSH_API int gmshModelOccAddDisk(const double xc, const double yc, const double zc, const double rx, const double ry, const int tag, int * ierr)
3114 {
3115 int result_api_ = 0;
3116 if(ierr) *ierr = 0;
3117 try {
3118 result_api_ = gmsh::model::occ::addDisk(xc, yc, zc, rx, ry, tag);
3119 }
3120 catch(...){
3121 if(ierr) *ierr = 1;
3122 }
3123 return result_api_;
3124 }
3125
gmshModelOccAddPlaneSurface(int * wireTags,size_t wireTags_n,const int tag,int * ierr)3126 GMSH_API int gmshModelOccAddPlaneSurface(int * wireTags, size_t wireTags_n, const int tag, int * ierr)
3127 {
3128 int result_api_ = 0;
3129 if(ierr) *ierr = 0;
3130 try {
3131 std::vector<int> api_wireTags_(wireTags, wireTags + wireTags_n);
3132 result_api_ = gmsh::model::occ::addPlaneSurface(api_wireTags_, tag);
3133 }
3134 catch(...){
3135 if(ierr) *ierr = 1;
3136 }
3137 return result_api_;
3138 }
3139
gmshModelOccAddSurfaceFilling(const int wireTag,const int tag,int * pointTags,size_t pointTags_n,const int degree,const int numPointsOnCurves,const int numIter,const int anisotropic,const double tol2d,const double tol3d,const double tolAng,const double tolCurv,const int maxDegree,const int maxSegments,int * ierr)3140 GMSH_API int gmshModelOccAddSurfaceFilling(const int wireTag, const int tag, int * pointTags, size_t pointTags_n, const int degree, const int numPointsOnCurves, const int numIter, const int anisotropic, const double tol2d, const double tol3d, const double tolAng, const double tolCurv, const int maxDegree, const int maxSegments, int * ierr)
3141 {
3142 int result_api_ = 0;
3143 if(ierr) *ierr = 0;
3144 try {
3145 std::vector<int> api_pointTags_(pointTags, pointTags + pointTags_n);
3146 result_api_ = gmsh::model::occ::addSurfaceFilling(wireTag, tag, api_pointTags_, degree, numPointsOnCurves, numIter, anisotropic, tol2d, tol3d, tolAng, tolCurv, maxDegree, maxSegments);
3147 }
3148 catch(...){
3149 if(ierr) *ierr = 1;
3150 }
3151 return result_api_;
3152 }
3153
gmshModelOccAddBSplineFilling(const int wireTag,const int tag,const char * type,int * ierr)3154 GMSH_API int gmshModelOccAddBSplineFilling(const int wireTag, const int tag, const char * type, int * ierr)
3155 {
3156 int result_api_ = 0;
3157 if(ierr) *ierr = 0;
3158 try {
3159 result_api_ = gmsh::model::occ::addBSplineFilling(wireTag, tag, type);
3160 }
3161 catch(...){
3162 if(ierr) *ierr = 1;
3163 }
3164 return result_api_;
3165 }
3166
gmshModelOccAddBezierFilling(const int wireTag,const int tag,const char * type,int * ierr)3167 GMSH_API int gmshModelOccAddBezierFilling(const int wireTag, const int tag, const char * type, int * ierr)
3168 {
3169 int result_api_ = 0;
3170 if(ierr) *ierr = 0;
3171 try {
3172 result_api_ = gmsh::model::occ::addBezierFilling(wireTag, tag, type);
3173 }
3174 catch(...){
3175 if(ierr) *ierr = 1;
3176 }
3177 return result_api_;
3178 }
3179
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 * wireTags,size_t wireTags_n,const int wire3D,int * ierr)3180 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 * wireTags, size_t wireTags_n, const int wire3D, int * ierr)
3181 {
3182 int result_api_ = 0;
3183 if(ierr) *ierr = 0;
3184 try {
3185 std::vector<int> api_pointTags_(pointTags, pointTags + pointTags_n);
3186 std::vector<double> api_weights_(weights, weights + weights_n);
3187 std::vector<double> api_knotsU_(knotsU, knotsU + knotsU_n);
3188 std::vector<double> api_knotsV_(knotsV, knotsV + knotsV_n);
3189 std::vector<int> api_multiplicitiesU_(multiplicitiesU, multiplicitiesU + multiplicitiesU_n);
3190 std::vector<int> api_multiplicitiesV_(multiplicitiesV, multiplicitiesV + multiplicitiesV_n);
3191 std::vector<int> api_wireTags_(wireTags, wireTags + wireTags_n);
3192 result_api_ = gmsh::model::occ::addBSplineSurface(api_pointTags_, numPointsU, tag, degreeU, degreeV, api_weights_, api_knotsU_, api_knotsV_, api_multiplicitiesU_, api_multiplicitiesV_, api_wireTags_, wire3D);
3193 }
3194 catch(...){
3195 if(ierr) *ierr = 1;
3196 }
3197 return result_api_;
3198 }
3199
gmshModelOccAddBezierSurface(int * pointTags,size_t pointTags_n,const int numPointsU,const int tag,int * wireTags,size_t wireTags_n,const int wire3D,int * ierr)3200 GMSH_API int gmshModelOccAddBezierSurface(int * pointTags, size_t pointTags_n, const int numPointsU, const int tag, int * wireTags, size_t wireTags_n, const int wire3D, int * ierr)
3201 {
3202 int result_api_ = 0;
3203 if(ierr) *ierr = 0;
3204 try {
3205 std::vector<int> api_pointTags_(pointTags, pointTags + pointTags_n);
3206 std::vector<int> api_wireTags_(wireTags, wireTags + wireTags_n);
3207 result_api_ = gmsh::model::occ::addBezierSurface(api_pointTags_, numPointsU, tag, api_wireTags_, wire3D);
3208 }
3209 catch(...){
3210 if(ierr) *ierr = 1;
3211 }
3212 return result_api_;
3213 }
3214
gmshModelOccAddTrimmedSurface(const int surfaceTag,int * wireTags,size_t wireTags_n,const int wire3D,const int tag,int * ierr)3215 GMSH_API int gmshModelOccAddTrimmedSurface(const int surfaceTag, int * wireTags, size_t wireTags_n, const int wire3D, const int tag, int * ierr)
3216 {
3217 int result_api_ = 0;
3218 if(ierr) *ierr = 0;
3219 try {
3220 std::vector<int> api_wireTags_(wireTags, wireTags + wireTags_n);
3221 result_api_ = gmsh::model::occ::addTrimmedSurface(surfaceTag, api_wireTags_, wire3D, tag);
3222 }
3223 catch(...){
3224 if(ierr) *ierr = 1;
3225 }
3226 return result_api_;
3227 }
3228
gmshModelOccAddSurfaceLoop(int * surfaceTags,size_t surfaceTags_n,const int tag,const int sewing,int * ierr)3229 GMSH_API int gmshModelOccAddSurfaceLoop(int * surfaceTags, size_t surfaceTags_n, const int tag, const int sewing, int * ierr)
3230 {
3231 int result_api_ = 0;
3232 if(ierr) *ierr = 0;
3233 try {
3234 std::vector<int> api_surfaceTags_(surfaceTags, surfaceTags + surfaceTags_n);
3235 result_api_ = gmsh::model::occ::addSurfaceLoop(api_surfaceTags_, tag, sewing);
3236 }
3237 catch(...){
3238 if(ierr) *ierr = 1;
3239 }
3240 return result_api_;
3241 }
3242
gmshModelOccAddVolume(int * shellTags,size_t shellTags_n,const int tag,int * ierr)3243 GMSH_API int gmshModelOccAddVolume(int * shellTags, size_t shellTags_n, const int tag, int * ierr)
3244 {
3245 int result_api_ = 0;
3246 if(ierr) *ierr = 0;
3247 try {
3248 std::vector<int> api_shellTags_(shellTags, shellTags + shellTags_n);
3249 result_api_ = gmsh::model::occ::addVolume(api_shellTags_, tag);
3250 }
3251 catch(...){
3252 if(ierr) *ierr = 1;
3253 }
3254 return result_api_;
3255 }
3256
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)3257 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)
3258 {
3259 int result_api_ = 0;
3260 if(ierr) *ierr = 0;
3261 try {
3262 result_api_ = gmsh::model::occ::addSphere(xc, yc, zc, radius, tag, angle1, angle2, angle3);
3263 }
3264 catch(...){
3265 if(ierr) *ierr = 1;
3266 }
3267 return result_api_;
3268 }
3269
gmshModelOccAddBox(const double x,const double y,const double z,const double dx,const double dy,const double dz,const int tag,int * ierr)3270 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)
3271 {
3272 int result_api_ = 0;
3273 if(ierr) *ierr = 0;
3274 try {
3275 result_api_ = gmsh::model::occ::addBox(x, y, z, dx, dy, dz, tag);
3276 }
3277 catch(...){
3278 if(ierr) *ierr = 1;
3279 }
3280 return result_api_;
3281 }
3282
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)3283 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)
3284 {
3285 int result_api_ = 0;
3286 if(ierr) *ierr = 0;
3287 try {
3288 result_api_ = gmsh::model::occ::addCylinder(x, y, z, dx, dy, dz, r, tag, angle);
3289 }
3290 catch(...){
3291 if(ierr) *ierr = 1;
3292 }
3293 return result_api_;
3294 }
3295
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)3296 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)
3297 {
3298 int result_api_ = 0;
3299 if(ierr) *ierr = 0;
3300 try {
3301 result_api_ = gmsh::model::occ::addCone(x, y, z, dx, dy, dz, r1, r2, tag, angle);
3302 }
3303 catch(...){
3304 if(ierr) *ierr = 1;
3305 }
3306 return result_api_;
3307 }
3308
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)3309 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)
3310 {
3311 int result_api_ = 0;
3312 if(ierr) *ierr = 0;
3313 try {
3314 result_api_ = gmsh::model::occ::addWedge(x, y, z, dx, dy, dz, tag, ltx);
3315 }
3316 catch(...){
3317 if(ierr) *ierr = 1;
3318 }
3319 return result_api_;
3320 }
3321
gmshModelOccAddTorus(const double x,const double y,const double z,const double r1,const double r2,const int tag,const double angle,int * ierr)3322 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)
3323 {
3324 int result_api_ = 0;
3325 if(ierr) *ierr = 0;
3326 try {
3327 result_api_ = gmsh::model::occ::addTorus(x, y, z, r1, r2, tag, angle);
3328 }
3329 catch(...){
3330 if(ierr) *ierr = 1;
3331 }
3332 return result_api_;
3333 }
3334
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)3335 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)
3336 {
3337 if(ierr) *ierr = 0;
3338 try {
3339 std::vector<int> api_wireTags_(wireTags, wireTags + wireTags_n);
3340 gmsh::vectorpair api_outDimTags_;
3341 gmsh::model::occ::addThruSections(api_wireTags_, api_outDimTags_, tag, makeSolid, makeRuled, maxDegree);
3342 vectorpair2intptr(api_outDimTags_, outDimTags, outDimTags_n);
3343 }
3344 catch(...){
3345 if(ierr) *ierr = 1;
3346 }
3347 }
3348
gmshModelOccAddThickSolid(const int volumeTag,int * excludeSurfaceTags,size_t excludeSurfaceTags_n,const double offset,int ** outDimTags,size_t * outDimTags_n,const int tag,int * ierr)3349 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)
3350 {
3351 if(ierr) *ierr = 0;
3352 try {
3353 std::vector<int> api_excludeSurfaceTags_(excludeSurfaceTags, excludeSurfaceTags + excludeSurfaceTags_n);
3354 gmsh::vectorpair api_outDimTags_;
3355 gmsh::model::occ::addThickSolid(volumeTag, api_excludeSurfaceTags_, offset, api_outDimTags_, tag);
3356 vectorpair2intptr(api_outDimTags_, outDimTags, outDimTags_n);
3357 }
3358 catch(...){
3359 if(ierr) *ierr = 1;
3360 }
3361 }
3362
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)3363 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)
3364 {
3365 if(ierr) *ierr = 0;
3366 try {
3367 gmsh::vectorpair api_dimTags_(dimTags_n/2);
3368 for(size_t i = 0; i < dimTags_n/2; ++i){
3369 api_dimTags_[i].first = dimTags[i * 2 + 0];
3370 api_dimTags_[i].second = dimTags[i * 2 + 1];
3371 }
3372 gmsh::vectorpair api_outDimTags_;
3373 std::vector<int> api_numElements_(numElements, numElements + numElements_n);
3374 std::vector<double> api_heights_(heights, heights + heights_n);
3375 gmsh::model::occ::extrude(api_dimTags_, dx, dy, dz, api_outDimTags_, api_numElements_, api_heights_, recombine);
3376 vectorpair2intptr(api_outDimTags_, outDimTags, outDimTags_n);
3377 }
3378 catch(...){
3379 if(ierr) *ierr = 1;
3380 }
3381 }
3382
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)3383 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)
3384 {
3385 if(ierr) *ierr = 0;
3386 try {
3387 gmsh::vectorpair api_dimTags_(dimTags_n/2);
3388 for(size_t i = 0; i < dimTags_n/2; ++i){
3389 api_dimTags_[i].first = dimTags[i * 2 + 0];
3390 api_dimTags_[i].second = dimTags[i * 2 + 1];
3391 }
3392 gmsh::vectorpair api_outDimTags_;
3393 std::vector<int> api_numElements_(numElements, numElements + numElements_n);
3394 std::vector<double> api_heights_(heights, heights + heights_n);
3395 gmsh::model::occ::revolve(api_dimTags_, x, y, z, ax, ay, az, angle, api_outDimTags_, api_numElements_, api_heights_, recombine);
3396 vectorpair2intptr(api_outDimTags_, outDimTags, outDimTags_n);
3397 }
3398 catch(...){
3399 if(ierr) *ierr = 1;
3400 }
3401 }
3402
gmshModelOccAddPipe(int * dimTags,size_t dimTags_n,const int wireTag,int ** outDimTags,size_t * outDimTags_n,const char * trihedron,int * ierr)3403 GMSH_API void gmshModelOccAddPipe(int * dimTags, size_t dimTags_n, const int wireTag, int ** outDimTags, size_t * outDimTags_n, const char * trihedron, int * ierr)
3404 {
3405 if(ierr) *ierr = 0;
3406 try {
3407 gmsh::vectorpair api_dimTags_(dimTags_n/2);
3408 for(size_t i = 0; i < dimTags_n/2; ++i){
3409 api_dimTags_[i].first = dimTags[i * 2 + 0];
3410 api_dimTags_[i].second = dimTags[i * 2 + 1];
3411 }
3412 gmsh::vectorpair api_outDimTags_;
3413 gmsh::model::occ::addPipe(api_dimTags_, wireTag, api_outDimTags_, trihedron);
3414 vectorpair2intptr(api_outDimTags_, outDimTags, outDimTags_n);
3415 }
3416 catch(...){
3417 if(ierr) *ierr = 1;
3418 }
3419 }
3420
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)3421 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)
3422 {
3423 if(ierr) *ierr = 0;
3424 try {
3425 std::vector<int> api_volumeTags_(volumeTags, volumeTags + volumeTags_n);
3426 std::vector<int> api_curveTags_(curveTags, curveTags + curveTags_n);
3427 std::vector<double> api_radii_(radii, radii + radii_n);
3428 gmsh::vectorpair api_outDimTags_;
3429 gmsh::model::occ::fillet(api_volumeTags_, api_curveTags_, api_radii_, api_outDimTags_, removeVolume);
3430 vectorpair2intptr(api_outDimTags_, outDimTags, outDimTags_n);
3431 }
3432 catch(...){
3433 if(ierr) *ierr = 1;
3434 }
3435 }
3436
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)3437 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)
3438 {
3439 if(ierr) *ierr = 0;
3440 try {
3441 std::vector<int> api_volumeTags_(volumeTags, volumeTags + volumeTags_n);
3442 std::vector<int> api_curveTags_(curveTags, curveTags + curveTags_n);
3443 std::vector<int> api_surfaceTags_(surfaceTags, surfaceTags + surfaceTags_n);
3444 std::vector<double> api_distances_(distances, distances + distances_n);
3445 gmsh::vectorpair api_outDimTags_;
3446 gmsh::model::occ::chamfer(api_volumeTags_, api_curveTags_, api_surfaceTags_, api_distances_, api_outDimTags_, removeVolume);
3447 vectorpair2intptr(api_outDimTags_, outDimTags, outDimTags_n);
3448 }
3449 catch(...){
3450 if(ierr) *ierr = 1;
3451 }
3452 }
3453
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)3454 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)
3455 {
3456 if(ierr) *ierr = 0;
3457 try {
3458 gmsh::vectorpair api_objectDimTags_(objectDimTags_n/2);
3459 for(size_t i = 0; i < objectDimTags_n/2; ++i){
3460 api_objectDimTags_[i].first = objectDimTags[i * 2 + 0];
3461 api_objectDimTags_[i].second = objectDimTags[i * 2 + 1];
3462 }
3463 gmsh::vectorpair api_toolDimTags_(toolDimTags_n/2);
3464 for(size_t i = 0; i < toolDimTags_n/2; ++i){
3465 api_toolDimTags_[i].first = toolDimTags[i * 2 + 0];
3466 api_toolDimTags_[i].second = toolDimTags[i * 2 + 1];
3467 }
3468 gmsh::vectorpair api_outDimTags_;
3469 std::vector<gmsh::vectorpair >api_outDimTagsMap_;
3470 gmsh::model::occ::fuse(api_objectDimTags_, api_toolDimTags_, api_outDimTags_, api_outDimTagsMap_, tag, removeObject, removeTool);
3471 vectorpair2intptr(api_outDimTags_, outDimTags, outDimTags_n);
3472 vectorvectorpair2intptrptr(api_outDimTagsMap_, outDimTagsMap, outDimTagsMap_n, outDimTagsMap_nn);
3473 }
3474 catch(...){
3475 if(ierr) *ierr = 1;
3476 }
3477 }
3478
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)3479 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)
3480 {
3481 if(ierr) *ierr = 0;
3482 try {
3483 gmsh::vectorpair api_objectDimTags_(objectDimTags_n/2);
3484 for(size_t i = 0; i < objectDimTags_n/2; ++i){
3485 api_objectDimTags_[i].first = objectDimTags[i * 2 + 0];
3486 api_objectDimTags_[i].second = objectDimTags[i * 2 + 1];
3487 }
3488 gmsh::vectorpair api_toolDimTags_(toolDimTags_n/2);
3489 for(size_t i = 0; i < toolDimTags_n/2; ++i){
3490 api_toolDimTags_[i].first = toolDimTags[i * 2 + 0];
3491 api_toolDimTags_[i].second = toolDimTags[i * 2 + 1];
3492 }
3493 gmsh::vectorpair api_outDimTags_;
3494 std::vector<gmsh::vectorpair >api_outDimTagsMap_;
3495 gmsh::model::occ::intersect(api_objectDimTags_, api_toolDimTags_, api_outDimTags_, api_outDimTagsMap_, tag, removeObject, removeTool);
3496 vectorpair2intptr(api_outDimTags_, outDimTags, outDimTags_n);
3497 vectorvectorpair2intptrptr(api_outDimTagsMap_, outDimTagsMap, outDimTagsMap_n, outDimTagsMap_nn);
3498 }
3499 catch(...){
3500 if(ierr) *ierr = 1;
3501 }
3502 }
3503
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)3504 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)
3505 {
3506 if(ierr) *ierr = 0;
3507 try {
3508 gmsh::vectorpair api_objectDimTags_(objectDimTags_n/2);
3509 for(size_t i = 0; i < objectDimTags_n/2; ++i){
3510 api_objectDimTags_[i].first = objectDimTags[i * 2 + 0];
3511 api_objectDimTags_[i].second = objectDimTags[i * 2 + 1];
3512 }
3513 gmsh::vectorpair api_toolDimTags_(toolDimTags_n/2);
3514 for(size_t i = 0; i < toolDimTags_n/2; ++i){
3515 api_toolDimTags_[i].first = toolDimTags[i * 2 + 0];
3516 api_toolDimTags_[i].second = toolDimTags[i * 2 + 1];
3517 }
3518 gmsh::vectorpair api_outDimTags_;
3519 std::vector<gmsh::vectorpair >api_outDimTagsMap_;
3520 gmsh::model::occ::cut(api_objectDimTags_, api_toolDimTags_, api_outDimTags_, api_outDimTagsMap_, tag, removeObject, removeTool);
3521 vectorpair2intptr(api_outDimTags_, outDimTags, outDimTags_n);
3522 vectorvectorpair2intptrptr(api_outDimTagsMap_, outDimTagsMap, outDimTagsMap_n, outDimTagsMap_nn);
3523 }
3524 catch(...){
3525 if(ierr) *ierr = 1;
3526 }
3527 }
3528
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)3529 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)
3530 {
3531 if(ierr) *ierr = 0;
3532 try {
3533 gmsh::vectorpair api_objectDimTags_(objectDimTags_n/2);
3534 for(size_t i = 0; i < objectDimTags_n/2; ++i){
3535 api_objectDimTags_[i].first = objectDimTags[i * 2 + 0];
3536 api_objectDimTags_[i].second = objectDimTags[i * 2 + 1];
3537 }
3538 gmsh::vectorpair api_toolDimTags_(toolDimTags_n/2);
3539 for(size_t i = 0; i < toolDimTags_n/2; ++i){
3540 api_toolDimTags_[i].first = toolDimTags[i * 2 + 0];
3541 api_toolDimTags_[i].second = toolDimTags[i * 2 + 1];
3542 }
3543 gmsh::vectorpair api_outDimTags_;
3544 std::vector<gmsh::vectorpair >api_outDimTagsMap_;
3545 gmsh::model::occ::fragment(api_objectDimTags_, api_toolDimTags_, api_outDimTags_, api_outDimTagsMap_, tag, removeObject, removeTool);
3546 vectorpair2intptr(api_outDimTags_, outDimTags, outDimTags_n);
3547 vectorvectorpair2intptrptr(api_outDimTagsMap_, outDimTagsMap, outDimTagsMap_n, outDimTagsMap_nn);
3548 }
3549 catch(...){
3550 if(ierr) *ierr = 1;
3551 }
3552 }
3553
gmshModelOccTranslate(int * dimTags,size_t dimTags_n,const double dx,const double dy,const double dz,int * ierr)3554 GMSH_API void gmshModelOccTranslate(int * dimTags, size_t dimTags_n, const double dx, const double dy, const double dz, int * ierr)
3555 {
3556 if(ierr) *ierr = 0;
3557 try {
3558 gmsh::vectorpair api_dimTags_(dimTags_n/2);
3559 for(size_t i = 0; i < dimTags_n/2; ++i){
3560 api_dimTags_[i].first = dimTags[i * 2 + 0];
3561 api_dimTags_[i].second = dimTags[i * 2 + 1];
3562 }
3563 gmsh::model::occ::translate(api_dimTags_, dx, dy, dz);
3564 }
3565 catch(...){
3566 if(ierr) *ierr = 1;
3567 }
3568 }
3569
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)3570 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)
3571 {
3572 if(ierr) *ierr = 0;
3573 try {
3574 gmsh::vectorpair api_dimTags_(dimTags_n/2);
3575 for(size_t i = 0; i < dimTags_n/2; ++i){
3576 api_dimTags_[i].first = dimTags[i * 2 + 0];
3577 api_dimTags_[i].second = dimTags[i * 2 + 1];
3578 }
3579 gmsh::model::occ::rotate(api_dimTags_, x, y, z, ax, ay, az, angle);
3580 }
3581 catch(...){
3582 if(ierr) *ierr = 1;
3583 }
3584 }
3585
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)3586 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)
3587 {
3588 if(ierr) *ierr = 0;
3589 try {
3590 gmsh::vectorpair api_dimTags_(dimTags_n/2);
3591 for(size_t i = 0; i < dimTags_n/2; ++i){
3592 api_dimTags_[i].first = dimTags[i * 2 + 0];
3593 api_dimTags_[i].second = dimTags[i * 2 + 1];
3594 }
3595 gmsh::model::occ::dilate(api_dimTags_, x, y, z, a, b, c);
3596 }
3597 catch(...){
3598 if(ierr) *ierr = 1;
3599 }
3600 }
3601
gmshModelOccMirror(int * dimTags,size_t dimTags_n,const double a,const double b,const double c,const double d,int * ierr)3602 GMSH_API void gmshModelOccMirror(int * dimTags, size_t dimTags_n, const double a, const double b, const double c, const double d, int * ierr)
3603 {
3604 if(ierr) *ierr = 0;
3605 try {
3606 gmsh::vectorpair api_dimTags_(dimTags_n/2);
3607 for(size_t i = 0; i < dimTags_n/2; ++i){
3608 api_dimTags_[i].first = dimTags[i * 2 + 0];
3609 api_dimTags_[i].second = dimTags[i * 2 + 1];
3610 }
3611 gmsh::model::occ::mirror(api_dimTags_, a, b, c, d);
3612 }
3613 catch(...){
3614 if(ierr) *ierr = 1;
3615 }
3616 }
3617
gmshModelOccSymmetrize(int * dimTags,size_t dimTags_n,const double a,const double b,const double c,const double d,int * ierr)3618 GMSH_API void gmshModelOccSymmetrize(int * dimTags, size_t dimTags_n, const double a, const double b, const double c, const double d, int * ierr)
3619 {
3620 if(ierr) *ierr = 0;
3621 try {
3622 gmsh::vectorpair api_dimTags_(dimTags_n/2);
3623 for(size_t i = 0; i < dimTags_n/2; ++i){
3624 api_dimTags_[i].first = dimTags[i * 2 + 0];
3625 api_dimTags_[i].second = dimTags[i * 2 + 1];
3626 }
3627 gmsh::model::occ::symmetrize(api_dimTags_, a, b, c, d);
3628 }
3629 catch(...){
3630 if(ierr) *ierr = 1;
3631 }
3632 }
3633
gmshModelOccAffineTransform(int * dimTags,size_t dimTags_n,double * affineTransform,size_t affineTransform_n,int * ierr)3634 GMSH_API void gmshModelOccAffineTransform(int * dimTags, size_t dimTags_n, double * affineTransform, size_t affineTransform_n, int * ierr)
3635 {
3636 if(ierr) *ierr = 0;
3637 try {
3638 gmsh::vectorpair api_dimTags_(dimTags_n/2);
3639 for(size_t i = 0; i < dimTags_n/2; ++i){
3640 api_dimTags_[i].first = dimTags[i * 2 + 0];
3641 api_dimTags_[i].second = dimTags[i * 2 + 1];
3642 }
3643 std::vector<double> api_affineTransform_(affineTransform, affineTransform + affineTransform_n);
3644 gmsh::model::occ::affineTransform(api_dimTags_, api_affineTransform_);
3645 }
3646 catch(...){
3647 if(ierr) *ierr = 1;
3648 }
3649 }
3650
gmshModelOccCopy(int * dimTags,size_t dimTags_n,int ** outDimTags,size_t * outDimTags_n,int * ierr)3651 GMSH_API void gmshModelOccCopy(int * dimTags, size_t dimTags_n, int ** outDimTags, size_t * outDimTags_n, int * ierr)
3652 {
3653 if(ierr) *ierr = 0;
3654 try {
3655 gmsh::vectorpair api_dimTags_(dimTags_n/2);
3656 for(size_t i = 0; i < dimTags_n/2; ++i){
3657 api_dimTags_[i].first = dimTags[i * 2 + 0];
3658 api_dimTags_[i].second = dimTags[i * 2 + 1];
3659 }
3660 gmsh::vectorpair api_outDimTags_;
3661 gmsh::model::occ::copy(api_dimTags_, api_outDimTags_);
3662 vectorpair2intptr(api_outDimTags_, outDimTags, outDimTags_n);
3663 }
3664 catch(...){
3665 if(ierr) *ierr = 1;
3666 }
3667 }
3668
gmshModelOccRemove(int * dimTags,size_t dimTags_n,const int recursive,int * ierr)3669 GMSH_API void gmshModelOccRemove(int * dimTags, size_t dimTags_n, const int recursive, int * ierr)
3670 {
3671 if(ierr) *ierr = 0;
3672 try {
3673 gmsh::vectorpair api_dimTags_(dimTags_n/2);
3674 for(size_t i = 0; i < dimTags_n/2; ++i){
3675 api_dimTags_[i].first = dimTags[i * 2 + 0];
3676 api_dimTags_[i].second = dimTags[i * 2 + 1];
3677 }
3678 gmsh::model::occ::remove(api_dimTags_, recursive);
3679 }
3680 catch(...){
3681 if(ierr) *ierr = 1;
3682 }
3683 }
3684
gmshModelOccRemoveAllDuplicates(int * ierr)3685 GMSH_API void gmshModelOccRemoveAllDuplicates(int * ierr)
3686 {
3687 if(ierr) *ierr = 0;
3688 try {
3689 gmsh::model::occ::removeAllDuplicates();
3690 }
3691 catch(...){
3692 if(ierr) *ierr = 1;
3693 }
3694 }
3695
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)3696 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)
3697 {
3698 if(ierr) *ierr = 0;
3699 try {
3700 gmsh::vectorpair api_outDimTags_;
3701 gmsh::vectorpair api_dimTags_(dimTags_n/2);
3702 for(size_t i = 0; i < dimTags_n/2; ++i){
3703 api_dimTags_[i].first = dimTags[i * 2 + 0];
3704 api_dimTags_[i].second = dimTags[i * 2 + 1];
3705 }
3706 gmsh::model::occ::healShapes(api_outDimTags_, api_dimTags_, tolerance, fixDegenerated, fixSmallEdges, fixSmallFaces, sewFaces, makeSolids);
3707 vectorpair2intptr(api_outDimTags_, outDimTags, outDimTags_n);
3708 }
3709 catch(...){
3710 if(ierr) *ierr = 1;
3711 }
3712 }
3713
gmshModelOccImportShapes(const char * fileName,int ** outDimTags,size_t * outDimTags_n,const int highestDimOnly,const char * format,int * ierr)3714 GMSH_API void gmshModelOccImportShapes(const char * fileName, int ** outDimTags, size_t * outDimTags_n, const int highestDimOnly, const char * format, int * ierr)
3715 {
3716 if(ierr) *ierr = 0;
3717 try {
3718 gmsh::vectorpair api_outDimTags_;
3719 gmsh::model::occ::importShapes(fileName, api_outDimTags_, highestDimOnly, format);
3720 vectorpair2intptr(api_outDimTags_, outDimTags, outDimTags_n);
3721 }
3722 catch(...){
3723 if(ierr) *ierr = 1;
3724 }
3725 }
3726
gmshModelOccImportShapesNativePointer(const void * shape,int ** outDimTags,size_t * outDimTags_n,const int highestDimOnly,int * ierr)3727 GMSH_API void gmshModelOccImportShapesNativePointer(const void * shape, int ** outDimTags, size_t * outDimTags_n, const int highestDimOnly, int * ierr)
3728 {
3729 if(ierr) *ierr = 0;
3730 try {
3731 gmsh::vectorpair api_outDimTags_;
3732 gmsh::model::occ::importShapesNativePointer(shape, api_outDimTags_, highestDimOnly);
3733 vectorpair2intptr(api_outDimTags_, outDimTags, outDimTags_n);
3734 }
3735 catch(...){
3736 if(ierr) *ierr = 1;
3737 }
3738 }
3739
gmshModelOccGetEntities(int ** dimTags,size_t * dimTags_n,const int dim,int * ierr)3740 GMSH_API void gmshModelOccGetEntities(int ** dimTags, size_t * dimTags_n, const int dim, int * ierr)
3741 {
3742 if(ierr) *ierr = 0;
3743 try {
3744 gmsh::vectorpair api_dimTags_;
3745 gmsh::model::occ::getEntities(api_dimTags_, dim);
3746 vectorpair2intptr(api_dimTags_, dimTags, dimTags_n);
3747 }
3748 catch(...){
3749 if(ierr) *ierr = 1;
3750 }
3751 }
3752
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)3753 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)
3754 {
3755 if(ierr) *ierr = 0;
3756 try {
3757 gmsh::vectorpair api_tags_;
3758 gmsh::model::occ::getEntitiesInBoundingBox(xmin, ymin, zmin, xmax, ymax, zmax, api_tags_, dim);
3759 vectorpair2intptr(api_tags_, tags, tags_n);
3760 }
3761 catch(...){
3762 if(ierr) *ierr = 1;
3763 }
3764 }
3765
gmshModelOccGetBoundingBox(const int dim,const int tag,double * xmin,double * ymin,double * zmin,double * xmax,double * ymax,double * zmax,int * ierr)3766 GMSH_API void gmshModelOccGetBoundingBox(const int dim, const int tag, double * xmin, double * ymin, double * zmin, double * xmax, double * ymax, double * zmax, int * ierr)
3767 {
3768 if(ierr) *ierr = 0;
3769 try {
3770 gmsh::model::occ::getBoundingBox(dim, tag, *xmin, *ymin, *zmin, *xmax, *ymax, *zmax);
3771 }
3772 catch(...){
3773 if(ierr) *ierr = 1;
3774 }
3775 }
3776
gmshModelOccGetMass(const int dim,const int tag,double * mass,int * ierr)3777 GMSH_API void gmshModelOccGetMass(const int dim, const int tag, double * mass, int * ierr)
3778 {
3779 if(ierr) *ierr = 0;
3780 try {
3781 gmsh::model::occ::getMass(dim, tag, *mass);
3782 }
3783 catch(...){
3784 if(ierr) *ierr = 1;
3785 }
3786 }
3787
gmshModelOccGetCenterOfMass(const int dim,const int tag,double * x,double * y,double * z,int * ierr)3788 GMSH_API void gmshModelOccGetCenterOfMass(const int dim, const int tag, double * x, double * y, double * z, int * ierr)
3789 {
3790 if(ierr) *ierr = 0;
3791 try {
3792 gmsh::model::occ::getCenterOfMass(dim, tag, *x, *y, *z);
3793 }
3794 catch(...){
3795 if(ierr) *ierr = 1;
3796 }
3797 }
3798
gmshModelOccGetMatrixOfInertia(const int dim,const int tag,double ** mat,size_t * mat_n,int * ierr)3799 GMSH_API void gmshModelOccGetMatrixOfInertia(const int dim, const int tag, double ** mat, size_t * mat_n, int * ierr)
3800 {
3801 if(ierr) *ierr = 0;
3802 try {
3803 std::vector<double> api_mat_;
3804 gmsh::model::occ::getMatrixOfInertia(dim, tag, api_mat_);
3805 vector2ptr(api_mat_, mat, mat_n);
3806 }
3807 catch(...){
3808 if(ierr) *ierr = 1;
3809 }
3810 }
3811
gmshModelOccGetMaxTag(const int dim,int * ierr)3812 GMSH_API int gmshModelOccGetMaxTag(const int dim, int * ierr)
3813 {
3814 int result_api_ = 0;
3815 if(ierr) *ierr = 0;
3816 try {
3817 result_api_ = gmsh::model::occ::getMaxTag(dim);
3818 }
3819 catch(...){
3820 if(ierr) *ierr = 1;
3821 }
3822 return result_api_;
3823 }
3824
gmshModelOccSetMaxTag(const int dim,const int maxTag,int * ierr)3825 GMSH_API void gmshModelOccSetMaxTag(const int dim, const int maxTag, int * ierr)
3826 {
3827 if(ierr) *ierr = 0;
3828 try {
3829 gmsh::model::occ::setMaxTag(dim, maxTag);
3830 }
3831 catch(...){
3832 if(ierr) *ierr = 1;
3833 }
3834 }
3835
gmshModelOccSynchronize(int * ierr)3836 GMSH_API void gmshModelOccSynchronize(int * ierr)
3837 {
3838 if(ierr) *ierr = 0;
3839 try {
3840 gmsh::model::occ::synchronize();
3841 }
3842 catch(...){
3843 if(ierr) *ierr = 1;
3844 }
3845 }
3846
gmshModelOccMeshSetSize(int * dimTags,size_t dimTags_n,const double size,int * ierr)3847 GMSH_API void gmshModelOccMeshSetSize(int * dimTags, size_t dimTags_n, const double size, int * ierr)
3848 {
3849 if(ierr) *ierr = 0;
3850 try {
3851 gmsh::vectorpair api_dimTags_(dimTags_n/2);
3852 for(size_t i = 0; i < dimTags_n/2; ++i){
3853 api_dimTags_[i].first = dimTags[i * 2 + 0];
3854 api_dimTags_[i].second = dimTags[i * 2 + 1];
3855 }
3856 gmsh::model::occ::mesh::setSize(api_dimTags_, size);
3857 }
3858 catch(...){
3859 if(ierr) *ierr = 1;
3860 }
3861 }
3862
gmshViewAdd(const char * name,const int tag,int * ierr)3863 GMSH_API int gmshViewAdd(const char * name, const int tag, int * ierr)
3864 {
3865 int result_api_ = 0;
3866 if(ierr) *ierr = 0;
3867 try {
3868 result_api_ = gmsh::view::add(name, tag);
3869 }
3870 catch(...){
3871 if(ierr) *ierr = 1;
3872 }
3873 return result_api_;
3874 }
3875
gmshViewRemove(const int tag,int * ierr)3876 GMSH_API void gmshViewRemove(const int tag, int * ierr)
3877 {
3878 if(ierr) *ierr = 0;
3879 try {
3880 gmsh::view::remove(tag);
3881 }
3882 catch(...){
3883 if(ierr) *ierr = 1;
3884 }
3885 }
3886
gmshViewGetIndex(const int tag,int * ierr)3887 GMSH_API int gmshViewGetIndex(const int tag, int * ierr)
3888 {
3889 int result_api_ = 0;
3890 if(ierr) *ierr = 0;
3891 try {
3892 result_api_ = gmsh::view::getIndex(tag);
3893 }
3894 catch(...){
3895 if(ierr) *ierr = 1;
3896 }
3897 return result_api_;
3898 }
3899
gmshViewGetTags(int ** tags,size_t * tags_n,int * ierr)3900 GMSH_API void gmshViewGetTags(int ** tags, size_t * tags_n, int * ierr)
3901 {
3902 if(ierr) *ierr = 0;
3903 try {
3904 std::vector<int> api_tags_;
3905 gmsh::view::getTags(api_tags_);
3906 vector2ptr(api_tags_, tags, tags_n);
3907 }
3908 catch(...){
3909 if(ierr) *ierr = 1;
3910 }
3911 }
3912
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)3913 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)
3914 {
3915 if(ierr) *ierr = 0;
3916 try {
3917 std::vector<std::size_t> api_tags_(tags, tags + tags_n);
3918 std::vector<std::vector<double> > api_data_(data_nn);
3919 for(size_t i = 0; i < data_nn; ++i)
3920 api_data_[i] = std::vector<double>(data[i], data[i] + data_n[i]);
3921 gmsh::view::addModelData(tag, step, modelName, dataType, api_tags_, api_data_, time, numComponents, partition);
3922 }
3923 catch(...){
3924 if(ierr) *ierr = 1;
3925 }
3926 }
3927
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)3928 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)
3929 {
3930 if(ierr) *ierr = 0;
3931 try {
3932 std::vector<std::size_t> api_tags_(tags, tags + tags_n);
3933 std::vector<double> api_data_(data, data + data_n);
3934 gmsh::view::addHomogeneousModelData(tag, step, modelName, dataType, api_tags_, api_data_, time, numComponents, partition);
3935 }
3936 catch(...){
3937 if(ierr) *ierr = 1;
3938 }
3939 }
3940
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)3941 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)
3942 {
3943 if(ierr) *ierr = 0;
3944 try {
3945 std::string api_dataType_;
3946 std::vector<std::size_t> api_tags_;
3947 std::vector<double> api_data_;
3948 gmsh::view::getHomogeneousModelData(tag, step, api_dataType_, api_tags_, api_data_, *time, *numComponents);
3949 *dataType = strdup(api_dataType_.c_str());
3950 vector2ptr(api_tags_, tags, tags_n);
3951 vector2ptr(api_data_, data, data_n);
3952 }
3953 catch(...){
3954 if(ierr) *ierr = 1;
3955 }
3956 }
3957
gmshViewAddListData(const int tag,const char * dataType,const int numEle,double * data,size_t data_n,int * ierr)3958 GMSH_API void gmshViewAddListData(const int tag, const char * dataType, const int numEle, double * data, size_t data_n, int * ierr)
3959 {
3960 if(ierr) *ierr = 0;
3961 try {
3962 std::vector<double> api_data_(data, data + data_n);
3963 gmsh::view::addListData(tag, dataType, numEle, api_data_);
3964 }
3965 catch(...){
3966 if(ierr) *ierr = 1;
3967 }
3968 }
3969
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)3970 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)
3971 {
3972 if(ierr) *ierr = 0;
3973 try {
3974 std::vector<std::string> api_dataType_;
3975 std::vector<int> api_numElements_;
3976 std::vector<std::vector<double> > api_data_;
3977 gmsh::view::getListData(tag, api_dataType_, api_numElements_, api_data_);
3978 vectorstring2charptrptr(api_dataType_, dataType, dataType_n);
3979 vector2ptr(api_numElements_, numElements, numElements_n);
3980 vectorvector2ptrptr(api_data_, data, data_n, data_nn);
3981 }
3982 catch(...){
3983 if(ierr) *ierr = 1;
3984 }
3985 }
3986
gmshViewAddListDataString(const int tag,double * coord,size_t coord_n,char ** data,size_t data_n,char ** style,size_t style_n,int * ierr)3987 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)
3988 {
3989 if(ierr) *ierr = 0;
3990 try {
3991 std::vector<double> api_coord_(coord, coord + coord_n);
3992 std::vector<std::string> api_data_(data, data + data_n);
3993 std::vector<std::string> api_style_(style, style + style_n);
3994 gmsh::view::addListDataString(tag, api_coord_, api_data_, api_style_);
3995 }
3996 catch(...){
3997 if(ierr) *ierr = 1;
3998 }
3999 }
4000
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)4001 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)
4002 {
4003 if(ierr) *ierr = 0;
4004 try {
4005 std::vector<double> api_coord_;
4006 std::vector<std::string> api_data_;
4007 std::vector<std::string> api_style_;
4008 gmsh::view::getListDataStrings(tag, dim, api_coord_, api_data_, api_style_);
4009 vector2ptr(api_coord_, coord, coord_n);
4010 vectorstring2charptrptr(api_data_, data, data_n);
4011 vectorstring2charptrptr(api_style_, style, style_n);
4012 }
4013 catch(...){
4014 if(ierr) *ierr = 1;
4015 }
4016 }
4017
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)4018 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)
4019 {
4020 if(ierr) *ierr = 0;
4021 try {
4022 std::vector<double> api_coef_(coef, coef + coef_n);
4023 std::vector<double> api_exp_(exp, exp + exp_n);
4024 std::vector<double> api_coefGeo_(coefGeo, coefGeo + coefGeo_n);
4025 std::vector<double> api_expGeo_(expGeo, expGeo + expGeo_n);
4026 gmsh::view::setInterpolationMatrices(tag, type, d, api_coef_, api_exp_, dGeo, api_coefGeo_, api_expGeo_);
4027 }
4028 catch(...){
4029 if(ierr) *ierr = 1;
4030 }
4031 }
4032
gmshViewAddAlias(const int refTag,const int copyOptions,const int tag,int * ierr)4033 GMSH_API int gmshViewAddAlias(const int refTag, const int copyOptions, const int tag, int * ierr)
4034 {
4035 int result_api_ = 0;
4036 if(ierr) *ierr = 0;
4037 try {
4038 result_api_ = gmsh::view::addAlias(refTag, copyOptions, tag);
4039 }
4040 catch(...){
4041 if(ierr) *ierr = 1;
4042 }
4043 return result_api_;
4044 }
4045
gmshViewCombine(const char * what,const char * how,const int remove,const int copyOptions,int * ierr)4046 GMSH_API void gmshViewCombine(const char * what, const char * how, const int remove, const int copyOptions, int * ierr)
4047 {
4048 if(ierr) *ierr = 0;
4049 try {
4050 gmsh::view::combine(what, how, remove, copyOptions);
4051 }
4052 catch(...){
4053 if(ierr) *ierr = 1;
4054 }
4055 }
4056
gmshViewProbe(const int tag,const double x,const double y,const double z,double ** value,size_t * value_n,double * distance,const int step,const int numComp,const int gradient,const double distanceMax,double * xElemCoord,size_t xElemCoord_n,double * yElemCoord,size_t yElemCoord_n,double * zElemCoord,size_t zElemCoord_n,const int dim,int * ierr)4057 GMSH_API void gmshViewProbe(const int tag, const double x, const double y, const double z, double ** value, size_t * value_n, double * distance, const int step, const int numComp, const int gradient, const double distanceMax, double * xElemCoord, size_t xElemCoord_n, double * yElemCoord, size_t yElemCoord_n, double * zElemCoord, size_t zElemCoord_n, const int dim, int * ierr)
4058 {
4059 if(ierr) *ierr = 0;
4060 try {
4061 std::vector<double> api_value_;
4062 std::vector<double> api_xElemCoord_(xElemCoord, xElemCoord + xElemCoord_n);
4063 std::vector<double> api_yElemCoord_(yElemCoord, yElemCoord + yElemCoord_n);
4064 std::vector<double> api_zElemCoord_(zElemCoord, zElemCoord + zElemCoord_n);
4065 gmsh::view::probe(tag, x, y, z, api_value_, *distance, step, numComp, gradient, distanceMax, api_xElemCoord_, api_yElemCoord_, api_zElemCoord_, dim);
4066 vector2ptr(api_value_, value, value_n);
4067 }
4068 catch(...){
4069 if(ierr) *ierr = 1;
4070 }
4071 }
4072
gmshViewWrite(const int tag,const char * fileName,const int append,int * ierr)4073 GMSH_API void gmshViewWrite(const int tag, const char * fileName, const int append, int * ierr)
4074 {
4075 if(ierr) *ierr = 0;
4076 try {
4077 gmsh::view::write(tag, fileName, append);
4078 }
4079 catch(...){
4080 if(ierr) *ierr = 1;
4081 }
4082 }
4083
gmshViewSetVisibilityPerWindow(const int tag,const int value,const int windowIndex,int * ierr)4084 GMSH_API void gmshViewSetVisibilityPerWindow(const int tag, const int value, const int windowIndex, int * ierr)
4085 {
4086 if(ierr) *ierr = 0;
4087 try {
4088 gmsh::view::setVisibilityPerWindow(tag, value, windowIndex);
4089 }
4090 catch(...){
4091 if(ierr) *ierr = 1;
4092 }
4093 }
4094
gmshViewOptionSetNumber(const int tag,const char * name,const double value,int * ierr)4095 GMSH_API void gmshViewOptionSetNumber(const int tag, const char * name, const double value, int * ierr)
4096 {
4097 if(ierr) *ierr = 0;
4098 try {
4099 gmsh::view::option::setNumber(tag, name, value);
4100 }
4101 catch(...){
4102 if(ierr) *ierr = 1;
4103 }
4104 }
4105
gmshViewOptionGetNumber(const int tag,const char * name,double * value,int * ierr)4106 GMSH_API void gmshViewOptionGetNumber(const int tag, const char * name, double * value, int * ierr)
4107 {
4108 if(ierr) *ierr = 0;
4109 try {
4110 gmsh::view::option::getNumber(tag, name, *value);
4111 }
4112 catch(...){
4113 if(ierr) *ierr = 1;
4114 }
4115 }
4116
gmshViewOptionSetString(const int tag,const char * name,const char * value,int * ierr)4117 GMSH_API void gmshViewOptionSetString(const int tag, const char * name, const char * value, int * ierr)
4118 {
4119 if(ierr) *ierr = 0;
4120 try {
4121 gmsh::view::option::setString(tag, name, value);
4122 }
4123 catch(...){
4124 if(ierr) *ierr = 1;
4125 }
4126 }
4127
gmshViewOptionGetString(const int tag,const char * name,char ** value,int * ierr)4128 GMSH_API void gmshViewOptionGetString(const int tag, const char * name, char ** value, int * ierr)
4129 {
4130 if(ierr) *ierr = 0;
4131 try {
4132 std::string api_value_;
4133 gmsh::view::option::getString(tag, name, api_value_);
4134 *value = strdup(api_value_.c_str());
4135 }
4136 catch(...){
4137 if(ierr) *ierr = 1;
4138 }
4139 }
4140
gmshViewOptionSetColor(const int tag,const char * name,const int r,const int g,const int b,const int a,int * ierr)4141 GMSH_API void gmshViewOptionSetColor(const int tag, const char * name, const int r, const int g, const int b, const int a, int * ierr)
4142 {
4143 if(ierr) *ierr = 0;
4144 try {
4145 gmsh::view::option::setColor(tag, name, r, g, b, a);
4146 }
4147 catch(...){
4148 if(ierr) *ierr = 1;
4149 }
4150 }
4151
gmshViewOptionGetColor(const int tag,const char * name,int * r,int * g,int * b,int * a,int * ierr)4152 GMSH_API void gmshViewOptionGetColor(const int tag, const char * name, int * r, int * g, int * b, int * a, int * ierr)
4153 {
4154 if(ierr) *ierr = 0;
4155 try {
4156 gmsh::view::option::getColor(tag, name, *r, *g, *b, *a);
4157 }
4158 catch(...){
4159 if(ierr) *ierr = 1;
4160 }
4161 }
4162
gmshViewOptionCopy(const int refTag,const int tag,int * ierr)4163 GMSH_API void gmshViewOptionCopy(const int refTag, const int tag, int * ierr)
4164 {
4165 if(ierr) *ierr = 0;
4166 try {
4167 gmsh::view::option::copy(refTag, tag);
4168 }
4169 catch(...){
4170 if(ierr) *ierr = 1;
4171 }
4172 }
4173
gmshPluginSetNumber(const char * name,const char * option,const double value,int * ierr)4174 GMSH_API void gmshPluginSetNumber(const char * name, const char * option, const double value, int * ierr)
4175 {
4176 if(ierr) *ierr = 0;
4177 try {
4178 gmsh::plugin::setNumber(name, option, value);
4179 }
4180 catch(...){
4181 if(ierr) *ierr = 1;
4182 }
4183 }
4184
gmshPluginSetString(const char * name,const char * option,const char * value,int * ierr)4185 GMSH_API void gmshPluginSetString(const char * name, const char * option, const char * value, int * ierr)
4186 {
4187 if(ierr) *ierr = 0;
4188 try {
4189 gmsh::plugin::setString(name, option, value);
4190 }
4191 catch(...){
4192 if(ierr) *ierr = 1;
4193 }
4194 }
4195
gmshPluginRun(const char * name,int * ierr)4196 GMSH_API int gmshPluginRun(const char * name, int * ierr)
4197 {
4198 int result_api_ = 0;
4199 if(ierr) *ierr = 0;
4200 try {
4201 result_api_ = gmsh::plugin::run(name);
4202 }
4203 catch(...){
4204 if(ierr) *ierr = 1;
4205 }
4206 return result_api_;
4207 }
4208
gmshGraphicsDraw(int * ierr)4209 GMSH_API void gmshGraphicsDraw(int * ierr)
4210 {
4211 if(ierr) *ierr = 0;
4212 try {
4213 gmsh::graphics::draw();
4214 }
4215 catch(...){
4216 if(ierr) *ierr = 1;
4217 }
4218 }
4219
gmshFltkInitialize(int * ierr)4220 GMSH_API void gmshFltkInitialize(int * ierr)
4221 {
4222 if(ierr) *ierr = 0;
4223 try {
4224 gmsh::fltk::initialize();
4225 }
4226 catch(...){
4227 if(ierr) *ierr = 1;
4228 }
4229 }
4230
gmshFltkWait(const double time,int * ierr)4231 GMSH_API void gmshFltkWait(const double time, int * ierr)
4232 {
4233 if(ierr) *ierr = 0;
4234 try {
4235 gmsh::fltk::wait(time);
4236 }
4237 catch(...){
4238 if(ierr) *ierr = 1;
4239 }
4240 }
4241
gmshFltkUpdate(int * ierr)4242 GMSH_API void gmshFltkUpdate(int * ierr)
4243 {
4244 if(ierr) *ierr = 0;
4245 try {
4246 gmsh::fltk::update();
4247 }
4248 catch(...){
4249 if(ierr) *ierr = 1;
4250 }
4251 }
4252
gmshFltkAwake(const char * action,int * ierr)4253 GMSH_API void gmshFltkAwake(const char * action, int * ierr)
4254 {
4255 if(ierr) *ierr = 0;
4256 try {
4257 gmsh::fltk::awake(action);
4258 }
4259 catch(...){
4260 if(ierr) *ierr = 1;
4261 }
4262 }
4263
gmshFltkLock(int * ierr)4264 GMSH_API void gmshFltkLock(int * ierr)
4265 {
4266 if(ierr) *ierr = 0;
4267 try {
4268 gmsh::fltk::lock();
4269 }
4270 catch(...){
4271 if(ierr) *ierr = 1;
4272 }
4273 }
4274
gmshFltkUnlock(int * ierr)4275 GMSH_API void gmshFltkUnlock(int * ierr)
4276 {
4277 if(ierr) *ierr = 0;
4278 try {
4279 gmsh::fltk::unlock();
4280 }
4281 catch(...){
4282 if(ierr) *ierr = 1;
4283 }
4284 }
4285
gmshFltkRun(int * ierr)4286 GMSH_API void gmshFltkRun(int * ierr)
4287 {
4288 if(ierr) *ierr = 0;
4289 try {
4290 gmsh::fltk::run();
4291 }
4292 catch(...){
4293 if(ierr) *ierr = 1;
4294 }
4295 }
4296
gmshFltkIsAvailable(int * ierr)4297 GMSH_API int gmshFltkIsAvailable(int * ierr)
4298 {
4299 int result_api_ = 0;
4300 if(ierr) *ierr = 0;
4301 try {
4302 result_api_ = gmsh::fltk::isAvailable();
4303 }
4304 catch(...){
4305 if(ierr) *ierr = 1;
4306 }
4307 return result_api_;
4308 }
4309
gmshFltkSelectEntities(int ** dimTags,size_t * dimTags_n,const int dim,int * ierr)4310 GMSH_API int gmshFltkSelectEntities(int ** dimTags, size_t * dimTags_n, const int dim, int * ierr)
4311 {
4312 int result_api_ = 0;
4313 if(ierr) *ierr = 0;
4314 try {
4315 gmsh::vectorpair api_dimTags_;
4316 result_api_ = gmsh::fltk::selectEntities(api_dimTags_, dim);
4317 vectorpair2intptr(api_dimTags_, dimTags, dimTags_n);
4318 }
4319 catch(...){
4320 if(ierr) *ierr = 1;
4321 }
4322 return result_api_;
4323 }
4324
gmshFltkSelectElements(size_t ** elementTags,size_t * elementTags_n,int * ierr)4325 GMSH_API int gmshFltkSelectElements(size_t ** elementTags, size_t * elementTags_n, int * ierr)
4326 {
4327 int result_api_ = 0;
4328 if(ierr) *ierr = 0;
4329 try {
4330 std::vector<std::size_t> api_elementTags_;
4331 result_api_ = gmsh::fltk::selectElements(api_elementTags_);
4332 vector2ptr(api_elementTags_, elementTags, elementTags_n);
4333 }
4334 catch(...){
4335 if(ierr) *ierr = 1;
4336 }
4337 return result_api_;
4338 }
4339
gmshFltkSelectViews(int ** viewTags,size_t * viewTags_n,int * ierr)4340 GMSH_API int gmshFltkSelectViews(int ** viewTags, size_t * viewTags_n, int * ierr)
4341 {
4342 int result_api_ = 0;
4343 if(ierr) *ierr = 0;
4344 try {
4345 std::vector<int> api_viewTags_;
4346 result_api_ = gmsh::fltk::selectViews(api_viewTags_);
4347 vector2ptr(api_viewTags_, viewTags, viewTags_n);
4348 }
4349 catch(...){
4350 if(ierr) *ierr = 1;
4351 }
4352 return result_api_;
4353 }
4354
gmshFltkSplitCurrentWindow(const char * how,const double ratio,int * ierr)4355 GMSH_API void gmshFltkSplitCurrentWindow(const char * how, const double ratio, int * ierr)
4356 {
4357 if(ierr) *ierr = 0;
4358 try {
4359 gmsh::fltk::splitCurrentWindow(how, ratio);
4360 }
4361 catch(...){
4362 if(ierr) *ierr = 1;
4363 }
4364 }
4365
gmshFltkSetCurrentWindow(const int windowIndex,int * ierr)4366 GMSH_API void gmshFltkSetCurrentWindow(const int windowIndex, int * ierr)
4367 {
4368 if(ierr) *ierr = 0;
4369 try {
4370 gmsh::fltk::setCurrentWindow(windowIndex);
4371 }
4372 catch(...){
4373 if(ierr) *ierr = 1;
4374 }
4375 }
4376
gmshFltkSetStatusMessage(const char * message,const int graphics,int * ierr)4377 GMSH_API void gmshFltkSetStatusMessage(const char * message, const int graphics, int * ierr)
4378 {
4379 if(ierr) *ierr = 0;
4380 try {
4381 gmsh::fltk::setStatusMessage(message, graphics);
4382 }
4383 catch(...){
4384 if(ierr) *ierr = 1;
4385 }
4386 }
4387
gmshFltkShowContextWindow(const int dim,const int tag,int * ierr)4388 GMSH_API void gmshFltkShowContextWindow(const int dim, const int tag, int * ierr)
4389 {
4390 if(ierr) *ierr = 0;
4391 try {
4392 gmsh::fltk::showContextWindow(dim, tag);
4393 }
4394 catch(...){
4395 if(ierr) *ierr = 1;
4396 }
4397 }
4398
gmshFltkOpenTreeItem(const char * name,int * ierr)4399 GMSH_API void gmshFltkOpenTreeItem(const char * name, int * ierr)
4400 {
4401 if(ierr) *ierr = 0;
4402 try {
4403 gmsh::fltk::openTreeItem(name);
4404 }
4405 catch(...){
4406 if(ierr) *ierr = 1;
4407 }
4408 }
4409
gmshFltkCloseTreeItem(const char * name,int * ierr)4410 GMSH_API void gmshFltkCloseTreeItem(const char * name, int * ierr)
4411 {
4412 if(ierr) *ierr = 0;
4413 try {
4414 gmsh::fltk::closeTreeItem(name);
4415 }
4416 catch(...){
4417 if(ierr) *ierr = 1;
4418 }
4419 }
4420
gmshOnelabSet(const char * data,const char * format,int * ierr)4421 GMSH_API void gmshOnelabSet(const char * data, const char * format, int * ierr)
4422 {
4423 if(ierr) *ierr = 0;
4424 try {
4425 gmsh::onelab::set(data, format);
4426 }
4427 catch(...){
4428 if(ierr) *ierr = 1;
4429 }
4430 }
4431
gmshOnelabGet(char ** data,const char * name,const char * format,int * ierr)4432 GMSH_API void gmshOnelabGet(char ** data, const char * name, const char * format, int * ierr)
4433 {
4434 if(ierr) *ierr = 0;
4435 try {
4436 std::string api_data_;
4437 gmsh::onelab::get(api_data_, name, format);
4438 *data = strdup(api_data_.c_str());
4439 }
4440 catch(...){
4441 if(ierr) *ierr = 1;
4442 }
4443 }
4444
gmshOnelabGetNames(char *** names,size_t * names_n,const char * search,int * ierr)4445 GMSH_API void gmshOnelabGetNames(char *** names, size_t * names_n, const char * search, int * ierr)
4446 {
4447 if(ierr) *ierr = 0;
4448 try {
4449 std::vector<std::string> api_names_;
4450 gmsh::onelab::getNames(api_names_, search);
4451 vectorstring2charptrptr(api_names_, names, names_n);
4452 }
4453 catch(...){
4454 if(ierr) *ierr = 1;
4455 }
4456 }
4457
gmshOnelabSetNumber(const char * name,double * value,size_t value_n,int * ierr)4458 GMSH_API void gmshOnelabSetNumber(const char * name, double * value, size_t value_n, int * ierr)
4459 {
4460 if(ierr) *ierr = 0;
4461 try {
4462 std::vector<double> api_value_(value, value + value_n);
4463 gmsh::onelab::setNumber(name, api_value_);
4464 }
4465 catch(...){
4466 if(ierr) *ierr = 1;
4467 }
4468 }
4469
gmshOnelabSetString(const char * name,char ** value,size_t value_n,int * ierr)4470 GMSH_API void gmshOnelabSetString(const char * name, char ** value, size_t value_n, int * ierr)
4471 {
4472 if(ierr) *ierr = 0;
4473 try {
4474 std::vector<std::string> api_value_(value, value + value_n);
4475 gmsh::onelab::setString(name, api_value_);
4476 }
4477 catch(...){
4478 if(ierr) *ierr = 1;
4479 }
4480 }
4481
gmshOnelabGetNumber(const char * name,double ** value,size_t * value_n,int * ierr)4482 GMSH_API void gmshOnelabGetNumber(const char * name, double ** value, size_t * value_n, int * ierr)
4483 {
4484 if(ierr) *ierr = 0;
4485 try {
4486 std::vector<double> api_value_;
4487 gmsh::onelab::getNumber(name, api_value_);
4488 vector2ptr(api_value_, value, value_n);
4489 }
4490 catch(...){
4491 if(ierr) *ierr = 1;
4492 }
4493 }
4494
gmshOnelabGetString(const char * name,char *** value,size_t * value_n,int * ierr)4495 GMSH_API void gmshOnelabGetString(const char * name, char *** value, size_t * value_n, int * ierr)
4496 {
4497 if(ierr) *ierr = 0;
4498 try {
4499 std::vector<std::string> api_value_;
4500 gmsh::onelab::getString(name, api_value_);
4501 vectorstring2charptrptr(api_value_, value, value_n);
4502 }
4503 catch(...){
4504 if(ierr) *ierr = 1;
4505 }
4506 }
4507
gmshOnelabClear(const char * name,int * ierr)4508 GMSH_API void gmshOnelabClear(const char * name, int * ierr)
4509 {
4510 if(ierr) *ierr = 0;
4511 try {
4512 gmsh::onelab::clear(name);
4513 }
4514 catch(...){
4515 if(ierr) *ierr = 1;
4516 }
4517 }
4518
gmshOnelabRun(const char * name,const char * command,int * ierr)4519 GMSH_API void gmshOnelabRun(const char * name, const char * command, int * ierr)
4520 {
4521 if(ierr) *ierr = 0;
4522 try {
4523 gmsh::onelab::run(name, command);
4524 }
4525 catch(...){
4526 if(ierr) *ierr = 1;
4527 }
4528 }
4529
gmshLoggerWrite(const char * message,const char * level,int * ierr)4530 GMSH_API void gmshLoggerWrite(const char * message, const char * level, int * ierr)
4531 {
4532 if(ierr) *ierr = 0;
4533 try {
4534 gmsh::logger::write(message, level);
4535 }
4536 catch(...){
4537 if(ierr) *ierr = 1;
4538 }
4539 }
4540
gmshLoggerStart(int * ierr)4541 GMSH_API void gmshLoggerStart(int * ierr)
4542 {
4543 if(ierr) *ierr = 0;
4544 try {
4545 gmsh::logger::start();
4546 }
4547 catch(...){
4548 if(ierr) *ierr = 1;
4549 }
4550 }
4551
gmshLoggerGet(char *** log,size_t * log_n,int * ierr)4552 GMSH_API void gmshLoggerGet(char *** log, size_t * log_n, int * ierr)
4553 {
4554 if(ierr) *ierr = 0;
4555 try {
4556 std::vector<std::string> api_log_;
4557 gmsh::logger::get(api_log_);
4558 vectorstring2charptrptr(api_log_, log, log_n);
4559 }
4560 catch(...){
4561 if(ierr) *ierr = 1;
4562 }
4563 }
4564
gmshLoggerStop(int * ierr)4565 GMSH_API void gmshLoggerStop(int * ierr)
4566 {
4567 if(ierr) *ierr = 0;
4568 try {
4569 gmsh::logger::stop();
4570 }
4571 catch(...){
4572 if(ierr) *ierr = 1;
4573 }
4574 }
4575
gmshLoggerGetWallTime(int * ierr)4576 GMSH_API double gmshLoggerGetWallTime(int * ierr)
4577 {
4578 double result_api_ = 0;
4579 if(ierr) *ierr = 0;
4580 try {
4581 result_api_ = gmsh::logger::getWallTime();
4582 }
4583 catch(...){
4584 if(ierr) *ierr = 1;
4585 }
4586 return result_api_;
4587 }
4588
gmshLoggerGetCpuTime(int * ierr)4589 GMSH_API double gmshLoggerGetCpuTime(int * ierr)
4590 {
4591 double result_api_ = 0;
4592 if(ierr) *ierr = 0;
4593 try {
4594 result_api_ = gmsh::logger::getCpuTime();
4595 }
4596 catch(...){
4597 if(ierr) *ierr = 1;
4598 }
4599 return result_api_;
4600 }
4601
gmshLoggerGetLastError(char ** error,int * ierr)4602 GMSH_API void gmshLoggerGetLastError(char ** error, int * ierr)
4603 {
4604 if(ierr) *ierr = 0;
4605 try {
4606 std::string api_error_;
4607 gmsh::logger::getLastError(api_error_);
4608 *error = strdup(api_error_.c_str());
4609 }
4610 catch(...){
4611 if(ierr) *ierr = 1;
4612 }
4613 }
4614
4615