smesh/doc/examples/modifying_meshes_split_vol.py

21 lines
572 B
Python
Raw Permalink Normal View History

2018-05-25 22:04:48 +05:00
# Split volumic elements into tetrahedrons
import salome
salome.salome_init_without_session()
2018-05-25 22:04:48 +05:00
from salome.geom import geomBuilder
from salome.smesh import smeshBuilder
2022-04-11 18:28:01 +05:00
geom_builder = geomBuilder.New()
smesh_builder = smeshBuilder.New()
2018-05-25 22:04:48 +05:00
# mesh a hexahedral mesh
2022-04-11 18:28:01 +05:00
box = geom_builder.MakeBoxDXDYDZ (1, 1, 1 )
mesh = smesh_builder.Mesh( box )
2018-05-25 22:04:48 +05:00
mesh.AutomaticHexahedralization(0)
print("Nb volumes mesh: %s" % mesh.NbHexas())
# split each hexahedron into 6 tetrahedra
2022-04-11 18:28:01 +05:00
mesh.SplitVolumesIntoTetra( mesh, smesh_builder.Hex_6Tet )
2018-05-25 22:04:48 +05:00
print("Nb volumes mesh: %s" % mesh.NbTetras())