17 January 2017 at 23 h 35 min #8399
I need to create simple meshes (for exemple, L-shaped/T-shaped meshes). To create those meshes, I used the
RegularGridcomponent to build blocks of hexahedra, and then I used the
MergeMeshescomponent to merge the blocks into a full mesh topology.
Something like that:
<RegularGrid name="grid1" nx="5" ny="3" nz="3" xmin="-4" xmax="0" ymin="0" ymax="2" zmin="0" zmax="2" /> <RegularGrid name="grid2" nx="3" ny="3" nz="3" xmin="-4" xmax="-2" ymin="2" ymax="4" zmin="0" zmax="2" /> <MergeMeshes name="L-mesh" nbMeshes="2" position1="@grid1.position" quads1="@grid1.quads" tetrahedra1="@grid1.tetrahedra" hexahedra1="@grid1.hexahedra" position2="@grid2.position" quads2="@grid2.quads" tetrahedra2="@grid2.tetrahedra" hexahedra2="@grid2.hexahedra" />
This will create an L-shaped mesh, grid1 is the lower part of the L, grid2 is the upper part.
It is working as intended, I believe. The only thing is that the vertices between the two grid will be duplicated.
Is there another component in SOFA that would do the same as this but by merging a vertex with another one if they are at the same position?
If not, would it be a good feature to add an option to the
MergeMeshescomponent to find duplicated vertices and merge them (in the positions vector as well as all the topologies indices that link to those position)?
Jean-Nico18 January 2017 at 8 h 36 min #8400AlexParticipant
have you tried to merge your input meshes in the first place, and then apply a regular grid on the result?
If you would like to detect duplicated vertices, I wouldn’t do it directly in MergeMeshes but rather in another component, so that it can be used without the will to merge meshes.
Alex18 January 2017 at 21 h 00 min #8402
I’m actually using regular grids as building blocks of my final mesh. It is a lazy way of building my mesh since you can easily, with regular grid, set the number of DOFs.
Once I’m satisfied with the resulting “building blocks” (regular grids) ‘s topology, I’m using MergeMeshes to merge them into one single mesh on which the simulation will run.
I think it would be a cool feature to add a little boolean on the MergeMeshes component to automatically merge duplicated vertices. Then I can build quickly some scenario for my scene in a couple of lines (regular grids until I’m satisfied with the meshing, and then the MergeMeshes into a complete mesh).
Hope that makes sense.19 January 2017 at 9 h 00 min #8403AlexParticipant
Yes, I understand your scene. But, I propose to modify your pipeline in order to avoid the need to merge duplicated vertices. My idea is to merge your input meshes (and not your grids), and then computing one unique grid on the result. It’s just inverting your steps. Here is an example:
<MeshObjLoader name="upLoader" filename="up.obj"/> <MeshObjLoader name="downLoader" filename="down.obj"/> <Node name="merge"> <MergeMeshes position1="@../upLoader.position" position2="@../downLoader.position" quads1="@../upLoader.quads" quads2="@../downLoader.quads" name="merge"/> <!-- <OglModel position="@merge.position" quads="@merge.quads"/> --> <Node name="topology"> <SparseGridTopology drawHexahedra="true" n="10 10 10" vertices="@../merge.position" input_quads="@merge.quads" name="grid"/> <VTKExporter filename="hexa.vtu" hexas="true" position="@grid.position" exportAtBegin="true" overwrite="true"/> </Node> </Node>
Seems to work. This method requires that you want the same hexa size in the whole mesh. In the method you presented, you can define multiple hexa size depending on your initial mesh, but it will be complicated to merge them even if you have a boolean to remove duplicated vertices due to topology problems.
If you really want to remove duplicates, you would need to add a distance parameter to define what duplicated vertices are.
Let me know if I understood correctly19 January 2017 at 15 h 52 min #8404
Yes, you understood perfectly.
I only had in my head the case where the boundary’s vertices of the two meshes are to be merged and are aligned, which is an easy case. But you are right, handling other cases (for example, when the element of the two meshes overlaps, or like you said, with different boundaries size) would demand more work.
At that point, I will probably use an external tool to build the surface and to control the meshing of the volume of my different scenarios. The idea was just to stay from A to Z in SOFA and to build rapidly (and intuitively) different scenarios in a couple of lines like you would do in some software like COMSOL. I did however underestimate the task 😉
Well I was just curious, thanks for your inputs!
- You must be logged in to reply to this topic.