167 if $verbose; then echo
"! $command" 1>&2; fi
169 if test $? -ne 0; then
170 echo
"$0: error on command: $command" >&2
191Point(1) = {a, 0, 0, h};
192Point(2) = {b, 0, 0, h};
195if $sides || $corner; then
196 echo
"Physical Point(\"left\") = {1};"
197 echo
"Physical Point(\"right\") = {2};"
200 echo
"Physical Point(\"boundary\") = {1,2};"
202echo
"Physical Line(\"interior\") = {3};"
219echo
"a = $a; b = $b;"
220echo
"c = $c; d = $d;"
221if test $variant = t -o $variant = tq; then
222 echo
"h = 1.0*(b-a)/n;"
224 echo
"h = 2.0*(b-a)/n;"
227Point(1) = {a, c, 0, h};
228Point(2) = {b, c, 0, h};
229Point(3) = {b, d, 0, h};
230Point(4) = {a, d, 0, h};
235Line Loop(5) = {1,2,3,4};
237Plane Surface(6) = {5} ;
239if test $variant = q; then
240 echo
"Mesh.RecombinationAlgorithm = 1;"
241 echo
"Mesh.SubdivisionAlgorithm = 1;"
242 echo
"Recombine Surface {6};"
244if test $variant = tq; then
245 echo
"Mesh.RecombinationAlgorithm = 0;"
247 echo
"Recombine Surface {6} = angle;"
250 echo
"Physical Point(\"left_bottom\") = {1};"
251 echo
"Physical Point(\"right_bottom\") = {2};"
252 echo
"Physical Point(\"right_top\") = {3};"
253 echo
"Physical Point(\"left_top\") = {4};"
256 echo
"Physical Line(\"boundary\") = {1,2,3,4};"
259 echo
"Physical Line(\"bottom\") = {1};"
260 echo
"Physical Line(\"right\") = {2};"
261 echo
"Physical Line(\"top\") = {3};"
262 echo
"Physical Line(\"left\") = {4};"
264echo
"Physical Surface(\"interior\") = {6};"
269mkgmsh_3d_T_TP_TPH () {
284a = $a; c = $c; f = $f;
285b = $b; d = $d; g = $g;
287if test $variant = T; then
290elif test $variant = TP; then
291 echo
"fg = (f+g)/2.0;"
294elif test $variant = TPH; then
295 echo
"cd = (c+d)/2.0;"
296 echo
"fg = (f+g)/2.0;"
302Point(1) = {a, c, f, h};
303Point(2) = {b, c, f, h};
304Point(3) = {b, $d, f, h};
305Point(4) = {a, $d, f, h};
306Point(5) = {a, c, $g, h};
307Point(6) = {b, c, $g, h};
308Point(7) = {b, $d, $g, h};
309Point(8) = {a, $d, $g, h};
322Line Loop(21) = {-1,-4,-3,-2};
323Line Loop(22) = {5,6,7,8};
324Line Loop(23) = {1,10,-5,-9};
325Line Loop(25) = {2,11,-6,-10};
326Line Loop(24) = {12,-7,-11,3};
327Line Loop(26) = {9,-8,-12,4};
328Plane Surface(31) = {21} ;
329Plane Surface(32) = {22} ;
330Plane Surface(33) = {23} ;
331Plane Surface(34) = {24} ;
332Plane Surface(35) = {25} ;
333Plane Surface(36) = {26} ;
334Surface Loop(41) = {31,32,33,34,35,36};
337if test $variant = TP; then
338 echo
"extr[] = Extrude{0,0,(g-f)/2}{ Surface{32}; Layers{n/2}; Recombine;};"
339elif test $variant = TPH; then
340 echo
"extr_y[] = Extrude{0,(d-c)/2,0}{ Surface{34}; Layers{n/2}; Recombine;};"
341 echo
"extr_z[] = Extrude{0,0,(g-f)/2}{ Surface{32,extr_y[3]}; Layers{n/2}; Recombine;};"
343if test $variant = T; then
345 echo
"Physical Surface(\"boundary\") = {31, 32, 33, 34, 35, 36};"
348 echo
"Physical Surface(\"bottom\") = {31};"
349 echo
"Physical Surface(\"top\") = {32};"
350 echo
"Physical Surface(\"left\") = {33};"
351 echo
"Physical Surface(\"front\") = {35};"
352 echo
"Physical Surface(\"right\") = {34};"
353 echo
"Physical Surface(\"back\") = {36};"
355 echo
"Physical Volume(\"internal\") = {51};"
356elif test $variant = TP; then
358 echo
"Physical Surface(\"boundary\") = {31, extr[0], 33, extr[2], 35, extr[3], 34, extr[4], 36, extr[5]};"
361 echo
"Physical Surface(\"bottom\") = {31};"
362 echo
"Physical Surface(\"top\") = {extr[0]};"
363 echo
"Physical Surface(\"left\") = {33, extr[2]};"
364 echo
"Physical Surface(\"front\") = {35, extr[3]};"
365 echo
"Physical Surface(\"right\") = {34, extr[4]};"
366 echo
"Physical Surface(\"back\") = {36, extr[5]};"
368 echo
"Physical Volume(\"internal\") = {51,extr[1]};"
369elif test $variant = TPH; then
371 echo
"Physical Surface(\"boundary\") = {31, extr_y[5], extr_z[0], extr_z[6],"
372 echo
" 33,extr_z[2], 35, extr_y[4], extr_z[3], extr_z[9],"
373 echo
" extr_y[0],extr_z[10], 36, extr_y[2], extr_z[5], extr_z[11]};"
376 echo
"Physical Surface(\"bottom\") = {31, extr_y[5]};"
377 echo
"Physical Surface(\"top\") = {extr_z[0], extr_z[6]};"
378 echo
"Physical Surface(\"left\") = {33,extr_z[2]};"
379 echo
"Physical Surface(\"front\") = {35, extr_y[4], extr_z[3], extr_z[9]};"
380 echo
"Physical Surface(\"right\") = {extr_y[0],extr_z[10]};"
381 echo
"Physical Surface(\"back\") = {36, extr_y[2], extr_z[5], extr_z[11]};"
383 echo
"Physical Volume(\"internal\") = {51,extr_y[1],extr_z[1],extr_z[7]};"
402if test $variant = H -a $n -ne 1; then
407a = $a; c = $c; f = $f;
408b = $b; d = $d; g = $g;
410Point(1) = {a, c, f, h};
411Point(2) = {b, c, f, h};
412Point(6) = {b, c, g, h};
413Point(5) = {a, c, g, h};
418Line Loop(300) = {1,6,-9,-5};
421if test $variant = P; then
422 echo
"Plane Surface(3) = {300};"
423elif test $variant = H; then
424 echo
"Plane Surface(3) = {300};"
425 echo
"Mesh.SubdivisionAlgorithm = 1;"
426 echo
"Mesh.RecombinationAlgorithm = 1;"
427 echo
"Recombine Surface {3};"
428 echo
"Mesh.SubdivisionAlgorithm = 2;"
429elif test $variant = PH; then
430 echo
"Plane Surface(3) = {300};"
431 echo
"Mesh.RecombinationAlgorithm = 0;"
433 echo
"Recombine Surface {3} = angle;"
435echo
"extr[] = Extrude{0,d-c,0}{ Surface{3}; Layers{n}; Recombine;};"
437 echo
"Physical Surface(\"boundary\") = {-extr[2], -extr[4], 3, -extr[3], -extr[0], -extr[5]};"
440 echo
"Physical Surface(\"bottom\") = {-extr[2]};"
441 echo
"Physical Surface(\"top\") = {-extr[4]};"
442 echo
"Physical Surface(\"left\") = {3};"
443 echo
"Physical Surface(\"front\") = {-extr[3]};"
444 echo
"Physical Surface(\"right\") = {-extr[0]};"
445 echo
"Physical Surface(\"back\") = {-extr[5]};"
447echo
"Physical Volume(\"interior\") = {extr[1]};"
459 T*) mkgmsh_3d_T_TP_TPH $*;;
460 *) mkgmsh_3d_P_H_PH $*;;
468 [-{eptqTPH}|-tq|-TP|-PH|-TPH]
498 -h) echo ${usage} >&2; exit 0;;
499 -e) dim=1; variant=`echo x$1 | sed -e
's/x-//'`;;
500 -[tq]|-tq) dim=2; variant=`echo x$1 | sed -e
's/x-//'`;;
501 -[TPH]|-TP|-PH|-TPH) dim=3; variant=`echo x$1 | sed -e
's/x-//'`;;
502 -[abcdfg]) var=`echo x$1 | sed -e
's/x-//'`
503 if test x
"$2" = x
""; then echo ${usage} >&2; exit 1; fi
509 -order) order=$2; shift;;
511 -nosides) sides=false;;
512 -boundary) boundary=true;;
513 -noboundary) boundary=false;;
514 -corner) corner=true;;
515 -nocorner) corner=false;;
516 -verbose) verbose=true;;
517 -noverbose) verbose=false;;
519 -noclean) clean=false;;
521 if test x
"$2" = x
""; then echo ${usage} >&2; exit 1; fi
525 *) echo ${usage} >&2; exit 1;;
539mkgmsh $dim $variant $n $sides $boundary $corner $a $b $c $d $f $g > $tmp.mshcad
540my_eval
"gmsh -$dim -order $order -format msh2 $tmp.mshcad -o $tmp.msh > $tmp.log"
541if test ! -f $tmp.msh; then
542 echo
"$0: gmsh failed"
545MSH2GEO=
"${bindir}msh2geo"
547my_eval
"$MSH2GEO $tmp.msh"
552 my_eval
"rm -f $tmp.mshcad $tmp.log $tmp.msh"