Salome HOME
Merge branch 'BR_LAND_COVER_MAP' into BR_quadtree
[modules/hydro.git] / doc / salome / examples / h011_normalCaseManualInterpolZ.py
1 # -*- coding: utf-8 -*-
2
3 import os
4 HYDRO_SAMPLES = os.path.join( os.environ["HYDRO_ROOT_DIR"], "bin/salome/test/HYDRO")
5
6 import sys
7 import salome
8
9 salome.salome_init()
10 theStudy = salome.myStudy
11   
12 #----------------------
13 # --- HYDRO 
14 #----------------------
15
16 from HYDROPy import *
17 from PyQt4.QtCore import *
18 from PyQt4.QtGui import *
19
20 hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() )
21
22 hydro_doc.SetLocalCS( 430000, 6.35e+06 )
23
24 garonne_ign_01 = hydro_doc.CreateObject( KIND_IMAGE )
25 garonne_ign_01.SetName( "garonne_ign_01" )
26
27 garonne_ign_01.SetZLevel( 0 )
28
29
30 garonne_ign_01.LoadImage(os.path.join(HYDRO_SAMPLES, "garonne_ign_01.png" ))
31
32 garonne_ign_01.SetLocalPoints( QPoint( 40, 817 ),
33                                QPoint( 1325, 85 ) )
34
35 garonne_ign_01.SetGlobalPoints( 1,
36                                 QPointF( 471562, 6.36775e+06 ),
37                                 QPointF( 489400, 6.37702e+06 ) )
38
39 garonne_ign_01.Update()
40
41 garonne_ign_02 = hydro_doc.CreateObject( KIND_IMAGE )
42 garonne_ign_02.SetName( "garonne_ign_02" )
43
44 garonne_ign_02.SetZLevel( 1 )
45
46
47 garonne_ign_02.LoadImage( os.path.join(HYDRO_SAMPLES, "garonne_ign_02.png" ))
48
49 garonne_ign_02.SetLocalPoints( QPoint( 1389, 447 ),
50                                QPoint( 784, 481 ) )
51
52 garonne_ign_02.SetGlobalPoints( 3,
53                                 QPointF( 631, 95 ),
54                                 QPointF( 26, 129 ) )
55 garonne_ign_02.SetTrsfReferenceImage( garonne_ign_01 )
56
57 garonne_ign_02.Update()
58
59 garonne = hydro_doc.CreateObject( KIND_POLYLINEXY )
60 garonne.SetName( "garonne" )
61
62 garonne.SetZLevel( 2 )
63
64 garonne.AddSection( "Section_1", 1, 1 )
65 garonne.AddPoint( 0, gp_XY( 38191.48, 33184.55 ) )
66 garonne.AddPoint( 0, gp_XY( 38553.78, 33013.53 ) )
67 garonne.AddPoint( 0, gp_XY( 38993.90, 32767.64 ) )
68 garonne.AddPoint( 0, gp_XY( 39678.58, 32533.58 ) )
69 garonne.AddPoint( 0, gp_XY( 40240.26, 32305.27 ) )
70 garonne.AddPoint( 0, gp_XY( 40717.94, 32193.70 ) )
71 garonne.AddPoint( 0, gp_XY( 41361.00, 32464.18 ) )
72 garonne.AddPoint( 0, gp_XY( 41831.41, 32626.69 ) )
73 garonne.AddPoint( 0, gp_XY( 41950.14, 32618.24 ) )
74 garonne.AddPoint( 0, gp_XY( 42524.97, 32419.61 ) )
75 garonne.AddPoint( 0, gp_XY( 42909.80, 32291.33 ) )
76 garonne.AddPoint( 0, gp_XY( 43177.03, 32269.95 ) )
77 garonne.AddPoint( 0, gp_XY( 43465.65, 32344.78 ) )
78 garonne.AddPoint( 0, gp_XY( 43754.27, 32152.37 ) )
79 garonne.AddPoint( 0, gp_XY( 44128.40, 31842.37 ) )
80 garonne.AddPoint( 0, gp_XY( 44003.90, 31269.93 ) )
81 garonne.AddPoint( 0, gp_XY( 44010.82, 30869.63 ) )
82 garonne.AddPoint( 0, gp_XY( 44064.26, 30655.84 ) )
83 garonne.AddPoint( 0, gp_XY( 44434.73, 30366.18 ) )
84 garonne.AddPoint( 0, gp_XY( 45208.04, 30484.81 ) )
85 garonne.AddPoint( 0, gp_XY( 45705.01, 30287.34 ) )
86 garonne.AddPoint( 0, gp_XY( 45933.89, 30046.87 ) )
87 garonne.AddPoint( 0, gp_XY( 46127.34, 29490.68 ) )
88 garonne.AddPoint( 0, gp_XY( 46111.60, 29226.08 ) )
89 garonne.AddPoint( 0, gp_XY( 46228.62, 28784.05 ) )
90 garonne.AddPoint( 0, gp_XY( 46247.64, 28449.75 ) )
91 garonne.AddPoint( 0, gp_XY( 46108.48, 28086.94 ) )
92 garonne.AddPoint( 0, gp_XY( 45618.52, 27553.74 ) )
93 garonne.AddPoint( 0, gp_XY( 45276.77, 27042.78 ) )
94 garonne.AddPoint( 0, gp_XY( 45001.89, 26273.15 ) )
95 garonne.AddPoint( 0, gp_XY( 45167.76, 25975.34 ) )
96 garonne.AddPoint( 0, gp_XY( 46018.15, 25848.84 ) )
97 garonne.AddPoint( 0, gp_XY( 46378.94, 25872.21 ) )
98 garonne.AddPoint( 0, gp_XY( 46885.57, 25937.64 ) )
99 garonne.AddPoint( 0, gp_XY( 47278.36, 25782.88 ) )
100 garonne.AddPoint( 0, gp_XY( 47153.86, 25728.04 ) )
101 garonne.AddPoint( 0, gp_XY( 46987.51, 25749.97 ) )
102 garonne.AddPoint( 0, gp_XY( 46658.26, 25715.71 ) )
103 garonne.AddPoint( 0, gp_XY( 45650.76, 25634.46 ) )
104 garonne.AddPoint( 0, gp_XY( 45122.63, 25748.21 ) )
105 garonne.AddPoint( 0, gp_XY( 44797.63, 26325.09 ) )
106 garonne.AddPoint( 0, gp_XY( 45114.51, 27168.75 ) )
107 garonne.AddPoint( 0, gp_XY( 45508.28, 27713.21 ) )
108 garonne.AddPoint( 0, gp_XY( 45994.19, 28382.53 ) )
109 garonne.AddPoint( 0, gp_XY( 45927.01, 29201.34 ) )
110 garonne.AddPoint( 0, gp_XY( 45756.39, 29859.47 ) )
111 garonne.AddPoint( 0, gp_XY( 45390.76, 30151.97 ) )
112 garonne.AddPoint( 0, gp_XY( 45039.85, 30120.84 ) )
113 garonne.AddPoint( 0, gp_XY( 44513.26, 30084.28 ) )
114 garonne.AddPoint( 0, gp_XY( 43923.42, 30426.28 ) )
115 garonne.AddPoint( 0, gp_XY( 43768.81, 30934.29 ) )
116 garonne.AddPoint( 0, gp_XY( 43820.10, 31425.20 ) )
117 garonne.AddPoint( 0, gp_XY( 43854.78, 31801.12 ) )
118 garonne.AddPoint( 0, gp_XY( 43479.64, 32053.54 ) )
119 garonne.AddPoint( 0, gp_XY( 42923.47, 32051.85 ) )
120 garonne.AddPoint( 0, gp_XY( 42493.64, 32187.97 ) )
121 garonne.AddPoint( 0, gp_XY( 42074.27, 32302.91 ) )
122 garonne.AddPoint( 0, gp_XY( 41624.75, 32330.93 ) )
123 garonne.AddPoint( 0, gp_XY( 41325.93, 32187.97 ) )
124 garonne.AddPoint( 0, gp_XY( 40879.52, 31987.29 ) )
125 garonne.AddPoint( 0, gp_XY( 40308.78, 32018.46 ) )
126 garonne.AddPoint( 0, gp_XY( 39782.86, 32207.17 ) )
127 garonne.AddPoint( 0, gp_XY( 38814.10, 32560.43 ) )
128 garonne.AddPoint( 0, gp_XY( 38302.17, 32903.70 ) )
129
130 garonne.Update()
131
132
133 domaine = hydro_doc.CreateObject( KIND_POLYLINEXY )
134 domaine.SetName( "domaine" )
135
136 domaine.SetZLevel( 3 )
137
138 domaine.AddSection( "Section_1", 0, 1 )
139 domaine.AddPoint( 0, gp_XY( 39901.15, 34762.30 ) );
140 domaine.AddPoint( 0, gp_XY( 38086.50, 29964.69 ) );
141 domaine.AddPoint( 0, gp_XY( 44835.83, 24264.97 ) );
142 domaine.AddPoint( 0, gp_XY( 46758.56, 25021.86 ) );
143 domaine.AddPoint( 0, gp_XY( 46757.20, 26601.21 ) );
144 domaine.AddPoint( 0, gp_XY( 48566.45, 30152.81 ) );
145 domaine.AddPoint( 0, gp_XY( 45532.36, 33239.83 ) );
146 domaine.AddPoint( 0, gp_XY( 43548.77, 34048.39 ) );
147
148 domaine.Update()
149
150
151 lit_majeur = hydro_doc.CreateObject( KIND_POLYLINEXY )
152 lit_majeur.SetName( "lit_majeur" )
153
154 lit_majeur.SetZLevel( 7 )
155
156 lit_majeur.AddSection( "Section_1", 1, 1 )
157 lit_majeur.AddPoint( 0, gp_XY( 41225.22, 34118.46 ) )
158 lit_majeur.AddPoint( 0, gp_XY( 41716.41, 33705.87 ) )
159 lit_majeur.AddPoint( 0, gp_XY( 42384.43, 33293.27 ) )
160 lit_majeur.AddPoint( 0, gp_XY( 42561.26, 32684.19 ) )
161 lit_majeur.AddPoint( 0, gp_XY( 42875.62, 32369.83 ) )
162 lit_majeur.AddPoint( 0, gp_XY( 43700.82, 32350.18 ) )
163 lit_majeur.AddPoint( 0, gp_XY( 44526.02, 31662.51 ) )
164 lit_majeur.AddPoint( 0, gp_XY( 45370.87, 31819.69 ) )
165 lit_majeur.AddPoint( 0, gp_XY( 46274.66, 31682.16 ) )
166 lit_majeur.AddPoint( 0, gp_XY( 46981.97, 31328.50 ) )
167 lit_majeur.AddPoint( 0, gp_XY( 47021.27, 30719.43 ) )
168 lit_majeur.AddPoint( 0, gp_XY( 47217.74, 30051.41 ) )
169 lit_majeur.AddPoint( 0, gp_XY( 47846.46, 29560.22 ) )
170 lit_majeur.AddPoint( 0, gp_XY( 48730.61, 28735.02 ) )
171 lit_majeur.AddPoint( 0, gp_XY( 48809.20, 27732.99 ) )
172 lit_majeur.AddPoint( 0, gp_XY( 49143.21, 27163.21 ) )
173 lit_majeur.AddPoint( 0, gp_XY( 49654.05, 26829.20 ) )
174 lit_majeur.AddPoint( 0, gp_XY( 49693.34, 25355.63 ) )
175 lit_majeur.AddPoint( 0, gp_XY( 48612.72, 23214.04 ) )
176 lit_majeur.AddPoint( 0, gp_XY( 47453.51, 23115.80 ) )
177 lit_majeur.AddPoint( 0, gp_XY( 46471.13, 24176.77 ) )
178 lit_majeur.AddPoint( 0, gp_XY( 45960.29, 25257.39 ) )
179 lit_majeur.AddPoint( 0, gp_XY( 44899.32, 25591.40 ) )
180 lit_majeur.AddPoint( 0, gp_XY( 44270.60, 26573.78 ) )
181 lit_majeur.AddPoint( 0, gp_XY( 43248.92, 27909.82 ) )
182 lit_majeur.AddPoint( 0, gp_XY( 42757.73, 28243.83 ) )
183 lit_majeur.AddPoint( 0, gp_XY( 42266.54, 28342.07 ) )
184 lit_majeur.AddPoint( 0, gp_XY( 41736.06, 28106.30 ) )
185 lit_majeur.AddPoint( 0, gp_XY( 41402.05, 28833.26 ) )
186 lit_majeur.AddPoint( 0, gp_XY( 40910.86, 28911.85 ) )
187 lit_majeur.AddPoint( 0, gp_XY( 40576.85, 29324.45 ) )
188 lit_majeur.AddPoint( 0, gp_XY( 40144.60, 29599.51 ) )
189 lit_majeur.AddPoint( 0, gp_XY( 39024.69, 30130.00 ) )
190 lit_majeur.AddPoint( 0, gp_XY( 38612.09, 30365.77 ) )
191 lit_majeur.AddPoint( 0, gp_XY( 38828.21, 33391.50 ) )
192
193 lit_majeur.Update()
194
195
196 Cloud_02 = hydro_doc.CreateObject( KIND_BATHYMETRY )
197 Cloud_02.SetName( "Cloud_02" )
198
199 Cloud_02.SetAltitudesInverted( 0 )
200 Cloud_02.ImportFromFile( os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz" ))
201
202 Cloud_02.Update()
203
204
205 garonne_point_L93 = hydro_doc.CreateObject( KIND_BATHYMETRY )
206 garonne_point_L93.SetName( "garonne_point_L93" )
207
208 garonne_point_L93.SetAltitudesInverted( 0 )
209 garonne_point_L93.ImportFromFile( os.path.join(HYDRO_SAMPLES, "garonne_point_L93.xyz" ))
210
211 garonne_point_L93.Update()
212
213
214 litMineur = hydro_doc.CreateObject( KIND_IMMERSIBLE_ZONE )
215 litMineur.SetName( "litMineur" )
216
217 litMineur.SetZLevel( 6 )
218
219 litMineur.SetAltitudeObject( garonne_point_L93 )
220 litMineur.SetPolyline( garonne )
221
222 litMineur.Update()
223
224
225 litMajeur = hydro_doc.CreateObject( KIND_IMMERSIBLE_ZONE )
226 litMajeur.SetName( "litMajeur" )
227
228 litMajeur.SetZLevel( 5 )
229
230 litMajeur.SetFillingColor( QColor( 0, 170, 127, 255 ) )
231
232 litMajeur.SetAltitudeObject( Cloud_02 )
233 litMajeur.SetPolyline( lit_majeur )
234
235 litMajeur.Update()
236
237
238 domaineEtendu = hydro_doc.CreateObject( KIND_IMMERSIBLE_ZONE )
239 domaineEtendu.SetName( "domaineEtendu" )
240
241 domaineEtendu.SetZLevel( 4 )
242
243 domaineEtendu.SetFillingColor( QColor( 201, 203, 55, 255 ) )
244
245 domaineEtendu.SetAltitudeObject( Cloud_02 )
246 domaineEtendu.SetPolyline( domaine )
247
248 domaineEtendu.Update()
249
250
251 # Calculation case
252 garonne_1 = hydro_doc.CreateObject( KIND_CALCULATION )
253 garonne_1.SetName( "garonne_1" )
254
255 garonne_1.SetAssignmentMode( HYDROData_CalculationCase.MANUAL )
256 garonne_1.AddGeometryObject( litMineur )
257 garonne_1.AddGeometryObject( domaineEtendu )
258 garonne_1.AddGeometryObject( litMajeur )
259
260 case_geom_group = domaineEtendu.GetGroup( 0 )
261 garonne_1.AddGeometryGroup( case_geom_group )
262 case_geom_group = litMineur.GetGroup( 0 )
263 garonne_1.AddGeometryGroup( case_geom_group )
264 case_geom_group = litMajeur.GetGroup( 0 )
265 garonne_1.AddGeometryGroup( case_geom_group )
266 garonne_1.SetBoundaryPolyline( domaine )
267
268 # Start the algorithm of the partition and assignment
269 garonne_1.Update()
270 garonne_1_litMineur = hydro_doc.FindObjectByName( "garonne_1_Reg_1" )
271 garonne_1_Zone_1 = hydro_doc.FindObjectByName( "garonne_1_Zone_1" )
272 garonne_1_Zone_1.SetMergeType( HYDROData_Zone.Merge_ZMIN )
273 garonne_1_litMineur.AddZone( garonne_1_Zone_1 )
274 garonne_1_riveDroite = hydro_doc.FindObjectByName( "garonne_1_Reg_2" )
275 garonne_1_Zone_2 = hydro_doc.FindObjectByName( "garonne_1_Zone_2" )
276 garonne_1_riveDroite.AddZone( garonne_1_Zone_2 )
277 garonne_1_Zone_3 = hydro_doc.FindObjectByName( "garonne_1_Zone_3" )
278 garonne_1_riveDroite.AddZone( garonne_1_Zone_3 )
279 garonne_1_riveGauche = hydro_doc.FindObjectByName( "garonne_1_Reg_3" )
280 garonne_1_Zone_4 = hydro_doc.FindObjectByName( "garonne_1_Zone_4" )
281 garonne_1_riveGauche.AddZone( garonne_1_Zone_4 )
282 garonne_1_Zone_5 = hydro_doc.FindObjectByName( "garonne_1_Zone_5" )
283 garonne_1_riveGauche.AddZone( garonne_1_Zone_5 )
284
285 garonne_1_litMineur.SetName("garonne_1_litMineur")
286 garonne_1_riveDroite.SetName("garonne_1_riveDroite")
287 garonne_1_riveGauche.SetName("garonne_1_riveGauche")
288
289 # Export of the calculation case
290 garonne_1_entry = garonne_1.Export( theStudy._get_StudyId() )
291
292 #----------------------
293 # --- Geometry 
294 #----------------------
295
296 # Get geometry shape and print debug information
297 import GEOM
298 from salome.geom import geomBuilder
299 import math
300 import SALOMEDS
301 from salome.hydrotools.controls import controlGeomProps
302
303 geompy = geomBuilder.New(theStudy)
304
305 print "Entry:", garonne_1_entry
306 HYDRO_garonne_1 = salome.IDToObject( str( garonne_1_entry ) )
307 print "Geom shape:", HYDRO_garonne_1
308 print "Geom shape name:", HYDRO_garonne_1.GetName()
309
310 # --- manual definition: geometrical faces 
311 [riveGauche,litMineur,riveDroite] = geompy.ExtractShapes(HYDRO_garonne_1, geompy.ShapeType["FACE"], True)
312
313 # --- manual definition: useful groups of edges
314 garonne_1_litMineur_Outer = geompy.CreateGroup(HYDRO_garonne_1, geompy.ShapeType["EDGE"])
315 geompy.UnionIDs(garonne_1_litMineur_Outer, [7, 9])
316 garonne_1_domaineEtendu_Outer = geompy.CreateGroup(HYDRO_garonne_1, geompy.ShapeType["EDGE"])
317 geompy.UnionIDs(garonne_1_domaineEtendu_Outer, [4, 11, 17, 24, 26, 28, 14, 19, 20, 22, 31, 39, 41, 33, 35, 37])
318
319 aval = geompy.CreateGroup(HYDRO_garonne_1, geompy.ShapeType["EDGE"])
320 geompy.UnionIDs(aval, [4])
321 amont = geompy.CreateGroup(HYDRO_garonne_1, geompy.ShapeType["EDGE"])
322 geompy.UnionIDs(amont, [11])
323 SectionsGaronne = geompy.CreateGroup(HYDRO_garonne_1, geompy.ShapeType["EDGE"])
324 geompy.UnionIDs(SectionsGaronne, [4, 11])
325 bordGaucheDomaine = geompy.CreateGroup(HYDRO_garonne_1, geompy.ShapeType["EDGE"])
326 geompy.UnionIDs(bordGaucheDomaine, [14, 28, 20, 24, 19, 17, 26, 22])
327 bordDroiteDomaine = geompy.CreateGroup(HYDRO_garonne_1, geompy.ShapeType["EDGE"])
328 geompy.UnionIDs(bordDroiteDomaine, [41, 35, 31, 33, 39, 37])
329
330 # --- publications dans l'étude
331 geompy.addToStudyInFather( HYDRO_garonne_1, riveGauche, 'riveGauche' )
332 geompy.addToStudyInFather( HYDRO_garonne_1, litMineur, 'litMineur' )
333 geompy.addToStudyInFather( HYDRO_garonne_1, riveDroite, 'riveDroite' )
334 geompy.addToStudyInFather( HYDRO_garonne_1, aval, 'aval' )
335 geompy.addToStudyInFather( HYDRO_garonne_1, amont, 'amont' )
336 geompy.addToStudyInFather( HYDRO_garonne_1, SectionsGaronne, 'SectionsGaronne' )
337 geompy.addToStudyInFather( HYDRO_garonne_1, bordGaucheDomaine, 'bordGaucheDomaine' )
338 geompy.addToStudyInFather( HYDRO_garonne_1, bordDroiteDomaine, 'bordDroiteDomaine' )
339
340 # --- basic properties control: edges length, surfaces
341 controlGeomProps(geompy, riveGauche,  29149.36918,  35992556.454929)
342 controlGeomProps(geompy, litMineur,   30337.548492,  3646827.749809)
343 controlGeomProps(geompy, riveDroite,  32012.343241, 26177085.460092)
344
345 #----------------------
346 # --- Meshing 
347 #----------------------
348
349 import  SMESH, SALOMEDS
350 from salome.smesh import smeshBuilder
351 from salome.hydrotools.controls import controlMeshStats, controlSubMeshStats
352
353 smesh = smeshBuilder.New(theStudy)
354
355 # --- algorithms and hypothesis
356 garonne_1 = smesh.Mesh(HYDRO_garonne_1)
357
358 NETGEN_2D = garonne_1.Triangle(algo=smeshBuilder.NETGEN_1D2D)
359 NETGEN_2D_Parameters = NETGEN_2D.Parameters()
360 NETGEN_2D_Parameters.SetMaxSize( 200 )
361 NETGEN_2D_Parameters.SetSecondOrder( 0 )
362 NETGEN_2D_Parameters.SetOptimize( 1 )
363 NETGEN_2D_Parameters.SetFineness( 4 )
364 NETGEN_2D_Parameters.SetMinSize( 50 )
365 NETGEN_2D_Parameters.SetUseSurfaceCurvature( 1 )
366 NETGEN_2D_Parameters.SetFuseEdges( 1 )
367 NETGEN_2D_Parameters.SetQuadAllowed( 0 )
368
369 algo2D_litMineur = garonne_1.Quadrangle(algo=smeshBuilder.QUAD_MA_PROJ,geom=litMineur)
370 algo1D_litMineur = garonne_1.Segment(geom=litMineur)
371 hypo1D_litMineur = algo1D_litMineur.LocalLength(100,None,1e-07)
372 subMesh_litMineur = algo1D_litMineur.GetSubMesh()
373 smesh.SetName(subMesh_litMineur, "litMineur")
374
375 algo1D_SectionsGaronne = garonne_1.Segment(geom=SectionsGaronne)
376 hypo1D_SectionsGaronne = algo1D_SectionsGaronne.NumberOfSegments(8)
377 hypo1D_SectionsGaronne.SetDistrType( 0 )
378 subMesh_SectionsGaronne = algo1D_SectionsGaronne.GetSubMesh()
379 smesh.SetName(subMesh_SectionsGaronne, "SectionsGaronne")
380
381 isDone = garonne_1.SetMeshOrder( [ [ subMesh_SectionsGaronne, subMesh_litMineur ] ])
382
383 # --- compute mesh
384 isDone = garonne_1.Compute()
385 isDone = garonne_1.SplitQuadObject( garonne_1, 1 )
386
387 # --- geometrical groups of edges
388 garonne_1_litMineur_Outer_1 = garonne_1.GroupOnGeom(garonne_1_litMineur_Outer,'garonne_1_litMineur_Outer',SMESH.EDGE)
389 garonne_1_domaineEtendu_Outer_1 = garonne_1.GroupOnGeom(garonne_1_domaineEtendu_Outer,'garonne_1_domaineEtendu_Outer',SMESH.EDGE)
390 aval_1 = garonne_1.GroupOnGeom(aval,'aval',SMESH.EDGE)
391 amont_1 = garonne_1.GroupOnGeom(amont,'amont',SMESH.EDGE)
392 bordGaucheDomaine_1 = garonne_1.GroupOnGeom(bordGaucheDomaine,'bordGaucheDomaine',SMESH.EDGE)
393 bordDroiteDomaine_1 = garonne_1.GroupOnGeom(bordDroiteDomaine,'bordDroiteDomaine',SMESH.EDGE)
394 SectionsGaronne_2 = garonne_1.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMESH.EDGE)
395
396 # --- geometrical groups of faces
397 riveGauche_1 = garonne_1.GroupOnGeom(riveGauche,'riveGauche',SMESH.FACE)
398 litMineur_2 = garonne_1.GroupOnGeom(litMineur,'litMineur',SMESH.FACE)
399 riveDroite_1 = garonne_1.GroupOnGeom(riveDroite,'riveDroite',SMESH.FACE)
400
401 # --- geometrical groups of nodes
402 garonne_1_litMineur_Outer_2 = garonne_1.GroupOnGeom(garonne_1_litMineur_Outer,'garonne_1_litMineur_Outer',SMESH.NODE)
403 garonne_1_domaineEtendu_Outer_2 = garonne_1.GroupOnGeom(garonne_1_domaineEtendu_Outer,'garonne_1_domaineEtendu_Outer',SMESH.NODE)
404 riveGauche_2 = garonne_1.GroupOnGeom(riveGauche,'riveGauche',SMESH.NODE)
405 litMineur_3 = garonne_1.GroupOnGeom(litMineur,'litMineur',SMESH.NODE)
406 riveDroite_2 = garonne_1.GroupOnGeom(riveDroite,'riveDroite',SMESH.NODE)
407 aval_2 = garonne_1.GroupOnGeom(aval,'aval',SMESH.NODE)
408 amont_2 = garonne_1.GroupOnGeom(amont,'amont',SMESH.NODE)
409 bordGaucheDomaine_2 = garonne_1.GroupOnGeom(bordGaucheDomaine,'bordGaucheDomaine',SMESH.NODE)
410 bordDroiteDomaine_2 = garonne_1.GroupOnGeom(bordDroiteDomaine,'bordDroiteDomaine',SMESH.NODE)
411 SectionsGaronne_3 = garonne_1.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMESH.NODE)
412
413 garonne_1.SetAutoColor( 1 )
414 garonne_1.ExportMED( r'/tmp/garonne_1.med', 0, SMESH.MED_V2_2, 1, None ,1)
415
416 controlMeshStats(garonne_1, 3888, 475, 7597)
417 controlSubMeshStats(litMineur_2, 2384)
418 controlSubMeshStats(riveDroite_1, 2342)
419 controlSubMeshStats(riveGauche_1, 2871)
420
421 if salome.sg.hasDesktop():
422   salome.sg.updateObjBrowser(1)
423
424 #----------------------
425 # --- Z interpolation with HYDRO 
426 #----------------------
427
428 from salome.hydrotools.interpolZ import interpolZ, createZfield2
429 from salome.hydrotools.controls import controlStatZ
430
431 # --- case name in HYDRO
432 nomCas = 'garonne_1'
433
434 # --- med file 2D(x,y) of the case produced by SMESH
435 fichierMaillage = '/tmp/garonne_1.med'
436
437 # --- dictionary [med group name] = region name
438 dicoGroupeRegion= dict(litMineur  = 'garonne_1_litMineur',
439                        riveDroite = 'garonne_1_riveDroite',
440                        riveGauche = 'garonne_1_riveGauche',
441                        )
442 # --- value to use for Z when the node is not in a region (used to detect problems)                       
443 zUndef = 90
444
445 # --- Z interpolation on the bathymety/altimetry on the mesh nodes
446 statz = interpolZ(nomCas, fichierMaillage, dicoGroupeRegion, zUndef)
447 refstatz = {'riveDroite': (10.88, 32.47999954), 'riveGauche': (7.72, 71.38999939), 'litMineur': (2.06, 25.41)}
448 controlStatZ(statz, refstatz)
449
450 # --- add a field on nodes of type double with z values, named "BOTTOM"
451 createZfield2(fichierMaillage)
452
453