diff --git a/Project.toml b/Project.toml index 680b2a3a..76afd8c7 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ExtendableGrids" uuid = "cfc395e8-590f-11e8-1f13-43a2532b2fa8" authors = ["Juergen Fuhrmann , Christian Merdon "] -version = "1.0.0" +version = "1.1.0" [deps] AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" @@ -14,13 +14,15 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Requires = "ae029012-a4dd-5104-9daa-d747884805df" -Revise = "295af30f-e4ad-537b-8983-00126c2a3abe" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192" +[weakdeps] +Gmsh = "705231aa-382f-11e9-3f0c-b7cb4346fdeb" + [extensions] ExtendableGridsGmshExt = "Gmsh" @@ -30,7 +32,7 @@ Bijections = "0.1.4" DocStringExtensions = "0.8,0.9" ElasticArrays = "1" Gmsh = "0.2.2" -Requires = "1.1.3" +Requires = "1.3" StaticArrays = "1" StatsBase = "0.34" WriteVTK = "1.14" @@ -38,7 +40,3 @@ julia = "1.6" [extras] Gmsh = "705231aa-382f-11e9-3f0c-b7cb4346fdeb" - - -[weakdeps] -Gmsh = "705231aa-382f-11e9-3f0c-b7cb4346fdeb" diff --git a/ext/ExtendableGridsGmshExt.jl b/ext/ExtendableGridsGmshExt.jl index f3cd1ea3..6996c91b 100644 --- a/ext/ExtendableGridsGmshExt.jl +++ b/ext/ExtendableGridsGmshExt.jl @@ -1,11 +1,10 @@ module ExtendableGridsGmshExt -#if isdefined(Base, :get_extension) -# ###!!! We do only need gmsh directly, no Gridap stuff -# import Gmsh: gmsh -#else -# import ..Gmsh: gmsh -#end +if isdefined(Base, :get_extension) + import Gmsh: gmsh +else + import ..Gmsh: gmsh +end import ExtendableGrids: ExtendableGrid, simplexgrid import ExtendableGrids: Coordinates, CellNodes, CellRegions, BFaceNodes, BFaceRegions @@ -15,7 +14,6 @@ import ExtendableGrids: simplexgrid_from_gmsh, write_gmsh #!!! Make a license warning at initialization ? Gmsh is GPL - mention this in the readme. ###??? Do we really need this dependency here ? I would rather like to live without, the more that it seems to make some problems. -using Gmsh: gmsh using StatsBase: countmap using Bijections @@ -350,9 +348,14 @@ end (this function has to be called with an initialized gmsh environment) """ function grid_to_gmshfile(grid::ExtendableGrid, filename::String) - - gmsh.model = grid_to_mod(grid) + if VERSION>=v"1.9" + # This possibility is new in 1.9, see + # https://github.com/JuliaLang/julia/blob/release-1.9/NEWS.md#new-language-features + gmsh.model = grid_to_mod(grid) + else + grid_to_mod(grid) + end gmsh.write(filename) end diff --git a/src/ExtendableGrids.jl b/src/ExtendableGrids.jl index d48473ec..94027a83 100644 --- a/src/ExtendableGrids.jl +++ b/src/ExtendableGrids.jl @@ -14,6 +14,9 @@ using Dates using LinearAlgebra +if !isdefined(Base, :get_extension) + using Requires +end include("adjacency.jl") @@ -183,4 +186,15 @@ export TokenStream, gettoken, expecttoken,trytoken include("io.jl") export writeVTK + +@static if !isdefined(Base, :get_extension) + function __init__() + @require Gmsh = "705231aa-382f-11e9-3f0c-b7cb4346fdeb" begin + include("../ext/ExtendableGridsGmshExt.jl") + end + end +end + + + end # module diff --git a/src/simplexgrid.jl b/src/simplexgrid.jl index 613a2c56..d7537006 100644 --- a/src/simplexgrid.jl +++ b/src/simplexgrid.jl @@ -731,14 +731,11 @@ function simplexgrid(file::String;format="") end -# Implementation in Gmsh ext +# Implementations in Gmsh extension function simplexgrid_from_gmsh end function write_gmsh end -function simplexgrid(mod::Module) - -end """ $(TYPEDSIGNATURES)