]> SALOME platform Git repositories - modules/med.git/blob - src/MEDMEM_SWIG/med_test_skin.py
Salome HOME
NRI : Merge from V1_2.
[modules/med.git] / src / MEDMEM_SWIG / med_test_skin.py
1 #  MED MEDMEM_SWIG : binding of C++ implementation and Python
2 #
3 #  Copyright (C) 2003  CEA/DEN, EDF R&D
4 #
5 #
6 #
7 #  File   : med_test_skin.py
8 #  Module : MED
9
10 #% Test function MESH::getSkin() on mesh from file cube_hexa8_quad4.med
11 #% The med file can be obtained by running create_mesh_c3h8q4 executable
12
13 from libMEDMEM_Swig import *
14
15 medFile = "cube_hexa8_quad4.med"
16
17 md = MED()
18
19 mdDriver = MED_MED_RDONLY_DRIVER(medFile,md)
20
21 print ""
22 print "Read file", medFile
23 print ""
24
25 mdDriver.open()
26 mdDriver.readFileStruct()
27 mdDriver.close()
28
29 mesh_name = md.getMeshName(0)
30 mesh = md.getMesh(mesh_name)
31 mesh.read()
32
33 print "Building the support on all (8) Cells of the mesh."
34 supportCell = SUPPORT(mesh)
35 supportCell.update()
36
37 print "Getting skin of an all cell support"
38
39 supportSkin = mesh.getSkin(supportCell)
40 faceNumbers = supportSkin.getNumber( supportSkin.getTypes()[0] )
41 print "--------", faceNumbers
42 if faceNumbers != [2, 3, 6, 8, 10, 11, 12, 13, 16, 17, 19, 20, 22, 23, 24, 27, 28, 29, 30, 31, 32, 34, 35, 36]:
43   raise  RuntimeError, "Wrong skin of an all cell support"
44   
45 print "Build the support on 1 Cell (#8) of the mesh."
46 supportCell.setAll( 0 )
47 nbGeomTypes = 1
48 nbTotalEntity = 1
49 GeometricType = mesh.getTypes(MED_CELL)
50 nbEntityList = [1, 2]
51 EntityNbs = [8]
52 supportCell.setpartial("1 Cell support",nbGeomTypes,nbTotalEntity,GeometricType,nbEntityList,EntityNbs)
53
54 print "Getting skin of 1 cell support"
55 supportSkin = mesh.getSkin(supportCell)
56 faceNumbers = supportSkin.getNumber( supportSkin.getTypes()[0] )
57 print "Skin Support FACE numbers:"
58 print "--------", faceNumbers
59 if faceNumbers != [18, 26, 33, 34, 35, 36]:
60   raise  RuntimeError, "Wrong skin of 1 cell support"
61
62
63
64 print "Building the support on 2 Cells (#1 #2) of the mesh."
65 nbTotalEntity = 2
66 nbEntityList = [1, 3]
67 EntityNbs = [1, 2]
68 supportCell.setpartial("2 Cell support",nbGeomTypes,nbTotalEntity,GeometricType,nbEntityList,EntityNbs)
69
70 print "Getting skin of 2 cell support"
71 supportSkin = mesh.getSkin(supportCell)
72 faceNumbers = supportSkin.getNumber( supportSkin.getTypes()[0] )
73 print "Skin Support FACE numbers:", faceNumbers
74 if faceNumbers != [1, 2, 3, 4, 6, 7, 8, 9, 10, 11]:
75   raise  RuntimeError, "Wrong skin of 2 cells support"