1 # MED MEDMEM_SWIG : binding of C++ implementation and Python
3 # Copyright (C) 2003 CEA/DEN, EDF R&D
7 # File : med_test_skin.py
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
13 from libMEDMEM_Swig import *
15 medFile = "cube_hexa8_quad4.med"
19 mdDriver = MED_MED_RDONLY_DRIVER(medFile,md)
22 print "Read file", medFile
26 mdDriver.readFileStruct()
29 mesh_name = md.getMeshName(0)
30 mesh = md.getMesh(mesh_name)
33 print "Building the support on all (8) Cells of the mesh."
34 supportCell = SUPPORT(mesh)
37 print "Getting skin of an all cell support"
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"
45 print "Build the support on 1 Cell (#8) of the mesh."
46 supportCell.setAll( 0 )
49 GeometricType = mesh.getTypes(MED_CELL)
52 supportCell.setpartial("1 Cell support",nbGeomTypes,nbTotalEntity,GeometricType,nbEntityList,EntityNbs)
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"
64 print "Building the support on 2 Cells (#1 #2) of the mesh."
68 supportCell.setpartial("2 Cell support",nbGeomTypes,nbTotalEntity,GeometricType,nbEntityList,EntityNbs)
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"