Salome HOME
IPAL21363 Compute hangs up on Hypothesis Distribution of Layers.
[modules/smesh.git] / src / SMESH_SWIG / ex30_tepal.py
1 #! /usr/bin/python
2 #  -*- coding: iso-8859-1 -*-
3 # CEA/LGLS 2008, Christian Van Wambeke (CEA/LGLS), Francis KLOSS (OCC)
4 # ====================================================================
5
6 import os
7
8 import geompy
9 import smesh
10
11 # Parameters
12 # ----------
13
14 results = "/tmp/ZZ"
15
16 radius =  50
17 height = 200
18
19 # Build a cylinder
20 # ----------------
21
22 base = geompy.MakeVertex(0, 0, 0)
23 direction = geompy.MakeVectorDXDYDZ(0, 0, 1)
24
25 cylinder = geompy.MakeCylinder(base, direction, radius, height)
26
27 geompy.addToStudy(cylinder, "Cylinder")
28
29 # Define a mesh on a geometry
30 # ---------------------------
31
32 m = smesh.Mesh(cylinder)
33
34 # 2D mesh with BLSURF
35 # -------------------
36
37 algo2d = m.Triangle(smesh.BLSURF)
38
39 algo2d.SetPhysicalMesh(1)
40 algo2d.SetPhySize(5)
41
42 algo2d.SetGeometricMesh(0)
43
44 # 3D mesh with tepal
45 # ------------------
46
47 algo3d = m.Tetrahedron(smesh.GHS3DPRL)
48
49 algo3d.SetMEDName(results)
50 algo3d.SetNbPart(4)
51 algo3d.SetBackground(False)
52 algo3d.SetKeepFiles(False)
53 algo3d.SetToMeshHoles(True)
54
55 # Launch meshers
56 # --------------
57
58 status = m.Compute()
59
60 # Test if ok
61 # ----------
62
63 if os.access(results+".xml", os.F_OK):
64     print "Ok: tepal"
65 else:
66     print "KO: tepal"