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