Salome HOME
Porting GUI documentation on Doxygen tool.
[modules/smesh.git] / doc / salome / gui / SMESH / defining_hypotheses_tui.htm
1 <!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
2
3 <html>
4
5 <head>
6 <title>Defining hypotheses TUI</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>
9 <!--
10 P { margin-top:0pt; margin-bottom:0pt; }
11 LI.kadov-P {  }
12 -->
13 </style><style type="text/css">
14 <!--
15 p.whs1 { font-weight:bold; }
16 p.whs2 { font-family:'Lucida Console' , monospace; }
17 p.whs3 { font-family:'Times New Roman' , serif; }
18 p.whs4 { margin-top:0pt; margin-bottom:0pt; font-family:'Lucida Console' , monospace; }
19 p.whs5 { margin-top:0pt; margin-bottom:0pt; font-family:'Times New Roman' , serif; }
20 p.whs6 { margin-top:0pt; margin-bottom:0pt; }
21 -->
22 </style><script type="text/javascript" language="JavaScript">
23 <!--
24 if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))
25 {
26   var strNSS = "<style type='text/css'>";
27   strNSS += "p.whs4 {margin-top:1pt;margin-bottom:1pt; }";
28   strNSS += "p.whs5 {margin-top:1pt;margin-bottom:1pt; }";
29   strNSS += "p.whs6 {margin-top:1pt;margin-bottom:1pt; }";
30   strNSS +="</style>";
31   document.write(strNSS);
32 }
33 //-->
34 </script>
35 <script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">
36 <!--
37 function reDo() {
38   if (innerWidth != origWidth || innerHeight != origHeight)
39      location.reload();
40 }
41 if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {
42         origWidth = innerWidth;
43         origHeight = innerHeight;
44         onresize = reDo;
45 }
46 onerror = null; 
47 //-->
48 </script>
49 <style type="text/css">
50 <!--
51 div.WebHelpPopupMenu { position:absolute; left:0px; top:0px; z-index:4; visibility:hidden; }
52 p.WebHelpNavBar { text-align:right; }
53 -->
54 </style><script type="text/javascript" language="javascript1.2" src="whmsg.js"></script>
55 <script type="text/javascript" language="javascript" src="whver.js"></script>
56 <script type="text/javascript" language="javascript1.2" src="whproxy.js"></script>
57 <script type="text/javascript" language="javascript1.2" src="whutils.js"></script>
58 <script type="text/javascript" language="javascript1.2" src="whtopic.js"></script>
59 <script type="text/javascript" language="javascript1.2">
60 <!--
61 if (window.gbWhTopic)
62 {
63         if (window.setRelStartPage)
64         {
65         addTocInfo("MESH module\nTUI Scripts\nDefining Hypotheses");
66 addButton("show",BTN_IMG,"Show","","","","",0,0,"whd_show0.gif","whd_show2.gif","whd_show1.gif");
67 addButton("hide",BTN_IMG,"Hide","","","","",0,0,"whd_hide0.gif","whd_hide2.gif","whd_hide1.gif");
68
69         }
70
71
72         if (window.setRelStartPage)
73         {
74         setRelStartPage("index.htm");
75
76                 autoSync(1);
77                 sendSyncInfo();
78                 sendAveInfoOut();
79         }
80
81 }
82 else
83         if (window.gbIE4)
84                 document.location.reload();
85 //-->
86 </script>
87 </head>
88 <body><script type="text/javascript" language="javascript1.2">
89 <!--
90 if (window.writeIntopicBar)
91         writeIntopicBar(4);
92 //-->
93 </script>
94 <h1>Defining Hypotheses and Algorithms</h1>
95
96 <h3>Defining 1D Hypotheses</h3>
97
98 <p class="whs1"><a name=bookmark>1D Arithmetic</a></p>
99
100 <p>&nbsp;</p>
101
102 <p class="whs2"><span style="font-family: 'Lucida Console', monospace;">import 
103  geompy</span></p>
104
105 <p class="whs2">import smesh</p>
106
107 <p class="whs2">&nbsp;</p>
108
109 <p class="whs3"># create a box</p>
110
111 <p class="whs2">box = geompy.MakeBoxDXDYDZ(10., 
112  10., 10.)</p>
113
114 <p class="whs2">geompy.addToStudy(box, 
115  &quot;Box&quot;)</p>
116
117 <p class="whs2">&nbsp;</p>
118
119 <p class="whs3"># create a hexahedral 
120  mesh on the box</p>
121
122 <p class="whs2">hexa = smesh.Mesh(box, 
123  &quot;Box : hexahedrical mesh&quot;)</p>
124
125 <p class="whs2">&nbsp;</p>
126
127 <p class="whs3"># create a Regular 1D 
128  algorithm for edges</p>
129
130 <p class="whs2">algo1D = hexa.Segment()</p>
131
132 <p class="whs2">&nbsp;</p>
133
134 <p class="whs3"># define &quot;Arithmetic1D&quot; 
135  hypothesis to cut all edges in several segments with increasing arithmetic 
136  length </p>
137
138 <p class="whs2">algo1D.Arithmetic1D(1, 
139  4)</p>
140
141 <p class="whs2">&nbsp;</p>
142
143 <p class="whs3"># create a quadrangle 
144  2D algorithm for faces</p>
145
146 <p class="whs2">hexa.Quadrangle()</p>
147
148 <p class="whs2">&nbsp;</p>
149
150 <p class="whs3"># create a hexahedron 
151  3D algorithm for solids</p>
152
153 <p class="whs2">hexa.Hexahedron()</p>
154
155 <p class="whs2">&nbsp;</p>
156
157 <p class="whs3"># compute the mesh</p>
158
159 <p class="whs2">hexa.Compute() </p>
160
161 <p class="whs2">&nbsp;</p>
162
163 <h4><a name=bookmark9>Deflection 1D and Number of Segments</a></h4>
164
165 <p class="whs2"><span style="font-family: 'Lucida Console', monospace;">import 
166  geompy</span></p>
167
168 <p class="whs2">import smesh</p>
169
170 <p class="whs2">&nbsp;</p>
171
172 <p class="whs3"># create a face from 
173  arc and straight segment</p>
174
175 <p class="whs2">px = geompy.MakeVertex(100., 
176  0. &nbsp;, 0. 
177  &nbsp;)</p>
178
179 <p class="whs2">py = geompy.MakeVertex(0. 
180  &nbsp;, 100., 
181  0. &nbsp;)</p>
182
183 <p class="whs2">pz = geompy.MakeVertex(0. 
184  &nbsp;, 0. &nbsp;, 
185  100.)</p>
186
187 <p class="whs2">&nbsp;</p>
188
189 <p class="whs2">exy = geompy.MakeEdge(px, 
190  py)</p>
191
192 <p class="whs2">arc = geompy.MakeArc(py, 
193  pz, px)</p>
194
195 <p class="whs2">&nbsp;</p>
196
197 <p class="whs2">wire = geompy.MakeWire([exy, 
198  arc])</p>
199
200 <p class="whs2">&nbsp;</p>
201
202 <p class="whs2">isPlanarFace = 1</p>
203
204 <p class="whs2">face1 = geompy.MakeFace(wire, 
205  isPlanarFace)</p>
206
207 <p class="whs2">geompy.addToStudy(face1,&quot;Face1&quot;)</p>
208
209 <p class="whs2">&nbsp;</p>
210
211 <p class="whs3"># get edges from the 
212  face</p>
213
214 <p class="whs2">e_straight,e_arc = 
215  geompy.SubShapeAll(face1, geompy.ShapeType[&quot;EDGE&quot;])</p>
216
217 <p class="whs2">geompy.addToStudyInFather(face1, 
218  e_arc, &quot;Arc Edge&quot;)</p>
219
220 <p class="whs2">&nbsp;</p>
221
222 <p class="whs3"># create hexahedral mesh</p>
223
224 <p class="whs2">hexa = smesh.Mesh(face1, 
225  &quot;Face : triangle mesh&quot;)</p>
226
227 <p class="whs2">&nbsp;</p>
228
229 <p class="whs3"># define &quot;NumberOfSegments&quot; 
230  hypothesis to cut a straight edge in a fixed number of segments</p>
231
232 <p class="whs2">algo1D = hexa.Segment()</p>
233
234 <p class="whs2">algo1D.NumberOfSegments(6)</p>
235
236 <p class="whs2">&nbsp;</p>
237
238 <p class="whs3"># define &quot;MaxElementArea&quot; 
239  hypothesis</p>
240
241 <p class="whs2">algo2D = hexa.Triangle()</p>
242
243 <p class="whs2">algo2D.MaxElementArea(70.0)</p>
244
245 <p class="whs2">&nbsp;</p>
246
247 <p class="whs3"># define a local &quot;Deflection1D&quot; 
248  hypothesis on the arc</p>
249
250 <p class="whs2">algo_local = hexa.Segment(e_arc)</p>
251
252 <p class="whs2">algo_local.Deflection1D(1.0)</p>
253
254 <p class="whs2">&nbsp;</p>
255
256 <p class="whs3"># compute the mesh</p>
257
258 <p class="whs2">hexa.Compute() </p>
259
260 <h4><a name=bookmark2>Start and End Length</a></h4>
261
262 <p class="whs2"><span style="font-family: 'Lucida Console', monospace;">from 
263  geompy import *</span></p>
264
265 <p class="whs2">import smesh</p>
266
267 <p class="whs2">&nbsp;</p>
268
269 <p class="whs3"># create a box</p>
270
271 <p class="whs2">box = MakeBoxDXDYDZ(10., 
272  10., 10.)</p>
273
274 <p class="whs2">addToStudy(box, &quot;Box&quot;)</p>
275
276 <p class="whs2">&nbsp;</p>
277
278 <p class="whs3"># get one edge of the 
279  box to put local hypothesis on</p>
280
281 <p class="whs2">p5 = MakeVertex(5., 
282  0., 0.)</p>
283
284 <p class="whs2">EdgeX = GetEdgeNearPoint(box, 
285  p5)</p>
286
287 <p class="whs2">addToStudyInFather(box, 
288  EdgeX, &quot;Edge [0,0,0 - 10,0,0]&quot;)</p>
289
290 <p class="whs2">&nbsp;</p>
291
292 <p class="whs3"># create a hexahedral 
293  mesh on the box</p>
294
295 <p class="whs2">hexa = smesh.Mesh(box, 
296  &quot;Box : hexahedrical mesh&quot;)</p>
297
298 <p class="whs2">&nbsp;</p>
299
300 <p class="whs3"># set algorithms</p>
301
302 <p class="whs2">algo1D = hexa.Segment()</p>
303
304 <p class="whs2">hexa.Quadrangle()</p>
305
306 <p class="whs2">hexa.Hexahedron()</p>
307
308 <p class="whs2">&nbsp;</p>
309
310 <p class="whs3"># define &quot;NumberOfSegments&quot; 
311  hypothesis to cut an edge in a fixed number of segments</p>
312
313 <p class="whs2">algo1D.NumberOfSegments(4)</p>
314
315 <p class="whs2">&nbsp;</p>
316
317 <p class="whs3"># create a local hypothesis</p>
318
319 <p class="whs2">algo_local = hexa.Segment(EdgeX)</p>
320
321 <p class="whs2">&nbsp;</p>
322
323 <p class="whs3"># define &quot;StartEndLength&quot; 
324  hypothesis to cut an edge in several segments with increasing geometric 
325  length</p>
326
327 <p class="whs2">algo_local.StartEndLength(1, 
328  6)</p>
329
330 <p class="whs2">&nbsp;</p>
331
332 <p class="whs3"># define &quot;Propagation&quot; 
333  hypothesis that propagates all other hypothesis</p>
334
335 <p class="whs3"># on all edges on the 
336  opposite side in case of quadrangular faces</p>
337
338 <p class="whs2">algo_local.Propagation()</p>
339
340 <p class="whs2">&nbsp;</p>
341
342 <p class="whs3"># compute the mesh</p>
343
344 <p class="whs2">hexa.Compute() </p>
345
346 <h4><a name=bookmark3>Average Length</a></h4>
347
348 <p class="whs2"><span style="font-family: 'Lucida Console', monospace;">from 
349  geompy import *</span></p>
350
351 <p class="whs2">import smesh</p>
352
353 <p class="whs2">&nbsp;</p>
354
355 <p class="whs3"># create a box</p>
356
357 <p class="whs2">box = MakeBoxDXDYDZ(10., 
358  10., 10.)</p>
359
360 <p class="whs2">addToStudy(box, &quot;Box&quot;)</p>
361
362 <p class="whs2">&nbsp;</p>
363
364 <p class="whs3"># get one edge of the 
365  box to put local hypothesis on</p>
366
367 <p class="whs2">p5 = MakeVertex(5., 
368  0., 0.)</p>
369
370 <p class="whs2">EdgeX = GetEdgeNearPoint(box, 
371  p5)</p>
372
373 <p class="whs2">addToStudyInFather(box, 
374  EdgeX, &quot;Edge [0,0,0 - 10,0,0]&quot;)</p>
375
376 <p class="whs2">&nbsp;</p>
377
378 <p class="whs3"># create a hexahedral 
379  mesh on the box</p>
380
381 <p class="whs2">hexa = smesh.Mesh(box, 
382  &quot;Box : hexahedrical mesh&quot;)</p>
383
384 <p class="whs2">&nbsp;</p>
385
386 <p class="whs3"># set algorithms</p>
387
388 <p class="whs2">algo1D = hexa.Segment()</p>
389
390 <p class="whs2">hexa.Quadrangle()</p>
391
392 <p class="whs2">hexa.Hexahedron()</p>
393
394 <p class="whs2">&nbsp;</p>
395
396 <p class="whs3"># define &quot;NumberOfSegments&quot; 
397  hypothesis to cut all edges in a fixed number of segments</p>
398
399 <p class="whs2">algo1D.NumberOfSegments(4)</p>
400
401 <p class="whs2">&nbsp;</p>
402
403 <p class="whs3"># create a sub-mesh</p>
404
405 <p class="whs2">algo_local = hexa.Segment(EdgeX)</p>
406
407 <p class="whs2">&nbsp;</p>
408
409 <p class="whs3"># define &quot;LocalLength&quot; 
410  hypothesis to cut an edge in several segments with the same length</p>
411
412 <p class="whs2">algo_local.LocalLength(2.)</p>
413
414 <p class="whs2">&nbsp;</p>
415
416 <p class="whs3"># define &quot;Propagation&quot; 
417  hypothesis that propagates all other hypothesis</p>
418
419 <p class="whs3"># on all edges on the 
420  opposite side in case of quadrangular faces</p>
421
422 <p class="whs2">algo_local.Propagation()</p>
423
424 <p class="whs2">&nbsp;</p>
425
426 <p class="whs3"># compute the mesh</p>
427
428 <p class="whs2">hexa.Compute() </p>
429
430 <h3>Defining 2D and 3D hypotheses</h3>
431
432 <h4><a name=bookmark4>Maximum Element Area</a></h4>
433
434 <p class="whs4"><span style="font-family: 'Lucida Console', monospace;">import 
435  geompy</span></p>
436
437 <p class="whs4">import smesh</p>
438
439 <p class="whs4">import salome </p>
440
441 <p class="whs4">&nbsp;</p>
442
443 <p class="whs5"># create a face</p>
444
445 <p class="whs4">px &nbsp;&nbsp;= 
446  geompy.MakeVertex(100., 0. &nbsp;, 
447  0. &nbsp;)</p>
448
449 <p class="whs4">py &nbsp;&nbsp;= 
450  geompy.MakeVertex(0. &nbsp;, 
451  100., 0. &nbsp;)</p>
452
453 <p class="whs4">pz &nbsp;&nbsp;= 
454  geompy.MakeVertex(0. &nbsp;, 
455  0. &nbsp;, 100.)</p>
456
457 <p class="whs4">&nbsp;</p>
458
459 <p class="whs4">vxy = geompy.MakeVector(px, 
460  py)</p>
461
462 <p class="whs4">arc = geompy.MakeArc(py, 
463  pz, px)</p>
464
465 <p class="whs4">wire = geompy.MakeWire([vxy, 
466  arc])</p>
467
468 <p class="whs4">&nbsp;</p>
469
470 <p class="whs4">isPlanarFace = 1</p>
471
472 <p class="whs4">face = geompy.MakeFace(wire, 
473  isPlanarFace)</p>
474
475 <p class="whs4">&nbsp;</p>
476
477 <p class="whs5"># add the face in the 
478  study</p>
479
480 <p class="whs4">id_face = geompy.addToStudy(face, 
481  &quot;Face to be meshed&quot;)</p>
482
483 <p class="whs4">&nbsp;</p>
484
485 <p class="whs5"># create a mesh</p>
486
487 <p class="whs4">tria_mesh = smesh.Mesh(face, 
488  &quot;Face : triangulation&quot;)</p>
489
490 <p class="whs4">&nbsp;</p>
491
492 <p class="whs5"># define 1D meshing:</p>
493
494 <p class="whs4">algo = tria_mesh.Segment()</p>
495
496 <p class="whs4">algo.NumberOfSegments(20)</p>
497
498 <p class="whs4">&nbsp;</p>
499
500 <p class="whs5"># define 2D meshing:</p>
501
502 <p class="whs5">&nbsp;</p>
503
504 <p class="whs5"># assign triangulation 
505  algorithm</p>
506
507 <p class="whs4">algo = tria_mesh.Triangle()</p>
508
509 <p class="whs4">&nbsp;</p>
510
511 <p class="whs5"># apply &quot;Max Element 
512  Area&quot; hypothesis to each triangle</p>
513
514 <p class="whs4">algo.MaxElementArea(100)</p>
515
516 <p class="whs4">&nbsp;</p>
517
518 <p class="whs5"># compute the mesh</p>
519
520 <p class="whs4">tria_mesh.Compute() 
521  &nbsp;</p>
522
523 <p class="whs4">&nbsp;</p>
524
525 <h4><a name=bookmark5>Maximum Element Volume</a></h4>
526
527 <p class="whs4"><span style="font-family: 'Lucida Console', monospace;">import 
528  geompy</span></p>
529
530 <p class="whs4">import smesh</p>
531
532 <p class="whs4">&nbsp;</p>
533
534 <p class="whs5"># create a cylinder</p>
535
536 <p class="whs4">cyl = geompy.MakeCylinderRH(30., 
537  50.)</p>
538
539 <p class="whs4">geompy.addToStudy(cyl, 
540  &quot;cyl&quot;)</p>
541
542 <p class="whs4">&nbsp;</p>
543
544 <p class="whs5"># create a mesh on 
545  the cylinder</p>
546
547 <p class="whs4">tetra = smesh.Mesh(cyl, 
548  &quot;Cylinder : tetrahedrical mesh&quot;)</p>
549
550 <p class="whs4">&nbsp;</p>
551
552 <p class="whs5"># assign algorithms</p>
553
554 <p class="whs4">algo1D = tetra.Segment()</p>
555
556 <p class="whs4">algo2D = tetra.Triangle()</p>
557
558 <p class="whs4">algo3D = tetra.Tetrahedron(smesh.NETGEN)</p>
559
560 <p class="whs4">&nbsp;</p>
561
562 <p class="whs5"># assign 1D and 2D 
563  hypotheses</p>
564
565 <p class="whs4">algo1D.NumberOfSegments(7)</p>
566
567 <p class="whs4">algo2D.MaxElementArea(150.)</p>
568
569 <p class="whs4">&nbsp;</p>
570
571 <p class="whs5"># assign Max Element 
572  Volume hypothesis</p>
573
574 <p class="whs4">algo3D.MaxElementVolume(200.)</p>
575
576 <p class="whs4">&nbsp;</p>
577
578 <p class="whs5"># compute the mesh</p>
579
580 <p class="whs4">ret = tetra.Compute()</p>
581
582 <p class="whs4">if ret == 0:</p>
583
584 <p class="whs4">&nbsp;&nbsp;&nbsp;&nbsp;print 
585  &quot;probleme when computing the mesh&quot;</p>
586
587 <p class="whs4">else:</p>
588
589 <p class="whs4">&nbsp;&nbsp;&nbsp;&nbsp;print 
590  &quot;Computation succeded&quot; </p>
591
592 <h4><a name=bookmark6>Length from Edges</a></h4>
593
594 <p class="whs2"><span style="font-family: 'Lucida Console', monospace;">import 
595  geompy</span></p>
596
597 <p class="whs2">import smesh</p>
598
599 <p class="whs2">&nbsp;</p>
600
601 <p class="whs3"># create sketchers</p>
602
603 <p class="whs2">sketcher1 = geompy.MakeSketcher(&quot;Sketcher:F 
604  0 0:TT 70 0:TT 70 70:TT 0 70:WW&quot;)</p>
605
606 <p class="whs2">sketcher2 = geompy.MakeSketcher(&quot;Sketcher:F 
607  20 20:TT 50 20:TT 50 50:TT 20 50:WW&quot;)</p>
608
609 <p class="whs2">&nbsp;</p>
610
611 <p class="whs3"># create a face from 
612  two wires</p>
613
614 <p class="whs2">isPlanarFace = 1</p>
615
616 <p class="whs2">face1 = geompy.MakeFaces([sketcher1, 
617  sketcher2], isPlanarFace)</p>
618
619 <p class="whs2">geompy.addToStudy(face1, 
620  &quot;Face1&quot;)</p>
621
622 <p class="whs2">&nbsp;</p>
623
624 <p class="whs3"># create a mesh</p>
625
626 <p class="whs2">tria = smesh.Mesh(face1, 
627  &quot;Face : triangle 2D mesh&quot;)</p>
628
629 <p class="whs2">&nbsp;</p>
630
631 <p class="whs3"># Define 1D meshing</p>
632
633 <p class="whs2">algo1D = tria.Segment()</p>
634
635 <p class="whs2">algo1D.NumberOfSegments(2)</p>
636
637 <p class="whs2">&nbsp;</p>
638
639 <p class="whs3"># create and assign the 
640  algorithm for 2D meshing with triangles</p>
641
642 <p class="whs2">algo2D = tria.Triangle()</p>
643
644 <p class="whs2">&nbsp;</p>
645
646 <p class="whs3"># create and assign &quot;LengthFromEdges&quot; 
647  hypothesis to build triangles<span style="font-family: 'Times New Roman', serif;"> 
648  based on the length of the edges taken from the wire</span></p>
649
650 <p class="whs2">algo2D.LengthFromEdges()</p>
651
652 <p class="whs2">&nbsp;</p>
653
654 <p class="whs3"># compute the mesh</p>
655
656 <p class="whs2">tria.Compute() </p>
657
658 <p class="whs2">&nbsp;</p>
659
660 <h3>Defining Additional Hypotheses</h3>
661
662 <h4><a name=bookmark7>Propagation</a></h4>
663
664 <p class="whs2">from geompy import 
665  *</p>
666
667 <p class="whs2">import smesh</p>
668
669 <p class="whs2">&nbsp;</p>
670
671 <p class="whs3"># create a box</p>
672
673 <p class="whs2">box = MakeBoxDXDYDZ(10., 
674  10., 10.)</p>
675
676 <p class="whs2">addToStudy(box, &quot;Box&quot;)</p>
677
678 <p class="whs2">&nbsp;</p>
679
680 <p class="whs3"># get one edge of the 
681  box to put local hypothesis on</p>
682
683 <p class="whs2">p5 = MakeVertex(5., 
684  0., 0.)</p>
685
686 <p class="whs2">EdgeX = GetEdgeNearPoint(box, 
687  p5)</p>
688
689 <p class="whs2">addToStudyInFather(box, 
690  EdgeX, &quot;Edge [0,0,0 - 10,0,0]&quot;)</p>
691
692 <p class="whs2">&nbsp;</p>
693
694 <p class="whs3"># create a hexahedral 
695  mesh on the box</p>
696
697 <p class="whs2">hexa = smesh.Mesh(box, 
698  &quot;Box : hexahedrical mesh&quot;)</p>
699
700 <p class="whs2">&nbsp;</p>
701
702 <p class="whs3"># set global algorithms 
703  and hypotheses</p>
704
705 <p class="whs2">algo1D = hexa.Segment()</p>
706
707 <p class="whs2">hexa.Quadrangle()</p>
708
709 <p class="whs2">hexa.Hexahedron()</p>
710
711 <p class="whs2">algo1D.NumberOfSegments(4)</p>
712
713 <p class="whs2">&nbsp;</p>
714
715 <p class="whs3"># create a sub-mesh with 
716  local 1D hypothesis and propagation</p>
717
718 <p class="whs2">algo_local = hexa.Segment(EdgeX)</p>
719
720 <p class="whs2">&nbsp;</p>
721
722 <p class="whs3"># define &quot;Arithmetic1D&quot; 
723  hypothesis to cut an edge in several segments with increasing length</p>
724
725 <p class="whs2">algo_local.Arithmetic1D(1, 
726  4)</p>
727
728 <p class="whs2">&nbsp;</p>
729
730 <p class="whs3"># define &quot;Propagation&quot; 
731  hypothesis that propagates all other 1D hypotheses</p>
732
733 <p class="whs3"># from all edges on the 
734  opposite side of a face in case of quadrangular faces</p>
735
736 <p class="whs2">algo_local.Propagation()</p>
737
738 <p class="whs2">&nbsp;</p>
739
740 <p class="whs3"># compute the mesh</p>
741
742 <p><span style="font-family: 'Lucida Console', monospace;">hexa.Compute()</span> 
743  </p>
744
745 <h3><a name=bookmark8>Defining Meshing Algorithms</a></h3>
746
747 <p class="whs4">import geompy</p>
748
749 <p class="whs4">import smesh</p>
750
751 <p class="whs6">&nbsp;</p>
752
753 <p class="whs6"># create a box</p>
754
755 <p class="whs4">box = geompy.MakeBoxDXDYDZ(10., 
756  10., 10.)</p>
757
758 <p class="whs4">geompy.addToStudy(box, 
759  &quot;Box&quot;)</p>
760
761 <p class="whs4">&nbsp;</p>
762
763 <p class="whs6"># 1. Create a hexahedral 
764  mesh on the box</p>
765
766 <p class="whs4">hexa = smesh.Mesh(box, 
767  &quot;Box : hexahedrical mesh&quot;)</p>
768
769 <p class="whs6">&nbsp;</p>
770
771 <p class="whs6"># create a Regular 1D algorithm 
772  for edges</p>
773
774 <p class="whs4">algo1D = hexa.Segment()</p>
775
776 <p class="whs6">&nbsp;</p>
777
778 <p class="whs6"># create a quadrangle 2D 
779  algorithm for faces</p>
780
781 <p class="whs4">algo2D = hexa.Quadrangle()</p>
782
783 <p class="whs6">&nbsp;</p>
784
785 <p class="whs6"># create a hexahedron 3D 
786  algorithm for solids</p>
787
788 <p class="whs4">algo3D = hexa.Hexahedron()</p>
789
790 <p class="whs6">&nbsp;</p>
791
792 <p class="whs6"># define hypotheses</p>
793
794 <p class="whs4">algo1D.Arithmetic1D(1, 
795  4)</p>
796
797 <p class="whs6">&nbsp;</p>
798
799 <p class="whs6"># compute the mesh</p>
800
801 <p class="whs4">hexa.Compute()</p>
802
803 <p class="whs6">&nbsp;</p>
804
805 <p class="whs6"># 2. Create a tetrahedral 
806  mesh on the box</p>
807
808 <p class="whs4">tetra = smesh.Mesh(box, 
809  &quot;Box : tetrahedrical mesh&quot;)</p>
810
811 <p class="whs6">&nbsp;</p>
812
813 <p class="whs6"># create a Regular 1D algorithm 
814  for edges</p>
815
816 <p class="whs4">algo1D = tetra.Segment()</p>
817
818 <p class="whs6">&nbsp;</p>
819
820 <p class="whs6"># create a Mefisto 2D algorithm 
821  for faces</p>
822
823 <p class="whs4">algo2D = tetra.Triangle()</p>
824
825 <p class="whs6">&nbsp;</p>
826
827 <p class="whs6"># create a Netgen 3D algorithm 
828  for solids</p>
829
830 <p class="whs4">algo3D = tetra.Tetrahedron(smesh.NETGEN)</p>
831
832 <p class="whs6">&nbsp;</p>
833
834 <p class="whs6"># define hypotheses</p>
835
836 <p class="whs4">algo1D.Arithmetic1D(1, 
837  4)</p>
838
839 <p class="whs4">algo2D.LengthFromEdges()</p>
840
841 <p class="whs6">&nbsp;</p>
842
843 <p class="whs6"># compute the mesh</p>
844
845 <p class="whs4">tetra.Compute()</p>
846
847 <p class="whs6">&nbsp;</p>
848
849 <p class="whs6"># 3. Create a tetrahedral 
850  mesh on the box with NETGEN_2D3D algorithm</p>
851
852 <p class="whs4">tetraN = smesh.Mesh(box, 
853  &quot;Box : tetrahedrical mesh by NETGEN_2D3D&quot;)</p>
854
855 <p class="whs6">&nbsp;</p>
856
857 <p class="whs6"># create a Netgen_2D3D 
858  algorithm for solids</p>
859
860 <p class="whs4">algo3D = tetraN.Tetrahedron(smesh.FULL_NETGEN) 
861  </p>
862
863 <p class="whs6">&nbsp;</p>
864
865 <p class="whs6"># define hypotheses</p>
866
867 <p class="whs4">n23_params = algo3D.Parameters()</p>
868
869 <p class="whs6">&nbsp;</p>
870
871 <p class="whs6"># compute the mesh</p>
872
873 <p class="whs4">tetraN.Compute() 
874  </p>
875
876 <script type="text/javascript" language="javascript1.2">
877 <!--
878 if (window.writeIntopicBar)
879         writeIntopicBar(0);
880 //-->
881 </script>
882 </body>
883 </html>