diff --git a/CHANGELOG.txt b/CHANGELOG.txt index a94b9328e032efe13295788f8a4abd14f1e7b5db..1f4648d6b5b806ac4d198ac20e1db796d1ae9642 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,7 +3,7 @@ algorithm; mesh renumbering now also renumbers dependent post-processing views; mesh size callback is now per-model; OCC STL representation is now generated using relative deflection tolerance; official binary builds now support OpenMP parallelization and are 64 bit only (build OS upgraded to Windows 10, macOS -10.15 and Linux glibc 2.24); small bug fixes. +10.15 and Linux glibc 2.24); new experimental Fortran API; small bug fixes. * Incompatible API changes: new arguments to mesh/getNode and mesh/getElement; new optional arguments to model/isInside, mesh/partition and diff --git a/CREDITS.txt b/CREDITS.txt index 5e8bdd35cd70d634c54ae8f1f55824ccb1103b18..f0a182a0392adc30443e80a6b8c62654a1ab9b67 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -32,9 +32,9 @@ Pierre-Alexandre Beaufort (HXT/reparam), Zhidong Han (LSDYNA export), Ismail Badia (hierarchical basis functions), Jeremy Theler (X3D export), Thomas Toulorge (high order mesh optimizer, new CGNS IO), Max Orok (binary PLY), Marek Wojciechowski (PyPi packaging), Maxence Reberol (automatic transfinite, quad -meshing tools), Michael Ermakov (Gambit export). See comments in the sources for -more information. If we forgot to list your contributions please send us an -email! +meshing tools), Michael Ermakov (Gambit export, Fortran API). See comments in +the sources for more information. If we forgot to list your contributions please +send us an email! Thanks to the following folks who have contributed by providing fresh ideas on theoretical or programming topics, who have sent patches, requests for changes diff --git a/api/GenApi.py b/api/GenApi.py index b867fab010ff1253d23a97298c0e9c15e0900965..d20d7f3164e91976847ddae3350e843f71fef420 100644 --- a/api/GenApi.py +++ b/api/GenApi.py @@ -36,6 +36,9 @@ class arg: self.julia_pre = "" self.julia_post = "" self.julia_return = name + self.fortran_type_post = "" + self.fortran_name_pre = "" + self.fortran_name_post = "" self.texi = name + ( (" = " + self.python_value) if self.python_value else "") @@ -49,6 +52,7 @@ def ibool(name, value=None, python_value=None, julia_value=None): a.python_arg = "c_int(bool(" + name + "))" a.cwrap_arg = "(int)" + name a.julia_ctype = "Cint" + a.fortran_type = "integer (C_INT), value" return a @@ -57,6 +61,7 @@ def iint(name, value=None, python_value=None, julia_value=None): False) a.python_arg = "c_int(" + name + ")" a.julia_ctype = "Cint" + a.fortran_type = "integer (C_INT), value" return a @@ -65,6 +70,7 @@ def isize(name, value=None, python_value=None, julia_value=None): "const size_t", False) a.python_arg = "c_size_t(" + name + ")" a.julia_ctype = "Csize_t" + a.fortran_type = "integer (C_SIZE_T), value" return a @@ -73,6 +79,7 @@ def idouble(name, value=None, python_value=None, julia_value=None): "const double", False) a.python_arg = "c_double(" + name + ")" a.julia_ctype = "Cdouble" + a.fortran_type = "real (C_DOUBLE), value" return a @@ -82,6 +89,8 @@ def istring(name, value=None, python_value=None, julia_value=None): a.python_arg = "c_char_p(" + name + ".encode())" a.cwrap_arg = name + ".c_str()" a.julia_ctype = "Ptr{Cchar}" + a.fortran_type = "character (LEN=1,KIND=C_CHAR)" + a.fortran_type_post = "(*)" return a @@ -90,6 +99,8 @@ def ivoidstar(name, value=None, python_value=None, julia_value=None): "const void *", False) a.python_arg = "c_void_p(" + name + ")" a.julia_ctype = "Ptr{Cvoid}" + a.fortran_type = "integer (C_INT)" + a.fortran_type_post = "(*)" return a @@ -113,6 +124,9 @@ def ivectorint(name, value=None, python_value=None, julia_value=None): a.python_arg = api_name + ", " + api_name_n a.julia_ctype = "Ptr{Cint}, Csize_t" a.julia_arg = "convert(Vector{Cint}, " + name + "), length(" + name + ")" + a.fortran_type = "integer (C_INT)" + a.fortran_type_post = "(*)\n integer (C_SIZE_T), value :: " + name +"_n" + a.fortran_name_post = ",\n & " + name + "_n" return a @@ -136,6 +150,9 @@ def ivectorsize(name, value=None, python_value=None, julia_value=None): a.python_arg = api_name + ", " + api_name_n a.julia_ctype = "Ptr{Csize_t}, Csize_t" a.julia_arg = "convert(Vector{Csize_t}, " + name + "), length(" + name + ")" + a.fortran_type = "integer (C_SIZE_T)" + a.fortran_type_post = "(*)\n integer (C_SIZE_T), value :: " + name +"_n" + a.fortran_name_post = ",\n & " + name + "_n" return a @@ -159,6 +176,9 @@ def ivectordouble(name, value=None, python_value=None, julia_value=None): a.python_arg = api_name + ", " + api_name_n a.julia_ctype = "Ptr{Cdouble}, Csize_t" a.julia_arg = "convert(Vector{Cdouble}, " + name + "), length(" + name + ")" + a.fortran_type = "real (C_DOUBLE)" + a.fortran_type_post = "(*)\n integer (C_SIZE_T), value :: " + name +"_n" + a.fortran_name_post = ",\n & " + name + "_n" return a @@ -182,6 +202,9 @@ def ivectorstring(name, value=None, python_value=None, julia_value=None): a.python_arg = api_name + ", " + api_name_n a.julia_ctype = "Ptr{Ptr{Cchar}}, Csize_t" a.julia_arg = name + ", length(" + name + ")" + a.fortran_type = "type (C_PTR)" + a.fortran_type_post = "(*)\n integer (C_SIZE_T), value :: " + name +"_n" + a.fortran_name_post = ",\n & " + name + "_n" return a @@ -210,6 +233,9 @@ def ivectorpair(name, value=None, python_value=None, julia_value=None): a.julia_pre = (api_name + " = collect(Cint, Iterators.flatten(" + name + "))\n " + api_name_n + " = length(" + api_name + ")") a.julia_arg = (api_name + ", " + api_name_n) + a.fortran_type = "integer (C_INT)" + a.fortran_type_post = "(*)\n integer (C_SIZE_T), value :: " + name +"_n" + a.fortran_name_post = ",\n & " + name + "_n" return a @@ -245,6 +271,9 @@ def ivectorvectorint(name, value=None, python_value=None, julia_value=None): "[i]) for i in 1:length(" + name + ") ]") a.julia_arg = ("convert(Vector{Vector{Cint}}," + name + "), " + api_name_n + ", length(" + name + ")") + a.fortran_type = "type (C_PTR), intent(out)" + a.fortran_type_post = "\n type (C_PTR), intent(out) :: " + name + "_n\n integer (C_SIZE_T) :: " + name +"_nn" + a.fortran_name_post = ",\n & " + name + "_n,\n & " + name + "_nn" return a @@ -281,6 +310,9 @@ def ivectorvectorsize(name, value=None, python_value=None, julia_value=None): "[i]) for i in 1:length(" + name + ") ]") a.julia_arg = ("convert(Vector{Vector{Csize_t}}," + name + "), " + api_name_n + ", length(" + name + ")") + a.fortran_type = "type (C_PTR), intent(out)" + a.fortran_type_post = "\n type (C_PTR), intent(out) :: " + name + "_n\n integer (C_SIZE_T) :: " + name +"_nn" + a.fortran_name_post = ",\n & " + name + "_n,\n & " + name + "_nn" return a @@ -317,6 +349,9 @@ def ivectorvectordouble(name, value=None, python_value=None, julia_value=None): "[i]) for i in 1:length(" + name + ") ]") a.julia_arg = ("convert(Vector{Vector{Cdouble}}," + name + "), " + api_name_n + ", length(" + name + ")") + a.fortran_type = "type (C_PTR), intent(out)" + a.fortran_type_post = "\n type (C_PTR), intent(out) :: " + name + "_n\n integer (C_SIZE_T) :: " + name +"_nn" + a.fortran_name_post = ",\n & " + name + "_n,\n & " + name + "_nn" return a @@ -328,6 +363,8 @@ class oint(arg): rc_type = "int" rtexi_type = "integer value" rjulia_type = "Cint" + fortran_type = "integer (C_INT)" + fortran_type_post = "" def __init__(self, name, value=None, python_value=None, julia_value=None): arg.__init__(self, name, value, python_value, julia_value, "int &", @@ -349,6 +386,8 @@ class osize(arg): rc_type = "size_t" rtexi_type = "size value" rjulia_type = "Csize_t" + fortran_type = "integer (C_SIZE_T)" + fortran_type_post = "" def __init__(self, name, value=None, python_value=None, julia_value=None): arg.__init__(self, name, value, python_value, julia_value, @@ -370,6 +409,8 @@ class odouble(arg): rc_type = "double" rtexi_type = "floating point value" rjulia_type = "Cdouble" + fortran_type = "real (C_DOUBLE)" + fortran_type_post = "" def __init__(self, name, value=None, python_value=None, julia_value=None): arg.__init__(self, name, value, python_value, julia_value, "double &", @@ -404,6 +445,8 @@ def ostring(name, value=None, python_value=None, julia_value=None): a.julia_pre = api_name + " = Ref{Ptr{Cchar}}()" a.julia_arg = api_name a.julia_post = name + " = unsafe_string(" + api_name + "[])" + a.fortran_type = "type (C_PTR)" + a.fortran_type_post = "(*)" return a @@ -429,6 +472,9 @@ def ovectorint(name, value=None, python_value=None, julia_value=None): a.julia_arg = api_name + ", " + api_name_n a.julia_post = (name + " = unsafe_wrap(Array, " + api_name + "[], " + api_name_n + "[], own=true)") + a.fortran_type = "type (C_PTR), intent(out)" + a.fortran_type_post = "\n integer (C_SIZE_T) :: " + name +"_n" + a.fortran_name_post = ",\n & " + name + "_n" return a @@ -454,6 +500,9 @@ def ovectorsize(name, value=None, python_value=None, julia_value=None): a.julia_arg = api_name + ", " + api_name_n a.julia_post = (name + " = unsafe_wrap(Array, " + api_name + "[], " + api_name_n + "[], own=true)") + a.fortran_type = "type (C_PTR), intent(out)" + a.fortran_type_post = "\n integer (C_SIZE_T) :: " + name +"_n" + a.fortran_name_post = ",\n & " + name + "_n" return a @@ -479,6 +528,9 @@ def ovectordouble(name, value=None, python_value=None, julia_value=None): a.julia_arg = api_name + ", " + api_name_n a.julia_post = (name + " = unsafe_wrap(Array, " + api_name + "[], " + api_name_n + "[], own=true)") + a.fortran_type = "type (C_PTR), intent(out)" + a.fortran_type_post = "\n integer (C_SIZE_T) :: " + name +"_n" + a.fortran_name_post = ",\n & " + name + "_n" return a @@ -509,6 +561,9 @@ def ovectorstring(name, value=None, python_value=None, julia_value=None): "[], " + api_name_n + "[], own=true)\n " + name + " = [unsafe_string(tmp_" + api_name + "[i]) for i in 1:length(tmp_" + api_name + ") ]") + a.fortran_type = "type (C_PTR), intent(out)" + a.fortran_type_post = "\n integer (C_SIZE_T) :: " + name +"_n" + a.fortran_name_post = ",\n & " + name + "_n" return a @@ -539,6 +594,9 @@ def ovectorpair(name, value=None, python_value=None, julia_value=None): "[], " + api_name_n + "[], own=true)\n " + name + " = [ (tmp_" + api_name + "[i], tmp_" + api_name + "[i+1]) " + "for i in 1:2:length(tmp_" + api_name + ") ]") + a.fortran_type = "type (C_PTR), intent(out)" + a.fortran_type_post = "\n integer (C_SIZE_T) :: " + name +"_n" + a.fortran_name_post = ",\n & " + name + "_n" return a @@ -580,6 +638,9 @@ def ovectorvectorint(name, value=None, python_value=None, julia_value=None): " = [ unsafe_wrap(Array, tmp_" + api_name + "[i], " + "tmp_" + api_name_n + "[i], own=true) for i in 1:" + api_name_nn + "[] ]") + a.fortran_type = "type (C_PTR), intent(out)" + a.fortran_type_post = "\n type (C_PTR), intent(out) :: " + name + "_n\n integer (C_SIZE_T) :: " + name +"_nn" + a.fortran_name_post = ",\n & " + name + "_n,\n & " + name + "_nn" return a @@ -621,6 +682,9 @@ def ovectorvectorsize(name, value=None, python_value=None, julia_value=None): " = [ unsafe_wrap(Array, tmp_" + api_name + "[i], " + "tmp_" + api_name_n + "[i], own=true) for i in 1:" + api_name_nn + "[] ]") + a.fortran_type = "type (C_PTR), intent(out)" + a.fortran_type_post = "\n type (C_PTR), intent(out) :: " + name + "_n\n integer (C_SIZE_T) :: " + name +"_nn" + a.fortran_name_post = ",\n & " + name + "_n,\n & " + name + "_nn" return a @@ -663,6 +727,9 @@ def ovectorvectordouble(name, value=None, python_value=None, julia_value=None): " = [ unsafe_wrap(Array, tmp_" + api_name + "[i], " + "tmp_" + api_name_n + "[i], own=true) for i in 1:" + api_name_nn + "[] ]") + a.fortran_type = "type (C_PTR), intent(out)" + a.fortran_type_post = "\n type (C_PTR), intent(out) :: " + name + "_n\n integer (C_SIZE_T) :: " + name +"_nn" + a.fortran_name_post = ",\n & " + name + "_n,\n & " + name + "_nn" return a @@ -710,6 +777,9 @@ def ovectorvectorpair(name, value=None, python_value=None, julia_value=None): api_name + "[i], tmp_" + api_name_n + "[i], own=true)\n " + " " + name + "[i] = [(tmp[i], tmp[i+1]) for i in 1:2:length(tmp)]\n " + "end") + a.fortran_type = "type (C_PTR), intent(out)" + a.fortran_type_post = "\n type (C_PTR), intent(out) :: " + name + "_n\n integer (C_SIZE_T) :: " + name +"_nn" + a.fortran_name_post = ",\n & " + name + "_n,\n & " + name + "_nn" return a @@ -732,6 +802,9 @@ def iargcargv(): a.julia_ctype = "Cint, Ptr{Ptr{Cchar}}" a.julia_arg = "length(argv), argv" a.texi = "(argc = 0)}, @code{argv = []" + a.fortran_name_pre = "argc,\n & " + a.fortran_type = "integer (C_INT), value :: argc\n type (C_PTR)" + a.fortran_type_post = "(*)" return a @@ -769,6 +842,8 @@ def isizefun(name): ", Cdouble, (Cint, Cint, Cdouble, Cdouble, Cdouble, Ptr{Cvoid}))") a.julia_arg = "api_" + name + "_, C_NULL" a.julia_ctype = "Ptr{Cvoid}, Ptr{Cvoid}" + a.fortran_type = "type (C_FUNPTR)" + a.fortran_type_post = " ! to do " return a @@ -1248,6 +1323,48 @@ julia_header = """# {0} """ +fortran_header = """c +c {0} +c +c See the LICENSE.txt file for license information. Please report all +c issues on {1} +c + +!DEC$ IF DEFINED ({2}F_H) +!DEC$ ELSE +!DEC$ DEFINE {2}F_H + +c +c This file defines the {3} Fortran API (v{4}.{5}.{6}). +c +c Do not edit it directly: it is automatically generated by `api/gen.py'. +c +c By design, the {3} Fortran API is purely functional, and only uses elementary +c Fortran types. See `tutorial/fortran' and `demos/api' for examples. +c + +!DEC$ DEFINE {2}_API_VERSION_MAJOR = {4} +!DEC$ DEFINE {2}_API_VERSION_MINOR = {5} +!DEC$ DEFINE {2}_API_VERSION_PATCH = {6} + + module gmsh_fortran + + use, intrinsic :: ISO_C_BINDING + + character (len=5), parameter :: {2}_API_VERSION = "{4}.{5}.{6}" + real (C_DOUBLE), parameter :: M_PI = 3.14159265358979323846d0 + + interface +""" + +fortran_footer = """ + end interface + end module gmsh_fortran + +!DEC$ ENDIF +""" + + def capi(s): return s[:1].upper() + s[1:] @@ -1271,7 +1388,7 @@ class API: self.copyright = copyright self.issues = issues self.modules = [] - self.api_lineno = {'cpp': {}, 'c': {}, 'py': {}, 'jl': {}} + self.api_lineno = {'cpp': {}, 'c': {}, 'py': {}, 'jl': {}, 'f': {}} def add_module(self, name, doc): module = Module(name, doc) @@ -1682,6 +1799,77 @@ class API: for module in self.modules: write_module(f, module, "", "", 1) + + def write_fortran(self): + def write_module(module, c_namespace, cpp_namespace, indent): + cpp_namespace += module.name + "::" + if c_namespace: + c_namespace += module.name[0].upper() + module.name[1:] + else: + c_namespace = module.name + + indent += " " + for rtype, name, args, doc, special in module.fs: + # *f.h + fname = c_namespace + name[0].upper() + name[1:] + +# output doc + self.fwrite( + f, + "\n! " + "\n! ".join(textwrap.wrap(doc, 75)) + "\n") + fnameapi = "! " + ns.upper() + "_API " + (rtype.rc_type if rtype else + "void") + " " + fname + "(" + self.flog('f', cpp_namespace.replace('::', '/') + name) + + if (len(fname) < 45) : + +# output fortran header + fnamef = ' '*8 + ("function" if rtype else "subroutine") + ' ' + fname + "(" + self.fwrite( + f, fnamef + "\n & " + (",\n & ").join( + list((a.fortran_name_pre + a.name + a.fortran_name_post for a in args + (oint("ierr"), )))) + ")\n") + + left = " " + self.fwrite( + f, + " & bind(C,name=\"" + fname + "\")" + "\n") + self.fwrite( + f, + left + "use, intrinsic :: ISO_C_BINDING" + "\n") + if rtype : + self.fwrite( + f, + left + (rtype.fortran_type) + " :: " + fname + "\n") + + self.fwrite( + f, ("").join( + list(( left + " " + a.fortran_type + " :: " + + a.name + a.fortran_type_post + + "\n" for a in args + (oint("ierr"), ) )) + ) + ) + + self.fwrite( + f, + left + "end " + ("function" if rtype else "subroutine") + + " " + fname + "\n") + + for m in module.submodules: + write_module(m, c_namespace, cpp_namespace, indent) + + self.current_lineno = 1 + with open(ns + "f.h", "w") as f: + self.fwrite( + f, + fortran_header.format(self.copyright, self.issues, + ns.upper(), self.code, + self.version_major, self.version_minor, + self.version_patch, ns)) + for module in self.modules: + write_module(module, "", "", "") + self.fwrite(f, fortran_footer) + + def write_texi(self): def tryint(s): try: diff --git a/api/gen.py b/api/gen.py index 204b43f1d998a0f709077d1b201e74049510971e..db2f5f87945de3cde5d462f60498a788976b79d6 100644 --- a/api/gen.py +++ b/api/gen.py @@ -1052,4 +1052,5 @@ api.write_cpp() api.write_c() api.write_python() api.write_julia() +api.write_fortran() api.write_texi() diff --git a/api/gmshf.h b/api/gmshf.h new file mode 100644 index 0000000000000000000000000000000000000000..6807e4e24371e71804ea274590d9aca0cd69485f --- /dev/null +++ b/api/gmshf.h @@ -0,0 +1,6367 @@ +c +c Gmsh - Copyright (C) 1997-2021 C. Geuzaine, J.-F. Remacle +c +c See the LICENSE.txt file for license information. Please report all +c issues on https://gitlab.onelab.info/gmsh/gmsh/issues. +c + +!DEC$ IF DEFINED (GMSHF_H) +!DEC$ ELSE +!DEC$ DEFINE GMSHF_H + +c +c This file defines the Gmsh Fortran API (v4.9.0). +c +c Do not edit it directly: it is automatically generated by `api/gen.py'. +c +c By design, the Gmsh Fortran API is purely functional, and only uses elementary +c Fortran types. See `tutorial/fortran' and `demos/api' for examples. +c + +!DEC$ DEFINE GMSH_API_VERSION_MAJOR = 4 +!DEC$ DEFINE GMSH_API_VERSION_MINOR = 9 +!DEC$ DEFINE GMSH_API_VERSION_PATCH = 0 + + module gmsh_fortran + + use, intrinsic :: ISO_C_BINDING + + character (len=5), parameter :: GMSH_API_VERSION = "4.9.0" + real (C_DOUBLE), parameter :: M_PI = 3.14159265358979323846d0 + + interface + +! Initialize the Gmsh API. This must be called before any call to the other +! functions in the API. If `argc' and `argv' (or just `argv' in Python or +! Julia) are provided, they will be handled in the same way as the command +! line arguments in the Gmsh app. If `readConfigFiles' is set, read system +! Gmsh configuration files (gmshrc and gmsh-options). Initializing the API +! sets the options "General.Terminal" to 1 and "General.AbortOnError" to 2. +! If compiled with OpenMP support, it also sets the number of threads to +! "General.NumThreads". + subroutine gmshInitialize( + & argc, + & argv, + & readConfigFiles, + & ierr) + & bind(C,name="gmshInitialize") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: argc + type (C_PTR) :: argv(*) + integer (C_INT), value :: readConfigFiles + integer (C_INT) :: ierr + end subroutine gmshInitialize + +! Finalize the Gmsh API. This must be called when you are done using the Gmsh +! API. + subroutine gmshFinalize( + & ierr) + & bind(C,name="gmshFinalize") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: ierr + end subroutine gmshFinalize + +! Open a file. Equivalent to the `File->Open' menu in the Gmsh app. Handling +! of the file depends on its extension and/or its contents: opening a file +! with model data will create a new model. + subroutine gmshOpen( + & fileName, + & ierr) + & bind(C,name="gmshOpen") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: fileName(*) + integer (C_INT) :: ierr + end subroutine gmshOpen + +! Merge a file. Equivalent to the `File->Merge' menu in the Gmsh app. +! Handling of the file depends on its extension and/or its contents. Merging +! a file with model data will add the data to the current model. + subroutine gmshMerge( + & fileName, + & ierr) + & bind(C,name="gmshMerge") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: fileName(*) + integer (C_INT) :: ierr + end subroutine gmshMerge + +! Write a file. The export format is determined by the file extension. + subroutine gmshWrite( + & fileName, + & ierr) + & bind(C,name="gmshWrite") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: fileName(*) + integer (C_INT) :: ierr + end subroutine gmshWrite + +! Clear all loaded models and post-processing data, and add a new empty +! model. + subroutine gmshClear( + & ierr) + & bind(C,name="gmshClear") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: ierr + end subroutine gmshClear + +! Set a numerical option to `value'. `name' is of the form "category.option" +! or "category[num].option". Available categories and options are listed in +! the Gmsh reference manual. + subroutine gmshOptionSetNumber( + & name, + & value, + & ierr) + & bind(C,name="gmshOptionSetNumber") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: name(*) + real (C_DOUBLE), value :: value + integer (C_INT) :: ierr + end subroutine gmshOptionSetNumber + +! Get the `value' of a numerical option. `name' is of the form +! "category.option" or "category[num].option". Available categories and +! options are listed in the Gmsh reference manual. + subroutine gmshOptionGetNumber( + & name, + & value, + & ierr) + & bind(C,name="gmshOptionGetNumber") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: name(*) + real (C_DOUBLE) :: value + integer (C_INT) :: ierr + end subroutine gmshOptionGetNumber + +! Set a string option to `value'. `name' is of the form "category.option" or +! "category[num].option". Available categories and options are listed in the +! Gmsh reference manual. + subroutine gmshOptionSetString( + & name, + & value, + & ierr) + & bind(C,name="gmshOptionSetString") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: name(*) + character (LEN=1,KIND=C_CHAR) :: value(*) + integer (C_INT) :: ierr + end subroutine gmshOptionSetString + +! Get the `value' of a string option. `name' is of the form "category.option" +! or "category[num].option". Available categories and options are listed in +! the Gmsh reference manual. + subroutine gmshOptionGetString( + & name, + & value, + & ierr) + & bind(C,name="gmshOptionGetString") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: name(*) + type (C_PTR) :: value(*) + integer (C_INT) :: ierr + end subroutine gmshOptionGetString + +! Set a color option to the RGBA value (`r', `g', `b', `a'), where where `r', +! `g', `b' and `a' should be integers between 0 and 255. `name' is of the +! form "category.option" or "category[num].option". Available categories and +! options are listed in the Gmsh reference manual, with the "Color." middle +! string removed. + subroutine gmshOptionSetColor( + & name, + & r, + & g, + & b, + & a, + & ierr) + & bind(C,name="gmshOptionSetColor") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: name(*) + integer (C_INT), value :: r + integer (C_INT), value :: g + integer (C_INT), value :: b + integer (C_INT), value :: a + integer (C_INT) :: ierr + end subroutine gmshOptionSetColor + +! Get the `r', `g', `b', `a' value of a color option. `name' is of the form +! "category.option" or "category[num].option". Available categories and +! options are listed in the Gmsh reference manual, with the "Color." middle +! string removed. + subroutine gmshOptionGetColor( + & name, + & r, + & g, + & b, + & a, + & ierr) + & bind(C,name="gmshOptionGetColor") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: name(*) + integer (C_INT) :: r + integer (C_INT) :: g + integer (C_INT) :: b + integer (C_INT) :: a + integer (C_INT) :: ierr + end subroutine gmshOptionGetColor + +! Add a new model, with name `name', and set it as the current model. + subroutine gmshModelAdd( + & name, + & ierr) + & bind(C,name="gmshModelAdd") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: name(*) + integer (C_INT) :: ierr + end subroutine gmshModelAdd + +! Remove the current model. + subroutine gmshModelRemove( + & ierr) + & bind(C,name="gmshModelRemove") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: ierr + end subroutine gmshModelRemove + +! List the names of all models. + subroutine gmshModelList( + & names, + & names_n, + & ierr) + & bind(C,name="gmshModelList") + use, intrinsic :: ISO_C_BINDING + type (C_PTR), intent(out) :: names + integer (C_SIZE_T) :: names_n + integer (C_INT) :: ierr + end subroutine gmshModelList + +! Get the name of the current model. + subroutine gmshModelGetCurrent( + & name, + & ierr) + & bind(C,name="gmshModelGetCurrent") + use, intrinsic :: ISO_C_BINDING + type (C_PTR) :: name(*) + integer (C_INT) :: ierr + end subroutine gmshModelGetCurrent + +! Set the current model to the model with name `name'. If several models have +! the same name, select the one that was added first. + subroutine gmshModelSetCurrent( + & name, + & ierr) + & bind(C,name="gmshModelSetCurrent") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: name(*) + integer (C_INT) :: ierr + end subroutine gmshModelSetCurrent + +! Get the file name (if any) associated with the current model. A file name +! is associated when a model is read from a file on disk. + subroutine gmshModelGetFileName( + & fileName, + & ierr) + & bind(C,name="gmshModelGetFileName") + use, intrinsic :: ISO_C_BINDING + type (C_PTR) :: fileName(*) + integer (C_INT) :: ierr + end subroutine gmshModelGetFileName + +! Set the file name associated with the current model. + subroutine gmshModelSetFileName( + & fileName, + & ierr) + & bind(C,name="gmshModelSetFileName") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: fileName(*) + integer (C_INT) :: ierr + end subroutine gmshModelSetFileName + +! Get all the entities in the current model. If `dim' is >= 0, return only +! the entities of the specified dimension (e.g. points if `dim' == 0). The +! entities are returned as a vector of (dim, tag) integer pairs. + subroutine gmshModelGetEntities( + & dimTags, + & dimTags_n, + & dim, + & ierr) + & bind(C,name="gmshModelGetEntities") + use, intrinsic :: ISO_C_BINDING + type (C_PTR), intent(out) :: dimTags + integer (C_SIZE_T) :: dimTags_n + integer (C_INT), value :: dim + integer (C_INT) :: ierr + end subroutine gmshModelGetEntities + +! Set the name of the entity of dimension `dim' and tag `tag'. + subroutine gmshModelSetEntityName( + & dim, + & tag, + & name, + & ierr) + & bind(C,name="gmshModelSetEntityName") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + character (LEN=1,KIND=C_CHAR) :: name(*) + integer (C_INT) :: ierr + end subroutine gmshModelSetEntityName + +! Get the name of the entity of dimension `dim' and tag `tag'. + subroutine gmshModelGetEntityName( + & dim, + & tag, + & name, + & ierr) + & bind(C,name="gmshModelGetEntityName") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + type (C_PTR) :: name(*) + integer (C_INT) :: ierr + end subroutine gmshModelGetEntityName + +! Get all the physical groups in the current model. If `dim' is >= 0, return +! only the entities of the specified dimension (e.g. physical points if `dim' +! == 0). The entities are returned as a vector of (dim, tag) integer pairs. + subroutine gmshModelGetPhysicalGroups( + & dimTags, + & dimTags_n, + & dim, + & ierr) + & bind(C,name="gmshModelGetPhysicalGroups") + use, intrinsic :: ISO_C_BINDING + type (C_PTR), intent(out) :: dimTags + integer (C_SIZE_T) :: dimTags_n + integer (C_INT), value :: dim + integer (C_INT) :: ierr + end subroutine gmshModelGetPhysicalGroups + +! Get the tags of the model entities making up the physical group of +! dimension `dim' and tag `tag'. + subroutine gmshModelGetEntitiesForPhysicalGroup( + & dim, + & tag, + & tags, + & tags_n, + & ierr) + & bind(C,name="gmshModelGetEntitiesForPhysicalGroup") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + type (C_PTR), intent(out) :: tags + integer (C_SIZE_T) :: tags_n + integer (C_INT) :: ierr + end subroutine gmshModelGetEntitiesForPhysicalGroup + +! Get the tags of the physical groups (if any) to which the model entity of +! dimension `dim' and tag `tag' belongs. + subroutine gmshModelGetPhysicalGroupsForEntity( + & dim, + & tag, + & physicalTags, + & physicalTags_n, + & ierr) + & bind(C,name="gmshModelGetPhysicalGroupsForEntity") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + type (C_PTR), intent(out) :: physicalTags + integer (C_SIZE_T) :: physicalTags_n + integer (C_INT) :: ierr + end subroutine gmshModelGetPhysicalGroupsForEntity + +! Add a physical group of dimension `dim', grouping the model entities with +! tags `tags'. Return the tag of the physical group, equal to `tag' if `tag' +! is positive, or a new tag if `tag' < 0. + function gmshModelAddPhysicalGroup( + & dim, + & tags, + & tags_n, + & tag, + & ierr) + & bind(C,name="gmshModelAddPhysicalGroup") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelAddPhysicalGroup + integer (C_INT), value :: dim + integer (C_INT) :: tags(*) + integer (C_SIZE_T), value :: tags_n + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelAddPhysicalGroup + +! Remove the physical groups `dimTags' from the current model. If `dimTags' +! is empty, remove all groups. + subroutine gmshModelRemovePhysicalGroups( + & dimTags, + & dimTags_n, + & ierr) + & bind(C,name="gmshModelRemovePhysicalGroups") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + integer (C_INT) :: ierr + end subroutine gmshModelRemovePhysicalGroups + +! Set the name of the physical group of dimension `dim' and tag `tag'. + subroutine gmshModelSetPhysicalName( + & dim, + & tag, + & name, + & ierr) + & bind(C,name="gmshModelSetPhysicalName") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + character (LEN=1,KIND=C_CHAR) :: name(*) + integer (C_INT) :: ierr + end subroutine gmshModelSetPhysicalName + +! Remove the physical name `name' from the current model. + subroutine gmshModelRemovePhysicalName( + & name, + & ierr) + & bind(C,name="gmshModelRemovePhysicalName") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: name(*) + integer (C_INT) :: ierr + end subroutine gmshModelRemovePhysicalName + +! Get the name of the physical group of dimension `dim' and tag `tag'. + subroutine gmshModelGetPhysicalName( + & dim, + & tag, + & name, + & ierr) + & bind(C,name="gmshModelGetPhysicalName") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + type (C_PTR) :: name(*) + integer (C_INT) :: ierr + end subroutine gmshModelGetPhysicalName + +! Get the boundary of the model entities `dimTags'. Return in `outDimTags' +! the boundary of the individual entities (if `combined' is false) or the +! boundary of the combined geometrical shape formed by all input entities (if +! `combined' is true). Return tags multiplied by the sign of the boundary +! entity if `oriented' is true. Apply the boundary operator recursively down +! to dimension 0 (i.e. to points) if `recursive' is true. + subroutine gmshModelGetBoundary( + & dimTags, + & dimTags_n, + & outDimTags, + & outDimTags_n, + & combined, + & oriented, + & recursive, + & ierr) + & bind(C,name="gmshModelGetBoundary") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + type (C_PTR), intent(out) :: outDimTags + integer (C_SIZE_T) :: outDimTags_n + integer (C_INT), value :: combined + integer (C_INT), value :: oriented + integer (C_INT), value :: recursive + integer (C_INT) :: ierr + end subroutine gmshModelGetBoundary + +! Get the upward and downward adjacencies of the model entity of dimension +! `dim' and tag `tag'. The `upward' vector returns the adjacent entities of +! dimension `dim' + 1; the `downward' vector returns the adjacent entities of +! dimension `dim' - 1. + subroutine gmshModelGetAdjacencies( + & dim, + & tag, + & upward, + & upward_n, + & downward, + & downward_n, + & ierr) + & bind(C,name="gmshModelGetAdjacencies") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + type (C_PTR), intent(out) :: upward + integer (C_SIZE_T) :: upward_n + type (C_PTR), intent(out) :: downward + integer (C_SIZE_T) :: downward_n + integer (C_INT) :: ierr + end subroutine gmshModelGetAdjacencies + +! Get the model entities in the bounding box defined by the two points +! (`xmin', `ymin', `zmin') and (`xmax', `ymax', `zmax'). If `dim' is >= 0, +! return only the entities of the specified dimension (e.g. points if `dim' +! == 0). + subroutine gmshModelGetEntitiesInBoundingBox( + & xmin, + & ymin, + & zmin, + & xmax, + & ymax, + & zmax, + & tags, + & tags_n, + & dim, + & ierr) + & bind(C,name="gmshModelGetEntitiesInBoundingBox") + use, intrinsic :: ISO_C_BINDING + real (C_DOUBLE), value :: xmin + real (C_DOUBLE), value :: ymin + real (C_DOUBLE), value :: zmin + real (C_DOUBLE), value :: xmax + real (C_DOUBLE), value :: ymax + real (C_DOUBLE), value :: zmax + type (C_PTR), intent(out) :: tags + integer (C_SIZE_T) :: tags_n + integer (C_INT), value :: dim + integer (C_INT) :: ierr + end subroutine gmshModelGetEntitiesInBoundingBox + +! Get the bounding box (`xmin', `ymin', `zmin'), (`xmax', `ymax', `zmax') of +! the model entity of dimension `dim' and tag `tag'. If `dim' and `tag' are +! negative, get the bounding box of the whole model. + subroutine gmshModelGetBoundingBox( + & dim, + & tag, + & xmin, + & ymin, + & zmin, + & xmax, + & ymax, + & zmax, + & ierr) + & bind(C,name="gmshModelGetBoundingBox") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + real (C_DOUBLE) :: xmin + real (C_DOUBLE) :: ymin + real (C_DOUBLE) :: zmin + real (C_DOUBLE) :: xmax + real (C_DOUBLE) :: ymax + real (C_DOUBLE) :: zmax + integer (C_INT) :: ierr + end subroutine gmshModelGetBoundingBox + +! Get the geometrical dimension of the current model. + function gmshModelGetDimension( + & ierr) + & bind(C,name="gmshModelGetDimension") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelGetDimension + integer (C_INT) :: ierr + end function gmshModelGetDimension + +! Add a discrete model entity (defined by a mesh) of dimension `dim' in the +! current model. Return the tag of the new discrete entity, equal to `tag' if +! `tag' is positive, or a new tag if `tag' < 0. `boundary' specifies the tags +! of the entities on the boundary of the discrete entity, if any. Specifying +! `boundary' allows Gmsh to construct the topology of the overall model. + function gmshModelAddDiscreteEntity( + & dim, + & tag, + & boundary, + & boundary_n, + & ierr) + & bind(C,name="gmshModelAddDiscreteEntity") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelAddDiscreteEntity + integer (C_INT), value :: dim + integer (C_INT), value :: tag + integer (C_INT) :: boundary(*) + integer (C_SIZE_T), value :: boundary_n + integer (C_INT) :: ierr + end function gmshModelAddDiscreteEntity + +! Remove the entities `dimTags' of the current model, provided that they are +! not on the boundary of (or embedded in) higher-dimensional entities. If +! `recursive' is true, remove all the entities on their boundaries, down to +! dimension 0. + subroutine gmshModelRemoveEntities( + & dimTags, + & dimTags_n, + & recursive, + & ierr) + & bind(C,name="gmshModelRemoveEntities") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + integer (C_INT), value :: recursive + integer (C_INT) :: ierr + end subroutine gmshModelRemoveEntities + +! Remove the entity name `name' from the current model. + subroutine gmshModelRemoveEntityName( + & name, + & ierr) + & bind(C,name="gmshModelRemoveEntityName") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: name(*) + integer (C_INT) :: ierr + end subroutine gmshModelRemoveEntityName + +! Get the type of the entity of dimension `dim' and tag `tag'. + subroutine gmshModelGetType( + & dim, + & tag, + & entityType, + & ierr) + & bind(C,name="gmshModelGetType") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + type (C_PTR) :: entityType(*) + integer (C_INT) :: ierr + end subroutine gmshModelGetType + +! In a partitioned model, get the parent of the entity of dimension `dim' and +! tag `tag', i.e. from which the entity is a part of, if any. `parentDim' and +! `parentTag' are set to -1 if the entity has no parent. + subroutine gmshModelGetParent( + & dim, + & tag, + & parentDim, + & parentTag, + & ierr) + & bind(C,name="gmshModelGetParent") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + integer (C_INT) :: parentDim + integer (C_INT) :: parentTag + integer (C_INT) :: ierr + end subroutine gmshModelGetParent + +! In a partitioned model, return the tags of the partition(s) to which the +! entity belongs. + subroutine gmshModelGetPartitions( + & dim, + & tag, + & partitions, + & partitions_n, + & ierr) + & bind(C,name="gmshModelGetPartitions") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + type (C_PTR), intent(out) :: partitions + integer (C_SIZE_T) :: partitions_n + integer (C_INT) :: ierr + end subroutine gmshModelGetPartitions + +! Evaluate the parametrization of the entity of dimension `dim' and tag `tag' +! at the parametric coordinates `parametricCoord'. Only valid for `dim' equal +! to 0 (with empty `parametricCoord'), 1 (with `parametricCoord' containing +! parametric coordinates on the curve) or 2 (with `parametricCoord' +! containing pairs of u, v parametric coordinates on the surface, +! concatenated: [p1u, p1v, p2u, ...]). Return triplets of x, y, z coordinates +! in `coord', concatenated: [p1x, p1y, p1z, p2x, ...]. + subroutine gmshModelGetValue( + & dim, + & tag, + & parametricCoord, + & parametricCoord_n, + & coord, + & coord_n, + & ierr) + & bind(C,name="gmshModelGetValue") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + real (C_DOUBLE) :: parametricCoord(*) + integer (C_SIZE_T), value :: parametricCoord_n + type (C_PTR), intent(out) :: coord + integer (C_SIZE_T) :: coord_n + integer (C_INT) :: ierr + end subroutine gmshModelGetValue + +! Evaluate the derivative of the parametrization of the entity of dimension +! `dim' and tag `tag' at the parametric coordinates `parametricCoord'. Only +! valid for `dim' equal to 1 (with `parametricCoord' containing parametric +! coordinates on the curve) or 2 (with `parametricCoord' containing pairs of +! u, v parametric coordinates on the surface, concatenated: [p1u, p1v, p2u, +! ...]). For `dim' equal to 1 return the x, y, z components of the derivative +! with respect to u [d1ux, d1uy, d1uz, d2ux, ...]; for `dim' equal to 2 +! return the x, y, z components of the derivative with respect to u and v: +! [d1ux, d1uy, d1uz, d1vx, d1vy, d1vz, d2ux, ...]. + subroutine gmshModelGetDerivative( + & dim, + & tag, + & parametricCoord, + & parametricCoord_n, + & derivatives, + & derivatives_n, + & ierr) + & bind(C,name="gmshModelGetDerivative") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + real (C_DOUBLE) :: parametricCoord(*) + integer (C_SIZE_T), value :: parametricCoord_n + type (C_PTR), intent(out) :: derivatives + integer (C_SIZE_T) :: derivatives_n + integer (C_INT) :: ierr + end subroutine gmshModelGetDerivative + +! Evaluate the second derivative of the parametrization of the entity of +! dimension `dim' and tag `tag' at the parametric coordinates +! `parametricCoord'. Only valid for `dim' equal to 1 (with `parametricCoord' +! containing parametric coordinates on the curve) or 2 (with +! `parametricCoord' containing pairs of u, v parametric coordinates on the +! surface, concatenated: [p1u, p1v, p2u, ...]). For `dim' equal to 1 return +! the x, y, z components of the second derivative with respect to u [d1uux, +! d1uuy, d1uuz, d2uux, ...]; for `dim' equal to 2 return the x, y, z +! components of the second derivative with respect to u and v, and the mixed +! derivative with respect to u and v: [d1uux, d1uuy, d1uuz, d1vvx, d1vvy, +! d1vvz, d1uvx, d1uvy, d1uvz, d2uux, ...]. + subroutine gmshModelGetSecondDerivative( + & dim, + & tag, + & parametricCoord, + & parametricCoord_n, + & derivatives, + & derivatives_n, + & ierr) + & bind(C,name="gmshModelGetSecondDerivative") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + real (C_DOUBLE) :: parametricCoord(*) + integer (C_SIZE_T), value :: parametricCoord_n + type (C_PTR), intent(out) :: derivatives + integer (C_SIZE_T) :: derivatives_n + integer (C_INT) :: ierr + end subroutine gmshModelGetSecondDerivative + +! Evaluate the (maximum) curvature of the entity of dimension `dim' and tag +! `tag' at the parametric coordinates `parametricCoord'. Only valid for `dim' +! equal to 1 (with `parametricCoord' containing parametric coordinates on the +! curve) or 2 (with `parametricCoord' containing pairs of u, v parametric +! coordinates on the surface, concatenated: [p1u, p1v, p2u, ...]). + subroutine gmshModelGetCurvature( + & dim, + & tag, + & parametricCoord, + & parametricCoord_n, + & curvatures, + & curvatures_n, + & ierr) + & bind(C,name="gmshModelGetCurvature") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + real (C_DOUBLE) :: parametricCoord(*) + integer (C_SIZE_T), value :: parametricCoord_n + type (C_PTR), intent(out) :: curvatures + integer (C_SIZE_T) :: curvatures_n + integer (C_INT) :: ierr + end subroutine gmshModelGetCurvature + +! Evaluate the principal curvatures of the surface with tag `tag' at the +! parametric coordinates `parametricCoord', as well as their respective +! directions. `parametricCoord' are given by pair of u and v coordinates, +! concatenated: [p1u, p1v, p2u, ...]. + subroutine gmshModelGetPrincipalCurvatures( + & tag, + & parametricCoord, + & parametricCoord_n, + & curvatureMax, + & curvatureMax_n, + & curvatureMin, + & curvatureMin_n, + & directionMax, + & directionMax_n, + & directionMin, + & directionMin_n, + & ierr) + & bind(C,name="gmshModelGetPrincipalCurvatures") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + real (C_DOUBLE) :: parametricCoord(*) + integer (C_SIZE_T), value :: parametricCoord_n + type (C_PTR), intent(out) :: curvatureMax + integer (C_SIZE_T) :: curvatureMax_n + type (C_PTR), intent(out) :: curvatureMin + integer (C_SIZE_T) :: curvatureMin_n + type (C_PTR), intent(out) :: directionMax + integer (C_SIZE_T) :: directionMax_n + type (C_PTR), intent(out) :: directionMin + integer (C_SIZE_T) :: directionMin_n + integer (C_INT) :: ierr + end subroutine gmshModelGetPrincipalCurvatures + +! Get the normal to the surface with tag `tag' at the parametric coordinates +! `parametricCoord'. `parametricCoord' are given by pairs of u and v +! coordinates, concatenated: [p1u, p1v, p2u, ...]. `normals' are returned as +! triplets of x, y, z components, concatenated: [n1x, n1y, n1z, n2x, ...]. + subroutine gmshModelGetNormal( + & tag, + & parametricCoord, + & parametricCoord_n, + & normals, + & normals_n, + & ierr) + & bind(C,name="gmshModelGetNormal") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + real (C_DOUBLE) :: parametricCoord(*) + integer (C_SIZE_T), value :: parametricCoord_n + type (C_PTR), intent(out) :: normals + integer (C_SIZE_T) :: normals_n + integer (C_INT) :: ierr + end subroutine gmshModelGetNormal + +! Get the parametric coordinates `parametricCoord' for the points `coord' on +! the entity of dimension `dim' and tag `tag'. `coord' are given as triplets +! of x, y, z coordinates, concatenated: [p1x, p1y, p1z, p2x, ...]. +! `parametricCoord' returns the parametric coordinates t on the curve (if +! `dim' = 1) or pairs of u and v coordinates concatenated on the surface (if +! `dim' = 2), i.e. [p1t, p2t, ...] or [p1u, p1v, p2u, ...]. + subroutine gmshModelGetParametrization( + & dim, + & tag, + & coord, + & coord_n, + & parametricCoord, + & parametricCoord_n, + & ierr) + & bind(C,name="gmshModelGetParametrization") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + real (C_DOUBLE) :: coord(*) + integer (C_SIZE_T), value :: coord_n + type (C_PTR), intent(out) :: parametricCoord + integer (C_SIZE_T) :: parametricCoord_n + integer (C_INT) :: ierr + end subroutine gmshModelGetParametrization + +! Get the `min' and `max' bounds of the parametric coordinates for the entity +! of dimension `dim' and tag `tag'. + subroutine gmshModelGetParametrizationBounds( + & dim, + & tag, + & min, + & min_n, + & max, + & max_n, + & ierr) + & bind(C,name="gmshModelGetParametrizationBounds") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + type (C_PTR), intent(out) :: min + integer (C_SIZE_T) :: min_n + type (C_PTR), intent(out) :: max + integer (C_SIZE_T) :: max_n + integer (C_INT) :: ierr + end subroutine gmshModelGetParametrizationBounds + +! Check if the coordinates (or the parametric coordinates if `parametric' is +! set) provided in `coord' correspond to points inside the entity of +! dimension `dim' and tag `tag', and return the number of points inside. This +! feature is only available for a subset of curves and surfaces, depending on +! the underyling geometrical representation. + function gmshModelIsInside( + & dim, + & tag, + & coord, + & coord_n, + & parametric, + & ierr) + & bind(C,name="gmshModelIsInside") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelIsInside + integer (C_INT), value :: dim + integer (C_INT), value :: tag + real (C_DOUBLE) :: coord(*) + integer (C_SIZE_T), value :: coord_n + integer (C_INT), value :: parametric + integer (C_INT) :: ierr + end function gmshModelIsInside + +! Get the points `closestCoord' on the entity of dimension `dim' and tag +! `tag' to the points `coord', by orthogonal projection. `coord' and +! `closestCoord' are given as triplets of x, y, z coordinates, concatenated: +! [p1x, p1y, p1z, p2x, ...]. `parametricCoord' returns the parametric +! coordinates t on the curve (if `dim' = 1) or pairs of u and v coordinates +! concatenated on the surface (if `dim' = 2), i.e. [p1t, p2t, ...] or [p1u, +! p1v, p2u, ...]. + subroutine gmshModelGetClosestPoint( + & dim, + & tag, + & coord, + & coord_n, + & closestCoord, + & closestCoord_n, + & parametricCoord, + & parametricCoord_n, + & ierr) + & bind(C,name="gmshModelGetClosestPoint") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + real (C_DOUBLE) :: coord(*) + integer (C_SIZE_T), value :: coord_n + type (C_PTR), intent(out) :: closestCoord + integer (C_SIZE_T) :: closestCoord_n + type (C_PTR), intent(out) :: parametricCoord + integer (C_SIZE_T) :: parametricCoord_n + integer (C_INT) :: ierr + end subroutine gmshModelGetClosestPoint + +! Reparametrize the boundary entity (point or curve, i.e. with `dim' == 0 or +! `dim' == 1) of tag `tag' on the surface `surfaceTag'. If `dim' == 1, +! reparametrize all the points corresponding to the parametric coordinates +! `parametricCoord'. Multiple matches in case of periodic surfaces can be +! selected with `which'. This feature is only available for a subset of +! entities, depending on the underyling geometrical representation. + subroutine gmshModelReparametrizeOnSurface( + & dim, + & tag, + & parametricCoord, + & parametricCoord_n, + & surfaceTag, + & surfaceParametricCoord, + & surfaceParametricCoord_n, + & which, + & ierr) + & bind(C,name="gmshModelReparametrizeOnSurface") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + real (C_DOUBLE) :: parametricCoord(*) + integer (C_SIZE_T), value :: parametricCoord_n + integer (C_INT), value :: surfaceTag + type (C_PTR), intent(out) :: surfaceParametricCoord + integer (C_SIZE_T) :: surfaceParametricCoord_n + integer (C_INT), value :: which + integer (C_INT) :: ierr + end subroutine gmshModelReparametrizeOnSurface + +! Set the visibility of the model entities `dimTags' to `value'. Apply the +! visibility setting recursively if `recursive' is true. + subroutine gmshModelSetVisibility( + & dimTags, + & dimTags_n, + & value, + & recursive, + & ierr) + & bind(C,name="gmshModelSetVisibility") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + integer (C_INT), value :: value + integer (C_INT), value :: recursive + integer (C_INT) :: ierr + end subroutine gmshModelSetVisibility + +! Get the visibility of the model entity of dimension `dim' and tag `tag'. + subroutine gmshModelGetVisibility( + & dim, + & tag, + & value, + & ierr) + & bind(C,name="gmshModelGetVisibility") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + integer (C_INT) :: value + integer (C_INT) :: ierr + end subroutine gmshModelGetVisibility + +! Set the global visibility of the model per window to `value', where +! `windowIndex' identifies the window in the window list. + subroutine gmshModelSetVisibilityPerWindow( + & value, + & windowIndex, + & ierr) + & bind(C,name="gmshModelSetVisibilityPerWindow") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: value + integer (C_INT), value :: windowIndex + integer (C_INT) :: ierr + end subroutine gmshModelSetVisibilityPerWindow + +! Set the color of the model entities `dimTags' to the RGBA value (`r', `g', +! `b', `a'), where `r', `g', `b' and `a' should be integers between 0 and +! 255. Apply the color setting recursively if `recursive' is true. + subroutine gmshModelSetColor( + & dimTags, + & dimTags_n, + & r, + & g, + & b, + & a, + & recursive, + & ierr) + & bind(C,name="gmshModelSetColor") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + integer (C_INT), value :: r + integer (C_INT), value :: g + integer (C_INT), value :: b + integer (C_INT), value :: a + integer (C_INT), value :: recursive + integer (C_INT) :: ierr + end subroutine gmshModelSetColor + +! Get the color of the model entity of dimension `dim' and tag `tag'. + subroutine gmshModelGetColor( + & dim, + & tag, + & r, + & g, + & b, + & a, + & ierr) + & bind(C,name="gmshModelGetColor") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + integer (C_INT) :: r + integer (C_INT) :: g + integer (C_INT) :: b + integer (C_INT) :: a + integer (C_INT) :: ierr + end subroutine gmshModelGetColor + +! Set the `x', `y', `z' coordinates of a geometrical point. + subroutine gmshModelSetCoordinates( + & tag, + & x, + & y, + & z, + & ierr) + & bind(C,name="gmshModelSetCoordinates") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + real (C_DOUBLE), value :: x + real (C_DOUBLE), value :: y + real (C_DOUBLE), value :: z + integer (C_INT) :: ierr + end subroutine gmshModelSetCoordinates + +! Generate a mesh of the current model, up to dimension `dim' (0, 1, 2 or 3). + subroutine gmshModelMeshGenerate( + & dim, + & ierr) + & bind(C,name="gmshModelMeshGenerate") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT) :: ierr + end subroutine gmshModelMeshGenerate + +! Partition the mesh of the current model into `numPart' partitions. +! Optionally, `elementTags' and `partitions' can be provided to specify the +! partition of each element explicitly. + subroutine gmshModelMeshPartition( + & numPart, + & elementTags, + & elementTags_n, + & partitions, + & partitions_n, + & ierr) + & bind(C,name="gmshModelMeshPartition") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: numPart + integer (C_SIZE_T) :: elementTags(*) + integer (C_SIZE_T), value :: elementTags_n + integer (C_INT) :: partitions(*) + integer (C_SIZE_T), value :: partitions_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshPartition + +! Unpartition the mesh of the current model. + subroutine gmshModelMeshUnpartition( + & ierr) + & bind(C,name="gmshModelMeshUnpartition") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: ierr + end subroutine gmshModelMeshUnpartition + +! Optimize the mesh of the current model using `method' (empty for default +! tetrahedral mesh optimizer, "Netgen" for Netgen optimizer, "HighOrder" for +! direct high-order mesh optimizer, "HighOrderElastic" for high-order elastic +! smoother, "HighOrderFastCurving" for fast curving algorithm, "Laplace2D" +! for Laplace smoothing, "Relocate2D" and "Relocate3D" for node relocation). +! If `force' is set apply the optimization also to discrete entities. If +! `dimTags' is given, only apply the optimizer to the given entities. + subroutine gmshModelMeshOptimize( + & method, + & force, + & niter, + & dimTags, + & dimTags_n, + & ierr) + & bind(C,name="gmshModelMeshOptimize") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: method(*) + integer (C_INT), value :: force + integer (C_INT), value :: niter + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshOptimize + +! Recombine the mesh of the current model. + subroutine gmshModelMeshRecombine( + & ierr) + & bind(C,name="gmshModelMeshRecombine") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: ierr + end subroutine gmshModelMeshRecombine + +! Refine the mesh of the current model by uniformly splitting the elements. + subroutine gmshModelMeshRefine( + & ierr) + & bind(C,name="gmshModelMeshRefine") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: ierr + end subroutine gmshModelMeshRefine + +! Set the order of the elements in the mesh of the current model to `order'. + subroutine gmshModelMeshSetOrder( + & order, + & ierr) + & bind(C,name="gmshModelMeshSetOrder") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: order + integer (C_INT) :: ierr + end subroutine gmshModelMeshSetOrder + +! Get the last entities (if any) where a meshing error occurred. Currently +! only populated by the new 3D meshing algorithms. + subroutine gmshModelMeshGetLastEntityError( + & dimTags, + & dimTags_n, + & ierr) + & bind(C,name="gmshModelMeshGetLastEntityError") + use, intrinsic :: ISO_C_BINDING + type (C_PTR), intent(out) :: dimTags + integer (C_SIZE_T) :: dimTags_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetLastEntityError + +! Get the last nodes (if any) where a meshing error occurred. Currently only +! populated by the new 3D meshing algorithms. + subroutine gmshModelMeshGetLastNodeError( + & nodeTags, + & nodeTags_n, + & ierr) + & bind(C,name="gmshModelMeshGetLastNodeError") + use, intrinsic :: ISO_C_BINDING + type (C_PTR), intent(out) :: nodeTags + integer (C_SIZE_T) :: nodeTags_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetLastNodeError + +! Clear the mesh, i.e. delete all the nodes and elements, for the entities +! `dimTags'. If `dimTags' is empty, clear the whole mesh. Note that the mesh +! of an entity can only be cleared if this entity is not on the boundary of +! another entity with a non-empty mesh. + subroutine gmshModelMeshClear( + & dimTags, + & dimTags_n, + & ierr) + & bind(C,name="gmshModelMeshClear") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshClear + +! Reverse the orientation of the elements in the entities `dimTags'. If +! `dimTags' is empty, reverse the orientation of the elements in the whole +! mesh. + subroutine gmshModelMeshReverse( + & dimTags, + & dimTags_n, + & ierr) + & bind(C,name="gmshModelMeshReverse") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshReverse + +! Apply the affine transformation `affineTransform' (16 entries of a 4x4 +! matrix, by row; only the 12 first can be provided for convenience) to the +! coordinates of the nodes classified on the entities `dimTags'. If `dimTags' +! is empty, transform all the nodes in the mesh. + subroutine gmshModelMeshAffineTransform( + & affineTransform, + & affineTransform_n, + & dimTags, + & dimTags_n, + & ierr) + & bind(C,name="gmshModelMeshAffineTransform") + use, intrinsic :: ISO_C_BINDING + real (C_DOUBLE) :: affineTransform(*) + integer (C_SIZE_T), value :: affineTransform_n + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshAffineTransform + +! Get the nodes classified on the entity of dimension `dim' and tag `tag'. If +! `tag' < 0, get the nodes for all entities of dimension `dim'. If `dim' and +! `tag' are negative, get all the nodes in the mesh. `nodeTags' contains the +! node tags (their unique, strictly positive identification numbers). `coord' +! is a vector of length 3 times the length of `nodeTags' that contains the x, +! y, z coordinates of the nodes, concatenated: [n1x, n1y, n1z, n2x, ...]. If +! `dim' >= 0 and `returnParamtricCoord' is set, `parametricCoord' contains +! the parametric coordinates ([u1, u2, ...] or [u1, v1, u2, ...]) of the +! nodes, if available. The length of `parametricCoord' can be 0 or `dim' +! times the length of `nodeTags'. If `includeBoundary' is set, also return +! the nodes classified on the boundary of the entity (which will be +! reparametrized on the entity if `dim' >= 0 in order to compute their +! parametric coordinates). + subroutine gmshModelMeshGetNodes( + & nodeTags, + & nodeTags_n, + & coord, + & coord_n, + & parametricCoord, + & parametricCoord_n, + & dim, + & tag, + & includeBoundary, + & returnParametricCoord, + & ierr) + & bind(C,name="gmshModelMeshGetNodes") + use, intrinsic :: ISO_C_BINDING + type (C_PTR), intent(out) :: nodeTags + integer (C_SIZE_T) :: nodeTags_n + type (C_PTR), intent(out) :: coord + integer (C_SIZE_T) :: coord_n + type (C_PTR), intent(out) :: parametricCoord + integer (C_SIZE_T) :: parametricCoord_n + integer (C_INT), value :: dim + integer (C_INT), value :: tag + integer (C_INT), value :: includeBoundary + integer (C_INT), value :: returnParametricCoord + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetNodes + +! Get the nodes classified on the entity of tag `tag', for all the elements +! of type `elementType'. The other arguments are treated as in `getNodes'. + subroutine gmshModelMeshGetNodesByElementType( + & elementType, + & nodeTags, + & nodeTags_n, + & coord, + & coord_n, + & parametricCoord, + & parametricCoord_n, + & tag, + & returnParametricCoord, + & ierr) + & bind(C,name="gmshModelMeshGetNodesByElementType") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: elementType + type (C_PTR), intent(out) :: nodeTags + integer (C_SIZE_T) :: nodeTags_n + type (C_PTR), intent(out) :: coord + integer (C_SIZE_T) :: coord_n + type (C_PTR), intent(out) :: parametricCoord + integer (C_SIZE_T) :: parametricCoord_n + integer (C_INT), value :: tag + integer (C_INT), value :: returnParametricCoord + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetNodesByElementType + +! Get the coordinates and the parametric coordinates (if any) of the node +! with tag `tag', as well as the dimension `dim' and tag `tag' of the entity +! on which the node is classified. This function relies on an internal cache +! (a vector in case of dense node numbering, a map otherwise); for large +! meshes accessing nodes in bulk is often preferable. + subroutine gmshModelMeshGetNode( + & nodeTag, + & coord, + & coord_n, + & parametricCoord, + & parametricCoord_n, + & dim, + & tag, + & ierr) + & bind(C,name="gmshModelMeshGetNode") + use, intrinsic :: ISO_C_BINDING + integer (C_SIZE_T), value :: nodeTag + type (C_PTR), intent(out) :: coord + integer (C_SIZE_T) :: coord_n + type (C_PTR), intent(out) :: parametricCoord + integer (C_SIZE_T) :: parametricCoord_n + integer (C_INT) :: dim + integer (C_INT) :: tag + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetNode + +! Set the coordinates and the parametric coordinates (if any) of the node +! with tag `tag'. This function relies on an internal cache (a vector in case +! of dense node numbering, a map otherwise); for large meshes accessing nodes +! in bulk is often preferable. + subroutine gmshModelMeshSetNode( + & nodeTag, + & coord, + & coord_n, + & parametricCoord, + & parametricCoord_n, + & ierr) + & bind(C,name="gmshModelMeshSetNode") + use, intrinsic :: ISO_C_BINDING + integer (C_SIZE_T), value :: nodeTag + real (C_DOUBLE) :: coord(*) + integer (C_SIZE_T), value :: coord_n + real (C_DOUBLE) :: parametricCoord(*) + integer (C_SIZE_T), value :: parametricCoord_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshSetNode + +! Rebuild the node cache. + subroutine gmshModelMeshRebuildNodeCache( + & onlyIfNecessary, + & ierr) + & bind(C,name="gmshModelMeshRebuildNodeCache") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: onlyIfNecessary + integer (C_INT) :: ierr + end subroutine gmshModelMeshRebuildNodeCache + +! Rebuild the element cache. + subroutine gmshModelMeshRebuildElementCache( + & onlyIfNecessary, + & ierr) + & bind(C,name="gmshModelMeshRebuildElementCache") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: onlyIfNecessary + integer (C_INT) :: ierr + end subroutine gmshModelMeshRebuildElementCache + +! Get the nodes from all the elements belonging to the physical group of +! dimension `dim' and tag `tag'. `nodeTags' contains the node tags; `coord' +! is a vector of length 3 times the length of `nodeTags' that contains the x, +! y, z coordinates of the nodes, concatenated: [n1x, n1y, n1z, n2x, ...]. + subroutine gmshModelMeshGetNodesForPhysicalGroup( + & dim, + & tag, + & nodeTags, + & nodeTags_n, + & coord, + & coord_n, + & ierr) + & bind(C,name="gmshModelMeshGetNodesForPhysicalGroup") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + type (C_PTR), intent(out) :: nodeTags + integer (C_SIZE_T) :: nodeTags_n + type (C_PTR), intent(out) :: coord + integer (C_SIZE_T) :: coord_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetNodesForPhysicalGroup + +! Add nodes classified on the model entity of dimension `dim' and tag `tag'. +! `nodeTags' contains the node tags (their unique, strictly positive +! identification numbers). `coord' is a vector of length 3 times the length +! of `nodeTags' that contains the x, y, z coordinates of the nodes, +! concatenated: [n1x, n1y, n1z, n2x, ...]. The optional `parametricCoord' +! vector contains the parametric coordinates of the nodes, if any. The length +! of `parametricCoord' can be 0 or `dim' times the length of `nodeTags'. If +! the `nodeTags' vector is empty, new tags are automatically assigned to the +! nodes. + subroutine gmshModelMeshAddNodes( + & dim, + & tag, + & nodeTags, + & nodeTags_n, + & coord, + & coord_n, + & parametricCoord, + & parametricCoord_n, + & ierr) + & bind(C,name="gmshModelMeshAddNodes") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + integer (C_SIZE_T) :: nodeTags(*) + integer (C_SIZE_T), value :: nodeTags_n + real (C_DOUBLE) :: coord(*) + integer (C_SIZE_T), value :: coord_n + real (C_DOUBLE) :: parametricCoord(*) + integer (C_SIZE_T), value :: parametricCoord_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshAddNodes + +! Reclassify all nodes on their associated model entity, based on the +! elements. Can be used when importing nodes in bulk (e.g. by associating +! them all to a single volume), to reclassify them correctly on model +! surfaces, curves, etc. after the elements have been set. + subroutine gmshModelMeshReclassifyNodes( + & ierr) + & bind(C,name="gmshModelMeshReclassifyNodes") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: ierr + end subroutine gmshModelMeshReclassifyNodes + +! Relocate the nodes classified on the entity of dimension `dim' and tag +! `tag' using their parametric coordinates. If `tag' < 0, relocate the nodes +! for all entities of dimension `dim'. If `dim' and `tag' are negative, +! relocate all the nodes in the mesh. + subroutine gmshModelMeshRelocateNodes( + & dim, + & tag, + & ierr) + & bind(C,name="gmshModelMeshRelocateNodes") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end subroutine gmshModelMeshRelocateNodes + +! Get the elements classified on the entity of dimension `dim' and tag `tag'. +! If `tag' < 0, get the elements for all entities of dimension `dim'. If +! `dim' and `tag' are negative, get all the elements in the mesh. +! `elementTypes' contains the MSH types of the elements (e.g. `2' for 3-node +! triangles: see `getElementProperties' to obtain the properties for a given +! element type). `elementTags' is a vector of the same length as +! `elementTypes'; each entry is a vector containing the tags (unique, +! strictly positive identifiers) of the elements of the corresponding type. +! `nodeTags' is also a vector of the same length as `elementTypes'; each +! entry is a vector of length equal to the number of elements of the given +! type times the number N of nodes for this type of element, that contains +! the node tags of all the elements of the given type, concatenated: [e1n1, +! e1n2, ..., e1nN, e2n1, ...]. + subroutine gmshModelMeshGetElements( + & elementTypes, + & elementTypes_n, + & elementTags, + & elementTags_n, + & elementTags_nn, + & nodeTags, + & nodeTags_n, + & nodeTags_nn, + & dim, + & tag, + & ierr) + & bind(C,name="gmshModelMeshGetElements") + use, intrinsic :: ISO_C_BINDING + type (C_PTR), intent(out) :: elementTypes + integer (C_SIZE_T) :: elementTypes_n + type (C_PTR), intent(out) :: elementTags + type (C_PTR), intent(out) :: elementTags_n + integer (C_SIZE_T) :: elementTags_nn + type (C_PTR), intent(out) :: nodeTags + type (C_PTR), intent(out) :: nodeTags_n + integer (C_SIZE_T) :: nodeTags_nn + integer (C_INT), value :: dim + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetElements + +! Get the type and node tags of the element with tag `tag', as well as the +! dimension `dim' and tag `tag' of the entity on which the element is +! classified. This function relies on an internal cache (a vector in case of +! dense element numbering, a map otherwise); for large meshes accessing +! elements in bulk is often preferable. + subroutine gmshModelMeshGetElement( + & elementTag, + & elementType, + & nodeTags, + & nodeTags_n, + & dim, + & tag, + & ierr) + & bind(C,name="gmshModelMeshGetElement") + use, intrinsic :: ISO_C_BINDING + integer (C_SIZE_T), value :: elementTag + integer (C_INT) :: elementType + type (C_PTR), intent(out) :: nodeTags + integer (C_SIZE_T) :: nodeTags_n + integer (C_INT) :: dim + integer (C_INT) :: tag + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetElement + +! Search the mesh for an element located at coordinates (`x', `y', `z'). This +! function performs a search in a spatial octree. If an element is found, +! return its tag, type and node tags, as well as the local coordinates (`u', +! `v', `w') within the reference element corresponding to search location. If +! `dim' is >= 0, only search for elements of the given dimension. If `strict' +! is not set, use a tolerance to find elements near the search location. + subroutine gmshModelMeshGetElementByCoordinates( + & x, + & y, + & z, + & elementTag, + & elementType, + & nodeTags, + & nodeTags_n, + & u, + & v, + & w, + & dim, + & strict, + & ierr) + & bind(C,name="gmshModelMeshGetElementByCoordinates") + use, intrinsic :: ISO_C_BINDING + real (C_DOUBLE), value :: x + real (C_DOUBLE), value :: y + real (C_DOUBLE), value :: z + integer (C_SIZE_T) :: elementTag + integer (C_INT) :: elementType + type (C_PTR), intent(out) :: nodeTags + integer (C_SIZE_T) :: nodeTags_n + real (C_DOUBLE) :: u + real (C_DOUBLE) :: v + real (C_DOUBLE) :: w + integer (C_INT), value :: dim + integer (C_INT), value :: strict + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetElementByCoordinates + +! Search the mesh for element(s) located at coordinates (`x', `y', `z'). This +! function performs a search in a spatial octree. Return the tags of all +! found elements in `elementTags'. Additional information about the elements +! can be accessed through `getElement' and `getLocalCoordinatesInElement'. If +! `dim' is >= 0, only search for elements of the given dimension. If `strict' +! is not set, use a tolerance to find elements near the search location. + subroutine gmshModelMeshGetElementsByCoordinates( + & x, + & y, + & z, + & elementTags, + & elementTags_n, + & dim, + & strict, + & ierr) + & bind(C,name="gmshModelMeshGetElementsByCoordinates") + use, intrinsic :: ISO_C_BINDING + real (C_DOUBLE), value :: x + real (C_DOUBLE), value :: y + real (C_DOUBLE), value :: z + type (C_PTR), intent(out) :: elementTags + integer (C_SIZE_T) :: elementTags_n + integer (C_INT), value :: dim + integer (C_INT), value :: strict + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetElementsByCoordinates + +! Return the local coordinates (`u', `v', `w') within the element +! `elementTag' corresponding to the model coordinates (`x', `y', `z'). This +! function relies on an internal cache (a vector in case of dense element +! numbering, a map otherwise); for large meshes accessing elements in bulk is +! often preferable. + subroutine gmshModelMeshGetLocalCoordinatesInElement( + & elementTag, + & x, + & y, + & z, + & u, + & v, + & w, + & ierr) + & bind(C,name="gmshModelMeshGetLocalCoordinatesInElement") + use, intrinsic :: ISO_C_BINDING + integer (C_SIZE_T), value :: elementTag + real (C_DOUBLE), value :: x + real (C_DOUBLE), value :: y + real (C_DOUBLE), value :: z + real (C_DOUBLE) :: u + real (C_DOUBLE) :: v + real (C_DOUBLE) :: w + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetLocalCoordinatesInElement + +! Get the types of elements in the entity of dimension `dim' and tag `tag'. +! If `tag' < 0, get the types for all entities of dimension `dim'. If `dim' +! and `tag' are negative, get all the types in the mesh. + subroutine gmshModelMeshGetElementTypes( + & elementTypes, + & elementTypes_n, + & dim, + & tag, + & ierr) + & bind(C,name="gmshModelMeshGetElementTypes") + use, intrinsic :: ISO_C_BINDING + type (C_PTR), intent(out) :: elementTypes + integer (C_SIZE_T) :: elementTypes_n + integer (C_INT), value :: dim + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetElementTypes + +! Return an element type given its family name `familyName' ("Point", "Line", +! "Triangle", "Quadrangle", "Tetrahedron", "Pyramid", "Prism", "Hexahedron") +! and polynomial order `order'. If `serendip' is true, return the +! corresponding serendip element type (element without interior nodes). + function gmshModelMeshGetElementType( + & familyName, + & order, + & serendip, + & ierr) + & bind(C,name="gmshModelMeshGetElementType") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelMeshGetElementType + character (LEN=1,KIND=C_CHAR) :: familyName(*) + integer (C_INT), value :: order + integer (C_INT), value :: serendip + integer (C_INT) :: ierr + end function gmshModelMeshGetElementType + +! Get the properties of an element of type `elementType': its name +! (`elementName'), dimension (`dim'), order (`order'), number of nodes +! (`numNodes'), local coordinates of the nodes in the reference element +! (`localNodeCoord' vector, of length `dim' times `numNodes') and number of +! primary (first order) nodes (`numPrimaryNodes'). + subroutine gmshModelMeshGetElementProperties( + & elementType, + & elementName, + & dim, + & order, + & numNodes, + & localNodeCoord, + & localNodeCoord_n, + & numPrimaryNodes, + & ierr) + & bind(C,name="gmshModelMeshGetElementProperties") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: elementType + type (C_PTR) :: elementName(*) + integer (C_INT) :: dim + integer (C_INT) :: order + integer (C_INT) :: numNodes + type (C_PTR), intent(out) :: localNodeCoord + integer (C_SIZE_T) :: localNodeCoord_n + integer (C_INT) :: numPrimaryNodes + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetElementProperties + +! Get the elements of type `elementType' classified on the entity of tag +! `tag'. If `tag' < 0, get the elements for all entities. `elementTags' is a +! vector containing the tags (unique, strictly positive identifiers) of the +! elements of the corresponding type. `nodeTags' is a vector of length equal +! to the number of elements of the given type times the number N of nodes for +! this type of element, that contains the node tags of all the elements of +! the given type, concatenated: [e1n1, e1n2, ..., e1nN, e2n1, ...]. If +! `numTasks' > 1, only compute and return the part of the data indexed by +! `task'. + subroutine gmshModelMeshGetElementsByType( + & elementType, + & elementTags, + & elementTags_n, + & nodeTags, + & nodeTags_n, + & tag, + & task, + & numTasks, + & ierr) + & bind(C,name="gmshModelMeshGetElementsByType") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: elementType + type (C_PTR), intent(out) :: elementTags + integer (C_SIZE_T) :: elementTags_n + type (C_PTR), intent(out) :: nodeTags + integer (C_SIZE_T) :: nodeTags_n + integer (C_INT), value :: tag + integer (C_SIZE_T), value :: task + integer (C_SIZE_T), value :: numTasks + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetElementsByType + +! Preallocate data before calling `getElementsByType' with `numTasks' > 1. +! For C and C++ only. + subroutine gmshModelMeshPreallocateElementsByType( + & elementType, + & elementTag, + & nodeTag, + & elementTags, + & elementTags_n, + & nodeTags, + & nodeTags_n, + & tag, + & ierr) + & bind(C,name="gmshModelMeshPreallocateElementsByType") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: elementType + integer (C_INT), value :: elementTag + integer (C_INT), value :: nodeTag + type (C_PTR), intent(out) :: elementTags + integer (C_SIZE_T) :: elementTags_n + type (C_PTR), intent(out) :: nodeTags + integer (C_SIZE_T) :: nodeTags_n + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end subroutine gmshModelMeshPreallocateElementsByType + +! Add elements classified on the entity of dimension `dim' and tag `tag'. +! `types' contains the MSH types of the elements (e.g. `2' for 3-node +! triangles: see the Gmsh reference manual). `elementTags' is a vector of the +! same length as `types'; each entry is a vector containing the tags (unique, +! strictly positive identifiers) of the elements of the corresponding type. +! `nodeTags' is also a vector of the same length as `types'; each entry is a +! vector of length equal to the number of elements of the given type times +! the number N of nodes per element, that contains the node tags of all the +! elements of the given type, concatenated: [e1n1, e1n2, ..., e1nN, e2n1, +! ...]. + subroutine gmshModelMeshAddElements( + & dim, + & tag, + & elementTypes, + & elementTypes_n, + & elementTags, + & elementTags_n, + & elementTags_nn, + & nodeTags, + & nodeTags_n, + & nodeTags_nn, + & ierr) + & bind(C,name="gmshModelMeshAddElements") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + integer (C_INT) :: elementTypes(*) + integer (C_SIZE_T), value :: elementTypes_n + type (C_PTR), intent(out) :: elementTags + type (C_PTR), intent(out) :: elementTags_n + integer (C_SIZE_T) :: elementTags_nn + type (C_PTR), intent(out) :: nodeTags + type (C_PTR), intent(out) :: nodeTags_n + integer (C_SIZE_T) :: nodeTags_nn + integer (C_INT) :: ierr + end subroutine gmshModelMeshAddElements + +! Add elements of type `elementType' classified on the entity of tag `tag'. +! `elementTags' contains the tags (unique, strictly positive identifiers) of +! the elements of the corresponding type. `nodeTags' is a vector of length +! equal to the number of elements times the number N of nodes per element, +! that contains the node tags of all the elements, concatenated: [e1n1, e1n2, +! ..., e1nN, e2n1, ...]. If the `elementTag' vector is empty, new tags are +! automatically assigned to the elements. + subroutine gmshModelMeshAddElementsByType( + & tag, + & elementType, + & elementTags, + & elementTags_n, + & nodeTags, + & nodeTags_n, + & ierr) + & bind(C,name="gmshModelMeshAddElementsByType") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + integer (C_INT), value :: elementType + integer (C_SIZE_T) :: elementTags(*) + integer (C_SIZE_T), value :: elementTags_n + integer (C_SIZE_T) :: nodeTags(*) + integer (C_SIZE_T), value :: nodeTags_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshAddElementsByType + +! Get the numerical quadrature information for the given element type +! `elementType' and integration rule `integrationType' (e.g. "Gauss4" for a +! Gauss quadrature suited for integrating 4th order polynomials). +! `localCoord' contains the u, v, w coordinates of the G integration points +! in the reference element: [g1u, g1v, g1w, ..., gGu, gGv, gGw]. `weights' +! contains the associated weights: [g1q, ..., gGq]. + subroutine gmshModelMeshGetIntegrationPoints( + & elementType, + & integrationType, + & localCoord, + & localCoord_n, + & weights, + & weights_n, + & ierr) + & bind(C,name="gmshModelMeshGetIntegrationPoints") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: elementType + character (LEN=1,KIND=C_CHAR) :: integrationType(*) + type (C_PTR), intent(out) :: localCoord + integer (C_SIZE_T) :: localCoord_n + type (C_PTR), intent(out) :: weights + integer (C_SIZE_T) :: weights_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetIntegrationPoints + +! Get the Jacobians of all the elements of type `elementType' classified on +! the entity of tag `tag', at the G evaluation points `localCoord' given as +! concatenated triplets of coordinates in the reference element [g1u, g1v, +! g1w, ..., gGu, gGv, gGw]. Data is returned by element, with elements in the +! same order as in `getElements' and `getElementsByType'. `jacobians' +! contains for each element the 9 entries of the 3x3 Jacobian matrix at each +! evaluation point. The matrix is returned by column: [e1g1Jxu, e1g1Jyu, +! e1g1Jzu, e1g1Jxv, ..., e1g1Jzw, e1g2Jxu, ..., e1gGJzw, e2g1Jxu, ...], with +! Jxu=dx/du, Jyu=dy/du, etc. `determinants' contains for each element the +! determinant of the Jacobian matrix at each evaluation point: [e1g1, e1g2, +! ... e1gG, e2g1, ...]. `coord' contains for each element the x, y, z +! coordinates of the evaluation points. If `tag' < 0, get the Jacobian data +! for all entities. If `numTasks' > 1, only compute and return the part of +! the data indexed by `task'. + subroutine gmshModelMeshGetJacobians( + & elementType, + & localCoord, + & localCoord_n, + & jacobians, + & jacobians_n, + & determinants, + & determinants_n, + & coord, + & coord_n, + & tag, + & task, + & numTasks, + & ierr) + & bind(C,name="gmshModelMeshGetJacobians") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: elementType + real (C_DOUBLE) :: localCoord(*) + integer (C_SIZE_T), value :: localCoord_n + type (C_PTR), intent(out) :: jacobians + integer (C_SIZE_T) :: jacobians_n + type (C_PTR), intent(out) :: determinants + integer (C_SIZE_T) :: determinants_n + type (C_PTR), intent(out) :: coord + integer (C_SIZE_T) :: coord_n + integer (C_INT), value :: tag + integer (C_SIZE_T), value :: task + integer (C_SIZE_T), value :: numTasks + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetJacobians + +! Preallocate data before calling `getJacobians' with `numTasks' > 1. For C +! and C++ only. + subroutine gmshModelMeshPreallocateJacobians( + & elementType, + & numEvaluationPoints, + & allocateJacobians, + & allocateDeterminants, + & allocateCoord, + & jacobians, + & jacobians_n, + & determinants, + & determinants_n, + & coord, + & coord_n, + & tag, + & ierr) + & bind(C,name="gmshModelMeshPreallocateJacobians") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: elementType + integer (C_INT), value :: numEvaluationPoints + integer (C_INT), value :: allocateJacobians + integer (C_INT), value :: allocateDeterminants + integer (C_INT), value :: allocateCoord + type (C_PTR), intent(out) :: jacobians + integer (C_SIZE_T) :: jacobians_n + type (C_PTR), intent(out) :: determinants + integer (C_SIZE_T) :: determinants_n + type (C_PTR), intent(out) :: coord + integer (C_SIZE_T) :: coord_n + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end subroutine gmshModelMeshPreallocateJacobians + +! Get the Jacobian for a single element `elementTag', at the G evaluation +! points `localCoord' given as concatenated triplets of coordinates in the +! reference element [g1u, g1v, g1w, ..., gGu, gGv, gGw]. `jacobians' contains +! the 9 entries of the 3x3 Jacobian matrix at each evaluation point. The +! matrix is returned by column: [e1g1Jxu, e1g1Jyu, e1g1Jzu, e1g1Jxv, ..., +! e1g1Jzw, e1g2Jxu, ..., e1gGJzw, e2g1Jxu, ...], with Jxu=dx/du, Jyu=dy/du, +! etc. `determinants' contains the determinant of the Jacobian matrix at each +! evaluation point. `coord' contains the x, y, z coordinates of the +! evaluation points. This function relies on an internal cache (a vector in +! case of dense element numbering, a map otherwise); for large meshes +! accessing Jacobians in bulk is often preferable. + subroutine gmshModelMeshGetJacobian( + & elementTag, + & localCoord, + & localCoord_n, + & jacobians, + & jacobians_n, + & determinants, + & determinants_n, + & coord, + & coord_n, + & ierr) + & bind(C,name="gmshModelMeshGetJacobian") + use, intrinsic :: ISO_C_BINDING + integer (C_SIZE_T), value :: elementTag + real (C_DOUBLE) :: localCoord(*) + integer (C_SIZE_T), value :: localCoord_n + type (C_PTR), intent(out) :: jacobians + integer (C_SIZE_T) :: jacobians_n + type (C_PTR), intent(out) :: determinants + integer (C_SIZE_T) :: determinants_n + type (C_PTR), intent(out) :: coord + integer (C_SIZE_T) :: coord_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetJacobian + +! Get the basis functions of the element of type `elementType' at the +! evaluation points `localCoord' (given as concatenated triplets of +! coordinates in the reference element [g1u, g1v, g1w, ..., gGu, gGv, gGw]), +! for the function space `functionSpaceType' (e.g. "Lagrange" or +! "GradLagrange" for Lagrange basis functions or their gradient, in the u, v, +! w coordinates of the reference element; or "H1Legendre3" or +! "GradH1Legendre3" for 3rd order hierarchical H1 Legendre functions). +! `numComponents' returns the number C of components of a basis function. +! `basisFunctions' returns the value of the N basis functions at the +! evaluation points, i.e. [g1f1, g1f2, ..., g1fN, g2f1, ...] when C == 1 or +! [g1f1u, g1f1v, g1f1w, g1f2u, ..., g1fNw, g2f1u, ...] when C == 3. For basis +! functions that depend on the orientation of the elements, all values for +! the first orientation are returned first, followed by values for the +! second, etc. `numOrientations' returns the overall number of orientations. +! If `wantedOrientations' is not empty, only return the values for the +! desired orientation indices. + subroutine gmshModelMeshGetBasisFunctions( + & elementType, + & localCoord, + & localCoord_n, + & functionSpaceType, + & numComponents, + & basisFunctions, + & basisFunctions_n, + & numOrientations, + & wantedOrientations, + & wantedOrientations_n, + & ierr) + & bind(C,name="gmshModelMeshGetBasisFunctions") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: elementType + real (C_DOUBLE) :: localCoord(*) + integer (C_SIZE_T), value :: localCoord_n + character (LEN=1,KIND=C_CHAR) :: functionSpaceType(*) + integer (C_INT) :: numComponents + type (C_PTR), intent(out) :: basisFunctions + integer (C_SIZE_T) :: basisFunctions_n + integer (C_INT) :: numOrientations + integer (C_INT) :: wantedOrientations(*) + integer (C_SIZE_T), value :: wantedOrientations_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetBasisFunctions + +! Get the orientation index of the elements of type `elementType' in the +! entity of tag `tag'. The arguments have the same meaning as in +! `getBasisFunctions'. `basisFunctionsOrientation' is a vector giving for +! each element the orientation index in the values returned by +! `getBasisFunctions'. For Lagrange basis functions the call is superfluous +! as it will return a vector of zeros. + +! Get the orientation of a single element `elementTag'. + +! Get the number of possible orientations for elements of type `elementType' +! and function space named `functionSpaceType'. + function gmshModelMeshGetNumberOfOrientations( + & elementType, + & functionSpaceType, + & ierr) + & bind(C,name="gmshModelMeshGetNumberOfOrientations") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelMeshGetNumberOfOrientations + integer (C_INT), value :: elementType + character (LEN=1,KIND=C_CHAR) :: functionSpaceType(*) + integer (C_INT) :: ierr + end function gmshModelMeshGetNumberOfOrientations + +! Preallocate data before calling `getBasisFunctionsOrientationForElements' +! with `numTasks' > 1. For C and C++ only. + +! Get the global unique mesh edge identifiers `edgeTags' and orientations +! `edgeOrientation' for an input list of node tag pairs defining these edges, +! concatenated in the vector `nodeTags'. + subroutine gmshModelMeshGetEdges( + & nodeTags, + & nodeTags_n, + & edgeTags, + & edgeTags_n, + & edgeOrientations, + & edgeOrientations_n, + & ierr) + & bind(C,name="gmshModelMeshGetEdges") + use, intrinsic :: ISO_C_BINDING + integer (C_SIZE_T) :: nodeTags(*) + integer (C_SIZE_T), value :: nodeTags_n + type (C_PTR), intent(out) :: edgeTags + integer (C_SIZE_T) :: edgeTags_n + type (C_PTR), intent(out) :: edgeOrientations + integer (C_SIZE_T) :: edgeOrientations_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetEdges + +! Get the global unique mesh face identifiers `faceTags' and orientations +! `faceOrientations' for an input list of node tag triplets (if `faceType' == +! 3) or quadruplets (if `faceType' == 4) defining these faces, concatenated +! in the vector `nodeTags'. + subroutine gmshModelMeshGetFaces( + & faceType, + & nodeTags, + & nodeTags_n, + & faceTags, + & faceTags_n, + & faceOrientations, + & faceOrientations_n, + & ierr) + & bind(C,name="gmshModelMeshGetFaces") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: faceType + integer (C_SIZE_T) :: nodeTags(*) + integer (C_SIZE_T), value :: nodeTags_n + type (C_PTR), intent(out) :: faceTags + integer (C_SIZE_T) :: faceTags_n + type (C_PTR), intent(out) :: faceOrientations + integer (C_SIZE_T) :: faceOrientations_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetFaces + +! Create unique mesh edges for the entities `dimTags'. + subroutine gmshModelMeshCreateEdges( + & dimTags, + & dimTags_n, + & ierr) + & bind(C,name="gmshModelMeshCreateEdges") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshCreateEdges + +! Create unique mesh faces for the entities `dimTags'. + subroutine gmshModelMeshCreateFaces( + & dimTags, + & dimTags_n, + & ierr) + & bind(C,name="gmshModelMeshCreateFaces") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshCreateFaces + +! Generate the pair of keys for the elements of type `elementType' in the +! entity of tag `tag', for the `functionSpaceType' function space. Each pair +! (`typeKey', `entityKey') uniquely identifies a basis function in the +! function space. If `returnCoord' is set, the `coord' vector contains the x, +! y, z coordinates locating basis functions for sorting purposes. Warning: +! this is an experimental feature and will probably change in a future +! release. + subroutine gmshModelMeshGetKeysForElements( + & elementType, + & functionSpaceType, + & typeKeys, + & typeKeys_n, + & entityKeys, + & entityKeys_n, + & coord, + & coord_n, + & tag, + & returnCoord, + & ierr) + & bind(C,name="gmshModelMeshGetKeysForElements") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: elementType + character (LEN=1,KIND=C_CHAR) :: functionSpaceType(*) + type (C_PTR), intent(out) :: typeKeys + integer (C_SIZE_T) :: typeKeys_n + type (C_PTR), intent(out) :: entityKeys + integer (C_SIZE_T) :: entityKeys_n + type (C_PTR), intent(out) :: coord + integer (C_SIZE_T) :: coord_n + integer (C_INT), value :: tag + integer (C_INT), value :: returnCoord + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetKeysForElements + +! Get the pair of keys for a single element `elementTag'. + subroutine gmshModelMeshGetKeysForElement( + & elementTag, + & functionSpaceType, + & typeKeys, + & typeKeys_n, + & entityKeys, + & entityKeys_n, + & coord, + & coord_n, + & returnCoord, + & ierr) + & bind(C,name="gmshModelMeshGetKeysForElement") + use, intrinsic :: ISO_C_BINDING + integer (C_SIZE_T), value :: elementTag + character (LEN=1,KIND=C_CHAR) :: functionSpaceType(*) + type (C_PTR), intent(out) :: typeKeys + integer (C_SIZE_T) :: typeKeys_n + type (C_PTR), intent(out) :: entityKeys + integer (C_SIZE_T) :: entityKeys_n + type (C_PTR), intent(out) :: coord + integer (C_SIZE_T) :: coord_n + integer (C_INT), value :: returnCoord + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetKeysForElement + +! Get the number of keys by elements of type `elementType' for function space +! named `functionSpaceType'. + function gmshModelMeshGetNumberOfKeysForElements( + & elementType, + & functionSpaceType, + & ierr) + & bind(C,name="gmshModelMeshGetNumberOfKeysForElements") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelMeshGetNumberOfKeysForElements + integer (C_INT), value :: elementType + character (LEN=1,KIND=C_CHAR) :: functionSpaceType(*) + integer (C_INT) :: ierr + end function gmshModelMeshGetNumberOfKeysForElements + +! Get information about the pair of `keys'. `infoKeys' returns information +! about the functions associated with the pairs (`typeKeys', `entityKey'). +! `infoKeys[0].first' describes the type of function (0 for vertex function, +! 1 for edge function, 2 for face function and 3 for bubble function). +! `infoKeys[0].second' gives the order of the function associated with the +! key. Warning: this is an experimental feature and will probably change in a +! future release. + subroutine gmshModelMeshGetInformationForElements( + & typeKeys, + & typeKeys_n, + & entityKeys, + & entityKeys_n, + & elementType, + & functionSpaceType, + & infoKeys, + & infoKeys_n, + & ierr) + & bind(C,name="gmshModelMeshGetInformationForElements") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: typeKeys(*) + integer (C_SIZE_T), value :: typeKeys_n + integer (C_SIZE_T) :: entityKeys(*) + integer (C_SIZE_T), value :: entityKeys_n + integer (C_INT), value :: elementType + character (LEN=1,KIND=C_CHAR) :: functionSpaceType(*) + type (C_PTR), intent(out) :: infoKeys + integer (C_SIZE_T) :: infoKeys_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetInformationForElements + +! Get the barycenters of all elements of type `elementType' classified on the +! entity of tag `tag'. If `primary' is set, only the primary nodes of the +! elements are taken into account for the barycenter calculation. If `fast' +! is set, the function returns the sum of the primary node coordinates +! (without normalizing by the number of nodes). If `tag' < 0, get the +! barycenters for all entities. If `numTasks' > 1, only compute and return +! the part of the data indexed by `task'. + subroutine gmshModelMeshGetBarycenters( + & elementType, + & tag, + & fast, + & primary, + & barycenters, + & barycenters_n, + & task, + & numTasks, + & ierr) + & bind(C,name="gmshModelMeshGetBarycenters") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: elementType + integer (C_INT), value :: tag + integer (C_INT), value :: fast + integer (C_INT), value :: primary + type (C_PTR), intent(out) :: barycenters + integer (C_SIZE_T) :: barycenters_n + integer (C_SIZE_T), value :: task + integer (C_SIZE_T), value :: numTasks + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetBarycenters + +! Preallocate data before calling `getBarycenters' with `numTasks' > 1. For C +! and C++ only. + subroutine gmshModelMeshPreallocateBarycenters( + & elementType, + & barycenters, + & barycenters_n, + & tag, + & ierr) + & bind(C,name="gmshModelMeshPreallocateBarycenters") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: elementType + type (C_PTR), intent(out) :: barycenters + integer (C_SIZE_T) :: barycenters_n + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end subroutine gmshModelMeshPreallocateBarycenters + +! Get the nodes on the edges of all elements of type `elementType' classified +! on the entity of tag `tag'. `nodeTags' contains the node tags of the edges +! for all the elements: [e1a1n1, e1a1n2, e1a2n1, ...]. Data is returned by +! element, with elements in the same order as in `getElements' and +! `getElementsByType'. If `primary' is set, only the primary (begin/end) +! nodes of the edges are returned. If `tag' < 0, get the edge nodes for all +! entities. If `numTasks' > 1, only compute and return the part of the data +! indexed by `task'. + subroutine gmshModelMeshGetElementEdgeNodes( + & elementType, + & nodeTags, + & nodeTags_n, + & tag, + & primary, + & task, + & numTasks, + & ierr) + & bind(C,name="gmshModelMeshGetElementEdgeNodes") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: elementType + type (C_PTR), intent(out) :: nodeTags + integer (C_SIZE_T) :: nodeTags_n + integer (C_INT), value :: tag + integer (C_INT), value :: primary + integer (C_SIZE_T), value :: task + integer (C_SIZE_T), value :: numTasks + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetElementEdgeNodes + +! Get the nodes on the faces of type `faceType' (3 for triangular faces, 4 +! for quadrangular faces) of all elements of type `elementType' classified on +! the entity of tag `tag'. `nodeTags' contains the node tags of the faces for +! all elements: [e1f1n1, ..., e1f1nFaceType, e1f2n1, ...]. Data is returned +! by element, with elements in the same order as in `getElements' and +! `getElementsByType'. If `primary' is set, only the primary (corner) nodes +! of the faces are returned. If `tag' < 0, get the face nodes for all +! entities. If `numTasks' > 1, only compute and return the part of the data +! indexed by `task'. + subroutine gmshModelMeshGetElementFaceNodes( + & elementType, + & faceType, + & nodeTags, + & nodeTags_n, + & tag, + & primary, + & task, + & numTasks, + & ierr) + & bind(C,name="gmshModelMeshGetElementFaceNodes") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: elementType + integer (C_INT), value :: faceType + type (C_PTR), intent(out) :: nodeTags + integer (C_SIZE_T) :: nodeTags_n + integer (C_INT), value :: tag + integer (C_INT), value :: primary + integer (C_SIZE_T), value :: task + integer (C_SIZE_T), value :: numTasks + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetElementFaceNodes + +! Get the ghost elements `elementTags' and their associated `partitions' +! stored in the ghost entity of dimension `dim' and tag `tag'. + subroutine gmshModelMeshGetGhostElements( + & dim, + & tag, + & elementTags, + & elementTags_n, + & partitions, + & partitions_n, + & ierr) + & bind(C,name="gmshModelMeshGetGhostElements") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + type (C_PTR), intent(out) :: elementTags + integer (C_SIZE_T) :: elementTags_n + type (C_PTR), intent(out) :: partitions + integer (C_SIZE_T) :: partitions_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetGhostElements + +! Set a mesh size constraint on the model entities `dimTags'. Currently only +! entities of dimension 0 (points) are handled. + subroutine gmshModelMeshSetSize( + & dimTags, + & dimTags_n, + & size, + & ierr) + & bind(C,name="gmshModelMeshSetSize") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + real (C_DOUBLE), value :: size + integer (C_INT) :: ierr + end subroutine gmshModelMeshSetSize + +! Get the mesh size constraints (if any) associated with the model entities +! `dimTags'. A zero entry in the output `sizes' vector indicates that no size +! constraint is specified on the corresponding entity. + subroutine gmshModelMeshGetSizes( + & dimTags, + & dimTags_n, + & sizes, + & sizes_n, + & ierr) + & bind(C,name="gmshModelMeshGetSizes") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + type (C_PTR), intent(out) :: sizes + integer (C_SIZE_T) :: sizes_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetSizes + +! Set mesh size constraints at the given parametric points `parametricCoord' +! on the model entity of dimension `dim' and tag `tag'. Currently only +! entities of dimension 1 (lines) are handled. + subroutine gmshModelMeshSetSizeAtParametricPoints( + & dim, + & tag, + & parametricCoord, + & parametricCoord_n, + & sizes, + & sizes_n, + & ierr) + & bind(C,name="gmshModelMeshSetSizeAtParametricPoints") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + real (C_DOUBLE) :: parametricCoord(*) + integer (C_SIZE_T), value :: parametricCoord_n + real (C_DOUBLE) :: sizes(*) + integer (C_SIZE_T), value :: sizes_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshSetSizeAtParametricPoints + +! Set a mesh size callback for the current model. The callback should take 5 +! arguments (`dim', `tag', `x', `y' and `z') and return the value of the mesh +! size at coordinates (`x', `y', `z'). + subroutine gmshModelMeshSetSizeCallback( + & callback, + & ierr) + & bind(C,name="gmshModelMeshSetSizeCallback") + use, intrinsic :: ISO_C_BINDING + type (C_FUNPTR) :: callback ! to do + integer (C_INT) :: ierr + end subroutine gmshModelMeshSetSizeCallback + +! Remove the mesh size callback from the current model. + subroutine gmshModelMeshRemoveSizeCallback( + & ierr) + & bind(C,name="gmshModelMeshRemoveSizeCallback") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: ierr + end subroutine gmshModelMeshRemoveSizeCallback + +! Set a transfinite meshing constraint on the curve `tag', with `numNodes' +! nodes distributed according to `meshType' and `coef'. Currently supported +! types are "Progression" (geometrical progression with power `coef'), "Bump" +! (refinement toward both extremities of the curve) and "Beta" (beta law). + subroutine gmshModelMeshSetTransfiniteCurve( + & tag, + & numNodes, + & meshType, + & coef, + & ierr) + & bind(C,name="gmshModelMeshSetTransfiniteCurve") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + integer (C_INT), value :: numNodes + character (LEN=1,KIND=C_CHAR) :: meshType(*) + real (C_DOUBLE), value :: coef + integer (C_INT) :: ierr + end subroutine gmshModelMeshSetTransfiniteCurve + +! Set a transfinite meshing constraint on the surface `tag'. `arrangement' +! describes the arrangement of the triangles when the surface is not flagged +! as recombined: currently supported values are "Left", "Right", +! "AlternateLeft" and "AlternateRight". `cornerTags' can be used to specify +! the (3 or 4) corners of the transfinite interpolation explicitly; +! specifying the corners explicitly is mandatory if the surface has more that +! 3 or 4 points on its boundary. + subroutine gmshModelMeshSetTransfiniteSurface( + & tag, + & arrangement, + & cornerTags, + & cornerTags_n, + & ierr) + & bind(C,name="gmshModelMeshSetTransfiniteSurface") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + character (LEN=1,KIND=C_CHAR) :: arrangement(*) + integer (C_INT) :: cornerTags(*) + integer (C_SIZE_T), value :: cornerTags_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshSetTransfiniteSurface + +! Set a transfinite meshing constraint on the surface `tag'. `cornerTags' can +! be used to specify the (6 or 8) corners of the transfinite interpolation +! explicitly. + subroutine gmshModelMeshSetTransfiniteVolume( + & tag, + & cornerTags, + & cornerTags_n, + & ierr) + & bind(C,name="gmshModelMeshSetTransfiniteVolume") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + integer (C_INT) :: cornerTags(*) + integer (C_SIZE_T), value :: cornerTags_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshSetTransfiniteVolume + +! Set transfinite meshing constraints on the model entities in `dimTag'. +! Transfinite meshing constraints are added to the curves of the quadrangular +! surfaces and to the faces of 6-sided volumes. Quadragular faces with a +! corner angle superior to `cornerAngle' (in radians) are ignored. The number +! of points is automatically determined from the sizing constraints. If +! `dimTag' is empty, the constraints are applied to all entities in the +! model. If `recombine' is true, the recombine flag is automatically set on +! the transfinite surfaces. + subroutine gmshModelMeshSetTransfiniteAutomatic( + & dimTags, + & dimTags_n, + & cornerAngle, + & recombine, + & ierr) + & bind(C,name="gmshModelMeshSetTransfiniteAutomatic") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + real (C_DOUBLE), value :: cornerAngle + integer (C_INT), value :: recombine + integer (C_INT) :: ierr + end subroutine gmshModelMeshSetTransfiniteAutomatic + +! Set a recombination meshing constraint on the model entity of dimension +! `dim' and tag `tag'. Currently only entities of dimension 2 (to recombine +! triangles into quadrangles) are supported. + subroutine gmshModelMeshSetRecombine( + & dim, + & tag, + & ierr) + & bind(C,name="gmshModelMeshSetRecombine") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end subroutine gmshModelMeshSetRecombine + +! Set a smoothing meshing constraint on the model entity of dimension `dim' +! and tag `tag'. `val' iterations of a Laplace smoother are applied. + subroutine gmshModelMeshSetSmoothing( + & dim, + & tag, + & val, + & ierr) + & bind(C,name="gmshModelMeshSetSmoothing") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + integer (C_INT), value :: val + integer (C_INT) :: ierr + end subroutine gmshModelMeshSetSmoothing + +! Set a reverse meshing constraint on the model entity of dimension `dim' and +! tag `tag'. If `val' is true, the mesh orientation will be reversed with +! respect to the natural mesh orientation (i.e. the orientation consistent +! with the orientation of the geometry). If `val' is false, the mesh is left +! as-is. + subroutine gmshModelMeshSetReverse( + & dim, + & tag, + & val, + & ierr) + & bind(C,name="gmshModelMeshSetReverse") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + integer (C_INT), value :: val + integer (C_INT) :: ierr + end subroutine gmshModelMeshSetReverse + +! Set the meshing algorithm on the model entity of dimension `dim' and tag +! `tag'. Currently only supported for `dim' == 2. + subroutine gmshModelMeshSetAlgorithm( + & dim, + & tag, + & val, + & ierr) + & bind(C,name="gmshModelMeshSetAlgorithm") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + integer (C_INT), value :: val + integer (C_INT) :: ierr + end subroutine gmshModelMeshSetAlgorithm + +! Force the mesh size to be extended from the boundary, or not, for the model +! entity of dimension `dim' and tag `tag'. Currently only supported for `dim' +! == 2. + subroutine gmshModelMeshSetSizeFromBoundary( + & dim, + & tag, + & val, + & ierr) + & bind(C,name="gmshModelMeshSetSizeFromBoundary") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + integer (C_INT), value :: val + integer (C_INT) :: ierr + end subroutine gmshModelMeshSetSizeFromBoundary + +! Set a compound meshing constraint on the model entities of dimension `dim' +! and tags `tags'. During meshing, compound entities are treated as a single +! discrete entity, which is automatically reparametrized. + subroutine gmshModelMeshSetCompound( + & dim, + & tags, + & tags_n, + & ierr) + & bind(C,name="gmshModelMeshSetCompound") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT) :: tags(*) + integer (C_SIZE_T), value :: tags_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshSetCompound + +! Set meshing constraints on the bounding surfaces of the volume of tag `tag' +! so that all surfaces are oriented with outward pointing normals; and if a +! mesh already exists, reorient it. Currently only available with the +! OpenCASCADE kernel, as it relies on the STL triangulation. + subroutine gmshModelMeshSetOutwardOrientation( + & tag, + & ierr) + & bind(C,name="gmshModelMeshSetOutwardOrientation") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end subroutine gmshModelMeshSetOutwardOrientation + +! Remove all meshing constraints from the model entities `dimTags'. If +! `dimTags' is empty, remove all constraings. + subroutine gmshModelMeshRemoveConstraints( + & dimTags, + & dimTags_n, + & ierr) + & bind(C,name="gmshModelMeshRemoveConstraints") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshRemoveConstraints + +! Embed the model entities of dimension `dim' and tags `tags' in the +! (`inDim', `inTag') model entity. The dimension `dim' can 0, 1 or 2 and must +! be strictly smaller than `inDim', which must be either 2 or 3. The embedded +! entities should not intersect each other or be part of the boundary of the +! entity `inTag', whose mesh will conform to the mesh of the embedded +! entities. With the OpenCASCADE kernel, if the `fragment' operation is +! applied to entities of different dimensions, the lower dimensional entities +! will be automatically embedded in the higher dimensional entities if they +! are not on their boundary. + subroutine gmshModelMeshEmbed( + & dim, + & tags, + & tags_n, + & inDim, + & inTag, + & ierr) + & bind(C,name="gmshModelMeshEmbed") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT) :: tags(*) + integer (C_SIZE_T), value :: tags_n + integer (C_INT), value :: inDim + integer (C_INT), value :: inTag + integer (C_INT) :: ierr + end subroutine gmshModelMeshEmbed + +! Remove embedded entities from the model entities `dimTags'. if `dim' is >= +! 0, only remove embedded entities of the given dimension (e.g. embedded +! points if `dim' == 0). + subroutine gmshModelMeshRemoveEmbedded( + & dimTags, + & dimTags_n, + & dim, + & ierr) + & bind(C,name="gmshModelMeshRemoveEmbedded") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + integer (C_INT), value :: dim + integer (C_INT) :: ierr + end subroutine gmshModelMeshRemoveEmbedded + +! Get the entities (if any) embedded in the model entity of dimension `dim' +! and tag `tag'. + subroutine gmshModelMeshGetEmbedded( + & dim, + & tag, + & dimTags, + & dimTags_n, + & ierr) + & bind(C,name="gmshModelMeshGetEmbedded") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + type (C_PTR), intent(out) :: dimTags + integer (C_SIZE_T) :: dimTags_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetEmbedded + +! Reorder the elements of type `elementType' classified on the entity of tag +! `tag' according to `ordering'. + subroutine gmshModelMeshReorderElements( + & elementType, + & tag, + & ordering, + & ordering_n, + & ierr) + & bind(C,name="gmshModelMeshReorderElements") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: elementType + integer (C_INT), value :: tag + integer (C_SIZE_T) :: ordering(*) + integer (C_SIZE_T), value :: ordering_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshReorderElements + +! Renumber the node tags in a continuous sequence. + subroutine gmshModelMeshRenumberNodes( + & ierr) + & bind(C,name="gmshModelMeshRenumberNodes") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: ierr + end subroutine gmshModelMeshRenumberNodes + +! Renumber the element tags in a continuous sequence. + subroutine gmshModelMeshRenumberElements( + & ierr) + & bind(C,name="gmshModelMeshRenumberElements") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: ierr + end subroutine gmshModelMeshRenumberElements + +! Set the meshes of the entities of dimension `dim' and tag `tags' as +! periodic copies of the meshes of entities `tagsMaster', using the affine +! transformation specified in `affineTransformation' (16 entries of a 4x4 +! matrix, by row). If used after meshing, generate the periodic node +! correspondence information assuming the meshes of entities `tags' +! effectively match the meshes of entities `tagsMaster' (useful for +! structured and extruded meshes). Currently only available for @code{dim} == +! 1 and @code{dim} == 2. + subroutine gmshModelMeshSetPeriodic( + & dim, + & tags, + & tags_n, + & tagsMaster, + & tagsMaster_n, + & affineTransform, + & affineTransform_n, + & ierr) + & bind(C,name="gmshModelMeshSetPeriodic") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT) :: tags(*) + integer (C_SIZE_T), value :: tags_n + integer (C_INT) :: tagsMaster(*) + integer (C_SIZE_T), value :: tagsMaster_n + real (C_DOUBLE) :: affineTransform(*) + integer (C_SIZE_T), value :: affineTransform_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshSetPeriodic + +! Get the master entity `tagMaster', the node tags `nodeTags' and their +! corresponding master node tags `nodeTagsMaster', and the affine transform +! `affineTransform' for the entity of dimension `dim' and tag `tag'. If +! `includeHighOrderNodes' is set, include high-order nodes in the returned +! data. + subroutine gmshModelMeshGetPeriodicNodes( + & dim, + & tag, + & tagMaster, + & nodeTags, + & nodeTags_n, + & nodeTagsMaster, + & nodeTagsMaster_n, + & affineTransform, + & affineTransform_n, + & includeHighOrderNodes, + & ierr) + & bind(C,name="gmshModelMeshGetPeriodicNodes") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + integer (C_INT) :: tagMaster + type (C_PTR), intent(out) :: nodeTags + integer (C_SIZE_T) :: nodeTags_n + type (C_PTR), intent(out) :: nodeTagsMaster + integer (C_SIZE_T) :: nodeTagsMaster_n + type (C_PTR), intent(out) :: affineTransform + integer (C_SIZE_T) :: affineTransform_n + integer (C_INT), value :: includeHighOrderNodes + integer (C_INT) :: ierr + end subroutine gmshModelMeshGetPeriodicNodes + +! Remove duplicate nodes in the mesh of the current model. + subroutine gmshModelMeshRemoveDuplicateNodes( + & ierr) + & bind(C,name="gmshModelMeshRemoveDuplicateNodes") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: ierr + end subroutine gmshModelMeshRemoveDuplicateNodes + +! Split (into two triangles) all quadrangles in surface `tag' whose quality +! is lower than `quality'. If `tag' < 0, split quadrangles in all surfaces. + subroutine gmshModelMeshSplitQuadrangles( + & quality, + & tag, + & ierr) + & bind(C,name="gmshModelMeshSplitQuadrangles") + use, intrinsic :: ISO_C_BINDING + real (C_DOUBLE), value :: quality + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end subroutine gmshModelMeshSplitQuadrangles + +! Classify ("color") the surface mesh based on the angle threshold `angle' +! (in radians), and create new discrete surfaces, curves and points +! accordingly. If `boundary' is set, also create discrete curves on the +! boundary if the surface is open. If `forReparametrization' is set, create +! edges and surfaces that can be reparametrized using a single map. If +! `curveAngle' is less than Pi, also force curves to be split according to +! `curveAngle'. If `exportDiscrete' is set, clear any built-in CAD kernel +! entities and export the discrete entities in the built-in CAD kernel. + subroutine gmshModelMeshClassifySurfaces( + & angle, + & boundary, + & forReparametrization, + & curveAngle, + & exportDiscrete, + & ierr) + & bind(C,name="gmshModelMeshClassifySurfaces") + use, intrinsic :: ISO_C_BINDING + real (C_DOUBLE), value :: angle + integer (C_INT), value :: boundary + integer (C_INT), value :: forReparametrization + real (C_DOUBLE), value :: curveAngle + integer (C_INT), value :: exportDiscrete + integer (C_INT) :: ierr + end subroutine gmshModelMeshClassifySurfaces + +! Create a geometry for the discrete entities `dimTags' (represented solely +! by a mesh, without an underlying CAD description), i.e. create a +! parametrization for discrete curves and surfaces, assuming that each can be +! parametrized with a single map. If `dimTags' is empty, create a geometry +! for all the discrete entities. + subroutine gmshModelMeshCreateGeometry( + & dimTags, + & dimTags_n, + & ierr) + & bind(C,name="gmshModelMeshCreateGeometry") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshCreateGeometry + +! Create a boundary representation from the mesh if the model does not have +! one (e.g. when imported from mesh file formats with no BRep representation +! of the underlying model). If `makeSimplyConnected' is set, enforce simply +! connected discrete surfaces and volumes. If `exportDiscrete' is set, clear +! any built-in CAD kernel entities and export the discrete entities in the +! built-in CAD kernel. + subroutine gmshModelMeshCreateTopology( + & makeSimplyConnected, + & exportDiscrete, + & ierr) + & bind(C,name="gmshModelMeshCreateTopology") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: makeSimplyConnected + integer (C_INT), value :: exportDiscrete + integer (C_INT) :: ierr + end subroutine gmshModelMeshCreateTopology + +! Compute a basis representation for homology spaces after a mesh has been +! generated. The computation domain is given in a list of physical group tags +! `domainTags'; if empty, the whole mesh is the domain. The computation +! subdomain for relative homology computation is given in a list of physical +! group tags `subdomainTags'; if empty, absolute homology is computed. The +! dimensions homology bases to be computed are given in the list `dim'; if +! empty, all bases are computed. Resulting basis representation chains are +! stored as physical groups in the mesh. + subroutine gmshModelMeshComputeHomology( + & domainTags, + & domainTags_n, + & subdomainTags, + & subdomainTags_n, + & dims, + & dims_n, + & ierr) + & bind(C,name="gmshModelMeshComputeHomology") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: domainTags(*) + integer (C_SIZE_T), value :: domainTags_n + integer (C_INT) :: subdomainTags(*) + integer (C_SIZE_T), value :: subdomainTags_n + integer (C_INT) :: dims(*) + integer (C_SIZE_T), value :: dims_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshComputeHomology + +! Compute a basis representation for cohomology spaces after a mesh has been +! generated. The computation domain is given in a list of physical group tags +! `domainTags'; if empty, the whole mesh is the domain. The computation +! subdomain for relative cohomology computation is given in a list of +! physical group tags `subdomainTags'; if empty, absolute cohomology is +! computed. The dimensions homology bases to be computed are given in the +! list `dim'; if empty, all bases are computed. Resulting basis +! representation cochains are stored as physical groups in the mesh. + subroutine gmshModelMeshComputeCohomology( + & domainTags, + & domainTags_n, + & subdomainTags, + & subdomainTags_n, + & dims, + & dims_n, + & ierr) + & bind(C,name="gmshModelMeshComputeCohomology") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: domainTags(*) + integer (C_SIZE_T), value :: domainTags_n + integer (C_INT) :: subdomainTags(*) + integer (C_SIZE_T), value :: subdomainTags_n + integer (C_INT) :: dims(*) + integer (C_SIZE_T), value :: dims_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshComputeCohomology + +! Compute a cross field for the current mesh. The function creates 3 views: +! the H function, the Theta function and cross directions. Return the tags of +! the views. + subroutine gmshModelMeshComputeCrossField( + & viewTags, + & viewTags_n, + & ierr) + & bind(C,name="gmshModelMeshComputeCrossField") + use, intrinsic :: ISO_C_BINDING + type (C_PTR), intent(out) :: viewTags + integer (C_SIZE_T) :: viewTags_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshComputeCrossField + +! Triangulate the points given in the `coord' vector as pairs of u, v +! coordinates, and return the node tags (with numbering starting at 1) of the +! resulting triangles in `tri'. + subroutine gmshModelMeshTriangulate( + & coord, + & coord_n, + & tri, + & tri_n, + & ierr) + & bind(C,name="gmshModelMeshTriangulate") + use, intrinsic :: ISO_C_BINDING + real (C_DOUBLE) :: coord(*) + integer (C_SIZE_T), value :: coord_n + type (C_PTR), intent(out) :: tri + integer (C_SIZE_T) :: tri_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshTriangulate + +! Tetrahedralize the points given in the `coord' vector as triplets of x, y, +! z coordinates, and return the node tags (with numbering starting at 1) of +! the resulting tetrahedra in `tetra'. + subroutine gmshModelMeshTetrahedralize( + & coord, + & coord_n, + & tetra, + & tetra_n, + & ierr) + & bind(C,name="gmshModelMeshTetrahedralize") + use, intrinsic :: ISO_C_BINDING + real (C_DOUBLE) :: coord(*) + integer (C_SIZE_T), value :: coord_n + type (C_PTR), intent(out) :: tetra + integer (C_SIZE_T) :: tetra_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshTetrahedralize + +! Add a new mesh size field of type `fieldType'. If `tag' is positive, assign +! the tag explicitly; otherwise a new tag is assigned automatically. Return +! the field tag. + function gmshModelMeshFieldAdd( + & fieldType, + & tag, + & ierr) + & bind(C,name="gmshModelMeshFieldAdd") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelMeshFieldAdd + character (LEN=1,KIND=C_CHAR) :: fieldType(*) + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelMeshFieldAdd + +! Remove the field with tag `tag'. + subroutine gmshModelMeshFieldRemove( + & tag, + & ierr) + & bind(C,name="gmshModelMeshFieldRemove") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end subroutine gmshModelMeshFieldRemove + +! Set the numerical option `option' to value `value' for field `tag'. + subroutine gmshModelMeshFieldSetNumber( + & tag, + & option, + & value, + & ierr) + & bind(C,name="gmshModelMeshFieldSetNumber") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + character (LEN=1,KIND=C_CHAR) :: option(*) + real (C_DOUBLE), value :: value + integer (C_INT) :: ierr + end subroutine gmshModelMeshFieldSetNumber + +! Set the string option `option' to value `value' for field `tag'. + subroutine gmshModelMeshFieldSetString( + & tag, + & option, + & value, + & ierr) + & bind(C,name="gmshModelMeshFieldSetString") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + character (LEN=1,KIND=C_CHAR) :: option(*) + character (LEN=1,KIND=C_CHAR) :: value(*) + integer (C_INT) :: ierr + end subroutine gmshModelMeshFieldSetString + +! Set the numerical list option `option' to value `value' for field `tag'. + subroutine gmshModelMeshFieldSetNumbers( + & tag, + & option, + & value, + & value_n, + & ierr) + & bind(C,name="gmshModelMeshFieldSetNumbers") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + character (LEN=1,KIND=C_CHAR) :: option(*) + real (C_DOUBLE) :: value(*) + integer (C_SIZE_T), value :: value_n + integer (C_INT) :: ierr + end subroutine gmshModelMeshFieldSetNumbers + +! Set the field `tag' as the background mesh size field. + subroutine gmshModelMeshFieldSetAsBackgroundMesh( + & tag, + & ierr) + & bind(C,name="gmshModelMeshFieldSetAsBackgroundMesh") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end subroutine gmshModelMeshFieldSetAsBackgroundMesh + +! Set the field `tag' as a boundary layer size field. + subroutine gmshModelMeshFieldSetAsBoundaryLayer( + & tag, + & ierr) + & bind(C,name="gmshModelMeshFieldSetAsBoundaryLayer") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end subroutine gmshModelMeshFieldSetAsBoundaryLayer + +! Add a geometrical point in the built-in CAD representation, at coordinates +! (`x', `y', `z'). If `meshSize' is > 0, add a meshing constraint at that +! point. If `tag' is positive, set the tag explicitly; otherwise a new tag is +! selected automatically. Return the tag of the point. (Note that the point +! will be added in the current model only after `synchronize' is called. This +! behavior holds for all the entities added in the geo module.) + function gmshModelGeoAddPoint( + & x, + & y, + & z, + & meshSize, + & tag, + & ierr) + & bind(C,name="gmshModelGeoAddPoint") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelGeoAddPoint + real (C_DOUBLE), value :: x + real (C_DOUBLE), value :: y + real (C_DOUBLE), value :: z + real (C_DOUBLE), value :: meshSize + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelGeoAddPoint + +! Add a straight line segment in the built-in CAD representation, between the +! two points with tags `startTag' and `endTag'. If `tag' is positive, set the +! tag explicitly; otherwise a new tag is selected automatically. Return the +! tag of the line. + function gmshModelGeoAddLine( + & startTag, + & endTag, + & tag, + & ierr) + & bind(C,name="gmshModelGeoAddLine") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelGeoAddLine + integer (C_INT), value :: startTag + integer (C_INT), value :: endTag + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelGeoAddLine + +! Add a circle arc (strictly smaller than Pi) in the built-in CAD +! representation, between the two points with tags `startTag' and `endTag', +! and with center `centerTag'. If `tag' is positive, set the tag explicitly; +! otherwise a new tag is selected automatically. If (`nx', `ny', `nz') != (0, +! 0, 0), explicitly set the plane of the circle arc. Return the tag of the +! circle arc. + function gmshModelGeoAddCircleArc( + & startTag, + & centerTag, + & endTag, + & tag, + & nx, + & ny, + & nz, + & ierr) + & bind(C,name="gmshModelGeoAddCircleArc") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelGeoAddCircleArc + integer (C_INT), value :: startTag + integer (C_INT), value :: centerTag + integer (C_INT), value :: endTag + integer (C_INT), value :: tag + real (C_DOUBLE), value :: nx + real (C_DOUBLE), value :: ny + real (C_DOUBLE), value :: nz + integer (C_INT) :: ierr + end function gmshModelGeoAddCircleArc + +! Add an ellipse arc (strictly smaller than Pi) in the built-in CAD +! representation, between the two points `startTag' and `endTag', and with +! center `centerTag' and major axis point `majorTag'. If `tag' is positive, +! set the tag explicitly; otherwise a new tag is selected automatically. If +! (`nx', `ny', `nz') != (0, 0, 0), explicitly set the plane of the circle +! arc. Return the tag of the ellipse arc. + function gmshModelGeoAddEllipseArc( + & startTag, + & centerTag, + & majorTag, + & endTag, + & tag, + & nx, + & ny, + & nz, + & ierr) + & bind(C,name="gmshModelGeoAddEllipseArc") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelGeoAddEllipseArc + integer (C_INT), value :: startTag + integer (C_INT), value :: centerTag + integer (C_INT), value :: majorTag + integer (C_INT), value :: endTag + integer (C_INT), value :: tag + real (C_DOUBLE), value :: nx + real (C_DOUBLE), value :: ny + real (C_DOUBLE), value :: nz + integer (C_INT) :: ierr + end function gmshModelGeoAddEllipseArc + +! Add a spline (Catmull-Rom) curve in the built-in CAD representation, going +! through the points `pointTags'. If `tag' is positive, set the tag +! explicitly; otherwise a new tag is selected automatically. Create a +! periodic curve if the first and last points are the same. Return the tag of +! the spline curve. + function gmshModelGeoAddSpline( + & pointTags, + & pointTags_n, + & tag, + & ierr) + & bind(C,name="gmshModelGeoAddSpline") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelGeoAddSpline + integer (C_INT) :: pointTags(*) + integer (C_SIZE_T), value :: pointTags_n + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelGeoAddSpline + +! Add a cubic b-spline curve in the built-in CAD representation, with +! `pointTags' control points. If `tag' is positive, set the tag explicitly; +! otherwise a new tag is selected automatically. Creates a periodic curve if +! the first and last points are the same. Return the tag of the b-spline +! curve. + function gmshModelGeoAddBSpline( + & pointTags, + & pointTags_n, + & tag, + & ierr) + & bind(C,name="gmshModelGeoAddBSpline") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelGeoAddBSpline + integer (C_INT) :: pointTags(*) + integer (C_SIZE_T), value :: pointTags_n + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelGeoAddBSpline + +! Add a Bezier curve in the built-in CAD representation, with `pointTags' +! control points. If `tag' is positive, set the tag explicitly; otherwise a +! new tag is selected automatically. Return the tag of the Bezier curve. + function gmshModelGeoAddBezier( + & pointTags, + & pointTags_n, + & tag, + & ierr) + & bind(C,name="gmshModelGeoAddBezier") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelGeoAddBezier + integer (C_INT) :: pointTags(*) + integer (C_SIZE_T), value :: pointTags_n + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelGeoAddBezier + +! Add a polyline curve in the built-in CAD representation, going through the +! points `pointTags'. If `tag' is positive, set the tag explicitly; otherwise +! a new tag is selected automatically. Create a periodic curve if the first +! and last points are the same. Return the tag of the polyline curve. + function gmshModelGeoAddPolyline( + & pointTags, + & pointTags_n, + & tag, + & ierr) + & bind(C,name="gmshModelGeoAddPolyline") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelGeoAddPolyline + integer (C_INT) :: pointTags(*) + integer (C_SIZE_T), value :: pointTags_n + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelGeoAddPolyline + +! Add a spline (Catmull-Rom) curve in the built-in CAD representation, going +! through points sampling the curves in `curveTags'. The density of sampling +! points on each curve is governed by `numIntervals'. If `tag' is positive, +! set the tag explicitly; otherwise a new tag is selected automatically. +! Return the tag of the spline. + function gmshModelGeoAddCompoundSpline( + & curveTags, + & curveTags_n, + & numIntervals, + & tag, + & ierr) + & bind(C,name="gmshModelGeoAddCompoundSpline") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelGeoAddCompoundSpline + integer (C_INT) :: curveTags(*) + integer (C_SIZE_T), value :: curveTags_n + integer (C_INT), value :: numIntervals + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelGeoAddCompoundSpline + +! Add a b-spline curve in the built-in CAD representation, with control +! points sampling the curves in `curveTags'. The density of sampling points +! on each curve is governed by `numIntervals'. If `tag' is positive, set the +! tag explicitly; otherwise a new tag is selected automatically. Return the +! tag of the b-spline. + function gmshModelGeoAddCompoundBSpline( + & curveTags, + & curveTags_n, + & numIntervals, + & tag, + & ierr) + & bind(C,name="gmshModelGeoAddCompoundBSpline") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelGeoAddCompoundBSpline + integer (C_INT) :: curveTags(*) + integer (C_SIZE_T), value :: curveTags_n + integer (C_INT), value :: numIntervals + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelGeoAddCompoundBSpline + +! Add a curve loop (a closed wire) in the built-in CAD representation, formed +! by the curves `curveTags'. `curveTags' should contain (signed) tags of +! model entities of dimension 1 forming a closed loop: a negative tag +! signifies that the underlying curve is considered with reversed +! orientation. If `tag' is positive, set the tag explicitly; otherwise a new +! tag is selected automatically. If `reorient' is set, automatically reorient +! the curves if necessary. Return the tag of the curve loop. + function gmshModelGeoAddCurveLoop( + & curveTags, + & curveTags_n, + & tag, + & reorient, + & ierr) + & bind(C,name="gmshModelGeoAddCurveLoop") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelGeoAddCurveLoop + integer (C_INT) :: curveTags(*) + integer (C_SIZE_T), value :: curveTags_n + integer (C_INT), value :: tag + integer (C_INT), value :: reorient + integer (C_INT) :: ierr + end function gmshModelGeoAddCurveLoop + +! Add curve loops in the built-in CAD representation based on the curves +! `curveTags'. Return the `tags' of found curve loops, if any. + subroutine gmshModelGeoAddCurveLoops( + & curveTags, + & curveTags_n, + & tags, + & tags_n, + & ierr) + & bind(C,name="gmshModelGeoAddCurveLoops") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: curveTags(*) + integer (C_SIZE_T), value :: curveTags_n + type (C_PTR), intent(out) :: tags + integer (C_SIZE_T) :: tags_n + integer (C_INT) :: ierr + end subroutine gmshModelGeoAddCurveLoops + +! Add a plane surface in the built-in CAD representation, defined by one or +! more curve loops `wireTags'. The first curve loop defines the exterior +! contour; additional curve loop define holes. If `tag' is positive, set the +! tag explicitly; otherwise a new tag is selected automatically. Return the +! tag of the surface. + function gmshModelGeoAddPlaneSurface( + & wireTags, + & wireTags_n, + & tag, + & ierr) + & bind(C,name="gmshModelGeoAddPlaneSurface") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelGeoAddPlaneSurface + integer (C_INT) :: wireTags(*) + integer (C_SIZE_T), value :: wireTags_n + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelGeoAddPlaneSurface + +! Add a surface in the built-in CAD representation, filling the curve loops +! in `wireTags' using transfinite interpolation. Currently only a single +! curve loop is supported; this curve loop should be composed by 3 or 4 +! curves only. If `tag' is positive, set the tag explicitly; otherwise a new +! tag is selected automatically. Return the tag of the surface. + function gmshModelGeoAddSurfaceFilling( + & wireTags, + & wireTags_n, + & tag, + & sphereCenterTag, + & ierr) + & bind(C,name="gmshModelGeoAddSurfaceFilling") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelGeoAddSurfaceFilling + integer (C_INT) :: wireTags(*) + integer (C_SIZE_T), value :: wireTags_n + integer (C_INT), value :: tag + integer (C_INT), value :: sphereCenterTag + integer (C_INT) :: ierr + end function gmshModelGeoAddSurfaceFilling + +! Add a surface loop (a closed shell) formed by `surfaceTags' in the built-in +! CAD representation. If `tag' is positive, set the tag explicitly; +! otherwise a new tag is selected automatically. Return the tag of the shell. + function gmshModelGeoAddSurfaceLoop( + & surfaceTags, + & surfaceTags_n, + & tag, + & ierr) + & bind(C,name="gmshModelGeoAddSurfaceLoop") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelGeoAddSurfaceLoop + integer (C_INT) :: surfaceTags(*) + integer (C_SIZE_T), value :: surfaceTags_n + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelGeoAddSurfaceLoop + +! Add a volume (a region) in the built-in CAD representation, defined by one +! or more shells `shellTags'. The first surface loop defines the exterior +! boundary; additional surface loop define holes. If `tag' is positive, set +! the tag explicitly; otherwise a new tag is selected automatically. Return +! the tag of the volume. + function gmshModelGeoAddVolume( + & shellTags, + & shellTags_n, + & tag, + & ierr) + & bind(C,name="gmshModelGeoAddVolume") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelGeoAddVolume + integer (C_INT) :: shellTags(*) + integer (C_SIZE_T), value :: shellTags_n + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelGeoAddVolume + +! Extrude the entities `dimTags' in the built-in CAD representation, using a +! translation along (`dx', `dy', `dz'). Return extruded entities in +! `outDimTags'. If `numElements' is not empty, also extrude the mesh: the +! entries in `numElements' give the number of elements in each layer. If +! `height' is not empty, it provides the (cumulative) height of the different +! layers, normalized to 1. If `recombine' is set, recombine the mesh in the +! layers. + subroutine gmshModelGeoExtrude( + & dimTags, + & dimTags_n, + & dx, + & dy, + & dz, + & outDimTags, + & outDimTags_n, + & numElements, + & numElements_n, + & heights, + & heights_n, + & recombine, + & ierr) + & bind(C,name="gmshModelGeoExtrude") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + real (C_DOUBLE), value :: dx + real (C_DOUBLE), value :: dy + real (C_DOUBLE), value :: dz + type (C_PTR), intent(out) :: outDimTags + integer (C_SIZE_T) :: outDimTags_n + integer (C_INT) :: numElements(*) + integer (C_SIZE_T), value :: numElements_n + real (C_DOUBLE) :: heights(*) + integer (C_SIZE_T), value :: heights_n + integer (C_INT), value :: recombine + integer (C_INT) :: ierr + end subroutine gmshModelGeoExtrude + +! Extrude the entities `dimTags' in the built-in CAD representation, using a +! rotation of `angle' radians around the axis of revolution defined by the +! point (`x', `y', `z') and the direction (`ax', `ay', `az'). The angle +! should be strictly smaller than Pi. Return extruded entities in +! `outDimTags'. If `numElements' is not empty, also extrude the mesh: the +! entries in `numElements' give the number of elements in each layer. If +! `height' is not empty, it provides the (cumulative) height of the different +! layers, normalized to 1. If `recombine' is set, recombine the mesh in the +! layers. + subroutine gmshModelGeoRevolve( + & dimTags, + & dimTags_n, + & x, + & y, + & z, + & ax, + & ay, + & az, + & angle, + & outDimTags, + & outDimTags_n, + & numElements, + & numElements_n, + & heights, + & heights_n, + & recombine, + & ierr) + & bind(C,name="gmshModelGeoRevolve") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + real (C_DOUBLE), value :: x + real (C_DOUBLE), value :: y + real (C_DOUBLE), value :: z + real (C_DOUBLE), value :: ax + real (C_DOUBLE), value :: ay + real (C_DOUBLE), value :: az + real (C_DOUBLE), value :: angle + type (C_PTR), intent(out) :: outDimTags + integer (C_SIZE_T) :: outDimTags_n + integer (C_INT) :: numElements(*) + integer (C_SIZE_T), value :: numElements_n + real (C_DOUBLE) :: heights(*) + integer (C_SIZE_T), value :: heights_n + integer (C_INT), value :: recombine + integer (C_INT) :: ierr + end subroutine gmshModelGeoRevolve + +! Extrude the entities `dimTags' in the built-in CAD representation, using a +! combined translation and rotation of `angle' radians, along (`dx', `dy', +! `dz') and around the axis of revolution defined by the point (`x', `y', +! `z') and the direction (`ax', `ay', `az'). The angle should be strictly +! smaller than Pi. Return extruded entities in `outDimTags'. If `numElements' +! is not empty, also extrude the mesh: the entries in `numElements' give the +! number of elements in each layer. If `height' is not empty, it provides the +! (cumulative) height of the different layers, normalized to 1. If +! `recombine' is set, recombine the mesh in the layers. + subroutine gmshModelGeoTwist( + & dimTags, + & dimTags_n, + & x, + & y, + & z, + & dx, + & dy, + & dz, + & ax, + & ay, + & az, + & angle, + & outDimTags, + & outDimTags_n, + & numElements, + & numElements_n, + & heights, + & heights_n, + & recombine, + & ierr) + & bind(C,name="gmshModelGeoTwist") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + real (C_DOUBLE), value :: x + real (C_DOUBLE), value :: y + real (C_DOUBLE), value :: z + real (C_DOUBLE), value :: dx + real (C_DOUBLE), value :: dy + real (C_DOUBLE), value :: dz + real (C_DOUBLE), value :: ax + real (C_DOUBLE), value :: ay + real (C_DOUBLE), value :: az + real (C_DOUBLE), value :: angle + type (C_PTR), intent(out) :: outDimTags + integer (C_SIZE_T) :: outDimTags_n + integer (C_INT) :: numElements(*) + integer (C_SIZE_T), value :: numElements_n + real (C_DOUBLE) :: heights(*) + integer (C_SIZE_T), value :: heights_n + integer (C_INT), value :: recombine + integer (C_INT) :: ierr + end subroutine gmshModelGeoTwist + +! Extrude the entities `dimTags' in the built-in CAD representation along the +! normals of the mesh, creating discrete boundary layer entities. Return +! extruded entities in `outDimTags'. The entries in `numElements' give the +! number of elements in each layer. If `height' is not empty, it provides the +! height of the different layers. If `recombine' is set, recombine the mesh +! in the layers. A second boundary layer can be created from the same +! entities if `second' is set. If `viewIndex' is >= 0, use the corresponding +! view to either specify the normals (if the view contains a vector field) or +! scale the normals (if the view is scalar). + subroutine gmshModelGeoExtrudeBoundaryLayer( + & dimTags, + & dimTags_n, + & outDimTags, + & outDimTags_n, + & numElements, + & numElements_n, + & heights, + & heights_n, + & recombine, + & second, + & viewIndex, + & ierr) + & bind(C,name="gmshModelGeoExtrudeBoundaryLayer") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + type (C_PTR), intent(out) :: outDimTags + integer (C_SIZE_T) :: outDimTags_n + integer (C_INT) :: numElements(*) + integer (C_SIZE_T), value :: numElements_n + real (C_DOUBLE) :: heights(*) + integer (C_SIZE_T), value :: heights_n + integer (C_INT), value :: recombine + integer (C_INT), value :: second + integer (C_INT), value :: viewIndex + integer (C_INT) :: ierr + end subroutine gmshModelGeoExtrudeBoundaryLayer + +! Translate the entities `dimTags' in the built-in CAD representation along +! (`dx', `dy', `dz'). + subroutine gmshModelGeoTranslate( + & dimTags, + & dimTags_n, + & dx, + & dy, + & dz, + & ierr) + & bind(C,name="gmshModelGeoTranslate") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + real (C_DOUBLE), value :: dx + real (C_DOUBLE), value :: dy + real (C_DOUBLE), value :: dz + integer (C_INT) :: ierr + end subroutine gmshModelGeoTranslate + +! Rotate the entities `dimTags' in the built-in CAD representation by `angle' +! radians around the axis of revolution defined by the point (`x', `y', `z') +! and the direction (`ax', `ay', `az'). + subroutine gmshModelGeoRotate( + & dimTags, + & dimTags_n, + & x, + & y, + & z, + & ax, + & ay, + & az, + & angle, + & ierr) + & bind(C,name="gmshModelGeoRotate") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + real (C_DOUBLE), value :: x + real (C_DOUBLE), value :: y + real (C_DOUBLE), value :: z + real (C_DOUBLE), value :: ax + real (C_DOUBLE), value :: ay + real (C_DOUBLE), value :: az + real (C_DOUBLE), value :: angle + integer (C_INT) :: ierr + end subroutine gmshModelGeoRotate + +! Scale the entities `dimTag' in the built-in CAD representation by factors +! `a', `b' and `c' along the three coordinate axes; use (`x', `y', `z') as +! the center of the homothetic transformation. + subroutine gmshModelGeoDilate( + & dimTags, + & dimTags_n, + & x, + & y, + & z, + & a, + & b, + & c, + & ierr) + & bind(C,name="gmshModelGeoDilate") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + real (C_DOUBLE), value :: x + real (C_DOUBLE), value :: y + real (C_DOUBLE), value :: z + real (C_DOUBLE), value :: a + real (C_DOUBLE), value :: b + real (C_DOUBLE), value :: c + integer (C_INT) :: ierr + end subroutine gmshModelGeoDilate + +! Mirror the entities `dimTag' in the built-in CAD representation, with +! respect to the plane of equation `a' * x + `b' * y + `c' * z + `d' = 0. + subroutine gmshModelGeoMirror( + & dimTags, + & dimTags_n, + & a, + & b, + & c, + & d, + & ierr) + & bind(C,name="gmshModelGeoMirror") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + real (C_DOUBLE), value :: a + real (C_DOUBLE), value :: b + real (C_DOUBLE), value :: c + real (C_DOUBLE), value :: d + integer (C_INT) :: ierr + end subroutine gmshModelGeoMirror + +! Mirror the entities `dimTag' in the built-in CAD representation, with +! respect to the plane of equation `a' * x + `b' * y + `c' * z + `d' = 0. +! (This is a synonym for `mirror', which will be deprecated in a future +! release.) + subroutine gmshModelGeoSymmetrize( + & dimTags, + & dimTags_n, + & a, + & b, + & c, + & d, + & ierr) + & bind(C,name="gmshModelGeoSymmetrize") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + real (C_DOUBLE), value :: a + real (C_DOUBLE), value :: b + real (C_DOUBLE), value :: c + real (C_DOUBLE), value :: d + integer (C_INT) :: ierr + end subroutine gmshModelGeoSymmetrize + +! Copy the entities `dimTags' in the built-in CAD representation; the new +! entities are returned in `outDimTags'. + subroutine gmshModelGeoCopy( + & dimTags, + & dimTags_n, + & outDimTags, + & outDimTags_n, + & ierr) + & bind(C,name="gmshModelGeoCopy") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + type (C_PTR), intent(out) :: outDimTags + integer (C_SIZE_T) :: outDimTags_n + integer (C_INT) :: ierr + end subroutine gmshModelGeoCopy + +! Remove the entities `dimTags' in the built-in CAD representation, provided +! that they are not on the boundary of higher-dimensional entities. If +! `recursive' is true, remove all the entities on their boundaries, down to +! dimension 0. + subroutine gmshModelGeoRemove( + & dimTags, + & dimTags_n, + & recursive, + & ierr) + & bind(C,name="gmshModelGeoRemove") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + integer (C_INT), value :: recursive + integer (C_INT) :: ierr + end subroutine gmshModelGeoRemove + +! Remove all duplicate entities in the built-in CAD representation (different +! entities at the same geometrical location). + subroutine gmshModelGeoRemoveAllDuplicates( + & ierr) + & bind(C,name="gmshModelGeoRemoveAllDuplicates") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: ierr + end subroutine gmshModelGeoRemoveAllDuplicates + +! Split the curve of tag `tag' in the built-in CAD representation, on the +! specified control points `pointTags'. This feature is only available for +! lines, splines and b-splines. Return the tag(s) `curveTags' of the newly +! created curve(s). + subroutine gmshModelGeoSplitCurve( + & tag, + & pointTags, + & pointTags_n, + & curveTags, + & curveTags_n, + & ierr) + & bind(C,name="gmshModelGeoSplitCurve") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + integer (C_INT) :: pointTags(*) + integer (C_SIZE_T), value :: pointTags_n + type (C_PTR), intent(out) :: curveTags + integer (C_SIZE_T) :: curveTags_n + integer (C_INT) :: ierr + end subroutine gmshModelGeoSplitCurve + +! Get the maximum tag of entities of dimension `dim' in the built-in CAD +! representation. + function gmshModelGeoGetMaxTag( + & dim, + & ierr) + & bind(C,name="gmshModelGeoGetMaxTag") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelGeoGetMaxTag + integer (C_INT), value :: dim + integer (C_INT) :: ierr + end function gmshModelGeoGetMaxTag + +! Set the maximum tag `maxTag' for entities of dimension `dim' in the built- +! in CAD representation. + subroutine gmshModelGeoSetMaxTag( + & dim, + & maxTag, + & ierr) + & bind(C,name="gmshModelGeoSetMaxTag") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: maxTag + integer (C_INT) :: ierr + end subroutine gmshModelGeoSetMaxTag + +! Add a physical group of dimension `dim', grouping the entities with tags +! `tags' in the built-in CAD representation. Return the tag of the physical +! group, equal to `tag' if `tag' is positive, or a new tag if `tag' < 0. + function gmshModelGeoAddPhysicalGroup( + & dim, + & tags, + & tags_n, + & tag, + & ierr) + & bind(C,name="gmshModelGeoAddPhysicalGroup") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelGeoAddPhysicalGroup + integer (C_INT), value :: dim + integer (C_INT) :: tags(*) + integer (C_SIZE_T), value :: tags_n + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelGeoAddPhysicalGroup + +! Remove the physical groups `dimTags' from the built-in CAD representation. +! If `dimTags' is empty, remove all groups. + subroutine gmshModelGeoRemovePhysicalGroups( + & dimTags, + & dimTags_n, + & ierr) + & bind(C,name="gmshModelGeoRemovePhysicalGroups") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + integer (C_INT) :: ierr + end subroutine gmshModelGeoRemovePhysicalGroups + +! Synchronize the built-in CAD representation with the current Gmsh model. +! This can be called at any time, but since it involves a non trivial amount +! of processing, the number of synchronization points should normally be +! minimized. Without synchronization the entities in the built-in CAD +! representation are not available to any function outside of the built-in +! CAD kernel functions. + subroutine gmshModelGeoSynchronize( + & ierr) + & bind(C,name="gmshModelGeoSynchronize") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: ierr + end subroutine gmshModelGeoSynchronize + +! Set a mesh size constraint on the entities `dimTags' in the built-in CAD +! kernel representation. Currently only entities of dimension 0 (points) are +! handled. + subroutine gmshModelGeoMeshSetSize( + & dimTags, + & dimTags_n, + & size, + & ierr) + & bind(C,name="gmshModelGeoMeshSetSize") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + real (C_DOUBLE), value :: size + integer (C_INT) :: ierr + end subroutine gmshModelGeoMeshSetSize + +! Set a transfinite meshing constraint on the curve `tag' in the built-in CAD +! kernel representation, with `numNodes' nodes distributed according to +! `meshType' and `coef'. Currently supported types are "Progression" +! (geometrical progression with power `coef') and "Bump" (refinement toward +! both extremities of the curve). + subroutine gmshModelGeoMeshSetTransfiniteCurve( + & tag, + & nPoints, + & meshType, + & coef, + & ierr) + & bind(C,name="gmshModelGeoMeshSetTransfiniteCurve") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + integer (C_INT), value :: nPoints + character (LEN=1,KIND=C_CHAR) :: meshType(*) + real (C_DOUBLE), value :: coef + integer (C_INT) :: ierr + end subroutine gmshModelGeoMeshSetTransfiniteCurve + +! Set a transfinite meshing constraint on the surface `tag' in the built-in +! CAD kernel representation. `arrangement' describes the arrangement of the +! triangles when the surface is not flagged as recombined: currently +! supported values are "Left", "Right", "AlternateLeft" and "AlternateRight". +! `cornerTags' can be used to specify the (3 or 4) corners of the transfinite +! interpolation explicitly; specifying the corners explicitly is mandatory if +! the surface has more that 3 or 4 points on its boundary. + subroutine gmshModelGeoMeshSetTransfiniteSurface( + & tag, + & arrangement, + & cornerTags, + & cornerTags_n, + & ierr) + & bind(C,name="gmshModelGeoMeshSetTransfiniteSurface") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + character (LEN=1,KIND=C_CHAR) :: arrangement(*) + integer (C_INT) :: cornerTags(*) + integer (C_SIZE_T), value :: cornerTags_n + integer (C_INT) :: ierr + end subroutine gmshModelGeoMeshSetTransfiniteSurface + +! Set a transfinite meshing constraint on the surface `tag' in the built-in +! CAD kernel representation. `cornerTags' can be used to specify the (6 or 8) +! corners of the transfinite interpolation explicitly. + subroutine gmshModelGeoMeshSetTransfiniteVolume( + & tag, + & cornerTags, + & cornerTags_n, + & ierr) + & bind(C,name="gmshModelGeoMeshSetTransfiniteVolume") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + integer (C_INT) :: cornerTags(*) + integer (C_SIZE_T), value :: cornerTags_n + integer (C_INT) :: ierr + end subroutine gmshModelGeoMeshSetTransfiniteVolume + +! Set a recombination meshing constraint on the entity of dimension `dim' and +! tag `tag' in the built-in CAD kernel representation. Currently only +! entities of dimension 2 (to recombine triangles into quadrangles) are +! supported. + subroutine gmshModelGeoMeshSetRecombine( + & dim, + & tag, + & angle, + & ierr) + & bind(C,name="gmshModelGeoMeshSetRecombine") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + real (C_DOUBLE), value :: angle + integer (C_INT) :: ierr + end subroutine gmshModelGeoMeshSetRecombine + +! Set a smoothing meshing constraint on the entity of dimension `dim' and tag +! `tag' in the built-in CAD kernel representation. `val' iterations of a +! Laplace smoother are applied. + subroutine gmshModelGeoMeshSetSmoothing( + & dim, + & tag, + & val, + & ierr) + & bind(C,name="gmshModelGeoMeshSetSmoothing") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + integer (C_INT), value :: val + integer (C_INT) :: ierr + end subroutine gmshModelGeoMeshSetSmoothing + +! Set a reverse meshing constraint on the entity of dimension `dim' and tag +! `tag' in the built-in CAD kernel representation. If `val' is true, the mesh +! orientation will be reversed with respect to the natural mesh orientation +! (i.e. the orientation consistent with the orientation of the geometry). If +! `val' is false, the mesh is left as-is. + subroutine gmshModelGeoMeshSetReverse( + & dim, + & tag, + & val, + & ierr) + & bind(C,name="gmshModelGeoMeshSetReverse") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + integer (C_INT), value :: val + integer (C_INT) :: ierr + end subroutine gmshModelGeoMeshSetReverse + +! Set the meshing algorithm on the entity of dimension `dim' and tag `tag' in +! the built-in CAD kernel representation. Currently only supported for `dim' +! == 2. + subroutine gmshModelGeoMeshSetAlgorithm( + & dim, + & tag, + & val, + & ierr) + & bind(C,name="gmshModelGeoMeshSetAlgorithm") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + integer (C_INT), value :: val + integer (C_INT) :: ierr + end subroutine gmshModelGeoMeshSetAlgorithm + +! Force the mesh size to be extended from the boundary, or not, for the +! entity of dimension `dim' and tag `tag' in the built-in CAD kernel +! representation. Currently only supported for `dim' == 2. + subroutine gmshModelGeoMeshSetSizeFromBoundary( + & dim, + & tag, + & val, + & ierr) + & bind(C,name="gmshModelGeoMeshSetSizeFromBoundary") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + integer (C_INT), value :: val + integer (C_INT) :: ierr + end subroutine gmshModelGeoMeshSetSizeFromBoundary + +! Add a geometrical point in the OpenCASCADE CAD representation, at +! coordinates (`x', `y', `z'). If `meshSize' is > 0, add a meshing constraint +! at that point. If `tag' is positive, set the tag explicitly; otherwise a +! new tag is selected automatically. Return the tag of the point. (Note that +! the point will be added in the current model only after `synchronize' is +! called. This behavior holds for all the entities added in the occ module.) + function gmshModelOccAddPoint( + & x, + & y, + & z, + & meshSize, + & tag, + & ierr) + & bind(C,name="gmshModelOccAddPoint") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddPoint + real (C_DOUBLE), value :: x + real (C_DOUBLE), value :: y + real (C_DOUBLE), value :: z + real (C_DOUBLE), value :: meshSize + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelOccAddPoint + +! Add a straight line segment in the OpenCASCADE CAD representation, between +! the two points with tags `startTag' and `endTag'. If `tag' is positive, set +! the tag explicitly; otherwise a new tag is selected automatically. Return +! the tag of the line. + function gmshModelOccAddLine( + & startTag, + & endTag, + & tag, + & ierr) + & bind(C,name="gmshModelOccAddLine") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddLine + integer (C_INT), value :: startTag + integer (C_INT), value :: endTag + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelOccAddLine + +! Add a circle arc in the OpenCASCADE CAD representation, between the two +! points with tags `startTag' and `endTag', with center `centerTag'. If `tag' +! is positive, set the tag explicitly; otherwise a new tag is selected +! automatically. Return the tag of the circle arc. + function gmshModelOccAddCircleArc( + & startTag, + & centerTag, + & endTag, + & tag, + & ierr) + & bind(C,name="gmshModelOccAddCircleArc") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddCircleArc + integer (C_INT), value :: startTag + integer (C_INT), value :: centerTag + integer (C_INT), value :: endTag + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelOccAddCircleArc + +! Add a circle of center (`x', `y', `z') and radius `r' in the OpenCASCADE +! CAD representation. If `tag' is positive, set the tag explicitly; otherwise +! a new tag is selected automatically. If `angle1' and `angle2' are +! specified, create a circle arc between the two angles. Return the tag of +! the circle. + function gmshModelOccAddCircle( + & x, + & y, + & z, + & r, + & tag, + & angle1, + & angle2, + & ierr) + & bind(C,name="gmshModelOccAddCircle") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddCircle + real (C_DOUBLE), value :: x + real (C_DOUBLE), value :: y + real (C_DOUBLE), value :: z + real (C_DOUBLE), value :: r + integer (C_INT), value :: tag + real (C_DOUBLE), value :: angle1 + real (C_DOUBLE), value :: angle2 + integer (C_INT) :: ierr + end function gmshModelOccAddCircle + +! Add an ellipse arc in the OpenCASCADE CAD representation, between the two +! points `startTag' and `endTag', and with center `centerTag' and major axis +! point `majorTag'. If `tag' is positive, set the tag explicitly; otherwise a +! new tag is selected automatically. Return the tag of the ellipse arc. Note +! that OpenCASCADE does not allow creating ellipse arcs with the major radius +! smaller than the minor radius. + function gmshModelOccAddEllipseArc( + & startTag, + & centerTag, + & majorTag, + & endTag, + & tag, + & ierr) + & bind(C,name="gmshModelOccAddEllipseArc") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddEllipseArc + integer (C_INT), value :: startTag + integer (C_INT), value :: centerTag + integer (C_INT), value :: majorTag + integer (C_INT), value :: endTag + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelOccAddEllipseArc + +! Add an ellipse of center (`x', `y', `z') and radii `r1' and `r2' along the +! x- and y-axes, respectively, in the OpenCASCADE CAD representation. If +! `tag' is positive, set the tag explicitly; otherwise a new tag is selected +! automatically. If `angle1' and `angle2' are specified, create an ellipse +! arc between the two angles. Return the tag of the ellipse. Note that +! OpenCASCADE does not allow creating ellipses with the major radius (along +! the x-axis) smaller than or equal to the minor radius (along the y-axis): +! rotate the shape or use `addCircle' in such cases. + function gmshModelOccAddEllipse( + & x, + & y, + & z, + & r1, + & r2, + & tag, + & angle1, + & angle2, + & ierr) + & bind(C,name="gmshModelOccAddEllipse") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddEllipse + real (C_DOUBLE), value :: x + real (C_DOUBLE), value :: y + real (C_DOUBLE), value :: z + real (C_DOUBLE), value :: r1 + real (C_DOUBLE), value :: r2 + integer (C_INT), value :: tag + real (C_DOUBLE), value :: angle1 + real (C_DOUBLE), value :: angle2 + integer (C_INT) :: ierr + end function gmshModelOccAddEllipse + +! Add a spline (C2 b-spline) curve in the OpenCASCADE CAD representation, +! going through the points `pointTags'. If `tag' is positive, set the tag +! explicitly; otherwise a new tag is selected automatically. Create a +! periodic curve if the first and last points are the same. Return the tag of +! the spline curve. + function gmshModelOccAddSpline( + & pointTags, + & pointTags_n, + & tag, + & ierr) + & bind(C,name="gmshModelOccAddSpline") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddSpline + integer (C_INT) :: pointTags(*) + integer (C_SIZE_T), value :: pointTags_n + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelOccAddSpline + +! Add a b-spline curve of degree `degree' in the OpenCASCADE CAD +! representation, with `pointTags' control points. If `weights', `knots' or +! `multiplicities' are not provided, default parameters are computed +! automatically. If `tag' is positive, set the tag explicitly; otherwise a +! new tag is selected automatically. Create a periodic curve if the first and +! last points are the same. Return the tag of the b-spline curve. + function gmshModelOccAddBSpline( + & pointTags, + & pointTags_n, + & tag, + & degree, + & weights, + & weights_n, + & knots, + & knots_n, + & multiplicities, + & multiplicities_n, + & ierr) + & bind(C,name="gmshModelOccAddBSpline") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddBSpline + integer (C_INT) :: pointTags(*) + integer (C_SIZE_T), value :: pointTags_n + integer (C_INT), value :: tag + integer (C_INT), value :: degree + real (C_DOUBLE) :: weights(*) + integer (C_SIZE_T), value :: weights_n + real (C_DOUBLE) :: knots(*) + integer (C_SIZE_T), value :: knots_n + integer (C_INT) :: multiplicities(*) + integer (C_SIZE_T), value :: multiplicities_n + integer (C_INT) :: ierr + end function gmshModelOccAddBSpline + +! Add a Bezier curve in the OpenCASCADE CAD representation, with `pointTags' +! control points. If `tag' is positive, set the tag explicitly; otherwise a +! new tag is selected automatically. Return the tag of the Bezier curve. + function gmshModelOccAddBezier( + & pointTags, + & pointTags_n, + & tag, + & ierr) + & bind(C,name="gmshModelOccAddBezier") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddBezier + integer (C_INT) :: pointTags(*) + integer (C_SIZE_T), value :: pointTags_n + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelOccAddBezier + +! Add a wire (open or closed) in the OpenCASCADE CAD representation, formed +! by the curves `curveTags'. Note that an OpenCASCADE wire can be made of +! curves that share geometrically identical (but topologically different) +! points. If `tag' is positive, set the tag explicitly; otherwise a new tag +! is selected automatically. Return the tag of the wire. + function gmshModelOccAddWire( + & curveTags, + & curveTags_n, + & tag, + & checkClosed, + & ierr) + & bind(C,name="gmshModelOccAddWire") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddWire + integer (C_INT) :: curveTags(*) + integer (C_SIZE_T), value :: curveTags_n + integer (C_INT), value :: tag + integer (C_INT), value :: checkClosed + integer (C_INT) :: ierr + end function gmshModelOccAddWire + +! Add a curve loop (a closed wire) in the OpenCASCADE CAD representation, +! formed by the curves `curveTags'. `curveTags' should contain tags of curves +! forming a closed loop. Note that an OpenCASCADE curve loop can be made of +! curves that share geometrically identical (but topologically different) +! points. If `tag' is positive, set the tag explicitly; otherwise a new tag +! is selected automatically. Return the tag of the curve loop. + function gmshModelOccAddCurveLoop( + & curveTags, + & curveTags_n, + & tag, + & ierr) + & bind(C,name="gmshModelOccAddCurveLoop") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddCurveLoop + integer (C_INT) :: curveTags(*) + integer (C_SIZE_T), value :: curveTags_n + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelOccAddCurveLoop + +! Add a rectangle in the OpenCASCADE CAD representation, with lower left +! corner at (`x', `y', `z') and upper right corner at (`x' + `dx', `y' + +! `dy', `z'). If `tag' is positive, set the tag explicitly; otherwise a new +! tag is selected automatically. Round the corners if `roundedRadius' is +! nonzero. Return the tag of the rectangle. + function gmshModelOccAddRectangle( + & x, + & y, + & z, + & dx, + & dy, + & tag, + & roundedRadius, + & ierr) + & bind(C,name="gmshModelOccAddRectangle") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddRectangle + real (C_DOUBLE), value :: x + real (C_DOUBLE), value :: y + real (C_DOUBLE), value :: z + real (C_DOUBLE), value :: dx + real (C_DOUBLE), value :: dy + integer (C_INT), value :: tag + real (C_DOUBLE), value :: roundedRadius + integer (C_INT) :: ierr + end function gmshModelOccAddRectangle + +! Add a disk in the OpenCASCADE CAD representation, with center (`xc', `yc', +! `zc') and radius `rx' along the x-axis and `ry' along the y-axis. If `tag' +! is positive, set the tag explicitly; otherwise a new tag is selected +! automatically. Return the tag of the disk. + function gmshModelOccAddDisk( + & xc, + & yc, + & zc, + & rx, + & ry, + & tag, + & ierr) + & bind(C,name="gmshModelOccAddDisk") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddDisk + real (C_DOUBLE), value :: xc + real (C_DOUBLE), value :: yc + real (C_DOUBLE), value :: zc + real (C_DOUBLE), value :: rx + real (C_DOUBLE), value :: ry + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelOccAddDisk + +! Add a plane surface in the OpenCASCADE CAD representation, defined by one +! or more curve loops (or closed wires) `wireTags'. The first curve loop +! defines the exterior contour; additional curve loop define holes. If `tag' +! is positive, set the tag explicitly; otherwise a new tag is selected +! automatically. Return the tag of the surface. + function gmshModelOccAddPlaneSurface( + & wireTags, + & wireTags_n, + & tag, + & ierr) + & bind(C,name="gmshModelOccAddPlaneSurface") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddPlaneSurface + integer (C_INT) :: wireTags(*) + integer (C_SIZE_T), value :: wireTags_n + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelOccAddPlaneSurface + +! Add a surface in the OpenCASCADE CAD representation, filling the curve loop +! `wireTag'. If `tag' is positive, set the tag explicitly; otherwise a new +! tag is selected automatically. Return the tag of the surface. If +! `pointTags' are provided, force the surface to pass through the given +! points. The other optional arguments are `degree' (the degree of the energy +! criterion to minimize for computing the deformation of the surface), +! `numPointsOnCurves' (the average number of points for discretisation of the +! bounding curves), `numIter' (the maximum number of iterations of the +! optimization process), `anisotropic' (improve performance when the ratio of +! the length along the two parametric coordinates of the surface is high), +! `tol2d' (tolerance to the constraints in the parametric plane of the +! surface), `tol3d' (the maximum distance allowed between the support surface +! and the constraints), `tolAng' (the maximum angle allowed between the +! normal of the surface and the constraints), `tolCurv' (the maximum +! difference of curvature allowed between the surface and the constraint), +! `maxDegree' (the highest degree which the polynomial defining the filling +! surface can have) and, `maxSegments' (the largest number of segments which +! the filling surface can have). + function gmshModelOccAddSurfaceFilling( + & wireTag, + & tag, + & pointTags, + & pointTags_n, + & degree, + & numPointsOnCurves, + & numIter, + & anisotropic, + & tol2d, + & tol3d, + & tolAng, + & tolCurv, + & maxDegree, + & maxSegments, + & ierr) + & bind(C,name="gmshModelOccAddSurfaceFilling") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddSurfaceFilling + integer (C_INT), value :: wireTag + integer (C_INT), value :: tag + integer (C_INT) :: pointTags(*) + integer (C_SIZE_T), value :: pointTags_n + integer (C_INT), value :: degree + integer (C_INT), value :: numPointsOnCurves + integer (C_INT), value :: numIter + integer (C_INT), value :: anisotropic + real (C_DOUBLE), value :: tol2d + real (C_DOUBLE), value :: tol3d + real (C_DOUBLE), value :: tolAng + real (C_DOUBLE), value :: tolCurv + integer (C_INT), value :: maxDegree + integer (C_INT), value :: maxSegments + integer (C_INT) :: ierr + end function gmshModelOccAddSurfaceFilling + +! Add a BSpline surface in the OpenCASCADE CAD representation, filling the +! curve loop `wireTag'. The curve loop should be made of 2, 3 or 4 BSpline +! curves. The optional `type' argument specifies the type of filling: +! "Stretch" creates the flattest patch, "Curved" (the default) creates the +! most rounded patch, and "Coons" creates a rounded patch with less depth +! than "Curved". If `tag' is positive, set the tag explicitly; otherwise a +! new tag is selected automatically. Return the tag of the surface. + function gmshModelOccAddBSplineFilling( + & wireTag, + & tag, + & type, + & ierr) + & bind(C,name="gmshModelOccAddBSplineFilling") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddBSplineFilling + integer (C_INT), value :: wireTag + integer (C_INT), value :: tag + character (LEN=1,KIND=C_CHAR) :: type(*) + integer (C_INT) :: ierr + end function gmshModelOccAddBSplineFilling + +! Add a Bezier surface in the OpenCASCADE CAD representation, filling the +! curve loop `wireTag'. The curve loop should be made of 2, 3 or 4 Bezier +! curves. The optional `type' argument specifies the type of filling: +! "Stretch" creates the flattest patch, "Curved" (the default) creates the +! most rounded patch, and "Coons" creates a rounded patch with less depth +! than "Curved". If `tag' is positive, set the tag explicitly; otherwise a +! new tag is selected automatically. Return the tag of the surface. + function gmshModelOccAddBezierFilling( + & wireTag, + & tag, + & type, + & ierr) + & bind(C,name="gmshModelOccAddBezierFilling") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddBezierFilling + integer (C_INT), value :: wireTag + integer (C_INT), value :: tag + character (LEN=1,KIND=C_CHAR) :: type(*) + integer (C_INT) :: ierr + end function gmshModelOccAddBezierFilling + +! Add a b-spline surface of degree `degreeU' x `degreeV' in the OpenCASCADE +! CAD representation, with `pointTags' control points given as a single +! vector [Pu1v1, ... Pu`numPointsU'v1, Pu1v2, ...]. If `weights', `knotsU', +! `knotsV', `multiplicitiesU' or `multiplicitiesV' are not provided, default +! parameters are computed automatically. If `tag' is positive, set the tag +! explicitly; otherwise a new tag is selected automatically. If `wireTags' is +! provided, trim the b-spline patch using the provided wires: the first wire +! defines the external contour, the others define holes. If `wire3D' is set, +! consider wire curves as 3D curves and project them on the b-spline surface; +! otherwise consider the wire curves as defined in the parametric space of +! the surface. Return the tag of the b-spline surface. + function gmshModelOccAddBSplineSurface( + & pointTags, + & pointTags_n, + & numPointsU, + & tag, + & degreeU, + & degreeV, + & weights, + & weights_n, + & knotsU, + & knotsU_n, + & knotsV, + & knotsV_n, + & multiplicitiesU, + & multiplicitiesU_n, + & multiplicitiesV, + & multiplicitiesV_n, + & wireTags, + & wireTags_n, + & wire3D, + & ierr) + & bind(C,name="gmshModelOccAddBSplineSurface") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddBSplineSurface + integer (C_INT) :: pointTags(*) + integer (C_SIZE_T), value :: pointTags_n + integer (C_INT), value :: numPointsU + integer (C_INT), value :: tag + integer (C_INT), value :: degreeU + integer (C_INT), value :: degreeV + real (C_DOUBLE) :: weights(*) + integer (C_SIZE_T), value :: weights_n + real (C_DOUBLE) :: knotsU(*) + integer (C_SIZE_T), value :: knotsU_n + real (C_DOUBLE) :: knotsV(*) + integer (C_SIZE_T), value :: knotsV_n + integer (C_INT) :: multiplicitiesU(*) + integer (C_SIZE_T), value :: multiplicitiesU_n + integer (C_INT) :: multiplicitiesV(*) + integer (C_SIZE_T), value :: multiplicitiesV_n + integer (C_INT) :: wireTags(*) + integer (C_SIZE_T), value :: wireTags_n + integer (C_INT), value :: wire3D + integer (C_INT) :: ierr + end function gmshModelOccAddBSplineSurface + +! Add a Bezier surface in the OpenCASCADE CAD representation, with +! `pointTags' control points given as a single vector [Pu1v1, ... +! Pu`numPointsU'v1, Pu1v2, ...]. If `tag' is positive, set the tag +! explicitly; otherwise a new tag is selected automatically. If `wireTags' is +! provided, trim the Bezier patch using the provided wires: the first wire +! defines the external contour, the others define holes. If `wire3D' is set, +! consider wire curves as 3D curves and project them on the Bezier surface; +! otherwise consider the wire curves as defined in the parametric space of +! the surface. Return the tag of the Bezier surface. + function gmshModelOccAddBezierSurface( + & pointTags, + & pointTags_n, + & numPointsU, + & tag, + & wireTags, + & wireTags_n, + & wire3D, + & ierr) + & bind(C,name="gmshModelOccAddBezierSurface") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddBezierSurface + integer (C_INT) :: pointTags(*) + integer (C_SIZE_T), value :: pointTags_n + integer (C_INT), value :: numPointsU + integer (C_INT), value :: tag + integer (C_INT) :: wireTags(*) + integer (C_SIZE_T), value :: wireTags_n + integer (C_INT), value :: wire3D + integer (C_INT) :: ierr + end function gmshModelOccAddBezierSurface + +! Trim the surface `surfaceTag' with the wires `wireTags', replacing any +! existing trimming curves. The first wire defines the external contour, the +! others define holes. If `wire3D' is set, consider wire curves as 3D curves +! and project them on the surface; otherwise consider the wire curves as +! defined in the parametric space of the surface. If `tag' is positive, set +! the tag explicitly; otherwise a new tag is selected automatically. Return +! the tag of the trimmed surface. + function gmshModelOccAddTrimmedSurface( + & surfaceTag, + & wireTags, + & wireTags_n, + & wire3D, + & tag, + & ierr) + & bind(C,name="gmshModelOccAddTrimmedSurface") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddTrimmedSurface + integer (C_INT), value :: surfaceTag + integer (C_INT) :: wireTags(*) + integer (C_SIZE_T), value :: wireTags_n + integer (C_INT), value :: wire3D + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelOccAddTrimmedSurface + +! Add a surface loop (a closed shell) in the OpenCASCADE CAD representation, +! formed by `surfaceTags'. If `tag' is positive, set the tag explicitly; +! otherwise a new tag is selected automatically. Return the tag of the +! surface loop. Setting `sewing' allows one to build a shell made of surfaces +! that share geometrically identical (but topologically different) curves. + function gmshModelOccAddSurfaceLoop( + & surfaceTags, + & surfaceTags_n, + & tag, + & sewing, + & ierr) + & bind(C,name="gmshModelOccAddSurfaceLoop") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddSurfaceLoop + integer (C_INT) :: surfaceTags(*) + integer (C_SIZE_T), value :: surfaceTags_n + integer (C_INT), value :: tag + integer (C_INT), value :: sewing + integer (C_INT) :: ierr + end function gmshModelOccAddSurfaceLoop + +! Add a volume (a region) in the OpenCASCADE CAD representation, defined by +! one or more surface loops `shellTags'. The first surface loop defines the +! exterior boundary; additional surface loop define holes. If `tag' is +! positive, set the tag explicitly; otherwise a new tag is selected +! automatically. Return the tag of the volume. + function gmshModelOccAddVolume( + & shellTags, + & shellTags_n, + & tag, + & ierr) + & bind(C,name="gmshModelOccAddVolume") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddVolume + integer (C_INT) :: shellTags(*) + integer (C_SIZE_T), value :: shellTags_n + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelOccAddVolume + +! Add a sphere of center (`xc', `yc', `zc') and radius `r' in the OpenCASCADE +! CAD representation. The optional `angle1' and `angle2' arguments define the +! polar angle opening (from -Pi/2 to Pi/2). The optional `angle3' argument +! defines the azimuthal opening (from 0 to 2*Pi). If `tag' is positive, set +! the tag explicitly; otherwise a new tag is selected automatically. Return +! the tag of the sphere. + function gmshModelOccAddSphere( + & xc, + & yc, + & zc, + & radius, + & tag, + & angle1, + & angle2, + & angle3, + & ierr) + & bind(C,name="gmshModelOccAddSphere") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddSphere + real (C_DOUBLE), value :: xc + real (C_DOUBLE), value :: yc + real (C_DOUBLE), value :: zc + real (C_DOUBLE), value :: radius + integer (C_INT), value :: tag + real (C_DOUBLE), value :: angle1 + real (C_DOUBLE), value :: angle2 + real (C_DOUBLE), value :: angle3 + integer (C_INT) :: ierr + end function gmshModelOccAddSphere + +! Add a parallelepipedic box in the OpenCASCADE CAD representation, defined +! by a point (`x', `y', `z') and the extents along the x-, y- and z-axes. If +! `tag' is positive, set the tag explicitly; otherwise a new tag is selected +! automatically. Return the tag of the box. + function gmshModelOccAddBox( + & x, + & y, + & z, + & dx, + & dy, + & dz, + & tag, + & ierr) + & bind(C,name="gmshModelOccAddBox") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddBox + real (C_DOUBLE), value :: x + real (C_DOUBLE), value :: y + real (C_DOUBLE), value :: z + real (C_DOUBLE), value :: dx + real (C_DOUBLE), value :: dy + real (C_DOUBLE), value :: dz + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshModelOccAddBox + +! Add a cylinder in the OpenCASCADE CAD representation, defined by the center +! (`x', `y', `z') of its first circular face, the 3 components (`dx', `dy', +! `dz') of the vector defining its axis and its radius `r'. The optional +! `angle' argument defines the angular opening (from 0 to 2*Pi). If `tag' is +! positive, set the tag explicitly; otherwise a new tag is selected +! automatically. Return the tag of the cylinder. + function gmshModelOccAddCylinder( + & x, + & y, + & z, + & dx, + & dy, + & dz, + & r, + & tag, + & angle, + & ierr) + & bind(C,name="gmshModelOccAddCylinder") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddCylinder + real (C_DOUBLE), value :: x + real (C_DOUBLE), value :: y + real (C_DOUBLE), value :: z + real (C_DOUBLE), value :: dx + real (C_DOUBLE), value :: dy + real (C_DOUBLE), value :: dz + real (C_DOUBLE), value :: r + integer (C_INT), value :: tag + real (C_DOUBLE), value :: angle + integer (C_INT) :: ierr + end function gmshModelOccAddCylinder + +! Add a cone in the OpenCASCADE CAD representation, defined by the center +! (`x', `y', `z') of its first circular face, the 3 components of the vector +! (`dx', `dy', `dz') defining its axis and the two radii `r1' and `r2' of the +! faces (these radii can be zero). If `tag' is positive, set the tag +! explicitly; otherwise a new tag is selected automatically. `angle' defines +! the optional angular opening (from 0 to 2*Pi). Return the tag of the cone. + function gmshModelOccAddCone( + & x, + & y, + & z, + & dx, + & dy, + & dz, + & r1, + & r2, + & tag, + & angle, + & ierr) + & bind(C,name="gmshModelOccAddCone") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddCone + real (C_DOUBLE), value :: x + real (C_DOUBLE), value :: y + real (C_DOUBLE), value :: z + real (C_DOUBLE), value :: dx + real (C_DOUBLE), value :: dy + real (C_DOUBLE), value :: dz + real (C_DOUBLE), value :: r1 + real (C_DOUBLE), value :: r2 + integer (C_INT), value :: tag + real (C_DOUBLE), value :: angle + integer (C_INT) :: ierr + end function gmshModelOccAddCone + +! Add a right angular wedge in the OpenCASCADE CAD representation, defined by +! the right-angle point (`x', `y', `z') and the 3 extends along the x-, y- +! and z-axes (`dx', `dy', `dz'). If `tag' is positive, set the tag +! explicitly; otherwise a new tag is selected automatically. The optional +! argument `ltx' defines the top extent along the x-axis. Return the tag of +! the wedge. + function gmshModelOccAddWedge( + & x, + & y, + & z, + & dx, + & dy, + & dz, + & tag, + & ltx, + & ierr) + & bind(C,name="gmshModelOccAddWedge") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddWedge + real (C_DOUBLE), value :: x + real (C_DOUBLE), value :: y + real (C_DOUBLE), value :: z + real (C_DOUBLE), value :: dx + real (C_DOUBLE), value :: dy + real (C_DOUBLE), value :: dz + integer (C_INT), value :: tag + real (C_DOUBLE), value :: ltx + integer (C_INT) :: ierr + end function gmshModelOccAddWedge + +! Add a torus in the OpenCASCADE CAD representation, defined by its center +! (`x', `y', `z') and its 2 radii `r' and `r2'. If `tag' is positive, set the +! tag explicitly; otherwise a new tag is selected automatically. The optional +! argument `angle' defines the angular opening (from 0 to 2*Pi). Return the +! tag of the wedge. + function gmshModelOccAddTorus( + & x, + & y, + & z, + & r1, + & r2, + & tag, + & angle, + & ierr) + & bind(C,name="gmshModelOccAddTorus") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccAddTorus + real (C_DOUBLE), value :: x + real (C_DOUBLE), value :: y + real (C_DOUBLE), value :: z + real (C_DOUBLE), value :: r1 + real (C_DOUBLE), value :: r2 + integer (C_INT), value :: tag + real (C_DOUBLE), value :: angle + integer (C_INT) :: ierr + end function gmshModelOccAddTorus + +! Add a volume (if the optional argument `makeSolid' is set) or surfaces in +! the OpenCASCADE CAD representation, defined through the open or closed +! wires `wireTags'. If `tag' is positive, set the tag explicitly; otherwise a +! new tag is selected automatically. The new entities are returned in +! `outDimTags'. If the optional argument `makeRuled' is set, the surfaces +! created on the boundary are forced to be ruled surfaces. If `maxDegree' is +! positive, set the maximal degree of resulting surface. + subroutine gmshModelOccAddThruSections( + & wireTags, + & wireTags_n, + & outDimTags, + & outDimTags_n, + & tag, + & makeSolid, + & makeRuled, + & maxDegree, + & ierr) + & bind(C,name="gmshModelOccAddThruSections") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: wireTags(*) + integer (C_SIZE_T), value :: wireTags_n + type (C_PTR), intent(out) :: outDimTags + integer (C_SIZE_T) :: outDimTags_n + integer (C_INT), value :: tag + integer (C_INT), value :: makeSolid + integer (C_INT), value :: makeRuled + integer (C_INT), value :: maxDegree + integer (C_INT) :: ierr + end subroutine gmshModelOccAddThruSections + +! Add a hollowed volume in the OpenCASCADE CAD representation, built from an +! initial volume `volumeTag' and a set of faces from this volume +! `excludeSurfaceTags', which are to be removed. The remaining faces of the +! volume become the walls of the hollowed solid, with thickness `offset'. If +! `tag' is positive, set the tag explicitly; otherwise a new tag is selected +! automatically. + subroutine gmshModelOccAddThickSolid( + & volumeTag, + & excludeSurfaceTags, + & excludeSurfaceTags_n, + & offset, + & outDimTags, + & outDimTags_n, + & tag, + & ierr) + & bind(C,name="gmshModelOccAddThickSolid") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: volumeTag + integer (C_INT) :: excludeSurfaceTags(*) + integer (C_SIZE_T), value :: excludeSurfaceTags_n + real (C_DOUBLE), value :: offset + type (C_PTR), intent(out) :: outDimTags + integer (C_SIZE_T) :: outDimTags_n + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end subroutine gmshModelOccAddThickSolid + +! Extrude the entities `dimTags' in the OpenCASCADE CAD representation, using +! a translation along (`dx', `dy', `dz'). Return extruded entities in +! `outDimTags'. If `numElements' is not empty, also extrude the mesh: the +! entries in `numElements' give the number of elements in each layer. If +! `height' is not empty, it provides the (cumulative) height of the different +! layers, normalized to 1. If `recombine' is set, recombine the mesh in the +! layers. + subroutine gmshModelOccExtrude( + & dimTags, + & dimTags_n, + & dx, + & dy, + & dz, + & outDimTags, + & outDimTags_n, + & numElements, + & numElements_n, + & heights, + & heights_n, + & recombine, + & ierr) + & bind(C,name="gmshModelOccExtrude") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + real (C_DOUBLE), value :: dx + real (C_DOUBLE), value :: dy + real (C_DOUBLE), value :: dz + type (C_PTR), intent(out) :: outDimTags + integer (C_SIZE_T) :: outDimTags_n + integer (C_INT) :: numElements(*) + integer (C_SIZE_T), value :: numElements_n + real (C_DOUBLE) :: heights(*) + integer (C_SIZE_T), value :: heights_n + integer (C_INT), value :: recombine + integer (C_INT) :: ierr + end subroutine gmshModelOccExtrude + +! Extrude the entities `dimTags' in the OpenCASCADE CAD representation, using +! a rotation of `angle' radians around the axis of revolution defined by the +! point (`x', `y', `z') and the direction (`ax', `ay', `az'). Return extruded +! entities in `outDimTags'. If `numElements' is not empty, also extrude the +! mesh: the entries in `numElements' give the number of elements in each +! layer. If `height' is not empty, it provides the (cumulative) height of the +! different layers, normalized to 1. When the mesh is extruded the angle +! should be strictly smaller than 2*Pi. If `recombine' is set, recombine the +! mesh in the layers. + subroutine gmshModelOccRevolve( + & dimTags, + & dimTags_n, + & x, + & y, + & z, + & ax, + & ay, + & az, + & angle, + & outDimTags, + & outDimTags_n, + & numElements, + & numElements_n, + & heights, + & heights_n, + & recombine, + & ierr) + & bind(C,name="gmshModelOccRevolve") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + real (C_DOUBLE), value :: x + real (C_DOUBLE), value :: y + real (C_DOUBLE), value :: z + real (C_DOUBLE), value :: ax + real (C_DOUBLE), value :: ay + real (C_DOUBLE), value :: az + real (C_DOUBLE), value :: angle + type (C_PTR), intent(out) :: outDimTags + integer (C_SIZE_T) :: outDimTags_n + integer (C_INT) :: numElements(*) + integer (C_SIZE_T), value :: numElements_n + real (C_DOUBLE) :: heights(*) + integer (C_SIZE_T), value :: heights_n + integer (C_INT), value :: recombine + integer (C_INT) :: ierr + end subroutine gmshModelOccRevolve + +! Add a pipe in the OpenCASCADE CAD representation, by extruding the entities +! `dimTags' along the wire `wireTag'. The type of sweep can be specified with +! `trihedron' (possible values: "DiscreteTrihedron", "CorrectedFrenet", +! "Fixed", "Frenet", "ConstantNormal", "Darboux", "GuideAC", "GuidePlan", +! "GuideACWithContact", "GuidePlanWithContact"). If `trihedron' is not +! provided, "DiscreteTrihedron" is assumed. Return the pipe in `outDimTags'. + subroutine gmshModelOccAddPipe( + & dimTags, + & dimTags_n, + & wireTag, + & outDimTags, + & outDimTags_n, + & trihedron, + & ierr) + & bind(C,name="gmshModelOccAddPipe") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + integer (C_INT), value :: wireTag + type (C_PTR), intent(out) :: outDimTags + integer (C_SIZE_T) :: outDimTags_n + character (LEN=1,KIND=C_CHAR) :: trihedron(*) + integer (C_INT) :: ierr + end subroutine gmshModelOccAddPipe + +! Fillet the volumes `volumeTags' on the curves `curveTags' with radii +! `radii'. The `radii' vector can either contain a single radius, as many +! radii as `curveTags', or twice as many as `curveTags' (in which case +! different radii are provided for the begin and end points of the curves). +! Return the filleted entities in `outDimTags'. Remove the original volume if +! `removeVolume' is set. + subroutine gmshModelOccFillet( + & volumeTags, + & volumeTags_n, + & curveTags, + & curveTags_n, + & radii, + & radii_n, + & outDimTags, + & outDimTags_n, + & removeVolume, + & ierr) + & bind(C,name="gmshModelOccFillet") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: volumeTags(*) + integer (C_SIZE_T), value :: volumeTags_n + integer (C_INT) :: curveTags(*) + integer (C_SIZE_T), value :: curveTags_n + real (C_DOUBLE) :: radii(*) + integer (C_SIZE_T), value :: radii_n + type (C_PTR), intent(out) :: outDimTags + integer (C_SIZE_T) :: outDimTags_n + integer (C_INT), value :: removeVolume + integer (C_INT) :: ierr + end subroutine gmshModelOccFillet + +! Chamfer the volumes `volumeTags' on the curves `curveTags' with distances +! `distances' measured on surfaces `surfaceTags'. The `distances' vector can +! either contain a single distance, as many distances as `curveTags' and +! `surfaceTags', or twice as many as `curveTags' and `surfaceTags' (in which +! case the first in each pair is measured on the corresponding surface in +! `surfaceTags', the other on the other adjacent surface). Return the +! chamfered entities in `outDimTags'. Remove the original volume if +! `removeVolume' is set. + subroutine gmshModelOccChamfer( + & volumeTags, + & volumeTags_n, + & curveTags, + & curveTags_n, + & surfaceTags, + & surfaceTags_n, + & distances, + & distances_n, + & outDimTags, + & outDimTags_n, + & removeVolume, + & ierr) + & bind(C,name="gmshModelOccChamfer") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: volumeTags(*) + integer (C_SIZE_T), value :: volumeTags_n + integer (C_INT) :: curveTags(*) + integer (C_SIZE_T), value :: curveTags_n + integer (C_INT) :: surfaceTags(*) + integer (C_SIZE_T), value :: surfaceTags_n + real (C_DOUBLE) :: distances(*) + integer (C_SIZE_T), value :: distances_n + type (C_PTR), intent(out) :: outDimTags + integer (C_SIZE_T) :: outDimTags_n + integer (C_INT), value :: removeVolume + integer (C_INT) :: ierr + end subroutine gmshModelOccChamfer + +! Compute the boolean union (the fusion) of the entities `objectDimTags' and +! `toolDimTags' in the OpenCASCADE CAD representation. Return the resulting +! entities in `outDimTags'. If `tag' is positive, try to set the tag +! explicitly (only valid if the boolean operation results in a single +! entity). Remove the object if `removeObject' is set. Remove the tool if +! `removeTool' is set. + subroutine gmshModelOccFuse( + & objectDimTags, + & objectDimTags_n, + & toolDimTags, + & toolDimTags_n, + & outDimTags, + & outDimTags_n, + & outDimTagsMap, + & outDimTagsMap_n, + & outDimTagsMap_nn, + & tag, + & removeObject, + & removeTool, + & ierr) + & bind(C,name="gmshModelOccFuse") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: objectDimTags(*) + integer (C_SIZE_T), value :: objectDimTags_n + integer (C_INT) :: toolDimTags(*) + integer (C_SIZE_T), value :: toolDimTags_n + type (C_PTR), intent(out) :: outDimTags + integer (C_SIZE_T) :: outDimTags_n + type (C_PTR), intent(out) :: outDimTagsMap + type (C_PTR), intent(out) :: outDimTagsMap_n + integer (C_SIZE_T) :: outDimTagsMap_nn + integer (C_INT), value :: tag + integer (C_INT), value :: removeObject + integer (C_INT), value :: removeTool + integer (C_INT) :: ierr + end subroutine gmshModelOccFuse + +! Compute the boolean intersection (the common parts) of the entities +! `objectDimTags' and `toolDimTags' in the OpenCASCADE CAD representation. +! Return the resulting entities in `outDimTags'. If `tag' is positive, try to +! set the tag explicitly (only valid if the boolean operation results in a +! single entity). Remove the object if `removeObject' is set. Remove the tool +! if `removeTool' is set. + subroutine gmshModelOccIntersect( + & objectDimTags, + & objectDimTags_n, + & toolDimTags, + & toolDimTags_n, + & outDimTags, + & outDimTags_n, + & outDimTagsMap, + & outDimTagsMap_n, + & outDimTagsMap_nn, + & tag, + & removeObject, + & removeTool, + & ierr) + & bind(C,name="gmshModelOccIntersect") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: objectDimTags(*) + integer (C_SIZE_T), value :: objectDimTags_n + integer (C_INT) :: toolDimTags(*) + integer (C_SIZE_T), value :: toolDimTags_n + type (C_PTR), intent(out) :: outDimTags + integer (C_SIZE_T) :: outDimTags_n + type (C_PTR), intent(out) :: outDimTagsMap + type (C_PTR), intent(out) :: outDimTagsMap_n + integer (C_SIZE_T) :: outDimTagsMap_nn + integer (C_INT), value :: tag + integer (C_INT), value :: removeObject + integer (C_INT), value :: removeTool + integer (C_INT) :: ierr + end subroutine gmshModelOccIntersect + +! Compute the boolean difference between the entities `objectDimTags' and +! `toolDimTags' in the OpenCASCADE CAD representation. Return the resulting +! entities in `outDimTags'. If `tag' is positive, try to set the tag +! explicitly (only valid if the boolean operation results in a single +! entity). Remove the object if `removeObject' is set. Remove the tool if +! `removeTool' is set. + subroutine gmshModelOccCut( + & objectDimTags, + & objectDimTags_n, + & toolDimTags, + & toolDimTags_n, + & outDimTags, + & outDimTags_n, + & outDimTagsMap, + & outDimTagsMap_n, + & outDimTagsMap_nn, + & tag, + & removeObject, + & removeTool, + & ierr) + & bind(C,name="gmshModelOccCut") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: objectDimTags(*) + integer (C_SIZE_T), value :: objectDimTags_n + integer (C_INT) :: toolDimTags(*) + integer (C_SIZE_T), value :: toolDimTags_n + type (C_PTR), intent(out) :: outDimTags + integer (C_SIZE_T) :: outDimTags_n + type (C_PTR), intent(out) :: outDimTagsMap + type (C_PTR), intent(out) :: outDimTagsMap_n + integer (C_SIZE_T) :: outDimTagsMap_nn + integer (C_INT), value :: tag + integer (C_INT), value :: removeObject + integer (C_INT), value :: removeTool + integer (C_INT) :: ierr + end subroutine gmshModelOccCut + +! Compute the boolean fragments (general fuse) resulting from the +! intersection of the entities `objectDimTags' and `toolDimTags' in the +! OpenCASCADE CAD representation, making all iterfaces conformal. When +! applied to entities of different dimensions, the lower dimensional entities +! will be automatically embedded in the higher dimensional entities if they +! are not on their boundary. Return the resulting entities in `outDimTags'. +! If `tag' is positive, try to set the tag explicitly (only valid if the +! boolean operation results in a single entity). Remove the object if +! `removeObject' is set. Remove the tool if `removeTool' is set. + subroutine gmshModelOccFragment( + & objectDimTags, + & objectDimTags_n, + & toolDimTags, + & toolDimTags_n, + & outDimTags, + & outDimTags_n, + & outDimTagsMap, + & outDimTagsMap_n, + & outDimTagsMap_nn, + & tag, + & removeObject, + & removeTool, + & ierr) + & bind(C,name="gmshModelOccFragment") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: objectDimTags(*) + integer (C_SIZE_T), value :: objectDimTags_n + integer (C_INT) :: toolDimTags(*) + integer (C_SIZE_T), value :: toolDimTags_n + type (C_PTR), intent(out) :: outDimTags + integer (C_SIZE_T) :: outDimTags_n + type (C_PTR), intent(out) :: outDimTagsMap + type (C_PTR), intent(out) :: outDimTagsMap_n + integer (C_SIZE_T) :: outDimTagsMap_nn + integer (C_INT), value :: tag + integer (C_INT), value :: removeObject + integer (C_INT), value :: removeTool + integer (C_INT) :: ierr + end subroutine gmshModelOccFragment + +! Translate the entities `dimTags' in the OpenCASCADE CAD representation +! along (`dx', `dy', `dz'). + subroutine gmshModelOccTranslate( + & dimTags, + & dimTags_n, + & dx, + & dy, + & dz, + & ierr) + & bind(C,name="gmshModelOccTranslate") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + real (C_DOUBLE), value :: dx + real (C_DOUBLE), value :: dy + real (C_DOUBLE), value :: dz + integer (C_INT) :: ierr + end subroutine gmshModelOccTranslate + +! Rotate the entities `dimTags' in the OpenCASCADE CAD representation by +! `angle' radians around the axis of revolution defined by the point (`x', +! `y', `z') and the direction (`ax', `ay', `az'). + subroutine gmshModelOccRotate( + & dimTags, + & dimTags_n, + & x, + & y, + & z, + & ax, + & ay, + & az, + & angle, + & ierr) + & bind(C,name="gmshModelOccRotate") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + real (C_DOUBLE), value :: x + real (C_DOUBLE), value :: y + real (C_DOUBLE), value :: z + real (C_DOUBLE), value :: ax + real (C_DOUBLE), value :: ay + real (C_DOUBLE), value :: az + real (C_DOUBLE), value :: angle + integer (C_INT) :: ierr + end subroutine gmshModelOccRotate + +! Scale the entities `dimTags' in the OpenCASCADE CAD representation by +! factors `a', `b' and `c' along the three coordinate axes; use (`x', `y', +! `z') as the center of the homothetic transformation. + subroutine gmshModelOccDilate( + & dimTags, + & dimTags_n, + & x, + & y, + & z, + & a, + & b, + & c, + & ierr) + & bind(C,name="gmshModelOccDilate") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + real (C_DOUBLE), value :: x + real (C_DOUBLE), value :: y + real (C_DOUBLE), value :: z + real (C_DOUBLE), value :: a + real (C_DOUBLE), value :: b + real (C_DOUBLE), value :: c + integer (C_INT) :: ierr + end subroutine gmshModelOccDilate + +! Mirror the entities `dimTags' in the OpenCASCADE CAD representation, with +! respect to the plane of equation `a' * x + `b' * y + `c' * z + `d' = 0. + subroutine gmshModelOccMirror( + & dimTags, + & dimTags_n, + & a, + & b, + & c, + & d, + & ierr) + & bind(C,name="gmshModelOccMirror") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + real (C_DOUBLE), value :: a + real (C_DOUBLE), value :: b + real (C_DOUBLE), value :: c + real (C_DOUBLE), value :: d + integer (C_INT) :: ierr + end subroutine gmshModelOccMirror + +! Mirror the entities `dimTags' in the OpenCASCADE CAD representation, with +! respect to the plane of equation `a' * x + `b' * y + `c' * z + `d' = 0. +! (This is a deprecated synonym for `mirror'.) + subroutine gmshModelOccSymmetrize( + & dimTags, + & dimTags_n, + & a, + & b, + & c, + & d, + & ierr) + & bind(C,name="gmshModelOccSymmetrize") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + real (C_DOUBLE), value :: a + real (C_DOUBLE), value :: b + real (C_DOUBLE), value :: c + real (C_DOUBLE), value :: d + integer (C_INT) :: ierr + end subroutine gmshModelOccSymmetrize + +! Apply a general affine transformation matrix `affineTransform' (16 entries +! of a 4x4 matrix, by row; only the 12 first can be provided for convenience) +! to the entities `dimTags' in the OpenCASCADE CAD representation. + subroutine gmshModelOccAffineTransform( + & dimTags, + & dimTags_n, + & affineTransform, + & affineTransform_n, + & ierr) + & bind(C,name="gmshModelOccAffineTransform") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + real (C_DOUBLE) :: affineTransform(*) + integer (C_SIZE_T), value :: affineTransform_n + integer (C_INT) :: ierr + end subroutine gmshModelOccAffineTransform + +! Copy the entities `dimTags' in the OpenCASCADE CAD representation; the new +! entities are returned in `outDimTags'. + subroutine gmshModelOccCopy( + & dimTags, + & dimTags_n, + & outDimTags, + & outDimTags_n, + & ierr) + & bind(C,name="gmshModelOccCopy") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + type (C_PTR), intent(out) :: outDimTags + integer (C_SIZE_T) :: outDimTags_n + integer (C_INT) :: ierr + end subroutine gmshModelOccCopy + +! Remove the entities `dimTags' in the OpenCASCADE CAD representation, +! provided that they are not on the boundary of higher-dimensional entities. +! If `recursive' is true, remove all the entities on their boundaries, down +! to dimension 0. + subroutine gmshModelOccRemove( + & dimTags, + & dimTags_n, + & recursive, + & ierr) + & bind(C,name="gmshModelOccRemove") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + integer (C_INT), value :: recursive + integer (C_INT) :: ierr + end subroutine gmshModelOccRemove + +! Remove all duplicate entities in the OpenCASCADE CAD representation +! (different entities at the same geometrical location) after intersecting +! (using boolean fragments) all highest dimensional entities. + subroutine gmshModelOccRemoveAllDuplicates( + & ierr) + & bind(C,name="gmshModelOccRemoveAllDuplicates") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: ierr + end subroutine gmshModelOccRemoveAllDuplicates + +! Apply various healing procedures to the entities `dimTags' (or to all the +! entities in the model if `dimTags' is empty) in the OpenCASCADE CAD +! representation. Return the healed entities in `outDimTags'. Available +! healing options are listed in the Gmsh reference manual. + subroutine gmshModelOccHealShapes( + & outDimTags, + & outDimTags_n, + & dimTags, + & dimTags_n, + & tolerance, + & fixDegenerated, + & fixSmallEdges, + & fixSmallFaces, + & sewFaces, + & makeSolids, + & ierr) + & bind(C,name="gmshModelOccHealShapes") + use, intrinsic :: ISO_C_BINDING + type (C_PTR), intent(out) :: outDimTags + integer (C_SIZE_T) :: outDimTags_n + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + real (C_DOUBLE), value :: tolerance + integer (C_INT), value :: fixDegenerated + integer (C_INT), value :: fixSmallEdges + integer (C_INT), value :: fixSmallFaces + integer (C_INT), value :: sewFaces + integer (C_INT), value :: makeSolids + integer (C_INT) :: ierr + end subroutine gmshModelOccHealShapes + +! Import BREP, STEP or IGES shapes from the file `fileName' in the +! OpenCASCADE CAD representation. The imported entities are returned in +! `outDimTags'. If the optional argument `highestDimOnly' is set, only import +! the highest dimensional entities in the file. The optional argument +! `format' can be used to force the format of the file (currently "brep", +! "step" or "iges"). + subroutine gmshModelOccImportShapes( + & fileName, + & outDimTags, + & outDimTags_n, + & highestDimOnly, + & format, + & ierr) + & bind(C,name="gmshModelOccImportShapes") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: fileName(*) + type (C_PTR), intent(out) :: outDimTags + integer (C_SIZE_T) :: outDimTags_n + integer (C_INT), value :: highestDimOnly + character (LEN=1,KIND=C_CHAR) :: format(*) + integer (C_INT) :: ierr + end subroutine gmshModelOccImportShapes + +! Imports an OpenCASCADE `shape' by providing a pointer to a native +! OpenCASCADE `TopoDS_Shape' object (passed as a pointer to void). The +! imported entities are returned in `outDimTags'. If the optional argument +! `highestDimOnly' is set, only import the highest dimensional entities in +! `shape'. For C and C++ only. Warning: this function is unsafe, as providing +! an invalid pointer will lead to undefined behavior. + subroutine gmshModelOccImportShapesNativePointer( + & shape, + & outDimTags, + & outDimTags_n, + & highestDimOnly, + & ierr) + & bind(C,name="gmshModelOccImportShapesNativePointer") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: shape(*) + type (C_PTR), intent(out) :: outDimTags + integer (C_SIZE_T) :: outDimTags_n + integer (C_INT), value :: highestDimOnly + integer (C_INT) :: ierr + end subroutine gmshModelOccImportShapesNativePointer + +! Get all the OpenCASCADE entities. If `dim' is >= 0, return only the +! entities of the specified dimension (e.g. points if `dim' == 0). The +! entities are returned as a vector of (dim, tag) integer pairs. + subroutine gmshModelOccGetEntities( + & dimTags, + & dimTags_n, + & dim, + & ierr) + & bind(C,name="gmshModelOccGetEntities") + use, intrinsic :: ISO_C_BINDING + type (C_PTR), intent(out) :: dimTags + integer (C_SIZE_T) :: dimTags_n + integer (C_INT), value :: dim + integer (C_INT) :: ierr + end subroutine gmshModelOccGetEntities + +! Get the OpenCASCADE entities in the bounding box defined by the two points +! (`xmin', `ymin', `zmin') and (`xmax', `ymax', `zmax'). If `dim' is >= 0, +! return only the entities of the specified dimension (e.g. points if `dim' +! == 0). + subroutine gmshModelOccGetEntitiesInBoundingBox( + & xmin, + & ymin, + & zmin, + & xmax, + & ymax, + & zmax, + & tags, + & tags_n, + & dim, + & ierr) + & bind(C,name="gmshModelOccGetEntitiesInBoundingBox") + use, intrinsic :: ISO_C_BINDING + real (C_DOUBLE), value :: xmin + real (C_DOUBLE), value :: ymin + real (C_DOUBLE), value :: zmin + real (C_DOUBLE), value :: xmax + real (C_DOUBLE), value :: ymax + real (C_DOUBLE), value :: zmax + type (C_PTR), intent(out) :: tags + integer (C_SIZE_T) :: tags_n + integer (C_INT), value :: dim + integer (C_INT) :: ierr + end subroutine gmshModelOccGetEntitiesInBoundingBox + +! Get the bounding box (`xmin', `ymin', `zmin'), (`xmax', `ymax', `zmax') of +! the OpenCASCADE entity of dimension `dim' and tag `tag'. + subroutine gmshModelOccGetBoundingBox( + & dim, + & tag, + & xmin, + & ymin, + & zmin, + & xmax, + & ymax, + & zmax, + & ierr) + & bind(C,name="gmshModelOccGetBoundingBox") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + real (C_DOUBLE) :: xmin + real (C_DOUBLE) :: ymin + real (C_DOUBLE) :: zmin + real (C_DOUBLE) :: xmax + real (C_DOUBLE) :: ymax + real (C_DOUBLE) :: zmax + integer (C_INT) :: ierr + end subroutine gmshModelOccGetBoundingBox + +! Get the mass of the OpenCASCADE entity of dimension `dim' and tag `tag'. + subroutine gmshModelOccGetMass( + & dim, + & tag, + & mass, + & ierr) + & bind(C,name="gmshModelOccGetMass") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + real (C_DOUBLE) :: mass + integer (C_INT) :: ierr + end subroutine gmshModelOccGetMass + +! Get the center of mass of the OpenCASCADE entity of dimension `dim' and tag +! `tag'. + subroutine gmshModelOccGetCenterOfMass( + & dim, + & tag, + & x, + & y, + & z, + & ierr) + & bind(C,name="gmshModelOccGetCenterOfMass") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + real (C_DOUBLE) :: x + real (C_DOUBLE) :: y + real (C_DOUBLE) :: z + integer (C_INT) :: ierr + end subroutine gmshModelOccGetCenterOfMass + +! Get the matrix of inertia (by row) of the OpenCASCADE entity of dimension +! `dim' and tag `tag'. + subroutine gmshModelOccGetMatrixOfInertia( + & dim, + & tag, + & mat, + & mat_n, + & ierr) + & bind(C,name="gmshModelOccGetMatrixOfInertia") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + type (C_PTR), intent(out) :: mat + integer (C_SIZE_T) :: mat_n + integer (C_INT) :: ierr + end subroutine gmshModelOccGetMatrixOfInertia + +! Get the maximum tag of entities of dimension `dim' in the OpenCASCADE CAD +! representation. + function gmshModelOccGetMaxTag( + & dim, + & ierr) + & bind(C,name="gmshModelOccGetMaxTag") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshModelOccGetMaxTag + integer (C_INT), value :: dim + integer (C_INT) :: ierr + end function gmshModelOccGetMaxTag + +! Set the maximum tag `maxTag' for entities of dimension `dim' in the +! OpenCASCADE CAD representation. + subroutine gmshModelOccSetMaxTag( + & dim, + & maxTag, + & ierr) + & bind(C,name="gmshModelOccSetMaxTag") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: maxTag + integer (C_INT) :: ierr + end subroutine gmshModelOccSetMaxTag + +! Synchronize the OpenCASCADE CAD representation with the current Gmsh model. +! This can be called at any time, but since it involves a non trivial amount +! of processing, the number of synchronization points should normally be +! minimized. Without synchronization the entities in the OpenCASCADE CAD +! representation are not available to any function outside of the OpenCASCADE +! CAD kernel functions. + subroutine gmshModelOccSynchronize( + & ierr) + & bind(C,name="gmshModelOccSynchronize") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: ierr + end subroutine gmshModelOccSynchronize + +! Set a mesh size constraint on the entities `dimTags' in the OpenCASCADE CAD +! representation. Currently only entities of dimension 0 (points) are +! handled. + subroutine gmshModelOccMeshSetSize( + & dimTags, + & dimTags_n, + & size, + & ierr) + & bind(C,name="gmshModelOccMeshSetSize") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: dimTags(*) + integer (C_SIZE_T), value :: dimTags_n + real (C_DOUBLE), value :: size + integer (C_INT) :: ierr + end subroutine gmshModelOccMeshSetSize + +! Add a new post-processing view, with name `name'. If `tag' is positive use +! it (and remove the view with that tag if it already exists), otherwise +! associate a new tag. Return the view tag. + function gmshViewAdd( + & name, + & tag, + & ierr) + & bind(C,name="gmshViewAdd") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshViewAdd + character (LEN=1,KIND=C_CHAR) :: name(*) + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshViewAdd + +! Remove the view with tag `tag'. + subroutine gmshViewRemove( + & tag, + & ierr) + & bind(C,name="gmshViewRemove") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end subroutine gmshViewRemove + +! Get the index of the view with tag `tag' in the list of currently loaded +! views. This dynamic index (it can change when views are removed) is used to +! access view options. + function gmshViewGetIndex( + & tag, + & ierr) + & bind(C,name="gmshViewGetIndex") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshViewGetIndex + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshViewGetIndex + +! Get the tags of all views. + subroutine gmshViewGetTags( + & tags, + & tags_n, + & ierr) + & bind(C,name="gmshViewGetTags") + use, intrinsic :: ISO_C_BINDING + type (C_PTR), intent(out) :: tags + integer (C_SIZE_T) :: tags_n + integer (C_INT) :: ierr + end subroutine gmshViewGetTags + +! Add model-based post-processing data to the view with tag `tag'. +! `modelName' identifies the model the data is attached to. `dataType' +! specifies the type of data, currently either "NodeData", "ElementData" or +! "ElementNodeData". `step' specifies the identifier (>= 0) of the data in a +! sequence. `tags' gives the tags of the nodes or elements in the mesh to +! which the data is associated. `data' is a vector of the same length as +! `tags': each entry is the vector of double precision numbers representing +! the data associated with the corresponding tag. The optional `time' +! argument associate a time value with the data. `numComponents' gives the +! number of data components (1 for scalar data, 3 for vector data, etc.) per +! entity; if negative, it is automatically inferred (when possible) from the +! input data. `partition' allows one to specify data in several sub-sets. + subroutine gmshViewAddModelData( + & tag, + & step, + & modelName, + & dataType, + & tags, + & tags_n, + & data, + & data_n, + & data_nn, + & time, + & numComponents, + & partition, + & ierr) + & bind(C,name="gmshViewAddModelData") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + integer (C_INT), value :: step + character (LEN=1,KIND=C_CHAR) :: modelName(*) + character (LEN=1,KIND=C_CHAR) :: dataType(*) + integer (C_SIZE_T) :: tags(*) + integer (C_SIZE_T), value :: tags_n + type (C_PTR), intent(out) :: data + type (C_PTR), intent(out) :: data_n + integer (C_SIZE_T) :: data_nn + real (C_DOUBLE), value :: time + integer (C_INT), value :: numComponents + integer (C_INT), value :: partition + integer (C_INT) :: ierr + end subroutine gmshViewAddModelData + +! Add homogeneous model-based post-processing data to the view with tag +! `tag'. The arguments have the same meaning as in `addModelData', except +! that `data' is supposed to be homogeneous and is thus flattened in a single +! vector. For data types that can lead to different data sizes per tag (like +! "ElementNodeData"), the data should be padded. + subroutine gmshViewAddHomogeneousModelData( + & tag, + & step, + & modelName, + & dataType, + & tags, + & tags_n, + & data, + & data_n, + & time, + & numComponents, + & partition, + & ierr) + & bind(C,name="gmshViewAddHomogeneousModelData") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + integer (C_INT), value :: step + character (LEN=1,KIND=C_CHAR) :: modelName(*) + character (LEN=1,KIND=C_CHAR) :: dataType(*) + integer (C_SIZE_T) :: tags(*) + integer (C_SIZE_T), value :: tags_n + real (C_DOUBLE) :: data(*) + integer (C_SIZE_T), value :: data_n + real (C_DOUBLE), value :: time + integer (C_INT), value :: numComponents + integer (C_INT), value :: partition + integer (C_INT) :: ierr + end subroutine gmshViewAddHomogeneousModelData + +! Get model-based post-processing data from the view with tag `tag' at step +! `step'. Return the `data' associated to the nodes or the elements with tags +! `tags', as well as the `dataType' and the number of components +! `numComponents'. + subroutine gmshViewGetModelData( + & tag, + & step, + & dataType, + & tags, + & tags_n, + & data, + & data_n, + & data_nn, + & time, + & numComponents, + & ierr) + & bind(C,name="gmshViewGetModelData") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + integer (C_INT), value :: step + type (C_PTR) :: dataType(*) + type (C_PTR), intent(out) :: tags + integer (C_SIZE_T) :: tags_n + type (C_PTR), intent(out) :: data + type (C_PTR), intent(out) :: data_n + integer (C_SIZE_T) :: data_nn + real (C_DOUBLE) :: time + integer (C_INT) :: numComponents + integer (C_INT) :: ierr + end subroutine gmshViewGetModelData + +! Get homogeneous model-based post-processing data from the view with tag +! `tag' at step `step'. The arguments have the same meaning as in +! `getModelData', except that `data' is returned flattened in a single +! vector, with the appropriate padding if necessary. + subroutine gmshViewGetHomogeneousModelData( + & tag, + & step, + & dataType, + & tags, + & tags_n, + & data, + & data_n, + & time, + & numComponents, + & ierr) + & bind(C,name="gmshViewGetHomogeneousModelData") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + integer (C_INT), value :: step + type (C_PTR) :: dataType(*) + type (C_PTR), intent(out) :: tags + integer (C_SIZE_T) :: tags_n + type (C_PTR), intent(out) :: data + integer (C_SIZE_T) :: data_n + real (C_DOUBLE) :: time + integer (C_INT) :: numComponents + integer (C_INT) :: ierr + end subroutine gmshViewGetHomogeneousModelData + +! Add list-based post-processing data to the view with tag `tag'. List-based +! datasets are independent from any model and any mesh. `dataType' identifies +! the data by concatenating the field type ("S" for scalar, "V" for vector, +! "T" for tensor) and the element type ("P" for point, "L" for line, "T" for +! triangle, "S" for tetrahedron, "I" for prism, "H" for hexaHedron, "Y" for +! pyramid). For example `dataType' should be "ST" for a scalar field on +! triangles. `numEle' gives the number of elements in the data. `data' +! contains the data for the `numEle' elements, concatenated, with node +! coordinates followed by values per node, repeated for each step: [e1x1, +! ..., e1xn, e1y1, ..., e1yn, e1z1, ..., e1zn, e1v1..., e1vN, e2x1, ...]. + subroutine gmshViewAddListData( + & tag, + & dataType, + & numEle, + & data, + & data_n, + & ierr) + & bind(C,name="gmshViewAddListData") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + character (LEN=1,KIND=C_CHAR) :: dataType(*) + integer (C_INT), value :: numEle + real (C_DOUBLE) :: data(*) + integer (C_SIZE_T), value :: data_n + integer (C_INT) :: ierr + end subroutine gmshViewAddListData + +! Get list-based post-processing data from the view with tag `tag'. Return +! the types `dataTypes', the number of elements `numElements' for each data +! type and the `data' for each data type. + subroutine gmshViewGetListData( + & tag, + & dataType, + & dataType_n, + & numElements, + & numElements_n, + & data, + & data_n, + & data_nn, + & ierr) + & bind(C,name="gmshViewGetListData") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + type (C_PTR), intent(out) :: dataType + integer (C_SIZE_T) :: dataType_n + type (C_PTR), intent(out) :: numElements + integer (C_SIZE_T) :: numElements_n + type (C_PTR), intent(out) :: data + type (C_PTR), intent(out) :: data_n + integer (C_SIZE_T) :: data_nn + integer (C_INT) :: ierr + end subroutine gmshViewGetListData + +! Add a string to a list-based post-processing view with tag `tag'. If +! `coord' contains 3 coordinates the string is positioned in the 3D model +! space ("3D string"); if it contains 2 coordinates it is positioned in the +! 2D graphics viewport ("2D string"). `data' contains one or more (for +! multistep views) strings. `style' contains key-value pairs of styling +! parameters, concatenated. Available keys are "Font" (possible values: +! "Times-Roman", "Times-Bold", "Times-Italic", "Times-BoldItalic", +! "Helvetica", "Helvetica-Bold", "Helvetica-Oblique", "Helvetica- +! BoldOblique", "Courier", "Courier-Bold", "Courier-Oblique", "Courier- +! BoldOblique", "Symbol", "ZapfDingbats", "Screen"), "FontSize" and "Align" +! (possible values: "Left" or "BottomLeft", "Center" or "BottomCenter", +! "Right" or "BottomRight", "TopLeft", "TopCenter", "TopRight", "CenterLeft", +! "CenterCenter", "CenterRight"). + subroutine gmshViewAddListDataString( + & tag, + & coord, + & coord_n, + & data, + & data_n, + & style, + & style_n, + & ierr) + & bind(C,name="gmshViewAddListDataString") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + real (C_DOUBLE) :: coord(*) + integer (C_SIZE_T), value :: coord_n + type (C_PTR) :: data(*) + integer (C_SIZE_T), value :: data_n + type (C_PTR) :: style(*) + integer (C_SIZE_T), value :: style_n + integer (C_INT) :: ierr + end subroutine gmshViewAddListDataString + +! Get list-based post-processing data strings (2D strings if `dim' = 2, 3D +! strings if `dim' = 3) from the view with tag `tag'. Return the coordinates +! in `coord', the strings in `data' and the styles in `style'. + subroutine gmshViewGetListDataStrings( + & tag, + & dim, + & coord, + & coord_n, + & data, + & data_n, + & style, + & style_n, + & ierr) + & bind(C,name="gmshViewGetListDataStrings") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + integer (C_INT), value :: dim + type (C_PTR), intent(out) :: coord + integer (C_SIZE_T) :: coord_n + type (C_PTR), intent(out) :: data + integer (C_SIZE_T) :: data_n + type (C_PTR), intent(out) :: style + integer (C_SIZE_T) :: style_n + integer (C_INT) :: ierr + end subroutine gmshViewGetListDataStrings + +! Set interpolation matrices for the element family `type' ("Line", +! "Triangle", "Quadrangle", "Tetrahedron", "Hexahedron", "Prism", "Pyramid") +! in the view `tag'. The approximation of the values over an element is +! written as a linear combination of `d' basis functions f_i(u, v, w) = +! sum_(j = 0, ..., `d' - 1) `coef'[i][j] u^`exp'[j][0] v^`exp'[j][1] +! w^`exp'[j][2], i = 0, ..., `d'-1, with u, v, w the coordinates in the +! reference element. The `coef' matrix (of size `d' x `d') and the `exp' +! matrix (of size `d' x 3) are stored as vectors, by row. If `dGeo' is +! positive, use `coefGeo' and `expGeo' to define the interpolation of the x, +! y, z coordinates of the element in terms of the u, v, w coordinates, in +! exactly the same way. If `d' < 0, remove the interpolation matrices. + subroutine gmshViewSetInterpolationMatrices( + & tag, + & type, + & d, + & coef, + & coef_n, + & exp, + & exp_n, + & dGeo, + & coefGeo, + & coefGeo_n, + & expGeo, + & expGeo_n, + & ierr) + & bind(C,name="gmshViewSetInterpolationMatrices") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + character (LEN=1,KIND=C_CHAR) :: type(*) + integer (C_INT), value :: d + real (C_DOUBLE) :: coef(*) + integer (C_SIZE_T), value :: coef_n + real (C_DOUBLE) :: exp(*) + integer (C_SIZE_T), value :: exp_n + integer (C_INT), value :: dGeo + real (C_DOUBLE) :: coefGeo(*) + integer (C_SIZE_T), value :: coefGeo_n + real (C_DOUBLE) :: expGeo(*) + integer (C_SIZE_T), value :: expGeo_n + integer (C_INT) :: ierr + end subroutine gmshViewSetInterpolationMatrices + +! Add a post-processing view as an `alias' of the reference view with tag +! `refTag'. If `copyOptions' is set, copy the options of the reference view. +! If `tag' is positive use it (and remove the view with that tag if it +! already exists), otherwise associate a new tag. Return the view tag. + function gmshViewAddAlias( + & refTag, + & copyOptions, + & tag, + & ierr) + & bind(C,name="gmshViewAddAlias") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshViewAddAlias + integer (C_INT), value :: refTag + integer (C_INT), value :: copyOptions + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end function gmshViewAddAlias + +! Copy the options from the view with tag `refTag' to the view with tag +! `tag'. + subroutine gmshViewCopyOptions( + & refTag, + & tag, + & ierr) + & bind(C,name="gmshViewCopyOptions") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: refTag + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end subroutine gmshViewCopyOptions + +! Combine elements (if `what' == "elements") or steps (if `what' == "steps") +! of all views (`how' == "all"), all visible views (`how' == "visible") or +! all views having the same name (`how' == "name"). Remove original views if +! `remove' is set. + subroutine gmshViewCombine( + & what, + & how, + & remove, + & copyOptions, + & ierr) + & bind(C,name="gmshViewCombine") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: what(*) + character (LEN=1,KIND=C_CHAR) :: how(*) + integer (C_INT), value :: remove + integer (C_INT), value :: copyOptions + integer (C_INT) :: ierr + end subroutine gmshViewCombine + +! Probe the view `tag' for its `value' at point (`x', `y', `z'). Return only +! the value at step `step' is `step' is positive. Return only values with +! `numComp' if `numComp' is positive. Return the gradient of the `value' if +! `gradient' is set. Probes with a geometrical tolerance (in the reference +! unit cube) of `tolerance' if `tolerance' is not zero. Return the result +! from the element described by its coordinates if `xElementCoord', +! `yElementCoord' and `zElementCoord' are provided. If `dim' is >= 0, return +! only elements of the specified dimension. + subroutine gmshViewProbe( + & tag, + & x, + & y, + & z, + & value, + & value_n, + & step, + & numComp, + & gradient, + & tolerance, + & xElemCoord, + & xElemCoord_n, + & yElemCoord, + & yElemCoord_n, + & zElemCoord, + & zElemCoord_n, + & dim, + & ierr) + & bind(C,name="gmshViewProbe") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + real (C_DOUBLE), value :: x + real (C_DOUBLE), value :: y + real (C_DOUBLE), value :: z + type (C_PTR), intent(out) :: value + integer (C_SIZE_T) :: value_n + integer (C_INT), value :: step + integer (C_INT), value :: numComp + integer (C_INT), value :: gradient + real (C_DOUBLE), value :: tolerance + real (C_DOUBLE) :: xElemCoord(*) + integer (C_SIZE_T), value :: xElemCoord_n + real (C_DOUBLE) :: yElemCoord(*) + integer (C_SIZE_T), value :: yElemCoord_n + real (C_DOUBLE) :: zElemCoord(*) + integer (C_SIZE_T), value :: zElemCoord_n + integer (C_INT), value :: dim + integer (C_INT) :: ierr + end subroutine gmshViewProbe + +! Write the view to a file `fileName'. The export format is determined by the +! file extension. Append to the file if `append' is set. + subroutine gmshViewWrite( + & tag, + & fileName, + & append, + & ierr) + & bind(C,name="gmshViewWrite") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + character (LEN=1,KIND=C_CHAR) :: fileName(*) + integer (C_INT), value :: append + integer (C_INT) :: ierr + end subroutine gmshViewWrite + +! Set the global visibility of the view `tag' per window to `value', where +! `windowIndex' identifies the window in the window list. + subroutine gmshViewSetVisibilityPerWindow( + & tag, + & value, + & windowIndex, + & ierr) + & bind(C,name="gmshViewSetVisibilityPerWindow") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: tag + integer (C_INT), value :: value + integer (C_INT), value :: windowIndex + integer (C_INT) :: ierr + end subroutine gmshViewSetVisibilityPerWindow + +! Set the numerical option `option' to the value `value' for plugin `name'. + subroutine gmshPluginSetNumber( + & name, + & option, + & value, + & ierr) + & bind(C,name="gmshPluginSetNumber") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: name(*) + character (LEN=1,KIND=C_CHAR) :: option(*) + real (C_DOUBLE), value :: value + integer (C_INT) :: ierr + end subroutine gmshPluginSetNumber + +! Set the string option `option' to the value `value' for plugin `name'. + subroutine gmshPluginSetString( + & name, + & option, + & value, + & ierr) + & bind(C,name="gmshPluginSetString") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: name(*) + character (LEN=1,KIND=C_CHAR) :: option(*) + character (LEN=1,KIND=C_CHAR) :: value(*) + integer (C_INT) :: ierr + end subroutine gmshPluginSetString + +! Run the plugin `name'. + subroutine gmshPluginRun( + & name, + & ierr) + & bind(C,name="gmshPluginRun") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: name(*) + integer (C_INT) :: ierr + end subroutine gmshPluginRun + +! Draw all the OpenGL scenes. + subroutine gmshGraphicsDraw( + & ierr) + & bind(C,name="gmshGraphicsDraw") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: ierr + end subroutine gmshGraphicsDraw + +! Create the FLTK graphical user interface. Can only be called in the main +! thread. + subroutine gmshFltkInitialize( + & ierr) + & bind(C,name="gmshFltkInitialize") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: ierr + end subroutine gmshFltkInitialize + +! Wait at most `time' seconds for user interface events and return. If `time' +! < 0, wait indefinitely. First automatically create the user interface if it +! has not yet been initialized. Can only be called in the main thread. + subroutine gmshFltkWait( + & time, + & ierr) + & bind(C,name="gmshFltkWait") + use, intrinsic :: ISO_C_BINDING + real (C_DOUBLE), value :: time + integer (C_INT) :: ierr + end subroutine gmshFltkWait + +! Update the user interface (potentially creating new widgets and windows). +! First automatically create the user interface if it has not yet been +! initialized. Can only be called in the main thread: use `awake("update")' +! to trigger an update of the user interface from another thread. + subroutine gmshFltkUpdate( + & ierr) + & bind(C,name="gmshFltkUpdate") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: ierr + end subroutine gmshFltkUpdate + +! Awake the main user interface thread and process pending events, and +! optionally perform an action (currently the only `action' allowed is +! "update"). + subroutine gmshFltkAwake( + & action, + & ierr) + & bind(C,name="gmshFltkAwake") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: action(*) + integer (C_INT) :: ierr + end subroutine gmshFltkAwake + +! Block the current thread until it can safely modify the user interface. + subroutine gmshFltkLock( + & ierr) + & bind(C,name="gmshFltkLock") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: ierr + end subroutine gmshFltkLock + +! Release the lock that was set using lock. + subroutine gmshFltkUnlock( + & ierr) + & bind(C,name="gmshFltkUnlock") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: ierr + end subroutine gmshFltkUnlock + +! Run the event loop of the graphical user interface, i.e. repeatedly call +! `wait()'. First automatically create the user interface if it has not yet +! been initialized. Can only be called in the main thread. + subroutine gmshFltkRun( + & ierr) + & bind(C,name="gmshFltkRun") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: ierr + end subroutine gmshFltkRun + +! Check if the user interface is available (e.g. to detect if it has been +! closed). + function gmshFltkIsAvailable( + & ierr) + & bind(C,name="gmshFltkIsAvailable") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshFltkIsAvailable + integer (C_INT) :: ierr + end function gmshFltkIsAvailable + +! Select entities in the user interface. If `dim' is >= 0, return only the +! entities of the specified dimension (e.g. points if `dim' == 0). + function gmshFltkSelectEntities( + & dimTags, + & dimTags_n, + & dim, + & ierr) + & bind(C,name="gmshFltkSelectEntities") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshFltkSelectEntities + type (C_PTR), intent(out) :: dimTags + integer (C_SIZE_T) :: dimTags_n + integer (C_INT), value :: dim + integer (C_INT) :: ierr + end function gmshFltkSelectEntities + +! Select elements in the user interface. + function gmshFltkSelectElements( + & elementTags, + & elementTags_n, + & ierr) + & bind(C,name="gmshFltkSelectElements") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshFltkSelectElements + type (C_PTR), intent(out) :: elementTags + integer (C_SIZE_T) :: elementTags_n + integer (C_INT) :: ierr + end function gmshFltkSelectElements + +! Select views in the user interface. + function gmshFltkSelectViews( + & viewTags, + & viewTags_n, + & ierr) + & bind(C,name="gmshFltkSelectViews") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: gmshFltkSelectViews + type (C_PTR), intent(out) :: viewTags + integer (C_SIZE_T) :: viewTags_n + integer (C_INT) :: ierr + end function gmshFltkSelectViews + +! Split the current window horizontally (if `how' = "h") or vertically (if +! `how' = "v"), using ratio `ratio'. If `how' = "u", restore a single window. + subroutine gmshFltkSplitCurrentWindow( + & how, + & ratio, + & ierr) + & bind(C,name="gmshFltkSplitCurrentWindow") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: how(*) + real (C_DOUBLE), value :: ratio + integer (C_INT) :: ierr + end subroutine gmshFltkSplitCurrentWindow + +! Set the current window by speficying its index (starting at 0) in the list +! of all windows. When new windows are created by splits, new windows are +! appended at the end of the list. + subroutine gmshFltkSetCurrentWindow( + & windowIndex, + & ierr) + & bind(C,name="gmshFltkSetCurrentWindow") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: windowIndex + integer (C_INT) :: ierr + end subroutine gmshFltkSetCurrentWindow + +! Set a status message in the current window. If `graphics' is set, display +! the message inside the graphic window instead of the status bar. + subroutine gmshFltkSetStatusMessage( + & message, + & graphics, + & ierr) + & bind(C,name="gmshFltkSetStatusMessage") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: message(*) + integer (C_INT), value :: graphics + integer (C_INT) :: ierr + end subroutine gmshFltkSetStatusMessage + +! Show context window for the entity of dimension `dim' and tag `tag'. + subroutine gmshFltkShowContextWindow( + & dim, + & tag, + & ierr) + & bind(C,name="gmshFltkShowContextWindow") + use, intrinsic :: ISO_C_BINDING + integer (C_INT), value :: dim + integer (C_INT), value :: tag + integer (C_INT) :: ierr + end subroutine gmshFltkShowContextWindow + +! Open the `name' item in the menu tree. + subroutine gmshFltkOpenTreeItem( + & name, + & ierr) + & bind(C,name="gmshFltkOpenTreeItem") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: name(*) + integer (C_INT) :: ierr + end subroutine gmshFltkOpenTreeItem + +! Close the `name' item in the menu tree. + subroutine gmshFltkCloseTreeItem( + & name, + & ierr) + & bind(C,name="gmshFltkCloseTreeItem") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: name(*) + integer (C_INT) :: ierr + end subroutine gmshFltkCloseTreeItem + +! Set one or more parameters in the ONELAB database, encoded in `format'. + subroutine gmshOnelabSet( + & data, + & format, + & ierr) + & bind(C,name="gmshOnelabSet") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: data(*) + character (LEN=1,KIND=C_CHAR) :: format(*) + integer (C_INT) :: ierr + end subroutine gmshOnelabSet + +! Get all the parameters (or a single one if `name' is specified) from the +! ONELAB database, encoded in `format'. + subroutine gmshOnelabGet( + & data, + & name, + & format, + & ierr) + & bind(C,name="gmshOnelabGet") + use, intrinsic :: ISO_C_BINDING + type (C_PTR) :: data(*) + character (LEN=1,KIND=C_CHAR) :: name(*) + character (LEN=1,KIND=C_CHAR) :: format(*) + integer (C_INT) :: ierr + end subroutine gmshOnelabGet + +! Get the names of the parameters in the ONELAB database matching the +! `search' regular expression. If `search' is empty, return all the names. + subroutine gmshOnelabGetNames( + & names, + & names_n, + & search, + & ierr) + & bind(C,name="gmshOnelabGetNames") + use, intrinsic :: ISO_C_BINDING + type (C_PTR), intent(out) :: names + integer (C_SIZE_T) :: names_n + character (LEN=1,KIND=C_CHAR) :: search(*) + integer (C_INT) :: ierr + end subroutine gmshOnelabGetNames + +! Set the value of the number parameter `name' in the ONELAB database. Create +! the parameter if it does not exist; update the value if the parameter +! exists. + subroutine gmshOnelabSetNumber( + & name, + & value, + & value_n, + & ierr) + & bind(C,name="gmshOnelabSetNumber") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: name(*) + real (C_DOUBLE) :: value(*) + integer (C_SIZE_T), value :: value_n + integer (C_INT) :: ierr + end subroutine gmshOnelabSetNumber + +! Set the value of the string parameter `name' in the ONELAB database. Create +! the parameter if it does not exist; update the value if the parameter +! exists. + subroutine gmshOnelabSetString( + & name, + & value, + & value_n, + & ierr) + & bind(C,name="gmshOnelabSetString") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: name(*) + type (C_PTR) :: value(*) + integer (C_SIZE_T), value :: value_n + integer (C_INT) :: ierr + end subroutine gmshOnelabSetString + +! Get the value of the number parameter `name' from the ONELAB database. +! Return an empty vector if the parameter does not exist. + subroutine gmshOnelabGetNumber( + & name, + & value, + & value_n, + & ierr) + & bind(C,name="gmshOnelabGetNumber") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: name(*) + type (C_PTR), intent(out) :: value + integer (C_SIZE_T) :: value_n + integer (C_INT) :: ierr + end subroutine gmshOnelabGetNumber + +! Get the value of the string parameter `name' from the ONELAB database. +! Return an empty vector if the parameter does not exist. + subroutine gmshOnelabGetString( + & name, + & value, + & value_n, + & ierr) + & bind(C,name="gmshOnelabGetString") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: name(*) + type (C_PTR), intent(out) :: value + integer (C_SIZE_T) :: value_n + integer (C_INT) :: ierr + end subroutine gmshOnelabGetString + +! Clear the ONELAB database, or remove a single parameter if `name' is given. + subroutine gmshOnelabClear( + & name, + & ierr) + & bind(C,name="gmshOnelabClear") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: name(*) + integer (C_INT) :: ierr + end subroutine gmshOnelabClear + +! Run a ONELAB client. If `name' is provided, create a new ONELAB client with +! name `name' and executes `command'. If not, try to run a client that might +! be linked to the processed input files. + subroutine gmshOnelabRun( + & name, + & command, + & ierr) + & bind(C,name="gmshOnelabRun") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: name(*) + character (LEN=1,KIND=C_CHAR) :: command(*) + integer (C_INT) :: ierr + end subroutine gmshOnelabRun + +! Write a `message'. `level' can be "info", "warning" or "error". + subroutine gmshLoggerWrite( + & message, + & level, + & ierr) + & bind(C,name="gmshLoggerWrite") + use, intrinsic :: ISO_C_BINDING + character (LEN=1,KIND=C_CHAR) :: message(*) + character (LEN=1,KIND=C_CHAR) :: level(*) + integer (C_INT) :: ierr + end subroutine gmshLoggerWrite + +! Start logging messages. + subroutine gmshLoggerStart( + & ierr) + & bind(C,name="gmshLoggerStart") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: ierr + end subroutine gmshLoggerStart + +! Get logged messages. + subroutine gmshLoggerGet( + & log, + & log_n, + & ierr) + & bind(C,name="gmshLoggerGet") + use, intrinsic :: ISO_C_BINDING + type (C_PTR), intent(out) :: log + integer (C_SIZE_T) :: log_n + integer (C_INT) :: ierr + end subroutine gmshLoggerGet + +! Stop logging messages. + subroutine gmshLoggerStop( + & ierr) + & bind(C,name="gmshLoggerStop") + use, intrinsic :: ISO_C_BINDING + integer (C_INT) :: ierr + end subroutine gmshLoggerStop + +! Return wall clock time. + function gmshLoggerGetWallTime( + & ierr) + & bind(C,name="gmshLoggerGetWallTime") + use, intrinsic :: ISO_C_BINDING + real (C_DOUBLE) :: gmshLoggerGetWallTime + integer (C_INT) :: ierr + end function gmshLoggerGetWallTime + +! Return CPU time. + function gmshLoggerGetCpuTime( + & ierr) + & bind(C,name="gmshLoggerGetCpuTime") + use, intrinsic :: ISO_C_BINDING + real (C_DOUBLE) :: gmshLoggerGetCpuTime + integer (C_INT) :: ierr + end function gmshLoggerGetCpuTime + +! Return last error message, if any. + subroutine gmshLoggerGetLastError( + & error, + & ierr) + & bind(C,name="gmshLoggerGetLastError") + use, intrinsic :: ISO_C_BINDING + type (C_PTR) :: error(*) + integer (C_INT) :: ierr + end subroutine gmshLoggerGetLastError + + end interface + end module gmsh_fortran + +!DEC$ ENDIF diff --git a/tutorial/c/t2.c b/tutorial/c/t2.c new file mode 100644 index 0000000000000000000000000000000000000000..9b001fd21af5d0e7dba453820dbbafd92280459a --- /dev/null +++ b/tutorial/c/t2.c @@ -0,0 +1,208 @@ +// ----------------------------------------------------------------------------- +// +// Gmsh C tutorial 2 +// +// Transformations, extruded geometries, volumes +// +// ----------------------------------------------------------------------------- + +#include <stdio.h> +#include <math.h> +#include <gmshc.h> + +int main(int argc, char **argv) +{ + int ierr; + + gmshInitialize(argc, argv, 1, &ierr); + + gmshModelAdd("t2", &ierr); + + // Copied from t1.c... + double lc = 1e-2; + + gmshModelGeoAddPoint(0, 0, 0, lc, 1, &ierr); + gmshModelGeoAddPoint(.1, 0, 0, lc, 2, &ierr); + gmshModelGeoAddPoint(.1, .3, 0, lc, 3, &ierr); + gmshModelGeoAddPoint(0, .3, 0, lc, 4, &ierr); + + gmshModelGeoAddLine(1, 2, 1, &ierr); + gmshModelGeoAddLine(3, 2, 2, &ierr); + gmshModelGeoAddLine(3, 4, 3, &ierr); + gmshModelGeoAddLine(4, 1, 4, &ierr); + + int cl1[] = {4, 1, -2, 3}; + gmshModelGeoAddCurveLoop(cl1, sizeof(cl1) / sizeof(cl1[0]), 1, 0, &ierr); + + int s1[] = {1}; + gmshModelGeoAddPlaneSurface(s1, sizeof(s1) / sizeof(s1[0]), 1, &ierr); + + gmshModelGeoSynchronize(&ierr); + + int g5[] = {1, 2, 4}; + gmshModelAddPhysicalGroup(1, g5, sizeof(g5) / sizeof(g5[0]), 5, &ierr); + + int g6[] = {1}; + int ps = + gmshModelAddPhysicalGroup(2, g6, sizeof(g6) / sizeof(g6[0]), -1, &ierr); + + gmshModelSetPhysicalName(2, ps, "My surface", &ierr); + + // We can then add new points and curves in the same way as we did in + // `t1.c': + gmshModelGeoAddPoint(0, .4, 0, lc, 5, &ierr); + gmshModelGeoAddLine(4, 5, 5, &ierr); + + // But Gmsh also provides tools to transform (translate, rotate, etc.) + // elementary entities or copies of elementary entities. Geometrical + // transformations take a vector of pairs of integers as first argument, which + // contains the list of entities, represented by (dimension, tag) pairs. For + // example, the point 5 (dimension=0, tag=5) can be moved by 0.02 to the left + // (dx=-0.02, dy=0, dz=0) with + int t2[] = {0, 5}; + gmshModelGeoTranslate(t2, 2, -0.02, 0, 0, &ierr); + + // And it can be further rotated by -Pi/4 around (0, 0.3, 0) (with the + // rotation along the z axis) with: + gmshModelGeoRotate(t2, 2, 0, 0.3, 0, 0, 0, 1, -M_PI / 4, &ierr); + + // Note that there are no units in Gmsh: coordinates are just numbers - it's + // up to the user to associate a meaning to them. + + // Point 3 can be duplicated and translated by 0.05 along the y axis by using + // the `copy()' function, which takes a vector of (dim, tag) pairs as input, + // and returns another vector of (dim, tag) pairs: + + int iv[] = {0, 3}; + int *ov; + size_t ov_n; + gmshModelGeoCopy(iv, 2, &ov, &ov_n, &ierr); + + gmshModelGeoTranslate(ov, ov_n, 0, 0.05, 0, &ierr); + + // The new point tag is available in ov[0].second, and can be used to create + // new lines: + gmshModelGeoAddLine(3, ov[1], 7, &ierr); + gmshModelGeoAddLine(ov[1], 5, 8, &ierr); + + int cl2[] = {5, -8, -7, 3}; + gmshModelGeoAddCurveLoop(cl2, sizeof(cl2) / sizeof(cl2[0]), 10, 0, &ierr); + + int s2[] = {10}; + gmshModelGeoAddPlaneSurface(s2, sizeof(s2) / sizeof(s2[0]), 11, &ierr); + + // In the same way, we can translate copies of the two surfaces 1 and 11 to + // the right with the following command: + int iv2[] = {2, 1, 2, 11}; + gmshModelGeoCopy(iv2, 4, &ov, &ov_n, &ierr); + + gmshModelGeoTranslate(ov, ov_n, 0.12, 0, 0, &ierr); + + printf("New surfaces '%d' and '%d'\n", ov[1], ov[3]); + + // Volumes are the fourth type of elementary entities in Gmsh. In the same way + // one defines curve loops to build surfaces, one has to define surface loops + // (i.e. `shells') to build volumes. The following volume does not have holes + // and thus consists of a single surface loop: + + gmshModelGeoAddPoint(0., 0.3, 0.12, lc, 100, &ierr); + + gmshModelGeoAddPoint(0.1, 0.3, 0.12, lc, 101, &ierr); + + gmshModelGeoAddPoint(0.1, 0.35, 0.12, lc, 102, &ierr); + + // We would like to retrieve the coordinates of point 5 to create point 103, + // so we synchronize the model, and use `getValue()' + + gmshModelGeoSynchronize(&ierr); + + double *iv0 = NULL; + double *xyz; + size_t xyz_n; + gmshModelGetValue(0, 5, iv0, 0, &xyz, &xyz_n, &ierr); + + gmshModelGeoAddPoint(xyz[0], xyz[1], 0.12, lc, 103, &ierr); + + gmshModelGeoAddLine(4, 100, 110, &ierr); + gmshModelGeoAddLine(3, 101, 111, &ierr); + gmshModelGeoAddLine(6, 102, 112, &ierr); + gmshModelGeoAddLine(5, 103, 113, &ierr); + gmshModelGeoAddLine(103, 100, 114, &ierr); + gmshModelGeoAddLine(100, 101, 115, &ierr); + gmshModelGeoAddLine(101, 102, 116, &ierr); + gmshModelGeoAddLine(102, 103, 117, &ierr); + + int cl3[] = {115, -111, 3, 110}; + gmshModelGeoAddCurveLoop(cl3, sizeof(cl3) / sizeof(cl3[0]), 118, 0, &ierr); + int s3[] = {118}; + gmshModelGeoAddPlaneSurface(s3, sizeof(s3) / sizeof(s3[0]), 119, &ierr); + + int cl4[] = {111, 116, -112, -7}; + gmshModelGeoAddCurveLoop(cl4, sizeof(cl4) / sizeof(cl4[0]), 120, 0, &ierr); + int s4[] = {120}; + gmshModelGeoAddPlaneSurface(s4, sizeof(s4) / sizeof(s4[0]), 121, &ierr); + + int cl5[] = {112, 117, -113, -8}; + gmshModelGeoAddCurveLoop(cl5, sizeof(cl5) / sizeof(cl5[0]), 122, 0, &ierr); + int s5[] = {122}; + gmshModelGeoAddPlaneSurface(s5, sizeof(s5) / sizeof(s5[0]), 123, &ierr); + + int cl6[] = {114, -110, 5, 113}; + gmshModelGeoAddCurveLoop(cl6, sizeof(cl6) / sizeof(cl6[0]), 124, 0, &ierr); + int s6[] = {124}; + gmshModelGeoAddPlaneSurface(s6, sizeof(s6) / sizeof(s6[0]), 125, &ierr); + + int cl7[] = {115, 116, 117, 114}; + gmshModelGeoAddCurveLoop(cl7, sizeof(cl7) / sizeof(cl7[0]), 126, 0, &ierr); + int s7[] = {126}; + gmshModelGeoAddPlaneSurface(s7, sizeof(s7) / sizeof(s7[0]), 127, &ierr); + + int sl1[] = {127, 119, 121, 123, 125, 11}; + gmshModelGeoAddSurfaceLoop(sl1, sizeof(sl1) / sizeof(sl1[0]), 128, &ierr); + int v1[] = {128}; + gmshModelGeoAddVolume(v1, sizeof(v1) / sizeof(v1[0]), 129, &ierr); + + // When a volume can be extruded from a surface, it is usually easier to use + // the `extrude()' function directly instead of creating all the points, + // curves and surfaces by hand. For example, the following command extrudes + // the surface 11 along the z axis and automatically creates a new volume (as + // well as all the needed points, curves and surfaces). As expected, the + // function takes a vector of (dim, tag) pairs as input as well as the + // translation vector, and returns a vector of (dim, tag) pairs as output: + + int *ov2; + size_t ov2_n; + int *numElements; + double *heights; + size_t numElements_n = 0; + size_t heights_n = 0; + int recombine = 0; + gmshModelGeoExtrude(&(ov[2]), 2, 0.0, 0.0, 0.12, &ov2, &ov2_n, numElements, + numElements_n, heights, heights_n, recombine, &ierr); + + // Mesh sizes associated to geometrical points can be set by passing a vector + // of (dim, tag) pairs for the corresponding points: + + int ss[] = {0, 103, 0, 105, 0, 109, 0, 102, 0, 28, 0, 24, 0, 6, 0, 5}; + gmshModelGeoMeshSetSize(ss, sizeof(ss) / sizeof(ss[0]), lc * 3, &ierr); + + // We finish by synchronizing the data from the built-in CAD kernel with the + // Gmsh model: + gmshModelGeoSynchronize(&ierr); + + // We group volumes 129 and 130 in a single physical group with tag `1' and + // name "The volume": + int g7[] = {129, 130}; + gmshModelAddPhysicalGroup(3, g7, sizeof(g7) / sizeof(g7[0]), 1, &ierr); + + gmshModelSetPhysicalName(3, 1, "The volume", &ierr); + + gmshModelMeshGenerate(3, &ierr); + + gmshWrite("t2.msh", &ierr); + + // gmshFltkRun(&ierr); + + gmshFinalize(&ierr); + return 0; +} diff --git a/tutorial/c/t6.c b/tutorial/c/t6.c new file mode 100644 index 0000000000000000000000000000000000000000..18b45ec045e582b4b9af028033dc90befac3d8ed --- /dev/null +++ b/tutorial/c/t6.c @@ -0,0 +1,123 @@ +// ----------------------------------------------------------------------------- +// +// Gmsh C tutorial 6 +// +// Transfinite meshes +// +// ----------------------------------------------------------------------------- + +#include <gmshc.h> + +int main(int argc, char **argv) +{ + int ierr; + + gmshInitialize(argc, argv, 1, &ierr); + + gmshModelAdd("t2", &ierr); + + // Copied from t1.c... + double lc = 1e-2; + + gmshModelGeoAddPoint(0, 0, 0, lc, 1, &ierr); + gmshModelGeoAddPoint(.1, 0, 0, lc, 2, &ierr); + gmshModelGeoAddPoint(.1, .3, 0, lc, 3, &ierr); + gmshModelGeoAddPoint(0, .3, 0, lc, 4, &ierr); + + gmshModelGeoAddLine(1, 2, 1, &ierr); + gmshModelGeoAddLine(3, 2, 2, &ierr); + gmshModelGeoAddLine(3, 4, 3, &ierr); + gmshModelGeoAddLine(4, 1, 4, &ierr); + + int cl1[] = {4, 1, -2, 3}; + gmshModelGeoAddCurveLoop(cl1, sizeof(cl1) / sizeof(cl1[0]), 1, 0, &ierr); + + int s1[] = {1}; + gmshModelGeoAddPlaneSurface(s1, sizeof(s1) / sizeof(s1[0]), 1, &ierr); + + // Delete the surface and the left line, and replace the line with 3 new ones: + int r4[] = {2, 1, 1, 4}; + gmshModelGeoRemove(r4, 4, 0, &ierr); + + int p1 = gmshModelGeoAddPoint(-0.05, 0.05, 0, lc, -1, &ierr); + int p2 = gmshModelGeoAddPoint(-0.05, 0.1, 0, lc, -1, &ierr); + + int l1 = gmshModelGeoAddLine(1, p1, -1, &ierr); + int l2 = gmshModelGeoAddLine(p1, p2, -1, &ierr); + int l3 = gmshModelGeoAddLine(p2, 4, -1, &ierr); + + // Create surface: + int cl2[] = {2, -1, l1, l2, l3, -3}; + gmshModelGeoAddCurveLoop(cl2, sizeof(cl2) / sizeof(cl2[0]), 2, 0, &ierr); + + int s2[] = {-2}; + gmshModelGeoAddPlaneSurface(s2, sizeof(s2) / sizeof(s2[0]), 1, &ierr); + + // The `setTransfiniteCurve()' meshing constraints explicitly specifies the + // location of the nodes on the curve. For example, the following command + // forces 20 uniformly placed nodes on curve 2 (including the nodes on the two + // end points): + gmshModelGeoMeshSetTransfiniteCurve(2, 20, "Progression", 1.0, &ierr); + + // Let's put 20 points total on combination of curves `l1', `l2' and `l3' + // (beware that the points `p1' and `p2' are shared by the curves, so we do + // not create 6 + 6 + 10 = 22 nodes, but 20!) + gmshModelGeoMeshSetTransfiniteCurve(l1, 6, "Progression", 1.0, &ierr); + gmshModelGeoMeshSetTransfiniteCurve(l2, 6, "Progression", 1.0, &ierr); + gmshModelGeoMeshSetTransfiniteCurve(l3, 10, "Progression", 1.0, &ierr); + + // Finally, we put 30 nodes following a geometric progression on curve 1 + // (reversed) and on curve 3: Put 30 points following a geometric progression + gmshModelGeoMeshSetTransfiniteCurve(1, 30, "Progression", -1.2, &ierr); + gmshModelGeoMeshSetTransfiniteCurve(3, 30, "Progression", 1.2, &ierr); + + // The `setTransfiniteSurface()' meshing constraint uses a transfinite + // interpolation algorithm in the parametric plane of the surface to connect + // the nodes on the boundary using a structured grid. If the surface has more + // than 4 corner points, the corners of the transfinite interpolation have to + // be specified by hand: + // gmsh::model::geo::mesh::setTransfiniteSurface(1, "Left", {1, 2, 3, 4}); + int ts[] = {1, 2, 3, 4}; + gmshModelGeoMeshSetTransfiniteSurface(1, "Left", ts, 4, &ierr); + + // To create quadrangles instead of triangles, one can use the `setRecombine' + // constraint: + gmshModelGeoMeshSetRecombine(2, 1, 45.0, &ierr); + + // When the surface has only 3 or 4 points on its boundary the list of corners + // can be omitted in the `setTransfiniteSurface()' call: + gmshModelGeoAddPoint(0.2, 0.2, 0, 1.0, 7, &ierr); + gmshModelGeoAddPoint(0.2, 0.1, 0, 1.0, 8, &ierr); + gmshModelGeoAddPoint(0, 0.3, 0, 1.0, 9, &ierr); + gmshModelGeoAddPoint(0.25, 0.2, 0, 1.0, 10, &ierr); + gmshModelGeoAddPoint(0.3, 0.1, 0, 1.0, 11, &ierr); + + gmshModelGeoAddLine(8, 11, 10, &ierr); + gmshModelGeoAddLine(11, 10, 11, &ierr); + gmshModelGeoAddLine(10, 7, 12, &ierr); + gmshModelGeoAddLine(7, 8, 13, &ierr); + + int cl3[] = {13, 10, 11, 12}; + gmshModelGeoAddCurveLoop(cl3, sizeof(cl3) / sizeof(cl3[0]), 14, 0, &ierr); + + int s3[] = {14}; + gmshModelGeoAddPlaneSurface(s3, sizeof(s3) / sizeof(s3[0]), 15, &ierr); + + for(int i = 10; i <= 13; i++) + gmshModelGeoMeshSetTransfiniteCurve(i, 10, "Progression", 1.0, &ierr); + + gmshModelGeoMeshSetTransfiniteSurface(15, "Left", ts, 0, &ierr); + + gmshOptionSetNumber("Mesh.Smoothing", 100, &ierr); + + gmshModelGeoSynchronize(&ierr); + + gmshModelMeshGenerate(2, &ierr); + + gmshWrite("t6.msh", &ierr); + + // gmshFltkRun(&ierr); + + gmshFinalize(&ierr); + return 0; +} diff --git a/tutorial/fortran/t1.f b/tutorial/fortran/t1.f new file mode 100644 index 0000000000000000000000000000000000000000..8a16b43cdbe3789fcc1e993cdbe4119cedd9ec04 --- /dev/null +++ b/tutorial/fortran/t1.f @@ -0,0 +1,82 @@ +c --------------------------------------------------------------------------- +c +c Gmsh Fortran tutorial 1 +c +c Elementary entities (points, curves, surfaces), physical groups +c +c --------------------------------------------------------------------------- + + include 'gmshf.h' + + program main + use, intrinsic :: ISO_C_BINDING + use gmsh_fortran + + implicit none + integer (C_INT) :: ierr, p4, argc, itmp, i, ps, status + real (C_DOUBLE) :: lc + + integer (C_INT) :: cl1(4) = (/4,1,-2,3/) + integer (C_INT) :: s1(1) = (/1/) + integer (C_INT) :: g5(3) = (/1,2,4/) + integer (C_INT) :: g6(1) = (/1/) + + type (C_PTR), allocatable :: argv(:) + + TYPE string + CHARACTER (LEN=:,KIND=C_CHAR), ALLOCATABLE :: item + END TYPE string + TYPE (string), ALLOCATABLE, TARGET :: tmp(:) + + character (80) :: buf + + lc=1d-2 + + argc = NARGS() + allocate(argv(argc+1)) + if (argc > 0) then + allocate(tmp(argc)) + endif + + do i=1,argc + call GETARG(i-1, buf, status) + tmp(i)%item=TRIM(buf) // C_NULL_CHAR + argv(i)=C_LOC(tmp(i)%item) + enddo + argv(argc+1)=C_NULL_PTR + + call gmshInitialize(argc, argv, 1, ierr) + + call gmshModelAdd('t1', ierr) + itmp = gmshModelGeoAddPoint(0d0, 0d0, 0d0, lc, 1, ierr) + itmp = gmshModelGeoAddPoint(0.1d0, 0d0, 0d0, lc, 2, ierr) + itmp = gmshModelGeoAddPoint(0.1d0, 0.3d0, 0d0, lc, 3, ierr) + p4 = gmshModelGeoAddPoint(0d0, 0.3d0, 0d0, lc, -1, ierr) + + itmp = gmshModelGeoAddLine(1, 2, 1, ierr) + itmp = gmshModelGeoAddLine(3, 2, 2, ierr) + itmp = gmshModelGeoAddLine(3, p4, 3, ierr) + itmp = gmshModelGeoAddLine(p4, 1, 4, ierr) + + itmp = gmshModelGeoAddCurveLoop(cl1, 4, 1, 0, ierr) + itmp = gmshModelGeoAddPlaneSurface(s1, 1, 1, ierr) + + call gmshModelGeoSynchronize(ierr) + itmp = gmshModelAddPhysicalGroup(1, g5, 3, 5, ierr) + ps = gmshModelAddPhysicalGroup(2, g6, 1, -1, ierr) + call gmshModelSetPhysicalName(2, ps, 'My surface', ierr) + + call gmshModelMeshGenerate(2, ierr) + call gmshWrite('t1.msh', ierr) + +c call gmshFltkRun(ierr) + + call gmshFinalize(ierr) + +c if (argc > 0) then +c deallocate(tmp) +c endif +c deallocate(argv) + + stop + end diff --git a/tutorial/fortran/t2.f b/tutorial/fortran/t2.f new file mode 100644 index 0000000000000000000000000000000000000000..dbad2696dc4e6c665e34db62c4a4487add0bd018 --- /dev/null +++ b/tutorial/fortran/t2.f @@ -0,0 +1,190 @@ +c --------------------------------------------------------------------------- +c +c Gmsh Fortran tutorial 2 +c +c Transformations, extruded geometries, volumes +c +c --------------------------------------------------------------------------- + + include 'gmshf.h' + + program main + use, intrinsic :: ISO_C_BINDING + use gmsh_fortran + + implicit none + integer (C_INT) :: ierr, argc, itmp, i, ps, status + integer (C_INT) :: recombine + integer (C_SIZE_T) :: ov_n, xyz_n, numElements_n, heights_n, ov2_n + real (C_DOUBLE) :: lc + + integer (C_INT) :: cl1(4) = (/4,1,-2,3/) + integer (C_INT) :: cl2(4) = (/5,-8,-7,3/) + integer (C_INT) :: cl3(4) = (/115,-111,3,110/) + + integer (C_INT) :: cl4(4) = (/111,116,-112,-7/) + integer (C_INT) :: cl5(4) = (/112,117,-113,-8/) + integer (C_INT) :: cl6(4) = (/114,-110,5,113/) + integer (C_INT) :: cl7(4) = (/115,116,117,114/) + integer (C_INT) :: s1(1) = (/1/) + integer (C_INT) :: s2(1) = (/10/) + integer (C_INT) :: s3(1) = (/118/) + integer (C_INT) :: s4(1) = (/120/) + integer (C_INT) :: s5(1) = (/122/) + integer (C_INT) :: s6(1) = (/124/) + integer (C_INT) :: s7(1) = (/126/) + integer (C_INT) :: g5(3) = (/1,2,4/) + integer (C_INT) :: g6(1) = (/1/) + integer (C_INT) :: g7(2) = (/129,130/) + integer (C_INT) :: t(2) = (/0,5/) + integer (C_INT) :: iv(2) = (/0,3/) + integer (C_INT) :: iv2(4) = (/2,1,2,11/) + integer (C_INT) :: numElements(0) + real (C_DOUBLE) :: iv0(0) + real (C_DOUBLE) :: heights(0) + integer (C_INT) :: sl1(6) = (/127,119,121,123,125,11/) + integer (C_INT) :: v1(1) = (/128/) + integer (C_INT) :: ss(16) = + & (/0,103,0,105,0,109,0,102,0,28,0,24,0,6,0,5/) + + type (C_PTR), allocatable :: argv(:) + type (C_PTR) :: ov, xyz, ov2, ov_3 + + TYPE string + CHARACTER (LEN=:,KIND=C_CHAR), ALLOCATABLE :: item + END TYPE string + TYPE (string), ALLOCATABLE, TARGET :: tmp(:) + + character (80) :: buf + + integer (kind=C_INT), pointer :: pf_ov(:), pf_ov3(:), pf_ov2(:) + real (kind=C_DOUBLE), pointer :: pf_xyz(:) + + lc=1d-2 + + argc = NARGS() + allocate(argv(argc+1)) + if (argc > 0) then + allocate(tmp(argc)) + endif + + do i=1,argc + call GETARG(i-1, buf, status) + tmp(i)%item=TRIM(buf) // C_NULL_CHAR + argv(i)=C_LOC(tmp(i)%item) + enddo + argv(argc+1)=C_NULL_PTR + + call gmshInitialize(argc, argv, 1, ierr) + + call gmshModelAdd('t2', ierr) + + itmp = gmshModelGeoAddPoint(0d0, 0d0, 0d0, lc, 1, ierr) + itmp = gmshModelGeoAddPoint(0.1d0, 0d0, 0d0, lc, 2, ierr) + itmp = gmshModelGeoAddPoint(0.1d0, 0.3d0, 0d0, lc, 3, ierr) + itmp = gmshModelGeoAddPoint(0d0, 0.3d0, 0d0, lc, 4, ierr) + + itmp = gmshModelGeoAddLine(1, 2, 1, ierr) + itmp = gmshModelGeoAddLine(3, 2, 2, ierr) + itmp = gmshModelGeoAddLine(3, 4, 3, ierr) + itmp = gmshModelGeoAddLine(4, 1, 4, ierr) + + itmp = gmshModelGeoAddCurveLoop(cl1, 4, 1, 0, ierr) + itmp = gmshModelGeoAddPlaneSurface(s1, 1, 1, ierr) + + call gmshModelGeoSynchronize(ierr) + itmp = gmshModelAddPhysicalGroup(1, g5, 3, 5, ierr) + ps = gmshModelAddPhysicalGroup(2, g6, 1, -1, ierr) + call gmshModelSetPhysicalName(2, ps, 'My surface', ierr) + + itmp = gmshModelGeoAddPoint(0d0, 0.4d0, 0d0, lc, 5, ierr) + + itmp = gmshModelGeoAddLine(4, 5, 5, ierr) + + call gmshModelGeoTranslate(t, 2, -0.02d0, 0d0, 0d0, ierr) + + call gmshModelGeoRotate(t, 2, 0d0, 0.3d0, 0d0, 0d0, 0d0, 1d0, + & -M_PI/4d0, ierr) + + call gmshModelGeoCopy(iv, 2, ov, ov_n, ierr) + + call C_F_POINTER(ov, pf_ov, [ov_n]) + call gmshModelGeoTranslate(pf_ov, ov_n, 0d0, 0.05d0, 0d0, ierr) + + itmp = gmshModelGeoAddLine(3, pf_ov(2), 7, ierr) + itmp = gmshModelGeoAddLine(pf_ov(2), 5, 8, ierr) + + itmp = gmshModelGeoAddCurveLoop(cl2, 4, 10, 0, ierr) + itmp = gmshModelGeoAddPlaneSurface(s2, 1, 11, ierr) + + call gmshModelGeoCopy(iv2, 4, ov, ov_n, ierr) + + call C_F_POINTER(ov, pf_ov, [ov_n]) + call gmshModelGeoTranslate(pf_ov, ov_n, 0.12d0, 0d0, 0d0, ierr) + + print *, 'New surfaces ', pf_ov(2), ' and ', pf_ov(4) + + itmp = gmshModelGeoAddPoint(0d0, 0.3d0, 0.12d0, lc, 100, ierr) + itmp = gmshModelGeoAddPoint(0.1d0, 0.3d0, 0.12d0, lc, 101, ierr) + itmp = gmshModelGeoAddPoint(0.1d0, 0.35d0, 0.12d0, lc, 102, ierr) + + call gmshModelGeoSynchronize(ierr) + + call gmshModelGetValue(0, 5, iv0, 0, xyz, xyz_n, ierr) + + call C_F_POINTER(xyz, pf_xyz, [xyz_n]) + itmp = gmshModelGeoAddPoint(pf_xyz(1), pf_xyz(2), 0.12d0, lc, 103, + & ierr) + + itmp = gmshModelGeoAddLine(4, 100, 110, ierr) + itmp = gmshModelGeoAddLine(3, 101, 111, ierr) + itmp = gmshModelGeoAddLine(6, 102, 112, ierr); + itmp = gmshModelGeoAddLine(5, 103, 113, ierr) + itmp = gmshModelGeoAddLine(103, 100, 114, ierr) + itmp = gmshModelGeoAddLine(100, 101, 115, ierr) + itmp = gmshModelGeoAddLine(101, 102, 116, ierr) + itmp = gmshModelGeoAddLine(102, 103, 117, ierr) + + itmp = gmshModelGeoAddCurveLoop(cl3, 4, 118, 0, ierr) + itmp = gmshModelGeoAddPlaneSurface(s3, 1, 119, ierr) + + itmp = gmshModelGeoAddCurveLoop(cl4, 4, 120, 0, ierr) + itmp = gmshModelGeoAddPlaneSurface(s4, 1, 121, ierr) + + itmp = gmshModelGeoAddCurveLoop(cl5, 4, 122, 0, ierr) + itmp = gmshModelGeoAddPlaneSurface(s5, 1, 123, ierr) + + itmp = gmshModelGeoAddCurveLoop(cl6, 4, 124, 0, ierr) + itmp = gmshModelGeoAddPlaneSurface(s6, 1, 125, ierr) + + itmp = gmshModelGeoAddCurveLoop(cl7, 4, 126, 0, ierr) + itmp = gmshModelGeoAddPlaneSurface(s7, 1, 127, ierr) + + itmp = gmshModelGeoAddSurfaceLoop(sl1, 6, 128, ierr) + itmp = gmshModelGeoAddVolume(v1, 1, 129, ierr) + + numElements_n = 0 + heights_n = 0 + recombine=0 + ov_3 = C_LOC(pf_ov(3)) + call C_F_POINTER(ov_3, pf_ov3, [ov_n-2]) + call gmshModelGeoExtrude(pf_ov3, 2, 0d0, 0d0, 0.12d0, + & ov2, ov2_n, numElements, numElements_n, + & heights, heights_n, recombine, ierr) + + call gmshModelGeoMeshSetSize(ss, 16, lc * 3, ierr) + + call gmshModelGeoSynchronize(ierr) + + itmp = gmshModelAddPhysicalGroup(3, g7, 2, 1, ierr) + + call gmshModelSetPhysicalName(3, 1, 'The volume', ierr) + + call gmshModelMeshGenerate(3, ierr) + call gmshWrite('t2.msh', ierr) + +c call gmshFltkRun(ierr) + + call gmshFinalize(ierr) + stop + end diff --git a/tutorial/fortran/t6.f b/tutorial/fortran/t6.f new file mode 100644 index 0000000000000000000000000000000000000000..cb2f469642a0af5a5c3fffe96bd942bd0c61ea9d --- /dev/null +++ b/tutorial/fortran/t6.f @@ -0,0 +1,135 @@ +c --------------------------------------------------------------------------- +c +c Gmsh Fortran tutorial 6 +c +c Transfinite meshes +c +c --------------------------------------------------------------------------- + + include 'gmshf.h' + + program main + use, intrinsic :: ISO_C_BINDING + use gmsh_fortran + + implicit none + integer (C_INT) :: ierr, argc, itmp, i, status + integer (C_INT) :: p1, p2, l1, l2, l3 + real (C_DOUBLE) :: lc + + integer (C_INT) :: cl1(4) = (/4,1,-2,3/) + integer (C_INT) :: cl2(6) = (/2, -1, 0, 0, 0, -3/) + integer (C_INT) :: cl3(4) = (/13, 10, 11, 12/) + integer (C_INT) :: s1(1) = (/1/) + integer (C_INT) :: s2(1) = (/-2/) + integer (C_INT) :: s3(1) = (/14/) + + integer (C_INT) :: r4(4) = (/2, 1, 1, 4/) + integer (C_INT) :: ts(4) = (/1, 2, 3, 4/) + + type (C_PTR), allocatable :: argv(:) + + TYPE string + CHARACTER (LEN=:,KIND=C_CHAR), ALLOCATABLE :: item + END TYPE string + TYPE (string), ALLOCATABLE, TARGET :: tmp(:) + + character (80) :: buf + + lc=1d-2 + + argc = NARGS() + allocate(argv(argc+1)) + if (argc > 0) then + allocate(tmp(argc)) + endif + + do i=1,argc + call GETARG(i-1, buf, status) + tmp(i)%item=TRIM(buf) // C_NULL_CHAR + argv(i)=C_LOC(tmp(i)%item) + enddo + argv(argc+1)=C_NULL_PTR + + call gmshInitialize(argc, argv, 1, ierr) + + call gmshModelAdd('t6', ierr) + + itmp = gmshModelGeoAddPoint(0d0, 0d0, 0d0, lc, 1, ierr) + itmp = gmshModelGeoAddPoint(0.1d0, 0d0, 0d0, lc, 2, ierr) + itmp = gmshModelGeoAddPoint(0.1d0, 0.3d0, 0d0, lc, 3, ierr) + itmp = gmshModelGeoAddPoint(0d0, 0.3d0, 0d0, lc, 4, ierr) + + itmp = gmshModelGeoAddLine(1, 2, 1, ierr) + itmp = gmshModelGeoAddLine(3, 2, 2, ierr) + itmp = gmshModelGeoAddLine(3, 4, 3, ierr) + itmp = gmshModelGeoAddLine(4, 1, 4, ierr) + + itmp = gmshModelGeoAddCurveLoop(cl1, 4, 1, 0, ierr) + itmp = gmshModelGeoAddPlaneSurface(s1, 1, 1, ierr) + + call gmshModelGeoRemove(r4, 4, 0, ierr) + + p1 = gmshModelGeoAddPoint(-0.05d0, 0.05d0, 0d0, lc, -1, ierr) + p2 = gmshModelGeoAddPoint(-0.05d0, 0.1d0, 0d0, lc, -1, ierr) + + l1 = gmshModelGeoAddLine(1, p1, -1, ierr) + l2 = gmshModelGeoAddLine(p1, p2, -1, ierr) + l3 = gmshModelGeoAddLine(p2, 4, -1, ierr) + + cl2(3) = l1 + cl2(4) = l2 + cl2(5) = l3 + itmp = gmshModelGeoAddCurveLoop(cl2, 6, 2, 0, ierr) + itmp = gmshModelGeoAddPlaneSurface(s2, 1, 1, ierr) + + call gmshModelGeoMeshSetTransfiniteCurve(2, 20, "Progression", + & 1d0, ierr) + call gmshModelGeoMeshSetTransfiniteCurve(l1, 6, "Progression", + & 1d0, ierr) + call gmshModelGeoMeshSetTransfiniteCurve(l2, 6, "Progression", + & 1d0, ierr) + call gmshModelGeoMeshSetTransfiniteCurve(l3, 10, "Progression", + & 1d0, ierr) + call gmshModelGeoMeshSetTransfiniteCurve(1, 30, "Progression", + & -1.2d0, ierr) + call gmshModelGeoMeshSetTransfiniteCurve(3, 30, "Progression", + & 1.2d0, ierr) + + call gmshModelGeoMeshSetTransfiniteSurface(1, "Left", ts, 4, ierr) + call gmshModelGeoMeshSetRecombine(2, 1, 45d0, ierr) + + itmp = gmshModelGeoAddPoint(0.2d0, 0.2d0, 0d0, 1d0, 7, ierr) + itmp = gmshModelGeoAddPoint(0.2d0, 0.1d0, 0d0, 1d0, 8, ierr) + itmp = gmshModelGeoAddPoint(0d0, 0.3d0, 0d0, 1d0, 9, ierr) + itmp = gmshModelGeoAddPoint(0.25d0, 0.2d0, 0d0, 1d0, 10, ierr) + itmp = gmshModelGeoAddPoint(0.3d0, 0.1d0, 0d0, 1d0, 11, ierr) + + itmp = gmshModelGeoAddLine(8, 11, 10, ierr) + itmp = gmshModelGeoAddLine(11, 10, 11, ierr) + itmp = gmshModelGeoAddLine(10, 7, 12, ierr) + itmp = gmshModelGeoAddLine(7, 8, 13, ierr) + + itmp = gmshModelGeoAddCurveLoop(cl3, 4, 14, 0, ierr) + itmp = gmshModelGeoAddPlaneSurface(s3, 1, 15, ierr) + + do i=10,13 + call gmshModelGeoMeshSetTransfiniteCurve(i, 10, "Progression", + & 1d0, ierr) + enddo + + call gmshModelGeoMeshSetTransfiniteSurface(15, "Left", ts, 0, + & ierr) + + call gmshOptionSetNumber("Mesh.Smoothing", 100, ierr) + + call gmshModelGeoSynchronize(ierr) + + call gmshModelMeshGenerate(2, ierr) + call gmshWrite('t6.msh', ierr) + +c call gmshFltkRun(ierr) + + call gmshFinalize(ierr) + stop + end