diff --git a/Project.toml b/Project.toml index 42e505df..75a9249e 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ExtendableGrids" uuid = "cfc395e8-590f-11e8-1f13-43a2532b2fa8" -authors = ["Juergen Fuhrmann ", "Christian Merdon ", "Johannes Taraz ", "Patrick Jaap "] version = "1.14.2" +authors = ["Juergen Fuhrmann ", "Christian Merdon ", "Johannes Taraz ", "Patrick Jaap "] [deps] AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" @@ -19,6 +19,7 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" +WeakDepHelpers = "7869a13a-7328-4bcf-a489-0f4bb64497c7" WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192" [weakdeps] @@ -53,5 +54,6 @@ StatsBase = "0.34" TetGen = "1.5.1, 2" Triangulate = "2.3.2, 3" UUIDs = "1.6" +WeakDepHelpers = "0.1.0" WriteVTK = "1.14" julia = "1.9" diff --git a/src/ExtendableGrids.jl b/src/ExtendableGrids.jl index be3d404a..81efa805 100644 --- a/src/ExtendableGrids.jl +++ b/src/ExtendableGrids.jl @@ -12,9 +12,22 @@ using Printf using Random using Dates using LinearAlgebra +using WeakDepHelpers import Graphs +const WEAKDEP_METHOD_ERROR_HINT_CACHE = WeakDepCache() +function register_weakdep_cache(cache::Dict{Function, Tuple{Vararg{Symbol}}}) + if isdefined(Base.Experimental, :register_error_hint) + Base.Experimental.register_error_hint(MethodError) do io, exc, argtypes, kwargs + WeakDepHelpers.method_error_hint_callback(cache,io,exc,argtypes,kwargs) + end + end +end + +function __init__() + register_weakdep_cache(WEAKDEP_METHOD_ERROR_HINT_CACHE) +end include("adjacency.jl") export Adjacency, VariableTargetAdjacency, FixedTargetAdjacency export atranspose, num_targets, num_sources, num_links, append!, max_num_targets_per_source diff --git a/src/io.jl b/src/io.jl index 553aa026..d8ee48f0 100644 --- a/src/io.jl +++ b/src/io.jl @@ -162,19 +162,12 @@ function simplexgrid(file::String; format = "", kwargs...) end function simplexgrid(file::String, ::Type{Val{:msh}}; kwargs...) - return try - simplexgrid_from_gmsh(file) - catch e - throw(ErrorException("Missing Gmsh extension. Add Gmsh.jl to your environment and import it to read msh files.")) - end + simplexgrid_from_gmsh(file) end function simplexgrid(file::String, ::Type{Val{:geo}}; kwargs...) - return try - simplexgrid_from_gmsh(file) - catch e - throw(ErrorException("Missing Gmsh extension. Add Gmsh.jl to your environment and import it to read geo files.")) - end + + simplexgrid_from_gmsh(file) end function simplexgrid(file::String, ::Type{Val{:sg}}; kwargs...) @@ -272,7 +265,8 @@ function simplexgrid(file::String, ::Type{Val{:sg}}; kwargs...) return g end -function simplexgrid_from_gmsh end +@declare_method_is_in_extension WEAKDEP_METHOD_ERROR_HINT_CACHE simplexgrid_from_gmsh (:Gmsh,) +# function simplexgrid_from_gmsh end function simplexgrid_to_gmsh end