Back to index

salome-med  6.5.0
MEDMEM_InvokingDriverByAttachingItToAnObject.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 ######################################################################
00025 # This Python script should be executed when the shared library is   #
00026 # generated using SWIG 1.3 (or higher) due to the fact that older    #
00027 # version could not handle the wrapping of several class constructor #
00028 ######################################################################
00029 #
00030 from libMEDMEM_Swig import *
00031 
00032 medFile = "pointe.med"
00033 medFile2 = "Field&MeshGeneratedPointe.med"
00034 fieldName = "fieldcelldoublescalar"
00035 meshName = "maa1"
00036 
00037 try:
00038     myField = FIELDDOUBLE()
00039     myRdOnlyDriver = MED_FIELDDOUBLE_RDONLY_DRIVER(medFile,myField)
00040     myRdOnlyDriver.setFieldName(fieldName)
00041     myRdOnlyDriver.open()
00042 
00043     myWrOnlyDriver = MED_FIELDDOUBLE_WRONLY_DRIVER(medFile2,myField)
00044     myWrOnlyDriver.open()
00045 
00046     myRdOnlyDriver.close()
00047     myWrOnlyDriver.close()
00048 
00049     print "Invoking field drivers OK"
00050 except :
00051     print "there is a problem in invoking field drivers !!"
00052     print "Please consult the error standart output of the python execution !!"
00053 
00054 try:
00055     myMesh = MESH()
00056 
00057     myRdOnlyDriver = MED_MESH_RDONLY_DRIVER(medFile,myMesh)
00058     myRdOnlyDriver.setMeshName(meshName)
00059     myRdOnlyDriver.open()
00060     myRdOnlyDriver.read()
00061     myRdOnlyDriver.close()
00062 
00063     myWrOnlyDriver = MED_MESH_WRONLY_DRIVER(medFile2,myMesh)
00064     myWrOnlyDriver.setMeshName(meshName)
00065     myWrOnlyDriver.open()
00066     myWrOnlyDriver.write()
00067     myWrOnlyDriver.close()
00068 
00069     print "Invoking mesh drivers OK"
00070 except :
00071     print "there is a problem in invoking mesh drivers !!"
00072     print "Please consult the error standart output of the python execution !!"
00073