1 # Arithmetic Progression and Geometric Progression
4 salome.salome_init_without_session()
6 from salome.geom import geomBuilder
7 from salome.smesh import smeshBuilder
9 geom_builder = geomBuilder.New()
10 smesh_builder = smeshBuilder.New()
13 box = geom_builder.MakeBoxDXDYDZ(10., 10., 10.)
14 geom_builder.addToStudy(box, "Box")
16 # create a hexahedral mesh on the box
17 hexa = smesh_builder.Mesh(box, "Box : hexahedrical mesh")
19 # create a Regular 1D algorithm for edges
20 algo1D = hexa.Segment()
22 # optionally reverse node distribution on certain edges
23 allEdges = geom_builder.SubShapeAllSorted( box, geom_builder.ShapeType["EDGE"])
24 reversedEdges = [ allEdges[0], allEdges[4] ]
26 # define "Arithmetic1D" hypothesis to cut all edges in several segments with increasing arithmetic length
27 algo1D.Arithmetic1D(1, 4, reversedEdges)
29 # define "Geometric Progression" hypothesis on one edge to cut this edge in segments with length increasing by 20% starting from 1
30 gpAlgo = hexa.Segment( allEdges[1] )
31 gpAlgo.GeometricProgression( 1, 1.2 )
33 # propagate distribution of nodes computed using "Geometric Progression" to parallel edges
34 gpAlgo.PropagationOfDistribution()
36 # create a quadrangle 2D algorithm for faces
39 # create a hexahedron 3D algorithm for solids
43 if not hexa.Compute(): raise Exception("Error when computing Mesh")