Meshing.jl icon indicating copy to clipboard operation
Meshing.jl copied to clipboard

GeometryBasics example errors

Open jlchan opened this issue 3 years ago • 7 comments

When I run the first example in https://juliageometry.github.io/Meshing.jl/dev/api/#Quick-Start-GeometryBasics-1 using the following code https://gist.github.com/jlchan/833c7b085149500bbd2e79c7a227cf07, I get an error.

ERROR: LoadError: MethodError: no method matching (AbstractMesh{GeometryBasics.Ngon{Dim, Float32, 3, PointMeta{Dim, Float32, Pointf{Dim}, (:normals,), Tuple{Vec{3, Float32}}}}} where Dim)(::var"#15#16", ::Rect3{Float64}, ::MarchingCubes{Float64})
Stacktrace:
 [1] top-level scope
   @ ~/Downloads/test.jl:9
in expression starting at /Users/jessechan/Downloads/test.jl:9

I'm using Julia 1.6.3 if that helps.

jlchan avatar Nov 01 '21 20:11 jlchan

Something changed between GeometryBasics 0.2 and 0.4 AbstractMesh definition (as in, it doesn't exist) . I think for the 1.0 release of this package I will remove the high level convenience APIs (GeometryTypes and GeometryBasics), since they change too much. Can you see if the isosurface API is sufficient for your use case?

sjkelly avatar Nov 01 '21 21:11 sjkelly

I'm not sure it is - does it support only rectangular domains? I was going to ask this in a separate issue, but I'm actually hoping to use marching tets on data represented using an unstructured tetrahedral mesh. I saw that you mentioned there was some progress in that direction in https://github.com/JuliaGeometry/Meshing.jl/issues/22?

jlchan avatar Nov 01 '21 21:11 jlchan

Yes, this package only supports rectangular domains at the moment, and it only covers surface meshing strategies. We got https://github.com/JuliaGeometry/DistMesh.jl registered for tetrahedral meshes, but it is still very alpha and researchy. If you are interested in DistMesh and have an application in mind, please file and issue there so I know where to focus my efforts in the future :)

sjkelly avatar Nov 02 '21 02:11 sjkelly

Also the GeometryBasics and GeometryTypes API are simply some convenience over the core isosurface function so the functionality should be the same regardless of entry point. You may need to make a few more constructor calls, but it shouldn't impact performance at all :)

sjkelly avatar Nov 02 '21 02:11 sjkelly

Thanks for the explanation, and glad to see DistMesh.jl registered!

For our application (visualization of fluid flows computed using Trixi.jl), I'm looking to create isosurfaces from a user-provided tetrahedral mesh and vertex data. Since this is just on the generation of the isosurface and not the tetrahedral mesh, should this issue be filed here or in DistMesh.jl?

jlchan avatar Nov 02 '21 15:11 jlchan

This package and DistMesh are for inputs of scalar fields or signed-distance functions with outputs of surface (Meshes.jl) or volume/tetrahedral mesh (DistMesh). I see in Trixi.jl (cool package BTW), that you are using GeometryBasics. This seems like an operation that would be needed on the core mesh type there. E.g. convert tetrahedral mesh into (iso)surface mesh. I would also point you in the direction of Meshes.jl which probably has better data structures for what you need, and is taking a far more rigorous approach to Mesh data structures and operations: https://juliageometry.github.io/Meshes.jl/stable/meshes.html

sjkelly avatar Nov 02 '21 19:11 sjkelly

Reopening because the documentation is still broken

sjkelly avatar Nov 02 '21 22:11 sjkelly

Going forward we will not maintain the GeometryBasics API. It will be trivial to do

verts, faces = isosurface(V)
GeometryBasics.Mesh(verts, faces)

sjkelly avatar Jun 25 '24 00:06 sjkelly