Back to index

salome-med  6.5.0
MED_test2.py
Go to the documentation of this file.
00001 #  -*- coding: iso-8859-1 -*-
00002 # Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00003 #
00004 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00005 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00006 #
00007 # This library is free software; you can redistribute it and/or
00008 # modify it under the terms of the GNU Lesser General Public
00009 # License as published by the Free Software Foundation; either
00010 # version 2.1 of the License.
00011 #
00012 # This library is distributed in the hope that it will be useful,
00013 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 # Lesser General Public License for more details.
00016 #
00017 # You should have received a copy of the GNU Lesser General Public
00018 # License along with this library; if not, write to the Free Software
00019 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00020 #
00021 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00022 #
00023 
00024 #  MED MED : implemetation of MED idl descriptions
00025 #  File   : MED_test2.py
00026 #  Author : 
00027 #  Module : MED
00028 #  $Header: /home/server/cvs/MED/MED_SRC/src/MED/MED_test2.py,v 1.8.2.2.8.3.10.1 2012-04-13 08:48:15 vsr Exp $
00029 #
00030 import salome
00031 import SALOME
00032 import os
00033 
00034 filePath=os.environ["MED_ROOT_DIR"]
00035 filePath=os.path.join(filePath, "share", "salome", "resources", "med")
00036 medFile=os.path.join(filePath, "mesh.med")
00037 
00038 med=salome.lcc.FindOrLoadComponent("FactoryServer", "MED")
00039 
00040 try:
00041   mesh=med.readMeshInFile(medFile, salome.myStudyName,"Mesh 1")
00042 except SALOME.SALOME_Exception, ex:
00043   print ex.details
00044   print ex.details.type
00045   print ex.details.text
00046   print ex.details.sourceFile
00047   print ex.details.lineNumber
00048 
00049   raise
00050 
00051 print mesh.getName()
00052 print mesh.getNumberOfNodes()
00053 
00054 medFile = os.path.join(filePath,"pointe.med")
00055 try:
00056   field=med.readFieldInFile(medFile,salome.myStudyName,"fieldcelldoublescalar",-1,-1)
00057 except SALOME.SALOME_Exception, ex:
00058   print ex.details
00059   print ex.details.type
00060   print ex.details.text
00061   print ex.details.sourceFile
00062   print ex.details.lineNumber
00063 
00064   raise
00065 
00066 print field.getName()
00067 print field.getDescription()
00068 print field.getNumberOfComponents()
00069