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

Basic mesh examples #99

Open
mancellin opened this issue Oct 11, 2024 · 10 comments
Open

Basic mesh examples #99

mancellin opened this issue Oct 11, 2024 · 10 comments

Comments

@mancellin
Copy link
Contributor

Inti's mesh type looks very powerful, but seems a bit complicated for my basic needs.

Could you provide some basic examples of just defining a 2D boundary from a list of point, or a 3D surface from a list of triangles of shape nb_faces × 3 × 3?

@maltezfaria
Copy link
Member

At the moment you can't really create a mesh by simply passing e.g. points and connectivities, but that should be easy to add. One issue I see is that it would not support many of the operations currently supported by our mesh type, but you would be able to create a quadrature and solve an integral equation on it, so it may be enough 👍

@maltezfaria
Copy link
Member

But what about using the gmsh API? You can just import meshes from there:

using Inti
using Gmsh
filename = joinpath(Inti.PROJECT_ROOT,"docs", "assets", "piece.msh")
msh = Inti.import_mesh(filename)

@mancellin
Copy link
Contributor Author

One issue I see is that it would not support many of the operations currently supported by our mesh type

How many methods would I need to implement to have my own DumbMesh type and pass it to Quadrature and single_double_layer()?

But what about using the gmsh API?

That's a possible workaround, but it would be nice to test my hydrodynamical meshes without a detour by Gmsh.

@tanderson92
Copy link
Member

Doesn't this issue expand the scope of Inti beyond integral equations? The docs are explicit that we view meshing as outside our scope.

@maltezfaria
Copy link
Member

Doesn't this issue expand the scope of Inti beyond integral equations? The docs are explicit that we view meshing as outside our scope.

I think this is well within the scope of stuff we can/should cover.

@maltezfaria
Copy link
Member

maltezfaria commented Oct 12, 2024

How many methods would I need to implement to have my own DumbMesh type and pass it to Quadrature and single_double_layer()?

You would need to implement element_types(msh) to return a list of element types of your mesh, and elements(msh,E) to return an iterable collection of elements of a given type. For simple meshes containing only one type, this is an overkill, but needed since the internals support meshes with elements of various types.

But what about using the gmsh API?

That's a possible workaround, but it would be nice to test my hydrodynamical meshes without a detour by Gmsh.

It would be easy to create a constructor like simple_mesh(nodes::Vector{SVector{N,T}}, connectivity::Matrix{Int}) returning a mesh of a single element type (but still using our internal mesh format). You probably would still need to pass an element type, since e.g. nodes in 3d and a 4 x n connectivity matrix could mean a surface mesh of quads or a volume mesh of tetras.

But even simpler: is there a mesh format you have in mind? FWIW, this could be as easy as extending import_mesh to cover your type. If you have a mesh format and example file, I could look into that.

@mancellin
Copy link
Contributor Author

You probably would still need to pass an element type, since e.g. nodes in 3d and a 4 x n connectivity matrix could mean a surface mesh of quads or a volume mesh of tetras.

Call the function simple_surface_mesh(...) and there is no ambiguity anymore?

But even simpler: is there a mesh format you have in mind? FWIW, this could be as easy as extending import_mesh to cover your type. If you have a mesh format and example file, I could look into that.

I have a couple of STL files, so you can start by providing some interface with https://github.com/JuliaIO/MeshIO.jl
The more niche hydro qmesh format are basically a list of quadrilateral faces under the form Tuple{Vector{SVector{3, Float64}}, Vector{SVector{4, Int}}} or Vector{SVector{4, SVector{3, Float64}}}}. I'll need to write some IO for another project, so we can do some interfacing then.

@maltezfaria
Copy link
Member

You probably would still need to pass an element type, since e.g. nodes in 3d and a 4 x n connectivity matrix could mean a surface mesh of quads or a volume mesh of tetras.

Call the function simple_surface_mesh(...) and there is no ambiguity anymore?

Sure, that is possible. But I am not sure how useful it would be. Do people really create a mesh by hand and pass the points? It is more likely the points are already in some file right?

But even simpler: is there a mesh format you have in mind? FWIW, this could be as easy as extending import_mesh to cover your type. If you have a mesh format and example file, I could look into that.

I have a couple of STL files, so you can start by providing some interface with https://github.com/JuliaIO/MeshIO.jl The more niche hydro qmesh format are basically a list of quadrilateral faces under the form Tuple{Vector{SVector{3, Float64}}, Vector{SVector{4, Int}}} or Vector{SVector{4, SVector{3, Float64}}}}. I'll need to write some IO for another project, so we can do some interfacing then.

I think STL files are already supported. I just tried the following on a simple cube.stl mesh file:

using Inti
using Gmsh
msh = Inti.import_mesh("cube.stl")

and it worked. As long as gmsh.open(file) works, Inti should be able to handle the rest.

@mancellin
Copy link
Contributor Author

Sure, that is possible. But I am not sure how useful it would be. Do people really create a mesh by hand and pass the points? It is more likely the points are already in some file right?

For basic meshes, users (like myself) might want to use their own loaders or mesh-tweaking-function.

I would be nice to have either a simple API or (the initial question of this thread) an example of how to handle Dict{DataType, AbstractVector} with 1 entry: LagrangeElement{ReferenceSimplex{2}, 3, SVector{3, Float64}} => LagrangeElement{ReferenceSimplex{2}, 3, SVector{3, Float64}}[LagrangeElement{ReferenceSimpl….

I think STL files are already supported.

👍 I keep underestimating Gmsh.

@maltezfaria
Copy link
Member

Fair enough, I guess I see your use case now...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants