1 # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License.
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 BASE = os.environ["MED_ROOT_DIR"]
24 BASE = os.path.join( BASE, 'share', 'salome', 'resources', 'med' )
26 fileName = os.path.join( BASE, 'pointe.med' )
27 fileName = os.path.join( BASE, 'carre_en_quad4_seg2.med' )
29 # MED Mesh read from a (local) file
31 from libMEDMEM_Swig import *
35 mdDriver = MED_MED_RDONLY_DRIVER(fileName, md)
38 mdDriver.readFileStruct()
41 mLocal = md.getMesh(md.getMeshName(0))
44 # MED Mesh recieved from a distant component (via CORBA)
46 from omniORB import CORBA
47 from LifeCycleCORBA import *
48 from libSALOME_Swig import *
50 orb = CORBA.ORB_init([''], CORBA.ORB_ID)
51 lcc = LifeCycleCORBA(orb)
53 C = lcc.FindOrLoadComponent("FactoryServerPy", "Compo1Py")
54 C.Initialise(fileName)
56 mDistant = C.Calcul1()
59 print "Name : ", mDistant.getName()
68 n1 = mLocal.getNumberOfTypes(i);
69 n2 = mDistant.getNumberOfTypes(i);
72 raise RuntimeError, "MESH::getNumberOfTypes()"
74 if ((n1 > 0) & (i != MED_NODE)):
75 T1 = mLocal.getTypes(i);
76 T2 = mDistant.getTypes(i);
77 print "types (local) : ", i, " : ", T1;
78 print "types (distant) : ", i, " : ", T2;
82 "len(MESH::getTypes()) <> MESH::getNumberOfTypes()"
85 if (T1[j] != eval(T2[j].__str__())):
86 raise RuntimeError, "MESH::getTypes()"
88 e1 = mLocal.getNumberOfElements(i, T1[j]);
89 e2 = mDistant.getNumberOfElements(i, T2[j]);
91 print "elements (local) : ", T1[j], " : ", e1;
92 print "elements (distant) : ", T2[j], " : ", e2;
95 raise RuntimeError, "MESH::getNumberOfElements"
98 print "All tests passed"