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' )
31 if (len(x) != len(y)):
33 for i in xrange(len(x)):
38 # MED Mesh read from a (local) file
40 from libMEDMEM_Swig import *
44 mdDriver = MED_MED_RDONLY_DRIVER(fileName, md)
47 mdDriver.readFileStruct()
50 mLocal = md.getMesh(md.getMeshName(0))
53 # MED Mesh recieved from a distant component (via CORBA)
55 from omniORB import CORBA
56 from LifeCycleCORBA import *
57 from libSALOME_Swig import *
59 orb = CORBA.ORB_init([''], CORBA.ORB_ID)
60 lcc = LifeCycleCORBA(orb)
62 C = lcc.FindOrLoadComponent("FactoryServerPy", "Compo1Py")
63 C.Initialise(fileName)
65 mDistant = C.Calcul1()
68 print "Name : ", mDistant.getName()
77 n1 = mLocal.getNumberOfTypes(i);
78 n2 = mDistant.getNumberOfTypes(i);
81 raise RuntimeError, "MESH::getNumberOfTypes()"
83 if ((n1 > 0) & (i != MED_NODE)):
84 T1 = mLocal.getTypes(i);
85 T2 = mDistant.getTypes(i);
89 "len(MESH::getTypes()) <> MESH::getNumberOfTypes()"
93 raise RuntimeError, "MESH::getTypes()"
95 c1 = mLocal.getConnectivity(MED_FULL_INTERLACE, MED_NODAL, \
97 c2 = mDistant.getConnectivity(MED_FULL_INTERLACE, MED_NODAL, \
100 print "connectivity (local) : ", T1[j], " : ", c1;
101 print "connectivity (distant) : ", T2[j], " : ", c2;
103 if (compare(c1, c2) == 0):
104 raise RuntimeError, "MESH::getConnectivity()"
107 print "All tests passed"