API dos not preserve tags in format MSH2
With gmsh-4.11.0-py2.py3-none-manylinux1_x86_64.whl
installed the GMSH Python API
does not preserve node and element tags when writing to the format MSH2.
Code to reproduce:
gmsh.initialize(argv=[])
model_name = "model"
#gmsh.model.add(model_name)
#gmsh.model.mesh.addNodes(0, node_entity_tag, node_tags, coords)
gmsh.model.add("simple model")
surf = gmsh.model.addDiscreteEntity(2)
gmsh.model.mesh.addNodes(2, surf, [10, 20, 30, 40],
[0., 0., 0., 1., 0., 0., 1., 1., 0., 0., 1., 0.])
gmsh.model.mesh.addElementsByType(surf, 2, [100, 200], [10, 20, 30, 10, 30, 40])
gmsh.write("test_gmsh_direct.msh2")
gmsh.clear()
gmsh.finalize()
Resulting file:
$MeshFormat
2.2 0 8
$EndMeshFormat
$Nodes
3
1 1 2 3
2 2 3 1
3 3 1 2
$EndNodes
$Elements
2
1 2 2 100 1000 2 1 3
2 2 2 100 1000 2 3 3
$EndElements
The format MSH4 is fine. We use API to write down a modified mesh. Then for output of the ElementData, we relay on our own writer in order to write out individual time steps, which seems to not be well supported by the API (can not append to the file). As the element tags are not preserved we have trouble to associate data to correct elements.
Question: What is meaning of entity in gmsh.model.mesh.addNodes
?
What if the node is shared by several entities?
Is it correct to create particular entity dim=0 just for all nodes?
That is what we do, but the reproduction code demonstrated, this is not the source of the problem.
Thank you for any help. Jan Brezina