Commit 5056033f by Christophe Geuzaine

install Julia module + Julia exceptions on errors

parent 1f75bfa4
Pipeline #1624 canceled with stage
in 1 minute 11 seconds
......@@ -125,6 +125,7 @@ endif(ENABLE_PRIVATE_API)
set(ONELAB_PY contrib/onelab/python/onelab.py)
set(GMSH_PY api/gmsh.py)
set(GMSH_JL api/gmsh.jl)
if(${CMAKE_MAJOR_VERSION} GREATER 2)
string(TIMESTAMP DATE "%Y%m%d")
......@@ -1696,6 +1697,7 @@ endif(ENABLE_ONELAB)
if(ENABLE_BUILD_LIB OR ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC)
install(FILES ${GMSH_API} DESTINATION ${GMSH_INC})
install(FILES ${GMSH_PY} DESTINATION ${GMSH_LIB})
install(FILES ${GMSH_JL} DESTINATION ${GMSH_LIB})
if(ENABLE_PRIVATE_API)
install(FILES ${GMSH_PRIVATE_API} DESTINATION ${GMSH_INC}/gmsh)
endif(ENABLE_PRIVATE_API)
......
......@@ -24,8 +24,8 @@ class arg:
self.cwrap_pre = ""
self.cwrap_post = ""
self.python_value = python_value if python_value is not None else value
self.python_arg = "not_implemented"
self.python_return = "not_implemented"
self.python_arg = ""
self.python_return = ""
self.python_pre = ""
self.julia_value = julia_value if julia_value is not None else value
self.julia_arg = name
......@@ -1103,9 +1103,8 @@ class API:
tuple(a.julia_arg for a in args) + ("ierr",)) + ")\n")
for a in args:
if a.julia_post: f.write(" " + a.julia_post + "\n")
f.write(" if ierr[1] != 0\n")
f.write(" println(ierr[1])\n")
f.write(" end\n")
f.write(' ierr[1] != 0 && error("' + c_name +
' returned non-zero error code: " * string(ierr[1]))\n')
r = (["api__result__"]) if rtype else []
r += list((o.name for o in oargs))
if len(r) != 0:
......
......@@ -34,9 +34,7 @@ function initialize(argv = Vector{String}(), readConfigFiles = true)
ccall((:gmshInitialize, clib), Void,
(Cint, Ptr{Ptr{Cchar}}, Cint, Ptr{Cint}),
length(argv), argv, readConfigFiles, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshInitialize returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -50,9 +48,7 @@ function finalize()
ccall((:gmshFinalize, clib), Void,
(Ptr{Cint},),
ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshFinalize returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -67,9 +63,7 @@ function open(fileName)
ccall((:gmshOpen, clib), Void,
(Ptr{Cchar}, Ptr{Cint}),
fileName, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshOpen returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -84,9 +78,7 @@ function merge(fileName)
ccall((:gmshMerge, clib), Void,
(Ptr{Cchar}, Ptr{Cint}),
fileName, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshMerge returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -100,9 +92,7 @@ function write(fileName)
ccall((:gmshWrite, clib), Void,
(Ptr{Cchar}, Ptr{Cint}),
fileName, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshWrite returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -116,9 +106,7 @@ function clear()
ccall((:gmshClear, clib), Void,
(Ptr{Cint},),
ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshClear returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -144,9 +132,7 @@ function setNumber(name, value)
ccall((:gmshOptionSetNumber, gmsh.clib), Void,
(Ptr{Cchar}, Cdouble, Ptr{Cint}),
name, value, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshOptionSetNumber returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -162,9 +148,7 @@ function getNumber(name)
ccall((:gmshOptionGetNumber, gmsh.clib), Void,
(Ptr{Cchar}, Ptr{Cdouble}, Ptr{Cint}),
name, value, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshOptionGetNumber returned non-zero error code: " * string(ierr[1]))
return value
end
......@@ -179,9 +163,7 @@ function setString(name, value)
ccall((:gmshOptionSetString, gmsh.clib), Void,
(Ptr{Cchar}, Ptr{Cchar}, Ptr{Cint}),
name, value, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshOptionSetString returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -197,9 +179,7 @@ function getString(name)
ccall((:gmshOptionGetString, gmsh.clib), Void,
(Ptr{Cchar}, Ptr{Ptr{Cchar}}, Ptr{Cint}),
name, value, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshOptionGetString returned non-zero error code: " * string(ierr[1]))
return value
end
......@@ -226,9 +206,7 @@ function add(name)
ccall((:gmshModelAdd, gmsh.clib), Void,
(Ptr{Cchar}, Ptr{Cint}),
name, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelAdd returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -242,9 +220,7 @@ function remove()
ccall((:gmshModelRemove, gmsh.clib), Void,
(Ptr{Cint},),
ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelRemove returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -264,9 +240,7 @@ function list()
api_names_, api_names_n_, ierr)
tmp_api_names_ = unsafe_wrap(Array, api_names_[1], api_names_n_[1], true)
names = [unsafe_string(tmp_api_names_[i]) for i in 1:length(tmp_api_names_) ]
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelList returned non-zero error code: " * string(ierr[1]))
return names
end
......@@ -282,9 +256,7 @@ function setCurrent(name)
ccall((:gmshModelSetCurrent, gmsh.clib), Void,
(Ptr{Cchar}, Ptr{Cint}),
name, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelSetCurrent returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -306,9 +278,7 @@ function getEntities(dim = -1)
api_dimTags_, api_dimTags_n_, dim, ierr)
tmp_api_dimTags_ = unsafe_wrap(Array, api_dimTags_[1], api_dimTags_n_[1], true)
dimTags = [ (tmp_api_dimTags_[i], tmp_api_dimTags_[i+1]) for i in 1:2:length(tmp_api_dimTags_) ]
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelGetEntities returned non-zero error code: " * string(ierr[1]))
return dimTags
end
......@@ -331,9 +301,7 @@ function getPhysicalGroups(dim = -1)
api_dimTags_, api_dimTags_n_, dim, ierr)
tmp_api_dimTags_ = unsafe_wrap(Array, api_dimTags_[1], api_dimTags_n_[1], true)
dimTags = [ (tmp_api_dimTags_[i], tmp_api_dimTags_[i+1]) for i in 1:2:length(tmp_api_dimTags_) ]
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelGetPhysicalGroups returned non-zero error code: " * string(ierr[1]))
return dimTags
end
......@@ -354,9 +322,7 @@ function getEntitiesForPhysicalGroup(dim, tag)
(Cint, Cint, Ptr{Ptr{Cint}}, Ptr{Csize_t}, Ptr{Cint}),
dim, tag, api_tags_, api_tags_n_, ierr)
tags = unsafe_wrap(Array, api_tags_[1], api_tags_n_[1], true)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelGetEntitiesForPhysicalGroup returned non-zero error code: " * string(ierr[1]))
return tags
end
......@@ -375,9 +341,7 @@ function addPhysicalGroup(dim, tags, tag = -1)
api__result__ = ccall((:gmshModelAddPhysicalGroup, gmsh.clib), Cint,
(Cint, Ptr{Cint}, Csize_t, Cint, Ptr{Cint}),
dim, convert(Vector{Cint}, tags), length(tags), tag, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelAddPhysicalGroup returned non-zero error code: " * string(ierr[1]))
return api__result__
end
......@@ -392,9 +356,7 @@ function setPhysicalName(dim, tag, name)
ccall((:gmshModelSetPhysicalName, gmsh.clib), Void,
(Cint, Cint, Ptr{Cchar}, Ptr{Cint}),
dim, tag, name, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelSetPhysicalName returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -410,9 +372,7 @@ function getPhysicalName(dim, tag)
ccall((:gmshModelGetPhysicalName, gmsh.clib), Void,
(Cint, Cint, Ptr{Ptr{Cchar}}, Ptr{Cint}),
dim, tag, name, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelGetPhysicalName returned non-zero error code: " * string(ierr[1]))
return name
end
......@@ -438,9 +398,7 @@ function getBoundary(dimTags, combined = true, oriented = true, recursive = fals
convert(Vector{Cint}, collect(Iterators.flatten(dimTags))), 2 * length(dimTags), api_outDimTags_, api_outDimTags_n_, combined, oriented, recursive, ierr)
tmp_api_outDimTags_ = unsafe_wrap(Array, api_outDimTags_[1], api_outDimTags_n_[1], true)
outDimTags = [ (tmp_api_outDimTags_[i], tmp_api_outDimTags_[i+1]) for i in 1:2:length(tmp_api_outDimTags_) ]
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelGetBoundary returned non-zero error code: " * string(ierr[1]))
return outDimTags
end
......@@ -463,9 +421,7 @@ function getEntitiesInBoundingBox(xmin, ymin, zmin, xmax, ymax, zmax, dim = -1)
xmin, ymin, zmin, xmax, ymax, zmax, api_tags_, api_tags_n_, dim, ierr)
tmp_api_tags_ = unsafe_wrap(Array, api_tags_[1], api_tags_n_[1], true)
tags = [ (tmp_api_tags_[i], tmp_api_tags_[i+1]) for i in 1:2:length(tmp_api_tags_) ]
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelGetEntitiesInBoundingBox returned non-zero error code: " * string(ierr[1]))
return tags
end
......@@ -483,9 +439,7 @@ function getBoundingBox(dim, tag)
ccall((:gmshModelGetBoundingBox, gmsh.clib), Void,
(Cint, Cint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cint}),
dim, tag, xmin, ymin, zmin, xmax, ymax, zmax, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelGetBoundingBox returned non-zero error code: " * string(ierr[1]))
return xmin, ymin, zmin, xmax, ymax, zmax
end
......@@ -506,9 +460,7 @@ function addDiscreteEntity(dim, tag = -1, boundary = [])
api__result__ = ccall((:gmshModelAddDiscreteEntity, gmsh.clib), Cint,
(Cint, Cint, Ptr{Cint}, Csize_t, Ptr{Cint}),
dim, tag, convert(Vector{Cint}, boundary), length(boundary), ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelAddDiscreteEntity returned non-zero error code: " * string(ierr[1]))
return api__result__
end
......@@ -524,9 +476,7 @@ function removeEntities(dimTags, recursive = false)
ccall((:gmshModelRemoveEntities, gmsh.clib), Void,
(Ptr{Cint}, Csize_t, Cint, Ptr{Cint}),
convert(Vector{Cint}, collect(Iterators.flatten(dimTags))), 2 * length(dimTags), recursive, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelRemoveEntities returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -542,9 +492,7 @@ function getType(dim, tag)
ccall((:gmshModelGetType, gmsh.clib), Void,
(Cint, Cint, Ptr{Ptr{Cchar}}, Ptr{Cint}),
dim, tag, entityType, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelGetType returned non-zero error code: " * string(ierr[1]))
return entityType
end
......@@ -569,9 +517,7 @@ function generate(dim = 3)
ccall((:gmshModelMeshGenerate, gmsh.clib), Void,
(Cint, Ptr{Cint}),
dim, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshGenerate returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -592,9 +538,7 @@ function homology(domainTags = [], subdomainTags = [], dims = [])
ccall((:gmshModelMeshHomology, gmsh.clib), Void,
(Ptr{Cint}, Csize_t, Ptr{Cint}, Csize_t, Ptr{Cint}, Csize_t, Ptr{Cint}),
convert(Vector{Cint}, domainTags), length(domainTags), convert(Vector{Cint}, subdomainTags), length(subdomainTags), convert(Vector{Cint}, dims), length(dims), ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshHomology returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -615,9 +559,7 @@ function cohomology(domainTags = [], subdomainTags = [], dims = [])
ccall((:gmshModelMeshCohomology, gmsh.clib), Void,
(Ptr{Cint}, Csize_t, Ptr{Cint}, Csize_t, Ptr{Cint}, Csize_t, Ptr{Cint}),
convert(Vector{Cint}, domainTags), length(domainTags), convert(Vector{Cint}, subdomainTags), length(subdomainTags), convert(Vector{Cint}, dims), length(dims), ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshCohomology returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -631,9 +573,7 @@ function partition(numPart)
ccall((:gmshModelMeshPartition, gmsh.clib), Void,
(Cint, Ptr{Cint}),
numPart, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshPartition returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -647,9 +587,7 @@ function refine()
ccall((:gmshModelMeshRefine, gmsh.clib), Void,
(Ptr{Cint},),
ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshRefine returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -663,9 +601,7 @@ function setOrder(order)
ccall((:gmshModelMeshSetOrder, gmsh.clib), Void,
(Cint, Ptr{Cint}),
order, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshSetOrder returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -679,9 +615,7 @@ function removeDuplicateNodes()
ccall((:gmshModelMeshRemoveDuplicateNodes, gmsh.clib), Void,
(Ptr{Cint},),
ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshRemoveDuplicateNodes returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -702,9 +636,7 @@ function getLastEntityError()
api_dimTags_, api_dimTags_n_, ierr)
tmp_api_dimTags_ = unsafe_wrap(Array, api_dimTags_[1], api_dimTags_n_[1], true)
dimTags = [ (tmp_api_dimTags_[i], tmp_api_dimTags_[i+1]) for i in 1:2:length(tmp_api_dimTags_) ]
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshGetLastEntityError returned non-zero error code: " * string(ierr[1]))
return dimTags
end
......@@ -725,9 +657,7 @@ function getLastNodeError()
(Ptr{Ptr{Cint}}, Ptr{Csize_t}, Ptr{Cint}),
api_nodeTags_, api_nodeTags_n_, ierr)
nodeTags = unsafe_wrap(Array, api_nodeTags_[1], api_nodeTags_n_[1], true)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshGetLastNodeError returned non-zero error code: " * string(ierr[1]))
return nodeTags
end
......@@ -760,9 +690,7 @@ function getNodes(dim = -1, tag = -1)
nodeTags = unsafe_wrap(Array, api_nodeTags_[1], api_nodeTags_n_[1], true)
coord = unsafe_wrap(Array, api_coord_[1], api_coord_n_[1], true)
parametricCoord = unsafe_wrap(Array, api_parametricCoord_[1], api_parametricCoord_n_[1], true)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshGetNodes returned non-zero error code: " * string(ierr[1]))
return nodeTags, coord, parametricCoord
end
......@@ -804,9 +732,7 @@ function getElements(dim = -1, tag = -1)
tmp_api_nodeTags_ = unsafe_wrap(Array, api_nodeTags_[1], api_nodeTags_nn_[1], true)
tmp_api_nodeTags_n_ = unsafe_wrap(Array, api_nodeTags_n_[1], api_nodeTags_nn_[1], true)
nodeTags = [ unsafe_wrap(Array, tmp_api_nodeTags_[i], tmp_api_nodeTags_n_[i], true) for i in 1:api_nodeTags_nn_[1] ]
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshGetElements returned non-zero error code: " * string(ierr[1]))
return elementTypes, elementTags, nodeTags
end
......@@ -829,9 +755,7 @@ function getElementProperties(elementType)
(Cint, Ptr{Ptr{Cchar}}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Ptr{Cdouble}}, Ptr{Csize_t}, Ptr{Cint}),
elementType, elementName, dim, order, numNodes, api_parametricCoord_, api_parametricCoord_n_, ierr)
parametricCoord = unsafe_wrap(Array, api_parametricCoord_[1], api_parametricCoord_n_[1], true)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshGetElementProperties returned non-zero error code: " * string(ierr[1]))
return elementName, dim, order, numNodes, parametricCoord
end
......@@ -880,9 +804,7 @@ function getIntegrationData(integrationType, functionSpaceType, dim = -1, tag =
tmp_api_functionSpaceData_ = unsafe_wrap(Array, api_functionSpaceData_[1], api_functionSpaceData_nn_[1], true)
tmp_api_functionSpaceData_n_ = unsafe_wrap(Array, api_functionSpaceData_n_[1], api_functionSpaceData_nn_[1], true)
functionSpaceData = [ unsafe_wrap(Array, tmp_api_functionSpaceData_[i], tmp_api_functionSpaceData_n_[i], true) for i in 1:api_functionSpaceData_nn_[1] ]
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshGetIntegrationData returned non-zero error code: " * string(ierr[1]))
return integrationPoints, integrationData, functionSpaceNumComponents, functionSpaceData
end
......@@ -904,9 +826,7 @@ function getElementTypes(dim = -1, tag = -1)
(Ptr{Ptr{Cint}}, Ptr{Csize_t}, Cint, Cint, Ptr{Cint}),
api_elementTypes_, api_elementTypes_n_, dim, tag, ierr)
elementTypes = unsafe_wrap(Array, api_elementTypes_[1], api_elementTypes_n_[1], true)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshGetElementTypes returned non-zero error code: " * string(ierr[1]))
return elementTypes
end
......@@ -930,9 +850,7 @@ function getElementsByType(elementType, dim = -1, tag = -1)
elementType, api_elementTags_, api_elementTags_n_, api_nodeTags_, api_nodeTags_n_, dim, tag, ierr)
elementTags = unsafe_wrap(Array, api_elementTags_[1], api_elementTags_n_[1], true)
nodeTags = unsafe_wrap(Array, api_nodeTags_[1], api_nodeTags_n_[1], true)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshGetElementsByType returned non-zero error code: " * string(ierr[1]))
return elementTags, nodeTags
end
......@@ -959,9 +877,7 @@ function getIntegrationDataByType(elementType, integrationType, functionSpaceTyp
integrationPoints = unsafe_wrap(Array, api_integrationPoints_[1], api_integrationPoints_n_[1], true)
integrationData = unsafe_wrap(Array, api_integrationData_[1], api_integrationData_n_[1], true)
functionSpaceData = unsafe_wrap(Array, api_functionSpaceData_[1], api_functionSpaceData_n_[1], true)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshGetIntegrationDataByType returned non-zero error code: " * string(ierr[1]))
return integrationPoints, integrationData, functionSpaceNumComponents, functionSpaceData
end
......@@ -982,9 +898,7 @@ function setNodes(dim, tag, nodeTags, coord, parametricCoord = [])
ccall((:gmshModelMeshSetNodes, gmsh.clib), Void,
(Cint, Cint, Ptr{Cint}, Csize_t, Ptr{Cdouble}, Csize_t, Ptr{Cdouble}, Csize_t, Ptr{Cint}),
dim, tag, convert(Vector{Cint}, nodeTags), length(nodeTags), coord, length(coord), parametricCoord, length(parametricCoord), ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshSetNodes returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -1007,9 +921,7 @@ function setElements(dim, tag, elementTypes, elementTags, nodeTags)
ccall((:gmshModelMeshSetElements, gmsh.clib), Void,
(Cint, Cint, Ptr{Cint}, Csize_t, Ptr{Ptr{Cint}}, Ptr{Csize_t}, Csize_t, Ptr{Ptr{Cint}}, Ptr{Csize_t}, Csize_t, Ptr{Cint}),
dim, tag, convert(Vector{Cint}, elementTypes), length(elementTypes), convert(Vector{Vector{Cint}},elementTags), api_elementTags_n_, length(elementTags), convert(Vector{Vector{Cint}},nodeTags), api_nodeTags_n_, length(nodeTags), ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshSetElements returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -1026,9 +938,7 @@ function reclassifyNodes()
ccall((:gmshModelMeshReclassifyNodes, gmsh.clib), Void,
(Ptr{Cint},),
ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshReclassifyNodes returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -1055,9 +965,7 @@ function getNode(nodeTag)
nodeTag, api_coord_, api_coord_n_, api_parametricCoord_, api_parametricCoord_n_, ierr)
coord = unsafe_wrap(Array, api_coord_[1], api_coord_n_[1], true)
parametricCoord = unsafe_wrap(Array, api_parametricCoord_[1], api_parametricCoord_n_[1], true)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshGetNode returned non-zero error code: " * string(ierr[1]))
return coord, parametricCoord
end
......@@ -1082,9 +990,7 @@ function getElement(elementTag)
(Cint, Ptr{Cint}, Ptr{Ptr{Cint}}, Ptr{Csize_t}, Ptr{Cint}),
elementTag, elementType, api_nodeTags_, api_nodeTags_n_, ierr)
nodeTags = unsafe_wrap(Array, api_nodeTags_[1], api_nodeTags_n_[1], true)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshGetElement returned non-zero error code: " * string(ierr[1]))
return elementType, nodeTags
end
......@@ -1100,9 +1006,7 @@ function setSize(dimTags, size)
ccall((:gmshModelMeshSetSize, gmsh.clib), Void,
(Ptr{Cint}, Csize_t, Cdouble, Ptr{Cint}),
convert(Vector{Cint}, collect(Iterators.flatten(dimTags))), 2 * length(dimTags), size, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshSetSize returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -1119,9 +1023,7 @@ function setTransfiniteCurve(tag, numNodes, meshType = "Progression", coef = 1.)
ccall((:gmshModelMeshSetTransfiniteCurve, gmsh.clib), Void,
(Cint, Cint, Ptr{Cchar}, Cdouble, Ptr{Cint}),
tag, numNodes, meshType, coef, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshSetTransfiniteCurve returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -1140,9 +1042,7 @@ function setTransfiniteSurface(tag, arrangement = "Left", cornerTags = [])
ccall((:gmshModelMeshSetTransfiniteSurface, gmsh.clib), Void,
(Cint, Ptr{Cchar}, Ptr{Cint}, Csize_t, Ptr{Cint}),
tag, arrangement, convert(Vector{Cint}, cornerTags), length(cornerTags), ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshSetTransfiniteSurface returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -1158,9 +1058,7 @@ function setTransfiniteVolume(tag, cornerTags = [])
ccall((:gmshModelMeshSetTransfiniteVolume, gmsh.clib), Void,
(Cint, Ptr{Cint}, Csize_t, Ptr{Cint}),
tag, convert(Vector{Cint}, cornerTags), length(cornerTags), ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshSetTransfiniteVolume returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -1176,9 +1074,7 @@ function setRecombine(dim, tag)
ccall((:gmshModelMeshSetRecombine, gmsh.clib), Void,
(Cint, Cint, Ptr{Cint}),
dim, tag, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshSetRecombine returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -1193,9 +1089,7 @@ function setSmoothing(dim, tag, val)
ccall((:gmshModelMeshSetSmoothing, gmsh.clib), Void,
(Cint, Cint, Cint, Ptr{Cint}),
dim, tag, val, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshSetSmoothing returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -1213,9 +1107,7 @@ function setReverse(dim, tag, val = true)
ccall((:gmshModelMeshSetReverse, gmsh.clib), Void,
(Cint, Cint, Cint, Ptr{Cint}),
dim, tag, val, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshSetReverse returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -1230,9 +1122,7 @@ function embed(dim, tags, inDim, inTag)
ccall((:gmshModelMeshEmbed, gmsh.clib), Void,
(Cint, Ptr{Cint}, Csize_t, Cint, Cint, Ptr{Cint}),
dim, convert(Vector{Cint}, tags), length(tags), inDim, inTag, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshEmbed returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -1249,9 +1139,7 @@ function setPeriodic(dim, tags, tagsSource, affineTransformation)
ccall((:gmshModelMeshSetPeriodic, gmsh.clib), Void,
(Cint, Ptr{Cint}, Csize_t, Ptr{Cint}, Csize_t, Ptr{Cdouble}, Csize_t, Ptr{Cint}),
dim, convert(Vector{Cint}, tags), length(tags), convert(Vector{Cint}, tagsSource), length(tagsSource), affineTransformation, length(affineTransformation), ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshSetPeriodic returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -1279,9 +1167,7 @@ function add(fieldType, tag = -1)
api__result__ = ccall((:gmshModelMeshFieldAdd, gmsh.clib), Cint,
(Ptr{Cchar}, Cint, Ptr{Cint}),
fieldType, tag, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshFieldAdd returned non-zero error code: " * string(ierr[1]))
return api__result__
end
......@@ -1296,9 +1182,7 @@ function remove(tag)
ccall((:gmshModelMeshFieldRemove, gmsh.clib), Void,
(Cint, Ptr{Cint}),
tag, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshFieldRemove returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -1312,9 +1196,7 @@ function setNumber(tag, option, value)
ccall((:gmshModelMeshFieldSetNumber, gmsh.clib), Void,
(Cint, Ptr{Cchar}, Cdouble, Ptr{Cint}),
tag, option, value, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshFieldSetNumber returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -1328,9 +1210,7 @@ function setString(tag, option, value)
ccall((:gmshModelMeshFieldSetString, gmsh.clib), Void,
(Cint, Ptr{Cchar}, Ptr{Cchar}, Ptr{Cint}),
tag, option, value, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshFieldSetString returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -1344,9 +1224,7 @@ function setNumbers(tag, option, value)
ccall((:gmshModelMeshFieldSetNumbers, gmsh.clib), Void,
(Cint, Ptr{Cchar}, Ptr{Cdouble}, Csize_t, Ptr{Cint}),
tag, option, value, length(value), ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshFieldSetNumbers returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -1360,9 +1238,7 @@ function setAsBackgroundMesh(tag)
ccall((:gmshModelMeshFieldSetAsBackgroundMesh, gmsh.clib), Void,
(Cint, Ptr{Cint}),
tag, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshFieldSetAsBackgroundMesh returned non-zero error code: " * string(ierr[1]))
end
"""
......@@ -1376,9 +1252,7 @@ function setAsBoundaryLayer(tag)
ccall((:gmshModelMeshFieldSetAsBoundaryLayer, gmsh.clib), Void,
(Cint, Ptr{Cint}),
tag, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelMeshFieldSetAsBoundaryLayer returned non-zero error code: " * string(ierr[1]))
end
end # end of module field
......@@ -1413,9 +1287,7 @@ function addPoint(x, y, z, meshSize = 0., tag = -1)
api__result__ = ccall((:gmshModelGeoAddPoint, gmsh.clib), Cint,
(Cdouble, Cdouble, Cdouble, Cdouble, Cint, Ptr{Cint}),
x, y, z, meshSize, tag, ierr)
if ierr[1] != 0
println(ierr[1])
end
ierr[1] != 0 && error("gmshModelGeoAddPoint returned non-zero error code: " * string(ierr[1]))
return api__result__
end
......@@ -1434,9 +1306,7 @@ function addLine(startTag, endTag, tag = -1)
api__result__ = ccall((:gmshModelGeoAddLine, gmsh.clib), Cint,
(Cint, Cint, Cint, Ptr{Cint}),
startTag, endTag, tag, ierr)
if ierr[1] != 0
println(ierr[1])