1 /*
2  * Gmsh - Copyright (C) 1997-2021 C. Geuzaine, J.-F. Remacle
3  *
4  * See the LICENSE.txt file in the Gmsh root directory for license information.
5  * Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
6  */
7 
8 #ifndef GMSHC_H
9 #define GMSHC_H
10 
11 /*
12  * This file defines the Gmsh C API (v4.9.2).
13  *
14  * Do not edit it directly: it is automatically generated by `api/gen.py'.
15  *
16  * By design, the Gmsh C API is purely functional, and only uses elementary
17  * C types. See `tutorial/c' and `demos/api' for examples.
18  */
19 
20 #include <stddef.h>
21 
22 #define GMSH_API_VERSION "4.9.2"
23 #define GMSH_API_VERSION_MAJOR 4
24 #define GMSH_API_VERSION_MINOR 9
25 #define GMSH_API_VERSION_PATCH 2
26 
27 #if defined(GMSH_DLL)
28 #if defined(GMSH_DLL_EXPORT)
29 #define GMSH_API __declspec(dllexport)
30 #else
31 #define GMSH_API __declspec(dllimport)
32 #endif
33 #else
34 #define GMSH_API
35 #endif
36 
37 GMSH_API void gmshFree(void *p);
38 GMSH_API void *gmshMalloc(size_t n);
39 
40 /* Initialize the Gmsh API. This must be called before any call to the other
41  * functions in the API. If `argc' and `argv' (or just `argv' in Python or
42  * Julia) are provided, they will be handled in the same way as the command
43  * line arguments in the Gmsh app. If `readConfigFiles' is set, read system
44  * Gmsh configuration files (gmshrc and gmsh-options). If `run' is set, run in
45  * the same way as the Gmsh app, either interactively or in batch mode
46  * depending on the command line arguments. If `run' is not set, initializing
47  * the API sets the options "General.AbortOnError" to 2 and "General.Terminal"
48  * to 1. If compiled with OpenMP support, it also sets the number of threads
49  * to "General.NumThreads". */
50 GMSH_API void gmshInitialize(int argc, char ** argv,
51                              const int readConfigFiles,
52                              const int run,
53                              int * ierr);
54 
55 /* Finalize the Gmsh API. This must be called when you are done using the Gmsh
56  * API. */
57 GMSH_API void gmshFinalize(int * ierr);
58 
59 /* Open a file. Equivalent to the `File->Open' menu in the Gmsh app. Handling
60  * of the file depends on its extension and/or its contents: opening a file
61  * with model data will create a new model. */
62 GMSH_API void gmshOpen(const char * fileName,
63                        int * ierr);
64 
65 /* Merge a file. Equivalent to the `File->Merge' menu in the Gmsh app.
66  * Handling of the file depends on its extension and/or its contents. Merging
67  * a file with model data will add the data to the current model. */
68 GMSH_API void gmshMerge(const char * fileName,
69                         int * ierr);
70 
71 /* Write a file. The export format is determined by the file extension. */
72 GMSH_API void gmshWrite(const char * fileName,
73                         int * ierr);
74 
75 /* Clear all loaded models and post-processing data, and add a new empty
76  * model. */
77 GMSH_API void gmshClear(int * ierr);
78 
79 /* Set a numerical option to `value'. `name' is of the form "Category.Option"
80  * or "Category[num].Option". Available categories and options are listed in
81  * the Gmsh reference manual. */
82 GMSH_API void gmshOptionSetNumber(const char * name,
83                                   const double value,
84                                   int * ierr);
85 
86 /* Get the `value' of a numerical option. `name' is of the form
87  * "Category.Option" or "Category[num].Option". Available categories and
88  * options are listed in the Gmsh reference manual. */
89 GMSH_API void gmshOptionGetNumber(const char * name,
90                                   double * value,
91                                   int * ierr);
92 
93 /* Set a string option to `value'. `name' is of the form "Category.Option" or
94  * "Category[num].Option". Available categories and options are listed in the
95  * Gmsh reference manual. */
96 GMSH_API void gmshOptionSetString(const char * name,
97                                   const char * value,
98                                   int * ierr);
99 
100 /* Get the `value' of a string option. `name' is of the form "Category.Option"
101  * or "Category[num].Option". Available categories and options are listed in
102  * the Gmsh reference manual. */
103 GMSH_API void gmshOptionGetString(const char * name,
104                                   char ** value,
105                                   int * ierr);
106 
107 /* Set a color option to the RGBA value (`r', `g', `b', `a'), where where `r',
108  * `g', `b' and `a' should be integers between 0 and 255. `name' is of the
109  * form "Category.Color.Option" or "Category[num].Color.Option". Available
110  * categories and options are listed in the Gmsh reference manual. For
111  * conciseness "Color." can be ommitted in `name'. */
112 GMSH_API void gmshOptionSetColor(const char * name,
113                                  const int r,
114                                  const int g,
115                                  const int b,
116                                  const int a,
117                                  int * ierr);
118 
119 /* Get the `r', `g', `b', `a' value of a color option. `name' is of the form
120  * "Category.Color.Option" or "Category[num].Color.Option". Available
121  * categories and options are listed in the Gmsh reference manual. For
122  * conciseness "Color." can be ommitted in `name'. */
123 GMSH_API void gmshOptionGetColor(const char * name,
124                                  int * r,
125                                  int * g,
126                                  int * b,
127                                  int * a,
128                                  int * ierr);
129 
130 /* Add a new model, with name `name', and set it as the current model. */
131 GMSH_API void gmshModelAdd(const char * name,
132                            int * ierr);
133 
134 /* Remove the current model. */
135 GMSH_API void gmshModelRemove(int * ierr);
136 
137 /* List the names of all models. */
138 GMSH_API void gmshModelList(char *** names, size_t * names_n,
139                             int * ierr);
140 
141 /* Get the name of the current model. */
142 GMSH_API void gmshModelGetCurrent(char ** name,
143                                   int * ierr);
144 
145 /* Set the current model to the model with name `name'. If several models have
146  * the same name, select the one that was added first. */
147 GMSH_API void gmshModelSetCurrent(const char * name,
148                                   int * ierr);
149 
150 /* Get the file name (if any) associated with the current model. A file name
151  * is associated when a model is read from a file on disk. */
152 GMSH_API void gmshModelGetFileName(char ** fileName,
153                                    int * ierr);
154 
155 /* Set the file name associated with the current model. */
156 GMSH_API void gmshModelSetFileName(const char * fileName,
157                                    int * ierr);
158 
159 /* Get all the entities in the current model. If `dim' is >= 0, return only
160  * the entities of the specified dimension (e.g. points if `dim' == 0). The
161  * entities are returned as a vector of (dim, tag) integer pairs. */
162 GMSH_API void gmshModelGetEntities(int ** dimTags, size_t * dimTags_n,
163                                    const int dim,
164                                    int * ierr);
165 
166 /* Set the name of the entity of dimension `dim' and tag `tag'. */
167 GMSH_API void gmshModelSetEntityName(const int dim,
168                                      const int tag,
169                                      const char * name,
170                                      int * ierr);
171 
172 /* Get the name of the entity of dimension `dim' and tag `tag'. */
173 GMSH_API void gmshModelGetEntityName(const int dim,
174                                      const int tag,
175                                      char ** name,
176                                      int * ierr);
177 
178 /* Get all the physical groups in the current model. If `dim' is >= 0, return
179  * only the entities of the specified dimension (e.g. physical points if `dim'
180  * == 0). The entities are returned as a vector of (dim, tag) integer pairs. */
181 GMSH_API void gmshModelGetPhysicalGroups(int ** dimTags, size_t * dimTags_n,
182                                          const int dim,
183                                          int * ierr);
184 
185 /* Get the tags of the model entities making up the physical group of
186  * dimension `dim' and tag `tag'. */
187 GMSH_API void gmshModelGetEntitiesForPhysicalGroup(const int dim,
188                                                    const int tag,
189                                                    int ** tags, size_t * tags_n,
190                                                    int * ierr);
191 
192 /* Get the tags of the physical groups (if any) to which the model entity of
193  * dimension `dim' and tag `tag' belongs. */
194 GMSH_API void gmshModelGetPhysicalGroupsForEntity(const int dim,
195                                                   const int tag,
196                                                   int ** physicalTags, size_t * physicalTags_n,
197                                                   int * ierr);
198 
199 /* Add a physical group of dimension `dim', grouping the model entities with
200  * tags `tags'. Return the tag of the physical group, equal to `tag' if `tag'
201  * is positive, or a new tag if `tag' < 0. */
202 GMSH_API int gmshModelAddPhysicalGroup(const int dim,
203                                        int * tags, size_t tags_n,
204                                        const int tag,
205                                        int * ierr);
206 
207 /* Remove the physical groups `dimTags' from the current model. If `dimTags'
208  * is empty, remove all groups. */
209 GMSH_API void gmshModelRemovePhysicalGroups(int * dimTags, size_t dimTags_n,
210                                             int * ierr);
211 
212 /* Set the name of the physical group of dimension `dim' and tag `tag'. */
213 GMSH_API void gmshModelSetPhysicalName(const int dim,
214                                        const int tag,
215                                        const char * name,
216                                        int * ierr);
217 
218 /* Remove the physical name `name' from the current model. */
219 GMSH_API void gmshModelRemovePhysicalName(const char * name,
220                                           int * ierr);
221 
222 /* Get the name of the physical group of dimension `dim' and tag `tag'. */
223 GMSH_API void gmshModelGetPhysicalName(const int dim,
224                                        const int tag,
225                                        char ** name,
226                                        int * ierr);
227 
228 /* Set the tag of the entity of dimension `dim' and tag `tag' to the new value
229  * `newTag'. */
230 GMSH_API void gmshModelSetTag(const int dim,
231                               const int tag,
232                               const int newTag,
233                               int * ierr);
234 
235 /* Get the boundary of the model entities `dimTags'. Return in `outDimTags'
236  * the boundary of the individual entities (if `combined' is false) or the
237  * boundary of the combined geometrical shape formed by all input entities (if
238  * `combined' is true). Return tags multiplied by the sign of the boundary
239  * entity if `oriented' is true. Apply the boundary operator recursively down
240  * to dimension 0 (i.e. to points) if `recursive' is true. */
241 GMSH_API void gmshModelGetBoundary(int * dimTags, size_t dimTags_n,
242                                    int ** outDimTags, size_t * outDimTags_n,
243                                    const int combined,
244                                    const int oriented,
245                                    const int recursive,
246                                    int * ierr);
247 
248 /* Get the upward and downward adjacencies of the model entity of dimension
249  * `dim' and tag `tag'. The `upward' vector returns the adjacent entities of
250  * dimension `dim' + 1; the `downward' vector returns the adjacent entities of
251  * dimension `dim' - 1. */
252 GMSH_API void gmshModelGetAdjacencies(const int dim,
253                                       const int tag,
254                                       int ** upward, size_t * upward_n,
255                                       int ** downward, size_t * downward_n,
256                                       int * ierr);
257 
258 /* Get the model entities in the bounding box defined by the two points
259  * (`xmin', `ymin', `zmin') and (`xmax', `ymax', `zmax'). If `dim' is >= 0,
260  * return only the entities of the specified dimension (e.g. points if `dim'
261  * == 0). */
262 GMSH_API void gmshModelGetEntitiesInBoundingBox(const double xmin,
263                                                 const double ymin,
264                                                 const double zmin,
265                                                 const double xmax,
266                                                 const double ymax,
267                                                 const double zmax,
268                                                 int ** tags, size_t * tags_n,
269                                                 const int dim,
270                                                 int * ierr);
271 
272 /* Get the bounding box (`xmin', `ymin', `zmin'), (`xmax', `ymax', `zmax') of
273  * the model entity of dimension `dim' and tag `tag'. If `dim' and `tag' are
274  * negative, get the bounding box of the whole model. */
275 GMSH_API void gmshModelGetBoundingBox(const int dim,
276                                       const int tag,
277                                       double * xmin,
278                                       double * ymin,
279                                       double * zmin,
280                                       double * xmax,
281                                       double * ymax,
282                                       double * zmax,
283                                       int * ierr);
284 
285 /* Return the geometrical dimension of the current model. */
286 GMSH_API int gmshModelGetDimension(int * ierr);
287 
288 /* Add a discrete model entity (defined by a mesh) of dimension `dim' in the
289  * current model. Return the tag of the new discrete entity, equal to `tag' if
290  * `tag' is positive, or a new tag if `tag' < 0. `boundary' specifies the tags
291  * of the entities on the boundary of the discrete entity, if any. Specifying
292  * `boundary' allows Gmsh to construct the topology of the overall model. */
293 GMSH_API int gmshModelAddDiscreteEntity(const int dim,
294                                         const int tag,
295                                         int * boundary, size_t boundary_n,
296                                         int * ierr);
297 
298 /* Remove the entities `dimTags' of the current model, provided that they are
299  * not on the boundary of (or embedded in) higher-dimensional entities. If
300  * `recursive' is true, remove all the entities on their boundaries, down to
301  * dimension 0. */
302 GMSH_API void gmshModelRemoveEntities(int * dimTags, size_t dimTags_n,
303                                       const int recursive,
304                                       int * ierr);
305 
306 /* Remove the entity name `name' from the current model. */
307 GMSH_API void gmshModelRemoveEntityName(const char * name,
308                                         int * ierr);
309 
310 /* Get the type of the entity of dimension `dim' and tag `tag'. */
311 GMSH_API void gmshModelGetType(const int dim,
312                                const int tag,
313                                char ** entityType,
314                                int * ierr);
315 
316 /* In a partitioned model, get the parent of the entity of dimension `dim' and
317  * tag `tag', i.e. from which the entity is a part of, if any. `parentDim' and
318  * `parentTag' are set to -1 if the entity has no parent. */
319 GMSH_API void gmshModelGetParent(const int dim,
320                                  const int tag,
321                                  int * parentDim,
322                                  int * parentTag,
323                                  int * ierr);
324 
325 /* Return the number of partitions in the model. */
326 GMSH_API int gmshModelGetNumberOfPartitions(int * ierr);
327 
328 /* In a partitioned model, return the tags of the partition(s) to which the
329  * entity belongs. */
330 GMSH_API void gmshModelGetPartitions(const int dim,
331                                      const int tag,
332                                      int ** partitions, size_t * partitions_n,
333                                      int * ierr);
334 
335 /* Evaluate the parametrization of the entity of dimension `dim' and tag `tag'
336  * at the parametric coordinates `parametricCoord'. Only valid for `dim' equal
337  * to 0 (with empty `parametricCoord'), 1 (with `parametricCoord' containing
338  * parametric coordinates on the curve) or 2 (with `parametricCoord'
339  * containing pairs of u, v parametric coordinates on the surface,
340  * concatenated: [p1u, p1v, p2u, ...]). Return triplets of x, y, z coordinates
341  * in `coord', concatenated: [p1x, p1y, p1z, p2x, ...]. */
342 GMSH_API void gmshModelGetValue(const int dim,
343                                 const int tag,
344                                 double * parametricCoord, size_t parametricCoord_n,
345                                 double ** coord, size_t * coord_n,
346                                 int * ierr);
347 
348 /* Evaluate the derivative of the parametrization of the entity of dimension
349  * `dim' and tag `tag' at the parametric coordinates `parametricCoord'. Only
350  * valid for `dim' equal to 1 (with `parametricCoord' containing parametric
351  * coordinates on the curve) or 2 (with `parametricCoord' containing pairs of
352  * u, v parametric coordinates on the surface, concatenated: [p1u, p1v, p2u,
353  * ...]). For `dim' equal to 1 return the x, y, z components of the derivative
354  * with respect to u [d1ux, d1uy, d1uz, d2ux, ...]; for `dim' equal to 2
355  * return the x, y, z components of the derivative with respect to u and v:
356  * [d1ux, d1uy, d1uz, d1vx, d1vy, d1vz, d2ux, ...]. */
357 GMSH_API void gmshModelGetDerivative(const int dim,
358                                      const int tag,
359                                      double * parametricCoord, size_t parametricCoord_n,
360                                      double ** derivatives, size_t * derivatives_n,
361                                      int * ierr);
362 
363 /* Evaluate the second derivative of the parametrization of the entity of
364  * dimension `dim' and tag `tag' at the parametric coordinates
365  * `parametricCoord'. Only valid for `dim' equal to 1 (with `parametricCoord'
366  * containing parametric coordinates on the curve) or 2 (with
367  * `parametricCoord' containing pairs of u, v parametric coordinates on the
368  * surface, concatenated: [p1u, p1v, p2u, ...]). For `dim' equal to 1 return
369  * the x, y, z components of the second derivative with respect to u [d1uux,
370  * d1uuy, d1uuz, d2uux, ...]; for `dim' equal to 2 return the x, y, z
371  * components of the second derivative with respect to u and v, and the mixed
372  * derivative with respect to u and v: [d1uux, d1uuy, d1uuz, d1vvx, d1vvy,
373  * d1vvz, d1uvx, d1uvy, d1uvz, d2uux, ...]. */
374 GMSH_API void gmshModelGetSecondDerivative(const int dim,
375                                            const int tag,
376                                            double * parametricCoord, size_t parametricCoord_n,
377                                            double ** derivatives, size_t * derivatives_n,
378                                            int * ierr);
379 
380 /* Evaluate the (maximum) curvature of the entity of dimension `dim' and tag
381  * `tag' at the parametric coordinates `parametricCoord'. Only valid for `dim'
382  * equal to 1 (with `parametricCoord' containing parametric coordinates on the
383  * curve) or 2 (with `parametricCoord' containing pairs of u, v parametric
384  * coordinates on the surface, concatenated: [p1u, p1v, p2u, ...]). */
385 GMSH_API void gmshModelGetCurvature(const int dim,
386                                     const int tag,
387                                     double * parametricCoord, size_t parametricCoord_n,
388                                     double ** curvatures, size_t * curvatures_n,
389                                     int * ierr);
390 
391 /* Evaluate the principal curvatures of the surface with tag `tag' at the
392  * parametric coordinates `parametricCoord', as well as their respective
393  * directions. `parametricCoord' are given by pair of u and v coordinates,
394  * concatenated: [p1u, p1v, p2u, ...]. */
395 GMSH_API void gmshModelGetPrincipalCurvatures(const int tag,
396                                               double * parametricCoord, size_t parametricCoord_n,
397                                               double ** curvatureMax, size_t * curvatureMax_n,
398                                               double ** curvatureMin, size_t * curvatureMin_n,
399                                               double ** directionMax, size_t * directionMax_n,
400                                               double ** directionMin, size_t * directionMin_n,
401                                               int * ierr);
402 
403 /* Get the normal to the surface with tag `tag' at the parametric coordinates
404  * `parametricCoord'. `parametricCoord' are given by pairs of u and v
405  * coordinates, concatenated: [p1u, p1v, p2u, ...]. `normals' are returned as
406  * triplets of x, y, z components, concatenated: [n1x, n1y, n1z, n2x, ...]. */
407 GMSH_API void gmshModelGetNormal(const int tag,
408                                  double * parametricCoord, size_t parametricCoord_n,
409                                  double ** normals, size_t * normals_n,
410                                  int * ierr);
411 
412 /* Get the parametric coordinates `parametricCoord' for the points `coord' on
413  * the entity of dimension `dim' and tag `tag'. `coord' are given as triplets
414  * of x, y, z coordinates, concatenated: [p1x, p1y, p1z, p2x, ...].
415  * `parametricCoord' returns the parametric coordinates t on the curve (if
416  * `dim' = 1) or pairs of u and v coordinates concatenated on the surface (if
417  * `dim' = 2), i.e. [p1t, p2t, ...] or [p1u, p1v, p2u, ...]. */
418 GMSH_API void gmshModelGetParametrization(const int dim,
419                                           const int tag,
420                                           double * coord, size_t coord_n,
421                                           double ** parametricCoord, size_t * parametricCoord_n,
422                                           int * ierr);
423 
424 /* Get the `min' and `max' bounds of the parametric coordinates for the entity
425  * of dimension `dim' and tag `tag'. */
426 GMSH_API void gmshModelGetParametrizationBounds(const int dim,
427                                                 const int tag,
428                                                 double ** min, size_t * min_n,
429                                                 double ** max, size_t * max_n,
430                                                 int * ierr);
431 
432 /* Check if the coordinates (or the parametric coordinates if `parametric' is
433  * set) provided in `coord' correspond to points inside the entity of
434  * dimension `dim' and tag `tag', and return the number of points inside. This
435  * feature is only available for a subset of entities, depending on the
436  * underyling geometrical representation. */
437 GMSH_API int gmshModelIsInside(const int dim,
438                                const int tag,
439                                double * coord, size_t coord_n,
440                                const int parametric,
441                                int * ierr);
442 
443 /* Get the points `closestCoord' on the entity of dimension `dim' and tag
444  * `tag' to the points `coord', by orthogonal projection. `coord' and
445  * `closestCoord' are given as triplets of x, y, z coordinates, concatenated:
446  * [p1x, p1y, p1z, p2x, ...]. `parametricCoord' returns the parametric
447  * coordinates t on the curve (if `dim' = 1) or pairs of u and v coordinates
448  * concatenated on the surface (if `dim' = 2), i.e. [p1t, p2t, ...] or [p1u,
449  * p1v, p2u, ...]. */
450 GMSH_API void gmshModelGetClosestPoint(const int dim,
451                                        const int tag,
452                                        double * coord, size_t coord_n,
453                                        double ** closestCoord, size_t * closestCoord_n,
454                                        double ** parametricCoord, size_t * parametricCoord_n,
455                                        int * ierr);
456 
457 /* Reparametrize the boundary entity (point or curve, i.e. with `dim' == 0 or
458  * `dim' == 1) of tag `tag' on the surface `surfaceTag'. If `dim' == 1,
459  * reparametrize all the points corresponding to the parametric coordinates
460  * `parametricCoord'. Multiple matches in case of periodic surfaces can be
461  * selected with `which'. This feature is only available for a subset of
462  * entities, depending on the underyling geometrical representation. */
463 GMSH_API void gmshModelReparametrizeOnSurface(const int dim,
464                                               const int tag,
465                                               double * parametricCoord, size_t parametricCoord_n,
466                                               const int surfaceTag,
467                                               double ** surfaceParametricCoord, size_t * surfaceParametricCoord_n,
468                                               const int which,
469                                               int * ierr);
470 
471 /* Set the visibility of the model entities `dimTags' to `value'. Apply the
472  * visibility setting recursively if `recursive' is true. */
473 GMSH_API void gmshModelSetVisibility(int * dimTags, size_t dimTags_n,
474                                      const int value,
475                                      const int recursive,
476                                      int * ierr);
477 
478 /* Get the visibility of the model entity of dimension `dim' and tag `tag'. */
479 GMSH_API void gmshModelGetVisibility(const int dim,
480                                      const int tag,
481                                      int * value,
482                                      int * ierr);
483 
484 /* Set the global visibility of the model per window to `value', where
485  * `windowIndex' identifies the window in the window list. */
486 GMSH_API void gmshModelSetVisibilityPerWindow(const int value,
487                                               const int windowIndex,
488                                               int * ierr);
489 
490 /* Set the color of the model entities `dimTags' to the RGBA value (`r', `g',
491  * `b', `a'), where `r', `g', `b' and `a' should be integers between 0 and
492  * 255. Apply the color setting recursively if `recursive' is true. */
493 GMSH_API void gmshModelSetColor(int * dimTags, size_t dimTags_n,
494                                 const int r,
495                                 const int g,
496                                 const int b,
497                                 const int a,
498                                 const int recursive,
499                                 int * ierr);
500 
501 /* Get the color of the model entity of dimension `dim' and tag `tag'. */
502 GMSH_API void gmshModelGetColor(const int dim,
503                                 const int tag,
504                                 int * r,
505                                 int * g,
506                                 int * b,
507                                 int * a,
508                                 int * ierr);
509 
510 /* Set the `x', `y', `z' coordinates of a geometrical point. */
511 GMSH_API void gmshModelSetCoordinates(const int tag,
512                                       const double x,
513                                       const double y,
514                                       const double z,
515                                       int * ierr);
516 
517 /* Generate a mesh of the current model, up to dimension `dim' (0, 1, 2 or 3). */
518 GMSH_API void gmshModelMeshGenerate(const int dim,
519                                     int * ierr);
520 
521 /* Partition the mesh of the current model into `numPart' partitions.
522  * Optionally, `elementTags' and `partitions' can be provided to specify the
523  * partition of each element explicitly. */
524 GMSH_API void gmshModelMeshPartition(const int numPart,
525                                      size_t * elementTags, size_t elementTags_n,
526                                      int * partitions, size_t partitions_n,
527                                      int * ierr);
528 
529 /* Unpartition the mesh of the current model. */
530 GMSH_API void gmshModelMeshUnpartition(int * ierr);
531 
532 /* Optimize the mesh of the current model using `method' (empty for default
533  * tetrahedral mesh optimizer, "Netgen" for Netgen optimizer, "HighOrder" for
534  * direct high-order mesh optimizer, "HighOrderElastic" for high-order elastic
535  * smoother, "HighOrderFastCurving" for fast curving algorithm, "Laplace2D"
536  * for Laplace smoothing, "Relocate2D" and "Relocate3D" for node relocation).
537  * If `force' is set apply the optimization also to discrete entities. If
538  * `dimTags' is given, only apply the optimizer to the given entities. */
539 GMSH_API void gmshModelMeshOptimize(const char * method,
540                                     const int force,
541                                     const int niter,
542                                     int * dimTags, size_t dimTags_n,
543                                     int * ierr);
544 
545 /* Recombine the mesh of the current model. */
546 GMSH_API void gmshModelMeshRecombine(int * ierr);
547 
548 /* Refine the mesh of the current model by uniformly splitting the elements. */
549 GMSH_API void gmshModelMeshRefine(int * ierr);
550 
551 /* Set the order of the elements in the mesh of the current model to `order'. */
552 GMSH_API void gmshModelMeshSetOrder(const int order,
553                                     int * ierr);
554 
555 /* Get the last entities (if any) where a meshing error occurred. Currently
556  * only populated by the new 3D meshing algorithms. */
557 GMSH_API void gmshModelMeshGetLastEntityError(int ** dimTags, size_t * dimTags_n,
558                                               int * ierr);
559 
560 /* Get the last nodes (if any) where a meshing error occurred. Currently only
561  * populated by the new 3D meshing algorithms. */
562 GMSH_API void gmshModelMeshGetLastNodeError(size_t ** nodeTags, size_t * nodeTags_n,
563                                             int * ierr);
564 
565 /* Clear the mesh, i.e. delete all the nodes and elements, for the entities
566  * `dimTags'. If `dimTags' is empty, clear the whole mesh. Note that the mesh
567  * of an entity can only be cleared if this entity is not on the boundary of
568  * another entity with a non-empty mesh. */
569 GMSH_API void gmshModelMeshClear(int * dimTags, size_t dimTags_n,
570                                  int * ierr);
571 
572 /* Reverse the orientation of the elements in the entities `dimTags'. If
573  * `dimTags' is empty, reverse the orientation of the elements in the whole
574  * mesh. */
575 GMSH_API void gmshModelMeshReverse(int * dimTags, size_t dimTags_n,
576                                    int * ierr);
577 
578 /* Apply the affine transformation `affineTransform' (16 entries of a 4x4
579  * matrix, by row; only the 12 first can be provided for convenience) to the
580  * coordinates of the nodes classified on the entities `dimTags'. If `dimTags'
581  * is empty, transform all the nodes in the mesh. */
582 GMSH_API void gmshModelMeshAffineTransform(double * affineTransform, size_t affineTransform_n,
583                                            int * dimTags, size_t dimTags_n,
584                                            int * ierr);
585 
586 /* Get the nodes classified on the entity of dimension `dim' and tag `tag'. If
587  * `tag' < 0, get the nodes for all entities of dimension `dim'. If `dim' and
588  * `tag' are negative, get all the nodes in the mesh. `nodeTags' contains the
589  * node tags (their unique, strictly positive identification numbers). `coord'
590  * is a vector of length 3 times the length of `nodeTags' that contains the x,
591  * y, z coordinates of the nodes, concatenated: [n1x, n1y, n1z, n2x, ...]. If
592  * `dim' >= 0 and `returnParamtricCoord' is set, `parametricCoord' contains
593  * the parametric coordinates ([u1, u2, ...] or [u1, v1, u2, ...]) of the
594  * nodes, if available. The length of `parametricCoord' can be 0 or `dim'
595  * times the length of `nodeTags'. If `includeBoundary' is set, also return
596  * the nodes classified on the boundary of the entity (which will be
597  * reparametrized on the entity if `dim' >= 0 in order to compute their
598  * parametric coordinates). */
599 GMSH_API void gmshModelMeshGetNodes(size_t ** nodeTags, size_t * nodeTags_n,
600                                     double ** coord, size_t * coord_n,
601                                     double ** parametricCoord, size_t * parametricCoord_n,
602                                     const int dim,
603                                     const int tag,
604                                     const int includeBoundary,
605                                     const int returnParametricCoord,
606                                     int * ierr);
607 
608 /* Get the nodes classified on the entity of tag `tag', for all the elements
609  * of type `elementType'. The other arguments are treated as in `getNodes'. */
610 GMSH_API void gmshModelMeshGetNodesByElementType(const int elementType,
611                                                  size_t ** nodeTags, size_t * nodeTags_n,
612                                                  double ** coord, size_t * coord_n,
613                                                  double ** parametricCoord, size_t * parametricCoord_n,
614                                                  const int tag,
615                                                  const int returnParametricCoord,
616                                                  int * ierr);
617 
618 /* Get the coordinates and the parametric coordinates (if any) of the node
619  * with tag `tag', as well as the dimension `dim' and tag `tag' of the entity
620  * on which the node is classified. This function relies on an internal cache
621  * (a vector in case of dense node numbering, a map otherwise); for large
622  * meshes accessing nodes in bulk is often preferable. */
623 GMSH_API void gmshModelMeshGetNode(const size_t nodeTag,
624                                    double ** coord, size_t * coord_n,
625                                    double ** parametricCoord, size_t * parametricCoord_n,
626                                    int * dim,
627                                    int * tag,
628                                    int * ierr);
629 
630 /* Set the coordinates and the parametric coordinates (if any) of the node
631  * with tag `tag'. This function relies on an internal cache (a vector in case
632  * of dense node numbering, a map otherwise); for large meshes accessing nodes
633  * in bulk is often preferable. */
634 GMSH_API void gmshModelMeshSetNode(const size_t nodeTag,
635                                    double * coord, size_t coord_n,
636                                    double * parametricCoord, size_t parametricCoord_n,
637                                    int * ierr);
638 
639 /* Rebuild the node cache. */
640 GMSH_API void gmshModelMeshRebuildNodeCache(const int onlyIfNecessary,
641                                             int * ierr);
642 
643 /* Rebuild the element cache. */
644 GMSH_API void gmshModelMeshRebuildElementCache(const int onlyIfNecessary,
645                                                int * ierr);
646 
647 /* Get the nodes from all the elements belonging to the physical group of
648  * dimension `dim' and tag `tag'. `nodeTags' contains the node tags; `coord'
649  * is a vector of length 3 times the length of `nodeTags' that contains the x,
650  * y, z coordinates of the nodes, concatenated: [n1x, n1y, n1z, n2x, ...]. */
651 GMSH_API void gmshModelMeshGetNodesForPhysicalGroup(const int dim,
652                                                     const int tag,
653                                                     size_t ** nodeTags, size_t * nodeTags_n,
654                                                     double ** coord, size_t * coord_n,
655                                                     int * ierr);
656 
657 /* Get the maximum tag `maxTag' of a node in the mesh. */
658 GMSH_API void gmshModelMeshGetMaxNodeTag(size_t * maxTag,
659                                          int * ierr);
660 
661 /* Add nodes classified on the model entity of dimension `dim' and tag `tag'.
662  * `nodeTags' contains the node tags (their unique, strictly positive
663  * identification numbers). `coord' is a vector of length 3 times the length
664  * of `nodeTags' that contains the x, y, z coordinates of the nodes,
665  * concatenated: [n1x, n1y, n1z, n2x, ...]. The optional `parametricCoord'
666  * vector contains the parametric coordinates of the nodes, if any. The length
667  * of `parametricCoord' can be 0 or `dim' times the length of `nodeTags'. If
668  * the `nodeTags' vector is empty, new tags are automatically assigned to the
669  * nodes. */
670 GMSH_API void gmshModelMeshAddNodes(const int dim,
671                                     const int tag,
672                                     size_t * nodeTags, size_t nodeTags_n,
673                                     double * coord, size_t coord_n,
674                                     double * parametricCoord, size_t parametricCoord_n,
675                                     int * ierr);
676 
677 /* Reclassify all nodes on their associated model entity, based on the
678  * elements. Can be used when importing nodes in bulk (e.g. by associating
679  * them all to a single volume), to reclassify them correctly on model
680  * surfaces, curves, etc. after the elements have been set. */
681 GMSH_API void gmshModelMeshReclassifyNodes(int * ierr);
682 
683 /* Relocate the nodes classified on the entity of dimension `dim' and tag
684  * `tag' using their parametric coordinates. If `tag' < 0, relocate the nodes
685  * for all entities of dimension `dim'. If `dim' and `tag' are negative,
686  * relocate all the nodes in the mesh. */
687 GMSH_API void gmshModelMeshRelocateNodes(const int dim,
688                                          const int tag,
689                                          int * ierr);
690 
691 /* Get the elements classified on the entity of dimension `dim' and tag `tag'.
692  * If `tag' < 0, get the elements for all entities of dimension `dim'. If
693  * `dim' and `tag' are negative, get all the elements in the mesh.
694  * `elementTypes' contains the MSH types of the elements (e.g. `2' for 3-node
695  * triangles: see `getElementProperties' to obtain the properties for a given
696  * element type). `elementTags' is a vector of the same length as
697  * `elementTypes'; each entry is a vector containing the tags (unique,
698  * strictly positive identifiers) of the elements of the corresponding type.
699  * `nodeTags' is also a vector of the same length as `elementTypes'; each
700  * entry is a vector of length equal to the number of elements of the given
701  * type times the number N of nodes for this type of element, that contains
702  * the node tags of all the elements of the given type, concatenated: [e1n1,
703  * e1n2, ..., e1nN, e2n1, ...]. */
704 GMSH_API void gmshModelMeshGetElements(int ** elementTypes, size_t * elementTypes_n,
705                                        size_t *** elementTags, size_t ** elementTags_n, size_t *elementTags_nn,
706                                        size_t *** nodeTags, size_t ** nodeTags_n, size_t *nodeTags_nn,
707                                        const int dim,
708                                        const int tag,
709                                        int * ierr);
710 
711 /* Get the type and node tags of the element with tag `tag', as well as the
712  * dimension `dim' and tag `tag' of the entity on which the element is
713  * classified. This function relies on an internal cache (a vector in case of
714  * dense element numbering, a map otherwise); for large meshes accessing
715  * elements in bulk is often preferable. */
716 GMSH_API void gmshModelMeshGetElement(const size_t elementTag,
717                                       int * elementType,
718                                       size_t ** nodeTags, size_t * nodeTags_n,
719                                       int * dim,
720                                       int * tag,
721                                       int * ierr);
722 
723 /* Search the mesh for an element located at coordinates (`x', `y', `z'). This
724  * function performs a search in a spatial octree. If an element is found,
725  * return its tag, type and node tags, as well as the local coordinates (`u',
726  * `v', `w') within the reference element corresponding to search location. If
727  * `dim' is >= 0, only search for elements of the given dimension. If `strict'
728  * is not set, use a tolerance to find elements near the search location. */
729 GMSH_API void gmshModelMeshGetElementByCoordinates(const double x,
730                                                    const double y,
731                                                    const double z,
732                                                    size_t * elementTag,
733                                                    int * elementType,
734                                                    size_t ** nodeTags, size_t * nodeTags_n,
735                                                    double * u,
736                                                    double * v,
737                                                    double * w,
738                                                    const int dim,
739                                                    const int strict,
740                                                    int * ierr);
741 
742 /* Search the mesh for element(s) located at coordinates (`x', `y', `z'). This
743  * function performs a search in a spatial octree. Return the tags of all
744  * found elements in `elementTags'. Additional information about the elements
745  * can be accessed through `getElement' and `getLocalCoordinatesInElement'. If
746  * `dim' is >= 0, only search for elements of the given dimension. If `strict'
747  * is not set, use a tolerance to find elements near the search location. */
748 GMSH_API void gmshModelMeshGetElementsByCoordinates(const double x,
749                                                     const double y,
750                                                     const double z,
751                                                     size_t ** elementTags, size_t * elementTags_n,
752                                                     const int dim,
753                                                     const int strict,
754                                                     int * ierr);
755 
756 /* Return the local coordinates (`u', `v', `w') within the element
757  * `elementTag' corresponding to the model coordinates (`x', `y', `z'). This
758  * function relies on an internal cache (a vector in case of dense element
759  * numbering, a map otherwise); for large meshes accessing elements in bulk is
760  * often preferable. */
761 GMSH_API void gmshModelMeshGetLocalCoordinatesInElement(const size_t elementTag,
762                                                         const double x,
763                                                         const double y,
764                                                         const double z,
765                                                         double * u,
766                                                         double * v,
767                                                         double * w,
768                                                         int * ierr);
769 
770 /* Get the types of elements in the entity of dimension `dim' and tag `tag'.
771  * If `tag' < 0, get the types for all entities of dimension `dim'. If `dim'
772  * and `tag' are negative, get all the types in the mesh. */
773 GMSH_API void gmshModelMeshGetElementTypes(int ** elementTypes, size_t * elementTypes_n,
774                                            const int dim,
775                                            const int tag,
776                                            int * ierr);
777 
778 /* Return an element type given its family name `familyName' ("Point", "Line",
779  * "Triangle", "Quadrangle", "Tetrahedron", "Pyramid", "Prism", "Hexahedron")
780  * and polynomial order `order'. If `serendip' is true, return the
781  * corresponding serendip element type (element without interior nodes). */
782 GMSH_API int gmshModelMeshGetElementType(const char * familyName,
783                                          const int order,
784                                          const int serendip,
785                                          int * ierr);
786 
787 /* Get the properties of an element of type `elementType': its name
788  * (`elementName'), dimension (`dim'), order (`order'), number of nodes
789  * (`numNodes'), local coordinates of the nodes in the reference element
790  * (`localNodeCoord' vector, of length `dim' times `numNodes') and number of
791  * primary (first order) nodes (`numPrimaryNodes'). */
792 GMSH_API void gmshModelMeshGetElementProperties(const int elementType,
793                                                 char ** elementName,
794                                                 int * dim,
795                                                 int * order,
796                                                 int * numNodes,
797                                                 double ** localNodeCoord, size_t * localNodeCoord_n,
798                                                 int * numPrimaryNodes,
799                                                 int * ierr);
800 
801 /* Get the elements of type `elementType' classified on the entity of tag
802  * `tag'. If `tag' < 0, get the elements for all entities. `elementTags' is a
803  * vector containing the tags (unique, strictly positive identifiers) of the
804  * elements of the corresponding type. `nodeTags' is a vector of length equal
805  * to the number of elements of the given type times the number N of nodes for
806  * this type of element, that contains the node tags of all the elements of
807  * the given type, concatenated: [e1n1, e1n2, ..., e1nN, e2n1, ...]. If
808  * `numTasks' > 1, only compute and return the part of the data indexed by
809  * `task'. */
810 GMSH_API void gmshModelMeshGetElementsByType(const int elementType,
811                                              size_t ** elementTags, size_t * elementTags_n,
812                                              size_t ** nodeTags, size_t * nodeTags_n,
813                                              const int tag,
814                                              const size_t task,
815                                              const size_t numTasks,
816                                              int * ierr);
817 
818 /* Get the maximum tag `maxTag' of an element in the mesh. */
819 GMSH_API void gmshModelMeshGetMaxElementTag(size_t * maxTag,
820                                             int * ierr);
821 
822 /* Preallocate data before calling `getElementsByType' with `numTasks' > 1.
823  * For C and C++ only. */
824 GMSH_API void gmshModelMeshPreallocateElementsByType(const int elementType,
825                                                      const int elementTag,
826                                                      const int nodeTag,
827                                                      size_t ** elementTags, size_t * elementTags_n,
828                                                      size_t ** nodeTags, size_t * nodeTags_n,
829                                                      const int tag,
830                                                      int * ierr);
831 
832 /* Add elements classified on the entity of dimension `dim' and tag `tag'.
833  * `types' contains the MSH types of the elements (e.g. `2' for 3-node
834  * triangles: see the Gmsh reference manual). `elementTags' is a vector of the
835  * same length as `types'; each entry is a vector containing the tags (unique,
836  * strictly positive identifiers) of the elements of the corresponding type.
837  * `nodeTags' is also a vector of the same length as `types'; each entry is a
838  * vector of length equal to the number of elements of the given type times
839  * the number N of nodes per element, that contains the node tags of all the
840  * elements of the given type, concatenated: [e1n1, e1n2, ..., e1nN, e2n1,
841  * ...]. */
842 GMSH_API void gmshModelMeshAddElements(const int dim,
843                                        const int tag,
844                                        int * elementTypes, size_t elementTypes_n,
845                                        const size_t ** elementTags, const size_t * elementTags_n, size_t elementTags_nn,
846                                        const size_t ** nodeTags, const size_t * nodeTags_n, size_t nodeTags_nn,
847                                        int * ierr);
848 
849 /* Add elements of type `elementType' classified on the entity of tag `tag'.
850  * `elementTags' contains the tags (unique, strictly positive identifiers) of
851  * the elements of the corresponding type. `nodeTags' is a vector of length
852  * equal to the number of elements times the number N of nodes per element,
853  * that contains the node tags of all the elements, concatenated: [e1n1, e1n2,
854  * ..., e1nN, e2n1, ...]. If the `elementTag' vector is empty, new tags are
855  * automatically assigned to the elements. */
856 GMSH_API void gmshModelMeshAddElementsByType(const int tag,
857                                              const int elementType,
858                                              size_t * elementTags, size_t elementTags_n,
859                                              size_t * nodeTags, size_t nodeTags_n,
860                                              int * ierr);
861 
862 /* Get the numerical quadrature information for the given element type
863  * `elementType' and integration rule `integrationType', where
864  * `integrationType' concatenates the integration rule family name with the
865  * desired order (e.g. "Gauss4" for a quadrature suited for integrating 4th
866  * order polynomials). The "CompositeGauss" family uses tensor-product rules
867  * based the 1D Gauss-Legendre rule; the "Gauss" family uses an economic
868  * scheme when available (i.e. with a minimal number of points), and falls
869  * back to "CompositeGauss" otherwise. Note that integration points for the
870  * "Gauss" family can fall outside of the reference element for high-order
871  * rules. `localCoord' contains the u, v, w coordinates of the G integration
872  * points in the reference element: [g1u, g1v, g1w, ..., gGu, gGv, gGw].
873  * `weights' contains the associated weights: [g1q, ..., gGq]. */
874 GMSH_API void gmshModelMeshGetIntegrationPoints(const int elementType,
875                                                 const char * integrationType,
876                                                 double ** localCoord, size_t * localCoord_n,
877                                                 double ** weights, size_t * weights_n,
878                                                 int * ierr);
879 
880 /* Get the Jacobians of all the elements of type `elementType' classified on
881  * the entity of tag `tag', at the G evaluation points `localCoord' given as
882  * concatenated triplets of coordinates in the reference element [g1u, g1v,
883  * g1w, ..., gGu, gGv, gGw]. Data is returned by element, with elements in the
884  * same order as in `getElements' and `getElementsByType'. `jacobians'
885  * contains for each element the 9 entries of the 3x3 Jacobian matrix at each
886  * evaluation point. The matrix is returned by column: [e1g1Jxu, e1g1Jyu,
887  * e1g1Jzu, e1g1Jxv, ..., e1g1Jzw, e1g2Jxu, ..., e1gGJzw, e2g1Jxu, ...], with
888  * Jxu=dx/du, Jyu=dy/du, etc. `determinants' contains for each element the
889  * determinant of the Jacobian matrix at each evaluation point: [e1g1, e1g2,
890  * ... e1gG, e2g1, ...]. `coord' contains for each element the x, y, z
891  * coordinates of the evaluation points. If `tag' < 0, get the Jacobian data
892  * for all entities. If `numTasks' > 1, only compute and return the part of
893  * the data indexed by `task'. */
894 GMSH_API void gmshModelMeshGetJacobians(const int elementType,
895                                         double * localCoord, size_t localCoord_n,
896                                         double ** jacobians, size_t * jacobians_n,
897                                         double ** determinants, size_t * determinants_n,
898                                         double ** coord, size_t * coord_n,
899                                         const int tag,
900                                         const size_t task,
901                                         const size_t numTasks,
902                                         int * ierr);
903 
904 /* Preallocate data before calling `getJacobians' with `numTasks' > 1. For C
905  * and C++ only. */
906 GMSH_API void gmshModelMeshPreallocateJacobians(const int elementType,
907                                                 const int numEvaluationPoints,
908                                                 const int allocateJacobians,
909                                                 const int allocateDeterminants,
910                                                 const int allocateCoord,
911                                                 double ** jacobians, size_t * jacobians_n,
912                                                 double ** determinants, size_t * determinants_n,
913                                                 double ** coord, size_t * coord_n,
914                                                 const int tag,
915                                                 int * ierr);
916 
917 /* Get the Jacobian for a single element `elementTag', at the G evaluation
918  * points `localCoord' given as concatenated triplets of coordinates in the
919  * reference element [g1u, g1v, g1w, ..., gGu, gGv, gGw]. `jacobians' contains
920  * the 9 entries of the 3x3 Jacobian matrix at each evaluation point. The
921  * matrix is returned by column: [e1g1Jxu, e1g1Jyu, e1g1Jzu, e1g1Jxv, ...,
922  * e1g1Jzw, e1g2Jxu, ..., e1gGJzw, e2g1Jxu, ...], with Jxu=dx/du, Jyu=dy/du,
923  * etc. `determinants' contains the determinant of the Jacobian matrix at each
924  * evaluation point. `coord' contains the x, y, z coordinates of the
925  * evaluation points. This function relies on an internal cache (a vector in
926  * case of dense element numbering, a map otherwise); for large meshes
927  * accessing Jacobians in bulk is often preferable. */
928 GMSH_API void gmshModelMeshGetJacobian(const size_t elementTag,
929                                        double * localCoord, size_t localCoord_n,
930                                        double ** jacobians, size_t * jacobians_n,
931                                        double ** determinants, size_t * determinants_n,
932                                        double ** coord, size_t * coord_n,
933                                        int * ierr);
934 
935 /* Get the basis functions of the element of type `elementType' at the
936  * evaluation points `localCoord' (given as concatenated triplets of
937  * coordinates in the reference element [g1u, g1v, g1w, ..., gGu, gGv, gGw]),
938  * for the function space `functionSpaceType'. Currently supported function
939  * spaces include "Lagrange" and "GradLagrange" for isoparametric Lagrange
940  * basis functions and their gradient in the u, v, w coordinates of the
941  * reference element; "LagrangeN" and "GradLagrangeN", with N = 1, 2, ..., for
942  * N-th order Lagrange basis functions; "H1LegendreN" and "GradH1LegendreN",
943  * with N = 1, 2, ..., for N-th order hierarchical H1 Legendre functions;
944  * "HcurlLegendreN" and "CurlHcurlLegendreN", with N = 1, 2, ..., for N-th
945  * order curl-conforming basis functions. `numComponents' returns the number C
946  * of components of a basis function (e.g. 1 for scalar functions and 3 for
947  * vector functions). `basisFunctions' returns the value of the N basis
948  * functions at the evaluation points, i.e. [g1f1, g1f2, ..., g1fN, g2f1, ...]
949  * when C == 1 or [g1f1u, g1f1v, g1f1w, g1f2u, ..., g1fNw, g2f1u, ...] when C
950  * == 3. For basis functions that depend on the orientation of the elements,
951  * all values for the first orientation are returned first, followed by values
952  * for the second, etc. `numOrientations' returns the overall number of
953  * orientations. If `wantedOrientations' is not empty, only return the values
954  * for the desired orientation indices. */
955 GMSH_API void gmshModelMeshGetBasisFunctions(const int elementType,
956                                              double * localCoord, size_t localCoord_n,
957                                              const char * functionSpaceType,
958                                              int * numComponents,
959                                              double ** basisFunctions, size_t * basisFunctions_n,
960                                              int * numOrientations,
961                                              int * wantedOrientations, size_t wantedOrientations_n,
962                                              int * ierr);
963 
964 /* Get the orientation index of the elements of type `elementType' in the
965  * entity of tag `tag'. The arguments have the same meaning as in
966  * `getBasisFunctions'. `basisFunctionsOrientation' is a vector giving for
967  * each element the orientation index in the values returned by
968  * `getBasisFunctions'. For Lagrange basis functions the call is superfluous
969  * as it will return a vector of zeros. */
970 GMSH_API void gmshModelMeshGetBasisFunctionsOrientation(const int elementType,
971                                                         const char * functionSpaceType,
972                                                         int ** basisFunctionsOrientation, size_t * basisFunctionsOrientation_n,
973                                                         const int tag,
974                                                         const size_t task,
975                                                         const size_t numTasks,
976                                                         int * ierr);
977 
978 /* Get the orientation of a single element `elementTag'. */
979 GMSH_API void gmshModelMeshGetBasisFunctionsOrientationForElement(const size_t elementTag,
980                                                                   const char * functionSpaceType,
981                                                                   int * basisFunctionsOrientation,
982                                                                   int * ierr);
983 
984 /* Get the number of possible orientations for elements of type `elementType'
985  * and function space named `functionSpaceType'. */
986 GMSH_API int gmshModelMeshGetNumberOfOrientations(const int elementType,
987                                                   const char * functionSpaceType,
988                                                   int * ierr);
989 
990 /* Preallocate data before calling `getBasisFunctionsOrientation' with
991  * `numTasks' > 1. For C and C++ only. */
992 GMSH_API void gmshModelMeshPreallocateBasisFunctionsOrientation(const int elementType,
993                                                                 int ** basisFunctionsOrientation, size_t * basisFunctionsOrientation_n,
994                                                                 const int tag,
995                                                                 int * ierr);
996 
997 /* Get the global unique mesh edge identifiers `edgeTags' and orientations
998  * `edgeOrientation' for an input list of node tag pairs defining these edges,
999  * concatenated in the vector `nodeTags'. Mesh edges are created e.g. by
1000  * `createEdges()', `getKeys()' or `addEdges()'. The reference positive
1001  * orientation is n1 < n2, where n1 and n2 are the tags of the two edge nodes,
1002  * which corresponds to the local orientation of edge-based basis functions as
1003  * well. */
1004 GMSH_API void gmshModelMeshGetEdges(size_t * nodeTags, size_t nodeTags_n,
1005                                     size_t ** edgeTags, size_t * edgeTags_n,
1006                                     int ** edgeOrientations, size_t * edgeOrientations_n,
1007                                     int * ierr);
1008 
1009 /* Get the global unique mesh face identifiers `faceTags' and orientations
1010  * `faceOrientations' for an input list of node tag triplets (if `faceType' ==
1011  * 3) or quadruplets (if `faceType' == 4) defining these faces, concatenated
1012  * in the vector `nodeTags'. Mesh faces are created e.g. by `createFaces()',
1013  * `getKeys()' or `addFaces()'. */
1014 GMSH_API void gmshModelMeshGetFaces(const int faceType,
1015                                     size_t * nodeTags, size_t nodeTags_n,
1016                                     size_t ** faceTags, size_t * faceTags_n,
1017                                     int ** faceOrientations, size_t * faceOrientations_n,
1018                                     int * ierr);
1019 
1020 /* Create unique mesh edges for the entities `dimTags'. */
1021 GMSH_API void gmshModelMeshCreateEdges(int * dimTags, size_t dimTags_n,
1022                                        int * ierr);
1023 
1024 /* Create unique mesh faces for the entities `dimTags'. */
1025 GMSH_API void gmshModelMeshCreateFaces(int * dimTags, size_t dimTags_n,
1026                                        int * ierr);
1027 
1028 /* Get the global unique identifiers `edgeTags' and the nodes `edgeNodes' of
1029  * the edges in the mesh. Mesh edges are created e.g. by `createEdges()',
1030  * `getKeys()' or addEdges(). */
1031 GMSH_API void gmshModelMeshGetAllEdges(size_t ** edgeTags, size_t * edgeTags_n,
1032                                        size_t ** edgeNodes, size_t * edgeNodes_n,
1033                                        int * ierr);
1034 
1035 /* Get the global unique identifiers `faceTags' and the nodes `faceNodes' of
1036  * the faces of type `faceType' in the mesh. Mesh faces are created e.g. by
1037  * `createFaces()', `getKeys()' or addFaces(). */
1038 GMSH_API void gmshModelMeshGetAllFaces(const int faceType,
1039                                        size_t ** faceTags, size_t * faceTags_n,
1040                                        size_t ** faceNodes, size_t * faceNodes_n,
1041                                        int * ierr);
1042 
1043 /* Add mesh edges defined by their global unique identifiers `edgeTags' and
1044  * their nodes `edgeNodes'. */
1045 GMSH_API void gmshModelMeshAddEdges(size_t * edgeTags, size_t edgeTags_n,
1046                                     size_t * edgeNodes, size_t edgeNodes_n,
1047                                     int * ierr);
1048 
1049 /* Add mesh faces of type `faceType' defined by their global unique
1050  * identifiers `faceTags' and their nodes `faceNodes'. */
1051 GMSH_API void gmshModelMeshAddFaces(const int faceType,
1052                                     size_t * faceTags, size_t faceTags_n,
1053                                     size_t * faceNodes, size_t faceNodes_n,
1054                                     int * ierr);
1055 
1056 /* Generate the pair of keys for the elements of type `elementType' in the
1057  * entity of tag `tag', for the `functionSpaceType' function space. Each pair
1058  * (`typeKey', `entityKey') uniquely identifies a basis function in the
1059  * function space. If `returnCoord' is set, the `coord' vector contains the x,
1060  * y, z coordinates locating basis functions for sorting purposes. Warning:
1061  * this is an experimental feature and will probably change in a future
1062  * release. */
1063 GMSH_API void gmshModelMeshGetKeys(const int elementType,
1064                                    const char * functionSpaceType,
1065                                    int ** typeKeys, size_t * typeKeys_n,
1066                                    size_t ** entityKeys, size_t * entityKeys_n,
1067                                    double ** coord, size_t * coord_n,
1068                                    const int tag,
1069                                    const int returnCoord,
1070                                    int * ierr);
1071 
1072 /* Get the pair of keys for a single element `elementTag'. */
1073 GMSH_API void gmshModelMeshGetKeysForElement(const size_t elementTag,
1074                                              const char * functionSpaceType,
1075                                              int ** typeKeys, size_t * typeKeys_n,
1076                                              size_t ** entityKeys, size_t * entityKeys_n,
1077                                              double ** coord, size_t * coord_n,
1078                                              const int returnCoord,
1079                                              int * ierr);
1080 
1081 /* Get the number of keys by elements of type `elementType' for function space
1082  * named `functionSpaceType'. */
1083 GMSH_API int gmshModelMeshGetNumberOfKeys(const int elementType,
1084                                           const char * functionSpaceType,
1085                                           int * ierr);
1086 
1087 /* Get information about the pair of `keys'. `infoKeys' returns information
1088  * about the functions associated with the pairs (`typeKeys', `entityKey').
1089  * `infoKeys[0].first' describes the type of function (0 for  vertex function,
1090  * 1 for edge function, 2 for face function and 3 for bubble function).
1091  * `infoKeys[0].second' gives the order of the function associated with the
1092  * key. Warning: this is an experimental feature and will probably change in a
1093  * future release. */
1094 GMSH_API void gmshModelMeshGetKeysInformation(int * typeKeys, size_t typeKeys_n,
1095                                               size_t * entityKeys, size_t entityKeys_n,
1096                                               const int elementType,
1097                                               const char * functionSpaceType,
1098                                               int ** infoKeys, size_t * infoKeys_n,
1099                                               int * ierr);
1100 
1101 /* Get the barycenters of all elements of type `elementType' classified on the
1102  * entity of tag `tag'. If `primary' is set, only the primary nodes of the
1103  * elements are taken into account for the barycenter calculation. If `fast'
1104  * is set, the function returns the sum of the primary node coordinates
1105  * (without normalizing by the number of nodes). If `tag' < 0, get the
1106  * barycenters for all entities. If `numTasks' > 1, only compute and return
1107  * the part of the data indexed by `task'. */
1108 GMSH_API void gmshModelMeshGetBarycenters(const int elementType,
1109                                           const int tag,
1110                                           const int fast,
1111                                           const int primary,
1112                                           double ** barycenters, size_t * barycenters_n,
1113                                           const size_t task,
1114                                           const size_t numTasks,
1115                                           int * ierr);
1116 
1117 /* Preallocate data before calling `getBarycenters' with `numTasks' > 1. For C
1118  * and C++ only. */
1119 GMSH_API void gmshModelMeshPreallocateBarycenters(const int elementType,
1120                                                   double ** barycenters, size_t * barycenters_n,
1121                                                   const int tag,
1122                                                   int * ierr);
1123 
1124 /* Get the nodes on the edges of all elements of type `elementType' classified
1125  * on the entity of tag `tag'. `nodeTags' contains the node tags of the edges
1126  * for all the elements: [e1a1n1, e1a1n2, e1a2n1, ...]. Data is returned by
1127  * element, with elements in the same order as in `getElements' and
1128  * `getElementsByType'. If `primary' is set, only the primary (begin/end)
1129  * nodes of the edges are returned. If `tag' < 0, get the edge nodes for all
1130  * entities. If `numTasks' > 1, only compute and return the part of the data
1131  * indexed by `task'. */
1132 GMSH_API void gmshModelMeshGetElementEdgeNodes(const int elementType,
1133                                                size_t ** nodeTags, size_t * nodeTags_n,
1134                                                const int tag,
1135                                                const int primary,
1136                                                const size_t task,
1137                                                const size_t numTasks,
1138                                                int * ierr);
1139 
1140 /* Get the nodes on the faces of type `faceType' (3 for triangular faces, 4
1141  * for quadrangular faces) of all elements of type `elementType' classified on
1142  * the entity of tag `tag'. `nodeTags' contains the node tags of the faces for
1143  * all elements: [e1f1n1, ..., e1f1nFaceType, e1f2n1, ...]. Data is returned
1144  * by element, with elements in the same order as in `getElements' and
1145  * `getElementsByType'. If `primary' is set, only the primary (corner) nodes
1146  * of the faces are returned. If `tag' < 0, get the face nodes for all
1147  * entities. If `numTasks' > 1, only compute and return the part of the data
1148  * indexed by `task'. */
1149 GMSH_API void gmshModelMeshGetElementFaceNodes(const int elementType,
1150                                                const int faceType,
1151                                                size_t ** nodeTags, size_t * nodeTags_n,
1152                                                const int tag,
1153                                                const int primary,
1154                                                const size_t task,
1155                                                const size_t numTasks,
1156                                                int * ierr);
1157 
1158 /* Get the ghost elements `elementTags' and their associated `partitions'
1159  * stored in the ghost entity of dimension `dim' and tag `tag'. */
1160 GMSH_API void gmshModelMeshGetGhostElements(const int dim,
1161                                             const int tag,
1162                                             size_t ** elementTags, size_t * elementTags_n,
1163                                             int ** partitions, size_t * partitions_n,
1164                                             int * ierr);
1165 
1166 /* Set a mesh size constraint on the model entities `dimTags'. Currently only
1167  * entities of dimension 0 (points) are handled. */
1168 GMSH_API void gmshModelMeshSetSize(int * dimTags, size_t dimTags_n,
1169                                    const double size,
1170                                    int * ierr);
1171 
1172 /* Get the mesh size constraints (if any) associated with the model entities
1173  * `dimTags'. A zero entry in the output `sizes' vector indicates that no size
1174  * constraint is specified on the corresponding entity. */
1175 GMSH_API void gmshModelMeshGetSizes(int * dimTags, size_t dimTags_n,
1176                                     double ** sizes, size_t * sizes_n,
1177                                     int * ierr);
1178 
1179 /* Set mesh size constraints at the given parametric points `parametricCoord'
1180  * on the model entity of dimension `dim' and tag `tag'. Currently only
1181  * entities of dimension 1 (lines) are handled. */
1182 GMSH_API void gmshModelMeshSetSizeAtParametricPoints(const int dim,
1183                                                      const int tag,
1184                                                      double * parametricCoord, size_t parametricCoord_n,
1185                                                      double * sizes, size_t sizes_n,
1186                                                      int * ierr);
1187 
1188 /* Set a mesh size callback for the current model. The callback function
1189  * should take six arguments as input (`dim', `tag', `x', `y', `z' and `lc').
1190  * The first two integer arguments correspond to the dimension `dim' and tag
1191  * `tag' of the entity being meshed. The next four double precision arguments
1192  * correspond to the coordinates `x', `y' and `z' around which to prescribe
1193  * the mesh size and to the mesh size `lc' that would be prescribed if the
1194  * callback had not been called. The callback function should return a double
1195  * precision number specifying the desired mesh size; returning `lc' is
1196  * equivalent to a no-op. */
1197 GMSH_API void gmshModelMeshSetSizeCallback(double (*callback)(int dim, int tag, double x, double y, double z, double lc, void * data), void * callback_data,
1198                                            int * ierr);
1199 
1200 /* Remove the mesh size callback from the current model. */
1201 GMSH_API void gmshModelMeshRemoveSizeCallback(int * ierr);
1202 
1203 /* Set a transfinite meshing constraint on the curve `tag', with `numNodes'
1204  * nodes distributed according to `meshType' and `coef'. Currently supported
1205  * types are "Progression" (geometrical progression with power `coef'), "Bump"
1206  * (refinement toward both extremities of the curve) and "Beta" (beta law). */
1207 GMSH_API void gmshModelMeshSetTransfiniteCurve(const int tag,
1208                                                const int numNodes,
1209                                                const char * meshType,
1210                                                const double coef,
1211                                                int * ierr);
1212 
1213 /* Set a transfinite meshing constraint on the surface `tag'. `arrangement'
1214  * describes the arrangement of the triangles when the surface is not flagged
1215  * as recombined: currently supported values are "Left", "Right",
1216  * "AlternateLeft" and "AlternateRight". `cornerTags' can be used to specify
1217  * the (3 or 4) corners of the transfinite interpolation explicitly;
1218  * specifying the corners explicitly is mandatory if the surface has more that
1219  * 3 or 4 points on its boundary. */
1220 GMSH_API void gmshModelMeshSetTransfiniteSurface(const int tag,
1221                                                  const char * arrangement,
1222                                                  int * cornerTags, size_t cornerTags_n,
1223                                                  int * ierr);
1224 
1225 /* Set a transfinite meshing constraint on the surface `tag'. `cornerTags' can
1226  * be used to specify the (6 or 8) corners of the transfinite interpolation
1227  * explicitly. */
1228 GMSH_API void gmshModelMeshSetTransfiniteVolume(const int tag,
1229                                                 int * cornerTags, size_t cornerTags_n,
1230                                                 int * ierr);
1231 
1232 /* Set transfinite meshing constraints on the model entities in `dimTag'.
1233  * Transfinite meshing constraints are added to the curves of the quadrangular
1234  * surfaces and to the faces of 6-sided volumes. Quadragular faces with a
1235  * corner angle superior to `cornerAngle' (in radians) are ignored. The number
1236  * of points is automatically determined from the sizing constraints. If
1237  * `dimTag' is empty, the constraints are applied to all entities in the
1238  * model. If `recombine' is true, the recombine flag is automatically set on
1239  * the transfinite surfaces. */
1240 GMSH_API void gmshModelMeshSetTransfiniteAutomatic(int * dimTags, size_t dimTags_n,
1241                                                    const double cornerAngle,
1242                                                    const int recombine,
1243                                                    int * ierr);
1244 
1245 /* Set a recombination meshing constraint on the model entity of dimension
1246  * `dim' and tag `tag'. Currently only entities of dimension 2 (to recombine
1247  * triangles into quadrangles) are supported. */
1248 GMSH_API void gmshModelMeshSetRecombine(const int dim,
1249                                         const int tag,
1250                                         int * ierr);
1251 
1252 /* Set a smoothing meshing constraint on the model entity of dimension `dim'
1253  * and tag `tag'. `val' iterations of a Laplace smoother are applied. */
1254 GMSH_API void gmshModelMeshSetSmoothing(const int dim,
1255                                         const int tag,
1256                                         const int val,
1257                                         int * ierr);
1258 
1259 /* Set a reverse meshing constraint on the model entity of dimension `dim' and
1260  * tag `tag'. If `val' is true, the mesh orientation will be reversed with
1261  * respect to the natural mesh orientation (i.e. the orientation consistent
1262  * with the orientation of the geometry). If `val' is false, the mesh is left
1263  * as-is. */
1264 GMSH_API void gmshModelMeshSetReverse(const int dim,
1265                                       const int tag,
1266                                       const int val,
1267                                       int * ierr);
1268 
1269 /* Set the meshing algorithm on the model entity of dimension `dim' and tag
1270  * `tag'. Currently only supported for `dim' == 2. */
1271 GMSH_API void gmshModelMeshSetAlgorithm(const int dim,
1272                                         const int tag,
1273                                         const int val,
1274                                         int * ierr);
1275 
1276 /* Force the mesh size to be extended from the boundary, or not, for the model
1277  * entity of dimension `dim' and tag `tag'. Currently only supported for `dim'
1278  * == 2. */
1279 GMSH_API void gmshModelMeshSetSizeFromBoundary(const int dim,
1280                                                const int tag,
1281                                                const int val,
1282                                                int * ierr);
1283 
1284 /* Set a compound meshing constraint on the model entities of dimension `dim'
1285  * and tags `tags'. During meshing, compound entities are treated as a single
1286  * discrete entity, which is automatically reparametrized. */
1287 GMSH_API void gmshModelMeshSetCompound(const int dim,
1288                                        int * tags, size_t tags_n,
1289                                        int * ierr);
1290 
1291 /* Set meshing constraints on the bounding surfaces of the volume of tag `tag'
1292  * so that all surfaces are oriented with outward pointing normals; and if a
1293  * mesh already exists, reorient it. Currently only available with the
1294  * OpenCASCADE kernel, as it relies on the STL triangulation. */
1295 GMSH_API void gmshModelMeshSetOutwardOrientation(const int tag,
1296                                                  int * ierr);
1297 
1298 /* Remove all meshing constraints from the model entities `dimTags'. If
1299  * `dimTags' is empty, remove all constraings. */
1300 GMSH_API void gmshModelMeshRemoveConstraints(int * dimTags, size_t dimTags_n,
1301                                              int * ierr);
1302 
1303 /* Embed the model entities of dimension `dim' and tags `tags' in the
1304  * (`inDim', `inTag') model entity. The dimension `dim' can 0, 1 or 2 and must
1305  * be strictly smaller than `inDim', which must be either 2 or 3. The embedded
1306  * entities should not intersect each other or be part of the boundary of the
1307  * entity `inTag', whose mesh will conform to the mesh of the embedded
1308  * entities. With the OpenCASCADE kernel, if the `fragment' operation is
1309  * applied to entities of different dimensions, the lower dimensional entities
1310  * will be automatically embedded in the higher dimensional entities if they
1311  * are not on their boundary. */
1312 GMSH_API void gmshModelMeshEmbed(const int dim,
1313                                  int * tags, size_t tags_n,
1314                                  const int inDim,
1315                                  const int inTag,
1316                                  int * ierr);
1317 
1318 /* Remove embedded entities from the model entities `dimTags'. if `dim' is >=
1319  * 0, only remove embedded entities of the given dimension (e.g. embedded
1320  * points if `dim' == 0). */
1321 GMSH_API void gmshModelMeshRemoveEmbedded(int * dimTags, size_t dimTags_n,
1322                                           const int dim,
1323                                           int * ierr);
1324 
1325 /* Get the entities (if any) embedded in the model entity of dimension `dim'
1326  * and tag `tag'. */
1327 GMSH_API void gmshModelMeshGetEmbedded(const int dim,
1328                                        const int tag,
1329                                        int ** dimTags, size_t * dimTags_n,
1330                                        int * ierr);
1331 
1332 /* Reorder the elements of type `elementType' classified on the entity of tag
1333  * `tag' according to `ordering'. */
1334 GMSH_API void gmshModelMeshReorderElements(const int elementType,
1335                                            const int tag,
1336                                            size_t * ordering, size_t ordering_n,
1337                                            int * ierr);
1338 
1339 /* Renumber the node tags in a continuous sequence. */
1340 GMSH_API void gmshModelMeshRenumberNodes(int * ierr);
1341 
1342 /* Renumber the element tags in a continuous sequence. */
1343 GMSH_API void gmshModelMeshRenumberElements(int * ierr);
1344 
1345 /* Set the meshes of the entities of dimension `dim' and tag `tags' as
1346  * periodic copies of the meshes of entities `tagsMaster', using the affine
1347  * transformation specified in `affineTransformation' (16 entries of a 4x4
1348  * matrix, by row). If used after meshing, generate the periodic node
1349  * correspondence information assuming the meshes of entities `tags'
1350  * effectively match the meshes of entities `tagsMaster' (useful for
1351  * structured and extruded meshes). Currently only available for @code{dim} ==
1352  * 1 and @code{dim} == 2. */
1353 GMSH_API void gmshModelMeshSetPeriodic(const int dim,
1354                                        int * tags, size_t tags_n,
1355                                        int * tagsMaster, size_t tagsMaster_n,
1356                                        double * affineTransform, size_t affineTransform_n,
1357                                        int * ierr);
1358 
1359 /* Get master entities `tagsMaster' for the entities of dimension `dim' and
1360  * tags `tags'. */
1361 GMSH_API void gmshModelMeshGetPeriodic(const int dim,
1362                                        int * tags, size_t tags_n,
1363                                        int ** tagMaster, size_t * tagMaster_n,
1364                                        int * ierr);
1365 
1366 /* Get the master entity `tagMaster', the node tags `nodeTags' and their
1367  * corresponding master node tags `nodeTagsMaster', and the affine transform
1368  * `affineTransform' for the entity of dimension `dim' and tag `tag'. If
1369  * `includeHighOrderNodes' is set, include high-order nodes in the returned
1370  * data. */
1371 GMSH_API void gmshModelMeshGetPeriodicNodes(const int dim,
1372                                             const int tag,
1373                                             int * tagMaster,
1374                                             size_t ** nodeTags, size_t * nodeTags_n,
1375                                             size_t ** nodeTagsMaster, size_t * nodeTagsMaster_n,
1376                                             double ** affineTransform, size_t * affineTransform_n,
1377                                             const int includeHighOrderNodes,
1378                                             int * ierr);
1379 
1380 /* Get the master entity `tagMaster' and the key pairs (`typeKeyMaster',
1381  * `entityKeyMaster') corresponding to the entity `tag' and the key pairs
1382  * (`typeKey', `entityKey') for the elements of type `elementType' and
1383  * function space type `functionSpaceType'. If `returnCoord' is set, the
1384  * `coord' and `coordMaster' vectors contain the x, y, z coordinates locating
1385  * basis functions for sorting purposes. */
1386 GMSH_API void gmshModelMeshGetPeriodicKeys(const int elementType,
1387                                            const char * functionSpaceType,
1388                                            const int tag,
1389                                            int * tagMaster,
1390                                            int ** typeKeys, size_t * typeKeys_n,
1391                                            int ** typeKeysMaster, size_t * typeKeysMaster_n,
1392                                            size_t ** entityKeys, size_t * entityKeys_n,
1393                                            size_t ** entityKeysMaster, size_t * entityKeysMaster_n,
1394                                            double ** coord, size_t * coord_n,
1395                                            double ** coordMaster, size_t * coordMaster_n,
1396                                            const int returnCoord,
1397                                            int * ierr);
1398 
1399 /* Remove duplicate nodes in the mesh of the current model. */
1400 GMSH_API void gmshModelMeshRemoveDuplicateNodes(int * ierr);
1401 
1402 /* Split (into two triangles) all quadrangles in surface `tag' whose quality
1403  * is lower than `quality'. If `tag' < 0, split quadrangles in all surfaces. */
1404 GMSH_API void gmshModelMeshSplitQuadrangles(const double quality,
1405                                             const int tag,
1406                                             int * ierr);
1407 
1408 /* Classify ("color") the surface mesh based on the angle threshold `angle'
1409  * (in radians), and create new discrete surfaces, curves and points
1410  * accordingly. If `boundary' is set, also create discrete curves on the
1411  * boundary if the surface is open. If `forReparametrization' is set, create
1412  * curves and surfaces that can be reparametrized using a single map. If
1413  * `curveAngle' is less than Pi, also force curves to be split according to
1414  * `curveAngle'. If `exportDiscrete' is set, clear any built-in CAD kernel
1415  * entities and export the discrete entities in the built-in CAD kernel. */
1416 GMSH_API void gmshModelMeshClassifySurfaces(const double angle,
1417                                             const int boundary,
1418                                             const int forReparametrization,
1419                                             const double curveAngle,
1420                                             const int exportDiscrete,
1421                                             int * ierr);
1422 
1423 /* Create a geometry for the discrete entities `dimTags' (represented solely
1424  * by a mesh, without an underlying CAD description), i.e. create a
1425  * parametrization for discrete curves and surfaces, assuming that each can be
1426  * parametrized with a single map. If `dimTags' is empty, create a geometry
1427  * for all the discrete entities. */
1428 GMSH_API void gmshModelMeshCreateGeometry(int * dimTags, size_t dimTags_n,
1429                                           int * ierr);
1430 
1431 /* Create a boundary representation from the mesh if the model does not have
1432  * one (e.g. when imported from mesh file formats with no BRep representation
1433  * of the underlying model). If `makeSimplyConnected' is set, enforce simply
1434  * connected discrete surfaces and volumes. If `exportDiscrete' is set, clear
1435  * any built-in CAD kernel entities and export the discrete entities in the
1436  * built-in CAD kernel. */
1437 GMSH_API void gmshModelMeshCreateTopology(const int makeSimplyConnected,
1438                                           const int exportDiscrete,
1439                                           int * ierr);
1440 
1441 /* Compute a basis representation for homology spaces after a mesh has been
1442  * generated. The computation domain is given in a list of physical group tags
1443  * `domainTags'; if empty, the whole mesh is the domain. The computation
1444  * subdomain for relative homology computation is given in a list of physical
1445  * group tags `subdomainTags'; if empty, absolute homology is computed. The
1446  * dimensions homology bases to be computed are given in the list `dim'; if
1447  * empty, all bases are computed. Resulting basis representation chains are
1448  * stored as physical groups in the mesh. */
1449 GMSH_API void gmshModelMeshComputeHomology(int * domainTags, size_t domainTags_n,
1450                                            int * subdomainTags, size_t subdomainTags_n,
1451                                            int * dims, size_t dims_n,
1452                                            int * ierr);
1453 
1454 /* Compute a basis representation for cohomology spaces after a mesh has been
1455  * generated. The computation domain is given in a list of physical group tags
1456  * `domainTags'; if empty, the whole mesh is the domain. The computation
1457  * subdomain for relative cohomology computation is given in a list of
1458  * physical group tags `subdomainTags'; if empty, absolute cohomology is
1459  * computed. The dimensions homology bases to be computed are given in the
1460  * list `dim'; if empty, all bases are computed. Resulting basis
1461  * representation cochains are stored as physical groups in the mesh. */
1462 GMSH_API void gmshModelMeshComputeCohomology(int * domainTags, size_t domainTags_n,
1463                                              int * subdomainTags, size_t subdomainTags_n,
1464                                              int * dims, size_t dims_n,
1465                                              int * ierr);
1466 
1467 /* Compute a cross field for the current mesh. The function creates 3 views:
1468  * the H function, the Theta function and cross directions. Return the tags of
1469  * the views. */
1470 GMSH_API void gmshModelMeshComputeCrossField(int ** viewTags, size_t * viewTags_n,
1471                                              int * ierr);
1472 
1473 /* Triangulate the points given in the `coord' vector as pairs of u, v
1474  * coordinates, and return the node tags (with numbering starting at 1) of the
1475  * resulting triangles in `tri'. */
1476 GMSH_API void gmshModelMeshTriangulate(double * coord, size_t coord_n,
1477                                        size_t ** tri, size_t * tri_n,
1478                                        int * ierr);
1479 
1480 /* Tetrahedralize the points given in the `coord' vector as triplets of x, y,
1481  * z coordinates, and return the node tags (with numbering starting at 1) of
1482  * the resulting tetrahedra in `tetra'. */
1483 GMSH_API void gmshModelMeshTetrahedralize(double * coord, size_t coord_n,
1484                                           size_t ** tetra, size_t * tetra_n,
1485                                           int * ierr);
1486 
1487 /* Add a new mesh size field of type `fieldType'. If `tag' is positive, assign
1488  * the tag explicitly; otherwise a new tag is assigned automatically. Return
1489  * the field tag. */
1490 GMSH_API int gmshModelMeshFieldAdd(const char * fieldType,
1491                                    const int tag,
1492                                    int * ierr);
1493 
1494 /* Remove the field with tag `tag'. */
1495 GMSH_API void gmshModelMeshFieldRemove(const int tag,
1496                                        int * ierr);
1497 
1498 /* Get the list of all fields. */
1499 GMSH_API void gmshModelMeshFieldList(int ** tags, size_t * tags_n,
1500                                      int * ierr);
1501 
1502 /* Get the type `fieldType' of the field with tag `tag'. */
1503 GMSH_API void gmshModelMeshFieldGetType(const int tag,
1504                                         char ** fileType,
1505                                         int * ierr);
1506 
1507 /* Set the numerical option `option' to value `value' for field `tag'. */
1508 GMSH_API void gmshModelMeshFieldSetNumber(const int tag,
1509                                           const char * option,
1510                                           const double value,
1511                                           int * ierr);
1512 
1513 /* Get the value of the numerical option `option' for field `tag'. */
1514 GMSH_API void gmshModelMeshFieldGetNumber(const int tag,
1515                                           const char * option,
1516                                           double * value,
1517                                           int * ierr);
1518 
1519 /* Set the string option `option' to value `value' for field `tag'. */
1520 GMSH_API void gmshModelMeshFieldSetString(const int tag,
1521                                           const char * option,
1522                                           const char * value,
1523                                           int * ierr);
1524 
1525 /* Get the value of the string option `option' for field `tag'. */
1526 GMSH_API void gmshModelMeshFieldGetString(const int tag,
1527                                           const char * option,
1528                                           char ** value,
1529                                           int * ierr);
1530 
1531 /* Set the numerical list option `option' to value `value' for field `tag'. */
1532 GMSH_API void gmshModelMeshFieldSetNumbers(const int tag,
1533                                            const char * option,
1534                                            double * value, size_t value_n,
1535                                            int * ierr);
1536 
1537 /* Get the value of the numerical list option `option' for field `tag'. */
1538 GMSH_API void gmshModelMeshFieldGetNumbers(const int tag,
1539                                            const char * option,
1540                                            double ** value, size_t * value_n,
1541                                            int * ierr);
1542 
1543 /* Set the field `tag' as the background mesh size field. */
1544 GMSH_API void gmshModelMeshFieldSetAsBackgroundMesh(const int tag,
1545                                                     int * ierr);
1546 
1547 /* Set the field `tag' as a boundary layer size field. */
1548 GMSH_API void gmshModelMeshFieldSetAsBoundaryLayer(const int tag,
1549                                                    int * ierr);
1550 
1551 /* Add a geometrical point in the built-in CAD representation, at coordinates
1552  * (`x', `y', `z'). If `meshSize' is > 0, add a meshing constraint at that
1553  * point. If `tag' is positive, set the tag explicitly; otherwise a new tag is
1554  * selected automatically. Return the tag of the point. (Note that the point
1555  * will be added in the current model only after `synchronize' is called. This
1556  * behavior holds for all the entities added in the geo module.) */
1557 GMSH_API int gmshModelGeoAddPoint(const double x,
1558                                   const double y,
1559                                   const double z,
1560                                   const double meshSize,
1561                                   const int tag,
1562                                   int * ierr);
1563 
1564 /* Add a straight line segment in the built-in CAD representation, between the
1565  * two points with tags `startTag' and `endTag'. If `tag' is positive, set the
1566  * tag explicitly; otherwise a new tag is selected automatically. Return the
1567  * tag of the line. */
1568 GMSH_API int gmshModelGeoAddLine(const int startTag,
1569                                  const int endTag,
1570                                  const int tag,
1571                                  int * ierr);
1572 
1573 /* Add a circle arc (strictly smaller than Pi) in the built-in CAD
1574  * representation, between the two points with tags `startTag' and `endTag',
1575  * and with center `centerTag'. If `tag' is positive, set the tag explicitly;
1576  * otherwise a new tag is selected automatically. If (`nx', `ny', `nz') != (0,
1577  * 0, 0), explicitly set the plane of the circle arc. Return the tag of the
1578  * circle arc. */
1579 GMSH_API int gmshModelGeoAddCircleArc(const int startTag,
1580                                       const int centerTag,
1581                                       const int endTag,
1582                                       const int tag,
1583                                       const double nx,
1584                                       const double ny,
1585                                       const double nz,
1586                                       int * ierr);
1587 
1588 /* Add an ellipse arc (strictly smaller than Pi) in the built-in CAD
1589  * representation, between the two points `startTag' and `endTag', and with
1590  * center `centerTag' and major axis point `majorTag'. If `tag' is positive,
1591  * set the tag explicitly; otherwise a new tag is selected automatically. If
1592  * (`nx', `ny', `nz') != (0, 0, 0), explicitly set the plane of the circle
1593  * arc. Return the tag of the ellipse arc. */
1594 GMSH_API int gmshModelGeoAddEllipseArc(const int startTag,
1595                                        const int centerTag,
1596                                        const int majorTag,
1597                                        const int endTag,
1598                                        const int tag,
1599                                        const double nx,
1600                                        const double ny,
1601                                        const double nz,
1602                                        int * ierr);
1603 
1604 /* Add a spline (Catmull-Rom) curve in the built-in CAD representation, going
1605  * through the points `pointTags'. If `tag' is positive, set the tag
1606  * explicitly; otherwise a new tag is selected automatically. Create a
1607  * periodic curve if the first and last points are the same. Return the tag of
1608  * the spline curve. */
1609 GMSH_API int gmshModelGeoAddSpline(int * pointTags, size_t pointTags_n,
1610                                    const int tag,
1611                                    int * ierr);
1612 
1613 /* Add a cubic b-spline curve in the built-in CAD representation, with
1614  * `pointTags' control points. If `tag' is positive, set the tag explicitly;
1615  * otherwise a new tag is selected automatically. Creates a periodic curve if
1616  * the first and last points are the same. Return the tag of the b-spline
1617  * curve. */
1618 GMSH_API int gmshModelGeoAddBSpline(int * pointTags, size_t pointTags_n,
1619                                     const int tag,
1620                                     int * ierr);
1621 
1622 /* Add a Bezier curve in the built-in CAD representation, with `pointTags'
1623  * control points. If `tag' is positive, set the tag explicitly; otherwise a
1624  * new tag is selected automatically.  Return the tag of the Bezier curve. */
1625 GMSH_API int gmshModelGeoAddBezier(int * pointTags, size_t pointTags_n,
1626                                    const int tag,
1627                                    int * ierr);
1628 
1629 /* Add a polyline curve in the built-in CAD representation, going through the
1630  * points `pointTags'. If `tag' is positive, set the tag explicitly; otherwise
1631  * a new tag is selected automatically. Create a periodic curve if the first
1632  * and last points are the same. Return the tag of the polyline curve. */
1633 GMSH_API int gmshModelGeoAddPolyline(int * pointTags, size_t pointTags_n,
1634                                      const int tag,
1635                                      int * ierr);
1636 
1637 /* Add a spline (Catmull-Rom) curve in the built-in CAD representation, going
1638  * through points sampling the curves in `curveTags'. The density of sampling
1639  * points on each curve is governed by `numIntervals'. If `tag' is positive,
1640  * set the tag explicitly; otherwise a new tag is selected automatically.
1641  * Return the tag of the spline. */
1642 GMSH_API int gmshModelGeoAddCompoundSpline(int * curveTags, size_t curveTags_n,
1643                                            const int numIntervals,
1644                                            const int tag,
1645                                            int * ierr);
1646 
1647 /* Add a b-spline curve in the built-in CAD representation, with control
1648  * points sampling the curves in `curveTags'. The density of sampling points
1649  * on each curve is governed by `numIntervals'. If `tag' is positive, set the
1650  * tag explicitly; otherwise a new tag is selected automatically. Return the
1651  * tag of the b-spline. */
1652 GMSH_API int gmshModelGeoAddCompoundBSpline(int * curveTags, size_t curveTags_n,
1653                                             const int numIntervals,
1654                                             const int tag,
1655                                             int * ierr);
1656 
1657 /* Add a curve loop (a closed wire) in the built-in CAD representation, formed
1658  * by the curves `curveTags'. `curveTags' should contain (signed) tags of
1659  * model entities of dimension 1 forming a closed loop: a negative tag
1660  * signifies that the underlying curve is considered with reversed
1661  * orientation. If `tag' is positive, set the tag explicitly; otherwise a new
1662  * tag is selected automatically. If `reorient' is set, automatically reorient
1663  * the curves if necessary. Return the tag of the curve loop. */
1664 GMSH_API int gmshModelGeoAddCurveLoop(int * curveTags, size_t curveTags_n,
1665                                       const int tag,
1666                                       const int reorient,
1667                                       int * ierr);
1668 
1669 /* Add curve loops in the built-in CAD representation based on the curves
1670  * `curveTags'. Return the `tags' of found curve loops, if any. */
1671 GMSH_API void gmshModelGeoAddCurveLoops(int * curveTags, size_t curveTags_n,
1672                                         int ** tags, size_t * tags_n,
1673                                         int * ierr);
1674 
1675 /* Add a plane surface in the built-in CAD representation, defined by one or
1676  * more curve loops `wireTags'. The first curve loop defines the exterior
1677  * contour; additional curve loop define holes. If `tag' is positive, set the
1678  * tag explicitly; otherwise a new tag is selected automatically. Return the
1679  * tag of the surface. */
1680 GMSH_API int gmshModelGeoAddPlaneSurface(int * wireTags, size_t wireTags_n,
1681                                          const int tag,
1682                                          int * ierr);
1683 
1684 /* Add a surface in the built-in CAD representation, filling the curve loops
1685  * in `wireTags' using transfinite interpolation. Currently only a single
1686  * curve loop is supported; this curve loop should be composed by 3 or 4
1687  * curves only. If `tag' is positive, set the tag explicitly; otherwise a new
1688  * tag is selected automatically. Return the tag of the surface. */
1689 GMSH_API int gmshModelGeoAddSurfaceFilling(int * wireTags, size_t wireTags_n,
1690                                            const int tag,
1691                                            const int sphereCenterTag,
1692                                            int * ierr);
1693 
1694 /* Add a surface loop (a closed shell) formed by `surfaceTags' in the built-in
1695  * CAD representation.  If `tag' is positive, set the tag explicitly;
1696  * otherwise a new tag is selected automatically. Return the tag of the shell. */
1697 GMSH_API int gmshModelGeoAddSurfaceLoop(int * surfaceTags, size_t surfaceTags_n,
1698                                         const int tag,
1699                                         int * ierr);
1700 
1701 /* Add a volume (a region) in the built-in CAD representation, defined by one
1702  * or more shells `shellTags'. The first surface loop defines the exterior
1703  * boundary; additional surface loop define holes. If `tag' is positive, set
1704  * the tag explicitly; otherwise a new tag is selected automatically. Return
1705  * the tag of the volume. */
1706 GMSH_API int gmshModelGeoAddVolume(int * shellTags, size_t shellTags_n,
1707                                    const int tag,
1708                                    int * ierr);
1709 
1710 /* Extrude the entities `dimTags' in the built-in CAD representation, using a
1711  * translation along (`dx', `dy', `dz'). Return extruded entities in
1712  * `outDimTags'. If `numElements' is not empty, also extrude the mesh: the
1713  * entries in `numElements' give the number of elements in each layer. If
1714  * `height' is not empty, it provides the (cumulative) height of the different
1715  * layers, normalized to 1. If `recombine' is set, recombine the mesh in the
1716  * layers. */
1717 GMSH_API void gmshModelGeoExtrude(int * dimTags, size_t dimTags_n,
1718                                   const double dx,
1719                                   const double dy,
1720                                   const double dz,
1721                                   int ** outDimTags, size_t * outDimTags_n,
1722                                   int * numElements, size_t numElements_n,
1723                                   double * heights, size_t heights_n,
1724                                   const int recombine,
1725                                   int * ierr);
1726 
1727 /* Extrude the entities `dimTags' in the built-in CAD representation, using a
1728  * rotation of `angle' radians around the axis of revolution defined by the
1729  * point (`x', `y', `z') and the direction (`ax', `ay', `az'). The angle
1730  * should be strictly smaller than Pi. Return extruded entities in
1731  * `outDimTags'. If `numElements' is not empty, also extrude the mesh: the
1732  * entries in `numElements' give the number of elements in each layer. If
1733  * `height' is not empty, it provides the (cumulative) height of the different
1734  * layers, normalized to 1. If `recombine' is set, recombine the mesh in the
1735  * layers. */
1736 GMSH_API void gmshModelGeoRevolve(int * dimTags, size_t dimTags_n,
1737                                   const double x,
1738                                   const double y,
1739                                   const double z,
1740                                   const double ax,
1741                                   const double ay,
1742                                   const double az,
1743                                   const double angle,
1744                                   int ** outDimTags, size_t * outDimTags_n,
1745                                   int * numElements, size_t numElements_n,
1746                                   double * heights, size_t heights_n,
1747                                   const int recombine,
1748                                   int * ierr);
1749 
1750 /* Extrude the entities `dimTags' in the built-in CAD representation, using a
1751  * combined translation and rotation of `angle' radians, along (`dx', `dy',
1752  * `dz') and around the axis of revolution defined by the point (`x', `y',
1753  * `z') and the direction (`ax', `ay', `az'). The angle should be strictly
1754  * smaller than Pi. Return extruded entities in `outDimTags'. If `numElements'
1755  * is not empty, also extrude the mesh: the entries in `numElements' give the
1756  * number of elements in each layer. If `height' is not empty, it provides the
1757  * (cumulative) height of the different layers, normalized to 1. If
1758  * `recombine' is set, recombine the mesh in the layers. */
1759 GMSH_API void gmshModelGeoTwist(int * dimTags, size_t dimTags_n,
1760                                 const double x,
1761                                 const double y,
1762                                 const double z,
1763                                 const double dx,
1764                                 const double dy,
1765                                 const double dz,
1766                                 const double ax,
1767                                 const double ay,
1768                                 const double az,
1769                                 const double angle,
1770                                 int ** outDimTags, size_t * outDimTags_n,
1771                                 int * numElements, size_t numElements_n,
1772                                 double * heights, size_t heights_n,
1773                                 const int recombine,
1774                                 int * ierr);
1775 
1776 /* Extrude the entities `dimTags' in the built-in CAD representation along the
1777  * normals of the mesh, creating discrete boundary layer entities. Return
1778  * extruded entities in `outDimTags'. The entries in `numElements' give the
1779  * number of elements in each layer. If `height' is not empty, it provides the
1780  * height of the different layers. If `recombine' is set, recombine the mesh
1781  * in the layers. A second boundary layer can be created from the same
1782  * entities if `second' is set. If `viewIndex' is >= 0, use the corresponding
1783  * view to either specify the normals (if the view contains a vector field) or
1784  * scale the normals (if the view is scalar). */
1785 GMSH_API void gmshModelGeoExtrudeBoundaryLayer(int * dimTags, size_t dimTags_n,
1786                                                int ** outDimTags, size_t * outDimTags_n,
1787                                                int * numElements, size_t numElements_n,
1788                                                double * heights, size_t heights_n,
1789                                                const int recombine,
1790                                                const int second,
1791                                                const int viewIndex,
1792                                                int * ierr);
1793 
1794 /* Translate the entities `dimTags' in the built-in CAD representation along
1795  * (`dx', `dy', `dz'). */
1796 GMSH_API void gmshModelGeoTranslate(int * dimTags, size_t dimTags_n,
1797                                     const double dx,
1798                                     const double dy,
1799                                     const double dz,
1800                                     int * ierr);
1801 
1802 /* Rotate the entities `dimTags' in the built-in CAD representation by `angle'
1803  * radians around the axis of revolution defined by the point (`x', `y', `z')
1804  * and the direction (`ax', `ay', `az'). */
1805 GMSH_API void gmshModelGeoRotate(int * dimTags, size_t dimTags_n,
1806                                  const double x,
1807                                  const double y,
1808                                  const double z,
1809                                  const double ax,
1810                                  const double ay,
1811                                  const double az,
1812                                  const double angle,
1813                                  int * ierr);
1814 
1815 /* Scale the entities `dimTag' in the built-in CAD representation by factors
1816  * `a', `b' and `c' along the three coordinate axes; use (`x', `y', `z') as
1817  * the center of the homothetic transformation. */
1818 GMSH_API void gmshModelGeoDilate(int * dimTags, size_t dimTags_n,
1819                                  const double x,
1820                                  const double y,
1821                                  const double z,
1822                                  const double a,
1823                                  const double b,
1824                                  const double c,
1825                                  int * ierr);
1826 
1827 /* Mirror the entities `dimTag' in the built-in CAD representation, with
1828  * respect to the plane of equation `a' * x + `b' * y + `c' * z + `d' = 0. */
1829 GMSH_API void gmshModelGeoMirror(int * dimTags, size_t dimTags_n,
1830                                  const double a,
1831                                  const double b,
1832                                  const double c,
1833                                  const double d,
1834                                  int * ierr);
1835 
1836 /* Mirror the entities `dimTag' in the built-in CAD representation, with
1837  * respect to the plane of equation `a' * x + `b' * y + `c' * z + `d' = 0.
1838  * (This is a synonym for `mirror', which will be deprecated in a future
1839  * release.) */
1840 GMSH_API void gmshModelGeoSymmetrize(int * dimTags, size_t dimTags_n,
1841                                      const double a,
1842                                      const double b,
1843                                      const double c,
1844                                      const double d,
1845                                      int * ierr);
1846 
1847 /* Copy the entities `dimTags' in the built-in CAD representation; the new
1848  * entities are returned in `outDimTags'. */
1849 GMSH_API void gmshModelGeoCopy(int * dimTags, size_t dimTags_n,
1850                                int ** outDimTags, size_t * outDimTags_n,
1851                                int * ierr);
1852 
1853 /* Remove the entities `dimTags' in the built-in CAD representation, provided
1854  * that they are not on the boundary of higher-dimensional entities. If
1855  * `recursive' is true, remove all the entities on their boundaries, down to
1856  * dimension 0. */
1857 GMSH_API void gmshModelGeoRemove(int * dimTags, size_t dimTags_n,
1858                                  const int recursive,
1859                                  int * ierr);
1860 
1861 /* Remove all duplicate entities in the built-in CAD representation (different
1862  * entities at the same geometrical location). */
1863 GMSH_API void gmshModelGeoRemoveAllDuplicates(int * ierr);
1864 
1865 /* Split the curve of tag `tag' in the built-in CAD representation, on the
1866  * specified control points `pointTags'. This feature is only available for
1867  * lines, splines and b-splines. Return the tag(s) `curveTags' of the newly
1868  * created curve(s). */
1869 GMSH_API void gmshModelGeoSplitCurve(const int tag,
1870                                      int * pointTags, size_t pointTags_n,
1871                                      int ** curveTags, size_t * curveTags_n,
1872                                      int * ierr);
1873 
1874 /* Get the maximum tag of entities of dimension `dim' in the built-in CAD
1875  * representation. */
1876 GMSH_API int gmshModelGeoGetMaxTag(const int dim,
1877                                    int * ierr);
1878 
1879 /* Set the maximum tag `maxTag' for entities of dimension `dim' in the built-
1880  * in CAD representation. */
1881 GMSH_API void gmshModelGeoSetMaxTag(const int dim,
1882                                     const int maxTag,
1883                                     int * ierr);
1884 
1885 /* Add a physical group of dimension `dim', grouping the entities with tags
1886  * `tags' in the built-in CAD representation. Return the tag of the physical
1887  * group, equal to `tag' if `tag' is positive, or a new tag if `tag' < 0. */
1888 GMSH_API int gmshModelGeoAddPhysicalGroup(const int dim,
1889                                           int * tags, size_t tags_n,
1890                                           const int tag,
1891                                           int * ierr);
1892 
1893 /* Remove the physical groups `dimTags' from the built-in CAD representation.
1894  * If `dimTags' is empty, remove all groups. */
1895 GMSH_API void gmshModelGeoRemovePhysicalGroups(int * dimTags, size_t dimTags_n,
1896                                                int * ierr);
1897 
1898 /* Synchronize the built-in CAD representation with the current Gmsh model.
1899  * This can be called at any time, but since it involves a non trivial amount
1900  * of processing, the number of synchronization points should normally be
1901  * minimized. Without synchronization the entities in the built-in CAD
1902  * representation are not available to any function outside of the built-in
1903  * CAD kernel functions. */
1904 GMSH_API void gmshModelGeoSynchronize(int * ierr);
1905 
1906 /* Set a mesh size constraint on the entities `dimTags' in the built-in CAD
1907  * kernel representation. Currently only entities of dimension 0 (points) are
1908  * handled. */
1909 GMSH_API void gmshModelGeoMeshSetSize(int * dimTags, size_t dimTags_n,
1910                                       const double size,
1911                                       int * ierr);
1912 
1913 /* Set a transfinite meshing constraint on the curve `tag' in the built-in CAD
1914  * kernel representation, with `numNodes' nodes distributed according to
1915  * `meshType' and `coef'. Currently supported types are "Progression"
1916  * (geometrical progression with power `coef') and "Bump" (refinement toward
1917  * both extremities of the curve). */
1918 GMSH_API void gmshModelGeoMeshSetTransfiniteCurve(const int tag,
1919                                                   const int nPoints,
1920                                                   const char * meshType,
1921                                                   const double coef,
1922                                                   int * ierr);
1923 
1924 /* Set a transfinite meshing constraint on the surface `tag' in the built-in
1925  * CAD kernel representation. `arrangement' describes the arrangement of the
1926  * triangles when the surface is not flagged as recombined: currently
1927  * supported values are "Left", "Right", "AlternateLeft" and "AlternateRight".
1928  * `cornerTags' can be used to specify the (3 or 4) corners of the transfinite
1929  * interpolation explicitly; specifying the corners explicitly is mandatory if
1930  * the surface has more that 3 or 4 points on its boundary. */
1931 GMSH_API void gmshModelGeoMeshSetTransfiniteSurface(const int tag,
1932                                                     const char * arrangement,
1933                                                     int * cornerTags, size_t cornerTags_n,
1934                                                     int * ierr);
1935 
1936 /* Set a transfinite meshing constraint on the surface `tag' in the built-in
1937  * CAD kernel representation. `cornerTags' can be used to specify the (6 or 8)
1938  * corners of the transfinite interpolation explicitly. */
1939 GMSH_API void gmshModelGeoMeshSetTransfiniteVolume(const int tag,
1940                                                    int * cornerTags, size_t cornerTags_n,
1941                                                    int * ierr);
1942 
1943 /* Set a recombination meshing constraint on the entity of dimension `dim' and
1944  * tag `tag' in the built-in CAD kernel representation. Currently only
1945  * entities of dimension 2 (to recombine triangles into quadrangles) are
1946  * supported. */
1947 GMSH_API void gmshModelGeoMeshSetRecombine(const int dim,
1948                                            const int tag,
1949                                            const double angle,
1950                                            int * ierr);
1951 
1952 /* Set a smoothing meshing constraint on the entity of dimension `dim' and tag
1953  * `tag' in the built-in CAD kernel representation. `val' iterations of a
1954  * Laplace smoother are applied. */
1955 GMSH_API void gmshModelGeoMeshSetSmoothing(const int dim,
1956                                            const int tag,
1957                                            const int val,
1958                                            int * ierr);
1959 
1960 /* Set a reverse meshing constraint on the entity of dimension `dim' and tag
1961  * `tag' in the built-in CAD kernel representation. If `val' is true, the mesh
1962  * orientation will be reversed with respect to the natural mesh orientation
1963  * (i.e. the orientation consistent with the orientation of the geometry). If
1964  * `val' is false, the mesh is left as-is. */
1965 GMSH_API void gmshModelGeoMeshSetReverse(const int dim,
1966                                          const int tag,
1967                                          const int val,
1968                                          int * ierr);
1969 
1970 /* Set the meshing algorithm on the entity of dimension `dim' and tag `tag' in
1971  * the built-in CAD kernel representation. Currently only supported for `dim'
1972  * == 2. */
1973 GMSH_API void gmshModelGeoMeshSetAlgorithm(const int dim,
1974                                            const int tag,
1975                                            const int val,
1976                                            int * ierr);
1977 
1978 /* Force the mesh size to be extended from the boundary, or not, for the
1979  * entity of dimension `dim' and tag `tag' in the built-in CAD kernel
1980  * representation. Currently only supported for `dim' == 2. */
1981 GMSH_API void gmshModelGeoMeshSetSizeFromBoundary(const int dim,
1982                                                   const int tag,
1983                                                   const int val,
1984                                                   int * ierr);
1985 
1986 /* Add a geometrical point in the OpenCASCADE CAD representation, at
1987  * coordinates (`x', `y', `z'). If `meshSize' is > 0, add a meshing constraint
1988  * at that point. If `tag' is positive, set the tag explicitly; otherwise a
1989  * new tag is selected automatically. Return the tag of the point. (Note that
1990  * the point will be added in the current model only after `synchronize' is
1991  * called. This behavior holds for all the entities added in the occ module.) */
1992 GMSH_API int gmshModelOccAddPoint(const double x,
1993                                   const double y,
1994                                   const double z,
1995                                   const double meshSize,
1996                                   const int tag,
1997                                   int * ierr);
1998 
1999 /* Add a straight line segment in the OpenCASCADE CAD representation, between
2000  * the two points with tags `startTag' and `endTag'. If `tag' is positive, set
2001  * the tag explicitly; otherwise a new tag is selected automatically. Return
2002  * the tag of the line. */
2003 GMSH_API int gmshModelOccAddLine(const int startTag,
2004                                  const int endTag,
2005                                  const int tag,
2006                                  int * ierr);
2007 
2008 /* Add a circle arc in the OpenCASCADE CAD representation, between the two
2009  * points with tags `startTag' and `endTag', with center `centerTag'. If `tag'
2010  * is positive, set the tag explicitly; otherwise a new tag is selected
2011  * automatically. Return the tag of the circle arc. */
2012 GMSH_API int gmshModelOccAddCircleArc(const int startTag,
2013                                       const int centerTag,
2014                                       const int endTag,
2015                                       const int tag,
2016                                       int * ierr);
2017 
2018 /* Add a circle of center (`x', `y', `z') and radius `r' in the OpenCASCADE
2019  * CAD representation. If `tag' is positive, set the tag explicitly; otherwise
2020  * a new tag is selected automatically. If `angle1' and `angle2' are
2021  * specified, create a circle arc between the two angles. Return the tag of
2022  * the circle. */
2023 GMSH_API int gmshModelOccAddCircle(const double x,
2024                                    const double y,
2025                                    const double z,
2026                                    const double r,
2027                                    const int tag,
2028                                    const double angle1,
2029                                    const double angle2,
2030                                    int * ierr);
2031 
2032 /* Add an ellipse arc in the OpenCASCADE CAD representation, between the two
2033  * points `startTag' and `endTag', and with center `centerTag' and major axis
2034  * point `majorTag'. If `tag' is positive, set the tag explicitly; otherwise a
2035  * new tag is selected automatically. Return the tag of the ellipse arc. Note
2036  * that OpenCASCADE does not allow creating ellipse arcs with the major radius
2037  * smaller than the minor radius. */
2038 GMSH_API int gmshModelOccAddEllipseArc(const int startTag,
2039                                        const int centerTag,
2040                                        const int majorTag,
2041                                        const int endTag,
2042                                        const int tag,
2043                                        int * ierr);
2044 
2045 /* Add an ellipse of center (`x', `y', `z') and radii `r1' and `r2' along the
2046  * x- and y-axes, respectively, in the OpenCASCADE CAD representation. If
2047  * `tag' is positive, set the tag explicitly; otherwise a new tag is selected
2048  * automatically. If `angle1' and `angle2' are specified, create an ellipse
2049  * arc between the two angles. Return the tag of the ellipse. Note that
2050  * OpenCASCADE does not allow creating ellipses with the major radius (along
2051  * the x-axis) smaller than or equal to the minor radius (along the y-axis):
2052  * rotate the shape or use `addCircle' in such cases. */
2053 GMSH_API int gmshModelOccAddEllipse(const double x,
2054                                     const double y,
2055                                     const double z,
2056                                     const double r1,
2057                                     const double r2,
2058                                     const int tag,
2059                                     const double angle1,
2060                                     const double angle2,
2061                                     int * ierr);
2062 
2063 /* Add a spline (C2 b-spline) curve in the OpenCASCADE CAD representation,
2064  * going through the points `pointTags'. If `tag' is positive, set the tag
2065  * explicitly; otherwise a new tag is selected automatically. Create a
2066  * periodic curve if the first and last points are the same. Return the tag of
2067  * the spline curve. */
2068 GMSH_API int gmshModelOccAddSpline(int * pointTags, size_t pointTags_n,
2069                                    const int tag,
2070                                    int * ierr);
2071 
2072 /* Add a b-spline curve of degree `degree' in the OpenCASCADE CAD
2073  * representation, with `pointTags' control points. If `weights', `knots' or
2074  * `multiplicities' are not provided, default parameters are computed
2075  * automatically. If `tag' is positive, set the tag explicitly; otherwise a
2076  * new tag is selected automatically. Create a periodic curve if the first and
2077  * last points are the same. Return the tag of the b-spline curve. */
2078 GMSH_API int gmshModelOccAddBSpline(int * pointTags, size_t pointTags_n,
2079                                     const int tag,
2080                                     const int degree,
2081                                     double * weights, size_t weights_n,
2082                                     double * knots, size_t knots_n,
2083                                     int * multiplicities, size_t multiplicities_n,
2084                                     int * ierr);
2085 
2086 /* Add a Bezier curve in the OpenCASCADE CAD representation, with `pointTags'
2087  * control points. If `tag' is positive, set the tag explicitly; otherwise a
2088  * new tag is selected automatically. Return the tag of the Bezier curve. */
2089 GMSH_API int gmshModelOccAddBezier(int * pointTags, size_t pointTags_n,
2090                                    const int tag,
2091                                    int * ierr);
2092 
2093 /* Add a wire (open or closed) in the OpenCASCADE CAD representation, formed
2094  * by the curves `curveTags'. Note that an OpenCASCADE wire can be made of
2095  * curves that share geometrically identical (but topologically different)
2096  * points. If `tag' is positive, set the tag explicitly; otherwise a new tag
2097  * is selected automatically. Return the tag of the wire. */
2098 GMSH_API int gmshModelOccAddWire(int * curveTags, size_t curveTags_n,
2099                                  const int tag,
2100                                  const int checkClosed,
2101                                  int * ierr);
2102 
2103 /* Add a curve loop (a closed wire) in the OpenCASCADE CAD representation,
2104  * formed by the curves `curveTags'. `curveTags' should contain tags of curves
2105  * forming a closed loop. Negative tags can be specified for compatibility
2106  * with the built-in kernel, but are simply ignored: the wire is oriented
2107  * according to the orientation of its first curve. Note that an OpenCASCADE
2108  * curve loop can be made of curves that share geometrically identical (but
2109  * topologically different) points. If `tag' is positive, set the tag
2110  * explicitly; otherwise a new tag is selected automatically. Return the tag
2111  * of the curve loop. */
2112 GMSH_API int gmshModelOccAddCurveLoop(int * curveTags, size_t curveTags_n,
2113                                       const int tag,
2114                                       int * ierr);
2115 
2116 /* Add a rectangle in the OpenCASCADE CAD representation, with lower left
2117  * corner at (`x', `y', `z') and upper right corner at (`x' + `dx', `y' +
2118  * `dy', `z'). If `tag' is positive, set the tag explicitly; otherwise a new
2119  * tag is selected automatically. Round the corners if `roundedRadius' is
2120  * nonzero. Return the tag of the rectangle. */
2121 GMSH_API int gmshModelOccAddRectangle(const double x,
2122                                       const double y,
2123                                       const double z,
2124                                       const double dx,
2125                                       const double dy,
2126                                       const int tag,
2127                                       const double roundedRadius,
2128                                       int * ierr);
2129 
2130 /* Add a disk in the OpenCASCADE CAD representation, with center (`xc', `yc',
2131  * `zc') and radius `rx' along the x-axis and `ry' along the y-axis. If `tag'
2132  * is positive, set the tag explicitly; otherwise a new tag is selected
2133  * automatically. Return the tag of the disk. */
2134 GMSH_API int gmshModelOccAddDisk(const double xc,
2135                                  const double yc,
2136                                  const double zc,
2137                                  const double rx,
2138                                  const double ry,
2139                                  const int tag,
2140                                  int * ierr);
2141 
2142 /* Add a plane surface in the OpenCASCADE CAD representation, defined by one
2143  * or more curve loops (or closed wires) `wireTags'. The first curve loop
2144  * defines the exterior contour; additional curve loop define holes. If `tag'
2145  * is positive, set the tag explicitly; otherwise a new tag is selected
2146  * automatically. Return the tag of the surface. */
2147 GMSH_API int gmshModelOccAddPlaneSurface(int * wireTags, size_t wireTags_n,
2148                                          const int tag,
2149                                          int * ierr);
2150 
2151 /* Add a surface in the OpenCASCADE CAD representation, filling the curve loop
2152  * `wireTag'. If `tag' is positive, set the tag explicitly; otherwise a new
2153  * tag is selected automatically. Return the tag of the surface. If
2154  * `pointTags' are provided, force the surface to pass through the given
2155  * points. The other optional arguments are `degree' (the degree of the energy
2156  * criterion to minimize for computing the deformation of the surface),
2157  * `numPointsOnCurves' (the average number of points for discretisation of the
2158  * bounding curves), `numIter' (the maximum number of iterations of the
2159  * optimization process), `anisotropic' (improve performance when the ratio of
2160  * the length along the two parametric coordinates of the surface is high),
2161  * `tol2d' (tolerance to the constraints in the parametric plane of the
2162  * surface), `tol3d' (the maximum distance allowed between the support surface
2163  * and the constraints), `tolAng' (the maximum angle allowed between the
2164  * normal of the surface and the constraints), `tolCurv' (the maximum
2165  * difference of curvature allowed between the surface and the constraint),
2166  * `maxDegree' (the highest degree which the polynomial defining the filling
2167  * surface can have) and, `maxSegments' (the largest number of segments which
2168  * the filling surface can have). */
2169 GMSH_API int gmshModelOccAddSurfaceFilling(const int wireTag,
2170                                            const int tag,
2171                                            int * pointTags, size_t pointTags_n,
2172                                            const int degree,
2173                                            const int numPointsOnCurves,
2174                                            const int numIter,
2175                                            const int anisotropic,
2176                                            const double tol2d,
2177                                            const double tol3d,
2178                                            const double tolAng,
2179                                            const double tolCurv,
2180                                            const int maxDegree,
2181                                            const int maxSegments,
2182                                            int * ierr);
2183 
2184 /* Add a BSpline surface in the OpenCASCADE CAD representation, filling the
2185  * curve loop `wireTag'. The curve loop should be made of 2, 3 or 4 BSpline
2186  * curves. The optional `type' argument specifies the type of filling:
2187  * "Stretch" creates the flattest patch, "Curved" (the default) creates the
2188  * most rounded patch, and "Coons" creates a rounded patch with less depth
2189  * than "Curved". If `tag' is positive, set the tag explicitly; otherwise a
2190  * new tag is selected automatically. Return the tag of the surface. */
2191 GMSH_API int gmshModelOccAddBSplineFilling(const int wireTag,
2192                                            const int tag,
2193                                            const char * type,
2194                                            int * ierr);
2195 
2196 /* Add a Bezier surface in the OpenCASCADE CAD representation, filling the
2197  * curve loop `wireTag'. The curve loop should be made of 2, 3 or 4 Bezier
2198  * curves. The optional `type' argument specifies the type of filling:
2199  * "Stretch" creates the flattest patch, "Curved" (the default) creates the
2200  * most rounded patch, and "Coons" creates a rounded patch with less depth
2201  * than "Curved". If `tag' is positive, set the tag explicitly; otherwise a
2202  * new tag is selected automatically. Return the tag of the surface. */
2203 GMSH_API int gmshModelOccAddBezierFilling(const int wireTag,
2204                                           const int tag,
2205                                           const char * type,
2206                                           int * ierr);
2207 
2208 /* Add a b-spline surface of degree `degreeU' x `degreeV' in the OpenCASCADE
2209  * CAD representation, with `pointTags' control points given as a single
2210  * vector [Pu1v1, ... Pu`numPointsU'v1, Pu1v2, ...]. If `weights', `knotsU',
2211  * `knotsV', `multiplicitiesU' or `multiplicitiesV' are not provided, default
2212  * parameters are computed automatically. If `tag' is positive, set the tag
2213  * explicitly; otherwise a new tag is selected automatically. If `wireTags' is
2214  * provided, trim the b-spline patch using the provided wires: the first wire
2215  * defines the external contour, the others define holes. If `wire3D' is set,
2216  * consider wire curves as 3D curves and project them on the b-spline surface;
2217  * otherwise consider the wire curves as defined in the parametric space of
2218  * the surface. Return the tag of the b-spline surface. */
2219 GMSH_API int gmshModelOccAddBSplineSurface(int * pointTags, size_t pointTags_n,
2220                                            const int numPointsU,
2221                                            const int tag,
2222                                            const int degreeU,
2223                                            const int degreeV,
2224                                            double * weights, size_t weights_n,
2225                                            double * knotsU, size_t knotsU_n,
2226                                            double * knotsV, size_t knotsV_n,
2227                                            int * multiplicitiesU, size_t multiplicitiesU_n,
2228                                            int * multiplicitiesV, size_t multiplicitiesV_n,
2229                                            int * wireTags, size_t wireTags_n,
2230                                            const int wire3D,
2231                                            int * ierr);
2232 
2233 /* Add a Bezier surface in the OpenCASCADE CAD representation, with
2234  * `pointTags' control points given as a single vector [Pu1v1, ...
2235  * Pu`numPointsU'v1, Pu1v2, ...]. If `tag' is positive, set the tag
2236  * explicitly; otherwise a new tag is selected automatically. If `wireTags' is
2237  * provided, trim the Bezier patch using the provided wires: the first wire
2238  * defines the external contour, the others define holes. If `wire3D' is set,
2239  * consider wire curves as 3D curves and project them on the Bezier surface;
2240  * otherwise consider the wire curves as defined in the parametric space of
2241  * the surface. Return the tag of the Bezier surface. */
2242 GMSH_API int gmshModelOccAddBezierSurface(int * pointTags, size_t pointTags_n,
2243                                           const int numPointsU,
2244                                           const int tag,
2245                                           int * wireTags, size_t wireTags_n,
2246                                           const int wire3D,
2247                                           int * ierr);
2248 
2249 /* Trim the surface `surfaceTag' with the wires `wireTags', replacing any
2250  * existing trimming curves. The first wire defines the external contour, the
2251  * others define holes. If `wire3D' is set, consider wire curves as 3D curves
2252  * and project them on the surface; otherwise consider the wire curves as
2253  * defined in the parametric space of the surface. If `tag' is positive, set
2254  * the tag explicitly; otherwise a new tag is selected automatically. Return
2255  * the tag of the trimmed surface. */
2256 GMSH_API int gmshModelOccAddTrimmedSurface(const int surfaceTag,
2257                                            int * wireTags, size_t wireTags_n,
2258                                            const int wire3D,
2259                                            const int tag,
2260                                            int * ierr);
2261 
2262 /* Add a surface loop (a closed shell) in the OpenCASCADE CAD representation,
2263  * formed by `surfaceTags'.  If `tag' is positive, set the tag explicitly;
2264  * otherwise a new tag is selected automatically. Return the tag of the
2265  * surface loop. Setting `sewing' allows one to build a shell made of surfaces
2266  * that share geometrically identical (but topologically different) curves. */
2267 GMSH_API int gmshModelOccAddSurfaceLoop(int * surfaceTags, size_t surfaceTags_n,
2268                                         const int tag,
2269                                         const int sewing,
2270                                         int * ierr);
2271 
2272 /* Add a volume (a region) in the OpenCASCADE CAD representation, defined by
2273  * one or more surface loops `shellTags'. The first surface loop defines the
2274  * exterior boundary; additional surface loop define holes. If `tag' is
2275  * positive, set the tag explicitly; otherwise a new tag is selected
2276  * automatically. Return the tag of the volume. */
2277 GMSH_API int gmshModelOccAddVolume(int * shellTags, size_t shellTags_n,
2278                                    const int tag,
2279                                    int * ierr);
2280 
2281 /* Add a sphere of center (`xc', `yc', `zc') and radius `r' in the OpenCASCADE
2282  * CAD representation. The optional `angle1' and `angle2' arguments define the
2283  * polar angle opening (from -Pi/2 to Pi/2). The optional `angle3' argument
2284  * defines the azimuthal opening (from 0 to 2*Pi). If `tag' is positive, set
2285  * the tag explicitly; otherwise a new tag is selected automatically. Return
2286  * the tag of the sphere. */
2287 GMSH_API int gmshModelOccAddSphere(const double xc,
2288                                    const double yc,
2289                                    const double zc,
2290                                    const double radius,
2291                                    const int tag,
2292                                    const double angle1,
2293                                    const double angle2,
2294                                    const double angle3,
2295                                    int * ierr);
2296 
2297 /* Add a parallelepipedic box in the OpenCASCADE CAD representation, defined
2298  * by a point (`x', `y', `z') and the extents along the x-, y- and z-axes. If
2299  * `tag' is positive, set the tag explicitly; otherwise a new tag is selected
2300  * automatically. Return the tag of the box. */
2301 GMSH_API int gmshModelOccAddBox(const double x,
2302                                 const double y,
2303                                 const double z,
2304                                 const double dx,
2305                                 const double dy,
2306                                 const double dz,
2307                                 const int tag,
2308                                 int * ierr);
2309 
2310 /* Add a cylinder in the OpenCASCADE CAD representation, defined by the center
2311  * (`x', `y', `z') of its first circular face, the 3 components (`dx', `dy',
2312  * `dz') of the vector defining its axis and its radius `r'. The optional
2313  * `angle' argument defines the angular opening (from 0 to 2*Pi). If `tag' is
2314  * positive, set the tag explicitly; otherwise a new tag is selected
2315  * automatically. Return the tag of the cylinder. */
2316 GMSH_API int gmshModelOccAddCylinder(const double x,
2317                                      const double y,
2318                                      const double z,
2319                                      const double dx,
2320                                      const double dy,
2321                                      const double dz,
2322                                      const double r,
2323                                      const int tag,
2324                                      const double angle,
2325                                      int * ierr);
2326 
2327 /* Add a cone in the OpenCASCADE CAD representation, defined by the center
2328  * (`x', `y', `z') of its first circular face, the 3 components of the vector
2329  * (`dx', `dy', `dz') defining its axis and the two radii `r1' and `r2' of the
2330  * faces (these radii can be zero). If `tag' is positive, set the tag
2331  * explicitly; otherwise a new tag is selected automatically. `angle' defines
2332  * the optional angular opening (from 0 to 2*Pi). Return the tag of the cone. */
2333 GMSH_API int gmshModelOccAddCone(const double x,
2334                                  const double y,
2335                                  const double z,
2336                                  const double dx,
2337                                  const double dy,
2338                                  const double dz,
2339                                  const double r1,
2340                                  const double r2,
2341                                  const int tag,
2342                                  const double angle,
2343                                  int * ierr);
2344 
2345 /* Add a right angular wedge in the OpenCASCADE CAD representation, defined by
2346  * the right-angle point (`x', `y', `z') and the 3 extends along the x-, y-
2347  * and z-axes (`dx', `dy', `dz'). If `tag' is positive, set the tag
2348  * explicitly; otherwise a new tag is selected automatically. The optional
2349  * argument `ltx' defines the top extent along the x-axis. Return the tag of
2350  * the wedge. */
2351 GMSH_API int gmshModelOccAddWedge(const double x,
2352                                   const double y,
2353                                   const double z,
2354                                   const double dx,
2355                                   const double dy,
2356                                   const double dz,
2357                                   const int tag,
2358                                   const double ltx,
2359                                   int * ierr);
2360 
2361 /* Add a torus in the OpenCASCADE CAD representation, defined by its center
2362  * (`x', `y', `z') and its 2 radii `r' and `r2'. If `tag' is positive, set the
2363  * tag explicitly; otherwise a new tag is selected automatically. The optional
2364  * argument `angle' defines the angular opening (from 0 to 2*Pi). Return the
2365  * tag of the wedge. */
2366 GMSH_API int gmshModelOccAddTorus(const double x,
2367                                   const double y,
2368                                   const double z,
2369                                   const double r1,
2370                                   const double r2,
2371                                   const int tag,
2372                                   const double angle,
2373                                   int * ierr);
2374 
2375 /* Add a volume (if the optional argument `makeSolid' is set) or surfaces in
2376  * the OpenCASCADE CAD representation, defined through the open or closed
2377  * wires `wireTags'. If `tag' is positive, set the tag explicitly; otherwise a
2378  * new tag is selected automatically. The new entities are returned in
2379  * `outDimTags'. If the optional argument `makeRuled' is set, the surfaces
2380  * created on the boundary are forced to be ruled surfaces. If `maxDegree' is
2381  * positive, set the maximal degree of resulting surface. */
2382 GMSH_API void gmshModelOccAddThruSections(int * wireTags, size_t wireTags_n,
2383                                           int ** outDimTags, size_t * outDimTags_n,
2384                                           const int tag,
2385                                           const int makeSolid,
2386                                           const int makeRuled,
2387                                           const int maxDegree,
2388                                           int * ierr);
2389 
2390 /* Add a hollowed volume in the OpenCASCADE CAD representation, built from an
2391  * initial volume `volumeTag' and a set of faces from this volume
2392  * `excludeSurfaceTags', which are to be removed. The remaining faces of the
2393  * volume become the walls of the hollowed solid, with thickness `offset'. If
2394  * `tag' is positive, set the tag explicitly; otherwise a new tag is selected
2395  * automatically. */
2396 GMSH_API void gmshModelOccAddThickSolid(const int volumeTag,
2397                                         int * excludeSurfaceTags, size_t excludeSurfaceTags_n,
2398                                         const double offset,
2399                                         int ** outDimTags, size_t * outDimTags_n,
2400                                         const int tag,
2401                                         int * ierr);
2402 
2403 /* Extrude the entities `dimTags' in the OpenCASCADE CAD representation, using
2404  * a translation along (`dx', `dy', `dz'). Return extruded entities in
2405  * `outDimTags'. If `numElements' is not empty, also extrude the mesh: the
2406  * entries in `numElements' give the number of elements in each layer. If
2407  * `height' is not empty, it provides the (cumulative) height of the different
2408  * layers, normalized to 1. If `recombine' is set, recombine the mesh in the
2409  * layers. */
2410 GMSH_API void gmshModelOccExtrude(int * dimTags, size_t dimTags_n,
2411                                   const double dx,
2412                                   const double dy,
2413                                   const double dz,
2414                                   int ** outDimTags, size_t * outDimTags_n,
2415                                   int * numElements, size_t numElements_n,
2416                                   double * heights, size_t heights_n,
2417                                   const int recombine,
2418                                   int * ierr);
2419 
2420 /* Extrude the entities `dimTags' in the OpenCASCADE CAD representation, using
2421  * a rotation of `angle' radians around the axis of revolution defined by the
2422  * point (`x', `y', `z') and the direction (`ax', `ay', `az'). Return extruded
2423  * entities in `outDimTags'. If `numElements' is not empty, also extrude the
2424  * mesh: the entries in `numElements' give the number of elements in each
2425  * layer. If `height' is not empty, it provides the (cumulative) height of the
2426  * different layers, normalized to 1. When the mesh is extruded the angle
2427  * should be strictly smaller than 2*Pi. If `recombine' is set, recombine the
2428  * mesh in the layers. */
2429 GMSH_API void gmshModelOccRevolve(int * dimTags, size_t dimTags_n,
2430                                   const double x,
2431                                   const double y,
2432                                   const double z,
2433                                   const double ax,
2434                                   const double ay,
2435                                   const double az,
2436                                   const double angle,
2437                                   int ** outDimTags, size_t * outDimTags_n,
2438                                   int * numElements, size_t numElements_n,
2439                                   double * heights, size_t heights_n,
2440                                   const int recombine,
2441                                   int * ierr);
2442 
2443 /* Add a pipe in the OpenCASCADE CAD representation, by extruding the entities
2444  * `dimTags' along the wire `wireTag'. The type of sweep can be specified with
2445  * `trihedron' (possible values: "DiscreteTrihedron", "CorrectedFrenet",
2446  * "Fixed", "Frenet", "ConstantNormal", "Darboux", "GuideAC", "GuidePlan",
2447  * "GuideACWithContact", "GuidePlanWithContact"). If `trihedron' is not
2448  * provided, "DiscreteTrihedron" is assumed. Return the pipe in `outDimTags'. */
2449 GMSH_API void gmshModelOccAddPipe(int * dimTags, size_t dimTags_n,
2450                                   const int wireTag,
2451                                   int ** outDimTags, size_t * outDimTags_n,
2452                                   const char * trihedron,
2453                                   int * ierr);
2454 
2455 /* Fillet the volumes `volumeTags' on the curves `curveTags' with radii
2456  * `radii'. The `radii' vector can either contain a single radius, as many
2457  * radii as `curveTags', or twice as many as `curveTags' (in which case
2458  * different radii are provided for the begin and end points of the curves).
2459  * Return the filleted entities in `outDimTags'. Remove the original volume if
2460  * `removeVolume' is set. */
2461 GMSH_API void gmshModelOccFillet(int * volumeTags, size_t volumeTags_n,
2462                                  int * curveTags, size_t curveTags_n,
2463                                  double * radii, size_t radii_n,
2464                                  int ** outDimTags, size_t * outDimTags_n,
2465                                  const int removeVolume,
2466                                  int * ierr);
2467 
2468 /* Chamfer the volumes `volumeTags' on the curves `curveTags' with distances
2469  * `distances' measured on surfaces `surfaceTags'. The `distances' vector can
2470  * either contain a single distance, as many distances as `curveTags' and
2471  * `surfaceTags', or twice as many as `curveTags' and `surfaceTags' (in which
2472  * case the first in each pair is measured on the corresponding surface in
2473  * `surfaceTags', the other on the other adjacent surface). Return the
2474  * chamfered entities in `outDimTags'. Remove the original volume if
2475  * `removeVolume' is set. */
2476 GMSH_API void gmshModelOccChamfer(int * volumeTags, size_t volumeTags_n,
2477                                   int * curveTags, size_t curveTags_n,
2478                                   int * surfaceTags, size_t surfaceTags_n,
2479                                   double * distances, size_t distances_n,
2480                                   int ** outDimTags, size_t * outDimTags_n,
2481                                   const int removeVolume,
2482                                   int * ierr);
2483 
2484 /* Compute the boolean union (the fusion) of the entities `objectDimTags' and
2485  * `toolDimTags' in the OpenCASCADE CAD representation. Return the resulting
2486  * entities in `outDimTags'. If `tag' is positive, try to set the tag
2487  * explicitly (only valid if the boolean operation results in a single
2488  * entity). Remove the object if `removeObject' is set. Remove the tool if
2489  * `removeTool' is set. */
2490 GMSH_API void gmshModelOccFuse(int * objectDimTags, size_t objectDimTags_n,
2491                                int * toolDimTags, size_t toolDimTags_n,
2492                                int ** outDimTags, size_t * outDimTags_n,
2493                                int *** outDimTagsMap, size_t ** outDimTagsMap_n, size_t *outDimTagsMap_nn,
2494                                const int tag,
2495                                const int removeObject,
2496                                const int removeTool,
2497                                int * ierr);
2498 
2499 /* Compute the boolean intersection (the common parts) of the entities
2500  * `objectDimTags' and `toolDimTags' in the OpenCASCADE CAD representation.
2501  * Return the resulting entities in `outDimTags'. If `tag' is positive, try to
2502  * set the tag explicitly (only valid if the boolean operation results in a
2503  * single entity). Remove the object if `removeObject' is set. Remove the tool
2504  * if `removeTool' is set. */
2505 GMSH_API void gmshModelOccIntersect(int * objectDimTags, size_t objectDimTags_n,
2506                                     int * toolDimTags, size_t toolDimTags_n,
2507                                     int ** outDimTags, size_t * outDimTags_n,
2508                                     int *** outDimTagsMap, size_t ** outDimTagsMap_n, size_t *outDimTagsMap_nn,
2509                                     const int tag,
2510                                     const int removeObject,
2511                                     const int removeTool,
2512                                     int * ierr);
2513 
2514 /* Compute the boolean difference between the entities `objectDimTags' and
2515  * `toolDimTags' in the OpenCASCADE CAD representation. Return the resulting
2516  * entities in `outDimTags'. If `tag' is positive, try to set the tag
2517  * explicitly (only valid if the boolean operation results in a single
2518  * entity). Remove the object if `removeObject' is set. Remove the tool if
2519  * `removeTool' is set. */
2520 GMSH_API void gmshModelOccCut(int * objectDimTags, size_t objectDimTags_n,
2521                               int * toolDimTags, size_t toolDimTags_n,
2522                               int ** outDimTags, size_t * outDimTags_n,
2523                               int *** outDimTagsMap, size_t ** outDimTagsMap_n, size_t *outDimTagsMap_nn,
2524                               const int tag,
2525                               const int removeObject,
2526                               const int removeTool,
2527                               int * ierr);
2528 
2529 /* Compute the boolean fragments (general fuse) resulting from the
2530  * intersection of the entities `objectDimTags' and `toolDimTags' in the
2531  * OpenCASCADE CAD representation, making all iterfaces conformal. When
2532  * applied to entities of different dimensions, the lower dimensional entities
2533  * will be automatically embedded in the higher dimensional entities if they
2534  * are not on their boundary. Return the resulting entities in `outDimTags'.
2535  * If `tag' is positive, try to set the tag explicitly (only valid if the
2536  * boolean operation results in a single entity). Remove the object if
2537  * `removeObject' is set. Remove the tool if `removeTool' is set. */
2538 GMSH_API void gmshModelOccFragment(int * objectDimTags, size_t objectDimTags_n,
2539                                    int * toolDimTags, size_t toolDimTags_n,
2540                                    int ** outDimTags, size_t * outDimTags_n,
2541                                    int *** outDimTagsMap, size_t ** outDimTagsMap_n, size_t *outDimTagsMap_nn,
2542                                    const int tag,
2543                                    const int removeObject,
2544                                    const int removeTool,
2545                                    int * ierr);
2546 
2547 /* Translate the entities `dimTags' in the OpenCASCADE CAD representation
2548  * along (`dx', `dy', `dz'). */
2549 GMSH_API void gmshModelOccTranslate(int * dimTags, size_t dimTags_n,
2550                                     const double dx,
2551                                     const double dy,
2552                                     const double dz,
2553                                     int * ierr);
2554 
2555 /* Rotate the entities `dimTags' in the OpenCASCADE CAD representation by
2556  * `angle' radians around the axis of revolution defined by the point (`x',
2557  * `y', `z') and the direction (`ax', `ay', `az'). */
2558 GMSH_API void gmshModelOccRotate(int * dimTags, size_t dimTags_n,
2559                                  const double x,
2560                                  const double y,
2561                                  const double z,
2562                                  const double ax,
2563                                  const double ay,
2564                                  const double az,
2565                                  const double angle,
2566                                  int * ierr);
2567 
2568 /* Scale the entities `dimTags' in the OpenCASCADE CAD representation by
2569  * factors `a', `b' and `c' along the three coordinate axes; use (`x', `y',
2570  * `z') as the center of the homothetic transformation. */
2571 GMSH_API void gmshModelOccDilate(int * dimTags, size_t dimTags_n,
2572                                  const double x,
2573                                  const double y,
2574                                  const double z,
2575                                  const double a,
2576                                  const double b,
2577                                  const double c,
2578                                  int * ierr);
2579 
2580 /* Mirror the entities `dimTags' in the OpenCASCADE CAD representation, with
2581  * respect to the plane of equation `a' * x + `b' * y + `c' * z + `d' = 0. */
2582 GMSH_API void gmshModelOccMirror(int * dimTags, size_t dimTags_n,
2583                                  const double a,
2584                                  const double b,
2585                                  const double c,
2586                                  const double d,
2587                                  int * ierr);
2588 
2589 /* Mirror the entities `dimTags' in the OpenCASCADE CAD representation, with
2590  * respect to the plane of equation `a' * x + `b' * y + `c' * z + `d' = 0.
2591  * (This is a deprecated synonym for `mirror'.) */
2592 GMSH_API void gmshModelOccSymmetrize(int * dimTags, size_t dimTags_n,
2593                                      const double a,
2594                                      const double b,
2595                                      const double c,
2596                                      const double d,
2597                                      int * ierr);
2598 
2599 /* Apply a general affine transformation matrix `affineTransform' (16 entries
2600  * of a 4x4 matrix, by row; only the 12 first can be provided for convenience)
2601  * to the entities `dimTags' in the OpenCASCADE CAD representation. */
2602 GMSH_API void gmshModelOccAffineTransform(int * dimTags, size_t dimTags_n,
2603                                           double * affineTransform, size_t affineTransform_n,
2604                                           int * ierr);
2605 
2606 /* Copy the entities `dimTags' in the OpenCASCADE CAD representation; the new
2607  * entities are returned in `outDimTags'. */
2608 GMSH_API void gmshModelOccCopy(int * dimTags, size_t dimTags_n,
2609                                int ** outDimTags, size_t * outDimTags_n,
2610                                int * ierr);
2611 
2612 /* Remove the entities `dimTags' in the OpenCASCADE CAD representation,
2613  * provided that they are not on the boundary of higher-dimensional entities.
2614  * If `recursive' is true, remove all the entities on their boundaries, down
2615  * to dimension 0. */
2616 GMSH_API void gmshModelOccRemove(int * dimTags, size_t dimTags_n,
2617                                  const int recursive,
2618                                  int * ierr);
2619 
2620 /* Remove all duplicate entities in the OpenCASCADE CAD representation
2621  * (different entities at the same geometrical location) after intersecting
2622  * (using boolean fragments) all highest dimensional entities. */
2623 GMSH_API void gmshModelOccRemoveAllDuplicates(int * ierr);
2624 
2625 /* Apply various healing procedures to the entities `dimTags' (or to all the
2626  * entities in the model if `dimTags' is empty) in the OpenCASCADE CAD
2627  * representation. Return the healed entities in `outDimTags'. Available
2628  * healing options are listed in the Gmsh reference manual. */
2629 GMSH_API void gmshModelOccHealShapes(int ** outDimTags, size_t * outDimTags_n,
2630                                      int * dimTags, size_t dimTags_n,
2631                                      const double tolerance,
2632                                      const int fixDegenerated,
2633                                      const int fixSmallEdges,
2634                                      const int fixSmallFaces,
2635                                      const int sewFaces,
2636                                      const int makeSolids,
2637                                      int * ierr);
2638 
2639 /* Import BREP, STEP or IGES shapes from the file `fileName' in the
2640  * OpenCASCADE CAD representation. The imported entities are returned in
2641  * `outDimTags'. If the optional argument `highestDimOnly' is set, only import
2642  * the highest dimensional entities in the file. The optional argument
2643  * `format' can be used to force the format of the file (currently "brep",
2644  * "step" or "iges"). */
2645 GMSH_API void gmshModelOccImportShapes(const char * fileName,
2646                                        int ** outDimTags, size_t * outDimTags_n,
2647                                        const int highestDimOnly,
2648                                        const char * format,
2649                                        int * ierr);
2650 
2651 /* Imports an OpenCASCADE `shape' by providing a pointer to a native
2652  * OpenCASCADE `TopoDS_Shape' object (passed as a pointer to void). The
2653  * imported entities are returned in `outDimTags'. If the optional argument
2654  * `highestDimOnly' is set, only import the highest dimensional entities in
2655  * `shape'. In Python, this function can be used for integration with
2656  * PythonOCC, in which the SwigPyObject pointer of `TopoDS_Shape' must be
2657  * passed as an int to `shape', i.e., `shape = int(pythonocc_shape.this)'.
2658  * Warning: this function is unsafe, as providing an invalid pointer will lead
2659  * to undefined behavior. */
2660 GMSH_API void gmshModelOccImportShapesNativePointer(const void * shape,
2661                                                     int ** outDimTags, size_t * outDimTags_n,
2662                                                     const int highestDimOnly,
2663                                                     int * ierr);
2664 
2665 /* Get all the OpenCASCADE entities. If `dim' is >= 0, return only the
2666  * entities of the specified dimension (e.g. points if `dim' == 0). The
2667  * entities are returned as a vector of (dim, tag) integer pairs. */
2668 GMSH_API void gmshModelOccGetEntities(int ** dimTags, size_t * dimTags_n,
2669                                       const int dim,
2670                                       int * ierr);
2671 
2672 /* Get the OpenCASCADE entities in the bounding box defined by the two points
2673  * (`xmin', `ymin', `zmin') and (`xmax', `ymax', `zmax'). If `dim' is >= 0,
2674  * return only the entities of the specified dimension (e.g. points if `dim'
2675  * == 0). */
2676 GMSH_API void gmshModelOccGetEntitiesInBoundingBox(const double xmin,
2677                                                    const double ymin,
2678                                                    const double zmin,
2679                                                    const double xmax,
2680                                                    const double ymax,
2681                                                    const double zmax,
2682                                                    int ** tags, size_t * tags_n,
2683                                                    const int dim,
2684                                                    int * ierr);
2685 
2686 /* Get the bounding box (`xmin', `ymin', `zmin'), (`xmax', `ymax', `zmax') of
2687  * the OpenCASCADE entity of dimension `dim' and tag `tag'. */
2688 GMSH_API void gmshModelOccGetBoundingBox(const int dim,
2689                                          const int tag,
2690                                          double * xmin,
2691                                          double * ymin,
2692                                          double * zmin,
2693                                          double * xmax,
2694                                          double * ymax,
2695                                          double * zmax,
2696                                          int * ierr);
2697 
2698 /* Get the mass of the OpenCASCADE entity of dimension `dim' and tag `tag'. */
2699 GMSH_API void gmshModelOccGetMass(const int dim,
2700                                   const int tag,
2701                                   double * mass,
2702                                   int * ierr);
2703 
2704 /* Get the center of mass of the OpenCASCADE entity of dimension `dim' and tag
2705  * `tag'. */
2706 GMSH_API void gmshModelOccGetCenterOfMass(const int dim,
2707                                           const int tag,
2708                                           double * x,
2709                                           double * y,
2710                                           double * z,
2711                                           int * ierr);
2712 
2713 /* Get the matrix of inertia (by row) of the OpenCASCADE entity of dimension
2714  * `dim' and tag `tag'. */
2715 GMSH_API void gmshModelOccGetMatrixOfInertia(const int dim,
2716                                              const int tag,
2717                                              double ** mat, size_t * mat_n,
2718                                              int * ierr);
2719 
2720 /* Get the maximum tag of entities of dimension `dim' in the OpenCASCADE CAD
2721  * representation. */
2722 GMSH_API int gmshModelOccGetMaxTag(const int dim,
2723                                    int * ierr);
2724 
2725 /* Set the maximum tag `maxTag' for entities of dimension `dim' in the
2726  * OpenCASCADE CAD representation. */
2727 GMSH_API void gmshModelOccSetMaxTag(const int dim,
2728                                     const int maxTag,
2729                                     int * ierr);
2730 
2731 /* Synchronize the OpenCASCADE CAD representation with the current Gmsh model.
2732  * This can be called at any time, but since it involves a non trivial amount
2733  * of processing, the number of synchronization points should normally be
2734  * minimized. Without synchronization the entities in the OpenCASCADE CAD
2735  * representation are not available to any function outside of the OpenCASCADE
2736  * CAD kernel functions. */
2737 GMSH_API void gmshModelOccSynchronize(int * ierr);
2738 
2739 /* Set a mesh size constraint on the entities `dimTags' in the OpenCASCADE CAD
2740  * representation. Currently only entities of dimension 0 (points) are
2741  * handled. */
2742 GMSH_API void gmshModelOccMeshSetSize(int * dimTags, size_t dimTags_n,
2743                                       const double size,
2744                                       int * ierr);
2745 
2746 /* Add a new post-processing view, with name `name'. If `tag' is positive use
2747  * it (and remove the view with that tag if it already exists), otherwise
2748  * associate a new tag. Return the view tag. */
2749 GMSH_API int gmshViewAdd(const char * name,
2750                          const int tag,
2751                          int * ierr);
2752 
2753 /* Remove the view with tag `tag'. */
2754 GMSH_API void gmshViewRemove(const int tag,
2755                              int * ierr);
2756 
2757 /* Get the index of the view with tag `tag' in the list of currently loaded
2758  * views. This dynamic index (it can change when views are removed) is used to
2759  * access view options. */
2760 GMSH_API int gmshViewGetIndex(const int tag,
2761                               int * ierr);
2762 
2763 /* Get the tags of all views. */
2764 GMSH_API void gmshViewGetTags(int ** tags, size_t * tags_n,
2765                               int * ierr);
2766 
2767 /* Add model-based post-processing data to the view with tag `tag'.
2768  * `modelName' identifies the model the data is attached to. `dataType'
2769  * specifies the type of data, currently either "NodeData", "ElementData" or
2770  * "ElementNodeData". `step' specifies the identifier (>= 0) of the data in a
2771  * sequence. `tags' gives the tags of the nodes or elements in the mesh to
2772  * which the data is associated. `data' is a vector of the same length as
2773  * `tags': each entry is the vector of double precision numbers representing
2774  * the data associated with the corresponding tag. The optional `time'
2775  * argument associate a time value with the data. `numComponents' gives the
2776  * number of data components (1 for scalar data, 3 for vector data, etc.) per
2777  * entity; if negative, it is automatically inferred (when possible) from the
2778  * input data. `partition' allows one to specify data in several sub-sets. */
2779 GMSH_API void gmshViewAddModelData(const int tag,
2780                                    const int step,
2781                                    const char * modelName,
2782                                    const char * dataType,
2783                                    size_t * tags, size_t tags_n,
2784                                    const double ** data, const size_t * data_n, size_t data_nn,
2785                                    const double time,
2786                                    const int numComponents,
2787                                    const int partition,
2788                                    int * ierr);
2789 
2790 /* Add homogeneous model-based post-processing data to the view with tag
2791  * `tag'. The arguments have the same meaning as in `addModelData', except
2792  * that `data' is supposed to be homogeneous and is thus flattened in a single
2793  * vector. For data types that can lead to different data sizes per tag (like
2794  * "ElementNodeData"), the data should be padded. */
2795 GMSH_API void gmshViewAddHomogeneousModelData(const int tag,
2796                                               const int step,
2797                                               const char * modelName,
2798                                               const char * dataType,
2799                                               size_t * tags, size_t tags_n,
2800                                               double * data, size_t data_n,
2801                                               const double time,
2802                                               const int numComponents,
2803                                               const int partition,
2804                                               int * ierr);
2805 
2806 /* Get model-based post-processing data from the view with tag `tag' at step
2807  * `step'. Return the `data' associated to the nodes or the elements with tags
2808  * `tags', as well as the `dataType' and the number of components
2809  * `numComponents'. */
2810 GMSH_API void gmshViewGetModelData(const int tag,
2811                                    const int step,
2812                                    char ** dataType,
2813                                    size_t ** tags, size_t * tags_n,
2814                                    double *** data, size_t ** data_n, size_t *data_nn,
2815                                    double * time,
2816                                    int * numComponents,
2817                                    int * ierr);
2818 
2819 /* Get homogeneous model-based post-processing data from the view with tag
2820  * `tag' at step `step'. The arguments have the same meaning as in
2821  * `getModelData', except that `data' is returned flattened in a single
2822  * vector, with the appropriate padding if necessary. */
2823 GMSH_API void gmshViewGetHomogeneousModelData(const int tag,
2824                                               const int step,
2825                                               char ** dataType,
2826                                               size_t ** tags, size_t * tags_n,
2827                                               double ** data, size_t * data_n,
2828                                               double * time,
2829                                               int * numComponents,
2830                                               int * ierr);
2831 
2832 /* Add list-based post-processing data to the view with tag `tag'. List-based
2833  * datasets are independent from any model and any mesh. `dataType' identifies
2834  * the data by concatenating the field type ("S" for scalar, "V" for vector,
2835  * "T" for tensor) and the element type ("P" for point, "L" for line, "T" for
2836  * triangle, "S" for tetrahedron, "I" for prism, "H" for hexaHedron, "Y" for
2837  * pyramid). For example `dataType' should be "ST" for a scalar field on
2838  * triangles. `numEle' gives the number of elements in the data. `data'
2839  * contains the data for the `numEle' elements, concatenated, with node
2840  * coordinates followed by values per node, repeated for each step: [e1x1,
2841  * ..., e1xn, e1y1, ..., e1yn, e1z1, ..., e1zn, e1v1..., e1vN, e2x1, ...]. */
2842 GMSH_API void gmshViewAddListData(const int tag,
2843                                   const char * dataType,
2844                                   const int numEle,
2845                                   double * data, size_t data_n,
2846                                   int * ierr);
2847 
2848 /* Get list-based post-processing data from the view with tag `tag'. Return
2849  * the types `dataTypes', the number of elements `numElements' for each data
2850  * type and the `data' for each data type. */
2851 GMSH_API void gmshViewGetListData(const int tag,
2852                                   char *** dataType, size_t * dataType_n,
2853                                   int ** numElements, size_t * numElements_n,
2854                                   double *** data, size_t ** data_n, size_t *data_nn,
2855                                   int * ierr);
2856 
2857 /* Add a string to a list-based post-processing view with tag `tag'. If
2858  * `coord' contains 3 coordinates the string is positioned in the 3D model
2859  * space ("3D string"); if it contains 2 coordinates it is positioned in the
2860  * 2D graphics viewport ("2D string"). `data' contains one or more (for
2861  * multistep views) strings. `style' contains key-value pairs of styling
2862  * parameters, concatenated. Available keys are "Font" (possible values:
2863  * "Times-Roman", "Times-Bold", "Times-Italic", "Times-BoldItalic",
2864  * "Helvetica", "Helvetica-Bold", "Helvetica-Oblique", "Helvetica-
2865  * BoldOblique", "Courier", "Courier-Bold", "Courier-Oblique", "Courier-
2866  * BoldOblique", "Symbol", "ZapfDingbats", "Screen"), "FontSize" and "Align"
2867  * (possible values: "Left" or "BottomLeft", "Center" or "BottomCenter",
2868  * "Right" or "BottomRight", "TopLeft", "TopCenter", "TopRight", "CenterLeft",
2869  * "CenterCenter", "CenterRight"). */
2870 GMSH_API void gmshViewAddListDataString(const int tag,
2871                                         double * coord, size_t coord_n,
2872                                         char ** data, size_t data_n,
2873                                         char ** style, size_t style_n,
2874                                         int * ierr);
2875 
2876 /* Get list-based post-processing data strings (2D strings if `dim' = 2, 3D
2877  * strings if `dim' = 3) from the view with tag `tag'. Return the coordinates
2878  * in `coord', the strings in `data' and the styles in `style'. */
2879 GMSH_API void gmshViewGetListDataStrings(const int tag,
2880                                          const int dim,
2881                                          double ** coord, size_t * coord_n,
2882                                          char *** data, size_t * data_n,
2883                                          char *** style, size_t * style_n,
2884                                          int * ierr);
2885 
2886 /* Set interpolation matrices for the element family `type' ("Line",
2887  * "Triangle", "Quadrangle", "Tetrahedron", "Hexahedron", "Prism", "Pyramid")
2888  * in the view `tag'. The approximation of the values over an element is
2889  * written as a linear combination of `d' basis functions f_i(u, v, w) =
2890  * sum_(j = 0, ..., `d' - 1) `coef'[i][j] u^`exp'[j][0] v^`exp'[j][1]
2891  * w^`exp'[j][2], i = 0, ..., `d'-1, with u, v, w the coordinates in the
2892  * reference element. The `coef' matrix (of size `d' x `d') and the `exp'
2893  * matrix (of size `d' x 3) are stored as vectors, by row. If `dGeo' is
2894  * positive, use `coefGeo' and `expGeo' to define the interpolation of the x,
2895  * y, z coordinates of the element in terms of the u, v, w coordinates, in
2896  * exactly the same way. If `d' < 0, remove the interpolation matrices. */
2897 GMSH_API void gmshViewSetInterpolationMatrices(const int tag,
2898                                                const char * type,
2899                                                const int d,
2900                                                double * coef, size_t coef_n,
2901                                                double * exp, size_t exp_n,
2902                                                const int dGeo,
2903                                                double * coefGeo, size_t coefGeo_n,
2904                                                double * expGeo, size_t expGeo_n,
2905                                                int * ierr);
2906 
2907 /* Add a post-processing view as an `alias' of the reference view with tag
2908  * `refTag'. If `copyOptions' is set, copy the options of the reference view.
2909  * If `tag' is positive use it (and remove the view with that tag if it
2910  * already exists), otherwise associate a new tag. Return the view tag. */
2911 GMSH_API int gmshViewAddAlias(const int refTag,
2912                               const int copyOptions,
2913                               const int tag,
2914                               int * ierr);
2915 
2916 /* Combine elements (if `what' == "elements") or steps (if `what' == "steps")
2917  * of all views (`how' == "all"), all visible views (`how' == "visible") or
2918  * all views having the same name (`how' == "name"). Remove original views if
2919  * `remove' is set. */
2920 GMSH_API void gmshViewCombine(const char * what,
2921                               const char * how,
2922                               const int remove,
2923                               const int copyOptions,
2924                               int * ierr);
2925 
2926 /* Probe the view `tag' for its `value' at point (`x', `y', `z'). If no match
2927  * is found, `value' is returned empty. Return only the value at step `step'
2928  * is `step' is positive. Return only values with `numComp' if `numComp' is
2929  * positive. Return the gradient of the `value' if `gradient' is set. If
2930  * `distanceMax' is zero, only return a result if an exact match inside an
2931  * element in the view is found; if `distanceMax' is positive and an exact
2932  * match is not found, return the value at the closest node if it is closer
2933  * than `distanceMax'; if `distanceMax' is negative and an exact match is not
2934  * found, always return the value at the closest node. The distance to the
2935  * match is returned in `distance'. Return the result from the element
2936  * described by its coordinates if `xElementCoord', `yElementCoord' and
2937  * `zElementCoord' are provided. If `dim' is >= 0, return only matches from
2938  * elements of the specified dimension. */
2939 GMSH_API void gmshViewProbe(const int tag,
2940                             const double x,
2941                             const double y,
2942                             const double z,
2943                             double ** value, size_t * value_n,
2944                             double * distance,
2945                             const int step,
2946                             const int numComp,
2947                             const int gradient,
2948                             const double distanceMax,
2949                             double * xElemCoord, size_t xElemCoord_n,
2950                             double * yElemCoord, size_t yElemCoord_n,
2951                             double * zElemCoord, size_t zElemCoord_n,
2952                             const int dim,
2953                             int * ierr);
2954 
2955 /* Write the view to a file `fileName'. The export format is determined by the
2956  * file extension. Append to the file if `append' is set. */
2957 GMSH_API void gmshViewWrite(const int tag,
2958                             const char * fileName,
2959                             const int append,
2960                             int * ierr);
2961 
2962 /* Set the global visibility of the view `tag' per window to `value', where
2963  * `windowIndex' identifies the window in the window list. */
2964 GMSH_API void gmshViewSetVisibilityPerWindow(const int tag,
2965                                              const int value,
2966                                              const int windowIndex,
2967                                              int * ierr);
2968 
2969 /* Set the numerical option `name' to value `value' for the view with tag
2970  * `tag'. */
2971 GMSH_API void gmshViewOptionSetNumber(const int tag,
2972                                       const char * name,
2973                                       const double value,
2974                                       int * ierr);
2975 
2976 /* Get the `value' of the numerical option `name' for the view with tag `tag'. */
2977 GMSH_API void gmshViewOptionGetNumber(const int tag,
2978                                       const char * name,
2979                                       double * value,
2980                                       int * ierr);
2981 
2982 /* Set the string option `name' to value `value' for the view with tag `tag'. */
2983 GMSH_API void gmshViewOptionSetString(const int tag,
2984                                       const char * name,
2985                                       const char * value,
2986                                       int * ierr);
2987 
2988 /* Get the `value' of the string option `name' for the view with tag `tag'. */
2989 GMSH_API void gmshViewOptionGetString(const int tag,
2990                                       const char * name,
2991                                       char ** value,
2992                                       int * ierr);
2993 
2994 /* Set the color option `name' to the RGBA value (`r', `g', `b', `a') for the
2995  * view with tag `tag', where where `r', `g', `b' and `a' should be integers
2996  * between 0 and 255. */
2997 GMSH_API void gmshViewOptionSetColor(const int tag,
2998                                      const char * name,
2999                                      const int r,
3000                                      const int g,
3001                                      const int b,
3002                                      const int a,
3003                                      int * ierr);
3004 
3005 /* Get the `r', `g', `b', `a' value of the color option `name' for the view
3006  * with tag `tag'. */
3007 GMSH_API void gmshViewOptionGetColor(const int tag,
3008                                      const char * name,
3009                                      int * r,
3010                                      int * g,
3011                                      int * b,
3012                                      int * a,
3013                                      int * ierr);
3014 
3015 /* Copy the options from the view with tag `refTag' to the view with tag
3016  * `tag'. */
3017 GMSH_API void gmshViewOptionCopy(const int refTag,
3018                                  const int tag,
3019                                  int * ierr);
3020 
3021 /* Set the numerical option `option' to the value `value' for plugin `name'. */
3022 GMSH_API void gmshPluginSetNumber(const char * name,
3023                                   const char * option,
3024                                   const double value,
3025                                   int * ierr);
3026 
3027 /* Set the string option `option' to the value `value' for plugin `name'. */
3028 GMSH_API void gmshPluginSetString(const char * name,
3029                                   const char * option,
3030                                   const char * value,
3031                                   int * ierr);
3032 
3033 /* Run the plugin `name'. Return the tag of the created view (if any). */
3034 GMSH_API int gmshPluginRun(const char * name,
3035                            int * ierr);
3036 
3037 /* Draw all the OpenGL scenes. */
3038 GMSH_API void gmshGraphicsDraw(int * ierr);
3039 
3040 /* Create the FLTK graphical user interface. Can only be called in the main
3041  * thread. */
3042 GMSH_API void gmshFltkInitialize(int * ierr);
3043 
3044 /* Wait at most `time' seconds for user interface events and return. If `time'
3045  * < 0, wait indefinitely. First automatically create the user interface if it
3046  * has not yet been initialized. Can only be called in the main thread. */
3047 GMSH_API void gmshFltkWait(const double time,
3048                            int * ierr);
3049 
3050 /* Update the user interface (potentially creating new widgets and windows).
3051  * First automatically create the user interface if it has not yet been
3052  * initialized. Can only be called in the main thread: use `awake("update")'
3053  * to trigger an update of the user interface from another thread. */
3054 GMSH_API void gmshFltkUpdate(int * ierr);
3055 
3056 /* Awake the main user interface thread and process pending events, and
3057  * optionally perform an action (currently the only `action' allowed is
3058  * "update"). */
3059 GMSH_API void gmshFltkAwake(const char * action,
3060                             int * ierr);
3061 
3062 /* Block the current thread until it can safely modify the user interface. */
3063 GMSH_API void gmshFltkLock(int * ierr);
3064 
3065 /* Release the lock that was set using lock. */
3066 GMSH_API void gmshFltkUnlock(int * ierr);
3067 
3068 /* Run the event loop of the graphical user interface, i.e. repeatedly call
3069  * `wait()'. First automatically create the user interface if it has not yet
3070  * been initialized. Can only be called in the main thread. */
3071 GMSH_API void gmshFltkRun(int * ierr);
3072 
3073 /* Check if the user interface is available (e.g. to detect if it has been
3074  * closed). */
3075 GMSH_API int gmshFltkIsAvailable(int * ierr);
3076 
3077 /* Select entities in the user interface. If `dim' is >= 0, return only the
3078  * entities of the specified dimension (e.g. points if `dim' == 0). */
3079 GMSH_API int gmshFltkSelectEntities(int ** dimTags, size_t * dimTags_n,
3080                                     const int dim,
3081                                     int * ierr);
3082 
3083 /* Select elements in the user interface. */
3084 GMSH_API int gmshFltkSelectElements(size_t ** elementTags, size_t * elementTags_n,
3085                                     int * ierr);
3086 
3087 /* Select views in the user interface. */
3088 GMSH_API int gmshFltkSelectViews(int ** viewTags, size_t * viewTags_n,
3089                                  int * ierr);
3090 
3091 /* Split the current window horizontally (if `how' = "h") or vertically (if
3092  * `how' = "v"), using ratio `ratio'. If `how' = "u", restore a single window. */
3093 GMSH_API void gmshFltkSplitCurrentWindow(const char * how,
3094                                          const double ratio,
3095                                          int * ierr);
3096 
3097 /* Set the current window by speficying its index (starting at 0) in the list
3098  * of all windows. When new windows are created by splits, new windows are
3099  * appended at the end of the list. */
3100 GMSH_API void gmshFltkSetCurrentWindow(const int windowIndex,
3101                                        int * ierr);
3102 
3103 /* Set a status message in the current window. If `graphics' is set, display
3104  * the message inside the graphic window instead of the status bar. */
3105 GMSH_API void gmshFltkSetStatusMessage(const char * message,
3106                                        const int graphics,
3107                                        int * ierr);
3108 
3109 /* Show context window for the entity of dimension `dim' and tag `tag'. */
3110 GMSH_API void gmshFltkShowContextWindow(const int dim,
3111                                         const int tag,
3112                                         int * ierr);
3113 
3114 /* Open the `name' item in the menu tree. */
3115 GMSH_API void gmshFltkOpenTreeItem(const char * name,
3116                                    int * ierr);
3117 
3118 /* Close the `name' item in the menu tree. */
3119 GMSH_API void gmshFltkCloseTreeItem(const char * name,
3120                                     int * ierr);
3121 
3122 /* Set one or more parameters in the ONELAB database, encoded in `format'. */
3123 GMSH_API void gmshOnelabSet(const char * data,
3124                             const char * format,
3125                             int * ierr);
3126 
3127 /* Get all the parameters (or a single one if `name' is specified) from the
3128  * ONELAB database, encoded in `format'. */
3129 GMSH_API void gmshOnelabGet(char ** data,
3130                             const char * name,
3131                             const char * format,
3132                             int * ierr);
3133 
3134 /* Get the names of the parameters in the ONELAB database matching the
3135  * `search' regular expression. If `search' is empty, return all the names. */
3136 GMSH_API void gmshOnelabGetNames(char *** names, size_t * names_n,
3137                                  const char * search,
3138                                  int * ierr);
3139 
3140 /* Set the value of the number parameter `name' in the ONELAB database. Create
3141  * the parameter if it does not exist; update the value if the parameter
3142  * exists. */
3143 GMSH_API void gmshOnelabSetNumber(const char * name,
3144                                   double * value, size_t value_n,
3145                                   int * ierr);
3146 
3147 /* Set the value of the string parameter `name' in the ONELAB database. Create
3148  * the parameter if it does not exist; update the value if the parameter
3149  * exists. */
3150 GMSH_API void gmshOnelabSetString(const char * name,
3151                                   char ** value, size_t value_n,
3152                                   int * ierr);
3153 
3154 /* Get the value of the number parameter `name' from the ONELAB database.
3155  * Return an empty vector if the parameter does not exist. */
3156 GMSH_API void gmshOnelabGetNumber(const char * name,
3157                                   double ** value, size_t * value_n,
3158                                   int * ierr);
3159 
3160 /* Get the value of the string parameter `name' from the ONELAB database.
3161  * Return an empty vector if the parameter does not exist. */
3162 GMSH_API void gmshOnelabGetString(const char * name,
3163                                   char *** value, size_t * value_n,
3164                                   int * ierr);
3165 
3166 /* Clear the ONELAB database, or remove a single parameter if `name' is given. */
3167 GMSH_API void gmshOnelabClear(const char * name,
3168                               int * ierr);
3169 
3170 /* Run a ONELAB client. If `name' is provided, create a new ONELAB client with
3171  * name `name' and executes `command'. If not, try to run a client that might
3172  * be linked to the processed input files. */
3173 GMSH_API void gmshOnelabRun(const char * name,
3174                             const char * command,
3175                             int * ierr);
3176 
3177 /* Write a `message'. `level' can be "info", "warning" or "error". */
3178 GMSH_API void gmshLoggerWrite(const char * message,
3179                               const char * level,
3180                               int * ierr);
3181 
3182 /* Start logging messages. */
3183 GMSH_API void gmshLoggerStart(int * ierr);
3184 
3185 /* Get logged messages. */
3186 GMSH_API void gmshLoggerGet(char *** log, size_t * log_n,
3187                             int * ierr);
3188 
3189 /* Stop logging messages. */
3190 GMSH_API void gmshLoggerStop(int * ierr);
3191 
3192 /* Return wall clock time. */
3193 GMSH_API double gmshLoggerGetWallTime(int * ierr);
3194 
3195 /* Return CPU time. */
3196 GMSH_API double gmshLoggerGetCpuTime(int * ierr);
3197 
3198 /* Return last error message, if any. */
3199 GMSH_API void gmshLoggerGetLastError(char ** error,
3200                                      int * ierr);
3201 
3202 #endif
3203