Salome HOME
add image in binary
[modules/smesh.git] / doc / salome / gui / SMESH / constructing_meshes.htm
1 <!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
2
3 <html>
4
5 <head>
6 <title>Constructing Meshes</title>
7 <meta http-equiv="content-type" content="text/html; charset=windows-1252">
8 <meta name="generator" content="RoboHelp by eHelp Corporation www.ehelp.com"><style type="text/css">
9 <!--
10 p.whs1 { margin-top:0pt; margin-bottom:0pt; font-family:'Lucida Console' , monospace; }
11 p.whs2 { margin-top:0pt; margin-bottom:0pt; }
12 p.whs3 { font-family:'Lucida Console' , monospace; margin-top:0px; margin-bottom:0px; }
13 p.whs4 { margin-top:0px; margin-bottom:0px; }
14 p.whs5 { margin-top:0px; margin-bottom:0px; font-family:'Times New Roman' , serif; }
15 -->
16 </style><script type="text/javascript" language="JavaScript">
17 <!--
18 if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))
19 {
20   var strNSS = "<style type='text/css'>";
21   strNSS += "p.whs1 {margin-top:1pt;margin-bottom:1pt; }";
22   strNSS += "p.whs2 {margin-top:1pt;margin-bottom:1pt; }";
23   strNSS += "p.whs3 {margin-top:1pt;margin-bottom:1pt; }";
24   strNSS += "p.whs4 {margin-top:1pt;margin-bottom:1pt; }";
25   strNSS += "p.whs5 {margin-top:1pt;margin-bottom:1pt; }";
26   strNSS +="</style>";
27   document.write(strNSS);
28 }
29 //-->
30 </script>
31 <script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">
32 <!--
33 function reDo() {
34   if (innerWidth != origWidth || innerHeight != origHeight)
35      location.reload();
36 }
37 if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {
38         origWidth = innerWidth;
39         origHeight = innerHeight;
40         onresize = reDo;
41 }
42 onerror = null; 
43 //-->
44 </script>
45 <style type="text/css">
46 <!--
47 div.WebHelpPopupMenu { position:absolute; left:0px; top:0px; z-index:4; visibility:hidden; }
48 p.WebHelpNavBar { text-align:right; }
49 -->
50 </style><script type="text/javascript" language="javascript1.2" src="whmsg.js"></script>
51 <script type="text/javascript" language="javascript" src="whver.js"></script>
52 <script type="text/javascript" language="javascript1.2" src="whproxy.js"></script>
53 <script type="text/javascript" language="javascript1.2" src="whutils.js"></script>
54 <script type="text/javascript" language="javascript1.2" src="whtopic.js"></script>
55 <script type="text/javascript" language="javascript1.2">
56 <!--
57 if (window.gbWhTopic)
58 {
59         if (window.setRelStartPage)
60         {
61         addTocInfo("MESH module\nTUI Scripts\nCreating Meshes");
62 addButton("show",BTN_IMG,"Show","","","","",0,0,"whd_show0.gif","whd_show2.gif","whd_show1.gif");
63 addButton("hide",BTN_IMG,"Hide","","","","",0,0,"whd_hide0.gif","whd_hide2.gif","whd_hide1.gif");
64
65         }
66
67
68         if (window.setRelStartPage)
69         {
70         setRelStartPage("index.htm");
71
72                 autoSync(1);
73                 sendSyncInfo();
74                 sendAveInfoOut();
75         }
76
77 }
78 else
79         if (window.gbIE4)
80                 document.location.reload();
81 //-->
82 </script>
83 </head>
84 <body><script type="text/javascript" language="javascript1.2">
85 <!--
86 if (window.writeIntopicBar)
87         writeIntopicBar(4);
88 //-->
89 </script>
90 <h1>Creating Meshes</h1>
91
92 <h3><a name=bookmark>Construction of a Mesh</a></h3>
93
94 <p class="whs1">import salome</p>
95
96 <p class="whs1">import geompy</p>
97
98 <p class="whs1">import StdMeshers</p>
99
100 <p class="whs1">smesh = salome.lcc.FindOrLoadComponent(&quot;FactoryServer&quot;, 
101  &quot;SMESH&quot;)</p>
102
103 <p class="whs1">smeshgui = salome.ImportComponentGUI(&quot;SMESH&quot;)</p>
104
105 <p class="whs1">smeshgui.Init(salome.myStudyId);</p>
106
107 <p class="whs2">&nbsp;</p>
108
109 <p class="whs2"># create a box</p>
110
111 <p class="whs1">box = geompy.MakeBox(0., 
112  0., 0., 100., 200., 300.)</p>
113
114 <p class="whs2">&nbsp;</p>
115
116 <p class="whs2"># add box to the study</p>
117
118 <p class="whs1">idbox = geompy.addToStudy(box, 
119  &quot;box&quot;)</p>
120
121 <p class="whs2">&nbsp;</p>
122
123 <p class="whs2"># create a hypothesis</p>
124
125 <p class="whs1">print &quot;-------------------------- 
126  create Hypothesis&quot;</p>
127
128 <p class="whs1">print &quot;-------------------------- 
129  NumberOfSegments&quot;</p>
130
131 <p class="whs1">numberOfSegments 
132  = 7</p>
133
134 <p class="whs1">hypNbSeg = smesh.CreateHypothesis(&quot;NumberOfSegments&quot;, 
135  &quot;libStdMeshersEngine.so&quot;)</p>
136
137 <p class="whs1">hypNbSeg.SetNumberOfSegments(numberOfSegments)</p>
138
139 <p class="whs1">print hypNbSeg.GetName()</p>
140
141 <p class="whs1">print hypNbSeg.GetId()</p>
142
143 <p class="whs1">print hypNbSeg.GetNumberOfSegments()</p>
144
145 <p class="whs1">smeshgui.SetName(salome.ObjectToID(hypNbSeg), 
146  &quot;NumberOfSegments_10&quot;)</p>
147
148 <p class="whs1">print &quot;-------------------------- 
149  MaxElementArea&quot;</p>
150
151 <p class="whs1">maxElementArea = 
152  800</p>
153
154 <p class="whs1">hypArea = smesh.CreateHypothesis(&quot;MaxElementArea&quot;, 
155  &quot;libStdMeshersEngine.so&quot;)</p>
156
157 <p class="whs1">hypArea.SetMaxElementArea(maxElementArea)</p>
158
159 <p class="whs1">print hypArea.GetName()</p>
160
161 <p class="whs1">print hypArea.GetId()</p>
162
163 <p class="whs1">print hypArea.GetMaxElementArea()</p>
164
165 <p class="whs1">smeshgui.SetName(salome.ObjectToID(hypArea), 
166  &quot;MaxElementArea_500&quot;)</p>
167
168 <p class="whs1">print &quot;-------------------------- 
169  MaxElementVolume&quot;</p>
170
171 <p class="whs1">maxElementVolume 
172  = 900</p>
173
174 <p class="whs1">hypVolume = smesh.CreateHypothesis(&quot;MaxElementVolume&quot;, 
175  &quot;libStdMeshersEngine.so&quot;)</p>
176
177 <p class="whs1">hypVolume.SetMaxElementVolume(maxElementVolume)</p>
178
179 <p class="whs1">print hypVolume.GetName()</p>
180
181 <p class="whs1">print hypVolume.GetId()</p>
182
183 <p class="whs1">print hypVolume.GetMaxElementVolume()</p>
184
185 <p class="whs1">smeshgui.SetName(salome.ObjectToID(hypVolume), 
186  &quot;MaxElementVolume_500&quot;)</p>
187
188 <p class="whs2">&nbsp;</p>
189
190 <p class="whs2"># create algorithms</p>
191
192 <p class="whs1">print &quot;-------------------------- 
193  create Algorithms&quot;</p>
194
195 <p class="whs1">print &quot;-------------------------- 
196  Regular_1D&quot;</p>
197
198 <p class="whs1">regular1D = smesh.CreateHypothesis(&quot;Regular_1D&quot;, 
199  &quot;libStdMeshersEngine.so&quot;)</p>
200
201 <p class="whs1">smeshgui.SetName(salome.ObjectToID(regular1D), 
202  &quot;Wire Discretisation&quot;)</p>
203
204 <p class="whs1">print &quot;-------------------------- 
205  MEFISTO_2D&quot;</p>
206
207 <p class="whs1">mefisto2D = smesh.CreateHypothesis(&quot;MEFISTO_2D&quot;, 
208  &quot;libStdMeshersEngine.so&quot;)</p>
209
210 <p class="whs1">smeshgui.SetName(salome.ObjectToID(mefisto2D), 
211  &quot;MEFISTO_2D&quot;)</p>
212
213 <p class="whs2">&nbsp;</p>
214
215 <p class="whs2"># initialize a mesh with 
216  the box</p>
217
218 <p class="whs1">mesh = smesh.CreateMesh(box)</p>
219
220 <p class="whs1">smeshgui.SetName(salome.ObjectToID(mesh), 
221  &quot;MeshBox&quot;)</p>
222
223 <p class="whs2">&nbsp;</p>
224
225 <p class="whs2"># add the hypothesis to 
226  the box</p>
227
228 <p class="whs1">print &quot;-------------------------- 
229  add hypothesis to the box&quot;</p>
230
231 <p class="whs1">mesh.AddHypothesis(box,hypNbSeg)</p>
232
233 <p class="whs1">mesh.AddHypothesis(box,hypArea)</p>
234
235 <p class="whs1">mesh.AddHypothesis(box,hypVolume)</p>
236
237 <p class="whs1">mesh.AddHypothesis(box,regular1D)</p>
238
239 <p class="whs1">mesh.AddHypothesis(box,mefisto2D)</p>
240
241 <p class="whs2">&nbsp;</p>
242
243 <p class="whs2"># compute the mesh</p>
244
245 <p class="whs1">print &quot;-------------------------- 
246  compute the mesh of the box&quot;</p>
247
248 <p class="whs1">ret = smesh.Compute(mesh,box)</p>
249
250 <p class="whs1">print ret</p>
251
252 <p class="whs1">if ret == 0:</p>
253
254 <p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print 
255  &quot;probleme when computing the mesh&quot;</p>
256
257 <p class="whs1">salome.sg.updateObjBrowser(1)</p>
258
259 <p class="whs1">&nbsp;</p>
260
261 <h3><a name=bookmark1>Construction of a Submesh</a></h3>
262
263 <p class="whs3">&nbsp;</p>
264
265 <p class="whs3"><span style="font-family: 'Lucida Console', monospace;">from 
266  geompy import *</span></p>
267
268 <p class="whs3">import smesh</p>
269
270 <p class="whs4">&nbsp;</p>
271
272 <p class="whs4"># create vertices</p>
273
274 <p class="whs3">Point111 = MakeVertex( 0, &nbsp;0, 
275  &nbsp;0)</p>
276
277 <p class="whs3">Point211 = MakeVertex(10, &nbsp;0, 
278  &nbsp;0)</p>
279
280 <p class="whs3">Point121 = MakeVertex( 0, 10, &nbsp;0)</p>
281
282 <p class="whs3">Point221 = MakeVertex(10, 10, &nbsp;0)</p>
283
284 <p class="whs3">Point112 = MakeVertex( 0, &nbsp;0, 
285  10)</p>
286
287 <p class="whs3">Point212 = MakeVertex(10, &nbsp;0, 
288  10)</p>
289
290 <p class="whs3">Point122 = MakeVertex( 0, 10, 10)</p>
291
292 <p class="whs3">Point222 = MakeVertex(10, 10, 10)</p>
293
294 <p class="whs4">&nbsp;</p>
295
296 <p class="whs4"># create edges</p>
297
298 <p class="whs3">EdgeX111 = MakeEdge(Point111, Point211)</p>
299
300 <p class="whs3">EdgeX121 = MakeEdge(Point121, Point221)</p>
301
302 <p class="whs3">EdgeX112 = MakeEdge(Point112, Point212)</p>
303
304 <p class="whs3">EdgeX122 = MakeEdge(Point122, Point222)</p>
305
306 <p class="whs3">EdgeY11 = MakeEdge(Point111, Point121)</p>
307
308 <p class="whs3">EdgeY21 = MakeEdge(Point211, Point221)</p>
309
310 <p class="whs3">EdgeY12 = MakeEdge(Point112, Point122)</p>
311
312 <p class="whs3">EdgeY22 = MakeEdge(Point212, Point222)</p>
313
314 <p class="whs3">EdgeZ111 = MakeEdge(Point111, Point112)</p>
315
316 <p class="whs3">EdgeZ211 = MakeEdge(Point211, Point212)</p>
317
318 <p class="whs3">EdgeZ121 = MakeEdge(Point121, Point122)</p>
319
320 <p class="whs3">EdgeZ221 = MakeEdge(Point221, Point222)</p>
321
322 <p class="whs4">&nbsp;</p>
323
324 <p class="whs4"># create faces</p>
325
326 <p class="whs3">FaceX11 = MakeQuad(EdgeY11, EdgeZ111, 
327  EdgeY12, EdgeZ121)</p>
328
329 <p class="whs3">FaceX21 = MakeQuad(EdgeY21, EdgeZ211, 
330  EdgeY22, EdgeZ221)</p>
331
332 <p class="whs3">FaceY111 = MakeQuad(EdgeX111, EdgeZ111, 
333  EdgeX112, EdgeZ211)</p>
334
335 <p class="whs3">FaceY121 = MakeQuad(EdgeX121, EdgeZ121, 
336  EdgeX122, EdgeZ221)</p>
337
338 <p class="whs3">FaceZ11 = MakeQuad(EdgeX111, EdgeY11, 
339  EdgeX121, EdgeY21)</p>
340
341 <p class="whs3">FaceZ12 = MakeQuad(EdgeX112, EdgeY12, 
342  EdgeX122, EdgeY22)</p>
343
344 <p class="whs4">&nbsp;</p>
345
346 <p class="whs4"># create a solid</p>
347
348 <p class="whs3">Block = MakeHexa(FaceX11, FaceX21, FaceY111, 
349  FaceY121, FaceZ11, FaceZ12)</p>
350
351 <p class="whs4">&nbsp;</p>
352
353 <p class="whs4"># create a compound</p>
354
355 <p class="whs3">box = MakeCompound([Block])</p>
356
357 <p class="whs4">&nbsp;</p>
358
359 <p class="whs4"># add in the study</p>
360
361 <p class="whs3">box_id = addToStudy(box, &quot;Box compound&quot;)</p>
362
363 <p class="whs4">&nbsp;</p>
364
365 <p class="whs4"># create hexahedral mesh 
366  on the box</p>
367
368 <p class="whs3">hexa = smesh.Mesh(box, &quot;Box compound 
369  : hexahedrical mesh&quot;)</p>
370
371 <p class="whs3">algo = hexa.Segment()</p>
372
373 <p class="whs4">&nbsp;</p>
374
375 <p class="whs4"># define &quot;NumberOfSegments&quot; 
376  hypothesis to cut the edge in a fixed number of segments</p>
377
378 <p class="whs3">algo.NumberOfSegments(4)</p>
379
380 <p class="whs4">&nbsp;</p>
381
382 <p class="whs4"># creates a quadrangle 
383  2D algorithm for the faces</p>
384
385 <p class="whs3">hexa.Quadrangle()</p>
386
387 <p class="whs4">&nbsp;</p>
388
389 <p class="whs4"># construct a submesh with 
390  a local hypothesis</p>
391
392 <p class="whs3">algo = hexa.Segment(EdgeX111)</p>
393
394 <p class="whs4">&nbsp;</p>
395
396 <p class="whs4"># define &quot;Arithmetic1D&quot; 
397  hypothesis to cut an edge in several segments with increasing arithmetic 
398  length </p>
399
400 <p class="whs3">algo.Arithmetic1D(1, 4)</p>
401
402 <p class="whs4">&nbsp;</p>
403
404 <p class="whs4"># define &quot;Propagation&quot; 
405  hypothesis that propagates all other hypothesis on all edges on the opposite 
406  side in case of quadrangular faces</p>
407
408 <p class="whs3">algo.Propagation()</p>
409
410 <p class="whs4">&nbsp;</p>
411
412 <p class="whs4"># compute the mesh</p>
413
414 <p class="whs3">hexa.Compute() </p>
415
416 <p class="whs3">&nbsp;</p>
417
418 <h3><a name=bookmark2>Editing of a mesh</a></h3>
419
420 <p class="whs3">&nbsp;</p>
421
422 <p class="whs3"><span style="font-family: 'Lucida Console', monospace;">import 
423  salome</span></p>
424
425 <p class="whs3">import geompy</p>
426
427 <p class="whs3">import SMESH</p>
428
429 <p class="whs3">import StdMeshers</p>
430
431 <p class="whs3">&nbsp;</p>
432
433 <p class="whs3">smesh = salome.lcc.FindOrLoadComponent(&quot;FactoryServer&quot;, 
434  &quot;SMESH&quot;)</p>
435
436 <p class="whs3">smesh.SetCurrentStudy(salome.myStudy)</p>
437
438 <p class="whs3">&nbsp;</p>
439
440 <p class="whs3">box &nbsp;&nbsp;= 
441  geompy.MakeBox(0., 0., 0., 20., 20., 20.)</p>
442
443 <p class="whs3">idbox = geompy.addToStudy(box, &quot;box&quot;)</p>
444
445 <p class="whs3">&nbsp;</p>
446
447 <p class="whs3">subShapeList = geompy.SubShapeAll(box, 
448  geompy.ShapeType[&quot;EDGE&quot;])</p>
449
450 <p class="whs3">edge &nbsp;&nbsp;= 
451  subShapeList[0]</p>
452
453 <p class="whs3">name &nbsp;&nbsp;= 
454  geompy.SubShapeName(edge, box)</p>
455
456 <p class="whs3">idedge = geompy.addToStudyInFather(box, 
457  edge, name)</p>
458
459 <p class="whs3">&nbsp;</p>
460
461 <p class="whs3">box &nbsp;= 
462  salome.IDToObject(idbox)</p>
463
464 <p class="whs3">edge = salome.IDToObject(idedge)</p>
465
466 <p class="whs3">&nbsp;</p>
467
468 <p class="whs3">hyp1 = smesh.CreateHypothesis(&quot;NumberOfSegments&quot;, 
469  &quot;libStdMeshersEngine.so&quot;)</p>
470
471 <p class="whs3">hyp1.SetNumberOfSegments(3)</p>
472
473 <p class="whs3">hyp2 = smesh.CreateHypothesis(&quot;MaxElementArea&quot;, 
474  &quot;libStdMeshersEngine.so&quot;)</p>
475
476 <p class="whs3">hyp2.SetMaxElementArea(10)</p>
477
478 <p class="whs3">hyp3 = smesh.CreateHypothesis(&quot;Arithmetic1D&quot;, 
479  &quot;libStdMeshersEngine.so&quot;)</p>
480
481 <p class="whs3">hyp3.SetLength(1,1)</p>
482
483 <p class="whs3">hyp3.SetLength(6,0)</p>
484
485 <p class="whs3">hyp4 = smesh.CreateHypothesis(&quot;Propagation&quot;, 
486  &quot;libStdMeshersEngine.so&quot;)</p>
487
488 <p class="whs3">&nbsp;</p>
489
490 <p class="whs3">algo1 = smesh.CreateHypothesis(&quot;Regular_1D&quot;, 
491  &quot;libStdMeshersEngine.so&quot;)</p>
492
493 <p class="whs3">algo2 = smesh.CreateHypothesis(&quot;MEFISTO_2D&quot;, 
494  &quot;libStdMeshersEngine.so&quot;)</p>
495
496 <p class="whs3">&nbsp;</p>
497
498 <p class="whs3">mesh = smesh.CreateMesh(box)</p>
499
500 <p class="whs3">mesh.AddHypothesis(box,hyp1)</p>
501
502 <p class="whs3">mesh.AddHypothesis(box,hyp2)</p>
503
504 <p class="whs3">mesh.AddHypothesis(box,algo1)</p>
505
506 <p class="whs3">mesh.AddHypothesis(box,algo2)</p>
507
508 <p class="whs3">mesh.AddHypothesis(edge,hyp3)</p>
509
510 <p class="whs3">mesh.AddHypothesis(edge,hyp4)</p>
511
512 <p class="whs3">mesh.AddHypothesis(edge,algo1)</p>
513
514 <p class="whs3">&nbsp;</p>
515
516 <p class="whs3">smesh.Compute(mesh,box)</p>
517
518 <p class="whs3">salome.sg.updateObjBrowser(1)</p>
519
520 <p class="whs3">&nbsp;</p>
521
522 <p class="whs5"># remove a hypothesis</p>
523
524 <p class="whs3">mesh.RemoveHypothesis(edge,hyp4)</p>
525
526 <p class="whs3">&nbsp;</p>
527
528 <p class="whs3">smesh.Compute(mesh,box)</p>
529
530 <p class="whs3">salome.sg.updateObjBrowser(1)</p>
531
532 <p class="whs3">&nbsp;</p>
533
534 <p class="whs5"># change the value 
535  of the hypothesis</p>
536
537 <p class="whs3">hyp2.SetMaxElementArea(2)</p>
538
539 <p class="whs3">mesh.AddHypothesis(box,hyp2)</p>
540
541 <p class="whs3">&nbsp;</p>
542
543 <p class="whs3">smesh.Compute(mesh,box)</p>
544
545 <p class="whs3">salome.sg.updateObjBrowser(1) </p>
546
547 <p class="whs4">&nbsp;</p>
548
549 <h3><a name=bookmark3>Export of a Mesh</a></h3>
550
551 <p class="whs4">&nbsp;</p>
552
553 <p class="whs1"><span style="font-family: 'Lucida Console', monospace;">import 
554  salome</span></p>
555
556 <p class="whs1">import geompy</p>
557
558 <p class="whs1">import StdMeshers</p>
559
560 <p class="whs1">smesh = salome.lcc.FindOrLoadComponent(&quot;FactoryServer&quot;, 
561  &quot;SMESH&quot;)</p>
562
563 <p class="whs1">smeshgui = salome.ImportComponentGUI(&quot;SMESH&quot;)</p>
564
565 <p class="whs1">smeshgui.Init(salome.myStudyId);</p>
566
567 <p class="whs2">&nbsp;</p>
568
569 <p class="whs2"># create a box</p>
570
571 <p class="whs1">box = geompy.MakeBox(0., 
572  0., 0., 100., 200., 300.)</p>
573
574 <p class="whs2">&nbsp;</p>
575
576 <p class="whs2"># add the box to the study</p>
577
578 <p class="whs1">idbox = geompy.addToStudy(box, 
579  &quot;box&quot;)</p>
580
581 <p class="whs2">&nbsp;</p>
582
583 <p class="whs2"># create a hypothesis</p>
584
585 <p class="whs1">print &quot;-------------------------- 
586  create Hypothesis&quot;</p>
587
588 <p class="whs1">print &quot;-------------------------- 
589  NumberOfSegments&quot;</p>
590
591 <p class="whs1">numberOfSegments 
592  = 7</p>
593
594 <p class="whs1">hypNbSeg = smesh.CreateHypothesis(&quot;NumberOfSegments&quot;, 
595  &quot;libStdMeshersEngine.so&quot;)</p>
596
597 <p class="whs1">hypNbSeg.SetNumberOfSegments(numberOfSegments)</p>
598
599 <p class="whs1">print hypNbSeg.GetName()</p>
600
601 <p class="whs1">print hypNbSeg.GetId()</p>
602
603 <p class="whs1">print hypNbSeg.GetNumberOfSegments()</p>
604
605 <p class="whs1">smeshgui.SetName(salome.ObjectToID(hypNbSeg), 
606  &quot;NumberOfSegments_10&quot;)</p>
607
608 <p class="whs1">print &quot;-------------------------- 
609  MaxElementArea&quot;</p>
610
611 <p class="whs1">maxElementArea = 
612  800</p>
613
614 <p class="whs1">hypArea = smesh.CreateHypothesis(&quot;MaxElementArea&quot;, 
615  &quot;libStdMeshersEngine.so&quot;)</p>
616
617 <p class="whs1">hypArea.SetMaxElementArea(maxElementArea)</p>
618
619 <p class="whs1">print hypArea.GetName()</p>
620
621 <p class="whs1">print hypArea.GetId()</p>
622
623 <p class="whs1">print hypArea.GetMaxElementArea()</p>
624
625 <p class="whs1">smeshgui.SetName(salome.ObjectToID(hypArea), 
626  &quot;MaxElementArea_500&quot;)</p>
627
628 <p class="whs1">print &quot;-------------------------- 
629  MaxElementVolume&quot;</p>
630
631 <p class="whs1">maxElementVolume 
632  = 900</p>
633
634 <p class="whs1">hypVolume = smesh.CreateHypothesis(&quot;MaxElementVolume&quot;, 
635  &quot;libStdMeshersEngine.so&quot;)</p>
636
637 <p class="whs1">hypVolume.SetMaxElementVolume(maxElementVolume)</p>
638
639 <p class="whs1">print hypVolume.GetName()</p>
640
641 <p class="whs1">print hypVolume.GetId()</p>
642
643 <p class="whs1">print hypVolume.GetMaxElementVolume()</p>
644
645 <p class="whs1">smeshgui.SetName(salome.ObjectToID(hypVolume), 
646  &quot;MaxElementVolume_500&quot;)</p>
647
648 <p class="whs2">&nbsp;</p>
649
650 <p class="whs2"># create algorithms</p>
651
652 <p class="whs1">print &quot;-------------------------- 
653  create Algorithms&quot;</p>
654
655 <p class="whs1">print &quot;-------------------------- 
656  Regular_1D&quot;</p>
657
658 <p class="whs1">regular1D = smesh.CreateHypothesis(&quot;Regular_1D&quot;, 
659  &quot;libStdMeshersEngine.so&quot;)</p>
660
661 <p class="whs1">smeshgui.SetName(salome.ObjectToID(regular1D), 
662  &quot;Wire Discretisation&quot;)</p>
663
664 <p class="whs1">print &quot;-------------------------- 
665  MEFISTO_2D&quot;</p>
666
667 <p class="whs1">mefisto2D = smesh.CreateHypothesis(&quot;MEFISTO_2D&quot;, 
668  &quot;libStdMeshersEngine.so&quot;)</p>
669
670 <p class="whs1">smeshgui.SetName(salome.ObjectToID(mefisto2D), 
671  &quot;MEFISTO_2D&quot;)</p>
672
673 <p class="whs2">&nbsp;</p>
674
675 <p class="whs2"># initialize a mesh with 
676  the box</p>
677
678 <p class="whs1">mesh = smesh.CreateMesh(box)</p>
679
680 <p class="whs1">smeshgui.SetName(salome.ObjectToID(mesh), 
681  &quot;MeshBox&quot;)</p>
682
683 <p class="whs1">&nbsp;</p>
684
685 <p class="whs2"># add the hypothesis to 
686  the box</p>
687
688 <p class="whs1">print &quot;-------------------------- 
689  add hypothesis to the box&quot;</p>
690
691 <p class="whs1">mesh.AddHypothesis(box,hypNbSeg)</p>
692
693 <p class="whs1">mesh.AddHypothesis(box,hypArea)</p>
694
695 <p class="whs1">mesh.AddHypothesis(box,hypVolume)</p>
696
697 <p class="whs1">mesh.AddHypothesis(box,regular1D)</p>
698
699 <p class="whs1">mesh.AddHypothesis(box,mefisto2D)</p>
700
701 <p class="whs2">&nbsp;</p>
702
703 <p class="whs2"># compute the mesh</p>
704
705 <p class="whs1">print &quot;-------------------------- 
706  compute the mesh of the box&quot;</p>
707
708 <p class="whs1">ret = smesh.Compute(mesh,box)</p>
709
710 <p class="whs1">print ret</p>
711
712 <p class="whs1">if ret == 0:</p>
713
714 <p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print 
715  &quot;probleme when computing the mesh&quot;</p>
716
717 <p class="whs1">salome.sg.updateObjBrowser(1)</p>
718
719 <p class="whs1">mesh.ExportMED(&quot;/tmp/meshMED.med&quot;,0)</p>
720
721 <p class="whs2">&nbsp;</p>
722
723 <p class="whs4">&nbsp;</p>
724
725 <script type="text/javascript" language="javascript1.2">
726 <!--
727 if (window.writeIntopicBar)
728         writeIntopicBar(0);
729 //-->
730 </script>
731 </body>
732 </html>