Salome HOME
PR: merged from V5_1_4rc1
[modules/smesh.git] / doc / salome / gui / SMESH / input / ghs3dprl_hypo.doc
1 /*!
2
3 \page ghs3dprl_hypo_page GHS3DPRL Parameters hypothesis
4
5 \n GHS3DPRL Parameters hypothesis works only with <b>Tetrahedron (Tepal with TetMesh-GHS3D)</b> algorithm. 
6 This algorithm is a commercial software, its use requires a licence (http://www.distene.com/fr/build/offer.html).
7 \n Tepal_V1.4 gives the possibility to generate a partitioned
8 mesh with 200 million tetrahedrons on a computer with average memory size
9 (2Go RAM) in about 50 hours on one CPU (Xeon, 2008).
10 \n New Tepal_V2.0 gives the possibility to generate a partitioned mesh with (for the moment) no more than 100 million 
11 tetrahedrons on computers using MPI, (Total 16 Go RAM) 
12 in about 900 seconds (!yes! : !seconds!) on 2 octo processors (Xeon, 2009).
13 The launch of this beta-version is described below.
14 \n This is a serious alternative to GHS3D, which requires a much less common
15 configuration with 64Go RAM to only try to make a partition of a mesh with
16 200 million tetrahedrons, no result guaranteed.
17 \n
18 \note The Plugin doesn't load in the Memory the supposedly large resulting meshes. 
19 The meshes are saved in MED files and can be imported in the user-defined location via menu File-Import-MED Files.
20 \n Pay attention, that Salome GUI needs 2Go RAM to load a MED
21 file with 5 million tetrahedrons.
22
23 \image html ghs3dprl_parameters_basic.png
24
25 <ul>
26 <li>
27 <b>Name</b> - allows to define the name of the hypothesis (GHS3DPRL Parameters by default).
28 </li>
29 <li>
30 <b>MED_Name</b> - allows to define the path and the prefix of the 
31 resulting MED files ("DOMAIN" by default). 
32 If the path is not defined, the environment variable $SALOME_TMP_DIR
33 is used. If $SALOME_TMP_DIR is not defined as well, the environment
34 variable $TMP is used.
35 </li>
36 <li>
37 <b>Nb_Part</b> - allows to define the number of generated MED files.
38 The initial skin (triangles) will be meshed (tetrahedrons) and partitioned 
39 in Nb_Part by the elementary algorithm implemented in Tepal.<br>
40 </li>
41 <li>
42 <b>Keep_Files</b> - if this box is checked, input files of Tepal 
43 (GHS3DPRL.points and GHS3DPRL.faces) are not deleted after use (...if the
44 background mode was not used).
45 </li>
46 <li>
47 <b>Tepal_in_Background</b> - if this box is checked, Tepal execution
48 and MED file generation are launched in background mode and the user
49 can even exit Salome. Pay attention that in this case Tepal algorithm works
50 independently of "killSalome.py", and sometimes on another host.
51 </li>
52 <li>
53 <b>To_Mesh_Holes</b> - if this box is checked, the parameter component 
54 of tetmesh-ghs3d will mesh holes.
55 </li>
56
57 <h1>Modifying GHS3DPRL Advanced Parameters</h1><br>
58 GHS3DPRL Plugin launches a standalone binary executable tepal2med.<br>
59 tepal2med launches tepal, waits for the end of computation, and
60 converts the resulting output tepal files into MED files.<br>
61 Some advanced optional parameters are accessible as arguments.<br>
62
63 If keep_files option is checked, it is possible to re-launch tepal2med
64 or tepal in the Terminal as a command with custom parameters.<br>
65
66 <li>
67 <b>Advanced tepal2med Parameters</b> - type "tepal2med --help" in the Terminal. <p>
68
69 \verbatim
70 myname@myhost > /export/home/myname/salome_5/GHS3DPRLPLUGIN_5/bin/salome/tepal2med --help
71 Available options:
72    --help         : produces this help message
73    --casename     : path and name of input tepal2med files which are
74                        - output files of tepal .msg .noboite .faces .points .glo
75                        - output file of GHS3DPRL_Plugin casename_skin.med (optional)
76                          with initial skin and its initial groups
77    --number       : number of partitions
78    --medname      : path and name of output MED files
79    --limitswap    : max size of working cpu memory (Mo) (before swapping on .temp files)
80    --verbose      : trace of execution (0->6)
81    --test         : more tests about joints, before generation of output files
82    --menu         : a GUI menu for option number
83    --launchtepal  : also launch tepal on files casename.faces and casename.points and option number
84    --meshholes    : force parameter component of tetmesh-ghs3d to mesh holes
85    --background   : force background mode from launch tepal and generation of final MED files (big meshes)
86    --deletegroups : regular expression (see QRegExp) which matches unwanted groups in final MED files
87                     (try --deletegroups="(\bAll_Nodes|\bAll_Faces)"
88                     (try --deletegroups="((\bAll_|\bNew_)(N|F|T))"
89 example:
90    tepal2med --casename=/tmp/GHS3DPRL --number=2 --medname=DOMAIN --limitswap=1000 
91              --verbose=0 --test=yes --menu=no --launchtepal=no
92
93 \endverbatim
94 \n
95 </li>
96 <li>
97 <b>Advanced Tepal_V1.4 Parameters</b> <p>
98
99 \verbatim
100
101 USAGE : tepal options
102
103 With options :
104      --filename name (-f name) :
105           Prefix of the input case (MANDATORY)
106
107      --ndom n (-n n) :
108           Number of subdomains to make (MANDATORY)
109
110      --ghs3d ghs3d options (-g ghs3d options) :
111           Runs temesh ghs3d on a previously generated subdomain. (ghs3d options must be "quoted")
112
113      --memory m (-m m) :
114           Max amount of memory (megabytes) allowed for ghs in the cutting process. (default is 0 : unlimited)
115
116      --mesh_only  (-Z ) :
117           Only (re)meshes all subdomains and updates communications messages
118
119      --mesh_call command (-c command) :
120           Calls the user specified command for meshing all the
121           subomains after their skin has been generated
122
123      --stats_only  (-S ) :
124           Only computes and shows some statistics on subdomains
125
126      --rebuild  (-r ) :
127           Merges final subdomains skins
128
129      --rebuild_tetra  (-R ) :
130           Merges final subdomains skins and tetraedra
131
132      --rebuild_iface  (-i ) :
133           Includes interfaces in final subdomains merge
134
135      --rebuild_retag  (-t ) :
136           Tags vertices, faces (and tetra if selected) with their
137           subdomain number in the final merge of subdomains (keeps the lowest tag for shared elements)
138
139      --rebuild_ensight_parts  (-e ) :
140           Builds ensight geom file with parts
141
142      --tetmesh_args str (-G str) :
143           Arguments to pass to Tetmesh during cutting process
144
145 \endverbatim
146 \n
147 </li>
148 <li>
149 <b>Advanced ghs3d Parameters (through Tepal_V1.4's --tetmesh_args)</b> - type "ghs3d -h" in a Terminal. <p>
150
151 \verbatim
152 myname@myhost > ghs3d -h
153
154 USE
155     /export/home/myname/ghs3d-4.0/DISTENE/Tools/TetMesh-GHS3D4.0/bin/Linux/ghs3dV4.0
156     [-u] [-m memory>] [-M MEMORY] [-f prefix] [-v verbose]
157     [-c component] [-p0] [-C] [-E count] [-t] [-o level]
158     [-I filetype] [-a/-b] [-O n m]
159
160 DESCRIPTION
161
162  -u (-h)        : prints this message.
163
164  -m memory      : launches the software with memory in Megabytes.
165                   The default value of this parameter is 64 Megabytes and its
166                   minimum value is 10 Megabytes.
167                   It is also possible to set this parameter with the
168                   environment variable GHS3D_MEMORY by means of an operation
169                   equivalent to:
170                            setenv GHS3D_MEMORY memory,
171                   the value specified in the command line has the priority on
172                   the environment variable.
173
174  -M MEMORY      : provides the automatic memory adjustment feature.
175                   If MEMORY (in Megabytes) is equal to zero, the size of the work space is
176                   calculated from the input. If MEMORY is not equal to
177                   zero, the software starts with MEMORY amount of work space.
178                   The software reallocates memory as necessary.
179                   The start value of  MEMORY can range from 0 to 64 Megabytes,
180                   the maximum depends on -m option and the actual memory available.
181
182  -f prefix      : defines the generic prefix of the files.
183
184  -v verbose     : sets the output level parameter (the verbose parameter
185                   must be in the range 0 to 10).
186
187  -c component   : chooses the meshed component. If the parameter is
188                       0, all components will be meshed, if
189                       1, only the main (outermost) component will be meshed
190
191  -p0            : disables creation of internal points.
192
193  -C             : uses an alternative boundary recovery mechanism. It should be used only
194                   when the standard boundary recovery fails.
195
196  -E count       : sets the extended output for error messages. If -E is used,
197                   the error messages will be printed, it is possible
198                   to indicate the maximum number of printed messages between 1 and 100.
199
200  -t             : generates an error file prefix.Log
201
202  -o level       : sets the required optimisation level.
203                   Valid optimisation levels are:
204                   none, light, standard or strong,
205                   with increase of "quality vs speed" ratio.
206
207  -I filetype    : defines the input mesh format as follows:
208                     -IP input files are ascii files, named prefix.points
209                      and prefix.faces - this is the default type of files
210                     -IPb input files are binary files, named prefix.pointsb
211                      and prefix.facesb
212                     -IM input file is ascii file, named prefix.mesh
213                   where prefix is defined with -f option
214
215  -a/-b          : selects the output file type:
216                     -a for ascii (the default) and
217                     -b for binary.
218
219  -On            : saves a NOPO file in addition. NOPO is the mesh data
220                   structure of the Simail and Modulef software packages.
221  -Om            : saves a mesh file in addition.
222  -Omn           : saves both NOPO and mesh files.
223
224  ==============================================================================
225                    TETMESH-GHS3D SOFTWARE 4.0-3 (December, 2006)
226                                  END OF SESSION
227                 COPYRIGHT (C)1989-2006 INRIA ALL RIGHTS RESERVED
228  ==============================================================================
229       ( Distene SAS
230         Phone: +33(0)1-69-26-62-10   Fax: +33(0)1-69-26-90-33
231         EMail: support@distene.com )
232
233 \endverbatim
234 \n
235 </li>
236 <h1>Saving user's preferred GHS3DPRL Advanced Parameters</h1><br>
237 GHS3DPRL Plugin launches standalone binary executable tepal2med.<br>
238 You may rename file tepal2med as tepal2med.exe for example, and replace
239 tepal2med by a shell script at your convenience to overriding parameters.
240 <br>... or else $PATH modification... .<br>Idem for file tepal.<br><br>
241 <li>
242 <b>Advanced tepal2med Parameters</b> - overriding parameter deletegroups<p>
243 You may rename tepal2med as tepal2med.exe for example.
244
245 \code
246 #!/bin/bash
247 #script tepal2med overriding parameter deletegroups
248 #we have renamed binary executable tepal2med as tepal2med.exe
249 #echo tepal2med initial parameters are $1 $2 $3 $4 ... or $*
250 #$0 is ignored
251
252 tepal2med.exe $* --deletegroups="(\bAll_Nodes|\bAll_Faces)"
253
254 \endcode
255 \n
256 </li>
257 <li>
258 <b>Advanced Tepal_V1.4 Parameters</b> - overriding parameter component of ghs3d (to mesh holes). <p>
259 You may rename tepal as tepal.exe for example.
260
261 \code
262 #!/bin/bash
263 #script tepal overriding parameter component of tetmesh-ghs3d
264 #we have renamed binary executable tepal as tepal.exe
265
266 #optionnaly we could set licence only for us
267 DISTENE_LICENSE_FILE="Use global envvar: DLIM8VAR"
268 DLIM8VAR="dlim8 1:1:29030@is142356/0016175ef08c::a1ba1...etc...e19"
269 SIMULOGD_LICENSE_FILE=29029@is142356
270
271 tepal.exe $* --tetmesh_args "-c 0"
272
273 \endcode
274 \n
275 </li>
276 <li>
277 <b>Advanced tepal Parameters</b> - overriding launching tepal on other host. <p>
278 You may rename tepal as tepal.exe for example.
279
280 \code
281 #!/bin/bash
282 #script tepal overriding launching tepal on other host (tepal run 64 bits only)
283 #we have renamed binary executable tepal as tepal.exe
284 #common file system (same path) otherwise scp... on input or result files
285 #ssh -keygen -t rsa done and files id_rsa et id-rsa.pub move in ~/.ssh
286
287 #example of typical command
288 #tepal -f /home/myname/tmp/GHS3DPRL -n 4 > /home/myname/tmp/tepal.log
289 #echo parameters $1 $2 $3 $4 ... or $*
290
291 #tepal licence ought to be known on otherhost
292 ssh otherhost "tepal.exe $* > /home/myname/tmp/tepal.log"
293
294 #or more and more
295 #ssh otherhost "tepal.exe $* --tetmesh_args \"-c 0\"" > /home/myname/tmp/tepal.log
296
297 \endcode
298 \n
299 </li>
300
301 <h1>Tepal_V2.0 and MPI use.</h1><br>
302 This all new beta-version needs MPI, (openmpi-1.3.1 was used). To use it you have to proceed 
303 as done in "overriding parameter component of ghs3d".
304 Advanced ghs3d Parameters (through Tepal_V1.4's --tetmesh_args) are not assumed yet.
305 It meshes holes.
306 \n You may rename tepal as tepal64_v2.exe for example, and replace tepal by a shell script like below.
307
308 <li>
309 <b>example tepal_v2_mpirun.</b><p>
310
311 \code
312
313 #!/bin/bash
314 #script tepal overriding launching Tepal_V2.0 with MPI (tepal run 64 bits only).
315 #we have renamed binary executable tepal as tepal64_v2.exe.
316 #typical command to launch tepal v1 :
317 #tepal -f /tmp/myname/GHS3DPRL -n 16 > /tmp/myname/tepal.log
318 #this file is an exemple to transform this call for tepal v2.0, 
319 #   (beta version using .mesh input file)
320 #you have to adapt for your convenience.
321
322 #first problem  is convert v1 input files GHS3DPRL.faces and GHS3DPRL.points 
323 #               to v2 input file GHS3DPRL.mesh.
324 #second problem is to launch on heterogeneous system linux cluster of 
325 #               2 hosts (64 bits) of 8 nodes (by example)
326 #               with different 2 executables codes linked on 2 different
327 #               openmpi shared library codes.
328 #third problem  is convert tepal v2 output files GHS3DPRL*.mesh
329 #               to v1 input files GHS3DPRL*.faces an GHS3DPRL*.points.
330
331 #you have to work on the same physical disk and same path input and ouput files : $SAME_DIR
332 #you have to work on different physical disk but same path and name for executable files 
333 #    (and shared libraries) : $DIFF_DIR
334
335 echo "parameter 0="$0
336 echo "parameter 1="$1
337 echo "parameter 2="$2
338 echo "parameter 3="$3
339 echo "parameter 4="$4
340
341 export SAME_DIR=/same_physical_disk_and_same path/tmp
342 export DIFF_DIR=/different_physical_disk_but_same path/myname
343
344 #copy input local files from local current directory (something like /tmp/myname)
345 #in this case we need /tmp/myname and $SAME_DIR different
346 cd $SAME_DIR
347 rm *
348 cp $2* .
349
350 export IN_FILES=`basename $2`
351 export IN_DIR=`dirname $2`
352 #created .mesh from .faces et .points
353 /through_salome_path/facespoints2mesh.py $IN_FILES
354
355 #there are 2 executable openmpi and library through 2 physical DIFF_DIR
356 export PATH=$DIFF_DIR/openmpi-1.3.1_install/bin:${PATH}
357 export LD_LIBRARY_PATH=$DIFF_DIR/openmpi-1.3.1_install/lib:${LD_LIBRARY_PATH}
358
359 #there are 2 executables tepal_v2 through 2 physical DIFF_DIR
360 export LD_LIBRARY_PATH=$DIFF_DIR/tepal-2.0.0/bin/Linux_64:${LD_LIBRARY_PATH}
361 export PATH=$DIFF_DIR/tepal-2.0.0/bin/Linux_64:$PATH
362
363 #small test betweeen friends
364 #rm hostnames.log
365 #mpirun -n $4 hostname >> hostnames.log
366
367 #there necessary set env licence file for tepal v2
368 export DISTENE_LICENSE_FILE="Use global envvar: DLIM8VAR"
369 export DLIM8VAR="dlim8 1:1:29030@is142356/0016175ef08c::a1ba...9e19"
370 export SIMULOGD_LICENSE_FILE=29029@is142356 
371 export LICENSE_FILE=/product/distene/dlim8.var.sh
372
373 #mpirun with necessary set envenvironment
374 export TMP_ENV="-x PATH -x LD_LIBRARY_PATH -x DISTENE_LICENSE_FILE -x DLIM8VAR \
375                 -x SIMULOGD_LICENSE_FILE -x LICENSE_FILE"
376 #mpirun $TMPENV -n $4 which tepal64_v2.exe >> hostnames.log
377
378 #real mpirun uncomment after verify small test
379 mpirun $TMPENV -n $4 tepal64_v2.exe --in $IN_FILES.mesh --out $IN_FILES.mesh --verbose 100
380
381 #convert output files tepalv1 format
382 /through_salome_path/mesh2facespoints.py $IN_FILES
383
384 #copy ouputs files from $SAME_DIR to local current directory (something like /tmp/myname)
385 cp -f hostnames.log $IN_DIR
386 cp -f $IN_FILES* $IN_DIR
387
388 #ls -al $SAME_DIR
389 #cat $SAME_DIR/hostnames.log
390 #cat /tmp/myname/tepal.log
391
392 \endcode
393 \n
394 </li>
395
396 <h1>TUI use.</h1><br>
397
398 <li>
399 <b>example ex30_tepal.py.</b><p>
400
401 \code
402
403 #!/bin/python
404 import os
405
406 import geompy
407 import smesh
408
409 # Parameters
410 # ----------
411
412 results = "/tmp/ZZ"
413
414 radius =  50
415 height = 200
416
417 # Build a cylinder
418 # ----------------
419
420 base = geompy.MakeVertex(0, 0, 0)
421 direction = geompy.MakeVectorDXDYDZ(0, 0, 1)
422
423 cylinder = geompy.MakeCylinder(base, direction, radius, height)
424
425 geompy.addToStudy(cylinder, "Cylinder")
426
427 # Define a mesh on a geometry
428 # ---------------------------
429
430 m = smesh.Mesh(cylinder)
431
432 # 2D mesh with BLSURF
433 # -------------------
434
435 algo2d = m.Triangle(smesh.BLSURF)
436
437 algo2d.SetPhysicalMesh(1)
438 algo2d.SetPhySize(5)
439
440 algo2d.SetGeometricMesh(0)
441
442 # 3D mesh with tepal
443 # ------------------
444
445 algo3d = m.Tetrahedron(smesh.GHS3DPRL)
446
447 algo3d.SetMEDName(results)
448 algo3d.SetNbPart(4)
449 algo3d.SetBackground(False)
450 algo3d.SetKeepFiles(False)
451 algo3d.SetToMeshHoles(True)
452
453 # Launch meshers
454 # --------------
455
456 status = m.Compute()
457
458 # Test if ok
459 # ----------
460
461 if os.access(results+".xml", os.F_OK):
462     print "Ok: tepal"
463 else:
464     print "KO: tepal"
465 \endcode
466 \n
467 </li>
468 </ul>
469
470
471 */