1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
4 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
5 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License.
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 #% Test function MESH::getSkin() on mesh from file cube_hexa8_quad4.med
25 #% The med file can be obtained by running create_mesh_c3h8q4 executable
27 from libMEDMEM_Swig import *
30 #befor running this script, please be sure about the path the file fileName
32 filePath=os.environ["MED_ROOT_DIR"]
33 filePath=os.path.join(filePath, "share", "salome", "resources", "med")
35 medFile = os.path.join(filePath, "cube_hexa8_quad4.med")
38 print "Read file", medFile
41 md = MEDFILEBROWSER(medFile)
43 mesh_name = md.getMeshName(0)
44 mesh = MESH(MED_DRIVER,medFile,mesh_name)
46 print "Building the support on all (8) Cells of the mesh."
47 supportCell = mesh.getSupportOnAll(MED_CELL)
49 print "Getting skin of an all cell support"
51 supportSkin = mesh.getSkin(supportCell)
52 faceNumbers = supportSkin.getNumber( supportSkin.getTypes()[0] )
53 print "--------", faceNumbers
54 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]:
55 raise RuntimeError, "Wrong skin of an all cell support"
57 print "Build the support on 1 Cell (#8) of the mesh."
58 supportCell = SUPPORT( supportCell )
59 supportCell.setAll( 0 )
62 GeometricType = mesh.getTypes(MED_CELL)
65 supportCell.setpartial("1 Cell support",nbGeomTypes,nbTotalEntity,GeometricType,nbEntityList,EntityNbs)
67 print "Getting skin of 1 cell support"
68 supportSkin = mesh.getSkin(supportCell)
69 faceNumbers = supportSkin.getNumber( supportSkin.getTypes()[0] )
70 print "Skin Support FACE numbers:"
71 print "--------", faceNumbers
72 if faceNumbers != [18, 26, 33, 34, 35, 36]:
73 raise RuntimeError, "Wrong skin of 1 cell support"
77 print "Building the support on 2 Cells (#1 #2) of the mesh."
81 supportCell.setpartial("2 Cell support",nbGeomTypes,nbTotalEntity,GeometricType,nbEntityList,EntityNbs)
83 print "Getting skin of 2 cell support"
84 supportSkin = mesh.getSkin(supportCell)
85 faceNumbers = supportSkin.getNumber( supportSkin.getTypes()[0] )
86 print "Skin Support FACE numbers:", faceNumbers
87 if faceNumbers != [1, 2, 3, 4, 6, 7, 8, 9, 10, 11]:
88 raise RuntimeError, "Wrong skin of 2 cells support"