9 homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD")
15 study = salome.myStudyManager.NewStudy("HOMARD")
16 homard.SetCurrentStudy(study)
20 case_1 = homard.CreateCas("Case 1")
21 case_1.SetNomDir("/tmp/homard")
22 case_1.SetTypeConf(12)
23 case_1.SetBoiteEnglobante([1.2,2.3,3.4,4.5,5.6,6.7,7.8,8.9,9.10,10.11])
27 hypo_1 = homard.CreateHypothese("Hypothesis 1")
28 hypo_1.SetTypeAdapRaffDera(2,3,4)
29 hypo_1.SetField("Field 1", 12, 3.45, 67, 23.343)
30 hypo_1.AjoutComposant("Comp 1")
31 hypo_1.AjoutComposant("Comp 2")
32 hypo_1.AjoutComposant("Comp 3")
36 hypo_2 = homard.CreateHypothese("Hypothesis 2")
37 hypo_2.SetTypeAdapRaffDera(20,30,40)
38 hypo_2.SetField("Field 2", 5, 12.67223, 900, 6.5434)
39 hypo_2.AjoutComposant("Comp 123")
43 iter_1 = homard.CreateIteration("Iteration 1")
46 iter_1.SetMeshFile("/aaaa/bbbb/AAAAA.med")
47 iter_1.SetNomMesh("My Mesh")
48 iter_1.SetField("Field 1", 42, 522)
52 iter_2 = homard.CreateIteration("Iteration 2")
55 iter_2.SetMeshFile("/cccc/cccc/asd.med")
56 iter_2.SetNomMesh("MeshXZY")
57 iter_2.SetField("Field 2", 22222, 50000)
59 # create iteration 3 (not published)
61 iter_3 = homard.CreateIteration("Iteration 3")
63 iter_3.SetNumIter(666)
64 iter_3.SetMeshFile("/not/assigned/iteration/file.med")
65 iter_3.SetNomMesh("NOT ASSIGNED")
66 iter_3.SetField("Field XXX", 999, -1)
70 zone_1 = homard.CreateZone("Zone 1")
71 zone_1.SetBox(1.,2.,3.,4.,5.,6.)
72 zone_1.SetTypeZone(5454)
76 zone_2 = homard.CreateZone("Zone 2")
77 zone_2.SetSphere(12.3, 3.4, .56, 6.5)
78 zone_2.SetTypeZone(6545)
82 homard.AssocieCasIteration("Case 1", "Iteration 1")
83 homard.AssocieCasIteration("Case 1", "Iteration 2")
84 homard.AssocieHypoIteration("Iteration 1", "Hypothesis 1")
85 homard.AssocieHypoZone("Zone 1", "Hypothesis 1")
86 homard.AssocieHypoIteration("Iteration 2", "Hypothesis 2")
87 homard.AssocieHypoZone("Zone 2", "Hypothesis 2")
88 homard.AssocieIterationIteration("Iteration 1", "Iteration 2")
92 salome.myStudyManager.SaveAs(fname, study, 0)
96 salome.myStudyManager.Close(study)
100 def test_load(fname):
104 study = salome.myStudyManager.Open(fname)
108 comp = study.FindComponent("HOMARD")
109 builder = study.NewBuilder()
110 builder.LoadWith(comp, homard)
114 print homard.GetCurrentStudy()._get_StudyId()
118 case_1 = homard.GetCas("Case 1")
119 print "Case: ", case_1.GetNomCas()
120 print "-> nom dir:", case_1.GetNomDir()
121 print "-> type conf:", case_1.GetTypeConf()
122 print "-> boite:", case_1.GetBoiteEnglobante()
127 hypo_1 = homard.GetHypothesis("Hypothesis 1")
128 print "Hypothesis: ", hypo_1.GetNomHypothesis()
129 print "-> type:", hypo_1.GetTypeAdapRaffDera()
130 print "-> field name:", hypo_1.GetFieldName()
131 print "-> composants:", hypo_1.GetComposants()
132 print "-> zones:", hypo_1.GetZones()
137 hypo_2 = homard.GetHypothesis("Hypothesis 2")
138 print "Hypothesis: ", hypo_2.GetNomHypothesis()
139 print "-> type:", hypo_2.GetTypeAdapRaffDera()
140 print "-> field name:", hypo_2.GetFieldName()
141 print "-> composants:", hypo_2.GetComposants()
142 print "-> zones:", hypo_2.GetZones()
147 zone_1 = homard.GetZone("Zone 1")
148 print "Zone: ", zone_1.GetNomZone()
149 print "-> type zone:", zone_1.GetTypeZone()
150 print "-> shere:", zone_1.GetSphere()
151 print "-> box:", zone_1.GetBox()
152 print "-> hypotheses:", zone_1.GetHypo()
157 zone_2 = homard.GetZone("Zone 2")
158 print "Zone: ", zone_2.GetNomZone()
159 print "-> type zone:", zone_2.GetTypeZone()
160 print "-> shere:", zone_2.GetSphere()
161 print "-> box:", zone_2.GetBox()
162 print "-> hypotheses:", zone_2.GetHypo()
167 iter_1 = homard.GetIteration("Iteration 1")
168 print "Iteration: ", iter_1.GetNomIter()
169 print "-> etat:", iter_1.GetEtat()
170 print "-> num iter:", iter_1.GetNumIter()
171 print "-> nom mesh:", iter_1.GetNomMesh()
172 print "-> mesh file:", iter_1.GetMeshFile()
173 print "-> field:", iter_1.GetFieldFileName()
174 print "-> time step:", iter_1.GetTimeStep()
175 print "-> rank:", iter_1.GetRank()
176 print "-> parent iter:", iter_1.GetIterParent()
177 print "-> hypothesis:", iter_1.GetNomHypo()
178 print "-> case:", iter_1.GetNomCas()
183 iter_2 = homard.GetIteration("Iteration 2")
184 print "Iteration: ", iter_2.GetNomIter()
185 print "-> etat:", iter_2.GetEtat()
186 print "-> num iter:", iter_2.GetNumIter()
187 print "-> nom mesh:", iter_2.GetNomMesh()
188 print "-> mesh file:", iter_2.GetMeshFile()
189 print "-> field:", iter_2.GetFieldFileName()
190 print "-> time step:", iter_2.GetTimeStep()
191 print "-> rank:", iter_2.GetRank()
192 print "-> parent iter:", iter_2.GetIterParent()
193 print "-> hypothesis:", iter_2.GetNomHypo()
194 print "-> case:", iter_2.GetNomCas()
199 iter_3 = homard.GetIteration("Iteration 3")
200 print "Iteration: ", iter_3.GetNomIter()
201 print "-> etat:", iter_3.GetEtat()
202 print "-> num iter:", iter_3.GetNumIter()
203 print "-> nom mesh:", iter_3.GetNomMesh()
204 print "-> mesh file:", iter_3.GetMeshFile()
205 print "-> field:", iter_3.GetFieldFileName()
206 print "-> time step:", iter_3.GetTimeStep()
207 print "-> rank:", iter_3.GetRank()
208 print "-> parent iter:", iter_3.GetIterParent()
209 print "-> hypothesis:", iter_3.GetNomHypo()
210 print "-> case:", iter_3.GetNomCas()
214 filename = "/tmp/save_homard.hdf"