Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show function of ExtendableGrid throws error #70

Closed
pjaap opened this issue Nov 13, 2024 · 3 comments · Fixed by #71
Closed

show function of ExtendableGrid throws error #70

pjaap opened this issue Nov 13, 2024 · 3 comments · Fixed by #71
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@pjaap
Copy link
Member

pjaap commented Nov 13, 2024

ExtendableGrids v1.10.4
Julia 1.11.0

In REPL, a simple

julia> using ExtendableGrids
julia> ExtendableGrid{Float64,Int32}()

throws an error trying to show the object:

Error showing value of type ExtendableGrid{Float64, Int64}:
ERROR: MethodError: no method matching instantiate(::ExtendableGrid{Float64, Int64}, ::Type{Coordinates})
The function `instantiate` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  instantiate(::ExtendableGrid{Tc, Ti}, ::Type{EdgeRegions}) where {Tc, Ti}
   @ ExtendableGrids ~/.julia/packages/ExtendableGrids/7u1Kj/src/derived.jl:1186
  instantiate(::ExtendableGrid{Tc, Ti}, ::Type{FaceNodes}) where {Tc, Ti}
   @ ExtendableGrids ~/.julia/packages/ExtendableGrids/7u1Kj/src/derived.jl:162
  instantiate(::ExtendableGrid{Tc, Ti}, ::Type{BFaceFaces}) where {Tc, Ti}
   @ ExtendableGrids ~/.julia/packages/ExtendableGrids/7u1Kj/src/derived.jl:1025
  ...

Stacktrace:
  [1] (::ExtendableGrids.var"#7#8"{ExtendableGrid{Float64, Int64}, DataType})()
    @ ExtendableGrids ~/.julia/packages/ExtendableGrids/7u1Kj/src/extendablegrid.jl:272
  [2] get!(default::ExtendableGrids.var"#7#8"{ExtendableGrid{Float64, Int64}, DataType}, h::Dict{Type{<:AbstractGridComponent}, Any}, key::Type{Coordinates})
    @ Base ./dict.jl:458
  [3] get!
    @ ~/.julia/packages/ExtendableGrids/7u1Kj/src/extendablegrid.jl:272 [inlined]
  [4] getindex(grid::ExtendableGrid{Float64, Int64}, T::Type{Coordinates})
    @ ExtendableGrids ~/.julia/packages/ExtendableGrids/7u1Kj/src/extendablegrid.jl:63
  [5] dim_space
    @ ~/.julia/packages/ExtendableGrids/7u1Kj/src/extendablegrid.jl:356 [inlined]
  [6] show(io::IOContext{Base.TTY}, grid::ExtendableGrid{Float64, Int64})
    @ ExtendableGrids ~/.julia/packages/ExtendableGrids/7u1Kj/src/extendablegrid.jl:545
  [7] show(io::IOContext{Base.TTY}, ::MIME{Symbol("text/plain")}, x::ExtendableGrid{Float64, Int64})
    @ Base.Multimedia ./multimedia.jl:47
  [8] (::REPL.var"#68#69"{REPL.REPLDisplay{REPL.LineEditREPL}, MIME{Symbol("text/plain")}, Base.RefValue{Any}})(io::Any)
    @ REPL /usr/local/julia/share/julia/stdlib/v1.11/REPL/src/REPL.jl:348
  [9] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL /usr/local/julia/share/julia/stdlib/v1.11/REPL/src/REPL.jl:646
 [10] display(d::REPL.REPLDisplay, mime::MIME{Symbol("text/plain")}, x::Any)
    @ REPL /usr/local/julia/share/julia/stdlib/v1.11/REPL/src/REPL.jl:334
 [11] display
    @ /usr/local/julia/share/julia/stdlib/v1.11/REPL/src/REPL.jl:353 [inlined]
 [12] display(x::Any)
    @ Base.Multimedia ./multimedia.jl:340
 [13] #invokelatest#2
    @ ./essentials.jl:1054 [inlined]
 [14] invokelatest
    @ ./essentials.jl:1051 [inlined]
 [15] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
    @ REPL /usr/local/julia/share/julia/stdlib/v1.11/REPL/src/REPL.jl:390
 [16] (::REPL.var"#70#71"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL /usr/local/julia/share/julia/stdlib/v1.11/REPL/src/REPL.jl:359
 [17] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL /usr/local/julia/share/julia/stdlib/v1.11/REPL/src/REPL.jl:646
 [18] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL /usr/local/julia/share/julia/stdlib/v1.11/REPL/src/REPL.jl:357
 [19] (::REPL.var"#do_respond#96"{Bool, Bool, REPL.var"#112#130"{REPL.LineEditREPL, REPL.REPLHistoryProvider}, REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
    @ REPL /usr/local/julia/share/julia/stdlib/v1.11/REPL/src/REPL.jl:988
 [20] #invokelatest#2
    @ ./essentials.jl:1054 [inlined]
 [21] invokelatest
    @ ./essentials.jl:1051 [inlined]
 [22] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit /usr/local/julia/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:2749
 [23] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL /usr/local/julia/share/julia/stdlib/v1.11/REPL/src/REPL.jl:1456
 [24] (::REPL.var"#75#81"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL /usr/local/julia/share/julia/stdlib/v1.11/REPL/src/REPL.jl:461
@pjaap pjaap added bug Something isn't working good first issue Good for newcomers labels Nov 13, 2024
@j-fu
Copy link
Member

j-fu commented Nov 13, 2024

Well, yes, never tried to create this kind of empty grid in the repl.

IMHO dim_space, num_nodes, num_cells, num_bfaces should return 0 if there
are no Coordinates, CellNodes, BFaceNodes. This would fix this.

@pjaap
Copy link
Member Author

pjaap commented Nov 14, 2024

I'll fix this if you want and add tests for some default constructors. I think this is an important issue since it scares beginners of Julia when they discover things in the REPL, like it did when I encountered this problem.

@pjaap
Copy link
Member Author

pjaap commented Nov 14, 2024

See #71

@j-fu j-fu closed this as completed in #71 Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants