5 ################ GET A MED FIELD FROM FILE pointe.med ###################
7 # This test program is based on the field named fieldcelldoublevector in
8 # med file $MED_ROOT_DIR/share/salome/resources/pointe.med
10 filePath=environ["MED_ROOT_DIR"]
11 filePath=filePath+"/share/salome/resources/"
12 medFile=filePath+"pointe.med"
13 fieldname = "fieldcelldoublescalar"
15 # Launch the Med Component and use it to load into memory the test field
16 print "Launch the Med Component: "
17 med_comp = salome.lcc.FindOrLoadComponent("FactoryServer", "MED")
19 # Get a Corba field proxy on the distant field (located in the med_comp server).
21 studyname = salome.myStudyName
22 studynameId = salome.myStudyId
23 print "We are working in the study ",studyname," with the ID ",studynameId
24 print "Read field ",fieldname
25 fieldcell = med_comp.readFieldInFile(medFile,studyname,fieldname,-1,-1)
26 fieldcelldouble = fieldcell._narrow(SALOME_MED.FIELDDOUBLE)
27 except SALOME.SALOME_Exception, ex:
31 print ex.details.sourceFile
32 print ex.details.lineNumber
35 print "Description of Field : "
37 print fieldcelldouble.getName()
38 print fieldcelldouble.getDescription()
39 print fieldcelldouble.getNumberOfComponents()
42 ############## Load Calculator Component and test it ###################
45 print "Load Calculator Component "
46 # we need to import CALCULATOR_ORB to get a typed object (to perform narrowing)
48 calculator = salome.lcc.FindOrLoadComponent("FactoryServer", "CALCULATOR")
50 print "Appel cloneField : fieldcelldouble -> f1,f2,f3,f4"
51 (f1,f2,f3,f4)=calculator.cloneField(fieldcelldouble) # fieldcelldouble is consumed
53 calculator.printField(f1)
54 print "Add fields f2+f3"
55 f_add=calculator.add(f2, f3)
56 calculator.printField(f_add)
59 print "Apply linear function"
60 f_lin=calculator.applyLin(f4,2.0,1.0)
62 print "Appel Norme Max "
63 norme=calculator.normMax(f_lin)
64 print " -> norme = ",norme
66 print "End of Calculator Test!"