Salome HOME
bos #29171 Refactor testing procedure
[modules/smesh.git] / doc / examples / defining_hypotheses_ex09.py
1 # Defining Meshing Algorithms
2
3 import salome
4 salome.salome_init_without_session()
5
6 from salome.geom import geomBuilder
7 from salome.smesh import smeshBuilder
8
9 geom_builder = geomBuilder.New()
10 smesh_builder = smeshBuilder.New()
11
12 # create a box
13 box = geom_builder.MakeBoxDXDYDZ(10., 10., 10.)
14 geom_builder.addToStudy(box, "Box")
15
16 # Create a hexahedral mesh on the box
17 hexa = smesh_builder.Mesh(box, "Box : hexahedrical mesh")
18
19 # create a Regular 1D algorithm for edges
20 algo1D = hexa.Segment()
21
22 # create a quadrangle 2D algorithm for faces
23 algo2D = hexa.Quadrangle()
24
25 # create a hexahedron 3D algorithm for solids
26 algo3D = hexa.Hexahedron()
27
28 # define hypotheses
29 algo1D.Arithmetic1D(1, 4)
30
31 # compute the mesh
32 hexa.Compute()
33
34 # 2. Create a tetrahedral mesh on the box
35 tetra = smesh_builder.Mesh(box, "Box : tetrahedrical mesh")
36
37 # create a Regular 1D algorithm for edges
38 algo1D = tetra.Segment()
39
40 # create a Mefisto 2D algorithm for faces
41 algo2D = tetra.Triangle()
42
43 # create a 3D algorithm for solids
44 algo3D = tetra.Tetrahedron()
45
46 # define hypotheses
47 algo1D.Arithmetic1D(1, 4)
48 algo2D.LengthFromEdges()
49
50 # compute the mesh
51 tetra.Compute()