Skip to content

JLD2 crahses on grid[UniqueCellGeometries] #94

@pjaap

Description

@pjaap

small example:

julia> using ExtendableGrids, JLD2
julia> grid = grid_unitsquare(Triangle2D)
ExtendableGrid{Float64, Int32}
      dim =       2
   nnodes =       5
   ncells =       4
  nbfaces =       4

# init the UniqueCellGeometries
julia> grid[UniqueCellGeometries]
1-element Vector{Union{Type{Circle2D}, Type{Edge1D}, Type{Hexagon2D}, Type{Hexahedron3D}, Type{Parallelepiped3D}, Type{Parallelogram2D}, Type{Pentagon2D}, Type{Polygon2D}, Type{Polyhedron3D}, Type{Prism3D}, Type{Quadrilateral2D}, Type{Rectangle2D}, Type{RectangularCuboid3D}, Type{Sphere3D}, Type{Tetrahedron3D}, Type{Triangle2D}, Type{TrianglePrism3D}, Type{Vertex0D}}}:
 Triangle2D

# save and load
julia> JLD2.save("grid.jld2", "grid", grid)
julia> grid2 = JLD2.load("grid.jld2")["grid"]
ExtendableGrid{Float64, Int32}
      dim =       2
   nnodes =       5
   ncells =       4
  nbfaces =       4

julia> grid2[UniqueCellGeometries]
ERROR: MethodError: Cannot `convert` an object of type 
  Vector{DataType} to an object of type 
  Union{ElementInfo{Union{Type{Circle2D}, Type{Edge1D}, Type{Hexagon2D}, Type{Hexahedron3D}, Type{Parallelepiped3D}, Type{Parallelogram2D}, Type{Pentagon2D}, Type{Polygon2D}, Type{Polyhedron3D}, Type{Prism3D}, Type{Quadrilateral2D}, Type{Rectangle2D}, Type{RectangularCuboid3D}, Type{Sphere3D}, Type{Tetrahedron3D}, Type{Triangle2D}, Type{TrianglePrism3D}, Type{Vertex0D}}}, GridRegionTypes{Union{Type{Circle2D}, Type{Edge1D}, Type{Hexagon2D}, Type{Hexahedron3D}, Type{Parallelepiped3D}, Type{Parallelogram2D}, Type{Pentagon2D}, Type{Polygon2D}, Type{Polyhedron3D}, Type{Prism3D}, Type{Quadrilateral2D}, Type{Rectangle2D}, Type{RectangularCuboid3D}, Type{Sphere3D}, Type{Tetrahedron3D}, Type{Triangle2D}, Type{TrianglePrism3D}, Type{Vertex0D}}}}
The function `convert` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  convert(::Type{T}, ::T) where T
   @ Base Base_compiler.jl:133
  convert(::Type{T}, ::Factorization) where T<:AbstractArray
   @ LinearAlgebra ~/.julia/juliaup/julia-1.12.0-beta4+0.x64.linux.gnu/share/julia/stdlib/v1.12/LinearAlgebra/src/factorization.jl:104
  convert(::Type{T}, ::T) where T<:AbstractArray
   @ Base abstractarray.jl:16
  ...

Stacktrace:
 [1] getindex(grid::ExtendableGrid{Float64, Int32}, T::Type{UniqueCellGeometries})
   @ ExtendableGrids ~/.julia/packages/ExtendableGrids/3XkNs/src/extendablegrid.jl:128
 [2] top-level scope
   @ REPL[12]:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions