1 from omniORB import CORBA
12 host = os.getenv( 'HOST' )
14 orb = CORBA.ORB_init([''], CORBA.ORB_ID)
16 lcc = LifeCycleCORBA.LifeCycleCORBA(orb)
19 ################ GET A MED FIELD FROM FILE pointe.med ###################
21 # This test program is based on the field named fieldcelldoublevector in
22 # med file $MED_ROOT_DIR/share/salome/resources/pointe.med
23 from os import environ
24 filePath=environ["MED_ROOT_DIR"]
25 filePath=filePath+"/share/salome/resources/"
26 medFile=filePath+"pointe.med"
27 fieldname = "fieldcelldoublescalar"
29 # Launch the Med Component and use it to load into memory the test field
30 print "Launch the Med Component: "
31 #CCRTmed_comp = salome.lcc.FindOrLoadComponent("FactoryServer", "MED")
32 med_comp = lcc.FindOrLoadComponent("FactoryServer", "MED")
34 # Get a Corba field proxy on the distant field (located in the med_comp server).
36 studyname = salome.myStudyName
37 studynameId = salome.myStudyId
38 print "We are working in the study ",studyname," with the ID ",studynameId
39 print "Read field ",fieldname
40 fieldcell = med_comp.readFieldInFile(medFile,studyname,fieldname,-1,-1)
41 fieldcelldouble = fieldcell._narrow(SALOME_MED.FIELDDOUBLE)
42 except SALOME.SALOME_Exception, ex:
46 print ex.details.sourceFile
47 print ex.details.lineNumber
50 print "Description of Field : "
52 print fieldcelldouble.getName()
53 print fieldcelldouble.getDescription()
54 print fieldcelldouble.getNumberOfComponents()
57 ############## Load Calculator Component and test it ###################
60 print "Load Calculator Component "
61 # we need to import CALCULATOR_ORB to get a typed object (to perform narrowing)
63 calculator = salome.lcc.FindOrLoadComponent("FactoryServer", "CALCULATOR")
65 print "Appel cloneField : fieldcelldouble -> f1,f2,f3,f4"
66 (f1,f2,f3,f4)=calculator.cloneField(fieldcelldouble) # fieldcelldouble is consumed
68 calculator.printField(f1)
69 print "Add fields f2+f3"
70 f_add=calculator.add(f2, f3)
71 calculator.printField(f_add)
74 print "Apply linear function"
75 f_lin=calculator.applyLin(f4,2.0,1.0)
77 print "Appel Norme Max "
78 norme=calculator.normMax(f_lin)
79 print " -> norme = ",norme
81 print "End of Calculator Test!"