2013-02-12 20:37:44 +06:00
|
|
|
# Construction of a Mesh
|
|
|
|
|
2013-04-04 13:08:19 +06:00
|
|
|
import salome
|
2021-08-12 14:38:10 +05:00
|
|
|
salome.salome_init_without_session()
|
2013-04-04 13:08:19 +06:00
|
|
|
|
2022-04-11 18:28:01 +05:00
|
|
|
from salome.geom import geomBuilder
|
2013-04-04 13:08:19 +06:00
|
|
|
from salome.smesh import smeshBuilder
|
2022-04-11 18:28:01 +05:00
|
|
|
|
|
|
|
geom_builder = geomBuilder.New()
|
|
|
|
smesh_builder = smeshBuilder.New()
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# create a box
|
2022-04-11 18:28:01 +05:00
|
|
|
box = geom_builder.MakeBox(0., 0., 0., 100., 200., 300.)
|
|
|
|
idbox = geom_builder.addToStudy(box, "box")
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# create a mesh
|
2022-04-11 18:28:01 +05:00
|
|
|
tetra = smesh_builder.Mesh(box, "MeshBox")
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
algo1D = tetra.Segment()
|
|
|
|
algo1D.NumberOfSegments(7)
|
|
|
|
|
|
|
|
algo2D = tetra.Triangle()
|
|
|
|
algo2D.MaxElementArea(800.)
|
|
|
|
|
|
|
|
algo3D = tetra.Tetrahedron()
|
|
|
|
algo3D.MaxElementVolume(900.)
|
|
|
|
|
|
|
|
# compute the mesh
|
|
|
|
ret = tetra.Compute()
|
|
|
|
if ret == 0:
|
2017-03-20 17:27:30 +05:00
|
|
|
print("problem when computing the mesh")
|
2013-02-12 20:37:44 +06:00
|
|
|
else:
|
2017-03-20 17:27:30 +05:00
|
|
|
print("mesh computed")
|
2013-02-12 20:37:44 +06:00
|
|
|
pass
|